BM/cet: add signal/thread/legacy SHSTK and kernel IBT cases - #603
Merged
Merged
Conversation
Add the missing CET shadow stack cases into BM/cet: - sig_stack.c: CET signal stack test, verify the signal-triggered function is protected by SHSTK (bare "a" access check and cp_test "s" violation). - cet_thread.c: SHSTK violation in a new thread should be #CP blocked. Accept upstream SEGV_CPERR(3) in addition to the legacy si_code 8|10 so the case works on mainline kernels. - glibc_shstk_test_legacy: build glibc_shstk_test.c without CET protection (NOCETFLAGS) and verify none of the violation params trigger #CP (no_cp). - test_shadow_stack.c: treat an EINVAL from UFFDIO_REGISTER on a shadow stack VMA as SKIP, since recent kernels reject userfaultfd registration of special VMAs. Kernel IBT b1/b2 cases: - cet_tests.sh: kmod_ibt_illegal triggers a kernel-space missing-ENDBR #CP; block the case unless the kernel is booted with ibt=warn (and block on ibt=off) to avoid crashing the host. - load_cet_driver block_tests with a clear message pointing at the required kernel-devel/headers when cet_ioctl.ko is missing. - cet_driver/Makefile: fail early with an actionable error when the kernel build dir is absent, and suppress the module's missing-prototype/declaration warnings on -Werror kernels. - cet_driver/cet_ioctl.h: guard CPUID_LEAF_XSTATE so it does not conflict with the kernel's own definition. Document the ibt=warn requirement in the tests list and README, and wire the new binaries into Makefile, CMakeLists.txt and .gitignore. Co-authored-by: GitHub Copilot <copilot@github.com> Signed-off-by: Farrah Chen <farrah.chen@intel.com> (cherry picked from commit 8e9069c323d408fcd75b4b61ee669b8fe3fc5425)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add the missing CET shadow stack cases into BM/cet:
Kernel IBT b1/b2 cases:
Document the ibt=warn requirement in the tests list and README, and wire the new binaries into Makefile, CMakeLists.txt and .gitignore.
(cherry picked from commit 8e9069c323d408fcd75b4b61ee669b8fe3fc5425)