forked from analogdevicesinc/linux
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PATCH] fuse: scramble lock owner ID
VFS uses current->files pointer as lock owner ID, and it wouldn't be prudent to expose this value to userspace. So scramble it with XTEA using a per connection random key, known only to the kernel. Only one direction needs to be implemented, since the ID is never sent in the reverse direction. The XTEA algorithm is implemented inline since it's simple enough to do so, and this adds less complexity than if the crypto API were used. Thanks to Jesper Juhl for the idea. Signed-off-by: Miklos Szeredi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
- Loading branch information
Showing
3 changed files
with
25 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
#include <linux/module.h> | ||
#include <linux/parser.h> | ||
#include <linux/statfs.h> | ||
#include <linux/random.h> | ||
|
||
MODULE_AUTHOR("Miklos Szeredi <[email protected]>"); | ||
MODULE_DESCRIPTION("Filesystem in Userspace"); | ||
|
@@ -387,6 +388,7 @@ static struct fuse_conn *new_conn(void) | |
fc->bdi.unplug_io_fn = default_unplug_io_fn; | ||
fc->reqctr = 0; | ||
fc->blocked = 1; | ||
get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key)); | ||
} | ||
return fc; | ||
} | ||
|