sync with OpenBSD -current

This commit is contained in:
purplerain 2024-01-12 01:27:06 +00:00
parent caf62be22c
commit b3ecf9fa9a
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
56 changed files with 383 additions and 289 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: trap.c,v 1.102 2023/12/12 15:30:55 deraadt Exp $ */
/* $OpenBSD: trap.c,v 1.103 2024/01/11 19:16:26 miod Exp $ */
/* $NetBSD: trap.c,v 1.2 2003/05/04 23:51:56 fvdl Exp $ */
/*-
@ -550,12 +550,10 @@ ast(struct trapframe *frame)
void
syscall(struct trapframe *frame)
{
caddr_t params;
const struct sysent *callp;
struct proc *p;
int error = ENOSYS;
size_t argsize, argoff;
register_t code, args[9], rval[2], *argp;
register_t code, args[6], rval[2], *argp;
verify_smap(__func__);
uvmexp.syscalls++;
@ -568,36 +566,23 @@ syscall(struct trapframe *frame)
code = frame->tf_rax;
argp = &args[0];
argoff = 0;
if (code <= 0 || code >= SYS_MAXSYSCALL)
goto bad;
callp = sysent + code;
argsize = (callp->sy_argsize >> 3) + argoff;
if (argsize) {
switch (MIN(argsize, 6)) {
case 6:
args[5] = frame->tf_r9;
case 5:
args[4] = frame->tf_r8;
case 4:
args[3] = frame->tf_r10;
case 3:
args[2] = frame->tf_rdx;
case 2:
args[1] = frame->tf_rsi;
case 1:
args[0] = frame->tf_rdi;
break;
default:
panic("impossible syscall argsize");
}
if (argsize > 6) {
argsize -= 6;
params = (caddr_t)frame->tf_rsp + sizeof(register_t);
if ((error = copyin(params, &args[6], argsize << 3)))
goto bad;
}
switch (callp->sy_narg) {
case 6:
args[5] = frame->tf_r9;
case 5:
args[4] = frame->tf_r8;
case 4:
args[3] = frame->tf_r10;
case 3:
args[2] = frame->tf_rdx;
case 2:
args[1] = frame->tf_rsi;
case 1:
args[0] = frame->tf_rdi;
}
rval[0] = 0;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: vmm_machdep.c,v 1.14 2024/01/10 04:13:59 dv Exp $ */
/* $OpenBSD: vmm_machdep.c,v 1.15 2024/01/11 17:13:48 jan Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@ -158,7 +158,6 @@ static int vmx_remote_vmclear(struct cpu_info*, struct vcpu *);
#endif
#ifdef VMM_DEBUG
void dump_vcpu(struct vcpu *);
void vmx_vcpu_dump_regs(struct vcpu *);
void vmx_dump_vmcs(struct vcpu *);
const char *msr_name_decode(uint32_t);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: syscall.c,v 1.17 2023/12/13 15:57:22 miod Exp $ */
/* $OpenBSD: syscall.c,v 1.18 2024/01/11 19:16:26 miod Exp $ */
/*
* Copyright (c) 2015 Dale Rahn <drahn@dalerahn.com>
*
@ -26,16 +26,14 @@
#include <uvm/uvm_extern.h>
#define MAXARGS 8
void
svc_handler(trapframe_t *frame)
{
struct proc *p = curproc;
const struct sysent *callp;
int code, error = ENOSYS;
u_int nap = 8, nargs;
register_t *ap, *args, copyargs[MAXARGS], rval[2];
u_int nargs;
register_t *args, rval[2];
uvmexp.syscalls++;
@ -47,24 +45,12 @@ svc_handler(trapframe_t *frame)
frame->tf_elr += 8;
code = frame->tf_x[8];
ap = &frame->tf_x[0];
if (code <= 0 || code >= SYS_MAXSYSCALL)
goto bad;
callp = sysent + code;
nargs = callp->sy_argsize / sizeof(register_t);
if (nargs <= nap) {
args = ap;
} else {
KASSERT(nargs <= MAXARGS);
memcpy(copyargs, ap, nap * sizeof(register_t));
if ((error = copyin((void *)frame->tf_sp, copyargs + nap,
(nargs - nap) * sizeof(register_t))))
goto bad;
args = copyargs;
}
nargs = callp->sy_narg;
args = &frame->tf_x[0];
rval[0] = 0;
rval[1] = 0;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_qwx_pci.c,v 1.1 2023/12/28 17:36:29 stsp Exp $ */
/* $OpenBSD: if_qwx_pci.c,v 1.2 2024/01/11 09:52:19 stsp Exp $ */
/*
* Copyright 2023 Stefan Sperling <stsp@openbsd.org>
@ -455,6 +455,7 @@ int qwx_mhi_await_device_ready(struct qwx_softc *);
void qwx_mhi_ready_state_transition(struct qwx_pci_softc *);
void qwx_mhi_ee_amss_state_transition(struct qwx_pci_softc *);
void qwx_mhi_mission_mode_state_transition(struct qwx_pci_softc *);
void qwx_mhi_low_power_mode_state_transition(struct qwx_pci_softc *);
void qwx_mhi_set_state(struct qwx_softc *, uint32_t);
void qwx_mhi_init_mmio(struct qwx_pci_softc *);
int qwx_mhi_fw_load_bhi(struct qwx_pci_softc *, uint8_t *, size_t);
@ -2920,6 +2921,14 @@ qwx_mhi_mission_mode_state_transition(struct qwx_pci_softc *psc)
qwx_mhi_device_zzz(sc);
}
void
qwx_mhi_low_power_mode_state_transition(struct qwx_pci_softc *psc)
{
struct qwx_softc *sc = &psc->sc_sc;
qwx_mhi_set_state(sc, MHI_STATE_M2);
}
void
qwx_mhi_set_state(struct qwx_softc *sc, uint32_t state)
{
@ -3397,6 +3406,12 @@ qwx_mhi_state_change(void *arg)
psc->mhi_state = mhi_state;
qwx_mhi_mission_mode_state_transition(psc);
break;
case MHI_STATE_M1:
DNPRINTF(QWX_D_MHI, "%s: new MHI state M1\n",
sc->sc_dev.dv_xname);
psc->mhi_state = mhi_state;
qwx_mhi_low_power_mode_state_transition(psc);
break;
case MHI_STATE_SYS_ERR:
DNPRINTF(QWX_D_MHI,
"%s: new MHI state SYS ERR\n",

View file

@ -1,4 +1,4 @@
/* $OpenBSD: vmm.h,v 1.3 2023/05/13 23:15:28 dv Exp $ */
/* $OpenBSD: vmm.h,v 1.4 2024/01/11 17:13:48 jan Exp $ */
/*
* Copyright (c) 2014-2023 Mike Larkin <mlarkin@openbsd.org>
*
@ -203,5 +203,9 @@ int vm_resetcpu(struct vm_resetcpu_params *);
int vcpu_must_stop(struct vcpu *);
int vm_share_mem(struct vm_sharemem_params *, struct proc *);
#ifdef VMM_DEBUG
void dump_vcpu(struct vcpu *);
#endif
#endif /* _KERNEL */
#endif /* DEV_VMM_H */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uipc_domain.c,v 1.64 2023/05/18 10:23:19 mvs Exp $ */
/* $OpenBSD: uipc_domain.c,v 1.65 2024/01/11 14:15:11 bluhm Exp $ */
/* $NetBSD: uipc_domain.c,v 1.14 1996/02/09 19:00:44 christos Exp $ */
/*
@ -62,7 +62,6 @@ const struct domain *const domains[] = {
void pffasttimo(void *);
void pfslowtimo(void *);
const struct domain * pffinddomain(int);
void
domaininit(void)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uipc_socket.c,v 1.312 2023/12/19 21:34:22 bluhm Exp $ */
/* $OpenBSD: uipc_socket.c,v 1.313 2024/01/11 14:15:11 bluhm Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@ -148,7 +148,7 @@ soinit(void)
}
struct socket *
soalloc(int wait)
soalloc(const struct domain *dp, int wait)
{
struct socket *so;
@ -156,7 +156,7 @@ soalloc(int wait)
PR_ZERO);
if (so == NULL)
return (NULL);
rw_init_flags(&so->so_lock, "solock", RWL_DUPOK);
rw_init_flags(&so->so_lock, dp->dom_name, RWL_DUPOK);
refcnt_init(&so->so_refcnt);
klist_init(&so->so_rcv.sb_klist, &socket_klistops, so);
klist_init(&so->so_snd.sb_klist, &socket_klistops, so);
@ -190,7 +190,7 @@ socreate(int dom, struct socket **aso, int type, int proto)
return (EPROTONOSUPPORT);
if (prp->pr_type != type)
return (EPROTOTYPE);
so = soalloc(M_WAIT);
so = soalloc(pffinddomain(dom), M_WAIT);
so->so_type = type;
if (suser(p) == 0)
so->so_state = SS_PRIV;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uipc_socket2.c,v 1.139 2023/12/18 13:11:20 bluhm Exp $ */
/* $OpenBSD: uipc_socket2.c,v 1.140 2024/01/11 14:15:11 bluhm Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
@ -188,7 +188,7 @@ sonewconn(struct socket *head, int connstatus, int wait)
return (NULL);
if (head->so_qlen + head->so_q0len > head->so_qlimit * 3)
return (NULL);
so = soalloc(wait);
so = soalloc(head->so_proto->pr_domain, wait);
if (so == NULL)
return (NULL);
so->so_type = head->so_type;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pfkeyv2.c,v 1.259 2023/10/11 22:13:16 tobhe Exp $ */
/* $OpenBSD: pfkeyv2.c,v 1.260 2024/01/11 14:15:11 bluhm Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
@ -225,7 +225,7 @@ const struct protosw pfkeysw[] = {
const struct domain pfkeydomain = {
.dom_family = PF_KEY,
.dom_name = "PF_KEY",
.dom_name = "pfkey",
.dom_init = pfkey_init,
.dom_protosw = pfkeysw,
.dom_protoswNPROTOSW = &pfkeysw[nitems(pfkeysw)],

View file

@ -1,4 +1,4 @@
/* $OpenBSD: in_proto.c,v 1.102 2023/07/06 04:55:05 dlg Exp $ */
/* $OpenBSD: in_proto.c,v 1.103 2024/01/11 14:15:12 bluhm Exp $ */
/* $NetBSD: in_proto.c,v 1.14 1996/02/18 18:58:32 christos Exp $ */
/*
@ -387,7 +387,7 @@ const struct protosw inetsw[] = {
const struct domain inetdomain = {
.dom_family = AF_INET,
.dom_name = "internet",
.dom_name = "inet",
.dom_init = in_init,
.dom_protosw = inetsw,
.dom_protoswNPROTOSW = &inetsw[nitems(inetsw)],

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tcp_debug.c,v 1.30 2022/02/22 01:15:02 guenther Exp $ */
/* $OpenBSD: tcp_debug.c,v 1.31 2024/01/11 13:49:49 bluhm Exp $ */
/* $NetBSD: tcp_debug.c,v 1.10 1996/02/13 23:43:36 christos Exp $ */
/*
@ -42,10 +42,10 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgements:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* This product includes software developed at the Information
* Technology Division, US Naval Research Laboratory.
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* This product includes software developed at the Information
* Technology Division, US Naval Research Laboratory.
* 4. Neither the name of the NRL nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tcp_input.c,v 1.397 2023/12/01 15:30:47 bluhm Exp $ */
/* $OpenBSD: tcp_input.c,v 1.398 2024/01/11 13:49:49 bluhm Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@ -3932,7 +3932,7 @@ syn_cache_add(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
if (syn_cache_respond(sc, m, now) == 0) {
mtx_enter(&syn_cache_mtx);
/*
* XXXSMP Currently exclusive netlock prevents another insert
* XXXSMP Currently exclusive netlock prevents another insert
* after our syn_cache_lookup() and before syn_cache_insert().
* Double insert should be handled and not rely on netlock.
*/

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tcp_subr.c,v 1.194 2023/11/29 18:30:48 bluhm Exp $ */
/* $OpenBSD: tcp_subr.c,v 1.195 2024/01/11 13:49:49 bluhm Exp $ */
/* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */
/*
@ -42,10 +42,10 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgements:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* This product includes software developed at the Information
* Technology Division, US Naval Research Laboratory.
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* This product includes software developed at the Information
* Technology Division, US Naval Research Laboratory.
* 4. Neither the name of the NRL nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@ -396,7 +396,7 @@ tcp_respond(struct tcpcb *tp, caddr_t template, struct tcphdr *th0,
case AF_INET6:
ip6->ip6_flow = htonl(0x60000000);
ip6->ip6_nxt = IPPROTO_TCP;
ip6->ip6_hlim = in6_selecthlim(tp ? tp->t_inpcb : NULL); /*XXX*/
ip6->ip6_hlim = in6_selecthlim(tp ? tp->t_inpcb : NULL); /*XXX*/
ip6->ip6_plen = tlen - sizeof(struct ip6_hdr);
ip6->ip6_plen = htons(ip6->ip6_plen);
ip6_output(m, tp ? tp->t_inpcb->inp_outputopts6 : NULL,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tcp_timer.c,v 1.73 2023/07/06 09:15:24 bluhm Exp $ */
/* $OpenBSD: tcp_timer.c,v 1.74 2024/01/11 13:49:49 bluhm Exp $ */
/* $NetBSD: tcp_timer.c,v 1.14 1996/02/13 23:44:09 christos Exp $ */
/*
@ -367,7 +367,9 @@ tcp_timer_rexmt(void *arg)
* to go below this.)
*/
{
u_long win = ulmin(tp->snd_wnd, tp->snd_cwnd) / 2 / tp->t_maxseg;
u_long win;
win = ulmin(tp->snd_wnd, tp->snd_cwnd) / 2 / tp->t_maxseg;
if (win < 2)
win = 2;
tp->snd_cwnd = tp->t_maxseg;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tcp_usrreq.c,v 1.227 2023/12/03 20:24:17 bluhm Exp $ */
/* $OpenBSD: tcp_usrreq.c,v 1.228 2024/01/11 13:49:49 bluhm Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@ -175,7 +175,7 @@ int tcp_fill_info(struct tcpcb *, struct socket *, struct mbuf *);
int tcp_ident(void *, size_t *, void *, size_t, int);
static inline int tcp_sogetpcb(struct socket *, struct inpcb **,
struct tcpcb **);
struct tcpcb **);
static inline int
tcp_sogetpcb(struct socket *so, struct inpcb **rinp, struct tcpcb **rtp)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tcp_var.h,v 1.173 2023/11/29 19:19:25 bluhm Exp $ */
/* $OpenBSD: tcp_var.h,v 1.174 2024/01/11 13:49:49 bluhm Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
@ -43,7 +43,7 @@
struct sackblk {
tcp_seq start; /* start seq no. of sack block */
tcp_seq end; /* end seq no. */
tcp_seq end; /* end seq no. */
};
struct sackhole {
@ -334,7 +334,8 @@ struct syn_cache_set {
* is the same as the multiplier for rttvar.
*/
#define TCP_REXMTVAL(tp) \
((((tp)->t_srtt >> TCP_RTT_SHIFT) + (tp)->t_rttvar) >> TCP_RTT_BASE_SHIFT)
((((tp)->t_srtt >> TCP_RTT_SHIFT) + (tp)->t_rttvar) \
>> TCP_RTT_BASE_SHIFT)
/*
* TCP statistics.
@ -406,8 +407,8 @@ struct tcpstat {
u_int32_t tcps_rcvbadsig; /* rcvd bad/missing TCP signatures */
u_int64_t tcps_rcvgoodsig; /* rcvd good TCP signatures */
u_int32_t tcps_inswcsum; /* input software-checksummed packets */
u_int32_t tcps_outswcsum; /* output software-checksummed packets */
u_int32_t tcps_inswcsum; /* input software-checksummed pkts */
u_int32_t tcps_outswcsum; /* output software-checksummed pkts */
/* ECN stats */
u_int32_t tcps_ecn_accepts; /* ecn connections accepted */
@ -465,8 +466,8 @@ struct tcpstat {
* Names for TCP sysctl objects.
*/
#define TCPCTL_RFC1323 1 /* enable/disable RFC1323 timestamps/scaling */
#define TCPCTL_KEEPINITTIME 2 /* TCPT_KEEP value */
#define TCPCTL_RFC1323 1 /* enable RFC1323 timestamps/scaling */
#define TCPCTL_KEEPINITTIME 2 /* TCPT_KEEP value */
#define TCPCTL_KEEPIDLE 3 /* allow tcp_keepidle to be changed */
#define TCPCTL_KEEPINTVL 4 /* allow tcp_keepintvl to be changed */
#define TCPCTL_SLOWHZ 5 /* return kernel idea of PR_SLOWHZ */
@ -503,23 +504,23 @@ struct tcpstat {
{ "baddynamic", CTLTYPE_STRUCT }, \
{ NULL, 0 }, \
{ NULL, 0 }, \
{ "ident", CTLTYPE_STRUCT }, \
{ "ident", CTLTYPE_STRUCT }, \
{ "sack", CTLTYPE_INT }, \
{ "mssdflt", CTLTYPE_INT }, \
{ "rstppslimit", CTLTYPE_INT }, \
{ "ackonpush", CTLTYPE_INT }, \
{ "ecn", CTLTYPE_INT }, \
{ "syncachelimit", CTLTYPE_INT }, \
{ "synbucketlimit", CTLTYPE_INT }, \
{ "rfc3390", CTLTYPE_INT }, \
{ "reasslimit", CTLTYPE_INT }, \
{ "drop", CTLTYPE_STRUCT }, \
{ "sackholelimit", CTLTYPE_INT }, \
{ "ecn", CTLTYPE_INT }, \
{ "syncachelimit", CTLTYPE_INT }, \
{ "synbucketlimit", CTLTYPE_INT }, \
{ "rfc3390", CTLTYPE_INT }, \
{ "reasslimit", CTLTYPE_INT }, \
{ "drop", CTLTYPE_STRUCT }, \
{ "sackholelimit", CTLTYPE_INT }, \
{ "stats", CTLTYPE_STRUCT }, \
{ "always_keepalive", CTLTYPE_INT }, \
{ "synuselimit", CTLTYPE_INT }, \
{ "synuselimit", CTLTYPE_INT }, \
{ "rootonly", CTLTYPE_STRUCT }, \
{ "synhashsize", CTLTYPE_INT }, \
{ "synhashsize", CTLTYPE_INT }, \
{ "tso", CTLTYPE_INT }, \
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: in6_proto.c,v 1.112 2022/11/23 14:48:28 kn Exp $ */
/* $OpenBSD: in6_proto.c,v 1.113 2024/01/11 14:15:12 bluhm Exp $ */
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
/*
@ -332,7 +332,7 @@ const struct protosw inet6sw[] = {
const struct domain inet6domain = {
.dom_family = AF_INET6,
.dom_name = "internet6",
.dom_name = "inet6",
.dom_protosw = inet6sw,
.dom_protoswNPROTOSW = &inet6sw[nitems(inet6sw)],
.dom_sasize = sizeof(struct sockaddr_in6),

View file

@ -1,4 +1,4 @@
/* $OpenBSD: domain.h,v 1.23 2022/11/23 14:50:59 kn Exp $ */
/* $OpenBSD: domain.h,v 1.24 2024/01/11 14:15:12 bluhm Exp $ */
/* $NetBSD: domain.h,v 1.10 1996/02/09 18:25:07 christos Exp $ */
/*
@ -49,7 +49,7 @@ struct ifnet;
struct domain {
int dom_family; /* AF_xxx */
char *dom_name;
const char *dom_name;
void (*dom_init)(void); /* initialize domain data structures */
/* externalize access rights */
int (*dom_externalize)(struct mbuf *, socklen_t, int);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: protosw.h,v 1.63 2023/12/18 13:11:20 bluhm Exp $ */
/* $OpenBSD: protosw.h,v 1.64 2024/01/11 14:15:12 bluhm Exp $ */
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
/*-
@ -259,6 +259,7 @@ struct ifnet;
struct sockaddr;
const struct protosw *pffindproto(int, int, int);
const struct protosw *pffindtype(int, int);
const struct domain *pffinddomain(int);
void pfctlinput(int, struct sockaddr *);
extern u_char ip_protox[];

View file

@ -1,4 +1,4 @@
/* $OpenBSD: socketvar.h,v 1.120 2023/07/04 22:28:24 mvs Exp $ */
/* $OpenBSD: socketvar.h,v 1.121 2024/01/11 14:15:12 bluhm Exp $ */
/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */
/*-
@ -346,7 +346,7 @@ int soconnect(struct socket *, struct mbuf *);
int soconnect2(struct socket *, struct socket *);
int socreate(int, struct socket **, int, int);
int sodisconnect(struct socket *);
struct socket *soalloc(int);
struct socket *soalloc(const struct domain *, int);
void sofree(struct socket *, int);
int sogetopt(struct socket *, int, int, struct mbuf *);
void sohasoutofband(struct socket *);