NetBSD-Bugs archive

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

lib/59388: ld.elf_so: -Wno-stack-protector applies too broadly



>Number:         59388
>Category:       lib
>Synopsis:       ld.elf_so: -Wno-stack-protector applies too broadly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 02 22:55:00 +0000 2025
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The Rtalloca'd Stack Protector
>Environment:
>Description:
We currently build all of rtld.c and symbol.c with -Wno-stack-protector because _rtld_donelist_init uses alloca, intentionally (with a size limited by the number of objects currently loaded in the process; this was done as part of the work to make ld.elf_so thread-safe, PR lib/43005: ld.so needs locking).

But only a few functions actually use _rtld_donelist_init.  Those functions can be surrounded with the appropriate GCC diagnostic pragma, and the rest need not have the warning suppressed.
>How-To-Repeat:
code inspection
>Fix:
+_Pragma("GCC diagnostic push")	/* _rtld_donelist_init: -Wno-stack-protector */
+_Pragma("GCC diagnostic ignored \"-Wstack-protector\"")static void *
 do_dlsym(void *handle, const char *name, const Ver_Entry *ventry, void *retaddr)
 {
...
 }
+_Pragma("GCC diagnostic pop")



Home | Main Index | Thread Index | Old Index