https://github.com/torvalds/linux
Revision 735f2770a770156100f534646158cb58cb8b2939 authored by Michal Hocko on 01 September 2016, 23:15:13 UTC, committed by Linus Torvalds on 02 September 2016, 00:52:02 UTC
Commit fec1d0115240 ("[PATCH] Disable CLONE_CHILD_CLEARTID for abnormal
exit") has caused a subtle regression in nscd which uses
CLONE_CHILD_CLEARTID to clear the nscd_certainly_running flag in the
shared databases, so that the clients are notified when nscd is
restarted.  Now, when nscd uses a non-persistent database, clients that
have it mapped keep thinking the database is being updated by nscd, when
in fact nscd has created a new (anonymous) one (for non-persistent
databases it uses an unlinked file as backend).

The original proposal for the CLONE_CHILD_CLEARTID change claimed
(https://lkml.org/lkml/2006/10/25/233):

: The NPTL library uses the CLONE_CHILD_CLEARTID flag on clone() syscalls
: on behalf of pthread_create() library calls.  This feature is used to
: request that the kernel clear the thread-id in user space (at an address
: provided in the syscall) when the thread disassociates itself from the
: address space, which is done in mm_release().
:
: Unfortunately, when a multi-threaded process incurs a core dump (such as
: from a SIGSEGV), the core-dumping thread sends SIGKILL signals to all of
: the other threads, which then proceed to clear their user-space tids
: before synchronizing in exit_mm() with the start of core dumping.  This
: misrepresents the state of process's address space at the time of the
: SIGSEGV and makes it more difficult for someone to debug NPTL and glibc
: problems (misleading him/her to conclude that the threads had gone away
: before the fault).
:
: The fix below is to simply avoid the CLONE_CHILD_CLEARTID action if a
: core dump has been initiated.

The resulting patch from Roland (https://lkml.org/lkml/2006/10/26/269)
seems to have a larger scope than the original patch asked for.  It
seems that limitting the scope of the check to core dumping should work
for SIGSEGV issue describe above.

[Changelog partly based on Andreas' description]
Fixes: fec1d0115240 ("[PATCH] Disable CLONE_CHILD_CLEARTID for abnormal exit")
Link: http://lkml.kernel.org/r/1471968749-26173-1-git-send-email-mhocko@kernel.org
Signed-off-by: Michal Hocko <mhocko@suse.com>
Tested-by: William Preston <wpreston@suse.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Roland McGrath <roland@hack.frob.com>
Cc: Andreas Schwab <schwab@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent c4e2973
History
Tip revision: 735f2770a770156100f534646158cb58cb8b2939 authored by Michal Hocko on 01 September 2016, 23:15:13 UTC
kernel/fork: fix CLONE_CHILD_CLEARTID regression in nscd
Tip revision: 735f277
File Mode Size
partitions
Kconfig -rw-r--r-- 3.7 KB
Kconfig.iosched -rw-r--r-- 1.6 KB
Makefile -rw-r--r-- 922 bytes
badblocks.c -rw-r--r-- 14.1 KB
bio-integrity.c -rw-r--r-- 14.2 KB
bio.c -rw-r--r-- 48.5 KB
blk-cgroup.c -rw-r--r-- 35.8 KB
blk-core.c -rw-r--r-- 93.1 KB
blk-exec.c -rw-r--r-- 3.2 KB
blk-flush.c -rw-r--r-- 15.4 KB
blk-integrity.c -rw-r--r-- 12.3 KB
blk-ioc.c -rw-r--r-- 10.2 KB
blk-lib.c -rw-r--r-- 6.9 KB
blk-map.c -rw-r--r-- 5.8 KB
blk-merge.c -rw-r--r-- 19.6 KB
blk-mq-cpu.c -rw-r--r-- 1.6 KB
blk-mq-cpumap.c -rw-r--r-- 2.6 KB
blk-mq-sysfs.c -rw-r--r-- 11.4 KB
blk-mq-tag.c -rw-r--r-- 17.4 KB
blk-mq-tag.h -rw-r--r-- 2.6 KB
blk-mq.c -rw-r--r-- 58.0 KB
blk-mq.h -rw-r--r-- 3.3 KB
blk-settings.c -rw-r--r-- 27.0 KB
blk-softirq.c -rw-r--r-- 4.4 KB
blk-sysfs.c -rw-r--r-- 18.5 KB
blk-tag.c -rw-r--r-- 10.0 KB
blk-throttle.c -rw-r--r-- 42.5 KB
blk-timeout.c -rw-r--r-- 5.9 KB
blk.h -rw-r--r-- 9.1 KB
bounce.c -rw-r--r-- 5.8 KB
bsg-lib.c -rw-r--r-- 6.0 KB
bsg.c -rw-r--r-- 22.9 KB
cfq-iosched.c -rw-r--r-- 127.0 KB
cmdline-parser.c -rw-r--r-- 4.9 KB
compat_ioctl.c -rw-r--r-- 20.8 KB
deadline-iosched.c -rw-r--r-- 11.3 KB
elevator.c -rw-r--r-- 23.8 KB
genhd.c -rw-r--r-- 45.0 KB
ioctl.c -rw-r--r-- 14.6 KB
ioprio.c -rw-r--r-- 5.1 KB
noop-iosched.c -rw-r--r-- 2.6 KB
partition-generic.c -rw-r--r-- 14.7 KB
scsi_ioctl.c -rw-r--r-- 19.4 KB
t10-pi.c -rw-r--r-- 4.8 KB

back to top