]> git.baikalelectronics.ru Git - kernel.git/commit
compat_ioctl: don't call do_ioctl under set_fs(KERNEL_DS)
authorJann Horn <jann@thejh.net>
Tue, 5 Jan 2016 17:27:30 +0000 (18:27 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 9 Jan 2016 02:18:13 +0000 (21:18 -0500)
commita9d18e120bdff39245cf0ff6c50b19c059880d41
tree1a789dfbe2d49a18745416914e090425c44ae454
parentb6df50786203714453feb7da315f01a17f144e1e
compat_ioctl: don't call do_ioctl under set_fs(KERNEL_DS)

This replaces all code in fs/compat_ioctl.c that translated
ioctl arguments into a in-kernel structure, then performed
do_ioctl under set_fs(KERNEL_DS), with code that allocates
data on the user stack and can call the VFS ioctl handler
under USER_DS.

This is done as a hardening measure because the caller
does not know what kind of ioctl handler will be invoked,
only that no corresponding compat_ioctl handler exists and
what the ioctl command number is. The accidental
invocation of an unlocked_ioctl handler that unexpectedly
calls copy_to_user could be a severe security issue.

Signed-off-by: Jann Horn <jann@thejh.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/compat_ioctl.c