This commit is contained in:
purplerain 2023-05-13 14:25:18 +00:00
parent f609457dcf
commit 62073e0295
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
318 changed files with 8112 additions and 4346 deletions

View file

@ -1,10 +1,10 @@
/* $OpenBSD: init_sysent.c,v 1.264 2023/02/27 00:58:38 deraadt Exp $ */
/* $OpenBSD: init_sysent.c,v 1.265 2023/05/04 09:41:15 mvs Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.246 2023/02/25 09:55:46 mvs Exp
* created from; OpenBSD: syscalls.master,v 1.247 2023/05/04 09:40:36 mvs Exp
*/
#include <sys/param.h>
@ -441,7 +441,7 @@ const struct sysent sysent[] = {
sys_nosys }, /* 200 = obsolete pad_truncate */
{ 0, 0, 0,
sys_nosys }, /* 201 = obsolete pad_ftruncate */
{ 6, s(struct sys_sysctl_args), 0,
{ 6, s(struct sys_sysctl_args), SY_NOLOCK | 0,
sys_sysctl }, /* 202 = sysctl */
{ 2, s(struct sys_mlock_args), 0,
sys_mlock }, /* 203 = mlock */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_ktrace.c,v 1.111 2023/02/16 08:50:57 claudio Exp $ */
/* $OpenBSD: kern_ktrace.c,v 1.112 2023/05/11 09:51:33 bluhm Exp $ */
/* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */
/*
@ -160,7 +160,7 @@ ktrsyscall(struct proc *p, register_t code, size_t argsize, register_t args[])
u_int nargs = 0;
int i;
if (code == SYS_sysctl) {
if ((code & KTRC_CODE_MASK) == SYS_sysctl) {
/*
* The sysctl encoding stores the mib[]
* array because it is interesting.

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_sysctl.c,v 1.411 2023/01/22 12:05:44 mvs Exp $ */
/* $OpenBSD: kern_sysctl.c,v 1.412 2023/05/04 09:40:36 mvs Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@ -168,7 +168,7 @@ sys_sysctl(struct proc *p, void *v, register_t *retval)
syscallarg(void *) new;
syscallarg(size_t) newlen;
} */ *uap = v;
int error, dolock = 1;
int error, dokernellock = 1, dolock = 1;
size_t savelen = 0, oldlen = 0;
sysctlfn *fn;
int name[CTL_MAXNAME];
@ -203,6 +203,7 @@ sys_sysctl(struct proc *p, void *v, register_t *retval)
break;
case CTL_NET:
fn = net_sysctl;
dokernellock = 0;
break;
case CTL_FS:
fn = fs_sysctl;
@ -230,19 +231,22 @@ sys_sysctl(struct proc *p, void *v, register_t *retval)
if (SCARG(uap, oldlenp) &&
(error = copyin(SCARG(uap, oldlenp), &oldlen, sizeof(oldlen))))
return (error);
if (dokernellock)
KERNEL_LOCK();
if (SCARG(uap, old) != NULL) {
if ((error = rw_enter(&sysctl_lock, RW_WRITE|RW_INTR)) != 0)
return (error);
goto unlock;
if (dolock) {
if (atop(oldlen) > uvmexp.wiredmax - uvmexp.wired) {
rw_exit_write(&sysctl_lock);
return (ENOMEM);
error = ENOMEM;
goto unlock;
}
error = uvm_vslock(p, SCARG(uap, old), oldlen,
PROT_READ | PROT_WRITE);
if (error) {
rw_exit_write(&sysctl_lock);
return (error);
goto unlock;
}
}
savelen = oldlen;
@ -254,6 +258,9 @@ sys_sysctl(struct proc *p, void *v, register_t *retval)
uvm_vsunlock(p, SCARG(uap, old), savelen);
rw_exit_write(&sysctl_lock);
}
unlock:
if (dokernellock)
KERNEL_UNLOCK();
if (error)
return (error);
if (SCARG(uap, oldlenp))

View file

@ -1,4 +1,4 @@
/* $OpenBSD: sys_generic.c,v 1.155 2023/02/25 09:55:46 mvs Exp $ */
/* $OpenBSD: sys_generic.c,v 1.156 2023/05/09 14:22:17 visa Exp $ */
/* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */
/*
@ -769,12 +769,6 @@ pselregister(struct proc *p, fd_set *pibits[3], fd_set *pobits[3], int nfd,
* __EV_SELECT */
error = 0;
break;
case EPIPE: /* Specific to pipes */
KASSERT(kev.filter == EVFILT_WRITE);
FD_SET(kev.ident, pobits[1]);
(*ncollected)++;
error = 0;
break;
case ENXIO: /* Device has been detached */
default:
goto bad;
@ -1073,10 +1067,6 @@ again:
goto again;
}
break;
case EPIPE: /* Specific to pipes */
KASSERT(kevp->filter == EVFILT_WRITE);
pl->revents |= POLLHUP;
break;
default:
DPRINTFN(0, "poll err %lu fd %d revents %02x serial"
" %lu filt %d ERROR=%d\n",

View file

@ -1,4 +1,4 @@
/* $OpenBSD: sys_pipe.c,v 1.145 2023/02/12 10:41:00 mvs Exp $ */
/* $OpenBSD: sys_pipe.c,v 1.146 2023/05/09 14:22:17 visa Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
@ -857,9 +857,13 @@ pipe_kqfilter(struct file *fp, struct knote *kn)
break;
case EVFILT_WRITE:
if (wpipe == NULL) {
/* other end of pipe has been closed */
error = EPIPE;
break;
/*
* The other end of the pipe has been closed.
* Since the filter now always indicates a pending
* event, attach the knote to the current side
* to proceed with the registration.
*/
wpipe = rpipe;
}
kn->kn_fop = &pipe_wfiltops;
kn->kn_hook = wpipe;

View file

@ -1,10 +1,10 @@
/* $OpenBSD: syscalls.c,v 1.262 2023/02/27 00:58:38 deraadt Exp $ */
/* $OpenBSD: syscalls.c,v 1.263 2023/05/04 09:41:15 mvs Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
* created from; OpenBSD: syscalls.master,v 1.246 2023/02/25 09:55:46 mvs Exp
* created from; OpenBSD: syscalls.master,v 1.247 2023/05/04 09:40:36 mvs Exp
*/
const char *const syscallnames[] = {

View file

@ -1,4 +1,4 @@
; $OpenBSD: syscalls.master,v 1.246 2023/02/25 09:55:46 mvs Exp $
; $OpenBSD: syscalls.master,v 1.247 2023/05/04 09:40:36 mvs Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@ -361,7 +361,7 @@
199 OBSOL pad_lseek
200 OBSOL pad_truncate
201 OBSOL pad_ftruncate
202 STD { int sys_sysctl(const int *name, u_int namelen, \
202 STD NOLOCK { int sys_sysctl(const int *name, u_int namelen, \
void *old, size_t *oldlenp, void *new, \
size_t newlen); }
203 STD { int sys_mlock(const void *addr, size_t len); }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uipc_domain.c,v 1.60 2022/08/14 01:58:28 jsg Exp $ */
/* $OpenBSD: uipc_domain.c,v 1.61 2023/05/04 09:40:36 mvs Exp $ */
/* $NetBSD: uipc_domain.c,v 1.14 1996/02/09 19:00:44 christos Exp $ */
/*
@ -213,9 +213,13 @@ net_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
newp, newlen));
#endif
#if NPFLOW > 0
if (family == PF_PFLOW)
return (pflow_sysctl(name + 1, namelen - 1, oldp, oldlenp,
newp, newlen));
if (family == PF_PFLOW) {
KERNEL_LOCK();
error = pflow_sysctl(name + 1, namelen - 1, oldp, oldlenp,
newp, newlen);
KERNEL_UNLOCK();
return (error);
}
#endif
#ifdef PIPEX
if (family == PF_PIPEX)
@ -223,9 +227,13 @@ net_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
newp, newlen));
#endif
#ifdef MPLS
if (family == PF_MPLS)
return (mpls_sysctl(name + 1, namelen - 1, oldp, oldlenp,
newp, newlen));
if (family == PF_MPLS) {
KERNEL_LOCK();
error = mpls_sysctl(name + 1, namelen - 1, oldp, oldlenp,
newp, newlen);
KERNEL_UNLOCK();
return (error);
}
#endif
dp = pffinddomain(family);
if (dp == NULL)
@ -236,8 +244,10 @@ net_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
protocol = name[1];
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
if (pr->pr_protocol == protocol && pr->pr_sysctl) {
KERNEL_LOCK();
error = (*pr->pr_sysctl)(name + 2, namelen - 2,
oldp, oldlenp, newp, newlen);
KERNEL_UNLOCK();
return (error);
}
return (ENOPROTOOPT);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uipc_mbuf.c,v 1.284 2022/08/14 01:58:28 jsg Exp $ */
/* $OpenBSD: uipc_mbuf.c,v 1.285 2023/05/05 01:19:51 bluhm Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@ -1776,6 +1776,14 @@ mq_hdatalen(struct mbuf_queue *mq)
return (hdatalen);
}
void
mq_set_maxlen(struct mbuf_queue *mq, u_int maxlen)
{
mtx_enter(&mq->mq_mtx);
mq->mq_maxlen = maxlen;
mtx_leave(&mq->mq_mtx);
}
int
sysctl_mq(int *name, u_int namelen, void *oldp, size_t *oldlenp,
void *newp, size_t newlen, struct mbuf_queue *mq)
@ -1793,11 +1801,8 @@ sysctl_mq(int *name, u_int namelen, void *oldp, size_t *oldlenp,
case IFQCTL_MAXLEN:
maxlen = mq->mq_maxlen;
error = sysctl_int(oldp, oldlenp, newp, newlen, &maxlen);
if (!error && maxlen != mq->mq_maxlen) {
mtx_enter(&mq->mq_mtx);
mq->mq_maxlen = maxlen;
mtx_leave(&mq->mq_mtx);
}
if (!error && maxlen != mq->mq_maxlen)
mq_set_maxlen(mq, maxlen);
return (error);
case IFQCTL_DROPS:
return (sysctl_rdint(oldp, oldlenp, newp, mq_drops(mq)));