Source: glibc
Version: 2.34
Severity: important
User: debian-al...@lists.debian.org
Usertags: ftbfs
Justification: Fails to build from source but built in the past.

glibc 2.34 FTBFS on Alpha with a segfault occuring during building
locales.  From the build log:

Generating locale en_US.UTF-8: this might take a while...
../localedata/gen-locale.sh: line 29: 12551 Segmentation fault      
${localedef_before_env} ${run_program_env} I18NPATH=../localedata 
${localedef_after_env} $flags -f $charmap -i $input 
${common_objpfx}localedata/$out
Charmap: "UTF-8" Inputfile: "en_US" Outputdir: "en_US.UTF-8" failed
/bin/bash: line 4: 
/<<PKGBUILDDIR>>/build-tree/alpha-libc/localedata/en_US.UTF-8/LC_CTYPE.test-result:
 No such file or directory
make[3]: *** [../gen-locales.mk:17: 
/<<PKGBUILDDIR>>/build-tree/alpha-libc/localedata/en_US.UTF-8/LC_CTYPE] Error 1
make[3]: Leaving directory '/<<PKGBUILDDIR>>/iconv'


In the build directory I reran ./debian/rule build-arch to get a
coredump.  Debugging reports:

(sid)mjc@alpha:glibc-2.34$ gdb build-tree/alpha-libc/elf/ld.so 
iconv/core-23033-\!build\!glibc-hXmOs0\!glibc-2.34\!build-tree\!alpha-libc\!elf\!ld.so
 
GNU gdb (Debian 12.1-3) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "alpha-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from build-tree/alpha-libc/elf/ld.so...

warning: core file may not match specified executable file.
[New LWP 23033]

warning: Unexpected size of section `.reg/23033' in core file.

warning: Unable to find libthread_db matching inferior's thread library, thread 
debugging will not be available.
Core was generated by 
`/build/glibc-hXmOs0/glibc-2.34/build-tree/alpha-libc/elf/ld-linux.so.2 
--librar'.
Program terminated with signal SIGSEGV, Segmentation fault.

warning: Unexpected size of section `.reg/23033' in core file.
#0  0x00000200000f6384 in sysmalloc (nb=656, av=0x20000252908 <main_arena>) at 
./malloc/malloc.c:2784
2784                      set_head (av->top, (snd_brk - aligned_brk + 
correction) | PREV_INUSE);
(gdb) list
2779    
2780                  /* Adjust top based on results of second sbrk */
2781                  if (snd_brk != (char *) (MORECORE_FAILURE))
2782                    {
2783                      av->top = (mchunkptr) aligned_brk;
2784                      set_head (av->top, (snd_brk - aligned_brk + 
correction) | PREV_INUSE);
2785                      av->system_mem += correction;
2786    
2787                      /*
2788                         If not the first time through, we either have a
(gdb) print snd_brk
$1 = 0x20000064000 "\002"
(gdb) print aligned_brk
$2 = 0x20000042000 "\177ELF\002\001\001"
(gdb) print correction
$3 = 0
(gdb) print av->top
$4 = (mchunkptr) 0x20000042000
(gdb) print *av->top
$5 = {mchunk_prev_size = 282584257676671, mchunk_size = 0, fd = 0x190260003, bk 
= 0x2ce40, fd_nextsize = 0x40, 
  bk_nextsize = 0xb9d550}
(gdb) bt full
#0  0x00000200000f6384 in sysmalloc (nb=656, av=0x20000252908 <main_arena>) at 
./malloc/malloc.c:2784
        old_top = <optimized out>
        old_size = 0
        old_end = <optimized out>
        size = <optimized out>
        brk = <optimized out>
        correction = 0
        snd_brk = 0x20000064000 "\002"
        front_misalign = <optimized out>
        end_misalign = <optimized out>
        aligned_brk = 0x20000042000 "\177ELF\002\001\001"
        p = <optimized out>
        remainder = <optimized out>
        remainder_size = <optimized out>
        pagesize = <optimized out>
        tried_mmap = false
        __PRETTY_FUNCTION__ = "sysmalloc"
#1  0x00000200000f74d0 in _int_malloc (av=0x20000252908 <main_arena>, 
bytes=640) at ./malloc/malloc.c:4290
        p = <optimized out>
        iters = <optimized out>
        nb = 656
        idx = 42
        bin = 0xffffffffffffe000
        victim = 0x1fff
        size = <error reading variable size (Cannot access memory at address 
0x2007)>
        victim_index = <optimized out>
        remainder = <optimized out>
        remainder_size = <optimized out>
        block = 409600
        bit = <optimized out>
        map = <optimized out>
        fwd = <optimized out>
        bck = <optimized out>
        tcache_unsorted_count = <optimized out>
        tcache_nb = <optimized out>
        tc_idx = 39
        return_cached = <optimized out>
        __PRETTY_FUNCTION__ = "_int_malloc"
#2  0x00000200000f7624 in tcache_init () at ./malloc/malloc.c:3128
        ar_ptr = 0x20000252908 <main_arena>
        victim = <optimized out>
        bytes = <optimized out>
#3  0x00000200000f8050 in tcache_init () at ./malloc/malloc.c:3124
        ar_ptr = <optimized out>
        victim = 0x0
        bytes = 640
        __futex = <optimized out>
        __atg2_result = <optimized out>
        __prev = <optimized out>
        __cmp = <optimized out>
        __tmp = <optimized out>
        __snew = <optimized out>
        __addr64 = <optimized out>
        __prev = <optimized out>
        __cmp = <optimized out>
--Type <RET> for more, q to quit, c to continue without paging--
        __tmp = <optimized out>
        __snew = <optimized out>
        __addr64 = <optimized out>
        __prev = <optimized out>
        __cmp = <optimized out>
        __prev = <optimized out>
        __cmp = <optimized out>
        __futex = <optimized out>
        __private = <optimized out>
        __oldval = <optimized out>
        __atg1_result = <optimized out>
        __tmp = <optimized out>
        __addr64 = <optimized out>
        __sval = <optimized out>
        __ret = <optimized out>
        __tmp = <optimized out>
        __addr64 = <optimized out>
        __sval = <optimized out>
        __ret = <optimized out>
        __tmp = <optimized out>
        __ret = <optimized out>
        __tmp = <optimized out>
        __ret = <optimized out>
#4  __GI___libc_malloc (bytes=64) at ./malloc/malloc.c:3189
        ar_ptr = <optimized out>
        victim = <optimized out>
        tbytes = <optimized out>
        tc_idx = <optimized out>
        __PRETTY_FUNCTION__ = "__libc_malloc"
#5  0x000002000010053c in __argz_create_sep (
    string=0x11fdaff51 
"/build/glibc-hXmOs0/glibc-2.34/build-tree/alpha-libc/localedata", 
delim=<optimized out>, 
    argz=0x11fdaeab8, len=0x11fdaeab0) at ./string/argz-ctsep.c:35
        rp = <optimized out>
        wp = <optimized out>
        nlen = 64
#6  0x000002000007d970 in __GI_setlocale (locale=0x12004204b "", category=5) at 
./locale/setlocale.c:255
        locpath_var = 0x20000064000 "\002"
        composite = <optimized out>
        locale_path = warning: Hit heuristic-fence-post without finding 
enclosing function for address 0x120002d38
This warning occurs if you are debugging a function without any symbols
(for example, in a stripped executable).  In that case, you may wish to
increase the size of the search with the `set heuristic-fence-post' command.

Otherwise, you told GDB there was a function where there isn't one, or
(more likely) you have encountered a bug in GDB.
0x0
        locale_path_len = 0
        locale_path = <optimized out>
        locale_path_len = <optimized out>
        locpath_var = <optimized out>
        composite = <optimized out>
        error_return = <optimized out>
        abort_single = <optimized out>
        newnames = <optimized out>
        newdata = <optimized out>
        locale_copy = <optimized out>
--Type <RET> for more, q to quit, c to continue without paging--
        np = <optimized out>
        cp = <optimized out>
        cnt = <optimized out>
        newdata = <optimized out>
        newname = <optimized out>
#7  __GI_setlocale (category=<optimized out>, locale=0x12004204b "") at 
./locale/setlocale.c:217
        locale_path = <optimized out>
        locale_path_len = <optimized out>
        locpath_var = <optimized out>
        composite = <optimized out>
        error_return = <optimized out>
        abort_single = <optimized out>
        newnames = <optimized out>
        newdata = <optimized out>
        locale_copy = <optimized out>
        np = <optimized out>
        cp = <optimized out>
        cnt = <optimized out>
        newdata = <optimized out>
        newname = <optimized out>
#8  0x0000000120002d38 in ?? ()
No symbol table info available.
Backtrace stopped: frame did not save the PC


Disassembly about the segmentation violation point:
   0x00000200000f630c <+1564>:  lda     t2,16
   0x00000200000f6310 <+1568>:  subq    t2,t0,t2
   0x00000200000f6314 <+1572>:  addq    t7,t2,s4
   0x00000200000f6318 <+1576>:  addq    t2,s3,t2
   0x00000200000f631c <+1580>:  addq    s5,t2,s5
   0x00000200000f6320 <+1584>:  addq    t7,s5,t3
   0x00000200000f6324 <+1588>:  addq    t3,t4,s5
   0x00000200000f6328 <+1592>:  and     s5,t5,t0
   0x00000200000f632c <+1596>:  subq    t2,t3,t2
   0x00000200000f6330 <+1600>:  addq    t0,t2,s5
   0x00000200000f6334 <+1604>:  ldah    a3,-6(gp)
   0x00000200000f6338 <+1608>:  cmplt   s5,0,t0
   0x00000200000f633c <+1612>:  lda     a3,24047(a3)
   0x00000200000f6340 <+1616>:  bne     t0,0x200000f647c <sysmalloc+1932>
   0x00000200000f6344 <+1620>:  unop    
   0x00000200000f6348 <+1624>:  stq     t1,128(sp)
   0x00000200000f634c <+1628>:  mov     s5,a0
   0x00000200000f6350 <+1632>:  stq     s5,120(sp)
   0x00000200000f6354 <+1636>:  bsr     ra,0x200000f5118 <__glibc_morecore+8>
   0x00000200000f6358 <+1640>:  unop    
   0x00000200000f635c <+1644>:  ldq     t1,128(sp)
   0x00000200000f6360 <+1648>:  unop    
   0x00000200000f6364 <+1652>:  ldq     t2,120(sp)
   0x00000200000f6368 <+1656>:  mov     v0,t6
   0x00000200000f636c <+1660>:  beq     v0,0x200000f6510 <sysmalloc+2080>
   0x00000200000f6370 <+1664>:  subq    t6,s4,t0
   0x00000200000f6374 <+1668>:  ldq     t3,2184(s2)
   0x00000200000f6378 <+1672>:  addq    t0,t2,t0
   0x00000200000f637c <+1676>:  stq     s4,96(s2)
   0x00000200000f6380 <+1680>:  or      t0,0x1,t0
=> 0x00000200000f6384 <+1684>:  stq     t0,8(s4)
   0x00000200000f6388 <+1688>:  addq    s5,t3,t0
   0x00000200000f638c <+1692>:  stq     t0,2184(s2)
   0x00000200000f6390 <+1696>:  beq     s3,0x200000f5e0c <sysmalloc+284>

So it's writing register t0 to the address in s4 plus 8*4.

(gdb) i r  
v0             0x20000064000       2199023665152
t0             0x22001             139265
t1             0x20000252968       2199025690984
t2             0x0                 0
t3             0x22000             139264
t4             0x1fff              8191
t5             0xffffffffffffe000  -8192
t6             0x20000064000       2199023665152
t7             0x20000042000       2199023525888
s0             0x20000252908       2199025690888
s1             0x290               656
s2             0x20000252908       2199025690888
s3             0x0                 0
s4             0x20000042000       2199023525888
s5             0x0                 0
fp             0x2b0               688
a0             0x0                 0
a1             0x20000252908       2199025690888
a2             0xa                 10
a3             0x2000020145f       2199025357919
a4             0x1                 1
a5             0x200000046e0       2199023273696
t8             0x1                 1
t9             0x1                 1
t10            0x20000046978       2199023544696
t11            0x2b0               688
ra             0x200000f6358       2199024264024
t12            0x6e                110
at             0x615d87b5          1633519541
gp             0x2000025b670       0x2000025b670 <_res_hconf>
sp             0x11fdae7c0         0x11fdae7c0
pc             0x200000f6384       0x200000f6384 <sysmalloc+1684>

And we can see s4 is set to 0x20000042000.

(gdb) maintenance info sections
Exec file: `/build/glibc-hXmOs0/glibc-2.34/build-tree/alpha-libc/elf/ld.so', 
file type elf64-alpha.
 [0]      0x200000001c8->0x200000001ec at 0x000001c8: .note.gnu.build-id ALLOC 
LOAD READONLY DATA HAS_CONTENTS
 [1]      0x200000001f0->0x20000000580 at 0x000001f0: .hash ALLOC LOAD READONLY 
DATA HAS_CONTENTS
 [2]      0x20000000580->0x2000000075c at 0x00000580: .gnu.hash ALLOC LOAD 
READONLY DATA HAS_CONTENTS
 [3]      0x20000000760->0x20000000b08 at 0x00000760: .dynsym ALLOC LOAD 
READONLY DATA HAS_CONTENTS
 [4]      0x20000000b08->0x20000000dbe at 0x00000b08: .dynstr ALLOC LOAD 
READONLY DATA HAS_CONTENTS
 [5]      0x20000000dbe->0x20000000e0c at 0x00000dbe: .gnu.version ALLOC LOAD 
READONLY DATA HAS_CONTENTS
 [6]      0x20000000e10->0x20000000efc at 0x00000e10: .gnu.version_d ALLOC LOAD 
READONLY DATA HAS_CONTENTS
 [7]      0x20000000f00->0x20000001080 at 0x00000f00: .rela.dyn ALLOC LOAD 
READONLY DATA HAS_CONTENTS
 [8]      0x20000001080->0x200000010e0 at 0x00001080: .rela.plt ALLOC LOAD 
READONLY DATA HAS_CONTENTS
 [9]      0x200000010e0->0x20000001114 at 0x000010e0: .plt ALLOC LOAD READONLY 
CODE HAS_CONTENTS
 [10]     0x20000001120->0x20000026690 at 0x00001120: .text ALLOC LOAD READONLY 
CODE HAS_CONTENTS
 [11]     0x20000026690->0x2000002afc0 at 0x00026690: .rodata ALLOC LOAD 
READONLY DATA HAS_CONTENTS
 [12]     0x2000002afc0->0x2000002b824 at 0x0002afc0: .eh_frame_hdr ALLOC LOAD 
READONLY DATA HAS_CONTENTS
 [13]     0x2000002b828->0x2000002e1dc at 0x0002b828: .eh_frame ALLOC LOAD 
READONLY DATA HAS_CONTENTS
 [14]     0x2000003f1f8->0x2000003fe80 at 0x0002f1f8: .data.rel.ro ALLOC LOAD 
DATA HAS_CONTENTS
 [15]     0x2000003fe80->0x20000040000 at 0x0002fe80: .dynamic ALLOC LOAD DATA 
HAS_CONTENTS
 [16]     0x20000040000->0x20000040020 at 0x00030000: .data ALLOC LOAD DATA 
HAS_CONTENTS
 [17]     0x20000040020->0x20000040080 at 0x00030020: .got ALLOC LOAD DATA 
HAS_CONTENTS
 [18]     0x20000040080->0x200000410d8 at 0x00030080: .sdata ALLOC LOAD DATA 
HAS_CONTENTS
 [19]     0x200000410d8->0x200000411f8 at 0x000310d8: .sbss ALLOC
 [20]     0x200000411f8->0x20000041268 at 0x000310d8: .bss ALLOC
 [21]     0x00000000->0x0000001e at 0x000310d8: .comment READONLY HAS_CONTENTS
 [22]     0x00000000->0x00001420 at 0x00031100: .debug_aranges READONLY 
HAS_CONTENTS
 [23]     0x00000000->0x0007862f at 0x00032520: .debug_info READONLY 
HAS_CONTENTS
 [24]     0x00000000->0x00010e18 at 0x000aab4f: .debug_abbrev READONLY 
HAS_CONTENTS
 [25]     0x00000000->0x0001ea7c at 0x000bb967: .debug_line READONLY 
HAS_CONTENTS
 [26]     0x00000000->0x0000673f at 0x000da3e3: .debug_str READONLY HAS_CONTENTS
 [27]     0x00000000->0x00001195 at 0x000e0b22: .debug_line_str READONLY 
HAS_CONTENTS
 [28]     0x00000000->0x0001c4cf at 0x000e1cb7: .debug_loclists READONLY 
HAS_CONTENTS
 [29]     0x00000000->0x0000412c at 0x000fe186: .debug_rnglists READONLY 
HAS_CONTENTS
Core file: 
`/build/glibc-hXmOs0/glibc-2.34/iconv/core-23033-!build!glibc-hXmOs0!glibc-2.34!build-tree!alpha-libc!elf!ld.so',
 
        file type elf64-alpha.
 [0]      0x00000000->0x000008e4 at 0x00000350: note0 READONLY HAS_CONTENTS
 [1]      0x00000000->0x00000108 at 0x000003d4: .reg/23033 HAS_CONTENTS
 [2]      0x00000000->0x00000108 at 0x000003d4: .reg HAS_CONTENTS
 [3]      0x00000000->0x00000080 at 0x00000594: .note.linuxcore.siginfo/23033 
HAS_CONTENTS
 [4]      0x00000000->0x00000080 at 0x00000594: .note.linuxcore.siginfo 
HAS_CONTENTS
 [5]      0x00000000->0x00000160 at 0x00000628: .auxv HAS_CONTENTS
 [6]      0x00000000->0x00000383 at 0x0000079c: .note.linuxcore.file/23033 
HAS_CONTENTS
 [7]      0x00000000->0x00000383 at 0x0000079c: .note.linuxcore.file 
HAS_CONTENTS
 [8]      0x00000000->0x00000100 at 0x00000b34: .reg2/23033 HAS_CONTENTS
 [9]      0x00000000->0x00000100 at 0x00000b34: .reg2 HAS_CONTENTS
 [10]     0x11fd8e000->0x11fdb0000 at 0x00002000: load1 ALLOC LOAD HAS_CONTENTS
 [11]     0x120000000->0x120002000 at 0x00024000: load2a ALLOC LOAD READONLY 
CODE HAS_CONTENTS
 [12]     0x120002000->0x120050000 at 0x00026000: load2b ALLOC READONLY CODE
 [13]     0x12005e000->0x120060000 at 0x00026000: load3 ALLOC LOAD READONLY 
HAS_CONTENTS
 [14]     0x120060000->0x120064000 at 0x00028000: load4 ALLOC LOAD HAS_CONTENTS
 [15]     0x20000000000->0x20000002000 at 0x0002c000: load5a ALLOC LOAD 
READONLY CODE HAS_CONTENTS
 [16]     0x20000002000->0x20000030000 at 0x0002e000: load5b ALLOC READONLY CODE
 [17]     0x20000030000->0x20000034000 at 0x0002e000: load6 ALLOC LOAD 
HAS_CONTENTS
 [18]     0x2000003e000->0x20000040000 at 0x00032000: load7 ALLOC LOAD READONLY 
HAS_CONTENTS
 [19]     0x20000040000->0x20000042000 at 0x00034000: load8 ALLOC LOAD 
HAS_CONTENTS
 [20]     0x20000042000->0x20000044000 at 0x00036000: load9a ALLOC LOAD 
READONLY CODE HAS_CONTENTS

[snipped rest]

And we see 0x20000042000-> onwards is marked readonly! Hence the
segfault.

Hopefully the above may be helpful in tracking down the problem

Regards,
Michael.

Reply via email to