Module Name: src Committed By: riastradh Date: Mon Mar 31 14:23:11 UTC 2025
Modified Files: src/distrib/sets/lists/base: shl.mi src/distrib/sets/lists/debug: shl.mi src/lib/libpthread: pthread_cancelstub.c pthread_mi.expsym shlib_version src/tests/lib/libpthread: t_cancellation.c Log Message: libpthread(3): Add missing cancellation points. - accept4 - tcdrain XXX Should our nonstandard alias paccept(2) also be a cancellation point? PR lib/59240: POSIX.1-2024: cancellation point audit To generate a diff of this commit: cvs rdiff -u -r1.998 -r1.999 src/distrib/sets/lists/base/shl.mi cvs rdiff -u -r1.358 -r1.359 src/distrib/sets/lists/debug/shl.mi cvs rdiff -u -r1.46 -r1.47 src/lib/libpthread/pthread_cancelstub.c cvs rdiff -u -r1.1 -r1.2 src/lib/libpthread/pthread_mi.expsym cvs rdiff -u -r1.19 -r1.20 src/lib/libpthread/shlib_version cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libpthread/t_cancellation.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/base/shl.mi diff -u src/distrib/sets/lists/base/shl.mi:1.998 src/distrib/sets/lists/base/shl.mi:1.999 --- src/distrib/sets/lists/base/shl.mi:1.998 Fri Mar 14 21:27:10 2025 +++ src/distrib/sets/lists/base/shl.mi Mon Mar 31 14:23:10 2025 @@ -1,4 +1,4 @@ -# $NetBSD: shl.mi,v 1.998 2025/03/14 21:27:10 wiz Exp $ +# $NetBSD: shl.mi,v 1.999 2025/03/31 14:23:10 riastradh Exp $ # # Note: Don't delete entries from here - mark them as "obsolete" instead, # unless otherwise stated below. @@ -84,7 +84,7 @@ ./lib/libprop.so.1.2 base-sys-shlib dynamicroot ./lib/libpthread.so base-sys-shlib dynamicroot ./lib/libpthread.so.1 base-sys-shlib dynamicroot -./lib/libpthread.so.1.4 base-sys-shlib dynamicroot +./lib/libpthread.so.1.5 base-sys-shlib dynamicroot ./lib/libradius.so base-sys-shlib dynamicroot ./lib/libradius.so.5 base-sys-shlib dynamicroot ./lib/libradius.so.5.0 base-sys-shlib dynamicroot @@ -513,7 +513,7 @@ ./usr/lib/libprop.so.1.2 base-sys-shlib compatfile ./usr/lib/libpthread.so base-sys-shlib compatfile ./usr/lib/libpthread.so.1 base-sys-shlib compatfile -./usr/lib/libpthread.so.1.4 base-sys-shlib compatfile +./usr/lib/libpthread.so.1.5 base-sys-shlib compatfile ./usr/lib/libpthread_dbg.so base-obsolete obsolete ./usr/lib/libpuffs.so base-puffs-shlib compatfile ./usr/lib/libpuffs.so.2 base-puffs-shlib compatfile Index: src/distrib/sets/lists/debug/shl.mi diff -u src/distrib/sets/lists/debug/shl.mi:1.358 src/distrib/sets/lists/debug/shl.mi:1.359 --- src/distrib/sets/lists/debug/shl.mi:1.358 Fri Mar 14 21:27:10 2025 +++ src/distrib/sets/lists/debug/shl.mi Mon Mar 31 14:23:10 2025 @@ -1,4 +1,4 @@ -# $NetBSD: shl.mi,v 1.358 2025/03/14 21:27:10 wiz Exp $ +# $NetBSD: shl.mi,v 1.359 2025/03/31 14:23:10 riastradh Exp $ # ./usr/lib/libbfd_g.a comp-c-debuglib debuglib,compatfile,binutils ./usr/lib/libgcc_eh_g.a comp-c-debuglib debuglib,compatfile,gcc @@ -27,7 +27,7 @@ ./usr/libdata/debug/lib/libpcap.so.10.0.debug comp-sys-debug debug,dynamicroot ./usr/libdata/debug/lib/libppath.so.0.0.debug comp-sys-debug debug,dynamicroot ./usr/libdata/debug/lib/libprop.so.1.2.debug comp-sys-debug debug,dynamicroot -./usr/libdata/debug/lib/libpthread.so.1.4.debug comp-sys-debug debug,dynamicroot +./usr/libdata/debug/lib/libpthread.so.1.5.debug comp-sys-debug debug,dynamicroot ./usr/libdata/debug/lib/libradius.so.5.0.debug comp-sys-debug debug,dynamicroot ./usr/libdata/debug/lib/librumpclient.so.0.0.debug comp-rump-debug debug,dynamicroot,rump ./usr/libdata/debug/lib/librumpres.so.0.0.debug comp-rump-debug debug,dynamicroot,rump @@ -177,7 +177,7 @@ ./usr/libdata/debug/usr/lib/libppath.so.0.0.debug comp-sys-debug debug,compatfile ./usr/libdata/debug/usr/lib/libproc.so.1.0.debug comp-sys-debug debug,compatfile,dtrace ./usr/libdata/debug/usr/lib/libprop.so.1.2.debug comp-sys-debug debug,compatfile -./usr/libdata/debug/usr/lib/libpthread.so.1.4.debug comp-sys-debug debug,compatfile +./usr/libdata/debug/usr/lib/libpthread.so.1.5.debug comp-sys-debug debug,compatfile ./usr/libdata/debug/usr/lib/libpuffs.so.2.0.debug comp-puffs-debug debug,compatfile ./usr/libdata/debug/usr/lib/libquota.so.1.0.debug comp-sys-debug debug,compatfile ./usr/libdata/debug/usr/lib/libradius.so.5.0.debug comp-net-debug debug,compatfile Index: src/lib/libpthread/pthread_cancelstub.c diff -u src/lib/libpthread/pthread_cancelstub.c:1.46 src/lib/libpthread/pthread_cancelstub.c:1.47 --- src/lib/libpthread/pthread_cancelstub.c:1.46 Mon Mar 31 14:07:10 2025 +++ src/lib/libpthread/pthread_cancelstub.c Mon Mar 31 14:23:11 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: pthread_cancelstub.c,v 1.46 2025/03/31 14:07:10 riastradh Exp $ */ +/* $NetBSD: pthread_cancelstub.c,v 1.47 2025/03/31 14:23:11 riastradh 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.46 2025/03/31 14:07:10 riastradh Exp $"); +__RCSID("$NetBSD: pthread_cancelstub.c,v 1.47 2025/03/31 14:23:11 riastradh Exp $"); /* Need to use libc-private names for atomic operations. */ #include "../../common/lib/libc/atomic/atomic_op_namespace.h" @@ -67,6 +67,7 @@ __RCSID("$NetBSD: pthread_cancelstub.c,v #include <poll.h> #include <stdatomic.h> #include <stdarg.h> +#include <termios.h> #include <unistd.h> #include <signal.h> @@ -122,6 +123,7 @@ int _sys___nanosleep50(const struct time int __nanosleep50(const struct timespec *, struct timespec *); int _sys_open(const char *, int, ...); int _sys_openat(int, const char *, int, ...); +int _sys_paccept(int, struct sockaddr *, socklen_t *, int); int _sys_poll(struct pollfd *, nfds_t, int); int _sys___pollts50(struct pollfd *, nfds_t, const struct timespec *, const sigset_t *); @@ -174,6 +176,20 @@ accept(int s, struct sockaddr *addr, soc } int +accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags) +{ + int retval; + pthread_t self; + + self = pthread__self(); + TESTCANCEL(self); + retval = _sys_paccept(s, addr, addrlen, flags); + TESTCANCEL(self); + + return retval; +} + +int __aio_suspend50(const struct aiocb * const list[], int nent, const struct timespec *timeout) { @@ -661,6 +677,19 @@ sendmmsg(int s, struct mmsghdr *mmsg, un return retval; } +int +tcdrain(int fd) +{ + int retval; + pthread_t self; + + self = pthread__self(); + TESTCANCEL(self); + retval = ioctl(fd, TIOCDRAIN, 0); + TESTCANCEL(self); + + return retval; +} pid_t __wait450(pid_t wpid, int *status, int options, struct rusage *rusage) Index: src/lib/libpthread/pthread_mi.expsym diff -u src/lib/libpthread/pthread_mi.expsym:1.1 src/lib/libpthread/pthread_mi.expsym:1.2 --- src/lib/libpthread/pthread_mi.expsym:1.1 Fri Nov 22 15:51:34 2024 +++ src/lib/libpthread/pthread_mi.expsym Mon Mar 31 14:23:11 2025 @@ -87,6 +87,7 @@ _sigwait _write _writev accept +accept4 call_once clock_nanosleep close @@ -266,6 +267,7 @@ sendmsg sendto setcontext sigwait +tcdrain thrd_create thrd_current thrd_detach Index: src/lib/libpthread/shlib_version diff -u src/lib/libpthread/shlib_version:1.19 src/lib/libpthread/shlib_version:1.20 --- src/lib/libpthread/shlib_version:1.19 Wed Apr 24 13:01:52 2019 +++ src/lib/libpthread/shlib_version Mon Mar 31 14:23:11 2025 @@ -1,4 +1,4 @@ -# $NetBSD: shlib_version,v 1.19 2019/04/24 13:01:52 kamil Exp $ +# $NetBSD: shlib_version,v 1.20 2025/03/31 14:23:11 riastradh Exp $ # Remember to update distrib/sets/lists/base/shl.* when changing # # Things to do when bumping major version: @@ -21,4 +21,4 @@ # remove remnants of libpthread_dbg: pthread__dbg # major=1 -minor=4 +minor=5 Index: src/tests/lib/libpthread/t_cancellation.c diff -u src/tests/lib/libpthread/t_cancellation.c:1.2 src/tests/lib/libpthread/t_cancellation.c:1.3 --- src/tests/lib/libpthread/t_cancellation.c:1.2 Mon Mar 31 14:07:10 2025 +++ src/tests/lib/libpthread/t_cancellation.c Mon Mar 31 14:23:11 2025 @@ -1,4 +1,4 @@ -/* $NetBSD: t_cancellation.c,v 1.2 2025/03/31 14:07:10 riastradh Exp $ */ +/* $NetBSD: t_cancellation.c,v 1.3 2025/03/31 14:23:11 riastradh Exp $ */ /* * Copyright (c) 2025 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_cancellation.c,v 1.2 2025/03/31 14:07:10 riastradh Exp $"); +__RCSID("$NetBSD: t_cancellation.c,v 1.3 2025/03/31 14:23:11 riastradh Exp $"); #include <sys/mman.h> #include <sys/msg.h> @@ -961,9 +961,7 @@ ATF_TC_BODY(CANCELPOINT, tc) ATF_TP_ADD_TC(tp, CANCELPOINT) TEST_CANCELPOINT(cancelpoint_accept, __nothing) -TEST_CANCELPOINT(cancelpoint_accept4, - atf_tc_expect_signal(SIGALRM, - "PR lib/59240: POSIX.1-2024: cancellation point audit")) +TEST_CANCELPOINT(cancelpoint_accept4, __nothing) TEST_CANCELPOINT(cancelpoint_aio_suspend, __nothing) TEST_CANCELPOINT(cancelpoint_clock_nanosleep, __nothing) TEST_CANCELPOINT(cancelpoint_close, __nothing) @@ -1012,8 +1010,7 @@ TEST_CANCELPOINT(cancelpoint_sigtimedwai TEST_CANCELPOINT(cancelpoint_sigwait, __nothing) TEST_CANCELPOINT(cancelpoint_sigwaitinfo, __nothing) TEST_CANCELPOINT(cancelpoint_sleep, __nothing) -TEST_CANCELPOINT(cancelpoint_tcdrain, - atf_tc_expect_fail("PR lib/59240: POSIX.1-2024: cancellation point audit")) +TEST_CANCELPOINT(cancelpoint_tcdrain, __nothing) TEST_CANCELPOINT(cancelpoint_thrd_join, __nothing) TEST_CANCELPOINT(cancelpoint_thrd_sleep, __nothing) TEST_CANCELPOINT(cancelpoint_wait, __nothing)