freebsd-dev/sys/kern
Mateusz Guzik 2ca66c1ef5 Fix process exit vs reap race introduced in r329449
The race manifested itself mostly in terms of crashes with "spin lock
held too long".

Relevant parts of respective code paths:

exit:				reap:
PROC_LOCK(p);
PROC_SLOCK(p);
p->p_state == PRS_ZOMBIE
PROC_UNLOCK(p);
				PROC_LOCK(p);
/* exit work */
				if (p->p_state == PRS_ZOMBIE) /* true */
					proc_reap()
					free proc
/* more exit work */
PROC_SUNLOCK(p);

Thus a still exiting process is reaped.

Prior to the change the zombie check was followed by slock/sunlock trip
which prevented the problem.

Even code prior to this commit has a bug: the proc is still accessed for
statistic collection purposes. However, the severity is rather small and
the bug may be fixed in a future commit.

Reported by:	many
Tested by:	allanjude
2018-02-19 00:54:08 +00:00
..
bus_if.m
capabilities.conf
clock_if.m
cpufreq_if.m
device_if.m Teach makeobjops.awk to accept PROLOG and EPILOG blocks before 2017-12-31 09:23:19 +00:00
genassym.sh
imgact_aout.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
imgact_binmisc.c
imgact_elf32.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
imgact_elf64.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
imgact_elf.c Always give ELF brands a chance to veto a match. 2018-02-05 23:27:42 +00:00
imgact_gzip.c SPDX: use the Beerware identifier. 2017-11-30 20:33:45 +00:00
imgact_shell.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
inflate.c SPDX: use the Beerware identifier. 2017-11-30 20:33:45 +00:00
init_main.c Use per-domain locks for vm page queue free. Move paging control from 2018-02-06 22:10:07 +00:00
init_sysent.c Implement 'domainset', a cpuset based NUMA policy mechanism. This allows 2018-01-12 22:48:23 +00:00
kern_acct.c spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
kern_alq.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_clock.c make SW_WATCHDOG dynamic 2018-01-03 00:56:30 +00:00
kern_clocksource.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_condvar.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_conf.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_cons.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
kern_context.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_cpu.c Revert r327828, r327949, r327953, r328016-r328026, r328041: 2018-01-21 15:42:36 +00:00
kern_cpuset.c Implement 'domainset', a cpuset based NUMA policy mechanism. This allows 2018-01-12 22:48:23 +00:00
kern_ctf.c Revert r327828, r327949, r327953, r328016-r328026, r328041: 2018-01-21 15:42:36 +00:00
kern_descrip.c Use long for the last argument to VOP_PATHCONF rather than a register_t. 2018-01-17 22:36:58 +00:00
kern_dtrace.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_dump.c make SW_WATCHDOG dynamic 2018-01-03 00:56:30 +00:00
kern_environment.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_et.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_event.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_exec.c exec_map_first_page: fix an inverse condition introduced in r254138 2018-02-07 21:51:59 +00:00
kern_exit.c Fix process exit vs reap race introduced in r329449 2018-02-19 00:54:08 +00:00
kern_fail.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_ffclock.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_fork.c Postpone sx_sunlock(&proctree_lock) on fork until after allproc is dropped. 2018-02-17 00:23:28 +00:00
kern_hhook.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_idle.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_intr.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_jail.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_khelp.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_kthread.c Instrument thread creations for the the benefit of the TSLOG framework. 2017-12-31 09:24:11 +00:00
kern_ktr.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_ktrace.c Decode kevent structures logged via ktrace(2) in kdump. 2017-11-25 04:49:12 +00:00
kern_linker.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_lock.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_lockf.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
kern_lockstat.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_loginclass.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_malloc.c Fix boot_pages exhaustion on machines with many domains and cores, where 2018-02-09 04:45:39 +00:00
kern_mbuf.c Implement NUMA support in uma(9) and malloc(9). Allocations from specific 2018-01-12 23:25:05 +00:00
kern_mib.c Make v_wire_count a per-cpu counter(9) counter. This eliminates a 2018-02-12 22:53:00 +00:00
kern_module.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_mtxpool.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_mutex.c mtx: add mtx_spin_wait_unlocked 2018-02-19 00:38:14 +00:00
kern_ntptime.c
kern_osd.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_physio.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_pmc.c Revert r327828, r327949, r327953, r328016-r328026, r328041: 2018-01-21 15:42:36 +00:00
kern_poll.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_priv.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_proc.c Report offset relative to the backing object for kinfo_vmentry structures. 2018-01-04 21:59:34 +00:00
kern_procctl.c Kill all descendants of the reaper, even if they are descendants of a 2017-11-23 11:25:11 +00:00
kern_prot.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
kern_racct.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_rangelock.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_rctl.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_resource.c Always use atomic_fetchadd() when updating per-user accounting values. 2018-01-04 22:07:58 +00:00
kern_rmlock.c Clean up the SYSINIT_FLAGS definitions for rwlock(9) and rmlock(9). 2017-11-21 14:59:23 +00:00
kern_rwlock.c Undo LOCK_PROFILING pessimisation after r313454 and r313455 2018-02-17 12:07:09 +00:00
kern_sdt.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_sema.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_sendfile.c Dequeue wired pages lazily. 2018-02-07 16:57:10 +00:00
kern_sharedpage.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_shutdown.c Add support for zstd-compressed user and kernel core dumps. 2018-02-13 19:28:02 +00:00
kern_sig.c Add support for zstd-compressed user and kernel core dumps. 2018-02-13 19:28:02 +00:00
kern_switch.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_sx.c Undo LOCK_PROFILING pessimisation after r313454 and r313455 2018-02-17 12:07:09 +00:00
kern_synch.c Do pass removing some write-only variables from the kernel. 2017-12-25 04:48:39 +00:00
kern_syscalls.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_sysctl.c Slightly bump the maximum OID path for loading tunable SYSCTLs. 2018-02-02 12:42:46 +00:00
kern_tc.c Use atomic_load(9) to read ppsinfo sequence numbers. 2017-12-19 10:05:45 +00:00
kern_thr.c Implement 'domainset', a cpuset based NUMA policy mechanism. This allows 2018-01-12 22:48:23 +00:00
kern_thread.c Implement 'domainset', a cpuset based NUMA policy mechanism. This allows 2018-01-12 22:48:23 +00:00
kern_time.c nanosleep(2): Fix bogus incrementing of rmtp by tc_tick_sbt on [EINTR]. 2018-02-14 18:43:50 +00:00
kern_timeout.c Remove some, but not all, assumptions that the BSP is CPU 0 and that CPUs 2017-11-25 23:41:05 +00:00
kern_tslog.c Code for recording timestamps of events, especially function entries/exits. 2017-12-31 09:21:01 +00:00
kern_umtx.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_uuid.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
kern_xxx.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
ksched.c spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
link_elf_obj.c Ignore relocation tables for non-memory-resident sections. 2018-02-05 23:35:33 +00:00
link_elf.c Do pass removing some write-only variables from the kernel. 2017-12-25 04:48:39 +00:00
linker_if.m
Make.tags.inc
Makefile Don't use an .OBJDIR for 'make sysent'. 2018-01-29 19:14:15 +00:00
makesyscalls.sh makesyscalls: permit a range of syscall numbers for UNIMPL 2018-01-30 18:29:38 +00:00
md4c.c SPDX: some uses of the RSA-MD license. 2017-12-13 16:30:39 +00:00
md5c.c
msi_if.m
p1003_1b.c spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
pic_if.m
posix4_mib.c spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
sched_4bsd.c Implement 'domainset', a cpuset based NUMA policy mechanism. This allows 2018-01-12 22:48:23 +00:00
sched_ule.c Reverting r328320 2018-01-24 13:57:01 +00:00
serdev_if.m
stack_protector.c
subr_acl_nfs4.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_acl_posix1e.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_autoconf.c Instrument "boot holds" for the benefit of the TSLOG framework. These 2017-12-31 09:23:52 +00:00
subr_blist.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
subr_bufring.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_bus_dma.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_bus.c Fix LINT build after r328508, add forgotten part in format string 2018-01-29 02:29:08 +00:00
subr_busdma_bufalloc.c Implement NUMA support in uma(9) and malloc(9). Allocations from specific 2018-01-12 23:25:05 +00:00
subr_capability.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_clock.c Replace the existing print_ct() private debugging function with a set of 2018-02-12 16:25:56 +00:00
subr_compressor.c Fix the test for SET_FOREACH termination. 2018-02-15 17:35:40 +00:00
subr_counter.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_devmap.c
subr_devstat.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_disk.c SPDX: use the Beerware identifier. 2017-11-30 20:33:45 +00:00
subr_dummy_vdso_tc.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_eventhandler.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_fattime.c Use const pointers for input data not modified by clock utility functions. 2018-02-06 22:17:01 +00:00
subr_firmware.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_gtaskqueue.c
subr_hash.c Unsign some values related to allocation. 2018-01-22 02:08:10 +00:00
subr_hints.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_intr.c
subr_kdb.c KDB: restart only CPUs stopped by KDB 2018-01-18 07:38:54 +00:00
subr_kobj.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_lock.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_log.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
subr_mchain.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
subr_module.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_msgbuf.c Do pass removing some write-only variables from the kernel. 2017-12-25 04:48:39 +00:00
subr_param.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
subr_pcpu.c Make v_wire_count a per-cpu counter(9) counter. This eliminates a 2018-02-12 22:53:00 +00:00
subr_pctrie.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_power.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_prf.c Use the TSLOG framework to record entry/exit timestamps for DELAY and 2017-12-31 09:24:41 +00:00
subr_prof.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
subr_rman.c
subr_rtc.c Fix bad indentation. Whitespace only, no functional changes. 2018-02-13 17:38:08 +00:00
subr_sbuf.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_scanf.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
subr_sfbuf.c Remove SFBUF_OPTIONAL_DIRECT_MAP and such hacks, replacing them across the 2018-01-19 17:46:31 +00:00
subr_sglist.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
subr_sleepqueue.c Do pass removing some write-only variables from the kernel. 2017-12-25 04:48:39 +00:00
subr_smp.c Use resume_cpus() instead of restart_cpus() to resume from ACPI suspension. 2017-12-21 09:17:48 +00:00
subr_stack.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_syscall.c spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
subr_taskqueue.c Revert r327828, r327949, r327953, r328016-r328026, r328041: 2018-01-21 15:42:36 +00:00
subr_terminal.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_trap.c spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
subr_turnstile.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_uio.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
subr_unit.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
subr_vmem.c Fix three miscalculations in amount of boot pages: 2018-02-07 18:32:51 +00:00
subr_witness.c Use per-domain locks for vm page queue free. Move paging control from 2018-02-06 22:10:07 +00:00
sys_capability.c Fix broken assertion in r329520. 2018-02-18 20:04:39 +00:00
sys_generic.c Destroy seltd st_mtx and st_wait in seltdfini(). 2017-12-01 11:18:19 +00:00
sys_pipe.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
sys_procdesc.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
sys_process.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
sys_socket.c Ensure that the vnet is set when calling pru_sockaddr() and 2018-01-11 20:26:17 +00:00
syscalls.c Regenerate auto-generated files 2018-01-12 23:06:35 +00:00
syscalls.master Implement 'domainset', a cpuset based NUMA policy mechanism. This allows 2018-01-12 22:48:23 +00:00
systrace_args.c Regenerate auto-generated files 2018-01-12 23:06:35 +00:00
sysv_ipc.c sysv_{ipc|shm}: update the NetBSD VCS tags to match nearer our files. 2017-12-31 03:34:00 +00:00
sysv_msg.c Correct/improve the descriptions if kern.ipc.(shmsegs,sema,msqids). 2018-02-18 19:19:36 +00:00
sysv_sem.c Correct/improve the descriptions if kern.ipc.(shmsegs,sema,msqids). 2018-02-18 19:19:36 +00:00
sysv_shm.c Correct/improve the descriptions if kern.ipc.(shmsegs,sema,msqids). 2018-02-18 19:19:36 +00:00
tty_compat.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
tty_info.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
tty_inq.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
tty_outq.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
tty_pts.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
tty_tty.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
tty_ttydisc.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
tty.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
uipc_accf.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
uipc_debug.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
uipc_domain.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
uipc_mbuf2.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
uipc_mbuf.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
uipc_mbufhash.c
uipc_mqueue.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
uipc_sem.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
uipc_shm.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
uipc_sockbuf.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
uipc_socket.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
uipc_syscalls.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
uipc_usrreq.c Forgot to sort here in r328238. 2018-01-22 02:26:10 +00:00
vfs_acl.c Reduce duplication in __acl_*_(file|link). 2018-02-15 21:24:43 +00:00
vfs_aio.c Don't store shadow copies of per-process AIO limits. 2018-01-10 21:18:46 +00:00
vfs_bio.c Make v_wire_count a per-cpu counter(9) counter. This eliminates a 2018-02-12 22:53:00 +00:00
vfs_cache.c Plug a name cache lock leak. 2017-12-01 22:51:02 +00:00
vfs_cluster.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
vfs_default.c For many years the message "fsync: giving up on dirty" has occationally 2018-01-26 18:17:11 +00:00
vfs_export.c Reverse the check to allocate the buffer if cached pointer is NULL. 2017-12-23 17:55:19 +00:00
vfs_extattr.c Reduce duplication in extattr_*_(file|link) syscalls. 2018-02-05 19:06:34 +00:00
vfs_hash.c sys/kern: adoption of SPDX licensing ID tags. 2017-11-27 15:20:12 +00:00
vfs_init.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
vfs_lookup.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
vfs_mount.c Use EVENTHANDLER_DIRECT_INVOKE for [un]mount events, for better performance. 2018-01-07 18:07:22 +00:00
vfs_mountroot.c Instrument "boot holds" for the benefit of the TSLOG framework. These 2017-12-31 09:23:52 +00:00
vfs_subr.c One of the vnode fields listed by vn_printf is the union of pointers 2018-01-31 22:49:50 +00:00
vfs_syscalls.c Use long for the last argument to VOP_PATHCONF rather than a register_t. 2018-01-17 22:36:58 +00:00
vfs_vnops.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
vnode_if.src Use long for the last argument to VOP_PATHCONF rather than a register_t. 2018-01-17 22:36:58 +00:00