Re: armv7-on-aarch64 stuck at urdlck: I got a replication of the "ampere2" bulk build hangup problem on a Windows DevKit 2023

Mark Millard <[email protected]>
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <[email protected]>
On Jul 21, 2024, at 21:08, Mark Millard <[email protected]> wrote:

> On Jul 21, 2024, at 20:58, Mark Millard <[email protected]> wrote:
> 
>> I found a significant difference in my failing vs. working
>> armv7 contexts as installed: Presence vs. Lack of a .symtab
>> entry for the symbol _rtld_get_stack_prot in
>> /libexec/ld-elf.so.1 .
>> 
>> gdb inspection of operation shows distinctions based on
>> the difference.
>> 
>> This is related to the code:
>> 
>> (gdb) list  140
>> 135 void
>> 136 _thr_stack_fix_protection(struct pthread *thrd)
>> 137 {
>> 138 
>> 139 mprotect((char *)thrd->attr.stackaddr_attr +
>> 140    round_up(thrd->attr.guardsize_attr),
>> 141    round_up(thrd->attr.stacksize_attr),
>> 142    _rtld_get_stack_prot());
>> 143 }
>> 
>> 
>> Working context (Personal build):
>> 
>> NOTE THE .symtab ENTRY BELOW. It allows the gdb run to work:
>> 
>> # readelf -a /libexec/ld-elf.so.1 | grep -E "(^[^ 0-9]|.*_rtld_get_stack_prot)" | less
>> ELF Header:
>> Elf file type is DYN (Shared object file)
>> Entry point 0x14548
>> There are 10 program headers, starting at offset 52
>> Program Headers:
>> There are 24 section headers, starting at offset 0x1f2b8:
>> Section Headers:
>> Key to Flags:
>> Dynamic section at offset 0x199f8 contains 15 entries:
>> Relocation section (.rel.dyn):
>> r_offset r_info   r_type              st_value st_name
>> Symbol table '.dynsym' contains 27 entries:
>>    5: 000000000001b9ac    16 FUNC    GLOBAL DEFAULT   11 _rtld_get_stack_prot@@FBSDprivate_1.0 (11)
>> Symbol table '.symtab' contains 911 entries:
>>  903: 000000000001b9ac    16 FUNC    GLOBAL DEFAULT   11 _rtld_get_stack_prot
>> Notes at offset 0x00000174 with length 0x00000018:
>> Histogram for bucket list length (total of 6 buckets):
>> Histogram for bucket list length (total of 27 buckets):
>> Version symbol section (.gnu.version):
>> Version definition section (.gnu.version_d):
>> Attribute Section: aeabi
>> File Attributes
>> 
>> 
>> Breakpoint 8.3, _thr_stack_fix_protection (thrd=0x2006f000) at /usr/main-src/lib/libthr/thread/thr_stack.c:139
>> 139 mprotect((char *)thrd->attr.stackaddr_attr +
>> (gdb) si
>> 141    round_up(thrd->attr.stacksize_attr),
>> (gdb) 
>> 140    round_up(thrd->attr.guardsize_attr),
>> (gdb) 
>> round_up (size=4096) at /usr/main-src/lib/libthr/thread/thr_stack.c:129
>> 129 if (size % _thr_page_size != 0)
>> (gdb) 
>> 0x201110b8 129 if (size % _thr_page_size != 0)
>> 130 size = ((size / _thr_page_size) + 1) *
>> (gdb) 
>> 0x201110c0 130 size = ((size / _thr_page_size) + 1) *
>> (gdb) 
>> 0x201110c4 in round_up (size=4096) at /usr/main-src/lib/libthr/thread/thr_stack.c:130
>> 130 size = ((size / _thr_page_size) + 1) *
>> (gdb) 
>> 0x201110c8 130 size = ((size / _thr_page_size) + 1) *
>> (gdb) 
>> round_up (size=67108864) at /usr/main-src/lib/libthr/thread/thr_stack.c:129
>> 129 if (size % _thr_page_size != 0)
>> (gdb) 
>> 0x201110d0 in round_up (size=4096) at /usr/main-src/lib/libthr/thread/thr_stack.c:129
>> 129 if (size % _thr_page_size != 0)
>> (gdb) 
>> 0x201110d4 in round_up (size=67108864) at /usr/main-src/lib/libthr/thread/thr_stack.c:129
>> 129 if (size % _thr_page_size != 0)
>> (gdb) 
>> 0x201110d8 129 if (size % _thr_page_size != 0)
>> (gdb) 
>> 0x201110dc in round_up (size=4096) at /usr/main-src/lib/libthr/thread/thr_stack.c:129
>> 129 if (size % _thr_page_size != 0)
>> (gdb) 
>> 0x201110e0 129 if (size % _thr_page_size != 0)
>> (gdb) 
>> _thr_stack_fix_protection (thrd=0x2006f000) at /usr/main-src/lib/libthr/thread/thr_stack.c:139
>> 139 mprotect((char *)thrd->attr.stackaddr_attr +
>> (gdb) 
>> 142    _rtld_get_stack_prot());
>> (gdb) 
>> 0x20114880 in ?? () from /lib/libthr.so.3
>> (gdb) 
>> 0x20114884 in ?? () from /lib/libthr.so.3
>> (gdb) 
>> 0x20114888 in ?? () from /lib/libthr.so.3
>> (gdb) 
>> 
>> Breakpoint 9.1, _rtld_get_stack_prot () at /usr/main-src/libexec/rtld-elf/rtld.c:5884
>> 5884 return (stack_prot);
>> (gdb) 
>> 0x2005b9b0 5884 return (stack_prot);
>> (gdb) 
>> 0x2005b9b4 5884 return (stack_prot);
>> 
>> 
>> 
>> Failing context (Official PkgBase build):
>> 
>> NOTE THE *LACK OF* THE .symtab ENTRY ABOVE.
> 
> Not "ABOVE": BELOW! Sorry.
> 
>> _rtld_bind_start ends
>> up in use instead, which looks to lead to the gdb run not working.
>> 
>> IN FACT, NOTE THE LACK OF ANY "Symbol table '.symtab' contains"
>> TEXT AT ALL!
>> 
>> # readelf -a /libexec/ld-elf.so.1 | grep -E "(^[^ 0-9]|.*_rtld_get_stack_prot)" | less
>> ELF Header:
>> Elf file type is DYN (Shared object file)
>> Entry point 0x147b0
>> There are 10 program headers, starting at offset 52
>> Program Headers:
>> There are 22 section headers, starting at offset 0x1a960:
>> Section Headers:
>> Key to Flags:
>> Dynamic section at offset 0x1a4cc contains 15 entries:
>> Relocation section (.rel.dyn):
>> r_offset r_info   r_type              st_value st_name
>> Symbol table '.dynsym' contains 27 entries:
>>    5: 000000000001bcd8    16 FUNC    GLOBAL DEFAULT   11 _rtld_get_stack_prot@@FBSDprivate_1.0 (11)
>> Notes at offset 0x00000174 with length 0x00000018:
>> Histogram for bucket list length (total of 6 buckets):
>> Histogram for bucket list length (total of 27 buckets):
>> Version symbol section (.gnu.version):
>> Version definition section (.gnu.version_d):
>> Attribute Section: aeabi
>> File Attributes
>> 
>> 
>> Breakpoint 2.3, _thr_stack_fix_protection (thrd=0x20070000) at /home/pkgbuild/worktrees/main/lib/libthr/thread/thr_stack.c:140
>> 140    round_up(thrd->attr.guardsize_attr),
>> (gdb) si
>> 139 mprotect((char *)thrd->attr.stackaddr_attr +
>> (gdb) 
>> 141    round_up(thrd->attr.stacksize_attr),
>> (gdb) 
>> round_up (size=4096) at /home/pkgbuild/worktrees/main/lib/libthr/thread/thr_stack.c:129
>> 129 if (size % _thr_page_size != 0)
>> (gdb) 
>> 130 size = ((size / _thr_page_size) + 1) *
>> (gdb) 
>> 129 if (size % _thr_page_size != 0)
>> (gdb) 
>> 130 size = ((size / _thr_page_size) + 1) *
>> (gdb) 
>> 0x20112ef8 130 size = ((size / _thr_page_size) + 1) *
>> (gdb) 
>> 0x20116b60 in ?? () from /lib/libthr.so.3
>> (gdb) 
>> 0x20116b64 in ?? () from /lib/libthr.so.3
>> (gdb) 
>> 0x20116b68 in ?? () from /lib/libthr.so.3
>> (gdb) 
>> 0x20116760 in ?? () from /lib/libthr.so.3
>> (gdb) 
>> 0x20116764 in ?? () from /lib/libthr.so.3
>> (gdb) 
>> 0x20116768 in ?? () from /lib/libthr.so.3
>> (gdb) 
>> 0x2011676c in ?? () from /lib/libthr.so.3
>> (gdb) 
>> _rtld_bind_start () at /home/pkgbuild/worktrees/main/libexec/rtld-elf/arm/rtld_start.S:78
>> 78 stmdb sp!,{r0-r5,sl,fp}
>> (gdb) si
>> 80 sub r1, ip, lr /* r1 = 4 * (n + 1) */
>> (gdb) 
>> 81 sub r1, r1, #4 /* r1 = 4 * n */
>> (gdb) 
>> 82 add r1, r1, r1 /* r1 = 8 * n */
>> (gdb) 
>> 84 ldr r0, [lr, #-4] /* get obj ptr from GOT[1] */
>> (gdb) 
>> 85 mov r4, ip /* save GOT location */
>> (gdb) 
>> 87 mov r5, sp /* Save the stack pointer */
>> (gdb) 
>> 88 bic sp, sp, #7 /* Align the stack pointer */
>> (gdb) 
>> _rtld_bind_start () at /home/pkgbuild/worktrees/main/libexec/rtld-elf/arm/rtld_start.S:89
>> 89 bl _rtld_bind /* Call the binder */
>> 
>> 
>> I have not checked for other .symtab entry problems.
>> 
>> Nor have I figured out why the installed materials are
>> different for Symbol table '.symtab' . So this is not
>> yet root-cause information.


I know why. My personal FreeBSD builds have long had my
equivalents of src.conf (under normal naming) contain:

#
# Avoid stripping but do not control host -g status as well:
DEBUG_FLAGS+=

This likely replaces my earlier -mcpu=cortex-a7 hypothesis
for what a systematic difference might be that could
contribute to the personal builds not having the problem.


===
Mark Millard
marklmi at yahoo.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.