NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/59652: DNS utilities core dump in -current
The following reply was made to PR lib/59652; it has been noted by GNATS.
From: Nick Hudson <nick.hudson%gmx.co.uk@localhost>
To: gnats-bugs%netbsd.org@localhost, lib-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
netbsd-bugs%netbsd.org@localhost
Cc:
Subject: Re: lib/59652: DNS utilities core dump in -current
Date: Sun, 21 Sep 2025 08:26:06 +0100
I've analysed this and it's a compiler/linker bug.
A cut down program of
$ cat urcu.c
typedef struct __pthread_st *pthread_t;
pthread_t __libc_thr_self(void);
struct cds_list_head {
struct cds_list_head *next, *prev;
};
struct urcu_reader {
unsigned long ctr;
struct cds_list_head node __attribute__((aligned(64)));
unsigned int registered:1;
};
__thread struct urcu_reader urcu_mb_reader;
int
main(void)
{
int ret =3D urcu_mb_reader.registered;
return ret;
}
$
The compiler generates the following code
00000000 <main>:
0: 03 60 08 bc mfctl tr3,ret0
4: 2b 80 00 00 addil L%0,ret0,r1
4: R_PARISC_TPREL21L urcu_mb_reader
8: 34 3c 00 00 ldo 0(r1),ret0
8: R_PARISC_TPREL14R urcu_mb_reader
c: 37 9c 00 90 ldo 48(ret0),ret0
10: 0f 80 10 9c ldw 0(ret0),ret0
14: e8 40 c0 00 bv r0(rp)
18: d3 9c 18 1f extrw,u ret0,0,1,ret0
which the linker resolves to a load from 0x40 + 0x4c (0x8c) relative to=20
the TLS area
000107b4 <main>:
107b4: 03 60 08 bc mfctl tr3,ret0
107b8: 2b 80 00 00 addil L%0,ret0,r1
107bc: 34 3c 00 80 ldo 40(r1),ret0
107c0: 37 9c 00 90 ldo 48(ret0),ret0
107c4: 0f 80 10 9c ldw 0(ret0),ret0
107c8: e8 40 c0 00 bv r0(rp)
107cc: d3 9c 18 1f extrw,u ret0,0,1,ret0
which is outside the 0x80 bytes allocated.
$ readelf -S urcu | grep tbss
[14] .tbss NOBITS 00011000 001000 000080 00 WAT=20
0 0 64
$
Home |
Main Index |
Thread Index |
Old Index