From: mvs Date: Tue, 14 Feb 2023 08:34:49 +0000 (+0000) Subject: Backout previous. Assertion was triggered within tsleep(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=97b0c01557f5df5905132361238645084482ec94;p=openbsd Backout previous. Assertion was triggered within tsleep(). --- diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 57f34dd9895..c17c3289a8f 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_generic.c,v 1.153 2023/02/13 09:42:45 mvs Exp $ */ +/* $OpenBSD: sys_generic.c,v 1.154 2023/02/14 08:34:49 mvs Exp $ */ /* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */ /* @@ -596,16 +596,15 @@ dopselect(struct proc *p, int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timespec zerots = {}; fd_mask bits[6]; fd_set *pibits[3], *pobits[3]; - int error, nfiles, ncollected = 0, nevents = 0; + int error, ncollected = 0, nevents = 0; u_int ni; if (nd < 0) return (EINVAL); - - nfiles = READ_ONCE(p->p_fd->fd_nfiles); - if (nd > nfiles) - nd = nfiles; - + if (nd > p->p_fd->fd_nfiles) { + /* forgiving; slightly wrong */ + nd = p->p_fd->fd_nfiles; + } ni = howmany(nd, NFDBITS) * sizeof(fd_mask); if (ni > sizeof(bits[0])) { caddr_t mbits; @@ -644,11 +643,8 @@ dopselect(struct proc *p, int nd, fd_set *in, fd_set *ou, fd_set *ex, } #endif - if (sigmask) { - KERNEL_LOCK(); + if (sigmask) dosigsuspend(p, *sigmask &~ sigcantmask); - KERNEL_UNLOCK(); - } /* Register kqueue events */ error = pselregister(p, pibits, pobits, nd, &nevents, &ncollected); @@ -952,11 +948,8 @@ doppoll(struct proc *p, struct pollfd *fds, u_int nfds, if ((error = copyin(fds, pl, sz)) != 0) goto bad; - if (sigmask) { - KERNEL_LOCK(); + if (sigmask) dosigsuspend(p, *sigmask &~ sigcantmask); - KERNEL_UNLOCK(); - } /* Register kqueue events */ ppollregister(p, pl, nfds, &nevents, &ncollected); diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 9a5793a23d0..d799adcc9b2 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1,4 +1,4 @@ -; $OpenBSD: syscalls.master,v 1.242 2023/02/13 09:42:45 mvs Exp $ +; $OpenBSD: syscalls.master,v 1.243 2023/02/14 08:34:49 mvs Exp $ ; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -165,7 +165,7 @@ struct itimerval *oitv); } 70 STD NOLOCK { int sys_getitimer(int which, \ struct itimerval *itv); } -71 STD NOLOCK { int sys_select(int nd, fd_set *in, fd_set *ou, \ +71 STD { int sys_select(int nd, fd_set *in, fd_set *ou, \ fd_set *ex, struct timeval *tv); } 72 STD NOLOCK { int sys_kevent(int fd, \ const struct kevent *changelist, int nchanges, \ @@ -230,10 +230,10 @@ u_int flags, int atflags); } 108 STD NOLOCK { int sys_pledge(const char *promises, \ const char *execpromises); } -109 STD NOLOCK { int sys_ppoll(struct pollfd *fds, \ +109 STD { int sys_ppoll(struct pollfd *fds, \ u_int nfds, const struct timespec *ts, \ const sigset_t *mask); } -110 STD NOLOCK { int sys_pselect(int nd, fd_set *in, fd_set *ou, \ +110 STD { int sys_pselect(int nd, fd_set *in, fd_set *ou, \ fd_set *ex, const struct timespec *ts, \ const sigset_t *mask); } 111 STD { int sys_sigsuspend(int mask); } @@ -443,7 +443,7 @@ 250 STD NOLOCK { int sys_minherit(void *addr, size_t len, \ int inherit); } 251 OBSOL rfork -252 STD NOLOCK { int sys_poll(struct pollfd *fds, \ +252 STD { int sys_poll(struct pollfd *fds, \ u_int nfds, int timeout); } 253 STD NOLOCK { int sys_issetugid(void); } 254 STD { int sys_lchown(const char *path, uid_t uid, gid_t gid); }