Date: Thu, 27 Jul 2017 19:28:56 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Eugene Grosbein <eugen@grosbein.net> Cc: FreeBSD Stable <freebsd-stable@FreeBSD.org> Subject: Re: stable/11 regression: SIGSYS in the /bin/sh Message-ID: <20170727162856.GH1700@kib.kiev.ua> In-Reply-To: <597A018D.4040601@grosbein.net> References: <597A018D.4040601@grosbein.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jul 27, 2017 at 10:06:53PM +0700, Eugene Grosbein wrote: > Hi! > > Very recently stable/11 got a problem somewhere between r321073 and r321459: > /bin/sh crashes with SIGSYS at boot time: > > Trying to mount root from ufs:/dev/ada0s1a [ro]... > start_init: trying /sbin/init > ppid 21 (sh), uid 0: exited on signal 12 > id 21 comm sh: nosys 42 > Jul 27 14:30:23 init: /bin/sh on /etc/rc terminated abnormally, going to single user mode Take your /bin/sh, libraries and rtld to some other machine and try to catch where the pipe(2) call come from. I do not see any other way forward, assuming your build env is not contaminated somehow. I did the following on the today stable/11: pooma% ktrace -if /tmp/ktrace.out sh -c 'jot 100 | grep 1 | wc -l' 20 pooma% kdump -f /tmp/ktrace.out | grep pipe 1493 sh CALL pipe2(0x7fffffffe390,0) 1493 sh RET pipe2 0 1493 sh CALL pipe2(0x7fffffffe390,0) 1493 sh RET pipe2 0 > > This is *not* upgrade but complete rebuild of NanoBSD image: > all binaries, libraries and kernel are built from stable/11 sources. > > My custom kernel for amd64 has COMPAT_43TTY and COMPAT_FREEBSD32 options > and no other COMPAT_XXX options. It has no COMPAT_FREEBSD10 option too > as this is new installation. > > Also, I needed the following patch to make sysctl kern.lognosys > work for non-tty case: > > --- sys/kern/subr_prf.c.orig 2017-07-25 15:14:27.236304000 +0700 > +++ sys/kern/subr_prf.c 2017-07-27 21:05:55.912042000 +0700 > @@ -958,6 +958,7 @@ number: > break; > } > } > + return (retval); > #undef PCHAR > } > > --- sys/kern/kern_sig.c.orig 2017-07-25 15:14:27.232126000 +0700 > +++ sys/kern/kern_sig.c 2017-07-27 21:07:58.298440000 +0700 > @@ -3596,7 +3596,9 @@ > tdsignal(td, SIGSYS); > PROC_UNLOCK(p); > if (kern_lognosys) > - uprintf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm, > + if (!uprintf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm, > + td->td_sa.code)) > + printf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm, > td->td_sa.code); > return (ENOSYS); > } > The following has more regular behavior. diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 37da97924ca..ce5e7b2768f 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -3579,9 +3579,14 @@ nosys(struct thread *td, struct nosys_args *args) PROC_LOCK(p); tdsignal(td, SIGSYS); PROC_UNLOCK(p); - if (kern_lognosys) + if (kern_lognosys == 1 || kern_lognosys == 3) { uprintf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm, td->td_sa.code); + } + if (kern_lognosys == 2 || kern_lognosys == 3) { + printf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm, + td->td_sa.code); + } return (ENOSYS); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170727162856.GH1700>