Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp231775imm; Fri, 3 Aug 2018 02:31:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdkDnCaDsTg1VZXmWy0gZ9pRirTweCj1tYQlDySFM/1dnhnEuv9jrU81+ONTX23vE/0dwMm X-Received: by 2002:a63:8c0b:: with SMTP id m11-v6mr2941931pgd.372.1533288668914; Fri, 03 Aug 2018 02:31:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533288668; cv=none; d=google.com; s=arc-20160816; b=KW6wwOa+pxG6NwqsxXkVLhojM9iW7imb3VADQXmHLYW5GhNbnWdac+vkVNkouSHZmy o2ve6OVne+jF1UlO9EZE3RQ3mZrxFbHeAgh7xCDYU2mdA5ffgVRXtto5izNW0NCn0Jh9 m9FBYE6PjTDeCzXaIVLY9p9tLV4hFQopY84kBPY6/itb9PVpT+WOZlL2aFgj1289YX8b DnqhI9OQhSrlgEL/kOYyRI7Tiuty2RibankD5/ES+t3ZIB9b/pM2+BzHiICpYapo0w55 TKlphyRTh309o4eTpa0vqq3onUnpRMcHOpJh4SRpAfPb9a/AsvIUIWXEKL5DHsbC6MFr pEfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=asIJduDDXCfiOl2yGV6miJRUGVm+XJYipxt+oOZ4CyY=; b=mJmImqG4QV0DsTV33WcMsXbBDQjs8Mtdluv4BTLoQFXQibXm8pXmNo70StAMdtzmN1 ABaRVSrEt83esupmybr2t2kD5EJb+tHmEJ6cYROnSztDQtHrqvaio/PdwO/GDDRWxR8I kbLavDyVHczJDmT7dlf6sXnzBlAIUUxTDoye1GP9eZoliQFgmVpCAI0E+9E1Yo1sXPap woNq/X38OtbECkqclTTSvZTArddGf+vANjuQgYJELn4mCSpww1wardcZ4RhZ4QNpbLZI AkzKiq5226hLcEGz4PZ2CLKQ/pHchNyBxwSqSg0DBweOGrGF3nuhXVGNy1TqirnjafRK qwDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OnQpcTff; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k11-v6si4269283pgm.154.2018.08.03.02.30.54; Fri, 03 Aug 2018 02:31:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OnQpcTff; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732374AbeHCLZX (ORCPT + 99 others); Fri, 3 Aug 2018 07:25:23 -0400 Received: from mail-it0-f50.google.com ([209.85.214.50]:38184 "EHLO mail-it0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730129AbeHCLZW (ORCPT ); Fri, 3 Aug 2018 07:25:22 -0400 Received: by mail-it0-f50.google.com with SMTP id v71-v6so7509110itb.3 for ; Fri, 03 Aug 2018 02:29:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=asIJduDDXCfiOl2yGV6miJRUGVm+XJYipxt+oOZ4CyY=; b=OnQpcTffTNkCDh+lDE4SQgC7VaIsT7hJ9GN8/WdOoYhFvud9ml8mpyFQIF9Lxm2bg1 y1Gthq6i7bPVfgzTGigYlwu6PZ3QpLvVVcxJ52KY8XXlZY00lHXdU3mKWvnqe2ahSKE5 ccEdnL0apozY1qM7Eml8LBDDvEagKjNHXY0vc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=asIJduDDXCfiOl2yGV6miJRUGVm+XJYipxt+oOZ4CyY=; b=rcDTGyj5qCoxw1vTglhWAcgRPTRaCDbBf0M2LkijCKpdm+jeQWMOwHHGGKjKIl5Blr cuUZCp8/d0iVnG3oxdHKB09M0eHx+FE23Xsft1cc/I1IBawnpd7NvIozA1FwJ9Lwr2fA XtSNsFBY5BMS/fW/IB70iimh6QdSX7csJ5c10WDgxGYPAGtnj86MA2i8TETeTsH84/hd yL9SXX2H/f2Js7cMaKHbT9LPzdjKDBfa8IxnuluvrKRPnVj/Pj2FBAqn+KxjRIEyNfKn 2ohBvyvymbX4aeJBn0fb9CMXgDlNmjaryLGtfffdYUgQucy7bBP0hZ+swltHYlLHcYo3 aaPw== X-Gm-Message-State: AOUpUlEf0w/zSU0pZMccRx8PCFkENxBXKnBWQtQ1dn3fIZ9UoNx7adNg FUoKQcsPlAC6rRPoZc6FhmqyyfHFsAcHt+DY+saH3Q== X-Received: by 2002:a02:a1d9:: with SMTP id o25-v6mr2697819jah.86.1533288594748; Fri, 03 Aug 2018 02:29:54 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:ac05:0:0:0:0:0 with HTTP; Fri, 3 Aug 2018 02:29:54 -0700 (PDT) In-Reply-To: References: <9acdacdb-3bd5-b71a-3003-e48132ee1371@redhat.com> From: Ard Biesheuvel Date: Fri, 3 Aug 2018 11:29:54 +0200 Message-ID: Subject: Re: framebuffer corruption due to overlapping stp instructions on arm64 To: Ramana Radhakrishnan Cc: Florian Weimer , Thomas Petazzoni , GNU C Library , Andrew Pinski , Catalin Marinas , Will Deacon , Russell King , LKML , Mikulas Patocka , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3 August 2018 at 11:15, Ramana Radhakrishnan wrote: > On Fri, Aug 3, 2018 at 8:53 AM, Florian Weimer 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