Skip to content

Commit

Permalink
policy/cap_userns: fix for kernels >= v5.12
Browse files Browse the repository at this point in the history
Starting with Linux v5.12 CAP_SETFCAP is required to map UID 0/root.
This is due to kernel commit db2e718a4798 ("capabilities: require
CAP_SETFCAP to map uid 0").  In order to resolve this in the test
suite allow the cap_userns test domains to exercise the setfcap
capability.

Signed-off-by: Paul Moore <paul@paul-moore.com>
[OM: moved the new rule under "Rules common to both domains" and tweaked
 the subject]
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
  • Loading branch information
pcmoore authored and WOnder93 committed Apr 27, 2021
1 parent 1defa85 commit fd4254f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions policy/test_cap_userns.te
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ typeattribute test_no_cap_userns_t capusernsdomain;
# Rules common to both domains.
miscfiles_domain_entry_test_files(capusernsdomain)
corecmd_exec_bin(capusernsdomain)

# linux >= v5.12 needs setfcap to map UID 0
allow capusernsdomain self:capability setfcap;

0 comments on commit fd4254f

Please sign in to comment.