220 38229 <CAFdMc-1x-jV8fwXj7=S5-XjA1yMTNVBJYQiwpNVO52-Sk4X6CQ@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: "dgutson ." <danielgutson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: memcpy/memset/etc overloads for volatile memory
Date: Sun, 27 May 2018 21:07:07 -0300
Lines: 147
Approved: news@gmane.org
Message-ID: <CAFdMc-1x-jV8fwXj7=S5-XjA1yMTNVBJYQiwpNVO52-Sk4X6CQ@mail.gmail.com>
References: <CAFdMc-0NAvWrkwzpgEKq4DQj=0vL_0F2s17XyR9MSUNJk5R0sw@mail.gmail.com>
 <420b274b-fc4b-413e-8ce9-b78131c782f7@isocpp.org> <CAFQaeCD83_FBX4cAE+9AAEHai4ciCeOaorHY1K94k_Yb0e9wnA@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="000000000000cb4a18056d38e68f"
X-Trace: blaine.gmane.org 1527465918 26901 195.159.176.226 (28 May 2018 00:05:18 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 28 May 2018 00:05:18 +0000 (UTC)
To: std-proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDE3NBMV6UFBBOMQVXMAKGQEK5Y2UWI@isocpp.org Mon May 28 02:05:14 2018
Return-path: <std-proposals+bncBDE3NBMV6UFBBOMQVXMAKGQEK5Y2UWI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qk0-f200.google.com ([209.85.220.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDE3NBMV6UFBBOMQVXMAKGQEK5Y2UWI@isocpp.org>)
	id 1fN5ex-0006sD-Ki
	for gclcip-std-proposals@m.gmane.org; Mon, 28 May 2018 02:05:11 +0200
Original-Received: by mail-qk0-f200.google.com with SMTP id 5-v6sf9608344qke.19
        for <gclcip-std-proposals@m.gmane.org>; Sun, 27 May 2018 17:07:22 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1527466042; cv=pass;
        d=google.com; s=arc-20160816;
        b=IHkZzI57uBzI/1DSko8YwX5jLcv7/WmZnUoh6/QVbXOphvlSQJ7y60D/Ftx0/bHt98
         savkq39wmSDeo8HDGWCQSLHWT089qyu/1EhSbrYI7YyLWF1dyq9/EoUPMVbrqm43Wjdh
         jeK+Uv3EdbD86ci3I3Z6pyrhxsowl9zPaoDiXmi5QOQa7qPlexKFgXojQnFsk2WDDP8M
         a3/vqTHBf1xXaecmko3ulsksmvBWeBiB1hz4iUEXSnJot/JmR99s6veYMBNQNS9XJ0Sl
         9cYe0KKFZL6uFf6YHoo13rKqS2DgcjaMNMa8hlGQk9F2TbT26jK/OhdI/TvPRq4Av12q
         ef/A==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:in-reply-to:references:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=sgPXntPyS1sZbqlmQACp46CKvmfHv6vzLX3a6W2T2Vo=;
        b=vXV012VenW6iWlxK6Dfs3IRh/5K8TSupNaUMmYwglK6dAzxc1+JvwIjD9RsCGczVQw
         YskXUYEnYFCD1NAYoPtTjYL8v0kn5P7C2PTXJFh2pXREMAITQov4uGPvccsHDP4n/v9c
         DtEmKbvS8ubjrGxqQ+uCJJp5sKETrdfu8YoQxGL5BUhxgB5oemP2hhUy/SgI/mUhSBAd
         DzaCDHQ3YVZOoK2+AdMJggFiego7uQFa8N3OwCN1U6KjuoSJZYgR6HJcJfMgolShqQ4F
         xN0qZV/p8XzPja1cOBFRaykWe+xaAZBig38URWoK9PgXSkVzQ7LfPq0udDaj52je1C8K
         QhWA==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=dTDZL1EF;
       spf=pass (google.com: domain of danielgutson@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=danielgutson@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:references:in-reply-to:from:date:message-id:subject:to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=sgPXntPyS1sZbqlmQACp46CKvmfHv6vzLX3a6W2T2Vo=;
        b=UTq+AyeuWHJ943studTI0LJEBPCOag0xYfWlC9qHh1beI7NbjJq4WuqHsURpJ+4/mG
         FkMK4lyfBvEBvuPlIBBnCKC5uWtB2ZpgRhlUPiGxNsF+GUGpGhPhn7dAQ4SC8w2dObrr
         47DAdjeakjvQYlExWFrNowX044EDLOF58zlOJBStk5lzsYdmnws76JZSu3INrn2BkA77
         hlMMIlM0iic5k92Du13kElkfHde2DjScv2HKwHYXlNYpMOGhZkwM+6tUo3HD5SlGsXZw
         LlEA4vIFBjVmyF1S/pYTKj9Dbn6zYrYNO/+tjyxwk7Uf8gT8RFitCDGo7dai4QFYaGG6
         HELg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:in-reply-to:from:date
         :message-id:subject:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=sgPXntPyS1sZbqlmQACp46CKvmfHv6vzLX3a6W2T2Vo=;
        b=MYKBUxw+fu3fmmfgd1e+8Wr/z1nF6Geq1tqx/WhcdlE20yVVGJbGeb0cVwUa0xkhFe
         O8bIiczE8MhoPxsjXDCIGjKThjdjWNrzM1AIZtYjGHYU1rALXNVdR4XIHlMtm24ApICD
         p5pTs8fDHfqw/YvBhHDqVGiSp9dnagzKE46Cy9byl60VNHeXdr5hoCDVVSGxkJBVa2Ef
         Ho0sPl/csduiS8Ud2D/t9ICN9dYdieQlGhm0w6QCurFTGnlwByd51YP/aNZHVDKlQEeP
         3OWq4HaqcD18GOThTHr+Qiq/DdLEK4W/MZvyPsRSI67DoMLKgQDrtpKsNQi3inZIzoMK
         Ff3A==
X-Gm-Message-State: ALKqPweesMqQEiWIPddulMeMxhGfUMzJFdNUkN1NcWqf1OssrZKyoTaq
	u3ROIuspzkrbOlvm05TOGTHjKw==
X-Google-Smtp-Source: ADUXVKLztxqZW+NUK76/LJ0+Vr+cwVM7MZsZlGyrPZCD/nnXBh06GUIvI/kpNp/Z7ueBSx6JEdHPEA==
X-Received: by 2002:a0c:b586:: with SMTP id g6-v6mr6217045qve.61.1527466042460;
        Sun, 27 May 2018 17:07:22 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a0c:96a4:: with SMTP id a33-v6ls12429779qvd.1.gmail; Sun, 27
 May 2018 17:07:21 -0700 (PDT)
X-Received: by 2002:a0c:9de6:: with SMTP id p38-v6mr10525707qvf.101.1527466041709;
        Sun, 27 May 2018 17:07:21 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1527466041; cv=none;
        d=google.com; s=arc-20160816;
        b=h2k3MHdGKJcn+SmxE26gY7qheyePLJZVnPT7W2R9EtEh76KbKJjKNCA75YEp8cp0Wo
         E+ATKjSRbKnET/zrRQcWbv+p4teHiV3FRHN+A3hqWGFw/BbNijFspDvAUfWkQh6WJuEo
         OiQ57dWMA/AQT8mYZ5xVjrmU9PEU8/pMS9x29P+Ja6bjDFC86VdY74Q8jPltBvwD84qt
         wvXsCfO2ACZrnCjEIm4dJX9EZ2/PBuwpp8goX+O65V9Gukr1i4yAJq71P/RsIFkJIOLZ
         d7Rd/FdKbWo9jjpo89VsXloCHuhzv6FNFK54Y/G6vE8NFE0QtP6G1JO2cwLJXpGNzk2m
         TcUA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:in-reply-to:references:mime-version
         :dkim-signature:arc-authentication-results;
        bh=5omJ9kv6mmMJKN5MKJMKQ1d0MI4FTRaVim9oEz8Hz20=;
        b=lIBN3asGjQt30d9R2txxs2aDY21kV6+QB0s9AR/0NLvV6eQpnxYkuIFQguy9/HtCfk
         4hXKYtJ0Z5BK2mv7cc/Sjs/hSIgnF4SZyGAJRra8/+8BZjWfLCWKKDnvjKBrx/HFMO0T
         YMckrPCTeaj7kkrn+scUNcNcY4cf+L+Wgb3Iqgv4krRU5mZnlzCQt9c1BGMjYeX9q8aK
         dX4kwkgZ9GcQ9vHFBw/0ho/P032Ju9DLYTN0eTn5SOJgVx3BYN+/WSchRS8HESD2ZFwk
         n6G38QklDSH+aa9jyeJMHo4+bNrlFLxc9YTSu5GbTqWBZXCjMfbM9zRwN277QJthRRvx
         BP0w==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=dTDZL1EF;
       spf=pass (google.com: domain of danielgutson@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=danielgutson@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65])
        by mx.google.com with SMTPS id 56-v6sor16749382qvi.6.2018.05.27.17.07.21
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Sun, 27 May 2018 17:07:21 -0700 (PDT)
Received-SPF: pass (google.com: domain of danielgutson@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65;
X-Received: by 2002:a0c:9621:: with SMTP id 30-v6mr9722026qvx.127.1527466041230;
 Sun, 27 May 2018 17:07:21 -0700 (PDT)
In-Reply-To: <CAFQaeCD83_FBX4cAE+9AAEHai4ciCeOaorHY1K94k_Yb0e9wnA@mail.gmail.com>
X-Original-Sender: danielgutson@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=dTDZL1EF;       spf=pass
 (google.com: domain of danielgutson@gmail.com designates 209.85.220.65 as
 permitted sender) smtp.mailfrom=danielgutson@gmail.com;       dmarc=pass
 (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:38229
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/38229>

--000000000000cb4a18056d38e68f
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

El dom., 27 de mayo de 2018 21:02, j c <james.a.cooper@gmail.com> escribi=
=C3=B3:

>
>
> On Monday, May 28, 2018, Niall Douglas <nialldouglas14@gmail.com> wrote:
>
>> On Friday, May 18, 2018 at 9:41:08 PM UTC+1, dgutson wrote:
>>>
>>> This might be interesting.
>>>
>>> In some systems, the implementation of memcpy() & friends cannot be use=
d
>>> for memory-mapped devices.
>>> Usually, mapped memory is marked as volatile.
>>>
>>> I'm proposing to add volatile pointers overloads for the memcpy()
>>> function and friends, without specifying exactly what should be differe=
nt
>>> at the standard-level, but allowing implementations to provide a partic=
ular
>>> behavior. I'm just proposing to add the declaration to the standard.
>>>
>>> Just there this weekend I, yet again, had to write a custom memcpy()
>> implementation because the built-in one can be elided by the compiler
>> during optimisation. I'd like to stop having to write memcpy() personall=
y.
>>
>> I think your idea has two variants:
>>
>>    1. Cannot be optimised out memcpy/memset/memmove etc. I'd suggest
>>    secure_memset(), secure_memcpy(), secure_memmove() and so on rather t=
han
>>    editions taking a volatile pointer.
>>    2. Said routines, but with additional std::memory_order parameter
>>
>>
> Or just stop compilers from doing daft things
>

FWIW, from my previous team:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D69976

--=20
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> To view this discussion on the web visit
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFQaeCD83_F=
BX4cAE%2B9AAEHai4ciCeOaorHY1K94k_Yb0e9wnA%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFQaeCD83_=
FBX4cAE%2B9AAEHai4ciCeOaorHY1K94k_Yb0e9wnA%40mail.gmail.com?utm_medium=3Dem=
ail&utm_source=3Dfooter>
> .
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CAFdMc-1x-jV8fwXj7%3DS5-XjA1yMTNVBJYQiwpNVO52-Sk=
4X6CQ%40mail.gmail.com.

--000000000000cb4a18056d38e68f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">=
El dom., 27 de mayo de 2018 21:02, j c &lt;<a href=3D"mailto:james.a.cooper=
@gmail.com">james.a.cooper@gmail.com</a>&gt; escribi=C3=B3:<br></div><block=
quote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc=
 solid;padding-left:1ex"><br><br>On Monday, May 28, 2018, Niall Douglas &lt=
;<a href=3D"mailto:nialldouglas14@gmail.com" target=3D"_blank" rel=3D"noref=
errer">nialldouglas14@gmail.com</a>&gt; wrote:<br><blockquote class=3D"gmai=
l_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left=
:1ex"><div dir=3D"ltr">On Friday, May 18, 2018 at 9:41:08 PM UTC+1, dgutson=
 wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8e=
x;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">This might =
be interesting.<div><br></div><div>In some systems, the implementation of m=
emcpy() &amp; friends cannot be used for memory-mapped devices.</div><div>U=
sually, mapped memory is marked as volatile.</div><div><br></div><div>I&#39=
;m proposing to add volatile pointers overloads for the memcpy() function a=
nd friends, without specifying exactly what should be different at the stan=
dard-level, but allowing implementations to provide a particular behavior. =
I&#39;m just proposing to add the declaration to the standard.</div><div><b=
r></div></div></blockquote><div>Just there this weekend I, yet again, had t=
o write a custom memcpy() implementation because the built-in one can be el=
ided by the compiler during optimisation. I&#39;d like to stop having to wr=
ite memcpy() personally.</div><div><br></div><div>I think your idea has two=
 variants:</div><div><ol><li>Cannot be optimised out memcpy/memset/memmove =
etc. I&#39;d suggest secure_memset(), secure_memcpy(), secure_memmove() and=
 so on rather than editions taking a volatile pointer.</li><li>Said routine=
s, but with additional std::memory_order parameter</li></ol></div></div></b=
lockquote><div><br></div><div>Or just stop compilers from doing daft things=
=C2=A0</div></blockquote></div></div><div dir=3D"auto"><br></div><div dir=
=3D"auto">FWIW, from my previous team:=C2=A0<a href=3D"https://gcc.gnu.org/=
bugzilla/show_bug.cgi?id=3D69976">https://gcc.gnu.org/bugzilla/show_bug.cgi=
?id=3D69976</a></div><div dir=3D"auto"><br></div><div dir=3D"auto"><div cla=
ss=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 =
..8ex;border-left:1px #ccc solid;padding-left:1ex">

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank" rel=3D"noreferrer">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank" rel=3D"noreferrer">std-proposals@isocpp.org</a>.<br=
>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAFQaeCD83_FBX4cAE%2B9AAEHai4ciCeOaor=
HY1K94k_Yb0e9wnA%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfoote=
r" target=3D"_blank" rel=3D"noreferrer">https://groups.google.com/a/isocpp.=
org/d/msgid/std-proposals/CAFQaeCD83_FBX4cAE%2B9AAEHai4ciCeOaorHY1K94k_Yb0e=
9wnA%40mail.gmail.com</a>.<br>
</blockquote></div></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAFdMc-1x-jV8fwXj7%3DS5-XjA1yMTNVBJYQ=
iwpNVO52-Sk4X6CQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFdMc-1x-jV8fw=
Xj7%3DS5-XjA1yMTNVBJYQiwpNVO52-Sk4X6CQ%40mail.gmail.com</a>.<br />

--000000000000cb4a18056d38e68f--

.
