From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0F6DC31E45 for ; Thu, 13 Jun 2019 15:52:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8612D208CA for ; Thu, 13 Jun 2019 15:52:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8612D208CA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 15ECF8E0004; Thu, 13 Jun 2019 11:52:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 072A78E0001; Thu, 13 Jun 2019 11:51:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E2D2D8E0004; Thu, 13 Jun 2019 11:51:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id 95F8B8E0001 for ; Thu, 13 Jun 2019 11:51:59 -0400 (EDT) Received: by mail-ed1-f71.google.com with SMTP id n49so31362558edd.15 for ; Thu, 13 Jun 2019 08:51:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=BrhdRbRHoQZViCc8WGUqKO5SfChkOSffqO5/rBxgcDo=; b=fpK/YGxDSUx20btYLTcUDhsCe68uyK+m/ghzOkv8GCEH/ZIwMmaOOdLfe/KOj944IL qgd0Dh7WePRN0oMyhJB7u+SlNRDhyPoBcxyTjtPaJARANx8Ug+pe1MTylMziMa+KHncb 48a2aL0EPn5yZxWA0MNEQ4PR4g/jHL+dz88prWlUWjmDZCn9TeXTsD1mM7x6Cgg8RzGM Yl4YKvnfVeCB3GUR5jcbk0cA82oUJHU390i2y5sL0jF7aeBYKpY20rUr5MlxHGlobK6N vmHCc2iBYvWfLwv8Gm3e49Kue3n7AxPA0k60jnoX4Ac4Hrw3m2jJ//U+jBJ5UTJ0HAAH kSzA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com X-Gm-Message-State: APjAAAWhsVPgCiOfLOaijTVYPzE5JgyCmD2hnb1zJktV9D8PLrlm4ZU+ fm59rvAXBfVcBwDCDDWE4T1n7kLx/0nwOhR4cWqbg1yL324SK/pMCQaowjKi4K6uMxsfgKdW+cx wfAmK+PDBAnNt5+ez4GNvrEZYFEP4gcMMu17oSJvAw8EAdrfCBds3g5NJDu6h4vtbAw== X-Received: by 2002:a50:86b9:: with SMTP id r54mr67945383eda.162.1560441119060; Thu, 13 Jun 2019 08:51:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgT7EIAfhWoA5kyrrJrVnikruZI/DHsnTvywrBBnLAhkP7Lm8YYWFSrSxWYkEjwioeCogJ X-Received: by 2002:a50:86b9:: with SMTP id r54mr67945327eda.162.1560441118418; Thu, 13 Jun 2019 08:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560441118; cv=none; d=google.com; s=arc-20160816; b=Heu0+ZU3YJw0NNedt+ztWQAYi0Q2LTroUoyJj9jfktJ0QHAZX1ErMNzMBqFwxioSQG KskLo413/KDELmq8qMNBpBka+4JJzkOBtmVNwCW73blnMHHwhEO7GGq4AZtHNF+S9wC/ hUqqtT4Jccj4gk4SjyYrAXFOqMQASwMzA8ZXJivRcbENXSGSdDuRyDZB6V7bFzDi1CFv LKRyxe2gLmy9DLdMpqtiGr4tfheAjcOa3Bxopd3J+4F8fDRPT+8h2dh5tCmitlmRX16x YZKmm05jGuCRdHHyGVD++IKewm+H1g6CNmuXkk7+VJwXJS94JQS4bomP61uhzKMzlg7c +dFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=BrhdRbRHoQZViCc8WGUqKO5SfChkOSffqO5/rBxgcDo=; b=VH+rjeaJH+BLREbR7O7tDwW7ZLhjZPpjuuloKTPLsvPgoAopN0VwZaFMOiwy3vqQxe O0FRGko75li/Yn/BM7uujqeer/bZJDQzY6+/r+ag4jefqwwtQ1jryyu04BB14qxDgYQL WIjbkW0mEMEWAphMqv4JjIqhTt12DTMhv3AnQEq409/Ua8D3/yuZMUn7PT4ob+LXuTjF GopyBsWDn5aEhEtNC8KWHX8rzcPzQkxmvljH+RLhQ+QlQFkH3V3dUN25F5JY61DkLHZz FehPOGwrhTZ45iksF2H8DR3Nj6JiiPg1VsbPOK1TV8tM+bRSHs9DPrmv45WEFmGiXE3W cRMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com Received: from foss.arm.com (foss.arm.com. [217.140.110.172]) by mx.google.com with ESMTP id w20si222423ejj.239.2019.06.13.08.51.58 for ; Thu, 13 Jun 2019 08:51:58 -0700 (PDT) Received-SPF: pass (google.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) client-ip=217.140.110.172; Authentication-Results: mx.google.com; spf=pass (google.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6B8E0A78; Thu, 13 Jun 2019 08:51:57 -0700 (PDT) Received: from e119884-lin.cambridge.arm.com (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1748E3F246; Thu, 13 Jun 2019 08:51:55 -0700 (PDT) From: Vincenzo Frascino To: linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Catalin Marinas , Will Deacon , Andrey Konovalov , Alexander Viro Subject: [PATCH v5 2/2] arm64: Relax Documentation/arm64/tagged-pointers.txt Date: Thu, 13 Jun 2019 16:51:37 +0100 Message-Id: <20190613155137.47675-3-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190613155137.47675-1-vincenzo.frascino@arm.com> References: <20190613155137.47675-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On arm64 the TCR_EL1.TBI0 bit has been always enabled hence the userspace (EL0) is allowed to set a non-zero value in the top byte but the resulting pointers are not allowed at the user-kernel syscall ABI boundary. With the relaxed ABI proposed in this set, it is now possible to pass tagged pointers to the syscalls, when these pointers are in memory ranges obtained by an anonymous (MAP_ANONYMOUS) mmap(). Relax the requirements described in tagged-pointers.txt to be compliant with the behaviours guaranteed by the ARM64 Tagged Address ABI. Cc: Catalin Marinas Cc: Will Deacon CC: Andrey Konovalov Signed-off-by: Vincenzo Frascino --- Documentation/arm64/tagged-pointers.txt | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Documentation/arm64/tagged-pointers.txt b/Documentation/arm64/tagged-pointers.txt index a25a99e82bb1..e33af14478e3 100644 --- a/Documentation/arm64/tagged-pointers.txt +++ b/Documentation/arm64/tagged-pointers.txt @@ -18,7 +18,8 @@ Passing tagged addresses to the kernel -------------------------------------- All interpretation of userspace memory addresses by the kernel assumes -an address tag of 0x00. +an address tag of 0x00, unless the userspace opts-in the ARM64 Tagged +Address ABI via the PR_SET_TAGGED_ADDR_CTRL prctl(). This includes, but is not limited to, addresses found in: @@ -31,18 +32,23 @@ This includes, but is not limited to, addresses found in: - the frame pointer (x29) and frame records, e.g. when interpreting them to generate a backtrace or call graph. -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. +Using non-zero address tags in any of these locations when the +userspace application did not opt-in to the ARM64 Tagged Address ABI +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. +For these reasons, when the userspace application did not opt-in, 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. Programs maintaining a frame pointer and frame records that use non-zero address tags may suffer impaired or inaccurate debug and profiling visibility. +A definition of the meaning of ARM64 Tagged Address ABI and of the +guarantees that the ABI provides when the userspace opts-in via prctl() +can be found in: Documentation/arm64/tagged-address-abi.txt. + Preserving tags --------------- @@ -57,6 +63,9 @@ be preserved. The architecture prevents the use of a tagged PC, so the upper byte will be set to a sign-extension of bit 55 on exception return. +These behaviours are preserved even when the userspace opts-in to the ARM64 +Tagged Address ABI via the PR_SET_TAGGED_ADDR_CTRL prctl(). + Other considerations -------------------- -- 2.21.0