RFE: Add SCMP_ACT_TRAPX() #469
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is my first cut at addressing Issue #466. I'm open to discussion on other or better ways to handle it.
I decided to add
SCMP_ACT_TRAPX()(similar toSCMP_ACT_ERRNO()) where the user can specify the lower 16 bits of the action. These lower 16 bits are then fed into the si_errno field in the siginfo structure that is sent to the signal trap handler.With that said, this feature has been in seccomp since it was added in 2012, and no user has requested it. In fact, it looks like it was found by debugging and snooping around in the source code :). I don't think most users care about it, so I have chosen to make this invisible to users by remapping
SCMP_ACT_TRAPtoSCMP_ACT_TRAPX(0). When users upgrade to a version of libseccomp with this feature, everything will behave as they have before.If a user wants to use this feature, then they'll have to specifically use the
SCMP_ACT_TRAPX()action. Its usage is clearly outlined in test 63-live-trapx.c