public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Jorge Almeida <jjalmeida@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] memset_s
Date: Sat, 11 Nov 2017 00:10:19 +0000	[thread overview]
Message-ID: <CAKpSnp+ZHX=ms+YXrJTbgoSOzDU_TAZReVuEL0mSD1DesiE+mw@mail.gmail.com> (raw)
In-Reply-To: <CAAD4mYg96zgLaSTEENtgjXuuNM7L1rwdmFU=rqT_0HYE5zNOYA@mail.gmail.com>

On Fri, Nov 10, 2017 at 11:19 PM, R0b0t1 <r030t1@gmail.com> wrote:
> On Fri, Nov 10, 2017 at 2:09 PM, Jorge Almeida <jjalmeida@gmail.com> wrote:
>> On Fri, Nov 10, 2017 at 4:25 PM, R0b0t1 <r030t1@gmail.com> wrote:
>
>>
>> http://www.daemonology.net/blog/2014-09-04-how-to-zero-a-buffer.html
>>
>
> I really think there is a deeper issue here then, which is that the
> compiler takes a lot of liberties when translating a program
> description into machine code. There have been suggestions made that
> this makes very nearly all compilers unsuitable for high reliability
> purposes. Cryptographic or user security code is likely a candidate
> for the label "high reliability."

Yes, the html page above has a link to a 2nd part, where (if I
understood correctly) it is concluded that currently there is no real
solution: even if the compiler does what it is told to, it may copy
data around, and the programmer has no control whatsoever over the
fate of such data.

>
> To further explain why the additions are counterproductive: the
> programmer still has to remember to use them. It is just as likely
> that the programmer will forget to use memset_s properly as any of the
> other functions in string.h (possibly by forgetting to sanitize input
> i.e. the memory segment boundaries).
>
Well, most programmers probably won't care about this stuff anyway,
and people who deal with cryptography tend to be more cautious than
average. But I'm not really making a case for safe versions of known
functions. After all, the usual functions do fine for most
applications. memset() would be enough to clear RAM with sensitive
data if we had a pragma (or equivalent) to convince the compiler to
not ignore it (I mean a pragma to invoke on a particular function
definition when the programmer  feels that a black box behaviour is
undesirable). Of course, solving the problem of the compiler copying
stuff around might be harder nut to crack.
>

>
> If you don't mind I might post this concern to the GCC mailing list,
> or you can take it up if you want.

Please do. I'm strictly amateur league, and you'll do a better job.
>
Cheers

Jorge


  reply	other threads:[~2017-11-11  0:10 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 [this message]
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
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='CAKpSnp+ZHX=ms+YXrJTbgoSOzDU_TAZReVuEL0mSD1DesiE+mw@mail.gmail.com' \
    --to=jjalmeida@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