Fix p_endcopy.

For p_endcopy to work correctly, it must be the name of the next element
in struct proc after the end of the copy region, not the name of the
last element in the copy region.  Currently, the last element
(p_elf_flags) is not being copied.  In addition, the p_xexit and
p_xsig fields should not be copied on fork, so move them out of the
copy region.

Reviewed by:	kib
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D10677
This commit is contained in:
John Baldwin 2017-05-16 18:39:23 +00:00
parent 1e3ab5fd4a
commit 047e65ec2d

View file

@ -624,13 +624,13 @@ struct proc {
pid_t p_reapsubtree; /* (e) Pid of the direct child of the
reaper which spawned
our subtree. */
u_int p_xexit; /* (c) Exit code. */
u_int p_xsig; /* (c) Stop/kill sig. */
uint16_t p_elf_machine; /* (x) ELF machine type */
uint64_t p_elf_flags; /* (x) ELF flags */
/* End area that is copied on creation. */
#define p_endcopy p_elf_flags
#define p_endcopy p_xexit
u_int p_xexit; /* (c) Exit code. */
u_int p_xsig; /* (c) Stop/kill sig. */
struct pgrp *p_pgrp; /* (c + e) Pointer to process group. */
struct knlist *p_klist; /* (c) Knotes attached to this proc. */
int p_numthreads; /* (c) Number of threads. */