• Jann Horn's avatar
    selinux: move user accesses in selinuxfs out of locked regions · 0da74120
    Jann Horn authored
    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: 1da177e4 ("Linux-2.6.12-rc2")
    Signed-off-by: default avatarJann Horn <jannh@google.com>
    Acked-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
    [PM: removed an unused variable in sel_read_policy()]
    Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
    0da74120
selinuxfs.c 48.2 KB