[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#935750: libgcc-9-dev: The futex facility returned an unexpected error code



Package: libgcc-9-dev
Version: 9.2.1-4
Severity: normal

Dear Maintainer,

The following error occurs running "test-z3 -a" while building the z3 package:
PASS
(test hashtable :time 0.00 :before-memory 2630.62 :after-memory 2630.62)
The futex facility returned an unexpected error code.
make[1]: *** [debian/rules:130: override_dh_auto_test] Aborted
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:24: build-arch] Error 2

We have the following backtrace:
Breakpoint 3, futex_fatal_error () at ../sysdeps/nptl/futex-internal.h:200
200     ../sysdeps/nptl/futex-internal.h: No such file or directory.
(gdb) bt
#0  futex_fatal_error () at ../sysdeps/nptl/futex-internal.h:200
#1  futex_abstimed_wait_cancelable (private=1, abstime=0x0, expected=1,
    futex_word=<optimized out>)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:223
#2  do_futex_wait (sem=<optimized out>, abstime=0x0) at sem_waitcommon.c:115
#3  0xf88048f4 in __new_sem_wait_slow (sem=0x1, abstime=0x0)
    at sem_waitcommon.c:282
#4  0xf78c4fe4 in omp_set_nest_lock ()
   from /usr/lib/hppa-linux-gnu/libgomp.so.1
#5  0x0152b658 in mpn_manager::div (this=0x1b7f6ac, numer=0x1b7f96c, lnum=4,
    denom=0x1b7f8cc, lden=1, quot=0x1b7f94c, rem=0x1b7f8ac)
    at ../src/util/mpn.cpp:156
#6  0x01553da4 in mpz_manager<true>::quot_rem_core<1> (this=0x1b7f49c, a=...,
    b=..., q=..., r=...) at ../src/util/mpz.cpp:498
#7  0x01541c8c in mpz_manager<true>::big_rem (this=0x1b7f49c, a=..., b=...,
    c=...) at ../src/util/mpz.cpp:546
#8  0x0002e654 in mpz_manager<true>::rem (this=0x1b7f49c, a=..., b=..., c=...)
    at ../src/util/mpz.h:459
#9  0x01542cac in mpz_manager<true>::gcd (this=0x1b7f49c, a=..., b=..., c=...)
    at ../src/util/mpz.cpp:749
#10 0x0002d708 in mpq_manager<true>::gcd (this=0x1b7f49c, a=..., b=..., c=...)
    at ../src/util/mpq.h:594
#11 0x0002c814 in mpq_manager<true>::normalize (this=0x1b7f49c, a=...)
--Type <RET> for more, q to quit, c to continue without paging--
    at ../src/util/mpq.h:58
#12 0x0155d5a8 in mpq_manager<true>::set (this=0x1b7f49c, a=...,
    val=0x157cce0 "1", '0' <repeats 33 times>, "1") at ../src/util/mpq.cpp:278
#13 0x00029cc4 in rational::rational (this=0xf8f02e88,
    v=0x157cce0 "1", '0' <repeats 33 times>, "1") at ../src/util/rational.h:55
#14 0x0002962c in tst_rational () at ../src/test/rational.cpp:460
#15 0x00145398 in main (argc=2, argv=0xf8f02028) at ../src/test/main.cpp:138
(gdb) disass
Dump of assembler code for function do_futex_wait:
   0xf88046f0 <+0>:     stw rp,-14(sp)
   0xf88046f4 <+4>:     ldo 80(sp),sp
   0xf88046f8 <+8>:     stw r5,-74(sp)
   0xf88046fc <+12>:    stw r4,-70(sp)
   0xf8804700 <+16>:    copy r19,r4
   0xf8804704 <+20>:    stw r19,-20(sp)
   0xf8804708 <+24>:    stw r3,-6c(sp)
   0xf880470c <+28>:    ldw 4(r26),r3
   0xf8804710 <+32>:    b,l 0xf88055a4 <__pthread_enable_asynccancel>,rp
   0xf8804714 <+36>:    stw r26,-78(sp)
   0xf8804718 <+40>:    ldw -78(sp),r26
   0xf880471c <+44>:    copy r4,r19
   0xf8804720 <+48>:    copy ret0,r5
   0xf8804724 <+52>:    ldi -1,r21
   0xf8804728 <+56>:    ldi 0,r22
   0xf880472c <+60>:    ldi 0,r23
   0xf8804730 <+64>:    ldi 1,r24
   0xf8804734 <+68>:    ldi 189,r25
   0xf8804738 <+72>:    xor r3,r25,r25
   0xf880473c <+76>:    copy r19,r4
   0xf8804740 <+80>:    be,l 100(sr2,r0),sr0,r31
   0xf8804744 <+84>:    ldi d2,r20
--Type <RET> for more, q to quit, c to continue without paging--
   0xf8804748 <+88>:    copy r4,r19
   0xf880474c <+92>:    ldi ffd,r20
   0xf8804750 <+96>:    ldo ffe(ret0),r21
   0xf8804754 <+100>:   cmpb,>>= r20,r21,0xf8804780 <do_futex_wait+144>
   0xf8804758 <+104>:   copy r5,r26
   0xf880475c <+108>:   b,l 0xf8805670 <__pthread_disable_asynccancel>,rp
   0xf8804760 <+112>:   nop
   0xf8804764 <+116>:   ldi 0,ret0
   0xf8804768 <+120>:   ldw -94(sp),rp
   0xf880476c <+124>:   ldw -74(sp),r5
   0xf8804770 <+128>:   ldw -70(sp),r4
   0xf8804774 <+132>:   ldw -6c(sp),r3
   0xf8804778 <+136>:   bv r0(rp)
   0xf880477c <+140>:   ldo -80(sp),sp
   0xf8804780 <+144>:   stw ret0,-78(sp)
   0xf8804784 <+148>:   b,l 0xf8805670 <__pthread_disable_asynccancel>,rp
   0xf8804788 <+152>:   copy r19,r4
   0xf880478c <+156>:   ldw -78(sp),ret0
   0xf8804790 <+160>:   cmpib,= -b,ret0,0xf88047b4 <do_futex_wait+196>
   0xf8804794 <+164>:   copy r4,r19
   0xf8804798 <+168>:   cmpib,= -4,ret0,0xf88047b4 <do_futex_wait+196>
   0xf880479c <+172>:   ldi -ee,r20
   0xf88047a0 <+176>:   cmpb,= r20,ret0,0xf88047b4 <do_futex_wait+196>
--Type <RET> for more, q to quit, c to continue without paging--
   0xf88047a4 <+180>:   addil L%0,r19,r1
=> 0xf88047a8 <+184>:   ldw 1f0(r1),r26
   0xf88047ac <+188>:   b,l 0xf87f6960,rp
   0xf88047b0 <+192>:   nop
   0xf88047b4 <+196>:   b,l 0xf8804768 <do_futex_wait+120>,r0
   0xf88047b8 <+200>:   sub r0,ret0,ret0
End of assembler dump.
Breakpoint 4, 0xf8804740 in ?? ()
(gdb) p/x $r26
$1 = 0x1b7f6ac
(gdb) p/x $r25
$2 = 0x188
(gdb) p/x $r24
$3 = 0x1
(gdb) p/x $r23
$4 = 0x0
(gdb) p/x $r22
$5 = 0x0
(gdb) p/x $r21
$6 = 0xffffffff

The xor changes the futex op from FUTEX_WAIT_BITSET to FUTEX_TRYLOCK_PI.
This causes the unexpected futex operation.  What has happened is
sem->private has been set to 1 and this modifies the futex operation. 

It seems the omp_nest_lock_t type used in omp_set_nest_lock is smaller
than sem_t:

Breakpoint 6, __new_sem_init (sem=0x1b7f6a0, pshared=0, value=1)
    at sem_init.c:33
33      in sem_init.c
(gdb) p 0x1b7f6ac-0x1b7f6a0
$6 = 12
(gdb) ptype m_lock
type = struct omp_nest_lock_t {
    unsigned char _x[12];
}
(gdb) frame 0
#0  __new_sem_init (sem=0x1b7f6a0, pshared=0, value=1) at sem_init.c:33
33      sem_init.c: No such file or directory.
(gdb) ptype sem
type = union {
    char __size[16];
    long __align;
} *

I see this in omp.h:
typedef struct
{
#if defined(__linux__)
  unsigned char _x[8 + sizeof (void *)]
    __attribute__((__aligned__(sizeof (void *))));
#else
  unsigned char _x[24]
    __attribute__((__aligned__(4)));
#endif
} omp_nest_lock_t;

The default for this type is modified in the libgomp-omp_h-multilib.diff patch:

# DP: Fix up omp.h for multilibs.

2008-06-09  Jakub Jelinek  <jakub@redhat.com>

        * omp.h.in (omp_nest_lock_t): Fix up for Linux multilibs.

2015-03-25  Matthias Klose  <doko@ubuntu.com>

        * omp.h.in (omp_nest_lock_t): Limit the fix Linux.

--- a/src/libgomp/omp.h.in
+++ b/src/libgomp/omp.h.in
@@ -40,8 +40,13 @@ typedef struct

 typedef struct
 {
+#if defined(__linux__)
+  unsigned char _x[8 + sizeof (void *)]
+    __attribute__((__aligned__(sizeof (void *))));
+#else
   unsigned char _x[@OMP_NEST_LOCK_SIZE@]
     __attribute__((__aligned__(@OMP_NEST_LOCK_ALIGN@)));
+#endif
 } omp_nest_lock_t;
 #endif

I think the "8" needs to increase to "12" to reflect the sem->private
field in the new semaphore type.

Regards,
Dave Anglin

-- System Information:
Debian Release: bullseye/sid
  APT prefers buildd-unstable
  APT policy: (500, 'buildd-unstable'), (500, 'unstable')
Architecture: hppa (parisc64)

Kernel: Linux 4.14.139+ (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libgcc-9-dev depends on:
ii  gcc-9-base  9.2.1-4
ii  libatomic1  9.2.1-4
ii  libgcc4     1:9.2.1-4
ii  libgomp1    9.2.1-4

Versions of packages libgcc-9-dev recommends:
ii  libc6-dev  2.28-10

libgcc-9-dev suggests no packages.

-- no debconf information


Reply to: