NetBSD-Bugs archive

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

PR/60858 CVS commit: src



The following reply was made to PR lib/60858; it has been noted by GNATS.

From: "Taylor R Campbell" <riastradh%netbsd.org@localhost>
To: gnats-bugs%gnats.NetBSD.org@localhost
Cc: 
Subject: PR/60858 CVS commit: src
Date: Wed, 7 Oct 2026 00:51:18 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Wed Oct  7 00:51:18 UTC 2026
 
 Modified Files:
 	src/include/ssp: ssp.h
 	src/lib/libc/ssp: ssp_redirect.c
 
 Log Message:
 ssp.h: Stop creating references to useless __ssp_protected_* symbols.
 
 The ssp wrappers are useful _only_ when they are actually used for
 inline function call expansion; if the function is used for anything
 else like a function pointer, only the underlying library symbol
 should be used.
 
 To pacify linker complaints about spurious references to
 __ssp_protected_getcwd/read/readlink, we added equally spurious
 definitions of those symbols to libc without understanding why; it
 turns out it only happened because the ssp wrappers declared, e.g.:
 
 extern inline read(...) __RENAME(__ssp_protected_read);
 extern inline read(...) { <ssp check>; return __ssp_real_read(...); }
 
 The declaration with __RENAME caused the compiler to generate
 references, required by the linker to be resolved, to the symbol
 `__ssp_protected_read' when compiling code that takes the address of
 the function read() to pass around a function pointer.  Instead, the
 generated code should simply have a reference to the symbol `read',
 which is what we achieve by deleting that declaration.
 
 Now that the declaration is gone, we also need to redo the useless
 ssp_redirect.c so that the getcwd/read/readlink definitions are
 preceded by the appropriate prototypes.  Rather than try to integrate
 it into the ssp.h macrology, it is simpler to just define these three
 wrappers explicitly here because the pattern has no value to
 generalize; leave comments exhorting the reader never to extend it.
 We can't simply delete the symbols, though, because programs built
 against NetBSD 11 may rely on them (they won't _use_ the symbols in
 code, but the ELF files might have symbol references that have to be
 resolved).
 
 PR lib/60858: fortuitous embarrassment: fortify is all kinds of busted
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.16 -r1.17 src/include/ssp/ssp.h
 cvs rdiff -u -r1.3 -r1.4 src/lib/libc/ssp/ssp_redirect.c
 
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.
 



Home | Main Index | Thread Index | Old Index