Re: SIGSEGV in /bin/sh after r322740 -> r322776 update

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Tue, 22 Aug 2017 20:43:27 +0300
On Tue, Aug 22, 2017 at 09:07:03AM -0700, David Wolfskill wrote:
> On Tue, Aug 22, 2017 at 06:34:42PM +0300, Konstantin Belousov wrote:
> > ...
> > > Bisection time?  Or if there's another approach (or even a suggestion
> > > for a revision to try first), I'm up for it.  9And yes, I'll just
> > > be rebuilding the kernel for the rest of this exercise, I think.
> > > That should speed things up significantly.)
> > 
> > No need.  It is clearly something with r322762 (more likely) or
> > r322763 (less likely).
> 
> Ah.
> 
> > Give me some time, I either fix it today or revert the commits.
> 
> Cool.  I'm at work now, but if there's anything I can do (e.g.,
> testing), I will do what I can: I have serial console access to the
> machine (for example).

Try this.  The patch helped ae_at_, it seems.
I will commit it anyway in a hour, but more confirmations or nacks
would be good.  This patch has some debugging bits which add noise on
console when a process traps.  If this happens, please show me the lines.

Thank you for the patience.

diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index e5a69d715a7..d1de62d89a9 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
_at__at_ -147,7 +147,7 _at__at_ static int prot_fault_translation;
 SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RWTUN,
     &prot_fault_translation, 0,
     "Select signal to deliver on protection fault");
-static int uprintf_signal;
+static int uprintf_signal = 1;
 SYSCTL_INT(_machdep, OID_AUTO, uprintf_signal, CTLFLAG_RWTUN,
     &uprintf_signal, 0,
     "Print debugging information on trap signal to ctty");
_at__at_ -559,7 +559,7 _at__at_ trap(struct trapframe *frame)
 	ksi.ksi_trapno = type;
 	ksi.ksi_addr = (void *)addr;
 	if (uprintf_signal) {
-		uprintf("pid %d comm %s: signal %d err %lx code %d type %d "
+		printf("pid %d comm %s: signal %d err %lx code %d type %d "
 		    "addr 0x%lx rsp 0x%lx rip 0x%lx "
 		    "<%02x %02x %02x %02x %02x %02x %02x %02x>\n",
 		    p->p_pid, p->p_comm, signo, frame->tf_err, ucode, type,
_at__at_ -572,6 +572,8 _at__at_ trap(struct trapframe *frame)
 		    fubyte((void *)(frame->tf_rip + 5)),
 		    fubyte((void *)(frame->tf_rip + 6)),
 		    fubyte((void *)(frame->tf_rip + 7)));
+		printf("fsbase %#lx pcbfsbase %#lx flags %x\n", rdfsbase(),
+		    td->td_pcb->pcb_fsbase, td->td_pcb->pcb_flags);
 	}
 	KASSERT((read_rflags() & PSL_I) != 0, ("interrupts disabled"));
 	trapsignal(td, &ksi);
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index db82da4c8fe..f71378b36f8 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
_at__at_ -172,6 +172,7 _at__at_ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
 
 	/* Ensure that td1's pcb is up to date. */
 	fpuexit(td1);
+	update_pcb_bases(td1->td_pcb);
 
 	/* Point the pcb to the top of the stack */
 	pcb2 = get_pcb_td(td2);
_at__at_ -433,6 +434,7 _at__at_ cpu_copy_thread(struct thread *td, struct thread *td0)
 	 * Those not loaded individually below get their default
 	 * values here.
 	 */
+	update_pcb_bases(td0->td_pcb);
 	bcopy(td0->td_pcb, pcb2, sizeof(*pcb2));
 	clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE |
 	    PCB_KERNFPU);
Received on Tue Aug 22 2017 - 15:43:43 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:12 UTC