arch/mips/kernel/signal.c
Source file repositories/reference/linux-study-clean/arch/mips/kernel/signal.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/kernel/signal.c- Extension
.c- Size
- 23466 bytes
- Lines
- 970
- Domain
- Architecture Layer
- Bucket
- arch/mips
- Inferred role
- Architecture Layer: syscall or user/kernel boundary
- Status
- core 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 participates in a user/kernel boundary; inspect argument validation, copy_from_user/copy_to_user, credentials, and dispatch target.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cache.hlinux/context_tracking.hlinux/irqflags.hlinux/sched.hlinux/mm.hlinux/personality.hlinux/smp.hlinux/kernel.hlinux/signal.hlinux/errno.hlinux/wait.hlinux/ptrace.hlinux/unistd.hlinux/uprobes.hlinux/compiler.hlinux/syscalls.hlinux/uaccess.hlinux/resume_user_mode.hasm/abi.hasm/asm.hlinux/bitops.hasm/cacheflush.hasm/fpu.hasm/sim.hasm/ucontext.hasm/cpu-features.hasm/dsp.hasm/inst.hasm/msa.hasm/syscalls.hsignal-common.h
Detected Declarations
syscall sigsuspendsyscall sigactionstruct sigframestruct rt_sigframefunction copy_fp_to_sigcontextfunction copy_fp_from_sigcontextfunction copy_fp_to_sigcontextfunction copy_fp_from_sigcontextfunction save_hw_fp_contextfunction restore_hw_fp_contextfunction save_msa_extcontextfunction restore_msa_extcontextfunction save_msa_extcontextfunction restore_msa_extcontextfunction save_extcontextfunction restore_extcontextfunction protected_save_fp_contextfunction protected_restore_fp_contextfunction setup_sigcontextfunction extcontext_max_sizefunction fpcsr_pendingfunction restore_sigcontextfunction sys_sigreturnfunction sys_rt_sigreturnfunction setup_framefunction setup_rt_framefunction handle_signalfunction do_signalfunction do_notify_resumefunction smp_save_fp_contextfunction smp_restore_fp_contextfunction signal_setup
Annotated Snippet
SYSCALL_DEFINE1(sigsuspend, sigset_t __user *, uset)
{
return sys_rt_sigsuspend(uset, sizeof(sigset_t));
}
#endif
#ifdef CONFIG_TRAD_SIGNALS
SYSCALL_DEFINE3(sigaction, int, sig, const struct sigaction __user *, act,
struct sigaction __user *, oact)
{
struct k_sigaction new_ka, old_ka;
int ret;
int err = 0;
if (act) {
old_sigset_t mask;
if (!access_ok(act, sizeof(*act)))
return -EFAULT;
err |= __get_user(new_ka.sa.sa_handler, &act->sa_handler);
err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
err |= __get_user(mask, &act->sa_mask.sig[0]);
if (err)
return -EFAULT;
siginitset(&new_ka.sa.sa_mask, mask);
}
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
if (!ret && oact) {
if (!access_ok(oact, sizeof(*oact)))
return -EFAULT;
err |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
err |= __put_user(old_ka.sa.sa_handler, &oact->sa_handler);
err |= __put_user(old_ka.sa.sa_mask.sig[0], oact->sa_mask.sig);
err |= __put_user(0, &oact->sa_mask.sig[1]);
err |= __put_user(0, &oact->sa_mask.sig[2]);
err |= __put_user(0, &oact->sa_mask.sig[3]);
if (err)
return -EFAULT;
}
return ret;
}
#endif
#ifdef CONFIG_TRAD_SIGNALS
asmlinkage void sys_sigreturn(void)
{
struct sigframe __user *frame;
struct pt_regs *regs;
sigset_t blocked;
int sig;
regs = current_pt_regs();
frame = (struct sigframe __user *)regs->regs[29];
if (!access_ok(frame, sizeof(*frame)))
goto badframe;
if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked)))
goto badframe;
set_current_blocked(&blocked);
sig = restore_sigcontext(regs, &frame->sf_sc);
if (sig < 0)
goto badframe;
else if (sig)
force_sig(sig);
/*
* Don't let your children do this ...
*/
__asm__ __volatile__(
"move\t$29, %0\n\t"
"j\tsyscall_exit"
: /* no outputs */
: "r" (regs));
/* Unreached */
badframe:
force_sig(SIGSEGV);
}
#endif /* CONFIG_TRAD_SIGNALS */
asmlinkage void sys_rt_sigreturn(void)
{
struct rt_sigframe __user *frame;
struct pt_regs *regs;
sigset_t set;
Annotation
- Immediate include surface: `linux/cache.h`, `linux/context_tracking.h`, `linux/irqflags.h`, `linux/sched.h`, `linux/mm.h`, `linux/personality.h`, `linux/smp.h`, `linux/kernel.h`.
- Detected declarations: `syscall sigsuspend`, `syscall sigaction`, `struct sigframe`, `struct rt_sigframe`, `function copy_fp_to_sigcontext`, `function copy_fp_from_sigcontext`, `function copy_fp_to_sigcontext`, `function copy_fp_from_sigcontext`, `function save_hw_fp_context`, `function restore_hw_fp_context`.
- Atlas domain: Architecture Layer / arch/mips.
- Implementation status: core 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.