This is a mostly-unmodified copy of the various *_chk implementations
and headers from NetBSD, without yet modifying system headers to start
actually including them. A future commit will also apply the needed
bits to fix ssp/unistd.h.
This is always true...
why redirect read(2) and none of the other system calls that write back into user space?
I don't see any others in NetBSD's either. Expanding it is a big ask, so before I really do that as more than maybe a suggestion, I'd like to know the thinking here.
Fair point; I'll hack it back out in the second patch that reworks part of these headers for FreeBSD (with a brief explanation that it's tautological here)
I think they more or less tried to stick with the common _FORTIFY_SOURCE implementation (glibc). We can expand it, but IMO let's get to the baseline and define expanding it as future work (explicitly in the commit message) -- the baseline should be 'relatively safe' as folks have been running with glibc's implementation for years as it is.
Since this code goes directly into our libc source, and not into vendor import area, should it follow style(9)? The most systematic thing I noted is return a; instead of return (a); Another thing is the headers inclusion order.
I do not think lint is relevant for FreeBSD.
These lint-style comments (as well LINTLIBRARY) are not relevant either.
The counter you your argument may also be that fortify_source was done years ago and is showing its age :)....
Straighten out some style and other bits:
- clang || GCC >= 4.8 is a given
- Remove irrelevant LINT/lint bits
- Shuffle around includes in *_chk.c, alphabetical order with ssp/* headers last
- Remove spurious prototypes in *_chk.c; these should be provided in ssp/*
- return x => return (x)