NetBSD-Bugs archive

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

bin/56895: /usr/sbin/ldpd fails on alignment-picky architectures



>Number:         56895
>Category:       bin
>Synopsis:       /usr/sbin/ldpd fails on alignment-picky architectures
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 20 02:05:02 +0000 2022
>Originator:     Tom Lane
>Release:        HEAD/202206150250Z
>Organization:
PostgreSQL Global Development Group
>Environment:
NetBSD sss2.sss.pgh.pa.us 9.99.97 NetBSD 9.99.97 (SD0) #0: Wed Jun 15 15:24:17 EDT 2022  tgl%nuc1.sss.pgh.pa.us@localhost:/home/tgl/netbsd-H-202206150250Z/obj.hppa/sys/arch/hppa/compile/SD0 hppa
>Description:
The net/mpls/t_ldp_regen test fails for me on HPPA, because ldpd crashes here:

Program terminated with signal SIGBUS, Bus error.
#0  0xaf163ec0 in _inet_aton (cp=0x20ef8 <my_ldp_id+8> "", addr=0xb00027e6)
    at /home/tgl/netbsd-H-202206150250Z/usr/src/lib/libc/../../common/lib/libc/inet/inet_addr.c:222
(gdb) bt
#0  0xaf163ec0 in _inet_aton (cp=0x20ef8 <my_ldp_id+8> "", addr=0xb00027e6)
    at /home/tgl/netbsd-H-202206150250Z/usr/src/lib/libc/../../common/lib/libc/inet/inet_addr.c:222
#1  0x0001a0e4 in send_tlv (t=0xb00027c8, p=0xafe8c040)
    at /home/tgl/netbsd-H-202206150250Z/usr/src/usr.sbin/ldpd/socketops.c:1393
#2  send_initialize (p=0xafe8c040)
    at /home/tgl/netbsd-H-202206150250Z/usr/src/usr.sbin/ldpd/socketops.c:1076
#3  0x0001aec0 in the_big_loop ()
    at /home/tgl/netbsd-H-202206150250Z/usr/src/usr.sbin/ldpd/socketops.c:975
#4  0x0001c1c4 in main (argc=1, argv=0xb0001038)
    at /home/tgl/netbsd-H-202206150250Z/usr/src/usr.sbin/ldpd/main.c:155

Visibly, "addr" is not word-aligned, so it's unsurprising that trying to do a 32-bit store into it SIGBUS's on picky architectures.

This appears to happen because pdu.h marks struct ldp_pdu as __packed, which I believe authorizes the compiler to store it at non-aligned addresses.  That choice seems to be old, but perhaps gcc 10 takes advantage of that in a way that previous versions didn't?
>How-To-Repeat:
Run /usr/tests tests on HPPA.
>Fix:
Perhaps it'd be okay to remove the __packed annotation?



Home | Main Index | Thread Index | Old Index