Linux Manual Pages development
 help / color / mirror / Atom feed
* PR_SET_PTRACER can also EINVAL when Yama is not configured
@ 2026-11-07 10:26 Cesar Eduardo Barros
  2026-11-07 11:06 ` Alejandro Colomar
  0 siblings, 1 reply; 6+ messages in thread
From: Cesar Eduardo Barros @ 2026-11-07 10:26 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: linux-man

The man page for PR_SET_PTRACER mentions three cases in which 
prctl(PR_SET_PTRACER, ...) can fail with EINVAL, but there's a fourth 
case: when CONFIG_SECURITY_YAMA=n

The code which deals with the three currently documented cases is at 
security/yama/yama_lsm.c which is only compiled when "Yama support" is 
configured. When it isn't, it falls through to the default case at 
kernel/sys.c which returns EINVAL.

(I was alerted to this at 
https://github.com/cesarb/count_instructions/pull/1 where I was told 
that it fails with EINVAL when the Yama LSM is not installed. I had 
written the code based on the man page, so I hadn't considered this 
fourth case.)

-- 
Cesar Eduardo Barros
cesarb@cesarb.eti.br


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PR_SET_PTRACER can also EINVAL when Yama is not configured
  2026-11-07 10:26 PR_SET_PTRACER can also EINVAL when Yama is not configured Cesar Eduardo Barros
@ 2026-11-07 11:06 ` Alejandro Colomar
  2026-11-21 19:48   ` [PATCH v1 0/1] man/man2const/PR_SET_PTRACER.2const: Document EINVAL Cesar Eduardo Barros
  0 siblings, 1 reply; 6+ messages in thread
From: Alejandro Colomar @ 2026-11-07 11:06 UTC (permalink / raw)
  To: Cesar Eduardo Barros; +Cc: linux-man

[-- Attachment #1: Type: text/plain, Size: 929 bytes --]

Hi Cesar,

> Date: 2026-11-07 07:26:32-0300
> From: Cesar Eduardo Barros <cesarb@cesarb.eti.br>
>
> The man page for PR_SET_PTRACER mentions three cases in which
> prctl(PR_SET_PTRACER, ...) can fail with EINVAL, but there's a fourth case:
> when CONFIG_SECURITY_YAMA=n
> 
> The code which deals with the three currently documented cases is at
> security/yama/yama_lsm.c which is only compiled when "Yama support" is
> configured. When it isn't, it falls through to the default case at
> kernel/sys.c which returns EINVAL.
> 
> (I was alerted to this at
> https://github.com/cesarb/count_instructions/pull/1 where I was told that it
> fails with EINVAL when the Yama LSM is not installed. I had written the code
> based on the man page, so I hadn't considered this fourth case.)

Thanks for the report!  Would you mind sending a patch?


Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v1 0/1] man/man2const/PR_SET_PTRACER.2const: Document EINVAL
  2026-11-07 11:06 ` Alejandro Colomar
@ 2026-11-21 19:48   ` Cesar Eduardo Barros
  2026-11-21 19:48     ` [PATCH v1 1/1] man/man2const/PR_SET_PTRACER.2const: Document EINVAL when Yama is not configured Cesar Eduardo Barros
  0 siblings, 1 reply; 6+ messages in thread
From: Cesar Eduardo Barros @ 2026-11-21 19:48 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: Cesar Eduardo Barros, linux-man

The man page for PR_SET_PTRACER mentions three cases in which
prctl(PR_SET_PTRACER, ...) can fail with EINVAL, but there's a fourth
case: when CONFIG_SECURITY_YAMA=n

The code which deals with the three currently documented cases is at
security/yama/yama_lsm.c which is only compiled when "Yama support" is
configured.  When it isn't, it falls through to the default case at
kernel/sys.c which returns EINVAL.

Cesar Eduardo Barros (1):
  man/man2const/PR_SET_PTRACER.2const: Document EINVAL when Yama is not
    configured

 man/man2const/PR_SET_PTRACER.2const | 3 +++
 1 file changed, 3 insertions(+)

Range-diff em relação a v0:
-:  ------------ > 1:  cfc899195f8d man/man2const/PR_SET_PTRACER.2const: Document EINVAL when Yama is not configured
-- 
2.56.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v1 1/1] man/man2const/PR_SET_PTRACER.2const: Document EINVAL when Yama is not configured
  2026-11-21 19:48   ` [PATCH v1 0/1] man/man2const/PR_SET_PTRACER.2const: Document EINVAL Cesar Eduardo Barros
@ 2026-11-21 19:48     ` Cesar Eduardo Barros
  2026-11-26 22:52       ` Alejandro Colomar
  0 siblings, 1 reply; 6+ messages in thread
From: Cesar Eduardo Barros @ 2026-11-21 19:48 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: Cesar Eduardo Barros, linux-man

The man page for PR_SET_PTRACER mentions three cases in which
prctl(PR_SET_PTRACER, ...) can fail with EINVAL, but there's a fourth
case: when CONFIG_SECURITY_YAMA=n

The code which deals with the three currently documented cases is at
security/yama/yama_lsm.c which is only compiled when "Yama support" is
configured.  When it isn't, it falls through to the default case at
kernel/sys.c which returns EINVAL.

Fixes: 6f86bef66936 (2013-01-11; "prctl.2: Document EINVAL error for PR_SET_PTRACER")
Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.eti.br>
---
 man/man2const/PR_SET_PTRACER.2const | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/man/man2const/PR_SET_PTRACER.2const b/man/man2const/PR_SET_PTRACER.2const
index 48bd8f04e104..b07ee5ae4d2d 100644
--- a/man/man2const/PR_SET_PTRACER.2const
+++ b/man/man2const/PR_SET_PTRACER.2const
@@ -57,6 +57,9 @@ .SH ERRORS
 is not 0,
 .BR PR_SET_PTRACER_ANY ,
 nor the PID of an existing process.
+.TP
+.B EINVAL
+Yama support is not built into the running kernel.
 .SH STANDARDS
 Linux.
 .SH HISTORY
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] man/man2const/PR_SET_PTRACER.2const: Document EINVAL when Yama is not configured
  2026-11-21 19:48     ` [PATCH v1 1/1] man/man2const/PR_SET_PTRACER.2const: Document EINVAL when Yama is not configured Cesar Eduardo Barros
@ 2026-11-26 22:52       ` Alejandro Colomar
  2026-11-26 23:02         ` Alejandro Colomar
  0 siblings, 1 reply; 6+ messages in thread
From: Alejandro Colomar @ 2026-11-26 22:52 UTC (permalink / raw)
  To: Cesar Eduardo Barros; +Cc: linux-man

[-- Attachment #1: Type: text/plain, Size: 2976 bytes --]

Hi Cesar,

> Date: 2026-11-21 16:48:07-0300
> From: Cesar Eduardo Barros <cesarb@cesarb.eti.br>
>
> The man page for PR_SET_PTRACER mentions three cases in which
> prctl(PR_SET_PTRACER, ...) can fail with EINVAL, but there's a fourth
> case: when CONFIG_SECURITY_YAMA=n
> 
> The code which deals with the three currently documented cases is at
> security/yama/yama_lsm.c which is only compiled when "Yama support" is
> configured.  When it isn't, it falls through to the default case at
> kernel/sys.c which returns EINVAL.
> 
> Fixes: 6f86bef66936 (2013-01-11; "prctl.2: Document EINVAL error for PR_SET_PTRACER")
> Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.eti.br>

Thanks for the patch!  I've reworded it to be consistent with similar
pages, such as unshare(2).  Here's what I applied:

	commit 5a70354bca4d025720565e1e506c8adab62a01bd (HEAD -> contrib)
	Author: Cesar Eduardo Barros <cesarb@cesarb.eti.br>
	Date:   2026-11-21 16:48:07 -0300

	    man/man2const/PR_SET_PTRACER.2const: Document EINVAL when Yama is not configured
	    
	    The man page for PR_SET_PTRACER mentions three cases in which
	    prctl(PR_SET_PTRACER, ...) can fail with EINVAL, but there's a fourth
	    case: when 'CONFIG_SECURITY_YAMA=n'.
	    
	    The code which deals with the three currently documented cases is at
	    "security/yama/yama_lsm.c" which is only compiled when "Yama support" is
	    configured.  When it isn't, it falls through to the default case at
	    "kernel/sys.c" which returns EINVAL.
	    
	    Fixes: 6f86bef66936 (2013-01-11; "prctl.2: Document EINVAL error for PR_SET_PTRACER")
	    Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.eti.br>
	    Message-ID: <cfc899195f8d66e3846133e0488d713d6eaf975c.1795289695.git.cesarb@cesarb.eti.br>
	    [alx: reword]
	    Signed-off-by: Alejandro Colomar <alx@kernel.org>

	diff --git a/man/man2const/PR_SET_PTRACER.2const b/man/man2const/PR_SET_PTRACER.2const
	index 48bd8f04e104..b07ee5ae4d2d 100644
	--- a/man/man2const/PR_SET_PTRACER.2const
	+++ b/man/man2const/PR_SET_PTRACER.2const
	@@ -57,6 +57,9 @@ .SH ERRORS
	 is not 0,
	 .BR PR_SET_PTRACER_ANY ,
	 nor the PID of an existing process.
	+.TP
	+.B EINVAL
	+Yama support is not built into the running kernel.
	 .SH STANDARDS
	 Linux.
	 .SH HISTORY


Have a lovely night!
Alex

> ---
>  man/man2const/PR_SET_PTRACER.2const | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/man/man2const/PR_SET_PTRACER.2const b/man/man2const/PR_SET_PTRACER.2const
> index 48bd8f04e104..b07ee5ae4d2d 100644
> --- a/man/man2const/PR_SET_PTRACER.2const
> +++ b/man/man2const/PR_SET_PTRACER.2const
> @@ -57,6 +57,9 @@ .SH ERRORS
>  is not 0,
>  .BR PR_SET_PTRACER_ANY ,
>  nor the PID of an existing process.
> +.TP
> +.B EINVAL
> +Yama support is not built into the running kernel.
>  .SH STANDARDS
>  Linux.
>  .SH HISTORY
> -- 
> 2.56.1
> 

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] man/man2const/PR_SET_PTRACER.2const: Document EINVAL when Yama is not configured
  2026-11-26 22:52       ` Alejandro Colomar
@ 2026-11-26 23:02         ` Alejandro Colomar
  0 siblings, 0 replies; 6+ messages in thread
From: Alejandro Colomar @ 2026-11-26 23:02 UTC (permalink / raw)
  To: Cesar Eduardo Barros; +Cc: linux-man

[-- Attachment #1: Type: text/plain, Size: 4848 bytes --]

> Date: 2026-11-26 23:52:29+0100
> From: Alejandro Colomar <alx+linux-man@kernel.org>
>
> Hi Cesar,
> 
> > Date: 2026-11-21 16:48:07-0300
> > From: Cesar Eduardo Barros <cesarb@cesarb.eti.br>
> >
> > The man page for PR_SET_PTRACER mentions three cases in which
> > prctl(PR_SET_PTRACER, ...) can fail with EINVAL, but there's a fourth
> > case: when CONFIG_SECURITY_YAMA=n
> > 
> > The code which deals with the three currently documented cases is at
> > security/yama/yama_lsm.c which is only compiled when "Yama support" is
> > configured.  When it isn't, it falls through to the default case at
> > kernel/sys.c which returns EINVAL.
> > 
> > Fixes: 6f86bef66936 (2013-01-11; "prctl.2: Document EINVAL error for PR_SET_PTRACER")
> > Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.eti.br>
> 
> Thanks for the patch!  I've reworded it to be consistent with similar
> pages, such as unshare(2).  Here's what I applied:
> 
> 	commit 5a70354bca4d025720565e1e506c8adab62a01bd (HEAD -> contrib)
> 	Author: Cesar Eduardo Barros <cesarb@cesarb.eti.br>
> 	Date:   2026-11-21 16:48:07 -0300
> 
> 	    man/man2const/PR_SET_PTRACER.2const: Document EINVAL when Yama is not configured
> 	    
> 	    The man page for PR_SET_PTRACER mentions three cases in which
> 	    prctl(PR_SET_PTRACER, ...) can fail with EINVAL, but there's a fourth
> 	    case: when 'CONFIG_SECURITY_YAMA=n'.
> 	    
> 	    The code which deals with the three currently documented cases is at
> 	    "security/yama/yama_lsm.c" which is only compiled when "Yama support" is
> 	    configured.  When it isn't, it falls through to the default case at
> 	    "kernel/sys.c" which returns EINVAL.
> 	    
> 	    Fixes: 6f86bef66936 (2013-01-11; "prctl.2: Document EINVAL error for PR_SET_PTRACER")
> 	    Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.eti.br>
> 	    Message-ID: <cfc899195f8d66e3846133e0488d713d6eaf975c.1795289695.git.cesarb@cesarb.eti.br>
> 	    [alx: reword]
> 	    Signed-off-by: Alejandro Colomar <alx@kernel.org>
> 
> 	diff --git a/man/man2const/PR_SET_PTRACER.2const b/man/man2const/PR_SET_PTRACER.2const
> 	index 48bd8f04e104..b07ee5ae4d2d 100644
> 	--- a/man/man2const/PR_SET_PTRACER.2const
> 	+++ b/man/man2const/PR_SET_PTRACER.2const
> 	@@ -57,6 +57,9 @@ .SH ERRORS
> 	 is not 0,
> 	 .BR PR_SET_PTRACER_ANY ,
> 	 nor the PID of an existing process.
> 	+.TP
> 	+.B EINVAL
> 	+Yama support is not built into the running kernel.
> 	 .SH STANDARDS
> 	 Linux.
> 	 .SH HISTORY

Ouch!  I meant to send this:

	commit 0f4df33a87d3b1fbb92d948ca546736eef2dbcb9
	Author: Cesar Eduardo Barros <cesarb@cesarb.eti.br>
	Date:   2026-11-21 16:48:07 -0300

	    man/man2const/PR_SET_PTRACER.2const: Document EINVAL when Yama is not configured
	    
	    The man page for PR_SET_PTRACER mentions three cases in which
	    prctl(PR_SET_PTRACER, ...) can fail with EINVAL, but there's a fourth
	    case: when 'CONFIG_SECURITY_YAMA=n'.
	    
	    The code which deals with the three currently documented cases is at
	    "security/yama/yama_lsm.c" which is only compiled when "Yama support" is
	    configured.  When it isn't, it falls through to the default case at
	    "kernel/sys.c" which returns EINVAL.
	    
	    Fixes: 6f86bef66936 (2013-01-11; "prctl.2: Document EINVAL error for PR_SET_PTRACER")
	    Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.eti.br>
	    Message-ID: <cfc899195f8d66e3846133e0488d713d6eaf975c.1795289695.git.cesarb@cesarb.eti.br>
	    [alx: reword]
	    Signed-off-by: Alejandro Colomar <alx@kernel.org>

	diff --git a/man/man2const/PR_SET_PTRACER.2const b/man/man2const/PR_SET_PTRACER.2const
	index 48bd8f04e104..233495249eee 100644
	--- a/man/man2const/PR_SET_PTRACER.2const
	+++ b/man/man2const/PR_SET_PTRACER.2const
	@@ -57,6 +57,11 @@ .SH ERRORS
	 is not 0,
	 .BR PR_SET_PTRACER_ANY ,
	 nor the PID of an existing process.
	+.TP
	+.B EINVAL
	+The kernel was not configured with the
	+.B CONFIG_SECURITY_YAMA
	+option.
	 .SH STANDARDS
	 Linux.
	 .SH HISTORY

Cheers,
Alex

> 
> 
> Have a lovely night!
> Alex
> 
> > ---
> >  man/man2const/PR_SET_PTRACER.2const | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/man/man2const/PR_SET_PTRACER.2const b/man/man2const/PR_SET_PTRACER.2const
> > index 48bd8f04e104..b07ee5ae4d2d 100644
> > --- a/man/man2const/PR_SET_PTRACER.2const
> > +++ b/man/man2const/PR_SET_PTRACER.2const
> > @@ -57,6 +57,9 @@ .SH ERRORS
> >  is not 0,
> >  .BR PR_SET_PTRACER_ANY ,
> >  nor the PID of an existing process.
> > +.TP
> > +.B EINVAL
> > +Yama support is not built into the running kernel.
> >  .SH STANDARDS
> >  Linux.
> >  .SH HISTORY
> > -- 
> > 2.56.1
> > 
> 
> -- 
> <https://www.alejandro-colomar.es>



-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-26 23:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-07 10:26 PR_SET_PTRACER can also EINVAL when Yama is not configured Cesar Eduardo Barros
2026-11-07 11:06 ` Alejandro Colomar
2026-11-21 19:48   ` [PATCH v1 0/1] man/man2const/PR_SET_PTRACER.2const: Document EINVAL Cesar Eduardo Barros
2026-11-21 19:48     ` [PATCH v1 1/1] man/man2const/PR_SET_PTRACER.2const: Document EINVAL when Yama is not configured Cesar Eduardo Barros
2026-11-26 22:52       ` Alejandro Colomar
2026-11-26 23:02         ` Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox