Module Name: src
Committed By: christos
Date: Fri Oct 1 17:13:44 UTC 2021
Modified Files:
src/lib/libc/sys: Makefile.inc
src/lib/libpthread: pthread_cancelstub.c
Log Message:
PR/56424: Clay Mayers: recvfrom() is not a cancelation point as documented
in pthread_setcanceltype.3
To generate a diff of this commit:
cvs rdiff -u -r1.246 -r1.247 src/lib/libc/sys/Makefile.inc
cvs rdiff -u -r1.38 -r1.39 src/lib/libpthread/pthread_cancelstub.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/sys/Makefile.inc
diff -u src/lib/libc/sys/Makefile.inc:1.246 src/lib/libc/sys/Makefile.inc:1.247
--- src/lib/libc/sys/Makefile.inc:1.246 Sun Sep 19 11:51:28 2021
+++ src/lib/libc/sys/Makefile.inc Fri Oct 1 13:13:44 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.246 2021/09/19 15:51:28 thorpej Exp $
+# $NetBSD: Makefile.inc,v 1.247 2021/10/01 17:13:44 christos Exp $
# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
# sys sources
@@ -97,7 +97,7 @@ ASM=\
__acl_aclcheck_file.S __acl_aclcheck_fd.S \
access.S acct.S \
bind.S \
- chdir.S chflags.S chmod.S chown.S chroot.S clock_nanosleep.S \
+ chdir.S chflags.S chmod.S chown.S chroot.S \
clock_getcpuclockid2.S \
__clock_getres50.S __clock_gettime50.S \
dup.S dup2.S dup3.S \
@@ -137,15 +137,14 @@ ASM=\
mprotect.S __msgctl50.S msgget.S munlock.S munlockall.S \
munmap.S \
nfssvc.S __ntp_gettime50.S \
- openat.S \
pathconf.S pipe2.S \
__posix_chown.S __posix_fchown.S __posix_lchown.S \
__posix_rename.S profil.S \
__quotactl.S \
- rasctl.S readlinkat.S reboot.S recvfrom.S recvmmsg.S recvmsg.S \
+ rasctl.S readlinkat.S reboot.S \
rename.S renameat.S revoke.S rmdir.S \
semconfig.S semget.S semop.S \
- sendmmsg.S sendmsg.S sendto.S setegid.S seteuid.S \
+ setegid.S seteuid.S \
setgid.S setgroups.S __setitimer50.S __setlogin.S setpgid.S \
setpriority.S \
setregid.S setreuid.S setrlimit.S setsid.S setsockopt.S \
@@ -175,15 +174,19 @@ ASM_MD= _lwp_getprivate.S mremap.S
. endif
.endfor
-WEAKASM= accept.S __aio_suspend50.S close.S connect.S execve.S \
+WEAKASM= accept.S __aio_suspend50.S clock_nanosleep.S close.S connect.S \
+ execve.S \
fcntl.S fdatasync.S fsync.S \
fsync_range.S __kevent50.S \
kill.S mq_receive.S mq_send.S __mq_timedreceive50.S __mq_timedsend50.S \
- msgrcv.S msgsnd.S __msync13.S __nanosleep50.S open.S paccept.S poll.S \
+ msgrcv.S msgsnd.S __msync13.S __nanosleep50.S open.S openat.S \
+ paccept.S poll.S \
__pollts50.S __pselect50.S read.S readlink.S \
- readv.S _sched_setparam.S _sched_getparam.S _sched_setaffinity.S \
+ readv.S recvfrom.S recvmmsg.S recvmsg.S \
+ _sched_setparam.S _sched_getparam.S _sched_setaffinity.S \
_sched_getaffinity.S sched_yield.S _sched_protect.S \
- __select50.S setcontext.S __sigprocmask14.S __sigsuspend14.S sysarch.S \
+ __select50.S sendmmsg.S sendmsg.S sendto.S \
+ setcontext.S __sigprocmask14.S __sigsuspend14.S sysarch.S \
__wait450.S wait6.S write.S writev.S
NOERR= getegid.S geteuid.S getgid.S getpid.S getppid.S getuid.S \
Index: src/lib/libpthread/pthread_cancelstub.c
diff -u src/lib/libpthread/pthread_cancelstub.c:1.38 src/lib/libpthread/pthread_cancelstub.c:1.39
--- src/lib/libpthread/pthread_cancelstub.c:1.38 Thu Mar 21 12:49:12 2013
+++ src/lib/libpthread/pthread_cancelstub.c Fri Oct 1 13:13:44 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_cancelstub.c,v 1.38 2013/03/21 16:49:12 christos Exp $ */
+/* $NetBSD: pthread_cancelstub.c,v 1.39 2021/10/01 17:13:44 christos Exp $ */
/*-
* Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
#undef _FORTIFY_SOURCE
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_cancelstub.c,v 1.38 2013/03/21 16:49:12 christos Exp $");
+__RCSID("$NetBSD: pthread_cancelstub.c,v 1.39 2021/10/01 17:13:44 christos Exp $");
#ifndef lint
@@ -90,6 +90,8 @@ int _sys___aio_suspend50(const struct ai
const struct timespec *);
int __aio_suspend50(const struct aiocb * const [], int,
const struct timespec *);
+int _sys_clock_nanosleep(clockid_t clock_id, int flags,
+ const struct timespec *rqtp, struct timespec *rmtp);
int _sys_close(int);
int _sys_connect(int, const struct sockaddr *, socklen_t);
int _sys_fcntl(int, int, ...);
@@ -110,6 +112,7 @@ int _sys___msync13(void *, size_t, int);
int _sys___nanosleep50(const struct timespec *, struct timespec *);
int __nanosleep50(const struct timespec *, struct timespec *);
int _sys_open(const char *, int, ...);
+int _sys_openat(int, const char *, int, ...);
int _sys_poll(struct pollfd *, nfds_t, int);
int _sys___pollts50(struct pollfd *, nfds_t, const struct timespec *,
const sigset_t *);
@@ -119,6 +122,16 @@ int _sys___pselect50(int, fd_set *, fd_s
ssize_t _sys_pwrite(int, const void *, size_t, off_t);
ssize_t _sys_read(int, void *, size_t);
ssize_t _sys_readv(int, const struct iovec *, int);
+ssize_t _sys_recvfrom(int, void * restrict, size_t, int,
+ struct sockaddr * restrict, socklen_t * restrict);
+ssize_t _sys_recvmsg(int, struct msghdr *, int);
+int _sys_recvmmsg(int, struct mmsghdr *, unsigned int, unsigned int,
+ struct timespec *);
+ssize_t _sys_sendto(int s, const void *msg, size_t len, int flags,
+ const struct sockaddr *to, socklen_t tolen);
+ssize_t _sys_sendmsg(int s, const struct msghdr *msg, int flags);
+int _sys_sendmmsg(int s, struct mmsghdr *mmsg, unsigned int vlen,
+ unsigned int flags);
int _sys___select50(int, fd_set *, fd_set *, fd_set *, struct timeval *);
int _sys___wait450(pid_t, int *, int, struct rusage *);
ssize_t _sys_write(int, const void *, size_t);
@@ -180,6 +193,21 @@ __kevent50(int fd, const struct kevent *
}
int
+clock_nanosleep(clockid_t clock_id, int flags,
+ const struct timespec *rqtp, struct timespec *rmtp)
+{
+ int retval;
+ pthread_t self;
+
+ self = pthread__self();
+ TESTCANCEL(self);
+ retval = _sys_clock_nanosleep(clock_id, flags, rqtp, rmtp);
+ TESTCANCEL(self);
+
+ return retval;
+}
+
+int
close(int d)
{
int retval;
@@ -384,6 +412,23 @@ open(const char *path, int flags, ...)
}
int
+openat(int fd, const char *path, int flags, ...)
+{
+ int retval;
+ pthread_t self;
+ va_list ap;
+
+ self = pthread__self();
+ TESTCANCEL(self);
+ va_start(ap, flags);
+ retval = _sys_openat(fd, path, flags, va_arg(ap, mode_t));
+ va_end(ap);
+ TESTCANCEL(self);
+
+ return retval;
+}
+
+int
__nanosleep50(const struct timespec *rqtp, struct timespec *rmtp)
{
int retval;
@@ -502,6 +547,50 @@ readv(int d, const struct iovec *iov, in
return retval;
}
+ssize_t
+recvfrom(int s, void * restrict buf, size_t len, int flags,
+ struct sockaddr * restrict from, socklen_t * restrict fromlen)
+{
+ ssize_t retval;
+ pthread_t self;
+
+ self = pthread__self();
+ TESTCANCEL(self);
+ retval = _sys_recvfrom(s, buf, len, flags, from, fromlen);
+ TESTCANCEL(self);
+
+ return retval;
+}
+
+ssize_t
+recvmsg(int s, struct msghdr *msg, int flags)
+{
+ ssize_t retval;
+ pthread_t self;
+
+ self = pthread__self();
+ TESTCANCEL(self);
+ retval = _sys_recvmsg(s, msg, flags);
+ TESTCANCEL(self);
+
+ return retval;
+}
+
+int
+recvmmsg(int s, struct mmsghdr *mmsg, unsigned int vlen,
+ unsigned int flags, struct timespec *timeout)
+{
+ ssize_t retval;
+ pthread_t self;
+
+ self = pthread__self();
+ TESTCANCEL(self);
+ retval = _sys_recvmmsg(s, mmsg, vlen, flags, timeout);
+ TESTCANCEL(self);
+
+ return retval;
+}
+
int
__select50(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
struct timeval *timeout)
@@ -517,6 +606,51 @@ __select50(int nfds, fd_set *readfds, fd
return retval;
}
+ssize_t
+sendto(int s, const void *msg, size_t len, int flags,
+ const struct sockaddr *to, socklen_t tolen)
+{
+ int retval;
+ pthread_t self;
+
+ self = pthread__self();
+ TESTCANCEL(self);
+ retval = _sys_sendto(s, msg, len, flags, to, tolen);
+ TESTCANCEL(self);
+
+ return retval;
+}
+
+ssize_t
+sendmsg(int s, const struct msghdr *msg, int flags)
+{
+ int retval;
+ pthread_t self;
+
+ self = pthread__self();
+ TESTCANCEL(self);
+ retval = _sys_sendmsg(s, msg, flags);
+ TESTCANCEL(self);
+
+ return retval;
+}
+
+int
+sendmmsg(int s, struct mmsghdr *mmsg, unsigned int vlen,
+ unsigned int flags)
+{
+ int retval;
+ pthread_t self;
+
+ self = pthread__self();
+ TESTCANCEL(self);
+ retval = _sys_sendmmsg(s, mmsg, vlen, flags);
+ TESTCANCEL(self);
+
+ return retval;
+}
+
+
pid_t
__wait450(pid_t wpid, int *status, int options, struct rusage *rusage)
{
@@ -618,6 +752,7 @@ sigwait(const sigset_t * __restrict set,
}
__strong_alias(_close, close)
+__strong_alias(_clock_nanosleep, clock_nanosleep)
__strong_alias(_fcntl, fcntl)
__strong_alias(_fdatasync, fdatasync)
__strong_alias(_fsync, fsync)
@@ -629,11 +764,18 @@ __strong_alias(_msgsnd, msgsnd)
__strong_alias(___msync13, __msync13)
__strong_alias(___nanosleep50, __nanosleep50)
__strong_alias(_open, open)
+__strong_alias(_openat, openat)
__strong_alias(_poll, poll)
__strong_alias(_pread, pread)
__strong_alias(_pwrite, pwrite)
__strong_alias(_read, read)
__strong_alias(_readv, readv)
+__strong_alias(_recvfrom, recvfrom)
+__strong_alias(_recvmsg, recvmsg)
+__strong_alias(_recvmmsg, recvmmsg)
+__strong_alias(_sendmsg, sendmsg)
+__strong_alias(_sendmmsg, sendmmsg)
+__strong_alias(_sendto, sendto)
__strong_alias(_sigwait, sigwait)
__strong_alias(_write, write)
__strong_alias(_writev, writev)