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; 2+ 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] 2+ 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
  0 siblings, 0 replies; 2+ 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] 2+ messages in thread

end of thread, other threads:[~2026-11-07 11:06 UTC | newest]

Thread overview: 2+ 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

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