Re: NetBSD-10.0/i386 spurious SIGSEGV

2024-06-09 Thread Emmanuel Dreyfus
On Sat, Jun 08, 2024 at 10:10:58PM -0400, Mouse wrote:
> Are all the failures in __gettimeofday50?  All in trap-to-the-kernel
> calls?

Here is an example with syslogd

Core was generated by `syslogd'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0xbb0384d7 in writev () from /lib/libc.so.12
(gdb) bt
#0  0xbb0384d7 in writev () from /lib/libc.so.12
#1  0xa252 in fprintlog (f=0xbaf44c00, passedbuffer=, 
qentry=0x0) at /usr/src/usr.sbin/syslogd/syslogd.c:2474
#2  0xb2b6 in logmsg (buffer=0xbaf295c0)
at /usr/src/usr.sbin/syslogd/syslogd.c:2012
(...)

   0xbb0384d0 : mov$0x79,%eax
   0xbb0384d5 :   int$0x80
=> 0xbb0384d7 :   jb 0xbb0384da 
   0xbb0384d9 :   ret


-- 
Emmanuel Dreyfus
m...@netbsd.org


Re: NetBSD-10.0/i386 spurious SIGSEGV

2024-06-09 Thread Taylor R Campbell
> Date: Sun, 9 Jun 2024 05:28:49 +
> From: Emmanuel Dreyfus 
> 
> I have seen many crashes on system call returns. Another one on
> __gettimeofday50:
> 
>0xbb610570 <__gettimeofday50>: mov$0x1a2,%eax
>0xbb610575 <__gettimeofday50+5>:   int$0x80
>0xbb610577 <__gettimeofday50+7>:   jb 0xbb61057a <__gettimeofday50+10>
>0xbb610579 <__gettimeofday50+9>:   ret
> => 0xbb61057a <__gettimeofday50+10>:  push   %ebx
> 
> Another one:
>0xbb610570 <__gettimeofday50>: mov$0x1a2,%eax
>0xbb610575 <__gettimeofday50+5>:   int$0x80
> => 0xbb610577 <__gettimeofday50+7>:   jb 0xbb61057a <__gettimeofday50+10>
>0xbb610579 <__gettimeofday50+9>:   ret  

I would suggest printing the siginfo, but apparently our gdb doesn't
support it (so I filed PR 58325):

(gdb) print $_siginfo
$1 = void
(gdb) ptype $_siginfo
type = void

If we had the siginfo, it might provide a clue about why something
trapped to the kernel.


Re: NetBSD-10.0/i386 spurious SIGSEGV

2024-06-09 Thread Mouse
>> I have seen many crashes on system call returns.  [...]

> I would suggest printing the siginfo, but apparently our gdb doesn't
> support it (so I filed PR 58325): [...]

Okay, this is strictly a debugging workaround: how about building a
kernel with code added so that, whenever a SIGSEGV is delivered, the
siginfo is printed on the console?  It would at least let you get the
information, and I suspect SEGVs are rare enough you wouldn't have to
sift through too many false positives.

It does, though, assume you're comfortable adding code to your kernel
and rebuilding it.  (If trying to build a new kernel SEGVs, maybe
cross-build it?)

/~\ The ASCII Mouse
\ / Ribbon Campaign
 X  Against HTMLmo...@rodents-montreal.org
/ \ Email!   7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Re: tty process group use-after-free fix RFC

2024-06-09 Thread Jonathan A. Kollasch
On Tue, Apr 23, 2024 at 09:08:13PM -0500, Jonathan A. Kollasch wrote:
> 

This is now also at http://gnats.netbsd.org/58327


Re: NetBSD-10.0/i386 spurious SIGSEGV

2024-06-09 Thread Emmanuel Dreyfus
On Sun, Jun 09, 2024 at 08:44:19AM -0400, Mouse wrote:
> Okay, this is strictly a debugging workaround: how about building a
> kernel with code added so that, whenever a SIGSEGV is delivered, the
> siginfo is printed on the console?

Latest SIGSEGV on nagios:
   0xbb610570 <__gettimeofday50>:   mov$0x1a2,%eax
   0xbb610575 <__gettimeofday50+5>: int$0x80
   0xbb610577 <__gettimeofday50+7>: jb 0xbb61057a <__gettimeofday50+10>
   0xbb610579 <__gettimeofday50+9>: ret
=> 0xbb61057a <__gettimeofday50+10>:push   %ebx

I enabled TRAP_SIGDEBUG in src/sys/arch/i386/i386/trap.c and here is what
it says:

pid 853.853 (nagios): signal 11 code=1 (trap 6) @eip 0xbb61057a addr 0x7513f5a9 
error=14
trapframe 0xdd351fa8
eip 0xbb61057a  esp 0xbf7fdf34  efl 0x00010217
edi 0xb9a56b80  esi 0xb9be2380  edx 0x
ecx 0xb9a56b8b
ebp 0xbf7fdf50  ebx 0xbf7fdfa0  eax 0x
cs 0x0017  ds 0x001f  es 0x001f  fs 0x00ab  gs 0x00b3  ss 0x001f
fsbase 0x00cff300 gsbase 0xbbcff36e89b4

Stack dump: 256 bytes @ 0xdd351fa8
b3 00 00 00 ab 00 00 00  1f 00 00 00 1f 00 7f bf | 
80 6b a5 b9 80 23 be b9  50 df 7f bf a0 df 7f bf | .k...#..P...
00 00 00 00 8b 6b a5 b9  00 00 00 00 06 00 00 00 | .k..
04 00 00 00 7a 05 61 bb  17 00 00 00 17 02 01 00 | z.a.
34 df 7f bf 1f 00 00 00  00 00 00 00 00 00 00 00 | 4...
00 00 00 00 00 00 00 00  f0 3f 35 dd b0 3c 35 dd | .?5..<5.
f4 3c 35 dd 00 00 00 00  f0 e9 c5 ba 00 20 a7 00 | .<5.. ..
01 00 00 00 ff ff 00 00  00 f3 cf 00 ff ff b4 39 | ...9
e6 f3 cf ba 00 00 00 00  00 00 00 00 00 00 00 00 | 
7f 03 00 00 00 00 00 00  00 00 00 00 00 00 00 00 | 
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 | 
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 | 
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 | 
00 00 00 00 00 00 00 00  7f 03 00 00 00 00 00 00 | 
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 | 
80 1f 00 00 ff ff 00 00  00 00 00 00 00 00 00 00 | 


-- 
Emmanuel Dreyfus
m...@netbsd.org