Commit 7d6d637dac2050f30a1b57b0a3dc5de4a10616ba
Committed by
Benjamin Herrenschmidt
1 parent
f1ba12856b
Exists in
master
and in
7 other branches
powerpc: Add TIF_NOTIFY_RESUME support for tracehook
This adds TIF_NOTIFY_RESUME support for powerpc. When set, we call tracehook_notify_resume() on the way to user mode. This overloads do_signal() to do the work, but changes its arguments to it has the TIF_* bits handy in a register and drops the useless first argument that was always zero. Signed-off-by: Roland McGrath <roland@redhat.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Showing 5 changed files with 20 additions and 8 deletions Side-by-side Diff
arch/powerpc/kernel/entry_32.S
arch/powerpc/kernel/entry_64.S
arch/powerpc/kernel/signal.c
... | ... | @@ -112,7 +112,7 @@ |
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | -int do_signal(sigset_t *oldset, struct pt_regs *regs) | |
115 | +static int do_signal_pending(sigset_t *oldset, struct pt_regs *regs) | |
116 | 116 | { |
117 | 117 | siginfo_t info; |
118 | 118 | int signr; |
... | ... | @@ -186,6 +186,17 @@ |
186 | 186 | } |
187 | 187 | |
188 | 188 | return ret; |
189 | +} | |
190 | + | |
191 | +void do_signal(struct pt_regs *regs, unsigned long thread_info_flags) | |
192 | +{ | |
193 | + if (thread_info_flags & _TIF_SIGPENDING) | |
194 | + do_signal_pending(NULL, regs); | |
195 | + | |
196 | + if (thread_info_flags & _TIF_NOTIFY_RESUME) { | |
197 | + clear_thread_flag(TIF_NOTIFY_RESUME); | |
198 | + tracehook_notify_resume(regs); | |
199 | + } | |
189 | 200 | } |
190 | 201 | |
191 | 202 | long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, |
include/asm-powerpc/signal.h
... | ... | @@ -122,8 +122,7 @@ |
122 | 122 | |
123 | 123 | #ifdef __KERNEL__ |
124 | 124 | struct pt_regs; |
125 | -extern int do_signal(sigset_t *oldset, struct pt_regs *regs); | |
126 | -extern int do_signal32(sigset_t *oldset, struct pt_regs *regs); | |
125 | +extern void do_signal(struct pt_regs *regs, unsigned long thread_info_flags); | |
127 | 126 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) |
128 | 127 | #endif /* __KERNEL__ */ |
129 | 128 |
include/asm-powerpc/thread_info.h
... | ... | @@ -108,6 +108,7 @@ |
108 | 108 | #define TIF_SECCOMP 10 /* secure computing */ |
109 | 109 | #define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */ |
110 | 110 | #define TIF_NOERROR 12 /* Force successful syscall return */ |
111 | +#define TIF_NOTIFY_RESUME 13 /* callback before returning to user */ | |
111 | 112 | #define TIF_FREEZE 14 /* Freezing for suspend */ |
112 | 113 | #define TIF_RUNLATCH 15 /* Is the runlatch enabled? */ |
113 | 114 | #define TIF_ABI_PENDING 16 /* 32/64 bit switch needed */ |
114 | 115 | |
... | ... | @@ -125,12 +126,14 @@ |
125 | 126 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) |
126 | 127 | #define _TIF_RESTOREALL (1<<TIF_RESTOREALL) |
127 | 128 | #define _TIF_NOERROR (1<<TIF_NOERROR) |
129 | +#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | |
128 | 130 | #define _TIF_FREEZE (1<<TIF_FREEZE) |
129 | 131 | #define _TIF_RUNLATCH (1<<TIF_RUNLATCH) |
130 | 132 | #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) |
131 | 133 | #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP) |
132 | 134 | |
133 | -#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED) | |
135 | +#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ | |
136 | + _TIF_NOTIFY_RESUME) | |
134 | 137 | #define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR) |
135 | 138 | |
136 | 139 | /* Bits in local_flags */ |