public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* SIGBUS failure for misc/tst-bz21269 on i386
@ 2018-03-14 13:35 Florian Weimer
  2018-03-14 13:44 ` H.J. Lu
  2018-03-27 21:47 ` Aurelien Jarno
  0 siblings, 2 replies; 9+ messages in thread
From: Florian Weimer @ 2018-03-14 13:35 UTC (permalink / raw)
  To: GNU C Library

Has anyone else seen this failure?

I saw it with this kernel:

Linux buildvm-09.phx2.fedoraproject.org 4.15.3-300.fc27.x86_64 #1 SMP 
Tue Feb 13 17:02:01 UTC 2018 i686 i686 i386 GNU/Linux

The CPU has AVX2, but not AVX-512.  I couldn't reproduce it on another 
AVX2 machine.  The failure happened in the Fedora build environment, so 
I don't have a coredump.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: SIGBUS failure for misc/tst-bz21269 on i386
  2018-03-14 13:35 SIGBUS failure for misc/tst-bz21269 on i386 Florian Weimer
@ 2018-03-14 13:44 ` H.J. Lu
  2018-03-14 16:47   ` Adhemerval Zanella
  2018-03-27 21:47 ` Aurelien Jarno
  1 sibling, 1 reply; 9+ messages in thread
From: H.J. Lu @ 2018-03-14 13:44 UTC (permalink / raw)
  To: Florian Weimer; +Cc: GNU C Library

On Wed, Mar 14, 2018 at 6:34 AM, Florian Weimer <fweimer@redhat.com> wrote:
> Has anyone else seen this failure?
>
> I saw it with this kernel:
>
> Linux buildvm-09.phx2.fedoraproject.org 4.15.3-300.fc27.x86_64 #1 SMP Tue
> Feb 13 17:02:01 UTC 2018 i686 i686 i386 GNU/Linux
>
> The CPU has AVX2, but not AVX-512.  I couldn't reproduce it on another AVX2
> machine.  The failure happened in the Fedora build environment, so I don't
> have a coredump.
>

I didn't see it on AVX2 machines under 4.15.9-300.fc27.x86_64.

BTW, I always disable abrtd so that I can get a core dump.  I also have

[hjl@gnu-tools-1 etc]$ cat /etc/sysctl.d/coredump.conf
kernel.core_pattern=core
[hjl@gnu-tools-1 etc]$

-- 
H.J.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: SIGBUS failure for misc/tst-bz21269 on i386
  2018-03-14 13:44 ` H.J. Lu
@ 2018-03-14 16:47   ` Adhemerval Zanella
  0 siblings, 0 replies; 9+ messages in thread
From: Adhemerval Zanella @ 2018-03-14 16:47 UTC (permalink / raw)
  To: libc-alpha



On 14/03/2018 10:44, H.J. Lu wrote:
> On Wed, Mar 14, 2018 at 6:34 AM, Florian Weimer <fweimer@redhat.com> wrote:
>> Has anyone else seen this failure?
>>
>> I saw it with this kernel:
>>
>> Linux buildvm-09.phx2.fedoraproject.org 4.15.3-300.fc27.x86_64 #1 SMP Tue
>> Feb 13 17:02:01 UTC 2018 i686 i686 i386 GNU/Linux
>>
>> The CPU has AVX2, but not AVX-512.  I couldn't reproduce it on another AVX2
>> machine.  The failure happened in the Fedora build environment, so I don't
>> have a coredump.
>>
> 
> I didn't see it on AVX2 machines under 4.15.9-300.fc27.x86_64.
> 
> BTW, I always disable abrtd so that I can get a core dump.  I also have
> 
> [hjl@gnu-tools-1 etc]$ cat /etc/sysctl.d/coredump.conf
> kernel.core_pattern=core
> [hjl@gnu-tools-1 etc]$
> 

Also it should trigger a kernel regression since I used a kernel test
(tools/testing/selftests/x86/ldt_gdt.c) as base.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: SIGBUS failure for misc/tst-bz21269 on i386
  2018-03-14 13:35 SIGBUS failure for misc/tst-bz21269 on i386 Florian Weimer
  2018-03-14 13:44 ` H.J. Lu
@ 2018-03-27 21:47 ` Aurelien Jarno
  2018-03-27 21:58   ` H.J. Lu
  2018-03-28  8:01   ` Florian Weimer
  1 sibling, 2 replies; 9+ messages in thread
From: Aurelien Jarno @ 2018-03-27 21:47 UTC (permalink / raw)
  To: Florian Weimer; +Cc: GNU C Library

On 2018-03-14 14:34, Florian Weimer wrote:
> Has anyone else seen this failure?

I do see the issue. I can reproduce it on both Debian and Fedora.

> I saw it with this kernel:
> 
> Linux buildvm-09.phx2.fedoraproject.org 4.15.3-300.fc27.x86_64 #1 SMP Tue
> Feb 13 17:02:01 UTC 2018 i686 i686 i386 GNU/Linux

I am using 64-bit kernels:

Linux fedora.local 4.13.12-300.fc27.x86_64 #1 SMP Wed Nov 8 16:38:01 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Linux ohm 4.15.0-1-amd64 #1 SMP Debian 4.15.4-1 (2018-02-18) x86_64 GNU/Linux


> The CPU has AVX2, but not AVX-512.  I couldn't reproduce it on another AVX2

My CPU is a Core i3-5010U, so it has AVX2, but not AVX-512.

> machine.  The failure happened in the Fedora build environment, so I don't
> have a coredump.

Here is the coredump that I can get:

  Thread 1 "tst-bz21269" received signal SIGBUS, Bus error.
  0x565564a0 in do_test () at ../sysdeps/unix/sysv/linux/i386/tst-bz21269.c:217
  217           while (atomic_load (&ftx) != 0)
  (gdb) bt
  #0  0x565564a0 in do_test () at ../sysdeps/unix/sysv/linux/i386/tst-bz21269.c:217
  #1  0x56556bc2 in support_test_main (argc=<optimized out>, argv=0xffffd518, config=0xffffd424) at support_test_main.c:321
  #2  0x56556061 in main (argc=2, argv=0xffffd514) at ../support/test-driver.c:164
  (gdb) print &ftx
  $1 = (atomic_uint *) 0x5655a0e0 <ftx>
  (gdb) print ftx
  $2 = 0

Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: SIGBUS failure for misc/tst-bz21269 on i386
  2018-03-27 21:47 ` Aurelien Jarno
@ 2018-03-27 21:58   ` H.J. Lu
  2018-03-28  6:47     ` Aurelien Jarno
  2018-03-28  8:01   ` Florian Weimer
  1 sibling, 1 reply; 9+ messages in thread
From: H.J. Lu @ 2018-03-27 21:58 UTC (permalink / raw)
  To: Florian Weimer, GNU C Library

On Tue, Mar 27, 2018 at 2:47 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> On 2018-03-14 14:34, Florian Weimer wrote:
>> Has anyone else seen this failure?
>
> I do see the issue. I can reproduce it on both Debian and Fedora.
>
>> I saw it with this kernel:
>>
>> Linux buildvm-09.phx2.fedoraproject.org 4.15.3-300.fc27.x86_64 #1 SMP Tue
>> Feb 13 17:02:01 UTC 2018 i686 i686 i386 GNU/Linux
>
> I am using 64-bit kernels:
>
> Linux fedora.local 4.13.12-300.fc27.x86_64 #1 SMP Wed Nov 8 16:38:01 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
> Linux ohm 4.15.0-1-amd64 #1 SMP Debian 4.15.4-1 (2018-02-18) x86_64 GNU/Linux
>
>
>> The CPU has AVX2, but not AVX-512.  I couldn't reproduce it on another AVX2
>
> My CPU is a Core i3-5010U, so it has AVX2, but not AVX-512.
>
>> machine.  The failure happened in the Fedora build environment, so I don't
>> have a coredump.
>
> Here is the coredump that I can get:
>
>   Thread 1 "tst-bz21269" received signal SIGBUS, Bus error.
>   0x565564a0 in do_test () at ../sysdeps/unix/sysv/linux/i386/tst-bz21269.c:217
>   217           while (atomic_load (&ftx) != 0)
>   (gdb) bt
>   #0  0x565564a0 in do_test () at ../sysdeps/unix/sysv/linux/i386/tst-bz21269.c:217
>   #1  0x56556bc2 in support_test_main (argc=<optimized out>, argv=0xffffd518, config=0xffffd424) at support_test_main.c:321
>   #2  0x56556061 in main (argc=2, argv=0xffffd514) at ../support/test-driver.c:164
>   (gdb) print &ftx
>   $1 = (atomic_uint *) 0x5655a0e0 <ftx>
>   (gdb) print ftx
>   $2 = 0
>

Which GCC are you using?  How did you configure glibc?

-- 
H.J.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: SIGBUS failure for misc/tst-bz21269 on i386
  2018-03-27 21:58   ` H.J. Lu
@ 2018-03-28  6:47     ` Aurelien Jarno
  0 siblings, 0 replies; 9+ messages in thread
From: Aurelien Jarno @ 2018-03-28  6:47 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Florian Weimer, GNU C Library

On 2018-03-27 14:58, H.J. Lu wrote:
> On Tue, Mar 27, 2018 at 2:47 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> > On 2018-03-14 14:34, Florian Weimer wrote:
> >> Has anyone else seen this failure?
> >
> > I do see the issue. I can reproduce it on both Debian and Fedora.
> >
> >> I saw it with this kernel:
> >>
> >> Linux buildvm-09.phx2.fedoraproject.org 4.15.3-300.fc27.x86_64 #1 SMP Tue
> >> Feb 13 17:02:01 UTC 2018 i686 i686 i386 GNU/Linux
> >
> > I am using 64-bit kernels:
> >
> > Linux fedora.local 4.13.12-300.fc27.x86_64 #1 SMP Wed Nov 8 16:38:01 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
> > Linux ohm 4.15.0-1-amd64 #1 SMP Debian 4.15.4-1 (2018-02-18) x86_64 GNU/Linux
> >
> >
> >> The CPU has AVX2, but not AVX-512.  I couldn't reproduce it on another AVX2
> >
> > My CPU is a Core i3-5010U, so it has AVX2, but not AVX-512.
> >
> >> machine.  The failure happened in the Fedora build environment, so I don't
> >> have a coredump.
> >
> > Here is the coredump that I can get:
> >
> >   Thread 1 "tst-bz21269" received signal SIGBUS, Bus error.
> >   0x565564a0 in do_test () at ../sysdeps/unix/sysv/linux/i386/tst-bz21269.c:217
> >   217           while (atomic_load (&ftx) != 0)
> >   (gdb) bt
> >   #0  0x565564a0 in do_test () at ../sysdeps/unix/sysv/linux/i386/tst-bz21269.c:217
> >   #1  0x56556bc2 in support_test_main (argc=<optimized out>, argv=0xffffd518, config=0xffffd424) at support_test_main.c:321
> >   #2  0x56556061 in main (argc=2, argv=0xffffd514) at ../support/test-driver.c:164
> >   (gdb) print &ftx
> >   $1 = (atomic_uint *) 0x5655a0e0 <ftx>
> >   (gdb) print ftx
> >   $2 = 0
> >
> 
> Which GCC are you using?  How did you configure glibc?

I am using GCC 7.3.0 from Debian. I configured glibc with
../glibc/configure --prefix=/usr

Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: SIGBUS failure for misc/tst-bz21269 on i386
  2018-03-27 21:47 ` Aurelien Jarno
  2018-03-27 21:58   ` H.J. Lu
@ 2018-03-28  8:01   ` Florian Weimer
  2018-03-28 17:37     ` Aurelien Jarno
  1 sibling, 1 reply; 9+ messages in thread
From: Florian Weimer @ 2018-03-28  8:01 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: GNU C Library, H.J. Lu

[-- Attachment #1: Type: text/plain, Size: 1298 bytes --]

On 03/27/2018 11:47 PM, Aurelien Jarno wrote:
> Here is the coredump that I can get:
> 
>    Thread 1 "tst-bz21269" received signal SIGBUS, Bus error.
>    0x565564a0 in do_test () at ../sysdeps/unix/sysv/linux/i386/tst-bz21269.c:217
>    217           while (atomic_load (&ftx) != 0)
>    (gdb) bt
>    #0  0x565564a0 in do_test () at ../sysdeps/unix/sysv/linux/i386/tst-bz21269.c:217
>    #1  0x56556bc2 in support_test_main (argc=<optimized out>, argv=0xffffd518, config=0xffffd424) at support_test_main.c:321
>    #2  0x56556061 in main (argc=2, argv=0xffffd514) at ../support/test-driver.c:164
>    (gdb) print &ftx
>    $1 = (atomic_uint *) 0x5655a0e0 <ftx>
>    (gdb) print ftx
>    $2 = 0

Ahh.  I see.

       /* Fire up thread modify_ldt call.  */
       atomic_store (&ftx, 2);

       while (atomic_load (&ftx) != 0)
	;

       /* On success, modify_ldt will segfault us synchronously and we 
will escape via siglongjmp.  */
       support_record_failure ();

But:

   xsethandler (SIGSEGV, sigsegv_handler, 0);
   /* 32-bit kernels send SIGILL instead of SIGSEGV on IRET faults.  */
   xsethandler (SIGILL, sigsegv_handler, 0);

So some kernels apparently use SIGBUS instead, and the crash actually 
shows the test succeeded.

Would you please try the attached patch?

Thanks,
Florian

[-- Attachment #2: sigbus.patch --]
[-- Type: text/x-patch, Size: 902 bytes --]

Subject: [PATCH] Linux i386: tst-bz21269 triggers SIGBUS on some kernels
To: libc-alpha@sourceware.org

In addition to SIGSEGV and SIGILL, SIGBUS is also a possible signal
generated by the kernel.

2018-03-28  Florian Weimer  <fweimer@redhat.com>

	* sysdeps/unix/sysv/linux/i386/tst-bz21269.c (do_test): Also
	capture SIGBUS.

diff --git a/sysdeps/unix/sysv/linux/i386/tst-bz21269.c b/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
index 353e36507d..6ee3fc62be 100644
--- a/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
+++ b/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
@@ -177,6 +177,8 @@ do_test (void)
   xsethandler (SIGSEGV, sigsegv_handler, 0);
   /* 32-bit kernels send SIGILL instead of SIGSEGV on IRET faults.  */
   xsethandler (SIGILL, sigsegv_handler, 0);
+  /* Some kernels send SIGBUS instead.  */
+  xsethandler (SIGBUS, sigsegv_handler, 0);
 
   thread = xpthread_create (0, threadproc, 0);
 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: SIGBUS failure for misc/tst-bz21269 on i386
  2018-03-28  8:01   ` Florian Weimer
@ 2018-03-28 17:37     ` Aurelien Jarno
  2018-03-28 17:47       ` Florian Weimer
  0 siblings, 1 reply; 9+ messages in thread
From: Aurelien Jarno @ 2018-03-28 17:37 UTC (permalink / raw)
  To: Florian Weimer; +Cc: GNU C Library, H.J. Lu

On 2018-03-28 10:01, Florian Weimer wrote:
> On 03/27/2018 11:47 PM, Aurelien Jarno wrote:
> > Here is the coredump that I can get:
> > 
> >    Thread 1 "tst-bz21269" received signal SIGBUS, Bus error.
> >    0x565564a0 in do_test () at ../sysdeps/unix/sysv/linux/i386/tst-bz21269.c:217
> >    217           while (atomic_load (&ftx) != 0)
> >    (gdb) bt
> >    #0  0x565564a0 in do_test () at ../sysdeps/unix/sysv/linux/i386/tst-bz21269.c:217
> >    #1  0x56556bc2 in support_test_main (argc=<optimized out>, argv=0xffffd518, config=0xffffd424) at support_test_main.c:321
> >    #2  0x56556061 in main (argc=2, argv=0xffffd514) at ../support/test-driver.c:164
> >    (gdb) print &ftx
> >    $1 = (atomic_uint *) 0x5655a0e0 <ftx>
> >    (gdb) print ftx
> >    $2 = 0
> 
> Ahh.  I see.
> 
>       /* Fire up thread modify_ldt call.  */
>       atomic_store (&ftx, 2);
> 
>       while (atomic_load (&ftx) != 0)
> 	;
> 
>       /* On success, modify_ldt will segfault us synchronously and we will
> escape via siglongjmp.  */
>       support_record_failure ();
> 
> But:
> 
>   xsethandler (SIGSEGV, sigsegv_handler, 0);
>   /* 32-bit kernels send SIGILL instead of SIGSEGV on IRET faults.  */
>   xsethandler (SIGILL, sigsegv_handler, 0);
> 
> So some kernels apparently use SIGBUS instead, and the crash actually shows
> the test succeeded.
> 
> Would you please try the attached patch?

I confirm that this patch works. It returns no error with the fixed
libc, and a segmentation one with the previous one without the bz21269
fix.

Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: SIGBUS failure for misc/tst-bz21269 on i386
  2018-03-28 17:37     ` Aurelien Jarno
@ 2018-03-28 17:47       ` Florian Weimer
  0 siblings, 0 replies; 9+ messages in thread
From: Florian Weimer @ 2018-03-28 17:47 UTC (permalink / raw)
  To: GNU C Library, H.J. Lu

On 03/28/2018 07:36 PM, Aurelien Jarno wrote:
> I confirm that this patch works. It returns no error with the fixed
> libc, and a segmentation one with the previous one without the bz21269
> fix.

I reviewed the bug again, and I don't think it will interfere with the 
test objective, so I'm going to commit this soon unless someone objects.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-03-28 17:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-14 13:35 SIGBUS failure for misc/tst-bz21269 on i386 Florian Weimer
2018-03-14 13:44 ` H.J. Lu
2018-03-14 16:47   ` Adhemerval Zanella
2018-03-27 21:47 ` Aurelien Jarno
2018-03-27 21:58   ` H.J. Lu
2018-03-28  6:47     ` Aurelien Jarno
2018-03-28  8:01   ` Florian Weimer
2018-03-28 17:37     ` Aurelien Jarno
2018-03-28 17:47       ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).