Gentoo Archives: gentoo-user

From: Alexander Kapshuk <alexander.kapshuk@×××××.com>
To: Gentoo mailing list <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] memset_s
Date: Fri, 10 Nov 2017 18:21:18
Message-Id: CAJ1xhMXmZY=41Yp221LnOyxdgZNzxFJmtD--4r88uhLPVoGktQ@mail.gmail.com
In Reply to: Re: [gentoo-user] memset_s by R0b0t1
1 On Fri, Nov 10, 2017 at 6:25 PM, R0b0t1 <r030t1@×××××.com> wrote:
2
3 > Hello,
4 >
5 > On Fri, Nov 10, 2017 at 5:34 AM, Jorge Almeida <jjalmeida@×××××.com>
6 > wrote:
7 > > On Fri, Nov 10, 2017 at 10:52 AM, Marc Joliet <marcec@×××.de> wrote:
8 > >> Am Freitag, 10. November 2017, 10:54:53 CET schrieb Jorge Almeida:
9 > >>> I'm trying to use memset_s() but the system (glibc?) doesn't know
10 > >>> about it. I also tried to compile against musl, same result.
11 > >>>
12 > >
13 > >
14 > >> It seems as though it is simply not implemented, I found a variety of
15 > links
16 > >> that all support this:
17 > >>
18 > >> https://stackoverflow.com/a/40162721
19 > >>
20 > >> https://stackoverflow.com/questions/38322363/when-will-
21 > the-safe-string-functions-of-c11-be-part-of-glibc
22 > >>
23 > >> https://gcc.gnu.org/wiki/C11Status (which states that Annex K is not
24 > >> implemented)
25 > >>
26 > >> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1967.htm
27 > >>
28 > > OK, thanks. The last link even suggests that Annex K should be
29 > > deprecated. I suppose this people don't care about security at all.
30 > >
31 >
32 > I'm having trouble finding the article again, but these functions look
33 > very similar to Microsoft's extensions to the C standard. There is a
34 > good case to be made that they are counterproductive.
35 >
36 > > Of course, what would really solve the optimize-into-oblivion problem
37 > > is a pragma that when invoked on a particular block of code (maybe
38 > > only a function definition) would tell the compiler to do what the
39 > > programmer says rather than viewing a function as a kind of black box.
40 > >
41 >
42 > This would probably be useful. It may be wise to reimplement important
43 > functionality.
44 >
45 > Cheers,
46 > R0b0t1
47 >
48 >
49 It's also a part of NetBSD's libc used by Apple.
50 https://opensource.apple.com/source/Libc/Libc-1044.1.2/string/NetBSD/memset_s.c