Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull rseq fixes from Thomas Gleixer:
"A pile of rseq related fixups:

- Prevent infinite recursion when delivering SIGSEGV

- Remove the abort of rseq critical section on fork() as syscalls
inside rseq critical sections are explicitely forbidden. So no
point in doing the abort on the child.

- Align the rseq structure on 32 bytes in the ARM selftest code.

- Fix file permissions of the test script"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
rseq: Avoid infinite recursion when delivering SIGSEGV
rseq/cleanup: Do not abort rseq c.s. in child on fork()
rseq/selftests/arm: Align 'struct rseq_cs' on 32 bytes
rseq/selftests: Make run_param_test.sh executable

+23 -20
+2 -2
arch/arm/kernel/signal.c
··· 544 544 * Increment event counter and perform fixup for the pre-signal 545 545 * frame. 546 546 */ 547 - rseq_signal_deliver(regs); 547 + rseq_signal_deliver(ksig, regs); 548 548 549 549 /* 550 550 * Set up the stack frame ··· 666 666 } else { 667 667 clear_thread_flag(TIF_NOTIFY_RESUME); 668 668 tracehook_notify_resume(regs); 669 - rseq_handle_notify_resume(regs); 669 + rseq_handle_notify_resume(NULL, regs); 670 670 } 671 671 } 672 672 local_irq_disable();
+2 -2
arch/powerpc/kernel/signal.c
··· 134 134 /* Re-enable the breakpoints for the signal stack */ 135 135 thread_change_pc(tsk, tsk->thread.regs); 136 136 137 - rseq_signal_deliver(tsk->thread.regs); 137 + rseq_signal_deliver(&ksig, tsk->thread.regs); 138 138 139 139 if (is32) { 140 140 if (ksig.ka.sa.sa_flags & SA_SIGINFO) ··· 170 170 if (thread_info_flags & _TIF_NOTIFY_RESUME) { 171 171 clear_thread_flag(TIF_NOTIFY_RESUME); 172 172 tracehook_notify_resume(regs); 173 - rseq_handle_notify_resume(regs); 173 + rseq_handle_notify_resume(NULL, regs); 174 174 } 175 175 176 176 user_enter();
+1 -1
arch/x86/entry/common.c
··· 164 164 if (cached_flags & _TIF_NOTIFY_RESUME) { 165 165 clear_thread_flag(TIF_NOTIFY_RESUME); 166 166 tracehook_notify_resume(regs); 167 - rseq_handle_notify_resume(regs); 167 + rseq_handle_notify_resume(NULL, regs); 168 168 } 169 169 170 170 if (cached_flags & _TIF_USER_RETURN_NOTIFY)
+1 -1
arch/x86/kernel/signal.c
··· 692 692 * Increment event counter and perform fixup for the pre-signal 693 693 * frame. 694 694 */ 695 - rseq_signal_deliver(regs); 695 + rseq_signal_deliver(ksig, regs); 696 696 697 697 /* Set up the stack frame */ 698 698 if (is_ia32_frame(ksig)) {
+12 -11
include/linux/sched.h
··· 1799 1799 set_tsk_thread_flag(t, TIF_NOTIFY_RESUME); 1800 1800 } 1801 1801 1802 - void __rseq_handle_notify_resume(struct pt_regs *regs); 1802 + void __rseq_handle_notify_resume(struct ksignal *sig, struct pt_regs *regs); 1803 1803 1804 - static inline void rseq_handle_notify_resume(struct pt_regs *regs) 1804 + static inline void rseq_handle_notify_resume(struct ksignal *ksig, 1805 + struct pt_regs *regs) 1805 1806 { 1806 1807 if (current->rseq) 1807 - __rseq_handle_notify_resume(regs); 1808 + __rseq_handle_notify_resume(ksig, regs); 1808 1809 } 1809 1810 1810 - static inline void rseq_signal_deliver(struct pt_regs *regs) 1811 + static inline void rseq_signal_deliver(struct ksignal *ksig, 1812 + struct pt_regs *regs) 1811 1813 { 1812 1814 preempt_disable(); 1813 1815 __set_bit(RSEQ_EVENT_SIGNAL_BIT, &current->rseq_event_mask); 1814 1816 preempt_enable(); 1815 - rseq_handle_notify_resume(regs); 1817 + rseq_handle_notify_resume(ksig, regs); 1816 1818 } 1817 1819 1818 1820 /* rseq_preempt() requires preemption to be disabled. */ ··· 1833 1831 1834 1832 /* 1835 1833 * If parent process has a registered restartable sequences area, the 1836 - * child inherits. Only applies when forking a process, not a thread. In 1837 - * case a parent fork() in the middle of a restartable sequence, set the 1838 - * resume notifier to force the child to retry. 1834 + * child inherits. Only applies when forking a process, not a thread. 1839 1835 */ 1840 1836 static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags) 1841 1837 { ··· 1847 1847 t->rseq_len = current->rseq_len; 1848 1848 t->rseq_sig = current->rseq_sig; 1849 1849 t->rseq_event_mask = current->rseq_event_mask; 1850 - rseq_preempt(t); 1851 1850 } 1852 1851 } 1853 1852 ··· 1863 1864 static inline void rseq_set_notify_resume(struct task_struct *t) 1864 1865 { 1865 1866 } 1866 - static inline void rseq_handle_notify_resume(struct pt_regs *regs) 1867 + static inline void rseq_handle_notify_resume(struct ksignal *ksig, 1868 + struct pt_regs *regs) 1867 1869 { 1868 1870 } 1869 - static inline void rseq_signal_deliver(struct pt_regs *regs) 1871 + static inline void rseq_signal_deliver(struct ksignal *ksig, 1872 + struct pt_regs *regs) 1870 1873 { 1871 1874 } 1872 1875 static inline void rseq_preempt(struct task_struct *t)
+4 -3
kernel/rseq.c
··· 251 251 * respect to other threads scheduled on the same CPU, and with respect 252 252 * to signal handlers. 253 253 */ 254 - void __rseq_handle_notify_resume(struct pt_regs *regs) 254 + void __rseq_handle_notify_resume(struct ksignal *ksig, struct pt_regs *regs) 255 255 { 256 256 struct task_struct *t = current; 257 - int ret; 257 + int ret, sig; 258 258 259 259 if (unlikely(t->flags & PF_EXITING)) 260 260 return; ··· 268 268 return; 269 269 270 270 error: 271 - force_sig(SIGSEGV, t); 271 + sig = ksig ? ksig->sig : 0; 272 + force_sigsegv(sig, t); 272 273 } 273 274 274 275 #ifdef CONFIG_DEBUG_RSEQ
+1
tools/testing/selftests/rseq/rseq-arm.h
··· 57 57 #define __RSEQ_ASM_DEFINE_ABORT(table_label, label, teardown, \ 58 58 abort_label, version, flags, \ 59 59 start_ip, post_commit_offset, abort_ip) \ 60 + ".balign 32\n\t" \ 60 61 __rseq_str(table_label) ":\n\t" \ 61 62 ".word " __rseq_str(version) ", " __rseq_str(flags) "\n\t" \ 62 63 ".word " __rseq_str(start_ip) ", 0x0, " __rseq_str(post_commit_offset) ", 0x0, " __rseq_str(abort_ip) ", 0x0\n\t" \
tools/testing/selftests/rseq/run_param_test.sh