diff options
author | Mickaël Salaün <[email protected]> | 2024-08-21 11:56:05 +0200 |
---|---|---|
committer | Paul Moore <[email protected]> | 2024-09-09 12:30:51 -0400 |
commit | 26f204380a3c182e5adf1a798db0724d6111b597 (patch) | |
tree | c22246e6d080d721e19b632331f2b1e3c283c0ee /lib/crypto/mpi/mpi-sub-ui.c | |
parent | ce4a60592ee03e8f6900bf9bf2a6108cd1a9903c (diff) |
fs: Fix file_set_fowner LSM hook inconsistencies
The fcntl's F_SETOWN command sets the process that handle SIGIO/SIGURG
for the related file descriptor. Before this change, the
file_set_fowner LSM hook was always called, ignoring the VFS logic which
may not actually change the process that handles SIGIO (e.g. TUN, TTY,
dnotify), nor update the related UID/EUID.
Moreover, because security_file_set_fowner() was called without lock
(e.g. f_owner.lock), concurrent F_SETOWN commands could result to a race
condition and inconsistent LSM states (e.g. SELinux's fown_sid) compared
to struct fown_struct's UID/EUID.
This change makes sure the LSM states are always in sync with the VFS
state by moving the security_file_set_fowner() call close to the
UID/EUID updates and using the same f_owner.lock .
Rename f_modown() to __f_setown() to simplify code.
Cc: [email protected]
Cc: Al Viro <[email protected]>
Cc: Casey Schaufler <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: James Morris <[email protected]>
Cc: Jann Horn <[email protected]>
Cc: Ondrej Mosnacek <[email protected]>
Cc: Paul Moore <[email protected]>
Cc: Serge E. Hallyn <[email protected]>
Cc: Stephen Smalley <[email protected]>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Mickaël Salaün <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
Diffstat (limited to 'lib/crypto/mpi/mpi-sub-ui.c')
0 files changed, 0 insertions, 0 deletions