From: Kyle Huey <me@kylehuey.com> To: "Robert O'Callahan" <robert@ocallahan.org>, mtk.manpages@gmail.com Cc: linux-kernel@vger.kernel.org, Borislav Petkov <bp@suse.de>, Andy Lutomirski <luto@kernel.org>, linux-man@vger.kernel.org Subject: [PATCH (man-pages)] arch_prctl.2: Note new support on x86-32, ARCH_[GET|SET]_CPUID. Date: Wed, 14 Sep 2016 14:10:09 -0700 [thread overview] Message-ID: <1473887410-18624-1-git-send-email-khuey@kylehuey.com> (raw) In-Reply-To: <1473887291-18384-1-git-send-email-khuey@kylehuey.com> Signed-off-by: Kyle Huey <khuey@kylehuey.com> --- man2/arch_prctl.2 | 73 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 60 insertions(+), 13 deletions(-) diff --git a/man2/arch_prctl.2 b/man2/arch_prctl.2 index 989d369..c388797 100644 --- a/man2/arch_prctl.2 +++ b/man2/arch_prctl.2 @@ -22,7 +22,7 @@ .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" -.TH ARCH_PRCTL 2 2015-02-21 "Linux" "Linux Programmer's Manual" +.TH ARCH_PRCTL 2 2016-09-14 "Linux" "Linux Programmer's Manual" .SH NAME arch_prctl \- set architecture-specific thread state .SH SYNOPSIS @@ -31,8 +31,8 @@ arch_prctl \- set architecture-specific thread state .br .B #include <sys/prctl.h> .sp -.BI "int arch_prctl(int " code ", unsigned long " addr ); -.BI "int arch_prctl(int " code ", unsigned long *" addr ); +.BI "int arch_prctl(int " code ", unsigned long " arg2 ); +.BI "int arch_prctl(int " code ", unsigned long *" arg2 ); .fi .SH DESCRIPTION The @@ -41,22 +41,47 @@ function sets architecture-specific process or thread state. .I code selects a subfunction and passes argument -.I addr +.I arg2 to it; -.I addr +.I arg2 is interpreted as either an .I "unsigned long" for the "set" operations, or as an .IR "unsigned long\ *" , for the "get" operations. .LP +Subfunctions for both x86-64 and x86-32 are: +.TP +.B ARCH_GET_CPUID " (since Linux 4.X)" +Return the state of the flag determining whether the +.I cpuid +instruction can be executed by the process, in the +.I unsigned long +pointed to by +.IR arg2 . +.TP +.B ARCH_SET_CPUID " (since Linux 4.X)" +Set the state of the flag determining whether the +.I cpuid +instruction can be executed by the process. Pass +.B ARCH_CPUID_ENABLE +in +.I arg2 +to allow it to be executed, or +.B ARCH_CPUID_SIGSEGV +to generate a +.B SIGSEGV +when the process tries to execute the +.I cpuid +instruction. This flag is propagated across fork and exec. +.LP Subfunctions for x86-64 are: .TP .B ARCH_SET_FS Set the 64-bit base for the .I FS register to -.IR addr . +.IR arg2 . .TP .B ARCH_GET_FS Return the 64-bit base value for the @@ -64,13 +89,13 @@ Return the 64-bit base value for the register of the current thread in the .I unsigned long pointed to by -.IR addr . +.IR arg2 . .TP .B ARCH_SET_GS Set the 64-bit base for the .I GS register to -.IR addr . +.IR arg2 . .TP .B ARCH_GET_GS Return the 64-bit base value for the @@ -78,7 +103,7 @@ Return the 64-bit base value for the register of the current thread in the .I unsigned long pointed to by -.IR addr . +.IR arg2 . .SH RETURN VALUE On success, .BR arch_prctl () @@ -87,26 +112,48 @@ returns 0; on error, \-1 is returned, and is set to indicate the error. .SH ERRORS .TP +.B EACCES +.I code +is +.B ARCH_SET_CPUID +and +.I arg2 +is +.B ARCH_CPUID_ENABLE +and cpuid was previously disabled with +.B ARCH_CPUID_SIGSEGV +and the +.I no_new_privs +bit is set on this thread. +.TP .B EFAULT -.I addr +.I arg2 points to an unmapped address or is outside the process address space. .TP .B EINVAL .I code is not a valid subcommand. .TP +.B EINVAL +.I code +is +.B ARCH_SET_CPUID +and +.I cpuid +faulting is not supported on this machine. +.TP .B EPERM -.I addr +.I arg2 is outside the process address space. .\" .SH AUTHOR .\" Man page written by Andi Kleen. .SH CONFORMING TO .BR arch_prctl () -is a Linux/x86-64 extension and should not be used in programs intended +is a Linux/x86 extension and should not be used in programs intended to be portable. .SH NOTES .BR arch_prctl () -is supported only on Linux/x86-64 for 64-bit programs currently. +is supported only on Linux/x86 currently. The 64-bit base changes when a new 32-bit segment selector is loaded. -- 2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: Kyle Huey <me-OhBmq/TcCDJWk0Htik3J/w@public.gmane.org> To: Robert O'Callahan <robert-7ok7fSEJICeEi8DpZVb4nw@public.gmane.org>, mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Borislav Petkov <bp-l3A5Bk7waGM@public.gmane.org>, Andy Lutomirski <luto-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>, linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Subject: [PATCH (man-pages)] arch_prctl.2: Note new support on x86-32, ARCH_[GET|SET]_CPUID. Date: Wed, 14 Sep 2016 14:10:09 -0700 [thread overview] Message-ID: <1473887410-18624-1-git-send-email-khuey@kylehuey.com> (raw) In-Reply-To: <1473887291-18384-1-git-send-email-khuey-OhBmq/TcCDJWk0Htik3J/w@public.gmane.org> Signed-off-by: Kyle Huey <khuey-OhBmq/TcCDJWk0Htik3J/w@public.gmane.org> --- man2/arch_prctl.2 | 73 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 60 insertions(+), 13 deletions(-) diff --git a/man2/arch_prctl.2 b/man2/arch_prctl.2 index 989d369..c388797 100644 --- a/man2/arch_prctl.2 +++ b/man2/arch_prctl.2 @@ -22,7 +22,7 @@ .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" -.TH ARCH_PRCTL 2 2015-02-21 "Linux" "Linux Programmer's Manual" +.TH ARCH_PRCTL 2 2016-09-14 "Linux" "Linux Programmer's Manual" .SH NAME arch_prctl \- set architecture-specific thread state .SH SYNOPSIS @@ -31,8 +31,8 @@ arch_prctl \- set architecture-specific thread state .br .B #include <sys/prctl.h> .sp -.BI "int arch_prctl(int " code ", unsigned long " addr ); -.BI "int arch_prctl(int " code ", unsigned long *" addr ); +.BI "int arch_prctl(int " code ", unsigned long " arg2 ); +.BI "int arch_prctl(int " code ", unsigned long *" arg2 ); .fi .SH DESCRIPTION The @@ -41,22 +41,47 @@ function sets architecture-specific process or thread state. .I code selects a subfunction and passes argument -.I addr +.I arg2 to it; -.I addr +.I arg2 is interpreted as either an .I "unsigned long" for the "set" operations, or as an .IR "unsigned long\ *" , for the "get" operations. .LP +Subfunctions for both x86-64 and x86-32 are: +.TP +.B ARCH_GET_CPUID " (since Linux 4.X)" +Return the state of the flag determining whether the +.I cpuid +instruction can be executed by the process, in the +.I unsigned long +pointed to by +.IR arg2 . +.TP +.B ARCH_SET_CPUID " (since Linux 4.X)" +Set the state of the flag determining whether the +.I cpuid +instruction can be executed by the process. Pass +.B ARCH_CPUID_ENABLE +in +.I arg2 +to allow it to be executed, or +.B ARCH_CPUID_SIGSEGV +to generate a +.B SIGSEGV +when the process tries to execute the +.I cpuid +instruction. This flag is propagated across fork and exec. +.LP Subfunctions for x86-64 are: .TP .B ARCH_SET_FS Set the 64-bit base for the .I FS register to -.IR addr . +.IR arg2 . .TP .B ARCH_GET_FS Return the 64-bit base value for the @@ -64,13 +89,13 @@ Return the 64-bit base value for the register of the current thread in the .I unsigned long pointed to by -.IR addr . +.IR arg2 . .TP .B ARCH_SET_GS Set the 64-bit base for the .I GS register to -.IR addr . +.IR arg2 . .TP .B ARCH_GET_GS Return the 64-bit base value for the @@ -78,7 +103,7 @@ Return the 64-bit base value for the register of the current thread in the .I unsigned long pointed to by -.IR addr . +.IR arg2 . .SH RETURN VALUE On success, .BR arch_prctl () @@ -87,26 +112,48 @@ returns 0; on error, \-1 is returned, and is set to indicate the error. .SH ERRORS .TP +.B EACCES +.I code +is +.B ARCH_SET_CPUID +and +.I arg2 +is +.B ARCH_CPUID_ENABLE +and cpuid was previously disabled with +.B ARCH_CPUID_SIGSEGV +and the +.I no_new_privs +bit is set on this thread. +.TP .B EFAULT -.I addr +.I arg2 points to an unmapped address or is outside the process address space. .TP .B EINVAL .I code is not a valid subcommand. .TP +.B EINVAL +.I code +is +.B ARCH_SET_CPUID +and +.I cpuid +faulting is not supported on this machine. +.TP .B EPERM -.I addr +.I arg2 is outside the process address space. .\" .SH AUTHOR .\" Man page written by Andi Kleen. .SH CONFORMING TO .BR arch_prctl () -is a Linux/x86-64 extension and should not be used in programs intended +is a Linux/x86 extension and should not be used in programs intended to be portable. .SH NOTES .BR arch_prctl () -is supported only on Linux/x86-64 for 64-bit programs currently. +is supported only on Linux/x86 currently. The 64-bit base changes when a new 32-bit segment selector is loaded. -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-09-14 21:10 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-09-14 21:08 [RESEND][PATCH v2] arch_prctl,x86 Add ARCH_[GET|SET]_CPUID for controlling the CPUID instruction Kyle Huey 2016-09-14 21:08 ` [RESEND][PATCH v2 1/3] syscalls,x86 Expose arch_prctl on x86-32 Kyle Huey 2016-09-14 21:59 ` Dmitry Safonov 2016-09-14 22:08 ` Kyle Huey 2016-09-14 22:29 ` Dmitry Safonov 2016-09-15 1:01 ` Kyle Huey 2016-09-14 21:08 ` [RESEND][PATCH v2 2/3] x86 Test and expose CPUID faulting capabilities in /proc/cpuinfo Kyle Huey 2016-09-14 21:08 ` Kyle Huey 2016-09-14 21:08 ` [RESEND][PATCH v2 3/3] x86,arch_prctl Add ARCH_[GET|SET]_CPUID for controlling the CPUID instruction Kyle Huey 2016-09-14 21:10 ` Kyle Huey [this message] 2016-09-14 21:10 ` [PATCH (man-pages)] arch_prctl.2: Note new support on x86-32, ARCH_[GET|SET]_CPUID Kyle Huey
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1473887410-18624-1-git-send-email-khuey@kylehuey.com \ --to=me@kylehuey.com \ --cc=bp@suse.de \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-man@vger.kernel.org \ --cc=luto@kernel.org \ --cc=mtk.manpages@gmail.com \ --cc=robert@ocallahan.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.