Merge rule_ents from conditional block are dropped

In the following policy, "ptrace" would be dropped during merging:
```
$FOO=true
/bin/true {
  if $FOO {
      ptrace,
  }
}
```

Current behavior:
```
----- Debugging built structures -----
Name:		/bin/true
Local To:	<NULL>
Mode: 
```

With patch:
```
----- Debugging built structures -----
Name:		/bin/true
Local To:	<NULL>
Mode: 
ptrace,
```

I am quite new to the AA code base, so please let me know if I'm missing something obvious and this is intended behavior :)

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1551
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
This commit is contained in:
John Johansen 2025-02-18 22:33:32 +00:00
commit 46335d58cf

View file

@ -178,6 +178,8 @@ Profile *merge_policy(Profile *a, Profile *b)
}
}
a->rule_ents.splice(a->rule_ents.end(), b->rule_ents);
merge_hats(a, b->hat_table);
delete b;
out: