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
bpf
configs
debug
events
gcov
irq
livepatch
locking
power
printk
rcu
sched
time
trace
.gitignore -rw-r--r-- 69 bytes
Kconfig.freezer -rw-r--r-- 52 bytes
Kconfig.hz -rw-r--r-- 1.6 KB
Kconfig.locks -rw-r--r-- 4.8 KB
Kconfig.preempt -rw-r--r-- 2.1 KB
Makefile -rw-r--r-- 4.1 KB
acct.c -rw-r--r-- 15.4 KB
async.c -rw-r--r-- 9.9 KB
audit.c -rw-r--r-- 53.7 KB
audit.h -rw-r--r-- 11.1 KB
audit_fsnotify.c -rw-r--r-- 6.1 KB
audit_tree.c -rw-r--r-- 22.6 KB
audit_watch.c -rw-r--r-- 14.3 KB
auditfilter.c -rw-r--r-- 34.0 KB
auditsc.c -rw-r--r-- 64.4 KB
backtracetest.c -rw-r--r-- 2.1 KB
bounds.c -rw-r--r-- 703 bytes
capability.c -rw-r--r-- 12.9 KB
cgroup.c -rw-r--r-- 174.5 KB
cgroup_freezer.c -rw-r--r-- 12.4 KB
cgroup_pids.c -rw-r--r-- 8.9 KB
compat.c -rw-r--r-- 29.5 KB
configs.c -rw-r--r-- 2.8 KB
context_tracking.c -rw-r--r-- 6.3 KB
cpu.c -rw-r--r-- 43.0 KB
cpu_pm.c -rw-r--r-- 6.5 KB
cpuset.c -rw-r--r-- 76.2 KB
crash_dump.c -rw-r--r-- 1.3 KB
cred.c -rw-r--r-- 21.5 KB
delayacct.c -rw-r--r-- 4.5 KB
dma.c -rw-r--r-- 3.6 KB
elfcore.c -rw-r--r-- 396 bytes
exec_domain.c -rw-r--r-- 1.4 KB
exit.c -rw-r--r-- 43.9 KB
extable.c -rw-r--r-- 4.0 KB
fork.c -rw-r--r-- 51.5 KB
freezer.c -rw-r--r-- 4.4 KB
futex.c -rw-r--r-- 89.1 KB
futex_compat.c -rw-r--r-- 4.5 KB
groups.c -rw-r--r-- 5.9 KB
hung_task.c -rw-r--r-- 5.9 KB
irq_work.c -rw-r--r-- 4.4 KB
jump_label.c -rw-r--r-- 15.2 KB
kallsyms.c -rw-r--r-- 15.7 KB
kcmp.c -rw-r--r-- 4.4 KB
kcov.c -rw-r--r-- 6.6 KB
kexec.c -rw-r--r-- 6.8 KB
kexec_core.c -rw-r--r-- 39.6 KB
kexec_file.c -rw-r--r-- 24.5 KB
kexec_internal.h -rw-r--r-- 1.2 KB
kmod.c -rw-r--r-- 19.1 KB
kprobes.c -rw-r--r-- 60.7 KB
ksysfs.c -rw-r--r-- 6.2 KB
kthread.c -rw-r--r-- 19.2 KB
latencytop.c -rw-r--r-- 7.8 KB
membarrier.c -rw-r--r-- 2.4 KB
memremap.c -rw-r--r-- 11.6 KB
module-internal.h -rw-r--r-- 458 bytes
module.c -rw-r--r-- 109.3 KB
module_signing.c -rw-r--r-- 2.2 KB
notifier.c -rw-r--r-- 16.3 KB
nsproxy.c -rw-r--r-- 6.4 KB
padata.c -rw-r--r-- 25.2 KB
panic.c -rw-r--r-- 14.6 KB
params.c -rw-r--r-- 24.1 KB
pid.c -rw-r--r-- 15.0 KB
pid_namespace.c -rw-r--r-- 10.0 KB
profile.c -rw-r--r-- 14.7 KB
ptrace.c -rw-r--r-- 31.6 KB
range.c -rw-r--r-- 3.0 KB
reboot.c -rw-r--r-- 13.3 KB
relay.c -rw-r--r-- 33.4 KB
resource.c -rw-r--r-- 39.3 KB
seccomp.c -rw-r--r-- 23.6 KB
signal.c -rw-r--r-- 94.1 KB
smp.c -rw-r--r-- 19.5 KB
smpboot.c -rw-r--r-- 13.2 KB
smpboot.h -rw-r--r-- 601 bytes
softirq.c -rw-r--r-- 18.9 KB
stacktrace.c -rw-r--r-- 1.7 KB
stop_machine.c -rw-r--r-- 16.7 KB
sys.c -rw-r--r-- 57.6 KB
sys_ni.c -rw-r--r-- 7.0 KB
sysctl.c -rw-r--r-- 67.5 KB
sysctl_binary.c -rw-r--r-- 50.8 KB
task_work.c -rw-r--r-- 3.3 KB
taskstats.c -rw-r--r-- 14.8 KB
test_kprobes.c -rw-r--r-- 7.4 KB
torture.c -rw-r--r-- 21.0 KB
tracepoint.c -rw-r--r-- 14.5 KB
tsacct.c -rw-r--r-- 5.1 KB
uid16.c -rw-r--r-- 5.0 KB
up.c -rw-r--r-- 1.7 KB
user-return-notifier.c -rw-r--r-- 1.3 KB
user.c -rw-r--r-- 5.4 KB
user_namespace.c -rw-r--r-- 25.7 KB
utsname.c -rw-r--r-- 3.0 KB
utsname_sysctl.c -rw-r--r-- 3.0 KB
watchdog.c -rw-r--r-- 29.6 KB
workqueue.c -rw-r--r-- 152.2 KB
workqueue_internal.h -rw-r--r-- 2.2 KB

back to top