From: R0b0t1 <r030t1@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] memset_s
Date: Tue, 14 Nov 2017 22:42:48 -0600 [thread overview]
Message-ID: <CAAD4mYhWmDwrosnDjhb_6zNNKyqoLvf2CpVat47U9FQ2sma3ZA@mail.gmail.com> (raw)
In-Reply-To: <CAKpSnpJ0NHBnzj6ggEkx4TG36oNFBk7k=UoKxHC+5Wmw7029Kg@mail.gmail.com>
On Tue, Nov 14, 2017 at 11:36 AM, Jorge Almeida <jjalmeida@gmail.com> wrote:
> On Fri, Nov 10, 2017 at 12:09 PM, Jorge Almeida <jjalmeida@gmail.com> wrote:
>
>> http://www.daemonology.net/blog/2014-09-04-how-to-zero-a-buffer.html
>>
>>
>>>> Of course, what would really solve the optimize-into-oblivion problem
>>>> is a pragma that when invoked on a particular block of code (maybe
>>>> only a function definition) would tell the compiler to do what the
>>>> programmer says rather than viewing a function as a kind of black box.
>>>>
>>>
>
> It seems a solution exists with gcc:
>
> https://stackoverflow.com/questions/2219829/how-to-prevent-gcc-optimizing-some-statements-in-c
>
> The last reply:
>
> void __attribute__((optimize("O0"))) foo(unsigned char data) {
> // unmodifiable compiler code
> }
>
> Any comments, anyone? Yes, it's gcc, but IMO this should be in the
> language itself. Am I right to assume this is a poorly known feature
> of gcc?
> It allows, for example, to replace sensitive data by random bytes,
> existing system callls like memset() or getrandom() can be used as
> they are, no reimplementation needed.
>
Very interesting. I imagine the opinion of the standards committee
would be that the variability in code generation precludes a standard
interface to optimization controls. This might seem unusual, but
languages with a very controlling standard (like Java or C#) are a new
concept.
What I am wondering about is if C code which uses
__attribute__((optimize(...))) is against Gentoo package standards and
would have to be removed from the Portage tree.
Cheers,
R0b0t1
next prev parent reply other threads:[~2017-11-15 4:42 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-10 9:54 [gentoo-user] memset_s Jorge Almeida
2017-11-10 10:52 ` Marc Joliet
2017-11-10 11:34 ` Jorge Almeida
2017-11-10 16:25 ` R0b0t1
2017-11-10 18:20 ` Alexander Kapshuk
2017-11-10 20:09 ` Jorge Almeida
2017-11-10 23:19 ` R0b0t1
2017-11-11 0:10 ` Jorge Almeida
2017-11-13 3:03 ` Mart Raudsepp
2017-11-13 7:17 ` Jorge Almeida
2017-11-13 10:44 ` [gentoo-user] memset_s Nikos Chantziaras
2017-11-13 11:16 ` Jorge Almeida
2017-11-13 11:38 ` Mart Raudsepp
2017-11-13 14:26 ` Nikos Chantziaras
2017-11-14 17:36 ` [gentoo-user] memset_s Jorge Almeida
2017-11-15 4:42 ` R0b0t1 [this message]
2017-11-15 7:22 ` Jorge Almeida
2017-11-15 15:28 ` [gentoo-user] memset_s Grant Edwards
2017-11-15 15:41 ` R0b0t1
2017-11-15 15:48 ` R0b0t1
2017-11-15 21:42 ` Grant Edwards
2017-11-16 0:19 ` R0b0t1
2017-11-15 15:50 ` Jorge Almeida
2017-11-15 17:39 ` Michael Orlitzky
2017-11-15 8:54 ` Nikos Chantziaras
2017-11-15 9:05 ` Jorge Almeida
2017-11-15 10:31 ` Nikos Chantziaras
2017-11-10 11:38 ` Nikos Chantziaras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAD4mYhWmDwrosnDjhb_6zNNKyqoLvf2CpVat47U9FQ2sma3ZA@mail.gmail.com \
--to=r030t1@gmail.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox