Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Aug 2017 20:43:27 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        David Wolfskill <david@catwhisker.org>, current@freebsd.org
Subject:   Re: SIGSEGV in /bin/sh after r322740 -> r322776 update
Message-ID:  <20170822174327.GK1700@kib.kiev.ua>
In-Reply-To: <20170822160703.GW1130@albert.catwhisker.org>
References:  <20170822114627.GC1130@albert.catwhisker.org> <20170822115923.GC1700@kib.kiev.ua> <20170822122836.GH1130@albert.catwhisker.org> <20170822123449.GD1700@kib.kiev.ua> <20170822124617.GN1130@albert.catwhisker.org> <20170822131958.GE1700@kib.kiev.ua> <20170822151738.GV1130@albert.catwhisker.org> <20170822153442.GG1700@kib.kiev.ua> <20170822160703.GW1130@albert.catwhisker.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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@, 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
@@ -147,7 +147,7 @@ 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");
@@ -559,7 +559,7 @@ 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,
@@ -572,6 +572,8 @@ 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
@@ -172,6 +172,7 @@ 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);
@@ -433,6 +434,7 @@ 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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170822174327.GK1700>