1
0
Fork 0
remarkable-linux/arch
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
..
alpha sys: don't hold uts_sem while accessing userspace memory 2018-09-09 19:56:00 +02:00
arc ARC: clone syscall to setp r25 as thread pointer 2018-10-13 09:27:28 +02:00
arm ARM: dts: omap4-droid4: Fix emmc errors seen on some devices 2018-10-03 17:00:59 -07:00
arm64 arm64: jump_label.h: use asm_volatile_goto macro instead of "asm goto" 2018-10-10 08:54:25 +02:00
blackfin pinctrl: adi2: Fix Kconfig build problem 2017-12-20 10:10:34 +01:00
c6x License cleanup: add SPDX license identifier to uapi header files with a license 2017-11-02 11:20:11 +01:00
cris bug.h: work around GCC PR82365 in BUG() 2018-05-30 07:52:00 +02:00
frv License cleanup: add SPDX license identifier to uapi header files with a license 2017-11-02 11:20:11 +01:00
h8300 h8300: remove extraneous __BIG_ENDIAN definition 2018-03-28 18:24:38 +02:00
hexagon hexagon: modify ffs() and fls() to return int 2018-10-10 08:54:25 +02:00
ia64 ia64/err-inject: Use get_user_pages_fast() 2018-05-30 07:52:11 +02:00
m32r m32r: fix endianness constraints 2018-02-28 10:19:44 +01:00
m68k m68k: fix "bad page state" oops on ColdFire boot 2018-08-24 13:09:11 +02:00
metag .gitignore: move *.dtb and *.dtb.S patterns to the top-level .gitignore 2018-02-13 10:19:46 +01:00
microblaze microblaze: Fix simpleImage format generation 2018-08-03 07:50:40 +02:00
mips MIPS: boot: fix build rule of vmlinux.its.S 2018-10-03 17:00:52 -07:00
mn10300 mn10300/misalignment: Use SIGSEGV SEGV_MAPERR to report a failed user copy 2018-02-16 20:23:11 +01:00
nios2 .gitignore: move *.dtb and *.dtb.S patterns to the top-level .gitignore 2018-02-13 10:19:46 +01:00
openrisc openrisc: entry: Fix delay slot exception detection 2018-08-24 13:09:11 +02:00
parisc parisc: Remove unnecessary barriers from spinlock.h 2018-08-24 13:09:22 +02:00
powerpc powerpc/lib: fix book3s/32 boot failure due to code patching 2018-10-13 09:27:28 +02:00
s390 s390/extmem: fix gcc 8 stringop-overflow warning 2018-10-03 17:00:50 -07:00
score License cleanup: add SPDX license identifier to uapi header files with no license 2017-11-02 11:19:54 +01:00
sh sh: fix build failure for J2 cpu with SMP disabled 2018-06-21 04:02:54 +09:00
sparc sys: don't hold uts_sem while accessing userspace memory 2018-09-09 19:56:00 +02:00
tile fcntl: don't cap l_start and l_end values for F_GETLK64 in compat syscall 2017-12-17 15:07:59 +01:00
um um: Use POSIX ucontext_t instead of struct ucontext 2018-04-24 09:36:33 +02:00
unicore32 kmemcheck: stop using GFP_NOTRACK and SLAB_NOTRACK 2018-02-22 15:42:23 +01:00
x86 x86/vdso: Fix vDSO syscall fallback asm constraint regression 2018-10-13 09:27:24 +02:00
xtensa xtensa: ISS: don't allocate memory in platform_setup 2018-09-26 08:38:08 +02:00
.gitignore
Kconfig mm/tlb, x86/mm: Support invalidating TLB caches for RCU_TABLE_FREE 2018-09-05 09:26:37 +02:00