diff mbox series

[v2,2/2] libselinux: getcon.3: add note about PID races

Message ID 20230201131516.19967-2-cgzones@googlemail.com (mailing list archive)
State Accepted
Delegated to: Petr Lautrbach
Headers show
Series libselinux: add getpidprevcon | expand

Commit Message

Christian Göttsche Feb. 1, 2023, 1:15 p.m. UTC
Add a note that querying a foreign process via its PID is inherently
racy.

Suggested-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 libselinux/man/man3/getcon.3 | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Jason Zaman Feb. 11, 2023, 6:24 a.m. UTC | #1
On Wed, Feb 01, 2023 at 02:15:16PM +0100, Christian Göttsche wrote:
> Add a note that querying a foreign process via its PID is inherently
> racy.
> 
> Suggested-by: Stephen Smalley <stephen.smalley.work@gmail.com>
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: Jason Zaman <jason@perfinion.com>
And applied, thanks!
> ---
>  libselinux/man/man3/getcon.3 | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libselinux/man/man3/getcon.3 b/libselinux/man/man3/getcon.3
> index 1b4fe4b7..be60341b 100644
> --- a/libselinux/man/man3/getcon.3
> +++ b/libselinux/man/man3/getcon.3
> @@ -149,5 +149,9 @@ The retrieval functions might return success and set
>  .I *context
>  to NULL if and only if SELinux is not enabled.
>  
> +Querying a foreign process via its PID, e.g. \fBgetpidcon\fR() or
> +\fBgetpidprevcon\fR(), is inherently racy and therefore should never be relied
> +upon for security purposes.
> +
>  .SH "SEE ALSO"
>  .BR selinux "(8), " setexeccon "(3)"
> -- 
> 2.39.1
>
diff mbox series

Patch

diff --git a/libselinux/man/man3/getcon.3 b/libselinux/man/man3/getcon.3
index 1b4fe4b7..be60341b 100644
--- a/libselinux/man/man3/getcon.3
+++ b/libselinux/man/man3/getcon.3
@@ -149,5 +149,9 @@  The retrieval functions might return success and set
 .I *context
 to NULL if and only if SELinux is not enabled.
 
+Querying a foreign process via its PID, e.g. \fBgetpidcon\fR() or
+\fBgetpidprevcon\fR(), is inherently racy and therefore should never be relied
+upon for security purposes.
+
 .SH "SEE ALSO"
 .BR selinux "(8), " setexeccon "(3)"