diff options
| author | Georgia Garcia <georgia.garcia@canonical.com> | 2026-10-16 19:08:51 -0300 |
|---|---|---|
| committer | John Johansen <john.johansen@canonical.com> | 2026-10-28 20:16:29 -0700 |
| commit | a913281f600157aa036b7c02afbb18a0ac115187 (patch) | |
| tree | d1f67c5c01c531f4ce8c56696b6c962d74462963 /scripts/Makefile.thinlto | |
| parent | 4de32fd05ce9e63b492899215ea929e7d306cdab (diff) | |
| download | linux-a913281f600157aa036b7c02afbb18a0ac115187.tar.gz linux-a913281f600157aa036b7c02afbb18a0ac115187.zip | |
apparmor: don't revalidate inherited files under files->file_lock
aa_inherit_files() revalidates inherited files on exec using
iterate_fd(), which calls the callback with files->file_lock held,
so the revalidation is done with IN_ATOMIC. However the unix socket
mediation path can sleep: aa_unix_file_perm() drops a ref on the
peer's path with path_put(), and unix_fs_perm() -> aa_path_perm()
allocates a buffer with aa_get_buffer(false), resulting in
BUG: sleeping function called from invalid context at fs/dcache.c:1039
...
dput.part.0+0x24/0x180
path_put+0x2c/0x60
aa_unix_file_perm+0x42a/0x17b0
aa_file_perm+0xcd3/0x1060
match_file+0x10b/0x190
iterate_fd+0xe6/0x280
aa_inherit_files+0x250/0x4f0
Only grab a ref on each file under iterate_fd(), and revalidate it
after the lock is dropped, so revalidation is done with no locks held
and does not need to be atomic. Denied fds are still replaced with
/dev/null, or closed if it can not be opened.
Fixes: b1aea2c19607 ("apparmor: fix race in unix socket mediation when peer_path is used")
Cc: stable@vger.kernel.org
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
