HomeFreeBSD

Do not obliterate errno value in the main thread during ptrace(2) call on x86.

Description

Do not obliterate errno value in the main thread during ptrace(2) call on x86.

Since ptrace(2) syscall can return -1 for non-error situations, libc
wrappers set errno to 0 before performing the syscall, as the service
to the caller. On both i386 and amd64, the errno symbol was directly
referenced, which only works correctly in single-threaded process.

Change assembler wrappers for ptrace(2) to get current thread errno
location by calling error(). Allow error interposing, as
currently allowed in cerror().

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

Details

Provenance
kibAuthored on
Parents
rS304927: vfs: provide a common exit point in namei for error cases
Branches
Unknown
Tags
Unknown