NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
toolchain/60542: OBJDIR path leaked into installed debug library
>Number: 60542
>Category: toolchain
>Synopsis: OBJDIR path leaked into installed debug library
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: toolchain-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Aug 05 19:05:00 +0000 2026
>Originator: Thomas Klausner
>Release: NetBSD 11.99.7
>Organization:
>Environment:
Architecture: x86_64
Machine: amd64
>Description:
I found this by accident while debugging a binary built with SSP.
(gdb) br read
Function "read" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (read) pending.
(gdb) r
Starting program: /home/wiz/a
Breakpoint 1.1, 0x0000751ca08a03c0 in read () from /usr/lib/libc.so.12
(gdb) bt
#0 0x0000751ca08a03c0 in read () from /usr/lib/libc.so.12
#1 0x0000751ca0a1f334 in __ssp_protected__read (__fd=<optimized out>, __buf=0x751ca0843f80, __len=32768) at /usr/obj/amd64.gcc.20260803/usr/include/ssp/unistd.h:39
#2 __sread (cookie=0x751ca0cb1740 <usual>, buf=0x751ca0843f80, n=32768) at /usr/src/lib/libc/stdio/stdio.c:69
#3 0x0000751ca0a0c8ea in __srefill (fp=fp@entry=0x751ca0cb1740 <usual>) at /usr/src/lib/libc/stdio/refill.c:132
#4 0x0000751ca09f2d2d in fread (buf=buf@entry=0x7f7fffa673b0, size=size@entry=1024, count=count@entry=1, fp=fp@entry=0x751ca0cb1740 <usual>) at /usr/src/lib/libc/stdio/fread.c:128
#5 0x000000000040158b in main (argc=<optimized out>, argv=<optimized out>) at a.c:11
(gdb)
Here you can see that "/usr/obj/amd64.gcc.20260803" leaked into the binary.
Grepping /usr/lib shows a couple matches:
# grep -r /usr/obj/amd /usr/lib/libc*
Binary file /usr/lib/libc_g.a matches
Binary file /usr/lib/libc_p.a matches
Binary file /usr/lib/libcbor_g.a matches
Binary file /usr/lib/libcom_err_g.a matches
Binary file /usr/lib/libcompat_g.a matches
Binary file /usr/lib/libcrypt_g.a matches
Binary file /usr/lib/libcrypto_g.a matches
Binary file /usr/lib/libctf_g.a matches
Binary file /usr/lib/libcurses_g.a matches
I don't think it is useful to have this path and would prefer the normalized version
by default, that I hope we already get when using reproducible builds.
I tried a similar grep in an official NetBSD 10 release and see
/usr/obj/external/gpl3/gcc/lib/libgcc/libgcc
in
/usr/lib/libgcc.a
and some other files.
>How-To-Repeat:
cat > a.c << EOF
#include <err.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
FILE *fp;
char buf[1024];
if ((fp = fopen("a.c", "r")) == NULL) {
err(1, "can't fopen a.c");
}
while (fread(buf, 1024, 1, fp) > 0) {
}
fclose(fp);
return 0;
}
EOF
# cc -g -Og -fstack-protector-all -o a a.c
# gdb a
(gdb) br read
... confirm ...
(gdb) r
(gdb) bt
>Fix:
Please make the 'reproducible build' environment the default for these paths,
or get rid of the them completely.
>Unformatted:
Home |
Main Index |
Thread Index |
Old Index