memset_s is missing from the library.
I'm attempting to use memset_s to zero some memory. memset_s is guaranteed not to be optimized away, so its appealing to use it rather than the alternatives. Zeroization is a process requirement, and I can't discard it.
bzero cannot be used because (1) its non-portable, and (2) its deprecated.
The volatile qualifier cannot be used because GCC interprets it to mean only memory that can be changed by hardware (a more lenient interpretation by the GCC folks would be very helpful. But it is what it is).
memset_s not available in 2.19:
$ nm -D /lib/x86_64-linux-gnu/libc.so.6 | grep memset_s
$ ls -l /lib/x86_64-linux-gnu/libc.so.6 lrwxrwxrwx 1 root root 12 Dec 4 14:31 /lib/x86_64-linux-gnu/libc.so.6 -> libc-2.19.so
And checking out the latest, memset_s is not available in 2.20 (or is it 2.21?):
$ git clone git://sourceware.org/git/glibc.git
$ cd glibc
$ grep -R -w memset_s *
I understand the safer functions from TR 24731-1 are not popular, but there should be no objections for a memset function that is not optimized away (correct me here, please).
Please provide the memset_s for safety and portability.
New features should be proposed on libc-alpha, not in Bugzilla. Please
restart the discussions there, including a careful synthesis of the
arguments from previous libc-alpha discussions of the issue to help the
community in reaching consensus.
The GCC -fno-builtin-memset option can be used to prevent compatible compilers from optimizing away calls to memset that aren't strictly speaking necessary.
Regarding portability: memset_s is an optional feature of the C11 standard and as such isn't really portable. (AFAIK, there also are no conforming C11 implementations that provide the optional Annex K in which the function is defined.)
I will close this bug report based on comment #2.