mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-05 15:49:42 -04:00
Merge tag 'apparmor-pr-2024-01-03' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor
Pull apparmor fix from John Johansen: "Detect that the source mount is not in the namespace and if it isn't don't use it as a source path match. This prevent apparmor from applying the attach_disconnected flag to move_mount() source which prevents detached mounts from appearing as / when applying mount mediation, which is not only incorrect but could result in bad policy being generated" * tag 'apparmor-pr-2024-01-03' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor: apparmor: Fix move_mount mediation by detecting if source is detached
This commit is contained in:
@@ -2373,6 +2373,7 @@ static struct aa_sfs_entry aa_sfs_entry_policy[] = {
|
||||
|
||||
static struct aa_sfs_entry aa_sfs_entry_mount[] = {
|
||||
AA_SFS_FILE_STRING("mask", "mount umount pivot_root"),
|
||||
AA_SFS_FILE_STRING("move_mount", "detached"),
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
@@ -499,6 +499,10 @@ int aa_move_mount(const struct cred *subj_cred,
|
||||
error = -ENOMEM;
|
||||
if (!to_buffer || !from_buffer)
|
||||
goto out;
|
||||
|
||||
if (!our_mnt(from_path->mnt))
|
||||
/* moving a mount detached from the namespace */
|
||||
from_path = NULL;
|
||||
error = fn_for_each_confined(label, profile,
|
||||
match_mnt(subj_cred, profile, to_path, to_buffer,
|
||||
from_path, from_buffer,
|
||||
|
||||
Reference in New Issue
Block a user