tools/testing/selftests/powerpc/signal/sigfuz.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/powerpc/signal/sigfuz.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/powerpc/signal/sigfuz.c- Extension
.c- Size
- 8907 bytes
- Lines
- 326
- 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
stdio.hlimits.hsys/wait.hunistd.hstdlib.hsignal.hstring.hucontext.hsys/mman.hpthread.hutils.h
Detected Declarations
function one_in_chancefunction mess_with_tmfunction trap_signal_handlerfunction seg_signal_handlerfunction signal_fuzzerfunction show_helpfunction main
Annotated Snippet
if (tmp_uc) {
free(tmp_uc);
tmp_uc = NULL;
}
tmp_uc = malloc(sizeof(ucontext_t));
ucp->uc_link = tmp_uc;
/* Trying to cause a major page fault at Kernel level */
madvise(ucp->uc_link, sizeof(ucontext_t), MADV_DONTNEED);
}
if (args & ARG_MESS_WITH_MSR_AT) {
/* Changing the checkpointed registers */
if (one_in_chance(4)) {
ucp->uc_link->uc_mcontext.gp_regs[PT_MSR] |= MSR_TS_S;
} else {
if (one_in_chance(2)) {
ucp->uc_link->uc_mcontext.gp_regs[PT_MSR] |=
MSR_TS_T;
} else if (one_in_chance(2)) {
ucp->uc_link->uc_mcontext.gp_regs[PT_MSR] |=
MSR_TS_T | MSR_TS_S;
}
}
/* Checking the current register context */
if (one_in_chance(2)) {
ucp->uc_mcontext.gp_regs[PT_MSR] |= MSR_TS_S;
} else if (one_in_chance(2)) {
if (one_in_chance(2))
ucp->uc_mcontext.gp_regs[PT_MSR] |=
MSR_TS_T;
else if (one_in_chance(2))
ucp->uc_mcontext.gp_regs[PT_MSR] |=
MSR_TS_T | MSR_TS_S;
}
}
if (one_in_chance(20)) {
/* Nested transaction start */
if (one_in_chance(5))
mess_with_tm();
/* Return without changing any other context info */
return;
}
if (one_in_chance(10))
ucp->uc_mcontext.gp_regs[PT_MSR] = random();
if (one_in_chance(10))
ucp->uc_mcontext.gp_regs[PT_NIP] = random();
if (one_in_chance(10))
ucp->uc_link->uc_mcontext.gp_regs[PT_MSR] = random();
if (one_in_chance(10))
ucp->uc_link->uc_mcontext.gp_regs[PT_NIP] = random();
ucp->uc_mcontext.gp_regs[PT_TRAP] = random();
ucp->uc_mcontext.gp_regs[PT_DSISR] = random();
ucp->uc_mcontext.gp_regs[PT_DAR] = random();
ucp->uc_mcontext.gp_regs[PT_ORIG_R3] = random();
ucp->uc_mcontext.gp_regs[PT_XER] = random();
ucp->uc_mcontext.gp_regs[PT_RESULT] = random();
ucp->uc_mcontext.gp_regs[PT_SOFTE] = random();
ucp->uc_mcontext.gp_regs[PT_DSCR] = random();
ucp->uc_mcontext.gp_regs[PT_CTR] = random();
ucp->uc_mcontext.gp_regs[PT_LNK] = random();
ucp->uc_mcontext.gp_regs[PT_CCR] = random();
ucp->uc_mcontext.gp_regs[PT_REGS_COUNT] = random();
ucp->uc_link->uc_mcontext.gp_regs[PT_TRAP] = random();
ucp->uc_link->uc_mcontext.gp_regs[PT_DSISR] = random();
ucp->uc_link->uc_mcontext.gp_regs[PT_DAR] = random();
ucp->uc_link->uc_mcontext.gp_regs[PT_ORIG_R3] = random();
ucp->uc_link->uc_mcontext.gp_regs[PT_XER] = random();
ucp->uc_link->uc_mcontext.gp_regs[PT_RESULT] = random();
ucp->uc_link->uc_mcontext.gp_regs[PT_SOFTE] = random();
ucp->uc_link->uc_mcontext.gp_regs[PT_DSCR] = random();
ucp->uc_link->uc_mcontext.gp_regs[PT_CTR] = random();
ucp->uc_link->uc_mcontext.gp_regs[PT_LNK] = random();
ucp->uc_link->uc_mcontext.gp_regs[PT_CCR] = random();
ucp->uc_link->uc_mcontext.gp_regs[PT_REGS_COUNT] = random();
if (args & ARG_MESS_WITH_TM_BEFORE) {
if (one_in_chance(2))
mess_with_tm();
}
}
static void seg_signal_handler(int signo, siginfo_t *si, void *uc)
{
/* Clear exit for process that segfaults */
Annotation
- Immediate include surface: `stdio.h`, `limits.h`, `sys/wait.h`, `unistd.h`, `stdlib.h`, `signal.h`, `string.h`, `ucontext.h`.
- Detected declarations: `function one_in_chance`, `function mess_with_tm`, `function trap_signal_handler`, `function seg_signal_handler`, `function signal_fuzzer`, `function show_help`, `function main`.
- 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.