nanosleep(2): Plug a memory disclourse and be POSIX-compliant
The nanosleep1() called by sys_nanosleep() would only update rmt on
EINTR, but it can also return other errors, such as EINVAL. And in that
case, sys_nanosleep() would update the user-space rmtp by copying
garbage from its stack frame. This is not only a kernel memory
disclourse, but also not POSIX-compliant.
Fix sys_nanosleep() to update rmtp only on EINTR. In addition, zero the
kernel rmt variable for double safety.
Obtained-from: FreeBSD (r315510)
Reviewd-by: dillon