mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 18:17:09 +00:00
Make meaning of leading permissions consistent with trailing permissions
x Permissions when specified as a the start of the rule had a differnt meaning than when they appeared at the tail of a rule. Specifically px,cx,ux were not treated as unsafe when they appeared at the start of the rule. px /foo, instead of at the tail of the rule /foo px, the keyword unsafe had to be used to force the rule to cause the x transitio to be its unsafe variant. Fix leading permissions so that they are consistent with file rules that use trailing permissions. Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
c059224811
commit
4eea3ae073
@ -879,11 +879,12 @@ opt_unsafe: { /* nothing */ $$ = 0; }
|
|||||||
|
|
||||||
rule: opt_unsafe file_mode opt_subset_flag id_or_var opt_named_transition TOK_END_OF_RULE
|
rule: opt_unsafe file_mode opt_subset_flag id_or_var opt_named_transition TOK_END_OF_RULE
|
||||||
{
|
{
|
||||||
int mode = $2 & ~ALL_AA_EXEC_UNSAFE;
|
int mode = $2;
|
||||||
if ($1) {
|
if ($1) {
|
||||||
if (!($2 & AA_EXEC_BITS))
|
if (!($2 & AA_EXEC_BITS))
|
||||||
yyerror(_("unsafe rule missing exec permissions"));
|
yyerror(_("unsafe rule missing exec permissions"));
|
||||||
mode |= (($2 & AA_EXEC_BITS) << 8) & ALL_AA_EXEC_UNSAFE;
|
mode = ($2 & ~ALL_AA_EXEC_UNSAFE) |
|
||||||
|
((($2 & AA_EXEC_BITS) << 8) & ALL_AA_EXEC_UNSAFE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($3 && ($2 & ~AA_LINK_BITS))
|
if ($3 && ($2 & ~AA_LINK_BITS))
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
#
|
|
||||||
#=DESCRIPTION test pix - in forward perms P and p are the same and the
|
|
||||||
# unsafe keyword is required. So these should conflict
|
|
||||||
#=EXRESULT FAIL
|
|
||||||
#
|
|
||||||
/usr/bin/foo {
|
|
||||||
/bin/cat pix,
|
|
||||||
/bin/foo Pix,
|
|
||||||
/bin/bar pIx,
|
|
||||||
/bin/a PIx,
|
|
||||||
|
|
||||||
pix /bin/cat,
|
|
||||||
Pix /bin/foo,
|
|
||||||
pIx /bin/bar,
|
|
||||||
PIx /bin/a,
|
|
||||||
}
|
|
@ -9,7 +9,7 @@
|
|||||||
/bin/a PIx,
|
/bin/a PIx,
|
||||||
|
|
||||||
unsafe pix /bin/cat,
|
unsafe pix /bin/cat,
|
||||||
pix /bin/foo,
|
Pix /bin/foo,
|
||||||
unsafe pix /bin/bar,
|
unsafe pix /bin/bar,
|
||||||
pix /bin/a,
|
Pix /bin/a,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user