]> git.baikalelectronics.ru Git - kernel.git/commit
selinux: move user accesses in selinuxfs out of locked regions
authorJann Horn <jannh@google.com>
Fri, 29 Jun 2018 00:39:54 +0000 (20:39 -0400)
committerPaul Moore <paul@paul-moore.com>
Fri, 29 Jun 2018 00:39:54 +0000 (20:39 -0400)
commit074bfa254fa09d8611b0240f42745ed19881d8d4
treecef6a54c640bb2ddfcc927d8d869b6e390057102
parent345adf7df4793b657ded77e8962b65c31b96fb42
selinux: move user accesses in selinuxfs out of locked regions

If a user is accessing a file in selinuxfs with a pointer to a userspace
buffer that is backed by e.g. a userfaultfd, the userspace access can
stall indefinitely, which can block fsi->mutex if it is held.

For sel_read_policy(), remove the locking, since this method doesn't seem
to access anything that requires locking.

For sel_read_bool(), move the user access below the locked region.

For sel_write_bool() and sel_commit_bools_write(), move the user access
up above the locked region.

Cc: stable@vger.kernel.org
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Jann Horn <jannh@google.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
[PM: removed an unused variable in sel_read_policy()]
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/selinuxfs.c