From patchwork Wed Jun 24 15:53:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Earnshaw X-Patchwork-Id: 39788 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 34CA43987870; Wed, 24 Jun 2020 15:54:05 +0000 (GMT) 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 0D8B73840C21 for ; Wed, 24 Jun 2020 15:54:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0D8B73840C21 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rearnsha@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 B7A56101E; Wed, 24 Jun 2020 08:53:59 -0700 (PDT) Received: from eagle.buzzard.freeserve.co.uk (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 440A63F73C; Wed, 24 Jun 2020 08:53:59 -0700 (PDT) From: Richard Earnshaw To: libc-alpha@sourceware.org Subject: [PATCH v2 4/6] linux: Add compatibility definitions to sys/prctl.h for MTE Date: Wed, 24 Jun 2020 16:53:47 +0100 Message-Id: <20200624155349.12134-5-rearnsha@arm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200624155349.12134-1-rearnsha@arm.com> References: <20200624155349.12134-1-rearnsha@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.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: , 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. */