]> git.baikalelectronics.ru Git - kernel.git/commit
fuse: Fix parameter for FS_IOC_{GET,SET}FLAGS
authorChirantan Ekbote <chirantan@chromium.org>
Tue, 14 Jul 2020 10:26:39 +0000 (19:26 +0900)
committerMiklos Szeredi <mszeredi@redhat.com>
Wed, 15 Jul 2020 12:18:20 +0000 (14:18 +0200)
commit7b3f395b644b1134e46a31e5084e45bb3362488c
treecc8d2ed44516dd759324d0452f2ccb880b360a70
parent937f0da47372df138de4c197311382fe23f3d29f
fuse: Fix parameter for FS_IOC_{GET,SET}FLAGS

The ioctl encoding for this parameter is a long but the documentation says
it should be an int and the kernel drivers expect it to be an int.  If the
fuse driver treats this as a long it might end up scribbling over the stack
of a userspace process that only allocated enough space for an int.

This was previously discussed in [1] and a patch for fuse was proposed in
[2].  From what I can tell the patch in [2] was nacked in favor of adding
new, "fixed" ioctls and using those from userspace.  However there is still
no "fixed" version of these ioctls and the fact is that it's sometimes
infeasible to change all userspace to use the new one.

Handling the ioctls specially in the fuse driver seems like the most
pragmatic way for fuse servers to support them without causing crashes in
userspace applications that call them.

[1]: https://lore.kernel.org/linux-fsdevel/20131126200559.GH20559@hall.aurel32.net/T/
[2]: https://sourceforge.net/p/fuse/mailman/message/31771759/

Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
Fixes: 3a2ea24ef112 ("fuse: implement ioctl support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/file.c