tools/objtool/signal.c
Source file repositories/reference/linux-study-clean/tools/objtool/signal.c
File Facts
- System
- Linux kernel
- Corpus path
tools/objtool/signal.c- Extension
.c- Size
- 2865 bytes
- Lines
- 136
- 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.hstdlib.hsignal.hunistd.hsys/resource.hstring.hobjtool/objtool.hobjtool/warn.h
Detected Declarations
function is_stack_overflowfunction signal_handlerfunction read_stack_limitfunction init_signal_handler
Annotated Snippet
if (strstr(line, "[stack]")) {
if (sscanf(line, "%lx-%lx", &stack_start, &stack_end) != 2) {
ERROR_GLIBC("sscanf");
ret = -1;
goto done;
}
stack_limit = stack_end - rlim.rlim_cur;
goto done;
}
}
ret = -1;
ERROR("/proc/self/maps: can't find [stack]");
done:
fclose(fp);
return ret;
}
int init_signal_handler(void)
{
int signals[] = {SIGSEGV, SIGBUS, SIGILL, SIGABRT};
struct sigaction sa;
stack_t ss;
if (read_stack_limit())
return -1;
ss.ss_sp = malloc(SIGSTKSZ);
if (!ss.ss_sp) {
ERROR_GLIBC("malloc");
return -1;
}
ss.ss_size = SIGSTKSZ;
ss.ss_flags = 0;
if (sigaltstack(&ss, NULL) == -1) {
ERROR_GLIBC("sigaltstack");
return -1;
}
sa.sa_sigaction = signal_handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_ONSTACK | SA_SIGINFO;
for (int i = 0; i < ARRAY_SIZE(signals); i++) {
if (sigaction(signals[i], &sa, NULL) == -1) {
ERROR_GLIBC("sigaction");
return -1;
}
}
return 0;
}
Annotation
- Immediate include surface: `stdio.h`, `stdlib.h`, `signal.h`, `unistd.h`, `sys/resource.h`, `string.h`, `objtool/objtool.h`, `objtool/warn.h`.
- Detected declarations: `function is_stack_overflow`, `function signal_handler`, `function read_stack_limit`, `function init_signal_handler`.
- 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.