tools/testing/selftests/arm64/bti/test.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/arm64/bti/test.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/arm64/bti/test.c- Extension
.c- Size
- 4980 bytes
- Lines
- 230
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
system.hstdbool.hstddef.hlinux/errno.hlinux/auxvec.hlinux/signal.hasm/sigcontext.hasm/ucontext.hbtitest.hsignal.h
Detected Declarations
function fdputsfunction putstrfunction putnumfunction print_summaryfunction handlerfunction __do_testfunction start
Annotated Snippet
switch (auxv->type) {
case AT_HWCAP:
hwcap = auxv->val;
break;
case AT_HWCAP2:
hwcap2 = auxv->val;
break;
default:
break;
}
}
if (hwcap & HWCAP_PACA)
putstr("# HWCAP_PACA present\n");
else
putstr("# HWCAP_PACA not present\n");
if (hwcap2 & HWCAP2_BTI) {
putstr("# HWCAP2_BTI present\n");
if (!(hwcap & HWCAP_PACA))
putstr("# Bad hardware? Expect problems.\n");
have_bti = true;
} else {
putstr("# HWCAP2_BTI not present\n");
have_bti = false;
}
putstr("# Test binary");
if (!BTI)
putstr(" not");
putstr(" built for BTI\n");
sa.sa_handler = (sighandler_t)(void *)handler;
sa.sa_flags = SA_SIGINFO;
sigemptyset(&sa.sa_mask);
sigaction(SIGILL, &sa, NULL);
sigaddset(&sa.sa_mask, SIGILL);
sigprocmask(SIG_UNBLOCK, &sa.sa_mask, NULL);
do_test(1, 1, 1, nohint_func);
do_test(1, 1, 1, bti_none_func);
do_test(1, 0, 0, bti_c_func);
do_test(0, 0, 1, bti_j_func);
do_test(0, 0, 0, bti_jc_func);
do_test(1, 0, 0, paciasp_func);
print_summary();
if (test_num - 1 != EXPECTED_TESTS)
putstr("# WARNING - EXPECTED TEST COUNT WRONG\n");
if (test_failed)
exit(1);
else
exit(0);
}
Annotation
- Immediate include surface: `system.h`, `stdbool.h`, `stddef.h`, `linux/errno.h`, `linux/auxvec.h`, `linux/signal.h`, `asm/sigcontext.h`, `asm/ucontext.h`.
- Detected declarations: `function fdputs`, `function putstr`, `function putnum`, `function print_summary`, `function handler`, `function __do_test`, `function start`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.