lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 3 Aug 2018 10:42:40 +0100
From:   "Richard Earnshaw (lists)" <Richard.Earnshaw@....com>
To:     Ard Biesheuvel <ard.biesheuvel@...aro.org>,
        Ramana Radhakrishnan <ramana.gcc@...glemail.com>
Cc:     Florian Weimer <fweimer@...hat.com>,
        Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
        GNU C Library <libc-alpha@...rceware.org>,
        Andrew Pinski <pinskia@...il.com>,
        Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will.deacon@....com>,
        Russell King <linux@...linux.org.uk>,
        LKML <linux-kernel@...r.kernel.org>,
        Mikulas Patocka <mpatocka@...hat.com>,
        linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>
Subject: Re: framebuffer corruption due to overlapping stp instructions on
 arm64

On 03/08/18 10:29, Ard Biesheuvel wrote:
> On 3 August 2018 at 11:15, Ramana Radhakrishnan
> <ramana.gcc@...glemail.com> wrote:
>> On Fri, Aug 3, 2018 at 8:53 AM, Florian Weimer <fweimer@...hat.com> wrote:
>>> On 08/03/2018 09:11 AM, Andrew Pinski wrote:
>>>>
>>>> Yes fix Links not to use memcpy on the framebuffer.
>>>> It is undefined behavior to use device memory with memcpy.
>>>
>>>
>>> Some (de facto) ABIs require that it is supported, though.  For example, the
>>> POWER string functions avoid unaligned loads and stores for this reason
>>> because the platform has the same issue with device memory.  And yes, GCC
>>> will expand memcpy on POWER to something that is incompatible with device
>>> memory. 8-(
>>
>> GCC for AArch64 - use -mstrict-align
>> GCC for AArch32 - use -mno-unaligned-access.
>>
>> If you see unaligned accesses coming out of the compiler for well
>> defined programs then that's a bug. Frequently we see undefined
>> programs that get the compiler to produce traps - atleast one or 2
>> bugs a year  in  GCC .
>>
>>
>>>
>>> If we don't want people to use memcpy, we probably need to provide a
>>> credible alternative.
>>
>> I believe a number of packages have rolled their own to take these
>> constraints into account
>> for AArch32, perhaps it needs to be expanded for AArch64 as well.
>>
> 
> I guess the semantics of a framebuffer are not strictly defined, but
> the current reality is that it is expected to have memory semantics
> (by Linux/glibc)
> 
> Matt is saying fundamental properties of the underlying interconnects
> (AMBA) make that impossible on ARM, but I'd like to understand better
> if that is universally the case, and whether such a system is still
> PCIe compliant.
> 
> The discussion about whether memcpy() should rely on unaligned
> accesses, and whether you should use it on device memory is orthogonal
> to that, and not the heart of the matter IMO
> 

Whoa, hold on.

Memcpy should never be used on device memory.  Period.  Memcpy doesn't
know anything about what size of access is needed for accessing a device.

But why is the buffer in device memory rather than some other form of
uncached memory?

If you change memcpy to deal with an aspect of the system hardware,
you'll end up hosing performance EVERYWHERE.  DON'T DO IT!

If you must, create a new API with tighter semantics, but don't change
memcpy to accommodate this.

Anyway, back to the original report.  What memory mapping is being used?
 In detail?

R.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ