Files
linux-stable-mirror/include/linux
Linus Torvalds 93d4ba49d1 ptrace: slightly saner 'get_dumpable()' logic
commit 31e62c2ebb upstream.

The 'dumpability' of a task is fundamentally about the memory image of
the task - the concept comes from whether it can core dump or not - and
makes no sense when you don't have an associated mm.

And almost all users do in fact use it only for the case where the task
has a mm pointer.

But we have one odd special case: ptrace_may_access() uses 'dumpable' to
check various other things entirely independently of the MM (typically
explicitly using flags like PTRACE_MODE_READ_FSCREDS).  Including for
threads that no longer have a VM (and maybe never did, like most kernel
threads).

It's not what this flag was designed for, but it is what it is.

The ptrace code does check that the uid/gid matches, so you do have to
be uid-0 to see kernel thread details, but this means that the
traditional "drop capabilities" model doesn't make any difference for
this all.

Make it all make a *bit* more sense by saying that if you don't have a
MM pointer, we'll use a cached "last dumpability" flag if the thread
ever had a MM (it will be zero for kernel threads since it is never
set), and require a proper CAP_SYS_PTRACE capability to override.

Reported-by: Qualys Security Advisory <qsa@qualys.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-05-15 14:48:07 +02:00
..
2026-03-04 07:19:25 -05:00
2025-06-27 11:04:09 +01:00
2024-07-05 09:12:55 +02:00
2025-09-11 17:16:06 +02:00
2024-06-21 14:53:19 +02:00
2024-06-21 14:53:46 +02:00
2025-12-07 06:08:09 +09:00
2026-01-19 13:12:00 +01:00
2026-01-19 13:11:54 +01:00
2024-10-17 15:07:44 +02:00
2025-10-29 14:01:18 +01:00
2025-07-17 18:27:44 +02:00
2024-06-21 14:53:28 +02:00
2025-06-04 14:37:08 +02:00
2025-08-28 16:22:31 +02:00
2025-04-10 14:30:53 +02:00
2025-02-01 18:22:32 +01:00
2025-06-27 11:04:09 +01:00
2024-07-05 09:12:55 +02:00
2026-01-19 13:12:03 +01:00
2024-02-23 08:41:51 +01:00
2024-10-17 15:07:57 +02:00
2025-08-28 16:22:37 +02:00