From: Hannes Frederic Sowa > Sent: 25 November 2016 17:09 ... > Currently sk_err is set so the next syscall would get an -EFAULT, which > seems very bad and can also be overwritten by incoming icmp packets, so > we never get a notification that we actually had a bad pointer somewhere > in the mmsghdr. Also delivering -EFAULT on the follow-up syscalls really > will make people confused that use strace.
Saving an error code like that seems completely wrong to me. It is not unreasonable for there to be multiple system calls active on a single socket at the same time - so any error has to be returned to the system call that generated it. (Current locking rules might impose restrictions, but they could change.) A completely sticky error code might be useful if the only valid action is close(). If copytouser() fails I'd guess that most system calls just return EFAULT and discard any data that might have been copied to the start of the users buffer. Not unreasonable since it is likely to be a coding error. David