Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
2325f0a
Documentation
arch
alpha
arm
avr32
blackfin
cris
frv
h8300
ia64
m32r
m68k
m68knommu
mips
mn10300
parisc
powerpc
boot
configs
kernel
vdso32
vdso64
Makefile
align.c
asm-offsets.c
audit.c
btext.c
clock.c
compat_audit.c
cpu_setup_44x.S
cpu_setup_6xx.S
cpu_setup_pa6t.S
cpu_setup_ppc970.S
cputable.c
crash.c
crash_dump.c
dma_64.c
entry_32.S
entry_64.S
firmware.c
fpu.S
ftrace.c
head_32.S
head_40x.S
head_44x.S
head_64.S
head_8xx.S
head_booke.h
head_fsl_booke.S
ibmebus.c
idle.c
idle_6xx.S
idle_e500.S
idle_power4.S
init_task.c
io.c
iomap.c
iommu.c
irq.c
isa-bridge.c
kgdb.c
kprobes.c
l2cr_6xx.S
legacy_serial.c
lparcfg.c
machine_kexec.c
machine_kexec_32.c
machine_kexec_64.c
misc.S
misc_32.S
misc_64.S
module.c
module_32.c
module_64.c
msi.c
nvram_64.c
of_device.c
of_platform.c
paca.c
pci-common.c
pci_32.c
pci_64.c
pci_dn.c
pmc.c
ppc32.h
ppc_ksyms.c
proc_ppc64.c
process.c
prom.c
prom_init.c
prom_init_check.sh
prom_parse.c
ptrace.c
ptrace32.c
rtas-proc.c
rtas-rtc.c
rtas.c
rtas_flash.c
rtas_pci.c
setup-common.c
setup.h
setup_32.c
setup_64.c
signal.c
signal.h
signal_32.c
signal_64.c
smp-tbsync.c
smp.c
softemu8xx.c
stacktrace.c
suspend.c
swsusp.c
swsusp_32.S
swsusp_64.c
swsusp_asm64.S
sys_ppc32.c
syscalls.c
sysfs.c
systbl.S
systbl_chk.c
systbl_chk.sh
tau_6xx.c
time.c
traps.c
udbg.c
udbg_16550.c
vdso.c
vecemu.c
vector.S
vio.c
vmlinux.lds.S
kvm
lib
math-emu
mm
oprofile
platforms
sysdev
xmon
.gitignore
Kconfig
Kconfig.debug
Makefile
s390
sh
sparc
sparc64
um
x86
xtensa
.gitignore
Kconfig
block
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
usr
virt
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
arch
/
powerpc
/
kernel
/
signal.c
Blame
Blame
Latest commit
History
History
190 lines (163 loc) · 4.74 KB
Breadcrumbs
linux
/
arch
/
powerpc
/
kernel
/
signal.c
Top
File metadata and controls
Code
Blame
190 lines (163 loc) · 4.74 KB
Raw
/* * Common signal handling code for both 32 and 64 bits * * Copyright (c) 2007 Benjamin Herrenschmidt, IBM Coproration * Extracted from signal_32.c and signal_64.c * * This file is subject to the terms and conditions of the GNU General * Public License. See the file README.legal in the main directory of * this archive for more details. */ #include <linux/ptrace.h> #include <linux/signal.h> #include <asm/uaccess.h> #include <asm/unistd.h> #include "signal.h" /* Log an error when sending an unhandled signal to a process. Controlled * through debug.exception-trace sysctl. */ int show_unhandled_signals = 0; /* * Allocate space for the signal frame */ void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) { unsigned long oldsp, newsp; /* Default to using normal stack */ oldsp = regs->gpr[1]; /* Check for alt stack */ if ((ka->sa.sa_flags & SA_ONSTACK) && current->sas_ss_size && !on_sig_stack(oldsp)) oldsp = (current->sas_ss_sp + current->sas_ss_size); /* Get aligned frame */ newsp = (oldsp - frame_size) & ~0xFUL; /* Check access */ if (!access_ok(VERIFY_WRITE, (void __user *)newsp, oldsp - newsp)) return NULL; return (void __user *)newsp; } /* * Restore the user process's signal mask */ void restore_sigmask(sigset_t *set) { sigdelsetmask(set, ~_BLOCKABLE); spin_lock_irq(¤t->sighand->siglock); current->blocked = *set; recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); } static void check_syscall_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler) { unsigned long ret = regs->gpr[3]; int restart = 1; /* syscall ? */ if (TRAP(regs) != 0x0C00) return; /* error signalled ? */ if (!(regs->ccr & 0x10000000)) return; switch (ret) { case ERESTART_RESTARTBLOCK: case ERESTARTNOHAND: /* ERESTARTNOHAND means that the syscall should only be * restarted if there was no handler for the signal, and since * we only get here if there is a handler, we dont restart. */ restart = !has_handler; break; case ERESTARTSYS: /* ERESTARTSYS means to restart the syscall if there is no * handler or the handler was registered with SA_RESTART */ restart = !has_handler || (ka->sa.sa_flags & SA_RESTART) != 0; break; case ERESTARTNOINTR: /* ERESTARTNOINTR means that the syscall should be * called again after the signal handler returns. */ break; default: return; } if (restart) { if (ret == ERESTART_RESTARTBLOCK) regs->gpr[0] = __NR_restart_syscall; else regs->gpr[3] = regs->orig_gpr3; regs->nip -= 4; regs->result = 0; } else { regs->result = -EINTR; regs->gpr[3] = EINTR; regs->ccr |= 0x10000000; } } int do_signal(sigset_t *oldset, struct pt_regs *regs) { siginfo_t info; int signr; struct k_sigaction ka; int ret; int is32 = is_32bit_task(); if (current_thread_info()->local_flags & _TLF_RESTORE_SIGMASK) oldset = ¤t->saved_sigmask; else if (!oldset) oldset = ¤t->blocked; signr = get_signal_to_deliver(&info, &ka, regs, NULL); /* Is there any syscall restart business here ? */ check_syscall_restart(regs, &ka, signr > 0); if (signr <= 0) { struct thread_info *ti = current_thread_info(); /* No signal to deliver -- put the saved sigmask back */ if (ti->local_flags & _TLF_RESTORE_SIGMASK) { ti->local_flags &= ~_TLF_RESTORE_SIGMASK; sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); } return 0; /* no signals delivered */ } /* * Reenable the DABR before delivering the signal to * user space. The DABR will have been cleared if it * triggered inside the kernel. */ if (current->thread.dabr) { set_dabr(current->thread.dabr); #if defined(CONFIG_BOOKE) mtspr(SPRN_DBCR0, current->thread.dbcr0); #endif } if (is32) { if (ka.sa.sa_flags & SA_SIGINFO) ret = handle_rt_signal32(signr, &ka, &info, oldset, regs); else ret = handle_signal32(signr, &ka, &info, oldset, regs); } else { ret = handle_rt_signal64(signr, &ka, &info, oldset, regs); } if (ret) { spin_lock_irq(¤t->sighand->siglock); sigorsets(¤t->blocked, ¤t->blocked, &ka.sa.sa_mask); if (!(ka.sa.sa_flags & SA_NODEFER)) sigaddset(¤t->blocked, signr); recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); /* * A signal was successfully delivered; the saved sigmask is in * its frame, and we can clear the TLF_RESTORE_SIGMASK flag. */ current_thread_info()->local_flags &= ~_TLF_RESTORE_SIGMASK; } return ret; } long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, unsigned long r5, unsigned long r6, unsigned long r7, unsigned long r8, struct pt_regs *regs) { return do_sigaltstack(uss, uoss, regs->gpr[1]); }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
You can’t perform that action at this time.