From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72196 invoked by alias); 12 Sep 2017 12:18:51 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 71317 invoked by uid 89); 12 Sep 2017 12:18:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_SORBS_SPAM,RP_MATCHES_RCVD,SPF_PASS autolearn=no version=3.3.2 spammy=obliged, observable, defect, contemplate X-HELO: mailbackend.panix.com X-Gm-Message-State: AHPjjUgLnjw1djU9ye0xu4WtBVsx40/S70XHDsofdG1QC0vk+eoc1eWm 0cdIga3xe3fDbVMrWJx/zyvw0NxDUg== X-Google-Smtp-Source: AOwi7QCztZzSUkAGRLRyMyxnsrMa3c7b5Hfv2L52G2cxmbruEkFW+/E7vL+/qli1J0CzhnMvNuD3A1P359A2khW60s0= X-Received: by 10.202.235.80 with SMTP id j77mr15151899oih.220.1505218721621; Tue, 12 Sep 2017 05:18:41 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <1503033107-20047-1-git-send-email-raji@linux.vnet.ibm.com> From: Zack Weinberg Date: Tue, 12 Sep 2017 12:18:00 -0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] powerpc: Use aligned stores in memset To: Florian Weimer Cc: Rajalakshmi Srinivasaraghavan , GNU C Library Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2017-09/txt/msg00485.txt.bz2 On Tue, Sep 12, 2017 at 6:30 AM, Florian Weimer wrote: > > I could not find the manual which has the requirement that the mem* > functions do not use unaligned accesses. Unless they are worded in a > very peculiar way, right now, the GCC/glibc combination does not comply > with a requirement that memset & Co. can be used for device memory access. mem* are required to behave as-if they access memory as an array of unsigned char. Therefore it is valid to give them arbitrarily (un)aligned pointers. The C abstract machine doesn't specifically contemplate the possibility of a CPU that can do unaligned word reads but maybe not to all memory addresses, but I would argue that if there is such a CPU, then mem* are obliged to cope with it. > ...the current glibc > implementation accesses locations which are outside the specified object > boundaries. I think that's technically a defect. Nothing in the C standard licenses it to do that; we just get away with it because, on the implementations to date, it's not observable (unless you go past the end of a page, which you'll note there are a bunch of tests to ensure we don't do). If an over-read by a single byte is observable, then mem* is not allowed to do that. zw