-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ruleset: Fix compatibility inconsistency
When adding a rule to a ruleset created with ABI::Unsupported, its compatibility state could change from CompatLevel::No to CompatLevel::Partial, which is wrong and could lead to an unexpected error when trying to restrict the caller with -1 as a ruleset file descriptor. This is especially visible with a following change to prioritize error over incompatibility. Fix that by setting the mapping of ABI::Unsupported to CompatLevel::Dummy instead of CompatLevel::No. As a side effect, prctl(PR_SET_NO_NEW_PRIVS, 1) is now always called when no_new_privs is set to true. This was not the case before when the ruleset's compatibility level was explicitly set to SoftRequirement. This means that no RestrictSelfError::SetNoNewPrivsCall can now be returned in this specific case. The rationale is that no_new_privs was introduced with Linux 3.5 whereas the oldest supported kernel is now Linux 4.19 . It is not worth it to handle compatibility complexity for such widely available feature. Moreover, this new behavior lead to a more deterministic and secure execution, and no error should be returned by the kernel. Add tests to check theses changes, and change some existing tests to follow the new logic. Signed-off-by: Mickaël Salaün <[email protected]>
- Loading branch information
Showing
3 changed files
with
79 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters