1
0
Fork 0
remarkable-linux/arch/arc
Vineet Gupta b5dcd4ab8e ARC: clone syscall to setp r25 as thread pointer
commit c58a584f05 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-13 09:27:28 +02:00
..
boot .gitignore: move *.dtb and *.dtb.S patterns to the top-level .gitignore 2018-02-13 10:19:46 +01:00
configs ARC: [plat-axs*]: Enable SWAP 2018-09-19 22:43:38 +02:00
include ARC: atomics: unbork atomic_fetch_##op() 2018-10-10 08:54:20 +02:00
kernel ARC: clone syscall to setp r25 as thread pointer 2018-10-13 09:27:28 +02:00
lib ARC: dw2 unwind: enable cfi pseudo ops in string lib 2016-09-30 14:48:22 -07:00
mm arc: fix type warnings in arc/mm/cache.c 2018-09-05 09:26:31 +02:00
oprofile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
plat-axs10x ARC: [plat-axs103] Add temporary quirk to reset ethernet IP 2017-10-03 20:36:49 -07:00
plat-eznps arc: [plat-eznps] fix printk warning in arc/plat-eznps/mtm.c 2018-09-05 09:26:31 +02:00
plat-hsdk ARCv2: [plat-hsdk]: Save accl reg pair by default 2018-07-25 11:25:07 +02:00
plat-sim ARC: [plat-sim] Include this platform unconditionally 2017-08-04 13:49:47 +05:30
plat-tb10x arc: select GPIOLIB directly 2016-04-26 14:07:59 +02:00
Kbuild ARC: Build system: Makefiles, Kconfig, Linker script 2013-02-11 20:00:25 +05:30
Kconfig ARC: dma [non-IOC] setup SMP_CACHE_BYTES and cache_line_size 2018-09-05 09:26:30 +02:00
Kconfig.debug License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile ARC: Explicitly add -mmedium-calls to CFLAGS 2018-08-24 13:08:56 +02:00