Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10943322ybi; Thu, 25 Jul 2019 07:24:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRWliNX5fxOpAa4Anvt0Lsiyukvv6MEzYyBdcOkF3I4TjA3i77V9nlKj6Mo5I8TUkCaKsj X-Received: by 2002:a17:90a:bb01:: with SMTP id u1mr91419893pjr.92.1564064699856; Thu, 25 Jul 2019 07:24:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564064699; cv=none; d=google.com; s=arc-20160816; b=U0DV8kxD08ttffFk9OktDR43DWty4Scmb6cpdvtSgjXpm2OlkJvCV5xMc5Bf8ybW8O 7Rkeiieu5OYdUabqW2E61WwP6Y0S2zHNGD0wLWUEzP1bhgIXmq07bGEu1UNLLzXT1171 BwxrETrs26PFiOh3Mf1EmWdwxlUEAkzYj7ycw7ImnOFYnIvW5CMzk7MLSGDRTohWG9ku 8Dz5JXyyuRSR6BRRhyw0NpVmfHKXkF0Z0k8Dsek0NIg9txt9Mg+1OMMxGjKtboTGMfZ7 2E3wbRIz0haMw+4J/jc1Uhek8M6nESibO6ZcT5W6uO3lsGVWg/O2IYd+V0RNE31JjL7D +qZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=3TgGXteFhRCHA/BcXIxir1s/cycIKmyrkuaHYejh8jk=; b=N9xHO7urDqB15tOKFwT943Qkf2Eksgn2XmlzpIkpkiI/u8e/IBsqlr6rXtYgQHo1CV l8RwQy9bUFhyivvt8CWj6Rsde/ctyynuh7GHYN6O2Swcv67HT0xxgwJgOLcOKXZxsSd+ U2LvyI4jvJMGF38+Hg/FsG0aH7K74wR6KLcdRFFyMtStdYGM1Ar3rZIiSfrVNCrm7F8a 9Airzd/ytGl5+pi9q7xu3vN4f3ZhEav/QhCchJbq9cJSFU4dZOMdSishGC3JKDd3dS9y GVAjK4C5fzwQLfYV9GhrOT/kU8DmBsyGs9Jsn93mysuxUOdL8vV8zLAL+j/K5puvFwly sDhQ== 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 s9si15194930plr.146.2019.07.25.07.24.45; Thu, 25 Jul 2019 07:24:59 -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 S2390878AbfGYNvS (ORCPT + 99 others); Thu, 25 Jul 2019 09:51:18 -0400 Received: from foss.arm.com ([217.140.110.172]:57756 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725928AbfGYNvQ (ORCPT ); Thu, 25 Jul 2019 09:51:16 -0400 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 287B31595; Thu, 25 Jul 2019 06:51:16 -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 AE0983F71F; Thu, 25 Jul 2019 06:51:14 -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: vincenzo.frascino@arm.com, Catalin Marinas , Will Deacon , Andrey Konovalov , Szabolcs Nagy Subject: [PATCH v6 2/2] arm64: Relax Documentation/arm64/tagged-pointers.rst Date: Thu, 25 Jul 2019 14:50:44 +0100 Message-Id: <20190725135044.24381-3-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190725135044.24381-1-vincenzo.frascino@arm.com> References: <20190725135044.24381-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.rst 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 Acked-by: Szabolcs Nagy --- Documentation/arm64/tagged-pointers.rst | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Documentation/arm64/tagged-pointers.rst b/Documentation/arm64/tagged-pointers.rst index 2acdec3ebbeb..933aaef8d52f 100644 --- a/Documentation/arm64/tagged-pointers.rst +++ b/Documentation/arm64/tagged-pointers.rst @@ -20,7 +20,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: @@ -33,18 +34,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.rst. + Preserving tags --------------- @@ -59,6 +65,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.22.0