arch/arm/kernel/signal.c
Source file repositories/reference/linux-study-clean/arch/arm/kernel/signal.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/kernel/signal.c- Extension
.c- Size
- 18566 bytes
- Lines
- 719
- Domain
- Architecture Layer
- Bucket
- arch/arm
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/errno.hlinux/random.hlinux/signal.hlinux/personality.hlinux/uaccess.hlinux/resume_user_mode.hlinux/uprobes.hlinux/syscalls.hasm/elf.hasm/cacheflush.hasm/traps.hasm/unistd.hasm/vfp.hasm/syscalls.hsignal.h
Detected Declarations
function preserve_iwmmxt_contextfunction restore_iwmmxt_contextfunction preserve_vfp_contextfunction restore_vfp_contextfunction restore_sigframefunction sys_sigreturnfunction sys_rt_sigreturnfunction setup_sigframefunction get_sigframefunction setup_returnfunction setup_framefunction setup_rt_framefunction handle_signalfunction do_signalfunction do_work_pendingfunction do_rseq_syscall
Annotated Snippet
if (thumb) {
cpsr |= PSR_T_BIT;
} else
cpsr &= ~PSR_T_BIT;
}
#endif
if (ksig->ka.sa.sa_flags & SA_RESTORER) {
retcode = (unsigned long)ksig->ka.sa.sa_restorer;
if (fdpic) {
/*
* We need code to load the function descriptor.
* That code follows the standard sigreturn code
* (6 words), and is made of 3 + 2 words for each
* variant. The 4th copied word is the actual FD
* address that the assembly code expects.
*/
idx = 6 + thumb * 3;
if (ksig->ka.sa.sa_flags & SA_SIGINFO)
idx += 5;
if (__put_user(sigreturn_codes[idx], rc ) ||
__put_user(sigreturn_codes[idx+1], rc+1) ||
__put_user(sigreturn_codes[idx+2], rc+2) ||
__put_user(retcode, rc+3))
return 1;
goto rc_finish;
}
} else {
idx = thumb << 1;
if (ksig->ka.sa.sa_flags & SA_SIGINFO)
idx += 3;
/*
* Put the sigreturn code on the stack no matter which return
* mechanism we use in order to remain ABI compliant
*/
if (__put_user(sigreturn_codes[idx], rc) ||
__put_user(sigreturn_codes[idx+1], rc+1))
return 1;
rc_finish:
#ifdef CONFIG_MMU
if (cpsr & MODE32_BIT) {
struct mm_struct *mm = current->mm;
/*
* 32-bit code can use the signal return page
* except when the MPU has protected the vectors
* page from PL0
*/
retcode = mm->context.sigpage + signal_return_offset +
(idx << 2) + thumb;
} else
#endif
{
/*
* Ensure that the instruction cache sees
* the return code written onto the stack.
*/
flush_icache_range((unsigned long)rc,
(unsigned long)(rc + 3));
retcode = ((unsigned long)rc) + thumb;
}
}
regs->ARM_r0 = ksig->sig;
regs->ARM_sp = (unsigned long)frame;
regs->ARM_lr = retcode;
regs->ARM_pc = handler;
if (fdpic)
regs->ARM_r9 = handler_fdpic_GOT;
regs->ARM_cpsr = cpsr;
return 0;
}
static int
setup_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
{
struct sigframe __user *frame = get_sigframe(ksig, regs, sizeof(*frame));
int err = 0;
if (!frame)
return 1;
/*
* Set uc.uc_flags to a value which sc.trap_no would never have.
*/
err = __put_user(0x5ac3c35a, &frame->uc.uc_flags);
Annotation
- Immediate include surface: `linux/errno.h`, `linux/random.h`, `linux/signal.h`, `linux/personality.h`, `linux/uaccess.h`, `linux/resume_user_mode.h`, `linux/uprobes.h`, `linux/syscalls.h`.
- Detected declarations: `function preserve_iwmmxt_context`, `function restore_iwmmxt_context`, `function preserve_vfp_context`, `function restore_vfp_context`, `function restore_sigframe`, `function sys_sigreturn`, `function sys_rt_sigreturn`, `function setup_sigframe`, `function get_sigframe`, `function setup_return`.
- Atlas domain: Architecture Layer / arch/arm.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.