Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp431244img; Mon, 18 Mar 2019 06:27:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwU6xk0RzRCpRG3+dvRjCEWKzUA4MzCpVFc6JBKxyVW2OfeerYZcaM7GY1kMs52b/3Yrh4t X-Received: by 2002:a63:cd02:: with SMTP id i2mr17705216pgg.111.1552915671933; Mon, 18 Mar 2019 06:27:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552915671; cv=none; d=google.com; s=arc-20160816; b=YcsfnZQ/ItCHR1xzyvExCgcx4hDijVkXMSMvuzE268EeZ+eexP9WSRB2/K7SvmVoCV gtWHlmCL4txo7es2m9BTaPB9kKdVEZGlki8cm/zUutbCKDKJ3P/Rz2E8jhakm6ORc+9y e32KrllzXJXDxg0lyuNWo30iXLexNY8jaO/l83Ik0BLGvrVmmVQbU8ERHCEv5B5cuUEs h8ypa3bn08dhn9rgy996yJH+APEolCXF5or7lVTAf5AdTkGa63j9l9cOfFY50VeGzCPL 6Z7AdzjEeLPSqGdiAUq7ZADH5MnAfX0t4R+0TPOPmcof6RUozb+J27WNisJ/P5cFXXgZ YtZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=k8V6NxAlu75osrnEr3PKsMahY8inQJRflwo5EogmLqo=; b=Ys5bvtkqjVr56OVsBAKuEzFEalPzlqjHy8KxYE/nNSgfUtH6k8Vy7+EIapUu0UvVMA e5gyTbD7NhDaCosYWZVu0hVpPj4F5vt56p2ktQudUN8T7UGovjoMCFl26Ocx6FqBF96y TlVwyB2ccS9ZWiaMj8tOPudzDNRW0RQNDRvd3D9LCMNoMAjLMpVOOL9Hon0xcpDAEwLD W/O/7oHSmPmzhFJYyCSztwf7N8MnI2jCcls1cwf0YEg+ztSN25H4SeZ1qK/JvxOzMgqb HzP+QEMLxhglYgfUsDWglu85aC93MYC8h83R47qZuo3Qr8T4+R0IFIhY5H1SIUDbLPkq nXAw== 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 p4si9462570plr.366.2019.03.18.06.27.36; Mon, 18 Mar 2019 06:27:51 -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 S1726982AbfCRN07 (ORCPT + 99 others); Mon, 18 Mar 2019 09:26:59 -0400 Received: from foss.arm.com ([217.140.101.70]:34318 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725973AbfCRN06 (ORCPT ); Mon, 18 Mar 2019 09:26:58 -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 A984FEBD; Mon, 18 Mar 2019 06:26:57 -0700 (PDT) Received: from [10.1.199.35] (e107154-lin.cambridge.arm.com [10.1.199.35]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4DF053F71A; Mon, 18 Mar 2019 06:26:51 -0700 (PDT) Subject: Re: [PATCH v11 13/14] arm64: update Documentation/arm64/tagged-pointers.txt To: Andrey Konovalov , Catalin Marinas , Will Deacon , Mark Rutland , Robin Murphy , Kees Cook , Kate Stewart , Greg Kroah-Hartman , Andrew Morton , Ingo Molnar , "Kirill A . Shutemov" , Shuah Khan , Vincenzo Frascino , Eric Dumazet , "David S. Miller" , Alexei Starovoitov , Daniel Borkmann , Steven Rostedt , Ingo Molnar , Peter Zijlstra , Arnaldo Carvalho de Melo , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Chintan Pandya , Luc Van Oostenryck , Dave Martin , Szabolcs Nagy References: From: Kevin Brodsky Message-ID: <81bc3110-b638-4545-1270-26baec3d59e7@arm.com> Date: Mon, 18 Mar 2019 13:26:48 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/03/2019 19:51, Andrey Konovalov wrote: > This patch is a part of a series that extends arm64 kernel ABI to allow to > pass tagged user pointers (with the top byte set to something else other > than 0x00) as syscall arguments. > > Document the ABI changes in Documentation/arm64/tagged-pointers.txt. > > Signed-off-by: Andrey Konovalov > --- > Documentation/arm64/tagged-pointers.txt | 18 ++++++++---------- > 1 file changed, 8 insertions(+), 10 deletions(-) > > diff --git a/Documentation/arm64/tagged-pointers.txt b/Documentation/arm64/tagged-pointers.txt > index a25a99e82bb1..07fdddeacad0 100644 > --- a/Documentation/arm64/tagged-pointers.txt > +++ b/Documentation/arm64/tagged-pointers.txt > @@ -17,13 +17,15 @@ this byte for application use. > Passing tagged addresses to the kernel > -------------------------------------- > > -All interpretation of userspace memory addresses by the kernel assumes > -an address tag of 0x00. > +The kernel supports tags in pointer arguments (including pointers in > +structures) of syscalls, however such pointers must point to memory ranges > +obtained by anonymous mmap() or brk(). > > -This includes, but is not limited to, addresses found in: > +The kernel supports tags in user fault addresses. However the fault_address > +field in the sigcontext struct will contain an untagged address. > > - - pointer arguments to system calls, including pointers in structures > - passed to system calls, > +All other interpretations of userspace memory addresses by the kernel > +assume an address tag of 0x00, in particular: > > - the stack pointer (sp), e.g. when interpreting it to deliver a > signal, > @@ -33,11 +35,7 @@ This includes, but is not limited to, addresses found in: > > Using non-zero address tags in any of these locations may result in an > error code being returned, a (fatal) signal being raised, or other modes > -of failure. > - > -For these reasons, passing non-zero address tags to the kernel via > -system calls is forbidden, and using a non-zero address tag for sp is > -strongly discouraged. > +of failure. Using a non-zero address tag for sp is strongly discouraged. I don't understand why we should keep such a limitation. For MTE, tagging SP is something we are definitely considering. This does bother userspace software in some rare cases, but I'm not sure in what way it bothers the kernel. Kevin > > Programs maintaining a frame pointer and frame records that use non-zero > address tags may suffer impaired or inaccurate debug and profiling