Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 6 Jul 2017 20:52:18 +0200
From: Jens Gustedt <jens.gustedt@...ia.fr>
To: musl@...ts.openwall.com
Subject: Re: Documentation of memcpy and undefined behavior in memset

Hello,

On Thu, 6 Jul 2017 14:13:26 -0400 Rich Felker <dalias@...c.org> wrote:

> On Thu, Jul 06, 2017 at 08:38:29PM +0300, Alexander Monakov wrote:
> > On Thu, 6 Jul 2017, Rich Felker wrote:
> >   
> > > I'm doubtful of this. Certainly passing a pointer to memcpy with a
> > > nonzero n is a guarantee that the pointed-to object is
> > > non-volatile. The n=0 case is less clear though.  
> > 
> > My view is that since in n=0 case no memory access inside of memcpy
> > takes place, the compiler may not deduce that the pointed-to object
> > is ok for speculative reads.  
> 
> Indeed, I think that's a valid interpretation, but not the only one;
> the problem here is that the specification is ambiguous, and I suspect
> nobody wants to fix the ambiguity because they know they're going to
> have an argument over what it was intended to mean...

No, no, not because of that :)

More seriously, if there is existing practice in both ways, the
committee would not want to invalidate any of them for just a TC. In
consequence, as a user of such functions you'd always have to be
conservative. As an implementor, you can basically chose, but this
doesn't help much because your users can't rely on that particular
behavior.

Now when it comes to changes for a new standard, people would certainly
be more open-minded. So if anybody thinks they want to make a proposal
for C2x, don't hesitate.

Jens

-- 
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.