In cpu_fork(), initialize pcb_psl for the new process to PSL_KERNEL,

instead of taking the (userland) eflags from the trap frame and masking
out PSL_I. There is no need to inherit any flags from the forking process;
the old method however can cause flags set in userland for the forking
process to be bogusly set in kernel mode when the newly forked process
runs for the first time (in particular PSL_T, which is set for userland
when the process is single-stepped; this would cause trace traps in
kernel mode).

Approved by:	re (jhb)
This commit is contained in:
Thomas Moestl 2003-05-16 01:10:33 +00:00
parent d98ae55eaf
commit a93b6bf5e9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=115044

View file

@ -181,7 +181,7 @@ cpu_fork(td1, p2, td2, flags)
pcb2->pcb_esp = (int)td2->td_frame - sizeof(void *);
pcb2->pcb_ebx = (int)td2; /* fork_trampoline argument */
pcb2->pcb_eip = (int)fork_trampoline;
pcb2->pcb_psl = td2->td_frame->tf_eflags & ~PSL_I; /* ints disabled */
pcb2->pcb_psl = PSL_KERNEL; /* ints disabled */
pcb2->pcb_gs = rgs();
/*-
* pcb2->pcb_dr*: cloned above.