linux/arch/arc/kernel
Vineet Gupta c58a584f05 ARC: clone syscall to setp r25 as thread pointer
Per ARC TLS ABI, r25 is designated TP (thread pointer register).
However so far kernel didn't do any special treatment, like setting up
usermode r25, even for CLONE_SETTLS. We instead relied on libc runtime
to do this, in say clone libc wrapper [1]. This was deliberate to keep
kernel ABI agnostic (userspace could potentially change TP, specially
for different ARC ISA say ARCompact vs. ARCv2 with different spare
registers etc)

However userspace setting up r25, after clone syscall opens a race, if
child is not scheduled and gets a signal instead. It starts off in
userspace not in clone but in a signal handler and anything TP sepcific
there such as pthread_self() fails which showed up with uClibc
testsuite nptl/tst-kill6 [2]

Fix this by having kernel populate r25 to TP value. So this locks in
ABI, but it was not going to change anyways, and fwiw is same for both
ARCompact (arc700 core) and ARCvs (HS3x cores)

[1] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libc/sysdeps/linux/arc/clone.S
[2] https://github.com/wbx-github/uclibc-ng-test/blob/master/test/nptl/tst-kill6.c

Fixes: ARC STAR 9001378481
Cc: stable@vger.kernel.org
Reported-by: Nikita Sobolev <sobolev@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
2018-10-05 14:33:29 -07:00
..
.gitignore
arc_hostlink.c
arcksyms.c ARC: export __udivdi3 for modules 2016-08-19 14:09:33 -07:00
asm-offsets.c ARCv2: [vdk] dts files and defconfig for HS38 VDK 2015-06-25 06:00:21 +05:30
ctx_sw.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/debug.h> 2017-03-02 08:42:34 +01:00
ctx_sw_asm.S ARC: dw2 unwind: enable cfi pseudo ops in string lib 2016-09-30 14:48:22 -07:00
devtree.c ARC: [plat-hsdk] initial port for HSDK board 2017-09-01 11:26:28 -07:00
disasm.c
entry-arcv2.S ARCv2: make unimplemented vectors as no-ops rather than halt core 2017-03-20 18:47:57 -07:00
entry-compact.S ARC: typos fix in kernel/entry-compact.S 2017-08-28 15:17:36 -07:00
entry.S ARC: Re-enable MMU upon Machine Check exception 2017-09-01 11:29:05 -07:00
fpu.c
head.S ARC: smp-boot: Decouple Non masters waiting API from jump to entry point 2017-01-24 11:12:28 -08:00
intc-arcv2.c ARCv2: SMP: Mask only private-per-core IRQ lines on boot at core intc 2017-08-28 16:11:15 -07:00
intc-compact.c ARCv2: SMP: Mask only private-per-core IRQ lines on boot at core intc 2017-08-28 16:11:15 -07:00
irq.c ARC: Enable machine_desc->init_per_cpu for !CONFIG_SMP 2018-06-20 16:12:06 -07:00
kgdb.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task_stack.h> 2017-03-02 08:42:36 +01:00
kprobes.c bpf/error-inject/kprobes: Clear current_kprobe and enable preempt in kprobe 2018-06-21 12:33:19 +02:00
Makefile ARC: Remove empty kernel/pcibios.c 2017-08-02 14:53:35 -05:00
mcip.c ARC: mcip: update MCIP debug mask when the new cpu came online 2018-02-28 10:45:31 -08:00
module.c ARC: module: Fix !CONFIG_ARC_DW2_UNWIND builds 2017-01-18 11:17:44 -08:00
perf_event.c ARCv2: perf: optimize given that num counters <= 32 2017-11-21 15:20:55 -08:00
process.c ARC: clone syscall to setp r25 as thread pointer 2018-10-05 14:33:29 -07:00
ptrace.c ARCv2: ptrace: provide regset for accumulator/r30 regs 2017-05-03 11:21:31 -07:00
reset.c
setup.c ARCv2: boot log: fix HS48 release number 2018-02-28 10:45:30 -08:00
signal.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/task_stack.h> 2017-03-02 08:42:36 +01:00
smp.c ARC: setup cpu possible mask according to possible-cpus dts property 2018-02-28 10:45:32 -08:00
stacktrace.c arc: do not use __print_symbol() 2017-12-20 12:41:43 -08:00
sys.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
traps.c Merge branch 'siginfo-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2018-01-30 14:18:52 -08:00
troubleshoot.c ARC: cleanup show_faulting_vma() 2018-08-27 09:00:36 -07:00
unaligned.c ARC: [arcompact] brown paper bag bug in unaligned access delay slot fixup 2017-02-07 10:02:01 -08:00
unwind.c treewide/trivial: Remove ';;$' typo noise 2018-02-22 10:59:33 +01:00
vmlinux.lds.S nmi_backtrace: generate one-line reports for idle cpus 2016-10-07 18:46:30 -07:00