From patchwork Mon Dec 21 15:33:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Earnshaw X-Patchwork-Id: 41498 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 105D0386F41E; Mon, 21 Dec 2020 15:34:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 105D0386F41E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1608564847; bh=cOxS2t2DOV5xi4HS+8SEeQBHAmZxtOdDXrb/S5OiuSU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Mz7+QSk5NZzXEnqcAMIu/v4TU5BB0NNC4/D/Nh9H/IzgIa7+aoKGDfsKvmXeFcLYo dX+Uq3V+fNVU48HiPk+dz/qUlZWydcPUvpSLvYLUlJCPfkE8AC/pXsF2UtKfmH3qOg hRlUdapOy0LFT+sdq/Xjx0hkR26nCrF6wBPtNs1A= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id C329F386F000 for ; Mon, 21 Dec 2020 15:34:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C329F386F000 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 3DA1D12FC; Mon, 21 Dec 2020 07:34:04 -0800 (PST) Received: from eagle.buzzard.freeserve.co.uk (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 892963F6CF; Mon, 21 Dec 2020 07:34:03 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH v5 4/6] linux: Add compatibility definitions to sys/prctl.h for MTE Date: Mon, 21 Dec 2020 15:33:43 +0000 Message-Id: <20201221153345.3742-5-rearnsha@arm.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201221153345.3742-1-rearnsha@arm.com> References: <20201221153345.3742-1-rearnsha@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Earnshaw via Libc-alpha From: Richard Earnshaw Reply-To: Richard Earnshaw Cc: Richard Earnshaw Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Older versions of the Linux kernel headers obviously lack support for memory tagging, but we still want to be able to build in support when using those (obviously it can't be enabled on such systems). The linux kernel extensions are made to the platform-independent header (linux/prctl.h), so this patch takes a similar approach. --- sysdeps/unix/sysv/linux/sys/prctl.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sysdeps/unix/sysv/linux/sys/prctl.h b/sysdeps/unix/sysv/linux/sys/prctl.h index 7f748ebeeb..4d01379c23 100644 --- a/sysdeps/unix/sysv/linux/sys/prctl.h +++ b/sysdeps/unix/sysv/linux/sys/prctl.h @@ -21,6 +21,24 @@ #include #include /* The magic values come from here */ +/* Recent extensions to linux which may post-date the kernel headers + we're picking up... */ + +/* Memory tagging control operations (for AArch64). */ +#ifndef PR_TAGGED_ADDR_ENABLE +# define PR_TAGGED_ADDR_ENABLE (1UL << 8) +#endif + +#ifndef PR_MTE_TCF_SHIFT +# define PR_MTE_TCF_SHIFT 1 +# define PR_MTE_TCF_NONE (0UL << PR_MTE_TCF_SHIFT) +# define PR_MTE_TCF_SYNC (1UL << PR_MTE_TCF_SHIFT) +# define PR_MTE_TCF_ASYNC (2UL << PR_MTE_TCF_SHIFT) +# define PR_MTE_TCF_MASK (3UL << PR_MTE_TCF_SHIFT) +# define PR_MTE_TAG_SHIFT 3 +# define PR_MTE_TAG_MASK (0xffffUL << PR_MTE_TAG_SHIFT) +#endif + __BEGIN_DECLS /* Control process execution. */