From a0c25e6ab1dff871277bf390f3839a7e9c672d29 Mon Sep 17 00:00:00 2001 From: purplerain Date: Sun, 7 Apr 2024 00:39:16 +0000 Subject: [PATCH] sync with OpenBSD -current --- sys/dev/dt/dt_dev.c | 77 +----------------------------------- sys/dev/dt/dt_prov_kprobe.c | 3 +- sys/dev/dt/dt_prov_profile.c | 4 +- sys/dev/dt/dt_prov_static.c | 4 +- sys/dev/dt/dt_prov_syscall.c | 4 +- sys/dev/dt/dtvar.h | 27 +------------ sys/dev/pci/pcidevs | 6 ++- sys/dev/pci/pcidevs.h | 6 ++- sys/dev/pci/pcidevs_data.h | 18 ++++++++- sys/netinet/ip_mroute.c | 21 +++++----- sys/netinet6/ip6_mroute.c | 21 +++++----- sys/uvm/uvm_anon.c | 5 ++- 12 files changed, 56 insertions(+), 140 deletions(-) diff --git a/sys/dev/dt/dt_dev.c b/sys/dev/dt/dt_dev.c index 98b19792d..2d01b4f5e 100644 --- a/sys/dev/dt/dt_dev.c +++ b/sys/dev/dt/dt_dev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dt_dev.c,v 1.32 2024/02/29 00:18:48 cheloha Exp $ */ +/* $OpenBSD: dt_dev.c,v 1.33 2024/04/06 11:18:02 mpi Exp $ */ /* * Copyright (c) 2019 Martin Pieuchot @@ -347,30 +347,6 @@ dtlookup(int unit) return sc; } -int -dtioc_req_isvalid(struct dtioc_req *dtrq) -{ - switch (dtrq->dtrq_filter.dtf_operand) { - case DT_OP_NONE: - case DT_OP_EQ: - case DT_OP_NE: - break; - default: - return 0; - } - - switch (dtrq->dtrq_filter.dtf_variable) { - case DT_FV_NONE: - case DT_FV_PID: - case DT_FV_TID: - break; - default: - return 0; - } - - return 1; -} - int dt_ioctl_list_probes(struct dt_softc *sc, struct dtioc_probe *dtpr) { @@ -552,9 +528,6 @@ dt_ioctl_probe_enable(struct dt_softc *sc, struct dtioc_req *dtrq) struct dt_probe *dtp; int error; - if (!dtioc_req_isvalid(dtrq)) - return EINVAL; - SIMPLEQ_FOREACH(dtp, &dt_probe_list, dtp_next) { if (dtp->dtp_pbn == dtrq->dtrq_pbn) break; @@ -582,9 +555,6 @@ dt_ioctl_probe_disable(struct dt_softc *sc, struct dtioc_req *dtrq) struct dt_probe *dtp; int error; - if (!dtioc_req_isvalid(dtrq)) - return EINVAL; - SIMPLEQ_FOREACH(dtp, &dt_probe_list, dtp_next) { if (dtp->dtp_pbn == dtrq->dtrq_pbn) break; @@ -711,48 +681,6 @@ dt_pcb_purge(struct dt_pcb_list *plist) } } -int -dt_pcb_filter(struct dt_pcb *dp) -{ - struct dt_filter *dtf = &dp->dp_filter; - struct proc *p = curproc; - unsigned int var = 0; - int match = 1; - - /* Filter out tracing program. */ - if (dp->dp_sc->ds_pid == p->p_p->ps_pid) - return 1; - - switch (dtf->dtf_variable) { - case DT_FV_PID: - var = p->p_p->ps_pid; - break; - case DT_FV_TID: - var = p->p_tid + THREAD_PID_OFFSET; - break; - case DT_FV_NONE: - break; - default: - KASSERT(0); - } - - switch (dtf->dtf_operand) { - case DT_OP_EQ: - match = !!(var == dtf->dtf_value); - break; - case DT_OP_NE: - match = !!(var != dtf->dtf_value); - break; - case DT_OP_NONE: - break; - default: - KASSERT(0); - } - - return !match; -} - - /* * Get a reference to the next free event state from the ring. */ @@ -763,9 +691,6 @@ dt_pcb_ring_get(struct dt_pcb *dp, int profiling) struct dt_evt *dtev; int distance; - if (dt_pcb_filter(dp)) - return NULL; - mtx_enter(&dp->dp_mtx); distance = dp->dp_prod - dp->dp_cons; if (distance == 1 || distance == (1 - DT_EVTRING_SIZE)) { diff --git a/sys/dev/dt/dt_prov_kprobe.c b/sys/dev/dt/dt_prov_kprobe.c index c506b6908..f929dd56d 100644 --- a/sys/dev/dt/dt_prov_kprobe.c +++ b/sys/dev/dt/dt_prov_kprobe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dt_prov_kprobe.c,v 1.7 2023/07/06 10:53:11 jasper Exp $ */ +/* $OpenBSD: dt_prov_kprobe.c,v 1.8 2024/04/06 11:18:02 mpi Exp $ */ /* * Copyright (c) 2020 Tom Rollet @@ -263,7 +263,6 @@ dt_prov_kprobe_alloc(struct dt_probe *dtp, struct dt_softc *sc, intr_restore(s); } - dp->dp_filter = dtrq->dtrq_filter; dp->dp_evtflags = dtrq->dtrq_evtflags & DTEVT_PROV_KPROBE; TAILQ_INSERT_HEAD(plist, dp, dp_snext); return 0; diff --git a/sys/dev/dt/dt_prov_profile.c b/sys/dev/dt/dt_prov_profile.c index 26972585d..62900152e 100644 --- a/sys/dev/dt/dt_prov_profile.c +++ b/sys/dev/dt/dt_prov_profile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dt_prov_profile.c,v 1.7 2024/03/13 13:13:57 bluhm Exp $ */ +/* $OpenBSD: dt_prov_profile.c,v 1.8 2024/04/06 11:18:02 mpi Exp $ */ /* * Copyright (c) 2019 Martin Pieuchot @@ -72,7 +72,6 @@ dt_prov_profile_alloc(struct dt_probe *dtp, struct dt_softc *sc, CPU_INFO_ITERATOR cii; extern int hz; - KASSERT(dtioc_req_isvalid(dtrq)); KASSERT(TAILQ_EMPTY(plist)); KASSERT(dtp == dtpp_profile || dtp == dtpp_interval); @@ -92,7 +91,6 @@ dt_prov_profile_alloc(struct dt_probe *dtp, struct dt_softc *sc, dp->dp_nsecs = SEC_TO_NSEC(1) / dtrq->dtrq_rate; dp->dp_cpu = ci; - dp->dp_filter = dtrq->dtrq_filter; dp->dp_evtflags = dtrq->dtrq_evtflags & DTEVT_PROV_PROFILE; TAILQ_INSERT_HEAD(plist, dp, dp_snext); } diff --git a/sys/dev/dt/dt_prov_static.c b/sys/dev/dt/dt_prov_static.c index d03badccb..4a87bc916 100644 --- a/sys/dev/dt/dt_prov_static.c +++ b/sys/dev/dt/dt_prov_static.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dt_prov_static.c,v 1.22 2023/08/28 14:50:01 bluhm Exp $ */ +/* $OpenBSD: dt_prov_static.c,v 1.23 2024/04/06 11:18:02 mpi Exp $ */ /* * Copyright (c) 2019 Martin Pieuchot @@ -179,14 +179,12 @@ dt_prov_static_alloc(struct dt_probe *dtp, struct dt_softc *sc, { struct dt_pcb *dp; - KASSERT(dtioc_req_isvalid(dtrq)); KASSERT(TAILQ_EMPTY(plist)); dp = dt_pcb_alloc(dtp, sc); if (dp == NULL) return ENOMEM; - dp->dp_filter = dtrq->dtrq_filter; dp->dp_evtflags = dtrq->dtrq_evtflags; TAILQ_INSERT_HEAD(plist, dp, dp_snext); diff --git a/sys/dev/dt/dt_prov_syscall.c b/sys/dev/dt/dt_prov_syscall.c index f272ac768..03c561eec 100644 --- a/sys/dev/dt/dt_prov_syscall.c +++ b/sys/dev/dt/dt_prov_syscall.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dt_prov_syscall.c,v 1.8 2023/04/13 02:19:05 jsg Exp $ */ +/* $OpenBSD: dt_prov_syscall.c,v 1.9 2024/04/06 11:18:02 mpi Exp $ */ /* * Copyright (c) 2019 Martin Pieuchot @@ -101,7 +101,6 @@ dt_prov_syscall_alloc(struct dt_probe *dtp, struct dt_softc *sc, { struct dt_pcb *dp; - KASSERT(dtioc_req_isvalid(dtrq)); KASSERT(TAILQ_EMPTY(plist)); KASSERT(dtp->dtp_prov == &dt_prov_syscall); KASSERT((dtp->dtp_sysnum >= 0) && (dtp->dtp_sysnum < dtps_nsysent)); @@ -110,7 +109,6 @@ dt_prov_syscall_alloc(struct dt_probe *dtp, struct dt_softc *sc, if (dp == NULL) return ENOMEM; - dp->dp_filter = dtrq->dtrq_filter; dp->dp_evtflags = dtrq->dtrq_evtflags & DTEVT_PROV_SYSCALL; TAILQ_INSERT_HEAD(plist, dp, dp_snext); diff --git a/sys/dev/dt/dtvar.h b/sys/dev/dt/dtvar.h index f69a41c65..5bb7ab0d7 100644 --- a/sys/dev/dt/dtvar.h +++ b/sys/dev/dt/dtvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dtvar.h,v 1.18 2024/02/09 17:42:18 cheloha Exp $ */ +/* $OpenBSD: dtvar.h,v 1.19 2024/04/06 11:18:02 mpi Exp $ */ /* * Copyright (c) 2019 Martin Pieuchot @@ -82,26 +82,6 @@ struct dt_evt { "\003KSTACK" \ "\004FUNCARGS" \ -/* - * Each PCB can have a filter attached to itself. A filter do not - * prevent an enabled probe to fire, but when that happens, event - * states are only recorded if it is matched. - */ -struct dt_filter { - enum dt_operand { - DT_OP_NONE = 0, - DT_OP_EQ, - DT_OP_NE, - } dtf_operand; - enum dt_filtervar { - DT_FV_NONE = 0, - DT_FV_PID, - DT_FV_TID, - } dtf_variable /* what should be filtered */; - unsigned int dtf_value; /* PID or TID to filter */ -}; - - struct dtioc_probe_info { uint32_t dtpi_pbn; /* probe number */ uint8_t dtpi_nargs; /* # of arguments */ @@ -129,7 +109,6 @@ struct dtioc_arg { struct dtioc_req { uint32_t dtrq_pbn; /* probe number */ - struct dt_filter dtrq_filter; /* probe filter */ uint32_t dtrq_rate; /* number of ticks */ uint64_t dtrq_evtflags; /* states to record */ }; @@ -165,8 +144,6 @@ struct dtioc_getaux { struct dt_softc; -int dtioc_req_isvalid(struct dtioc_req *); - /* * Probe control block, possibly per-CPU. * @@ -195,7 +172,6 @@ struct dt_pcb { struct dt_softc *dp_sc; /* [I] related softc */ struct dt_probe *dp_dtp; /* [I] related probe */ uint64_t dp_evtflags; /* [I] event states to record */ - struct dt_filter dp_filter; /* [I] filter to match */ /* Provider specific fields. */ struct clockintr dp_clockintr; /* [D] profiling handle */ @@ -211,7 +187,6 @@ TAILQ_HEAD(dt_pcb_list, dt_pcb); struct dt_pcb *dt_pcb_alloc(struct dt_probe *, struct dt_softc *); void dt_pcb_free(struct dt_pcb *); void dt_pcb_purge(struct dt_pcb_list *); -int dt_pcb_filter(struct dt_pcb *); struct dt_evt *dt_pcb_ring_get(struct dt_pcb *, int); void dt_pcb_ring_consume(struct dt_pcb *, struct dt_evt *); diff --git a/sys/dev/pci/pcidevs b/sys/dev/pci/pcidevs index 5b661f716..33c2a6c4d 100644 --- a/sys/dev/pci/pcidevs +++ b/sys/dev/pci/pcidevs @@ -1,4 +1,4 @@ -$OpenBSD: pcidevs,v 1.2070 2024/03/30 11:12:20 jsg Exp $ +$OpenBSD: pcidevs,v 1.2071 2024/04/06 08:39:51 jsg Exp $ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ /* @@ -5694,6 +5694,7 @@ product INTEL ADL_H_HB_2 0x4629 Core 12G Host product INTEL ADL_P_GT2_3 0x462a Graphics product INTEL ADL_HX_HB_4 0x462b Core 12G Host product INTEL ADL_S_PCIE_2 0x462d Core 12G PCIE +product INTEL ADL_N_IPU 0x462e ADL-N IPU product INTEL ADL_TBT_PCIE2 0x462f Core 12G PCIE product INTEL ADL_S_HB_5 0x4630 Core 12G Host product INTEL ADL_HX_HB_1 0x4637 Core 12G Host @@ -5707,15 +5708,18 @@ product INTEL RPL_HX_HB_1 0x4647 Core 13G Host product INTEL ADL_S_HB_3 0x4648 Core 12G Host product INTEL ADL_H_HB_1 0x4649 Core 12G Host product INTEL ADL_S_PCIE_3 0x464d Core 12G PCIE +product INTEL ADL_N_XHCI_2 0x464e ADL-N xHCI product INTEL ADL_S_GNA 0x464f Core 12G GNA product INTEL ADL_S_HB_4 0x4650 Core 12G Host product INTEL ADL_IPU 0x465d Core 12G IPU +product INTEL ADL_N_XDCI_2 0x465e ADL-N xDCI product INTEL ADL_S_HB_1 0x4660 Core 12G Host product INTEL ADL_S_HB_2 0x4668 Core 12G Host product INTEL ADL_TBT_DMA1 0x466d Core 12G TBT product INTEL ADL_TBT_PCIE0 0x466e Core 12G PCIE product INTEL ADL_S_TH 0x466f Core 12G TH product INTEL ADL_S_CL 0x467d Core 12G CL +product INTEL ADL_N_GNA 0x467e ADL-N GNA product INTEL ADL_S_VMD 0x467f Core 12G VMD product INTEL ADL_S_GT1_1 0x4680 UHD Graphics 770 product INTEL ADL_S_GT1_2 0x4682 UHD Graphics 730 diff --git a/sys/dev/pci/pcidevs.h b/sys/dev/pci/pcidevs.h index 17920aaf9..a95903883 100644 --- a/sys/dev/pci/pcidevs.h +++ b/sys/dev/pci/pcidevs.h @@ -2,7 +2,7 @@ * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * OpenBSD: pcidevs,v 1.2070 2024/03/30 11:12:20 jsg Exp + * OpenBSD: pcidevs,v 1.2071 2024/04/06 08:39:51 jsg Exp */ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ @@ -5699,6 +5699,7 @@ #define PCI_PRODUCT_INTEL_ADL_P_GT2_3 0x462a /* Graphics */ #define PCI_PRODUCT_INTEL_ADL_HX_HB_4 0x462b /* Core 12G Host */ #define PCI_PRODUCT_INTEL_ADL_S_PCIE_2 0x462d /* Core 12G PCIE */ +#define PCI_PRODUCT_INTEL_ADL_N_IPU 0x462e /* ADL-N IPU */ #define PCI_PRODUCT_INTEL_ADL_TBT_PCIE2 0x462f /* Core 12G PCIE */ #define PCI_PRODUCT_INTEL_ADL_S_HB_5 0x4630 /* Core 12G Host */ #define PCI_PRODUCT_INTEL_ADL_HX_HB_1 0x4637 /* Core 12G Host */ @@ -5712,15 +5713,18 @@ #define PCI_PRODUCT_INTEL_ADL_S_HB_3 0x4648 /* Core 12G Host */ #define PCI_PRODUCT_INTEL_ADL_H_HB_1 0x4649 /* Core 12G Host */ #define PCI_PRODUCT_INTEL_ADL_S_PCIE_3 0x464d /* Core 12G PCIE */ +#define PCI_PRODUCT_INTEL_ADL_N_XHCI_2 0x464e /* ADL-N xHCI */ #define PCI_PRODUCT_INTEL_ADL_S_GNA 0x464f /* Core 12G GNA */ #define PCI_PRODUCT_INTEL_ADL_S_HB_4 0x4650 /* Core 12G Host */ #define PCI_PRODUCT_INTEL_ADL_IPU 0x465d /* Core 12G IPU */ +#define PCI_PRODUCT_INTEL_ADL_N_XDCI_2 0x465e /* ADL-N xDCI */ #define PCI_PRODUCT_INTEL_ADL_S_HB_1 0x4660 /* Core 12G Host */ #define PCI_PRODUCT_INTEL_ADL_S_HB_2 0x4668 /* Core 12G Host */ #define PCI_PRODUCT_INTEL_ADL_TBT_DMA1 0x466d /* Core 12G TBT */ #define PCI_PRODUCT_INTEL_ADL_TBT_PCIE0 0x466e /* Core 12G PCIE */ #define PCI_PRODUCT_INTEL_ADL_S_TH 0x466f /* Core 12G TH */ #define PCI_PRODUCT_INTEL_ADL_S_CL 0x467d /* Core 12G CL */ +#define PCI_PRODUCT_INTEL_ADL_N_GNA 0x467e /* ADL-N GNA */ #define PCI_PRODUCT_INTEL_ADL_S_VMD 0x467f /* Core 12G VMD */ #define PCI_PRODUCT_INTEL_ADL_S_GT1_1 0x4680 /* UHD Graphics 770 */ #define PCI_PRODUCT_INTEL_ADL_S_GT1_2 0x4682 /* UHD Graphics 730 */ diff --git a/sys/dev/pci/pcidevs_data.h b/sys/dev/pci/pcidevs_data.h index f8e807ff9..88406c7f6 100644 --- a/sys/dev/pci/pcidevs_data.h +++ b/sys/dev/pci/pcidevs_data.h @@ -2,7 +2,7 @@ * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * OpenBSD: pcidevs,v 1.2070 2024/03/30 11:12:20 jsg Exp + * OpenBSD: pcidevs,v 1.2071 2024/04/06 08:39:51 jsg Exp */ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ @@ -20127,6 +20127,10 @@ static const struct pci_known_product pci_known_products[] = { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ADL_S_PCIE_2, "Core 12G PCIE", }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ADL_N_IPU, + "ADL-N IPU", + }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ADL_TBT_PCIE2, "Core 12G PCIE", @@ -20179,6 +20183,10 @@ static const struct pci_known_product pci_known_products[] = { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ADL_S_PCIE_3, "Core 12G PCIE", }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ADL_N_XHCI_2, + "ADL-N xHCI", + }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ADL_S_GNA, "Core 12G GNA", @@ -20191,6 +20199,10 @@ static const struct pci_known_product pci_known_products[] = { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ADL_IPU, "Core 12G IPU", }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ADL_N_XDCI_2, + "ADL-N xDCI", + }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ADL_S_HB_1, "Core 12G Host", @@ -20215,6 +20227,10 @@ static const struct pci_known_product pci_known_products[] = { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ADL_S_CL, "Core 12G CL", }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ADL_N_GNA, + "ADL-N GNA", + }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ADL_S_VMD, "Core 12G VMD", diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index 3e9b00ec2..1913b1767 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_mroute.c,v 1.141 2024/02/11 18:14:26 mvs Exp $ */ +/* $OpenBSD: ip_mroute.c,v 1.142 2024/04/06 14:23:27 bluhm Exp $ */ /* $NetBSD: ip_mroute.c,v 1.85 2004/04/26 01:31:57 matt Exp $ */ /* @@ -430,8 +430,9 @@ mrt_rtwalk_mfcsysctl(struct rtentry *rt, void *arg, unsigned int rtableid) } for (minfo = msa->msa_minfos; - (uint8_t *)minfo < ((uint8_t *)msa->msa_minfos + msa->msa_len); - minfo++) { + (uint8_t *)(minfo + 1) <= + (uint8_t *)msa->msa_minfos + msa->msa_len; + minfo++) { /* Find a new entry or update old entry. */ if (minfo->mfc_origin.s_addr != satosin(rt->rt_gateway)->sin_addr.s_addr || @@ -471,13 +472,11 @@ mrt_sysctl_mfc(void *oldp, size_t *oldlenp) if (oldp != NULL && *oldlenp > MAXPHYS) return (EINVAL); - if (oldp != NULL) + memset(&msa, 0, sizeof(msa)); + if (oldp != NULL && *oldlenp > 0) { msa.msa_minfos = malloc(*oldlenp, M_TEMP, M_WAITOK | M_ZERO); - else - msa.msa_minfos = NULL; - - msa.msa_len = *oldlenp; - msa.msa_needed = 0; + msa.msa_len = *oldlenp; + } for (rtableid = 0; rtableid <= RT_TABLEID_MAX; rtableid++) { rtable_walk(rtableid, AF_INET, NULL, mrt_rtwalk_mfcsysctl, @@ -486,11 +485,11 @@ mrt_sysctl_mfc(void *oldp, size_t *oldlenp) if (msa.msa_minfos != NULL && msa.msa_needed > 0 && (error = copyout(msa.msa_minfos, oldp, msa.msa_needed)) != 0) { - free(msa.msa_minfos, M_TEMP, *oldlenp); + free(msa.msa_minfos, M_TEMP, msa.msa_len); return (error); } - free(msa.msa_minfos, M_TEMP, *oldlenp); + free(msa.msa_minfos, M_TEMP, msa.msa_len); *oldlenp = msa.msa_needed; return (0); diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index 9af9ed593..bf700ec32 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_mroute.c,v 1.140 2024/02/11 18:14:27 mvs Exp $ */ +/* $OpenBSD: ip6_mroute.c,v 1.141 2024/04/06 14:23:27 bluhm Exp $ */ /* $NetBSD: ip6_mroute.c,v 1.59 2003/12/10 09:28:38 itojun Exp $ */ /* $KAME: ip6_mroute.c,v 1.45 2001/03/25 08:38:51 itojun Exp $ */ @@ -406,8 +406,9 @@ mrt6_rtwalk_mf6csysctl(struct rtentry *rt, void *arg, unsigned int rtableid) } for (minfo = msa->ms6a_minfos; - (uint8_t *)minfo < ((uint8_t *)msa->ms6a_minfos + msa->ms6a_len); - minfo++) { + (uint8_t *)(minfo + 1) <= + (uint8_t *)msa->ms6a_minfos + msa->ms6a_len; + minfo++) { /* Find a new entry or update old entry. */ if (!IN6_ARE_ADDR_EQUAL(&minfo->mf6c_origin.sin6_addr, &satosin6(rt->rt_gateway)->sin6_addr) || @@ -449,13 +450,11 @@ mrt6_sysctl_mfc(void *oldp, size_t *oldlenp) if (oldp != NULL && *oldlenp > MAXPHYS) return EINVAL; - if (oldp != NULL) + memset(&msa, 0, sizeof(msa)); + if (oldp != NULL && *oldlenp > 0) { msa.ms6a_minfos = malloc(*oldlenp, M_TEMP, M_WAITOK | M_ZERO); - else - msa.ms6a_minfos = NULL; - - msa.ms6a_len = *oldlenp; - msa.ms6a_needed = 0; + msa.ms6a_len = *oldlenp; + } for (rtableid = 0; rtableid <= RT_TABLEID_MAX; rtableid++) { rtable_walk(rtableid, AF_INET6, NULL, mrt6_rtwalk_mf6csysctl, @@ -464,11 +463,11 @@ mrt6_sysctl_mfc(void *oldp, size_t *oldlenp) if (msa.ms6a_minfos != NULL && msa.ms6a_needed > 0 && (error = copyout(msa.ms6a_minfos, oldp, msa.ms6a_needed)) != 0) { - free(msa.ms6a_minfos, M_TEMP, *oldlenp); + free(msa.ms6a_minfos, M_TEMP, msa.ms6a_len); return error; } - free(msa.ms6a_minfos, M_TEMP, *oldlenp); + free(msa.ms6a_minfos, M_TEMP, msa.ms6a_len); *oldlenp = msa.ms6a_needed; return 0; diff --git a/sys/uvm/uvm_anon.c b/sys/uvm/uvm_anon.c index 4c4bf8eef..0fc2a0c89 100644 --- a/sys/uvm/uvm_anon.c +++ b/sys/uvm/uvm_anon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_anon.c,v 1.57 2023/10/27 19:13:51 mpi Exp $ */ +/* $OpenBSD: uvm_anon.c,v 1.58 2024/04/06 10:59:52 mpi Exp $ */ /* $NetBSD: uvm_anon.c,v 1.10 2000/11/25 06:27:59 chs Exp $ */ /* @@ -260,7 +260,8 @@ uvm_anon_release(struct vm_anon *anon) uvm_unlock_pageq(); KASSERT(anon->an_page == NULL); lock = anon->an_lock; - uvm_anfree(anon); + uvm_anon_dropswap(anon); + pool_put(&uvm_anon_pool, anon); rw_exit(lock); /* Note: extra reference is held for PG_RELEASED case. */ rw_obj_free(lock);