Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21312330ybl; Mon, 6 Jan 2020 02:06:18 -0800 (PST) X-Google-Smtp-Source: APXvYqxpgkXT2mUkS52cgZgkwaM97PWQiVqxeZXwdyc1khVj5GDAjbjdE54l3ppg0yaNrgpw0GKV X-Received: by 2002:a9d:7ac9:: with SMTP id m9mr109970814otn.80.1578305178240; Mon, 06 Jan 2020 02:06:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578305178; cv=none; d=google.com; s=arc-20160816; b=Fa5a5QZaYL8DgjuoAtdtoJ4KxIHOkOa57DWOgXgFiD3CvjCUdTx7S3/9mn5pD/yPtP fyEt0ldtL+c+MKOg9ehFzAPG1W+hVxNv3UFTXLkCbSvy5IN7ac4gLZzyaOE8SmWtzYeZ 5SkTDkKzxaFP8syCt8YR0OLD0c03lAvrlph/AjbSwtg2/0lcb7iir9v5Ma9e2C88ZwvG DiGywaGFPe5gL+u5QdWN5cBfH/Drd4CPOeuD8jwOK9UWDTZ+64c7KdC2EmiziKDbvQXT rH5QG8vzEsu+xHkk3dBpO9qUrNyqbvCWfv7t05NUk/GjkrwOcLqrUoRtfCYWY6rFRDOv dWDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=+r5qrDtI/8MxA6roL/AaQoMQsqo1NbwF3DMmkPvjPAA=; b=a/37N0vwq2HNghDTe70xdY1Pb1lzS85uGf968eALH+6Zw+lIDNhunXNw1shgnvqN/7 Aabp3ZCDUCMcQMJZ7uQa4i8PpxwqTm+dhPXvTkDGrTQrenoiRIEtpgiWSSs7Eu7ULU99 cnBCMv/C5vnxrUhWLnztue7zRJr/HQc4GQWtZcChpnEQBgyO/9OsZgStdynqn3n7nyEx ZPqsY+EEUR4CKWN4H/pDVzBD7dHXd1Xu2eGfEUJA+N/LJkyJmS8stmXXTzT89Hvdn29G LDHl+1vMi0rmbNQYambSFkm2WQpqtyT/eC1zfN7Yug+RxJ7VZgjB8665cTAXv5wRNsUn j7JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qxDusWjv; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n18si33447771otf.285.2020.01.06.02.06.05; Mon, 06 Jan 2020 02:06:18 -0800 (PST) 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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qxDusWjv; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726390AbgAFKFR (ORCPT + 99 others); Mon, 6 Jan 2020 05:05:17 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:52184 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726212AbgAFKFR (ORCPT ); Mon, 6 Jan 2020 05:05:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+r5qrDtI/8MxA6roL/AaQoMQsqo1NbwF3DMmkPvjPAA=; b=qxDusWjv6hcOzqQdl6O56m8Tf L+2LDJanP0A8qi6C/SvaV96bZjQYNTO4MC+4CME8ebUr4Ri1kjeluQZBmmPiajjfPuO/E6z8P3xD0 Ii0c1BjX1Hc1bWPL5L0vjk79glqK5gvxLdjXYPsN70sbXdfWKWMtZ81nB6T+a2z/Jfb83Xr32Ck18 1LhGW2H8oGhJpmsQJpEqR7bcyC29M0/Iw+BV8UBQYOF2KPlAooW34UaoUudp9/f8+SZBEKoENFBGe 3PZ/lo9yafS5KsRnD2D4gAQACQvvwR853zCvz3D7cTaLzi2htittH4NkhrOOb7sXDceW0/Jn+y5Qt 2V/taHdjg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1ioPFw-00071l-Qd; Mon, 06 Jan 2020 10:05:04 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id F19B5306368; Mon, 6 Jan 2020 11:03:29 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id DAF302B627477; Mon, 6 Jan 2020 11:05:01 +0100 (CET) Date: Mon, 6 Jan 2020 11:05:01 +0100 From: Peter Zijlstra To: Robin Murphy Cc: Marc Gonzalez , Greg Kroah-Hartman , Rafael Wysocki , LKML , Linux ARM , Dmitry Torokhov , Alexey Brodkin , Will Deacon , Russell King , Bjorn Andersson , Tejun Heo , Mark Brown Subject: Re: [RFC PATCH v1] devres: align devres.data strictly only for devm_kmalloc() Message-ID: <20200106100501.GM2844@hirez.programming.kicks-ass.net> References: <74ae22cd-08c1-d846-3e1d-cbc38db87442@free.fr> <20191220140655.GN2827@hirez.programming.kicks-ass.net> <9be1d523-e92c-836b-b79d-37e880d092a0@arm.com> <20191220171359.GP2827@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 20, 2019 at 10:02:13PM +0000, Robin Murphy wrote: > There is also the streaming API for one-off transfers > of data already existing at a given kernel address (think network packets, > USB URBs, etc), which on non-coherent architectures is achieved with > explicit cache maintenance plus an API contract that buffers must not be > explicitly accessed by CPUs for the duration of the mapping. Addresses from > kmalloc() are explicitly valid for dma_map_single() (and indeed are about > the only thing you'd ever reasonably feed it), which is the primary reason > why ARCH_KMALLOC_MINALIGN gets so big on architectures which can be > non-coherent and also suffer from creative cache designs. Would it make sense to extend KASAN (or something) to detect violations of this 'promise'? Because most obvious this was broken for the longest time and was only accidentally fixed due to the ARC alignment thingy. Who knows how many other sites are subtly broken too. Have the dma_{,un}map_single() things mark the memory as uninitialized/unaccessible such that any concurrent access will trigger a splat.