Re: Checking for support of ptrace(PTRACE_SEIZE,...) on older kernels
From: Oleg Nesterov
Date: Tue Apr 18 2023 - 03:56:03 EST
Hi Alejandro,
On 04/17, Alejandro Colomar wrote:
>
> On 4/17/23 13:50, Oleg Nesterov wrote:
> > Well, from https://man7.org/linux/man-pages/man2/ptrace.2.html
> >
> > ESRCH The specified process does not exist, or is not currently
> > being traced by the caller, or is not stopped (for
> > requests that require a stopped tracee).
> >
> > so if the kernel doesn't support PTRACE_SEIZE then ptrace(PTRACE_SEIZE)
> > should fail with -ESRCH as documented.
> >
> > Perhaps this part
> >
> > EIO request is invalid, or ...
> >
> > can be improvef a bit to explain that this happens if the target is already
> > traced by us and stopped.
>
> I'm not sure if it's necessary. When several errors happen at the same time,
> there's usually no documentation about which takes precedence, with few
> exceptions.
Yes, agreed.
I just tried to understand where did this ESRCH/EIO confusion come from.
Oleg.