Intercepting memory mapped files

Valdis.Kletnieks at Valdis.Kletnieks at
Fri Jan 30 08:13:54 EST 2015

On Fri, 30 Jan 2015 17:18:21 +0530, Kunal Baweja said:

> void encrypt(char *data, char *encrypted, size_t size)
> {
>     unsigned int i;
>     for(i=0;i<(unsigned int)size;i++)
>         encrypted[i] = data[i] + 3;
>     printk(KERN_INFO "%s",encrypted);
>     return;
> }
> So in the given code wherever u see the calls to *wrapfs_encrypt*, I have
> replaced with my simpler encryption function.
> But I am not able to figure out why calling this function creates a
> problem, the printk() statement inside the function shows me the correctly
> encrypted contents but the file is still blank.

Stupid question, but... once you call encrypt(data, encrypted, size),
do you then write out the 'encrypted' buffer, or do you write out 'data'?

(Bonus points for avoiding a memory leak here :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : 

More information about the Kernelnewbies mailing list