On Fri, Jun 22, 2012 at 05:10:20PM +0300, Konstantin Belousov wrote:
> On Fri, Jun 22, 2012 at 06:49:59AM -0700, David Wolfskill wrote:
> > Just updated my laptop's head slice from r237378 to r237440; while
> > it did manage to get to multi-user mode, I was only able to login as
> > root, and whenever I tried to do much of anything, the sell (csh) exited
> > with a SIGSEGV.
> > 
> > I finally gave it a "3-fingered salute", [Ctl-Alt-Del], and init
> > appeared to enter a non-terminating SIGSEGV loop.
> > 
> > My build machine is still building the kernel; assuming(!) I see similar
> > behavior on that, I should be able to poke around a bit, as I have a
> > serial console on it (though I'll be remote from it, as I'll be at
> > work).
> > 
> > Anyway, I thought I'd mention this in case it might help someone.
> > 
> > The typescript from the "svn update" and the resulting build may be
> > found at <http://www/~david/FreeBSD/head_r237440.txt>.
> This is on i386, right ?
> 
> Can you boot single-user and just type date in the shell ?
> Does it segfault ?
> 
> If yes, does setting sysctl kern.timecounter.fast_gettime to 0 fix
> segfault from date(1) ?

Ok, I probably can guess the cause. I suppose that 'date' does not
segfaults.

Please try the following (which I forgot to commit). Sorry.

diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index f0546b0..30efecd 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -469,7 +469,8 @@ osendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
        }
 
        regs->tf_esp = (int)fp;
-       regs->tf_eip = PS_STRINGS - szosigcode;
+       regs->tf_eip = p->p_sysent->sv_sigcode_base + szsigcode -
+           szosigcode;
        regs->tf_eflags &= ~(PSL_T | PSL_D);
        regs->tf_cs = _ucodesel;
        regs->tf_ds = _udatasel;
@@ -596,7 +597,8 @@ freebsd4_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t 
*mask)
        }
 
        regs->tf_esp = (int)sfp;
-       regs->tf_eip = PS_STRINGS - szfreebsd4_sigcode;
+       regs->tf_eip = p->p_sysent->sv_sigcode_base + szsigcode -
+           szfreebsd4_sigcode;
        regs->tf_eflags &= ~(PSL_T | PSL_D);
        regs->tf_cs = _ucodesel;
        regs->tf_ds = _udatasel;
@@ -747,7 +749,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
        }
 
        regs->tf_esp = (int)sfp;
-       regs->tf_eip = PS_STRINGS - *(p->p_sysent->sv_szsigcode);
+       regs->tf_eip = p->p_sysent->sv_sigcode_base;
        regs->tf_eflags &= ~(PSL_T | PSL_D);
        regs->tf_cs = _ucodesel;
        regs->tf_ds = _udatasel;

Attachment: pgpchlQV7q2nw.pgp
Description: PGP signature

Reply via email to