Page MenuHomeFreeBSD

ptrace: document ENOMEM
ClosedPublic

Authored by trasz on Apr 24 2021, 10:58 AM.

Details

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Note that I'm open to change the return value to EFAULT and documenting that instead; I'm a bit worried about possible breakage in eg debuggers, but, given Mark's explanation of how EFAULT and ENOMEM was squoshed together, it might be safe. So, if you think that's the right way, please tell.

Note that I'm open to change the return value to EFAULT and documenting that instead; I'm a bit worried about possible breakage in eg debuggers, but, given Mark's explanation of how EFAULT and ENOMEM was squoshed together, it might be safe. So, if you think that's the right way, please tell.

I don't have a strong feeling about it. I agree that it probably doesn't break anything. OTOH we have lots of errnos that don't really make sense, I'm not sure there's much value in fixing this one example. Documenting it is good enough IMO.

lib/libc/sys/ptrace.2
1221

We can always change both if we decide to use EFAULT instead, so I'm happy to see this go ahead

This revision is now accepted and ready to land.May 4 2021, 1:04 PM
This revision was automatically updated to reflect the committed changes.

I like it better if EFAULT is reserved as much as possible to the case where a syscall argument points to an invalid memory location for the calling process, which is undefined behaviour according to POSIX and other standards and often behaves poorly (for example, completing an operation but discarding the result). If the address in the target process passed to PT_READ_I is invalid, this is fully defined and may not be fully avoidable (for example if the traced process is running concurrently).