Re: [PATCH] ptrace.2: BUGS: may set errno to zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Jann Horn:

> ptrace() with requests PTRACE_PEEKTEXT, PTRACE_PEEKDATA and
> PTRACE_PEEKUSER can set errno to zero. AFAICS this is for a good reason (so
> that you can tell the difference between a successful PEEK with a result of
> -1 and a failed PEEK, even if you forget to clear errno yourself), but it
> technically violates the rules described in the errno.3 manpage.
>
> glibc snippet from sysdeps/unix/sysv/linux/ptrace.c:
>
>   res = INLINE_SYSCALL (ptrace, 4, request, pid, addr, data);
>   if (res >= 0 && request > 0 && request < 4)
>     {
>       __set_errno (0);
>       return ret;
>     }

glibc has various special cases like this for interfaces where the
return value is ambiguous, such as NULL from NSS functions:

  <https://sourceware.org/bugzilla/show_bug.cgi?id=3195#c1>

I'm a bit reluctant to fix this due to the backwards compatibility
impact.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux