Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6638574imm; Wed, 27 Jun 2018 10:41:48 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKyokI8xvi1ko5mJ6Tpkq0ieWrtaSyxAOfAvHHeHJ0SJIaAAmQqTy3PDSjUUcOtqwcchcS5 X-Received: by 2002:a17:902:3124:: with SMTP id w33-v6mr7117800plb.235.1530121308844; Wed, 27 Jun 2018 10:41:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530121308; cv=none; d=google.com; s=arc-20160816; b=CVuRxP4hgE9XObujmShVagqQ8BuikT+Vm2sB2VlSdHPeTHht49HFHBR23b1ro4pDf6 mKl/TxtiB+nmw8WL50NNto3pXC7nUiQqa+DEhK9iBNL+Gg1XClK8gc9p2bEwNooiHFsR Px3Y7r/+Q3gPB0a8Bt9ZjvudnREP5dg5H8Ax6sNFd5UCN+/IZU3SwlP84tMHQ76fVZGi LTp9J+ysBfRxwk+uRZN42IRgSfDDoWf0nyGp4PqaoX63WGW6ZMYCEEyPWQJrHqE98muF hZ4QcBDM/KX8QFVVhDqTKp9gR1eF/PBzj4w4ZxLfrGJp1jCdbprk10evRWwamaHizlpo oo/A== 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:arc-authentication-results; bh=SoAiuXvcYm56r0k4JgkpmGDn2sICpJjdXj0dcqyEMEE=; b=uo9hoilCQ6IL+GlBki6uEj56ceUVTMytZHwHUFzmcyWs3jOrDF54RMHHsXWZVwRhkx bVFusgcvk1cj9jw/7CVkJ1bVI9ZDNFxbbFycHYmzY8oVhcrZztR+yQyWa1ugpnl+Ib5B WwBjYIuw5Kebuk/RjzoJMEXP4yUsHDTeIlLO4y2yZrVe78Elk9Y+3ISdigcnOYHhdByX DvM833Gs4yOSNfEW6R2cKv4FhOtv8TnrAtJcolAuzyKFC0IUIB21g1DtGCUncvh3Hp0h 07d/Wuemm6LNJZz9CqNsTnzbGGKrdAzYsqtpVtUdT6kcdBmK/81kWz3Z9fLj7/BUBiA5 vwwA== ARC-Authentication-Results: i=1; mx.google.com; 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 o128-v6si4815104pfg.5.2018.06.27.10.41.34; Wed, 27 Jun 2018 10:41:48 -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; 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 S965629AbeF0RSH (ORCPT + 99 others); Wed, 27 Jun 2018 13:18:07 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:35084 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965051AbeF0RSF (ORCPT ); Wed, 27 Jun 2018 13:18:05 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 39EBB18A; Wed, 27 Jun 2018 10:18:05 -0700 (PDT) Received: from armageddon.cambridge.arm.com (armageddon.cambridge.arm.com [10.1.206.84]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F35983F5C0; Wed, 27 Jun 2018 10:18:00 -0700 (PDT) Date: Wed, 27 Jun 2018 18:17:58 +0100 From: Catalin Marinas To: Ramana Radhakrishnan Cc: Andrey Konovalov , Mark Rutland , Kate Stewart , "linux-doc@vger.kernel.org" , Will Deacon , Kostya Serebryany , "linux-kselftest@vger.kernel.org" , Chintan Pandya , Shuah Khan , Ingo Molnar , "linux-arch@vger.kernel.org" , Jacob Bramley , Dmitry Vyukov , Evgeniy Stepanov , Kees Cook , Ruben Ayrapetyan , Al Viro , nd , Linux ARM , Linux Memory Management List , Greg Kroah-Hartman , LKML , Lee Smith , Andrew Morton , Robin Murphy , "Kirill A . Shutemov" Subject: Re: [PATCH v4 0/7] arm64: untag user pointers passed to the kernel Message-ID: <20180627171757.amucnh5znld45cpc@armageddon.cambridge.arm.com> References: <20180626172900.ufclp2pfrhwkxjco@armageddon.cambridge.arm.com> <0cef1643-a523-98e7-95e2-9ec595137642@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0cef1643-a523-98e7-95e2-9ec595137642@arm.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 27, 2018 at 04:08:09PM +0100, Ramana Radhakrishnan wrote: > On 27/06/2018 16:05, Andrey Konovalov wrote: > > On Tue, Jun 26, 2018 at 7:29 PM, Catalin Marinas > > wrote: > >> On Tue, Jun 26, 2018 at 02:47:50PM +0200, Andrey Konovalov wrote: > >>> On Wed, Jun 20, 2018 at 5:24 PM, Andrey Konovalov wrote: > >>>> arm64 has a feature called Top Byte Ignore, which allows to embed pointer > >>>> tags into the top byte of each pointer. Userspace programs (such as > >>>> HWASan, a memory debugging tool [1]) might use this feature and pass > >>>> tagged user pointers to the kernel through syscalls or other interfaces. > >>>> > >>>> This patch makes a few of the kernel interfaces accept tagged user > >>>> pointers. The kernel is already able to handle user faults with tagged > >>>> pointers and has the untagged_addr macro, which this patchset reuses. > >>>> > >>>> We're not trying to cover all possible ways the kernel accepts user > >>>> pointers in one patchset, so this one should be considered as a start. > >>>> > >>>> Thanks! > >>>> > >>>> [1] http://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html > >>> > >>> Is there anything I should do to move forward with this? > >>> > >>> I've received zero replies to this patch set (v3 and v4) over the last > >>> month. > >> > >> The patches in this series look fine but my concern is that they are not > >> sufficient and we don't have (yet?) a way to identify where such > >> annotations are required. You even say in patch 6 that this is "some > >> initial work for supporting non-zero address tags passed to the kernel". > >> Unfortunately, merging (or relaxing) an ABI without a clear picture is > >> not really feasible. > >> > >> While I support this work, as a maintainer I'd like to understand > >> whether we'd be in a continuous chase of ABI breaks with every kernel > >> release or we have a better way to identify potential issues. Is there > >> any way to statically analyse conversions from __user ptr to long for > >> example? Or, could we get the compiler to do this for us? > > > > OK, got it, I'll try to figure out a way to find these conversions. > > This sounds like the kind of thing we should be able to get sparse to do > already, no ? It's been many years since I last looked at it but I > thought sparse was the tool of choice in the kernel to do this kind of > checking. sparse is indeed an option. The current implementation doesn't warn on an explicit cast from (void __user *) to (unsigned long) since that's a valid thing in the kernel. I couldn't figure out if there's any other __attribute__ that could be used to warn of such conversion. -- Catalin