From 617d3021e83622c7c38dfd3bf06d886b671d16bb Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Mon, 4 Aug 2025 00:08:26 +0200 Subject: [PATCH 1/2] parser: drop dead code in mount.cc perms = 0, therefore perms & something is always false. Fixes: coverity#320937 and coverity#320937 --- parser/mount.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/parser/mount.cc b/parser/mount.cc index 31f38c825..2c1756b19 100644 --- a/parser/mount.cc +++ b/parser/mount.cc @@ -1170,10 +1170,6 @@ void mnt_rule::post_parse_profile(Profile &prof) exit(1); } - if (perms & AA_USER_EXEC) - perms |= SHIFT_PERMS(n << 10, AA_USER_SHIFT); - if (perms & AA_OTHER_EXEC) - perms |= SHIFT_PERMS(n << 10, AA_OTHER_SHIFT); perms = ((perms & ~AA_ALL_EXEC_MODIFIERS) | (perms & AA_ALL_EXEC_MODIFIERS)); From 0de9678d4fa1911bfd60e58bd748095dee03ac28 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Mon, 4 Aug 2025 19:35:26 +0200 Subject: [PATCH 2/2] mount.cc: remove nop code from mnt_rule::post_parse_profile(Profile &prof) ... as discussed in https://gitlab.com/apparmor/apparmor/-/merge_requests/1759#note_2665952086 --- parser/mount.cc | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/parser/mount.cc b/parser/mount.cc index 2c1756b19..3d9df7d88 100644 --- a/parser/mount.cc +++ b/parser/mount.cc @@ -1163,17 +1163,7 @@ fail: void mnt_rule::post_parse_profile(Profile &prof) { if (trans) { - perm32_t perms = 0; - int n = add_entry_to_x_table(&prof, trans); - if (!n) { - PERROR("Profile %s has too many specified profile transitions.\n", prof.name); - exit(1); - } - - perms = ((perms & ~AA_ALL_EXEC_MODIFIERS) | - (perms & AA_ALL_EXEC_MODIFIERS)); - - trans = NULL; + /* TODO: pivot_root profile transition */ } }