arch/um/os-Linux/start_up.c
Source file repositories/reference/linux-study-clean/arch/um/os-Linux/start_up.c
File Facts
- System
- Linux kernel
- Corpus path
arch/um/os-Linux/start_up.c- Extension
.c- Size
- 12146 bytes
- Lines
- 496
- Domain
- Architecture Layer
- Bucket
- arch/um
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdio.hstdlib.hstdarg.hunistd.herrno.hfcntl.hsched.hsignal.hstring.hsys/mman.hsys/stat.hsys/wait.hsys/time.hsys/resource.hasm/ldt.hasm/unistd.hinit.hos.hsmp.hkern_util.hmem_user.hptrace_user.hstdbool.hstub-data.hsys/prctl.hlinux/seccomp.hlinux/filter.hsysdep/mcontext.hsysdep/stub.hregisters.hskas.hinternal.h
Detected Declarations
function Copyrightfunction fatal_perrorfunction fatalfunction non_fatalfunction start_ptraced_childfunction stop_ptraced_childfunction check_sysemufunction check_ptracefunction sigsys_handlerfunction seccomp_helperfunction init_seccompfunction check_coredump_limitfunction get_host_cpu_featuresfunction uml_seccomp_configfunction os_early_checks
Annotated Snippet
ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) {
perror("ptrace");
kill(pid, SIGKILL);
}
kill(pid, SIGSTOP);
/*
* This syscall will be intercepted by the parent. Don't call more than
* once, please.
*/
sc_result = os_getpid();
if (sc_result == pid)
/* Nothing modified by the parent, we are running normally. */
ret = 1;
else if (sc_result == ppid)
/*
* Expected in check_ptrace and check_sysemu when they succeed
* in modifying the stack frame
*/
ret = 0;
else
/* Serious trouble! This could be caused by a bug in host 2.6
* SKAS3/2.6 patch before release -V6, together with a bug in
* the UML code itself.
*/
ret = 2;
exit(ret);
}
static void fatal_perror(const char *str)
{
perror(str);
exit(1);
}
static void fatal(char *fmt, ...)
{
va_list list;
va_start(list, fmt);
vfprintf(stderr, fmt, list);
va_end(list);
exit(1);
}
static void non_fatal(char *fmt, ...)
{
va_list list;
va_start(list, fmt);
vfprintf(stderr, fmt, list);
va_end(list);
}
static int start_ptraced_child(void)
{
int pid, n, status;
fflush(stdout);
pid = fork();
if (pid == 0)
ptrace_child();
else if (pid < 0)
fatal_perror("start_ptraced_child : fork failed");
CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
if (n < 0)
fatal_perror("check_ptrace : waitpid failed");
if (!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGSTOP))
fatal("check_ptrace : expected SIGSTOP, got status = %d",
status);
return pid;
}
static void stop_ptraced_child(int pid, int exitcode)
{
int status, n;
if (ptrace(PTRACE_CONT, pid, 0, 0) < 0)
fatal_perror("stop_ptraced_child : ptrace failed");
CATCH_EINTR(n = waitpid(pid, &status, 0));
if (!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) {
int exit_with = WEXITSTATUS(status);
fatal("stop_ptraced_child : child exited with exitcode %d, "
Annotation
- Immediate include surface: `stdio.h`, `stdlib.h`, `stdarg.h`, `unistd.h`, `errno.h`, `fcntl.h`, `sched.h`, `signal.h`.
- Detected declarations: `function Copyright`, `function fatal_perror`, `function fatal`, `function non_fatal`, `function start_ptraced_child`, `function stop_ptraced_child`, `function check_sysemu`, `function check_ptrace`, `function sigsys_handler`, `function seccomp_helper`.
- Atlas domain: Architecture Layer / arch/um.
- 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.