From c346c8d04f188b0fef6a93bf86b7cce4fb982410 Mon Sep 17 00:00:00 2001 From: purplerain Date: Tue, 22 Aug 2023 00:55:38 +0000 Subject: [PATCH] sync code with last improvements from OpenBSD --- regress/sbin/bioctl/Makefile | 29 +++++++++++++++++++++++---- sys/dev/pci/if_ix.c | 15 +++++++------- sys/kern/kern_clockintr.c | 38 +++--------------------------------- sys/sys/clockintr.h | 3 +-- usr.bin/ssh/kex.c | 10 +++++----- 5 files changed, 41 insertions(+), 54 deletions(-) diff --git a/regress/sbin/bioctl/Makefile b/regress/sbin/bioctl/Makefile index 837fa50fc..4109e1396 100644 --- a/regress/sbin/bioctl/Makefile +++ b/regress/sbin/bioctl/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.2 2023/08/21 05:10:25 anton Exp $ +# $OpenBSD: Makefile,v 1.6 2023/08/21 18:56:06 kn Exp $ BIOCTL ?= /sbin/bioctl @@ -17,25 +17,46 @@ create-chunk: echo 'RAID *' | ${SUDO} disklabel -wAT- -- "$$(<${CHUNKDEVFILE})" -REGRESS_TARGETS = scripted-create-volume \ +SUCCESS_TESTS = scripted-create-volume \ + scripted-recreate-volume \ scripted-change-passphrase -REGRESS_ROOT_TARGETS = ${REGRESS_TARGETS} +REGRESS_TARGETS = ${SUCCESS_TESTS} +REGRESS_ROOT_TARGETS = ${SUCCESS_TESTS} scripted-create-volume: printf '%s\n' '${OLDPW}' | \ ${SUDO} ${BIOCTL} -s -cC -l"$$(<${CHUNKDEVFILE})a" -- softraid0 | \ grep -o 'sd[0-9]*$$' -- 1>${VOLDEVFILE} +scripted-recreate-volume: detach-volume + printf '%s\n' '${OLDPW}' | \ + ${SUDO} ${BIOCTL} -s -Cforce -r17 -cC -l"$$(<${CHUNKDEVFILE})a" -- softraid0 | \ + grep -o 'sd[0-9]*$$' -- 1>${VOLDEVFILE} + scripted-change-passphrase: printf '%s\n%s\n' '${OLDPW}' '${NEWPW}' | \ ${SUDO} ${BIOCTL} -s -P -- "$$(<${VOLDEVFILE})" +FAILURE_TESTS = reuse-active-chunk \ + set-empty-passphrase +REGRESS_EXPECTED_FAILURES += ${FAILURE_TESTS} +REGRESS_TARGETS += ${FAILURE_TESTS} +REGRESS_ROOT_TARGETS += ${FAILURE_TESTS} + +reuse-active-chunk: + ${SUDO} ${BIOCTL} -cC -l"$$(<${CHUNKDEVFILE})a" -- softraid0 + +set-empty-passphrase: + printf '\n' | ${SUDO} ${BIOCTL} -s -P -- "$$(<${VOLDEVFILE})" + + CLEANFILES = *.txt *.img REGRESS_CLEANUP = cleanup -cleanup: +detach-volume: ${SUDO} ${BIOCTL} -d -- "$$(<${VOLDEVFILE})" 2>/dev/null +cleanup: detach-volume ${SUDO} vnconfig -u -- "$$(<${CHUNKDEVFILE})" 2>/dev/null .include diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c index 7cae7f71c..a832a9a42 100644 --- a/sys/dev/pci/if_ix.c +++ b/sys/dev/pci/if_ix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ix.c,v 1.203 2023/08/03 18:56:32 jan Exp $ */ +/* $OpenBSD: if_ix.c,v 1.204 2023/08/21 21:45:18 bluhm Exp $ */ /****************************************************************************** @@ -3230,12 +3230,6 @@ ixgbe_rxeof(struct rx_ring *rxr) sendmp = mp; sendmp->m_pkthdr.len = 0; sendmp->m_pkthdr.ph_mss = 0; -#if NVLAN > 0 - if (staterr & IXGBE_RXD_STAT_VP) { - sendmp->m_pkthdr.ether_vtag = vtag; - SET(sendmp->m_flags, M_VLANTAG); - } -#endif } sendmp->m_pkthdr.len += mp->m_len; /* @@ -3256,7 +3250,12 @@ ixgbe_rxeof(struct rx_ring *rxr) uint16_t pkts; ixgbe_rx_checksum(staterr, sendmp); - +#if NVLAN > 0 + if (staterr & IXGBE_RXD_STAT_VP) { + sendmp->m_pkthdr.ether_vtag = vtag; + SET(sendmp->m_flags, M_VLANTAG); + } +#endif if (hashtype != IXGBE_RXDADV_RSSTYPE_NONE) { sendmp->m_pkthdr.ph_flowid = hash; SET(sendmp->m_pkthdr.csum_flags, M_FLOWID); diff --git a/sys/kern/kern_clockintr.c b/sys/kern/kern_clockintr.c index 6351a0bb2..48fb0def3 100644 --- a/sys/kern/kern_clockintr.c +++ b/sys/kern/kern_clockintr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_clockintr.c,v 1.31 2023/08/11 22:02:50 cheloha Exp $ */ +/* $OpenBSD: kern_clockintr.c,v 1.32 2023/08/21 17:22:04 cheloha Exp $ */ /* * Copyright (c) 2003 Dale Rahn * Copyright (c) 2020 Mark Kettenis @@ -38,7 +38,6 @@ */ u_int clockintr_flags; /* [I] global state + behavior flags */ uint32_t hardclock_period; /* [I] hardclock period (ns) */ -uint32_t schedclock_period; /* [I] schedclock period (ns) */ uint32_t statclock_avg; /* [I] average statclock period (ns) */ uint32_t statclock_min; /* [I] minimum statclock period (ns) */ uint32_t statclock_mask; /* [I] set of allowed offsets */ @@ -47,7 +46,6 @@ void clockintr_cancel_locked(struct clockintr *); uint64_t clockintr_expiration(const struct clockintr *); void clockintr_hardclock(struct clockintr *, void *); uint64_t clockintr_nsecuptime(const struct clockintr *); -void clockintr_schedclock(struct clockintr *, void *); void clockintr_schedule(struct clockintr *, uint64_t); void clockintr_schedule_locked(struct clockintr *, uint64_t); void clockintr_statclock(struct clockintr *, void *); @@ -89,10 +87,6 @@ clockintr_init(u_int flags) statclock_min = statclock_avg - (var / 2); statclock_mask = var - 1; - KASSERT(schedhz >= 0 && schedhz <= 1000000000); - if (schedhz != 0) - schedclock_period = 1000000000 / schedhz; - SET(clockintr_flags, flags | CL_INIT); } @@ -128,12 +122,6 @@ clockintr_cpu_init(const struct intrclock *ic) if (cq->cq_statclock == NULL) panic("%s: failed to establish statclock", __func__); } - if (schedhz != 0 && cq->cq_schedclock == NULL) { - cq->cq_schedclock = clockintr_establish(cq, - clockintr_schedclock); - if (cq->cq_schedclock == NULL) - panic("%s: failed to establish schedclock", __func__); - } /* * Mask CQ_INTRCLOCK while we're advancing the internal clock @@ -175,8 +163,8 @@ clockintr_cpu_init(const struct intrclock *ic) } /* - * We can always advance the statclock and schedclock. - * There is no reason to stagger a randomized statclock. + * We can always advance the statclock. There is no reason to + * stagger a randomized statclock. */ if (!ISSET(clockintr_flags, CL_RNDSTAT)) { if (cq->cq_statclock->cl_expiration == 0) { @@ -185,13 +173,6 @@ clockintr_cpu_init(const struct intrclock *ic) } } clockintr_advance(cq->cq_statclock, statclock_avg); - if (schedhz != 0) { - if (cq->cq_schedclock->cl_expiration == 0) { - clockintr_stagger(cq->cq_schedclock, schedclock_period, - multiplier, MAXCPUS); - } - clockintr_advance(cq->cq_schedclock, schedclock_period); - } /* * XXX Need to find a better place to do this. We can't do it in @@ -514,19 +495,6 @@ clockintr_hardclock(struct clockintr *cl, void *frame) hardclock(frame); } -void -clockintr_schedclock(struct clockintr *cl, void *unused) -{ - uint64_t count, i; - struct proc *p = curproc; - - count = clockintr_advance(cl, schedclock_period); - if (p != NULL) { - for (i = 0; i < count; i++) - schedclock(p); - } -} - void clockintr_statclock(struct clockintr *cl, void *frame) { diff --git a/sys/sys/clockintr.h b/sys/sys/clockintr.h index 4a546a564..d7e707d64 100644 --- a/sys/sys/clockintr.h +++ b/sys/sys/clockintr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: clockintr.h,v 1.9 2023/07/25 18:16:19 cheloha Exp $ */ +/* $OpenBSD: clockintr.h,v 1.10 2023/08/21 17:22:04 cheloha Exp $ */ /* * Copyright (c) 2020-2022 Scott Cheloha * @@ -97,7 +97,6 @@ struct clockintr_queue { TAILQ_HEAD(, clockintr) cq_pend;/* [m] pending clockintr list */ struct clockintr *cq_running; /* [m] running clockintr */ struct clockintr *cq_hardclock; /* [o] hardclock handle */ - struct clockintr *cq_schedclock;/* [o] schedclock handle, if any */ struct clockintr *cq_statclock; /* [o] statclock handle */ struct intrclock cq_intrclock; /* [I] local interrupt clock */ struct clockintr_stat cq_stat; /* [o] dispatch statistics */ diff --git a/usr.bin/ssh/kex.c b/usr.bin/ssh/kex.c index cdd5c2500..615ede832 100644 --- a/usr.bin/ssh/kex.c +++ b/usr.bin/ssh/kex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kex.c,v 1.179 2023/08/18 01:37:41 djm Exp $ */ +/* $OpenBSD: kex.c,v 1.180 2023/08/21 21:16:18 tobhe Exp $ */ /* * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. * @@ -1336,7 +1336,7 @@ kex_exchange_identification(struct ssh *ssh, int timeout_ms, len = atomicio(read, ssh_packet_get_connection_in(ssh), &c, 1); if (len != 1 && errno == EPIPE) { - error_f("Connection closed by remote host"); + verbose_f("Connection closed by remote host"); r = SSH_ERR_CONN_CLOSED; goto out; } else if (len != 1) { @@ -1352,7 +1352,7 @@ kex_exchange_identification(struct ssh *ssh, int timeout_ms, if (c == '\n') break; if (c == '\0' || expect_nl) { - error_f("banner line contains invalid " + verbose_f("banner line contains invalid " "characters"); goto invalid; } @@ -1362,7 +1362,7 @@ kex_exchange_identification(struct ssh *ssh, int timeout_ms, goto out; } if (sshbuf_len(peer_version) > SSH_MAX_BANNER_LEN) { - error_f("banner line too long"); + verbose_f("banner line too long"); goto invalid; } } @@ -1378,7 +1378,7 @@ kex_exchange_identification(struct ssh *ssh, int timeout_ms, } /* Do not accept lines before the SSH ident from a client */ if (ssh->kex->server) { - error_f("client sent invalid protocol identifier " + verbose_f("client sent invalid protocol identifier " "\"%.256s\"", cp); free(cp); goto invalid;