mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/2] ptrace: reject out of range error values in PTRACE_SET_SYSCALL_INFO
@ 2026-11-15 15:26 Renzo Davoli
  2026-11-15 15:26 ` [PATCH v3 1/2] " Renzo Davoli
  2026-11-15 15:27 ` [PATCH v3 2/2] selftests/ptrace: check that PTRACE_SET_SYSCALL_INFO rejects invalid error values Renzo Davoli
  0 siblings, 2 replies; 4+ messages in thread
From: Renzo Davoli @ 2026-11-15 15:26 UTC (permalink / raw)
  To: linux-kernel
  Cc: Renzo Davoli, Oleg Nesterov, Andrew Morton, Dmitry V . Levin,
	Alexey Gladkov, Eugene Syromyatnikov, Charlie Jenkins,
	Bradley Morgan, Shuah Khan, strace-devel, linux-api,
	linux-kselftest

With is_error set, PTRACE_SET_SYSCALL_INFO passes info.exit.rval to
syscall_set_return_value() as an "int" error without checking it: a
positive value, or on 64-bit one outside the "int" range, turns the
error into a success or is truncated.

Patch 1 rejects with -ERANGE any error value outside [-MAX_ERRNO, -1].
Patch 2 adds a test case for this to the set_syscall_info selftest.

This series is independent of the PTRACE_SET_SYSCALL_INFO seccomp skip
and SET_IP series: they apply on top of each other in either order.

Changes in v3:
* added Reviewed-by of Dmitry V. Levin and Bradley Morgan to patch 1
* new patch 2: selftest, as suggested by Dmitry V. Levin

Changes in v2:
* shorter commit message and comment, dropped Assisted-by
  (Bradley Morgan)

v2: https://lore.kernel.org/lkml/20261115082540.385386-1-renzo@cs.unibo.it/
v1: https://lore.kernel.org/lkml/20261114184842.373304-1-renzo@cs.unibo.it/

Renzo Davoli (2):
  ptrace: reject out of range error values in PTRACE_SET_SYSCALL_INFO
  selftests/ptrace: check that PTRACE_SET_SYSCALL_INFO rejects invalid
    error values

 kernel/ptrace.c                               |  4 ++
 .../selftests/ptrace/set_syscall_info.c       | 51 +++++++++++++++++++
 2 files changed, 55 insertions(+)


base-commit: 7e1392a42ea288d70a266f6553fe06f57f8647ea
-- 
2.47.3


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

end of thread, other threads:[~2026-11-15 16:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-15 15:26 [PATCH v3 0/2] ptrace: reject out of range error values in PTRACE_SET_SYSCALL_INFO Renzo Davoli
2026-11-15 15:26 ` [PATCH v3 1/2] " Renzo Davoli
2026-11-15 15:27 ` [PATCH v3 2/2] selftests/ptrace: check that PTRACE_SET_SYSCALL_INFO rejects invalid error values Renzo Davoli
2026-11-15 16:17   ` Bradley Morgan

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

all inboxes | Powered by JetHome®