Skip to content

Commit 8213a2f

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull pile 2 of execve and kernel_thread unification work from Al Viro: "Stuff in there: kernel_thread/kernel_execve/sys_execve conversions for several more architectures plus assorted signal fixes and cleanups. There'll be more (in particular, real fixes for the alpha do_notify_resume() irq mess)..." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (43 commits) alpha: don't open-code trace_report_syscall_{enter,exit} Uninclude linux/freezer.h m32r: trim masks avr32: trim masks tile: don't bother with SIGTRAP in setup_frame microblaze: don't bother with SIGTRAP in setup_rt_frame() mn10300: don't bother with SIGTRAP in setup_frame() frv: no need to raise SIGTRAP in setup_frame() x86: get rid of duplicate code in case of CONFIG_VM86 unicore32: remove pointless test h8300: trim _TIF_WORK_MASK parisc: decide whether to go to slow path (tracesys) based on thread flags parisc: don't bother looping in do_signal() parisc: fix double restarts bury the rest of TIF_IRET sanitize tsk_is_polling() bury _TIF_RESTORE_SIGMASK unicore32: unobfuscate _TIF_WORK_MASK mips: NOTIFY_RESUME is not needed in TIF masks mips: merge the identical "return from syscall" per-ABI code ... Conflicts: arch/arm/include/asm/thread_info.h
2 parents 4092475 + 12f79be commit 8213a2f

99 files changed

Lines changed: 344 additions & 882 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/alpha/include/asm/thread_info.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ register struct thread_info *__current_thread_info __asm__("$8");
8484
#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
8585
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
8686
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
87-
#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
8887
#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
8988

9089
/* Work to do on interrupt/exception return. */
@@ -117,5 +116,7 @@ register struct thread_info *__current_thread_info __asm__("$8");
117116
(int __user *)(value)); \
118117
})
119118

119+
#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
120+
120121
#endif /* __KERNEL__ */
121122
#endif /* _ALPHA_THREAD_INFO_H */

‎arch/alpha/kernel/entry.S‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,10 @@ $work_notifysig:
418418
strace:
419419
/* set up signal stack, call syscall_trace */
420420
bsr $1, do_switch_stack
421-
jsr $26, syscall_trace
421+
jsr $26, syscall_trace_enter /* returns the syscall number */
422422
bsr $1, undo_switch_stack
423423

424-
/* get the system call number and the arguments back.. */
425-
ldq $0, 0($sp)
424+
/* get the arguments back.. */
426425
ldq $16, SP_OFF+24($sp)
427426
ldq $17, SP_OFF+32($sp)
428427
ldq $18, SP_OFF+40($sp)
@@ -449,7 +448,7 @@ $strace_success:
449448
stq $0, 0($sp) /* save return value */
450449

451450
bsr $1, do_switch_stack
452-
jsr $26, syscall_trace
451+
jsr $26, syscall_trace_leave
453452
bsr $1, undo_switch_stack
454453
br $31, ret_from_sys_call
455454

@@ -467,7 +466,7 @@ $strace_error:
467466
bsr $1, do_switch_stack
468467
mov $19, $9 /* save old syscall number */
469468
mov $20, $10 /* save old a3 */
470-
jsr $26, syscall_trace
469+
jsr $26, syscall_trace_leave
471470
mov $9, $19
472471
mov $10, $20
473472
bsr $1, undo_switch_stack
@@ -698,7 +697,7 @@ sys_sigreturn:
698697
lda $sp, -SWITCH_STACK_SIZE($sp)
699698
jsr $26, do_sigreturn
700699
bne $9, 1f
701-
jsr $26, syscall_trace
700+
jsr $26, syscall_trace_leave
702701
1: br $1, undo_switch_stack
703702
br ret_from_sys_call
704703
.end sys_sigreturn
@@ -715,7 +714,7 @@ sys_rt_sigreturn:
715714
lda $sp, -SWITCH_STACK_SIZE($sp)
716715
jsr $26, do_rt_sigreturn
717716
bne $9, 1f
718-
jsr $26, syscall_trace
717+
jsr $26, syscall_trace_leave
719718
1: br $1, undo_switch_stack
720719
br ret_from_sys_call
721720
.end sys_rt_sigreturn

‎arch/alpha/kernel/ptrace.c‎

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/user.h>
1414
#include <linux/security.h>
1515
#include <linux/signal.h>
16+
#include <linux/tracehook.h>
1617

1718
#include <asm/uaccess.h>
1819
#include <asm/pgtable.h>
@@ -312,25 +313,18 @@ long arch_ptrace(struct task_struct *child, long request,
312313
return ret;
313314
}
314315

316+
asmlinkage unsigned long syscall_trace_enter(void)
317+
{
318+
unsigned long ret = 0;
319+
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
320+
tracehook_report_syscall_entry(current_pt_regs()))
321+
ret = -1UL;
322+
return ret ?: current_pt_regs()->r0;
323+
}
324+
315325
asmlinkage void
316-
syscall_trace(void)
326+
syscall_trace_leave(void)
317327
{
318-
if (!test_thread_flag(TIF_SYSCALL_TRACE))
319-
return;
320-
if (!(current->ptrace & PT_PTRACED))
321-
return;
322-
/* The 0x80 provides a way for the tracing parent to distinguish
323-
between a syscall stop and SIGTRAP delivery */
324-
ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
325-
? 0x80 : 0));
326-
327-
/*
328-
* This isn't the same as continuing with a signal, but it will do
329-
* for normal use. strace only continues with a signal if the
330-
* stopping signal is not SIGTRAP. -brl
331-
*/
332-
if (current->exit_code) {
333-
send_sig(current->exit_code, current, 1);
334-
current->exit_code = 0;
335-
}
328+
if (test_thread_flag(TIF_SYSCALL_TRACE))
329+
tracehook_report_syscall_exit(current_pt_regs(), 0);
336330
}

‎arch/arm/include/asm/thread_info.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
151151
#define TIF_SYSCALL_TRACE 8
152152
#define TIF_SYSCALL_AUDIT 9
153153
#define TIF_SYSCALL_TRACEPOINT 10
154-
#define TIF_POLLING_NRFLAG 16
155154
#define TIF_USING_IWMMXT 17
156155
#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
157156
#define TIF_RESTORE_SIGMASK 20
@@ -164,7 +163,6 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
164163
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
165164
#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
166165
#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
167-
#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
168166
#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
169167
#define _TIF_SECCOMP (1 << TIF_SECCOMP)
170168

‎arch/arm/kernel/signal.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <linux/errno.h>
1111
#include <linux/signal.h>
1212
#include <linux/personality.h>
13-
#include <linux/freezer.h>
1413
#include <linux/uaccess.h>
1514
#include <linux/tracehook.h>
1615

‎arch/avr32/include/asm/thread_info.h‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ static inline struct thread_info *current_thread_info(void)
7777
#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
7878
#define TIF_SIGPENDING 1 /* signal pending */
7979
#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
80-
#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
81-
TIF_NEED_RESCHED */
8280
#define TIF_BREAKPOINT 4 /* enter monitor mode on return */
8381
#define TIF_SINGLE_STEP 5 /* single step in progress */
8482
#define TIF_MEMDIE 6 /* is terminating due to OOM killer */
@@ -91,28 +89,24 @@ static inline struct thread_info *current_thread_info(void)
9189
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
9290
#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
9391
#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
94-
#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
92+
#define _TIF_BREAKPOINT (1 << TIF_BREAKPOINT)
9593
#define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP)
9694
#define _TIF_MEMDIE (1 << TIF_MEMDIE)
97-
#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
9895
#define _TIF_CPU_GOING_TO_SLEEP (1 << TIF_CPU_GOING_TO_SLEEP)
9996
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
10097

10198
/* Note: The masks below must never span more than 16 bits! */
10299

103100
/* work to do on interrupt/exception return */
104101
#define _TIF_WORK_MASK \
105-
((1 << TIF_SIGPENDING) \
102+
(_TIF_SIGPENDING \
106103
| _TIF_NOTIFY_RESUME \
107-
| (1 << TIF_NEED_RESCHED) \
108-
| (1 << TIF_POLLING_NRFLAG) \
109-
| (1 << TIF_BREAKPOINT) \
110-
| (1 << TIF_RESTORE_SIGMASK))
104+
| _TIF_NEED_RESCHED \
105+
| _TIF_BREAKPOINT)
111106

112107
/* work to do on any return to userspace */
113-
#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | (1 << TIF_SYSCALL_TRACE) | \
114-
_TIF_NOTIFY_RESUME)
108+
#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | _TIF_SYSCALL_TRACE)
115109
/* work to do on return from debug mode */
116-
#define _TIF_DBGWORK_MASK (_TIF_WORK_MASK & ~(1 << TIF_BREAKPOINT))
110+
#define _TIF_DBGWORK_MASK (_TIF_WORK_MASK & ~_TIF_BREAKPOINT)
117111

118112
#endif /* __ASM_AVR32_THREAD_INFO_H */

‎arch/avr32/kernel/signal.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <linux/errno.h>
1616
#include <linux/ptrace.h>
1717
#include <linux/unistd.h>
18-
#include <linux/freezer.h>
1918
#include <linux/tracehook.h>
2019

2120
#include <asm/uaccess.h>

‎arch/blackfin/include/asm/thread_info.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ static inline struct thread_info *current_thread_info(void)
9696
#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
9797
#define TIF_SIGPENDING 1 /* signal pending */
9898
#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
99-
#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
100-
TIF_NEED_RESCHED */
10199
#define TIF_MEMDIE 4 /* is terminating due to OOM killer */
102100
#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
103101
#define TIF_IRQ_SYNC 7 /* sync pipeline stage */
@@ -108,8 +106,6 @@ static inline struct thread_info *current_thread_info(void)
108106
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
109107
#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
110108
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
111-
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
112-
#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
113109
#define _TIF_IRQ_SYNC (1<<TIF_IRQ_SYNC)
114110
#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
115111
#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)

‎arch/blackfin/kernel/signal.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <linux/tty.h>
1111
#include <linux/personality.h>
1212
#include <linux/binfmts.h>
13-
#include <linux/freezer.h>
1413
#include <linux/uaccess.h>
1514
#include <linux/tracehook.h>
1615

‎arch/c6x/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ config C6X
1717
select OF
1818
select OF_EARLY_FLATTREE
1919
select GENERIC_CLOCKEVENTS
20+
select GENERIC_KERNEL_THREAD
2021

2122
config MMU
2223
def_bool n

0 commit comments

Comments
 (0)