Message ID | 20201218192957.11035-5-rearnsha@arm.com |
---|---|
State | Committed |
Commit | 0d1bafdcb62187a1535618c71b840672308ba07d |
Headers |
Return-Path: <libc-alpha-bounces@sourceware.org> 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 7DE80393BC3B; Fri, 18 Dec 2020 19:30:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7DE80393BC3B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1608319817; bh=O4gxRo5i/5pwHqTF2Ift3mp3R8Dbf3n2hfJsChNutjU=; 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=M1ORnUvaUwIXGrBrsYrNnX7ApkxZ+pyEZIPKzjSwr4KDXrEY/v4qPBHfqRQeXH/Tw DdZQ3JZeOx/rhNKMk4DnU7/QDdp7FA01aSQq+uWhxAh9jO5uCYPRo8csE850fQA5YT u1X11HGtUBNHxb7hVfd8RbALILhVNWanV5txWwI4= 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 304423857004 for <libc-alpha@sourceware.org>; Fri, 18 Dec 2020 19:30:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 304423857004 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 86C491042; Fri, 18 Dec 2020 11:30:13 -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 B36DB3F66E; Fri, 18 Dec 2020 11:30:12 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH v4 4/6] linux: Add compatibility definitions to sys/prctl.h for MTE Date: Fri, 18 Dec 2020 19:29:55 +0000 Message-Id: <20201218192957.11035-5-rearnsha@arm.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201218192957.11035-1-rearnsha@arm.com> References: <20201218192957.11035-1-rearnsha@arm.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2.29.2" Content-Transfer-Encoding: 8bit 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 <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: Richard Earnshaw via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Richard Earnshaw <rearnsha@arm.com> Cc: Richard Earnshaw <rearnsha@arm.com> Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces@sourceware.org> |
Series |
Memory tagging support
|
|
Commit Message
Richard Earnshaw
Dec. 18, 2020, 7:29 p.m. UTC
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(+)
Comments
On 12/19/20 12:59 AM, Richard Earnshaw via Libc-alpha wrote: > > 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(+) Please put the additions into an architecture-specific sysdeps/unix/sysv/linux/aarch64/sys/prctl.h and include_next this file from there. > > 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 <features.h> > #include <linux/prctl.h> /* 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. */
On 21/12/2020 13:32, Siddhesh Poyarekar wrote: > On 12/19/20 12:59 AM, Richard Earnshaw via Libc-alpha wrote: >> >> 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(+) > > Please put the additions into an architecture-specific > sysdeps/unix/sysv/linux/aarch64/sys/prctl.h and include_next this file > from there. > >> >> 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 <features.h> >> #include <linux/prctl.h> /* 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. */ > > The standard linux kernel headers have this in an architecture independent file, so why should glibc need to do this differently? R.
On 12/21/20 7:04 PM, Richard Earnshaw wrote: > The standard linux kernel headers have this in an architecture > independent file, so why should glibc need to do this differently? Only because that's the precedent we set with x86, where we avoided writing into the architecture-independent header. It seems cleaner that way too. Siddhesh
* Siddhesh Poyarekar: > On 12/19/20 12:59 AM, Richard Earnshaw via Libc-alpha wrote: >> 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(+) > > Please put the additions into an architecture-specific > sysdeps/unix/sysv/linux/aarch64/sys/prctl.h and include_next this file > from there. This does not work for an installed header. A separate bits/ header is needed for such cases (if it is indeed required not to make the definitions generic, which is probably not the case here—that is, this part of Richard's patch can be used as-is). Thanks, Florian
On 12/21/20 7:09 PM, Florian Weimer wrote: > * Siddhesh Poyarekar: > >> On 12/19/20 12:59 AM, Richard Earnshaw via Libc-alpha wrote: >>> 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(+) >> >> Please put the additions into an architecture-specific >> sysdeps/unix/sysv/linux/aarch64/sys/prctl.h and include_next this file >> from there. > > This does not work for an installed header. A separate bits/ header is > needed for such cases (if it is indeed required not to make the > definitions generic, which is probably not the case here—that is, > this part of Richard's patch can be used as-is). Uff, indeed I didn't notice that it was an installed header. This is OK as is then. Thanks, Siddhesh
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 <features.h> #include <linux/prctl.h> /* 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. */