CVS commit: src/sys/dev/ic
Module Name:src Committed By: mrg Date: Sun Mar 10 04:49:22 UTC 2024 Modified Files: src/sys/dev/ic: nvme.c Log Message: nvme(4): don't write to INTMC register if in intx mode this matches the handling of INTMS, both of which have the same restrictions on access in MSI-X mode. ideally, this register should be written to with a full set of values for MSI (upto 32 bits), but trying to force MSI mode for my test machine makes the system unstable. tested with samsung SM981 256GB, samsung 980 PRO 1TB, and intel 760p 250G. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/dev/ic/nvme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/nvme.c diff -u src/sys/dev/ic/nvme.c:1.67 src/sys/dev/ic/nvme.c:1.68 --- src/sys/dev/ic/nvme.c:1.67 Tue Sep 13 10:14:20 2022 +++ src/sys/dev/ic/nvme.c Sun Mar 10 04:49:22 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: nvme.c,v 1.67 2022/09/13 10:14:20 riastradh Exp $ */ +/* $NetBSD: nvme.c,v 1.68 2024/03/10 04:49:22 mrg Exp $ */ /* $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.67 2022/09/13 10:14:20 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.68 2024/03/10 04:49:22 mrg Exp $"); #include #include @@ -620,7 +620,8 @@ nvme_resume(struct nvme_softc *sc) } } - nvme_write4(sc, NVME_INTMC, 1); + if (!sc->sc_use_mq) + nvme_write4(sc, NVME_INTMC, 1); return 0; @@ -2023,6 +2024,8 @@ nvme_intr(void *xsc) { struct nvme_softc *sc = xsc; + KASSERT(!sc->sc_use_mq); + /* * INTx is level triggered, controller deasserts the interrupt only * when we advance command queue head via write to the doorbell. @@ -2043,6 +2046,8 @@ nvme_softintr_intx(void *xq) struct nvme_queue *q = xq; struct nvme_softc *sc = q->q_sc; + KASSERT(!sc->sc_use_mq); + nvme_q_complete(sc, sc->sc_admin_q); if (sc->sc_q != NULL) nvme_q_complete(sc, sc->sc_q[0]);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: mrg Date: Sun Mar 10 04:49:22 UTC 2024 Modified Files: src/sys/dev/ic: nvme.c Log Message: nvme(4): don't write to INTMC register if in intx mode this matches the handling of INTMS, both of which have the same restrictions on access in MSI-X mode. ideally, this register should be written to with a full set of values for MSI (upto 32 bits), but trying to force MSI mode for my test machine makes the system unstable. tested with samsung SM981 256GB, samsung 980 PRO 1TB, and intel 760p 250G. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/dev/ic/nvme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net
Module Name:src Committed By: riastradh Date: Sun Mar 10 04:21:47 UTC 2024 Modified Files: src/sys/net: if_wg.c Log Message: wg(4): Bind to CPU in wg_handle_packet. Required by use of psref there. Assert we're bound up front so we catch mistakes early, rather than later on if we get unlucky in preemption and scheduling. PR bin/58021 To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/net/if_wg.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net
Module Name:src Committed By: riastradh Date: Sun Mar 10 04:21:47 UTC 2024 Modified Files: src/sys/net: if_wg.c Log Message: wg(4): Bind to CPU in wg_handle_packet. Required by use of psref there. Assert we're bound up front so we catch mistakes early, rather than later on if we get unlucky in preemption and scheduling. PR bin/58021 To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/net/if_wg.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_wg.c diff -u src/sys/net/if_wg.c:1.77 src/sys/net/if_wg.c:1.78 --- src/sys/net/if_wg.c:1.77 Tue Aug 1 07:04:16 2023 +++ src/sys/net/if_wg.c Sun Mar 10 04:21:47 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wg.c,v 1.77 2023/08/01 07:04:16 mrg Exp $ */ +/* $NetBSD: if_wg.c,v 1.78 2024/03/10 04:21:47 riastradh Exp $ */ /* * Copyright (C) Ryota Ozaki @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.77 2023/08/01 07:04:16 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.78 2024/03/10 04:21:47 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_altq_enabled.h" @@ -2871,6 +2871,8 @@ wg_handle_packet(struct wg_softc *wg, st { struct wg_msg *wgm; + KASSERT(curlwp->l_pflag & LP_BOUND); + m = wg_validate_msg_header(wg, m); if (__predict_false(m == NULL)) return; @@ -5040,6 +5042,7 @@ rumpkern_wg_recv_peer(struct wg_softc *w { struct mbuf *m; const struct sockaddr *src; + int bound; WG_TRACE(""); @@ -5054,7 +5057,9 @@ rumpkern_wg_recv_peer(struct wg_softc *w WG_DLOG("iov_len=%lu\n", iov[1].iov_len); WG_DUMP_BUF(iov[1].iov_base, iov[1].iov_len); + bound = curlwp_bind(); wg_handle_packet(wg, m, src); + curlwp_bindx(bound); } #endif /* WG_RUMPKERNEL */
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun Mar 10 02:53:38 UTC 2024 Modified Files: src/usr.bin/make: compat.c job.c main.c make.1 make.h targ.c Log Message: make: record exit status in GNode SetErrorVars can now set .ERROR_EXIT which allows a .ERROR target to ignore the case of .ERROR_EXIT == 6 which means failure happened elsewhere. Reviewed by: To generate a diff of this commit: cvs rdiff -u -r1.253 -r1.254 src/usr.bin/make/compat.c cvs rdiff -u -r1.466 -r1.467 src/usr.bin/make/job.c cvs rdiff -u -r1.611 -r1.612 src/usr.bin/make/main.c cvs rdiff -u -r1.374 -r1.375 src/usr.bin/make/make.1 cvs rdiff -u -r1.328 -r1.329 src/usr.bin/make/make.h cvs rdiff -u -r1.179 -r1.180 src/usr.bin/make/targ.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/compat.c diff -u src/usr.bin/make/compat.c:1.253 src/usr.bin/make/compat.c:1.254 --- src/usr.bin/make/compat.c:1.253 Fri Mar 1 16:41:42 2024 +++ src/usr.bin/make/compat.c Sun Mar 10 02:53:37 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.253 2024/03/01 16:41:42 sjg Exp $ */ +/* $NetBSD: compat.c,v 1.254 2024/03/10 02:53:37 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.253 2024/03/01 16:41:42 sjg Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.254 2024/03/10 02:53:37 sjg Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -390,6 +390,8 @@ Compat_RunCommand(const char *cmdp, GNod meta_job_error(NULL, gn, false, status); #endif gn->made = ERROR; + if (WIFEXITED(reason)) +gn->exit_status = status; if (opts.keepgoing) { /* * Abort the current target, Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.466 src/usr.bin/make/job.c:1.467 --- src/usr.bin/make/job.c:1.466 Fri Mar 1 16:41:42 2024 +++ src/usr.bin/make/job.c Sun Mar 10 02:53:37 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.466 2024/03/01 16:41:42 sjg Exp $ */ +/* $NetBSD: job.c,v 1.467 2024/03/10 02:53:37 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -141,7 +141,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.466 2024/03/01 16:41:42 sjg Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.467 2024/03/10 02:53:37 sjg Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -2044,6 +2044,8 @@ JobReapChild(pid_t pid, int status, bool job->status = JOB_ST_FINISHED; job->exit_status = status; + if (WIFEXITED(status)) + job->node->exit_status = WEXITSTATUS(status); JobFinish(job, status); } Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.611 src/usr.bin/make/main.c:1.612 --- src/usr.bin/make/main.c:1.611 Fri Mar 1 16:41:42 2024 +++ src/usr.bin/make/main.c Sun Mar 10 02:53:37 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.611 2024/03/01 16:41:42 sjg Exp $ */ +/* $NetBSD: main.c,v 1.612 2024/03/10 02:53:37 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.611 2024/03/01 16:41:42 sjg Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.612 2024/03/10 02:53:37 sjg Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -2037,10 +2037,13 @@ static void SetErrorVars(GNode *gn) { StringListNode *ln; + char sts[16]; /* * We can print this even if there is no .ERROR target. */ + snprintf(sts, sizeof(sts), "%d", gn->exit_status); + Global_Set(".ERROR_EXIT", sts); Global_Set(".ERROR_TARGET", gn->name); Global_Delete(".ERROR_CMD"); Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.374 src/usr.bin/make/make.1:1.375 --- src/usr.bin/make/make.1:1.374 Thu Jan 25 21:00:59 2024 +++ src/usr.bin/make/make.1 Sun Mar 10 02:53:37 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.374 2024/01/25 21:00:59 sjg Exp $ +.\" $NetBSD: make.1,v 1.375 2024/03/10 02:53:37 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd January 24, 2024 +.Dd March 9, 2024 .Dt MAKE 1 .Os .Sh NAME @@ -879,6 +879,9 @@ Is used in error handling, see .It Va .ERROR_CWD Is used in error handling, see .Va MAKE_PRINT_VAR_ON_ERROR . +.It Va .ERROR_EXIT +Is used in error handling, see +.Va MAKE_PRINT_VAR_ON_ERROR . .It Va .ERROR_META_FILE Is used in error handling in .Dq meta @@ -1185,6 +1188,8 @@ When stops due to an error, it sets .Sq Va .ERROR_TARGET to the name of the target that failed, +.Sq Va .ERROR_EXIT +to the exit status of the failed target, .Sq Va
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun Mar 10 02:53:38 UTC 2024 Modified Files: src/usr.bin/make: compat.c job.c main.c make.1 make.h targ.c Log Message: make: record exit status in GNode SetErrorVars can now set .ERROR_EXIT which allows a .ERROR target to ignore the case of .ERROR_EXIT == 6 which means failure happened elsewhere. Reviewed by: To generate a diff of this commit: cvs rdiff -u -r1.253 -r1.254 src/usr.bin/make/compat.c cvs rdiff -u -r1.466 -r1.467 src/usr.bin/make/job.c cvs rdiff -u -r1.611 -r1.612 src/usr.bin/make/main.c cvs rdiff -u -r1.374 -r1.375 src/usr.bin/make/make.1 cvs rdiff -u -r1.328 -r1.329 src/usr.bin/make/make.h cvs rdiff -u -r1.179 -r1.180 src/usr.bin/make/targ.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Sat Mar 9 23:55:11 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: expr_fold.c src/usr.bin/xlint/lint1: tree.c Log Message: lint: fix excessive overflow warning after division by zero To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/expr_fold.c cvs rdiff -u -r1.613 -r1.614 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Sat Mar 9 23:55:11 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: expr_fold.c src/usr.bin/xlint/lint1: tree.c Log Message: lint: fix excessive overflow warning after division by zero To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/expr_fold.c cvs rdiff -u -r1.613 -r1.614 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/expr_fold.c diff -u src/tests/usr.bin/xlint/lint1/expr_fold.c:1.11 src/tests/usr.bin/xlint/lint1/expr_fold.c:1.12 --- src/tests/usr.bin/xlint/lint1/expr_fold.c:1.11 Sat Jan 6 15:05:24 2024 +++ src/tests/usr.bin/xlint/lint1/expr_fold.c Sat Mar 9 23:55:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: expr_fold.c,v 1.11 2024/01/06 15:05:24 rillig Exp $ */ +/* $NetBSD: expr_fold.c,v 1.12 2024/03/09 23:55:11 rillig Exp $ */ # 3 "expr_fold.c" /* @@ -114,9 +114,7 @@ fold_mult(void) void fold_div(void) { - /* expect+3: error: division by 0 [139] */ - /* XXX: The following message is redundant. */ - /* expect+1: warning: operator '/' produces integer overflow [141] */ + /* expect+1: error: division by 0 [139] */ take_int(0 / 0); /* expect+1: warning: conversion of 'long' to 'int' is out of range, arg #1 [295] */ Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.613 src/usr.bin/xlint/lint1/tree.c:1.614 --- src/usr.bin/xlint/lint1/tree.c:1.613 Sat Mar 9 14:54:14 2024 +++ src/usr.bin/xlint/lint1/tree.c Sat Mar 9 23:55:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.613 2024/03/09 14:54:14 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.614 2024/03/09 23:55:11 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.613 2024/03/09 14:54:14 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.614 2024/03/09 23:55:11 rillig Exp $"); #endif #include @@ -809,6 +809,8 @@ fold_constant_integer(tnode_t *tn) ur = sr = tn->u.ops.right->u.value.u.integer; uint64_t mask = value_bits(size_in_bits(t)); + int64_t max_value = (int64_t)(mask >> 1); + int64_t min_value = -max_value - 1; bool ovfl = false; int64_t si; @@ -841,11 +843,9 @@ fold_constant_integer(tnode_t *tn) if (sr == 0) { /* division by 0 */ error(139); - si = utyp ? -1 : INT64_MAX; - } else if (!utyp - && (sl & mask) == (mask ^ (mask >> 1)) && sr == -1) { - /* operator '%s' produces integer overflow */ - warning(141, op_name(DIV)); + si = utyp ? -1 : max_value; + } else if (!utyp && sl == min_value && sr == -1) { + ovfl = true; si = sl; } else si = utyp ? (int64_t)(ul / ur) : sl / sr;
CVS commit: src/sys/dev/pci
Module Name:src Committed By: mrg Date: Sat Mar 9 22:03:32 UTC 2024 Modified Files: src/sys/dev/pci: if_aq.c Log Message: aq(4): always poll for link status some devices don't have working link status and rather than have a likely incomplete list of issues, always poll as well as use the interrupt if possible. fixes link status on this device: aq0 at pci5 dev 0 function 0: Aquantia AQC107 10 Gigabit Network Adapter (rev. 0x02) aq0: Atlantic revision B1, F/W version 3.1.88 (was otherwise functional, just didn't report status, which likely meant eg, dhcpcd would be upset?) idea via mlelstv@ from linux. remove sc_detect_linkstat and rename sc_poll_linkstat to sc_no_link_intr, as the meaning has changed. simplify the signature for aq_setup_msix() and aq_establish_msix_intr(), removing forward decls that aren't required. obsolete AQ_FORCE_POLL_LINKSTAT. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/dev/pci/if_aq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_aq.c diff -u src/sys/dev/pci/if_aq.c:1.46 src/sys/dev/pci/if_aq.c:1.47 --- src/sys/dev/pci/if_aq.c:1.46 Wed Feb 7 04:20:28 2024 +++ src/sys/dev/pci/if_aq.c Sat Mar 9 22:03:32 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: if_aq.c,v 1.46 2024/02/07 04:20:28 msaitoh Exp $ */ +/* $NetBSD: if_aq.c,v 1.47 2024/03/09 22:03:32 mrg Exp $ */ /** * aQuantia Corporation Network Driver @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.46 2024/02/07 04:20:28 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.47 2024/03/09 22:03:32 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_if_aq.h" @@ -1330,8 +1330,7 @@ struct aq_softc { int sc_rx_irq[AQ_RSSQUEUE_MAX]; int sc_linkstat_irq; bool sc_use_txrx_independent_intr; - bool sc_poll_linkstat; - bool sc_detect_linkstat; + bool sc_no_link_intr; #if NSYSMON_ENVSYS > 0 struct sysmon_envsys *sc_sme; @@ -1443,11 +1442,9 @@ static int aq_match(device_t, cfdata_t, static void aq_attach(device_t, device_t, void *); static int aq_detach(device_t, int); -static int aq_setup_msix(struct aq_softc *, struct pci_attach_args *, int, -bool, bool); +static int aq_setup_msix(struct aq_softc *, struct pci_attach_args *); static int aq_setup_legacy(struct aq_softc *, struct pci_attach_args *, pci_intr_type_t); -static int aq_establish_msix_intr(struct aq_softc *, bool, bool); static int aq_ifmedia_change(struct ifnet * const); static void aq_ifmedia_status(struct ifnet * const, struct ifmediareq *); @@ -1784,67 +1781,57 @@ aq_attach(device_t parent, device_t self if (msixcount >= (sc->sc_nqueues * 2 + 1)) { /* TX intrs + RX intrs + LINKSTAT intrs */ sc->sc_use_txrx_independent_intr = true; - sc->sc_poll_linkstat = false; sc->sc_msix = true; } else if (msixcount >= (sc->sc_nqueues * 2)) { /* TX intrs + RX intrs */ sc->sc_use_txrx_independent_intr = true; - sc->sc_poll_linkstat = true; sc->sc_msix = true; } else #endif if (msixcount >= (sc->sc_nqueues + 1)) { /* TX/RX intrs LINKSTAT intrs */ sc->sc_use_txrx_independent_intr = false; - sc->sc_poll_linkstat = false; sc->sc_msix = true; } else if (msixcount >= sc->sc_nqueues) { /* TX/RX intrs */ sc->sc_use_txrx_independent_intr = false; - sc->sc_poll_linkstat = true; + sc->sc_no_link_intr = true; sc->sc_msix = true; } else { /* giving up using MSI-X */ sc->sc_msix = false; } - /* on AQ1a0, AQ2, or FIBRE, linkstat interrupt doesn't work? */ - if (aqp->aq_media_type == AQ_MEDIA_TYPE_FIBRE || - (HWTYPE_AQ1_P(sc) && FW_VERSION_MAJOR(sc) == 1) || - HWTYPE_AQ2_P(sc)) - sc->sc_poll_linkstat = true; - -#ifdef AQ_FORCE_POLL_LINKSTAT - sc->sc_poll_linkstat = true; -#endif - aprint_debug_dev(sc->sc_dev, "ncpu=%d, pci_msix_count=%d." " allocate %d interrupts for %d%s queues%s\n", ncpu, msixcount, (sc->sc_use_txrx_independent_intr ? (sc->sc_nqueues * 2) : sc->sc_nqueues) + - (sc->sc_poll_linkstat ? 0 : 1), + (sc->sc_no_link_intr ? 0 : 1), sc->sc_nqueues, sc->sc_use_txrx_independent_intr ? "*2" : "", - sc->sc_poll_linkstat ? "" : ", and link status"); + (sc->sc_no_link_intr) ? "" : ", and link status"); if (sc->sc_msix) - error = aq_setup_msix(sc, pa, sc->sc_nqueues, - sc->sc_use_txrx_independent_intr, !sc->sc_poll_linkstat); + error = aq_setup_msix(sc, pa); else error = ENODEV; if (error != 0) { /* if MSI-X failed, fallback to MSI with single queue */ sc->sc_use_txrx_independent_intr = false; - sc->sc_poll_linkstat = false; sc->sc_msix = false; sc->sc_nqueues = 1; + sc->sc_no_link_intr = false; + aprint_debug_dev(sc->sc_dev, "MSI-X failed: %d, trying MSI", + error); error = aq_setup_legacy(sc, pa, PCI_INTR_TYPE_MSI); } if (error != 0) { /* if MSI failed, fallback to INTx */ + aprint_debug_dev(sc->sc_dev,
CVS commit: src/sys/dev/pci
Module Name:src Committed By: mrg Date: Sat Mar 9 22:03:32 UTC 2024 Modified Files: src/sys/dev/pci: if_aq.c Log Message: aq(4): always poll for link status some devices don't have working link status and rather than have a likely incomplete list of issues, always poll as well as use the interrupt if possible. fixes link status on this device: aq0 at pci5 dev 0 function 0: Aquantia AQC107 10 Gigabit Network Adapter (rev. 0x02) aq0: Atlantic revision B1, F/W version 3.1.88 (was otherwise functional, just didn't report status, which likely meant eg, dhcpcd would be upset?) idea via mlelstv@ from linux. remove sc_detect_linkstat and rename sc_poll_linkstat to sc_no_link_intr, as the meaning has changed. simplify the signature for aq_setup_msix() and aq_establish_msix_intr(), removing forward decls that aren't required. obsolete AQ_FORCE_POLL_LINKSTAT. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/dev/pci/if_aq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man3
Module Name:src Committed By: gutteridge Date: Sat Mar 9 18:43:39 UTC 2024 Modified Files: src/share/man/man3: dlfcn.3 Log Message: dlfcn.3: remove duplicated dlopen() entry To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/share/man/man3/dlfcn.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man3
Module Name:src Committed By: gutteridge Date: Sat Mar 9 18:43:39 UTC 2024 Modified Files: src/share/man/man3: dlfcn.3 Log Message: dlfcn.3: remove duplicated dlopen() entry To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/share/man/man3/dlfcn.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man3/dlfcn.3 diff -u src/share/man/man3/dlfcn.3:1.41 src/share/man/man3/dlfcn.3:1.42 --- src/share/man/man3/dlfcn.3:1.41 Sat Mar 9 15:21:38 2024 +++ src/share/man/man3/dlfcn.3 Sat Mar 9 18:43:39 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: dlfcn.3,v 1.41 2024/03/09 15:21:38 uwe Exp $ +.\" $NetBSD: dlfcn.3,v 1.42 2024/03/09 18:43:39 gutteridge Exp $ .\" .\" Copyright (c) 1998 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -50,8 +50,6 @@ dynamically linked program automatically .Fn _dlauxinfo "void" .Ft "void *" .Fn dlopen "const char *path" "int mode" -.Ft "void *" -.Fn dlopen "const char *path" "int mode" .Ft "int" .Fn dlclose "void *handle" .Ft "void *"
CVS commit: [netbsd-10] src/doc
Module Name:src Committed By: bouyer Date: Sat Mar 9 18:27:00 UTC 2024 Modified Files: src/doc [netbsd-10]: CHANGES-10.0 Log Message: Ticket 623 To generate a diff of this commit: cvs rdiff -u -r1.1.2.207 -r1.1.2.208 src/doc/CHANGES-10.0 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-10.0 diff -u src/doc/CHANGES-10.0:1.1.2.207 src/doc/CHANGES-10.0:1.1.2.208 --- src/doc/CHANGES-10.0:1.1.2.207 Tue Feb 27 05:27:39 2024 +++ src/doc/CHANGES-10.0 Sat Mar 9 18:26:59 2024 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-10.0,v 1.1.2.207 2024/02/27 05:27:39 martin Exp $ +# $NetBSD: CHANGES-10.0,v 1.1.2.208 2024/03/09 18:26:59 bouyer Exp $ A complete list of changes from the initial NetBSD 10.0 branch on 2022-12-16 until the 10.0 release: @@ -21256,3 +21256,11 @@ sys/sys/param.h (manually edited) Welcome to 10.0_RC5 +external/bsd/tcpdump/dist/print-ppp.c patch + + tcpdump(8): apply upstream fix for CVE-2020-8037: + the ppp decapsulator in tcpdump 4.9.3 can be convinced + to allocate a large amount of memory. + fixes PR 57586 + [martin, ticket #623] +
CVS commit: [netbsd-10] src/doc
Module Name:src Committed By: bouyer Date: Sat Mar 9 18:27:00 UTC 2024 Modified Files: src/doc [netbsd-10]: CHANGES-10.0 Log Message: Ticket 623 To generate a diff of this commit: cvs rdiff -u -r1.1.2.207 -r1.1.2.208 src/doc/CHANGES-10.0 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-10] src/external/bsd/tcpdump/dist
Module Name:src Committed By: bouyer Date: Sat Mar 9 18:25:30 UTC 2024 Modified Files: src/external/bsd/tcpdump/dist [netbsd-10]: print-ppp.c Log Message: Apply patch, requested by martin in ticket #623: external/bsd/tcpdump/dist/print-ppp.c patch Apply upstream commit 32027e199368dad9508965aae8cd8de5b6ab5231 to fix CVE-2020-803: PPP: When un-escaping, don't allocate a too-large buffer. The buffer should be big enough to hold the captured data, but it doesn't need to be big enough to hold the entire on-the-network packet, if we haven't captured all of it. fixes PR 57586 To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.9.14.1 src/external/bsd/tcpdump/dist/print-ppp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-10] src/external/bsd/tcpdump/dist
Module Name:src Committed By: bouyer Date: Sat Mar 9 18:25:30 UTC 2024 Modified Files: src/external/bsd/tcpdump/dist [netbsd-10]: print-ppp.c Log Message: Apply patch, requested by martin in ticket #623: external/bsd/tcpdump/dist/print-ppp.c patch Apply upstream commit 32027e199368dad9508965aae8cd8de5b6ab5231 to fix CVE-2020-803: PPP: When un-escaping, don't allocate a too-large buffer. The buffer should be big enough to hold the captured data, but it doesn't need to be big enough to hold the entire on-the-network packet, if we haven't captured all of it. fixes PR 57586 To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.9.14.1 src/external/bsd/tcpdump/dist/print-ppp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/tcpdump/dist/print-ppp.c diff -u src/external/bsd/tcpdump/dist/print-ppp.c:1.9 src/external/bsd/tcpdump/dist/print-ppp.c:1.9.14.1 --- src/external/bsd/tcpdump/dist/print-ppp.c:1.9 Fri Sep 8 14:01:13 2017 +++ src/external/bsd/tcpdump/dist/print-ppp.c Sat Mar 9 18:25:30 2024 @@ -33,7 +33,7 @@ #include #ifndef lint -__RCSID("$NetBSD: print-ppp.c,v 1.9 2017/09/08 14:01:13 christos Exp $"); +__RCSID("$NetBSD: print-ppp.c,v 1.9.14.1 2024/03/09 18:25:30 bouyer Exp $"); #endif #ifdef HAVE_CONFIG_H @@ -1372,19 +1372,29 @@ trunc: return 0; } +/* + * Un-escape RFC 1662 PPP in HDLC-like framing, with octet escapes. + * The length argument is the on-the-wire length, not the captured + * length; we can only un-escape the captured part. + */ static void ppp_hdlc(netdissect_options *ndo, const u_char *p, int length) { + u_int caplen = ndo->ndo_snapend - p; u_char *b, *t, c; const u_char *s; - int i, proto; + u_int i; + int proto; const void *se; + if (caplen == 0) + return; + if (length <= 0) return; - b = (u_char *)malloc(length); + b = (u_char *)malloc(caplen); if (b == NULL) return; @@ -1393,10 +1403,10 @@ ppp_hdlc(netdissect_options *ndo, * Do this so that we dont overwrite the original packet * contents. */ - for (s = p, t = b, i = length; i > 0 && ND_TTEST(*s); i--) { + for (s = p, t = b, i = caplen; i != 0; i--) { c = *s++; if (c == 0x7d) { - if (i <= 1 || !ND_TTEST(*s)) + if (i <= 1) break; i--; c = *s++ ^ 0x20;
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Mar 9 17:34:01 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: platform_ilp32_int.c platform_ilp32_long.c platform_lp64.c Log Message: tests/lint: demonstrate integer overflow on lp64 platforms To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/platform_ilp32_int.c cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/platform_ilp32_long.c cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/platform_lp64.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/platform_ilp32_int.c diff -u src/tests/usr.bin/xlint/lint1/platform_ilp32_int.c:1.3 src/tests/usr.bin/xlint/lint1/platform_ilp32_int.c:1.4 --- src/tests/usr.bin/xlint/lint1/platform_ilp32_int.c:1.3 Sat Mar 9 16:47:09 2024 +++ src/tests/usr.bin/xlint/lint1/platform_ilp32_int.c Sat Mar 9 17:34:01 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: platform_ilp32_int.c,v 1.3 2024/03/09 16:47:09 rillig Exp $ */ +/* $NetBSD: platform_ilp32_int.c,v 1.4 2024/03/09 17:34:01 rillig Exp $ */ # 3 "platform_ilp32_int.c" /* @@ -28,24 +28,75 @@ convert_between_int_and_long(void) ul32 = u32; } -char ch; +unsigned char u8; +unsigned long long u64; +unsigned char u8_buf[20]; +unsigned long long u64_buf[20]; void array_index(void) { - static char buf[20]; + /* expect+1: warning: array subscript cannot be > 19: 16777215 [168] */ + u8 += u8_buf[0x00ff]; /* expect+1: warning: array subscript cannot be > 19: 2147483647 [168] */ - ch += buf[2147483647]; + u8 += u8_buf[0x7fff]; /* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */ /* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */ - ch += buf[2147483648]; + u8 += u8_buf[2147483648]; /* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ /* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */ - ch += buf[0x8000]; + u8 += u8_buf[0x8000]; /* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ /* expect+1: warning: array subscript cannot be negative: -1 [167] */ - ch += buf[0x]; + u8 += u8_buf[0x]; + /* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ + /* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */ + u8 += u8_buf[0x8000]; + /* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + u8 += u8_buf[0x]; + /* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */ + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + u8 += u8_buf[0x00ff]; + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + u8 += u8_buf[0x]; + + /* expect+1: warning: array subscript cannot be > 19: 16777215 [168] */ + u64 += u64_buf[0x00ff]; + /* expect+2: warning: operator '*' produces integer overflow [141] */ + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + u64 += u64_buf[0x7fff]; + /* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */ + /* expect+1: warning: operator '*' produces integer overflow [141] */ + u64 += u64_buf[2147483648]; + /* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ + /* expect+1: warning: operator '*' produces integer overflow [141] */ + u64 += u64_buf[0x8000]; + /* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + u64 += u64_buf[0x]; + /* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ + /* expect+1: warning: operator '*' produces integer overflow [141] */ + u64 += u64_buf[0x8000]; + /* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + u64 += u64_buf[0x]; + /* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */ + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + u64 += u64_buf[0x00ff]; + /* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */ + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + u64 += u64_buf[0x0fff]; + /* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */ + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + u64 += u64_buf[0x1fff]; + /* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */ + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + u64 +=
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Mar 9 17:34:01 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: platform_ilp32_int.c platform_ilp32_long.c platform_lp64.c Log Message: tests/lint: demonstrate integer overflow on lp64 platforms To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/platform_ilp32_int.c cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/platform_ilp32_long.c cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/platform_lp64.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Mar 9 16:47:10 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: platform_ilp32_int.c platform_ilp32_long.c platform_lp64.c Log Message: tests/lint: test check for out-of-bounds array index To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/platform_ilp32_int.c cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/platform_ilp32_long.c cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/platform_lp64.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/platform_ilp32_int.c diff -u src/tests/usr.bin/xlint/lint1/platform_ilp32_int.c:1.2 src/tests/usr.bin/xlint/lint1/platform_ilp32_int.c:1.3 --- src/tests/usr.bin/xlint/lint1/platform_ilp32_int.c:1.2 Tue Mar 28 14:44:35 2023 +++ src/tests/usr.bin/xlint/lint1/platform_ilp32_int.c Sat Mar 9 16:47:09 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: platform_ilp32_int.c,v 1.2 2023/03/28 14:44:35 rillig Exp $ */ +/* $NetBSD: platform_ilp32_int.c,v 1.3 2024/03/09 16:47:09 rillig Exp $ */ # 3 "platform_ilp32_int.c" /* @@ -27,3 +27,25 @@ convert_between_int_and_long(void) u32 = ul32; ul32 = u32; } + +char ch; + +void +array_index(void) +{ + static char buf[20]; + + /* expect+1: warning: array subscript cannot be > 19: 2147483647 [168] */ + ch += buf[2147483647]; + /* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */ + /* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */ + ch += buf[2147483648]; + /* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ + /* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */ + ch += buf[0x8000]; + /* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + ch += buf[0x]; + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + ch += buf[0x]; +} Index: src/tests/usr.bin/xlint/lint1/platform_ilp32_long.c diff -u src/tests/usr.bin/xlint/lint1/platform_ilp32_long.c:1.4 src/tests/usr.bin/xlint/lint1/platform_ilp32_long.c:1.5 --- src/tests/usr.bin/xlint/lint1/platform_ilp32_long.c:1.4 Sat Jul 8 15:26:25 2023 +++ src/tests/usr.bin/xlint/lint1/platform_ilp32_long.c Sat Mar 9 16:47:09 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: platform_ilp32_long.c,v 1.4 2023/07/08 15:26:25 rillig Exp $ */ +/* $NetBSD: platform_ilp32_long.c,v 1.5 2024/03/09 16:47:09 rillig Exp $ */ # 3 "platform_ilp32_long.c" /* @@ -36,3 +36,25 @@ convert_between_int_and_long(void) u32 = ul32; ul32 = u32; } + +char ch; + +void +array_index(void) +{ + static char buf[20]; + + /* expect+1: warning: array subscript cannot be > 19: 2147483647 [168] */ + ch += buf[2147483647]; + /* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */ + /* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */ + ch += buf[2147483648]; + /* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */ + /* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */ + ch += buf[0x8000]; + /* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */ + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + ch += buf[0x]; + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + ch += buf[0x]; +} Index: src/tests/usr.bin/xlint/lint1/platform_lp64.c diff -u src/tests/usr.bin/xlint/lint1/platform_lp64.c:1.7 src/tests/usr.bin/xlint/lint1/platform_lp64.c:1.8 --- src/tests/usr.bin/xlint/lint1/platform_lp64.c:1.7 Sat Jul 8 12:45:43 2023 +++ src/tests/usr.bin/xlint/lint1/platform_lp64.c Sat Mar 9 16:47:09 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: platform_lp64.c,v 1.7 2023/07/08 12:45:43 rillig Exp $ */ +/* $NetBSD: platform_lp64.c,v 1.8 2024/03/09 16:47:09 rillig Exp $ */ # 3 "platform_lp64.c" /* @@ -44,3 +44,22 @@ convert_128(void) /* expect+1: warning: conversion from '__uint128_t' to 'unsigned int' may lose accuracy [132] */ u32 = u128; } + +char ch; + +void +array_index(void) +{ + static char buf[20]; + + /* expect+1: warning: array subscript cannot be > 19: 2147483647 [168] */ + ch += buf[2147483647]; + /* expect+1: warning: array subscript cannot be > 19: 2147483648 [168] */ + ch += buf[2147483648]; + /* expect+1: warning: array subscript cannot be > 19: 2147483648 [168] */ + ch += buf[0x8000]; + /* expect+1: warning: array subscript cannot be > 19: 4294967295 [168] */ + ch += buf[0x]; + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + ch += buf[0x]; +}
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Mar 9 16:47:10 UTC 2024 Modified Files: src/tests/usr.bin/xlint/lint1: platform_ilp32_int.c platform_ilp32_long.c platform_lp64.c Log Message: tests/lint: test check for out-of-bounds array index To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/platform_ilp32_int.c cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/platform_ilp32_long.c cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/platform_lp64.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man3
Module Name:src Committed By: uwe Date: Sat Mar 9 15:21:38 UTC 2024 Modified Files: src/share/man/man3: dlfcn.3 Log Message: dlfcn(3): touch up markup To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/share/man/man3/dlfcn.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man3/dlfcn.3 diff -u src/share/man/man3/dlfcn.3:1.40 src/share/man/man3/dlfcn.3:1.41 --- src/share/man/man3/dlfcn.3:1.40 Thu Mar 7 22:14:20 2024 +++ src/share/man/man3/dlfcn.3 Sat Mar 9 15:21:38 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: dlfcn.3,v 1.40 2024/03/07 22:14:20 christos Exp $ +.\" $NetBSD: dlfcn.3,v 1.41 2024/03/09 15:21:38 uwe Exp $ .\" .\" Copyright (c) 1998 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -74,7 +74,9 @@ The .Fn _dlauxinfo function returns a pointer to the .Xr elf 5 -array of AuxInfo structures for the current executable. +array of +.Vt AuxInfo +structures for the current executable. .Pp The .Fn dlopen @@ -88,14 +90,16 @@ only the path provided will be searched. When just a shared object name is specified, the same search rules apply that are used for .Dq intrinsic -shared object searches. +shared object searches .Po see .Xr ld.elf_so 1 -.Pc +.Pc . .Pp Shared libraries take the following form: -.Do lib Ns Ao name Ac Ns .so Ns Oo .xx Ns Oo .yy Oc Oc Dc . +.Sm off +.Ic lib\^ Ao Ar name Ac Ic .so Oo Ic \&. Ar xx\^ Oo Ic \&. Ar yy\^ Oc Oc . +.Sm on .Pp The shared object is mapped into the address space, relocated, and its external references are resolved in the same way as is done @@ -134,8 +138,9 @@ other objects. This is the default value if visibility is unspecified. .El .Pp -To specify both resolution time and visibility, bitwise inclusive OR one of -each of the above values together. +To specify both resolution time and visibility, bitwise inclusive +.Tn OR +one of each of the above values together. If an object was opened with .Dv RTLD_LOCAL and later opened with @@ -143,7 +148,9 @@ and later opened with then it is promoted to .Dv RTLD_GLOBAL . .Pp -Additionally, one of the following flags may be ORed into the +Additionally, one of the following flags may be +.Tn OR Ap ed +into the .Fa mode argument: .Bl -tag -width ".Dv RTLD_NODELETE" -offset indent @@ -272,8 +279,7 @@ is between the base address of the share symbol .Va _end in the same shared object. -If no object for which this condition holds -true can be found, +If no object for which this condition holds true can be found, .Fn dladdr will return 0. Otherwise, a non-zero value is returned and the @@ -295,11 +301,11 @@ typedef struct { .Ed .Pp The structure members are further described as follows: -.Bl -tag -width "Va" -.It Va dli_fname +.Bl -tag -width Fa +.It Fa dli_fname The pathname of the shared object containing the address .Fa addr . -.It Va dli_fbase +.It Fa dli_fbase The base address at which this shared object is loaded in the process address space. This may be zero if the symbol was found in the internally generated @@ -310,18 +316,19 @@ see .Xr link 5 .Pc which is not associated with a file. -.It Va dli_sname +.It Fa dli_sname points at the nul-terminated name of the selected symbol -.It Va dli_saddr +.It Fa dli_saddr is the actual address .Pq as it appears in the process address space of the symbol. .El .Pp -Note: both strings pointed at by -.Va dli_fname +.Em Note : +both strings pointed at by +.Fa dli_fname and -.Va dli_sname +.Fa dli_sname reside in memory private to the run-time linker module and should not be modified by the caller. .Pp @@ -353,11 +360,14 @@ a second time, immediately following a p .Dv NULL being returned. .Sh ERRORS -The error -.Dq Cannot dlopen non-loadable /usr/lib/libpthread.so.1 -is generated when a program -.Fn dlopen Ns No s -a module that needs libpthread but isn't linked against it itself. +.Bl -diag +.It Cannot dlopen non-loadable /usr/lib/libpthread.so.1 +A program tries to +.Fn dlopen +a module that needs +.Lb libpthread +but the program isn't linked against it itself. +.El .Sh SEE ALSO .Xr ld 1 , .Xr rtld 1 , @@ -366,4 +376,4 @@ a module that needs libpthread but isn't .Sh HISTORY Some of the .Nm dl* -functions first appeared in SunOS 4. +functions first appeared in SunOS\~4.
CVS commit: src/share/man/man3
Module Name:src Committed By: uwe Date: Sat Mar 9 15:21:38 UTC 2024 Modified Files: src/share/man/man3: dlfcn.3 Log Message: dlfcn(3): touch up markup To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/share/man/man3/dlfcn.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Mar 9 14:54:14 UTC 2024 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: merge duplicate code for checking array index To generate a diff of this commit: cvs rdiff -u -r1.612 -r1.613 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.612 src/usr.bin/xlint/lint1/tree.c:1.613 --- src/usr.bin/xlint/lint1/tree.c:1.612 Sat Mar 9 13:54:47 2024 +++ src/usr.bin/xlint/lint1/tree.c Sat Mar 9 14:54:14 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.612 2024/03/09 13:54:47 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.613 2024/03/09 14:54:14 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.612 2024/03/09 13:54:47 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.613 2024/03/09 14:54:14 rillig Exp $"); #endif #include @@ -4327,52 +4327,37 @@ expr(tnode_t *tn, bool vctx, bool cond, expr_free_all(); } -/* - * Checks the range of array indices, if possible. - * amper is set if only the address of the element is used. This - * means that the index is allowed to refer to the first element - * after the array. - */ +/* If the expression has the form '*(arr + idx)', check the array index. */ static void -check_array_index(tnode_t *tn, bool amper) +check_array_index(const tnode_t *indir, bool taking_address) { - lint_assert(has_operands(tn)); - const tnode_t *ln = tn->u.ops.left; - const tnode_t *rn = tn->u.ops.right; - - /* We can only check constant indices. */ - if (rn->tn_op != CON) - return; - - /* Return if the left node does not stem from an array. */ - if (ln->tn_op != ADDR) - return; - if (ln->u.ops.left->tn_op != STRING && ln->u.ops.left->tn_op != NAME) - return; - if (ln->u.ops.left->tn_type->t_tspec != ARRAY) - return; + const tnode_t *plus, *arr, *idx; - /* - * For incomplete array types, we can print a warning only if the index - * is negative. - */ - if (is_incomplete(ln->u.ops.left->tn_type) - && rn->u.value.u.integer >= 0) - return; + if (indir->tn_op == INDIR + && (plus = indir->u.ops.left, plus->tn_op == PLUS) + && plus->u.ops.left->tn_op == ADDR + && (arr = plus->u.ops.left->u.ops.left, true) + && (arr->tn_op == STRING || arr->tn_op == NAME) + && arr->tn_type->t_tspec == ARRAY + && (idx = plus->u.ops.right, idx->tn_op == CON) + && (!is_incomplete(arr->tn_type) || idx->u.value.u.integer < 0)) + goto proceed; + return; - int elsz = length_in_bits(ln->tn_type->t_subt, NULL); +proceed:; + int elsz = length_in_bits(arr->tn_type->t_subt, NULL); if (elsz == 0) return; elsz /= CHAR_SIZE; /* Change the unit of the index from bytes to element size. */ - int64_t con = is_uinteger(rn->tn_type->t_tspec) - ? (int64_t)((uint64_t)rn->u.value.u.integer / elsz) - : rn->u.value.u.integer / elsz; + int64_t con = is_uinteger(idx->tn_type->t_tspec) + ? (int64_t)((uint64_t)idx->u.value.u.integer / elsz) + : idx->u.value.u.integer / elsz; - int dim = ln->u.ops.left->tn_type->u.dimension + (amper ? 1 : 0); + int dim = arr->tn_type->u.dimension + (taking_address ? 1 : 0); - if (!is_uinteger(rn->tn_type->t_tspec) && con < 0) + if (!is_uinteger(idx->tn_type->t_tspec) && con < 0) /* array subscript cannot be negative: %ld */ warning(167, (long)con); else if (dim > 0 && (uint64_t)con >= (uint64_t)dim) @@ -4389,15 +4374,7 @@ check_expr_addr(const tnode_t *ln, bool mark_as_set(ln->u.sym); mark_as_used(ln->u.sym, fcall, szof); } - if (ln->tn_op == INDIR && ln->u.ops.left->tn_op == PLUS) - check_array_index(ln->u.ops.left, true); -} - -static void -check_expr_load(const tnode_t *ln) -{ - if (ln->tn_op == INDIR && ln->u.ops.left->tn_op == PLUS) - check_array_index(ln->u.ops.left, false); + check_array_index(ln, true); } /* @@ -4439,9 +4416,7 @@ check_expr_assign(const tnode_t *ln, boo if (ln->u.sym->s_scl == EXTERN) outusg(ln->u.sym); } - if (ln->tn_op == INDIR && ln->u.ops.left->tn_op == PLUS) - /* check the range of array indices */ - check_array_index(ln->u.ops.left, false); + check_array_index(ln, false); } static void @@ -4463,7 +4438,7 @@ check_expr_op(op_t op, const tnode_t *ln check_expr_addr(ln, szof, fcall); break; case LOAD: - check_expr_load(ln); + check_array_index(ln, false); /* FALLTHROUGH */ case INCBEF: case DECBEF:
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Mar 9 14:54:14 UTC 2024 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: merge duplicate code for checking array index To generate a diff of this commit: cvs rdiff -u -r1.612 -r1.613 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net
Module Name:src Committed By: riastradh Date: Sat Mar 9 13:55:28 UTC 2024 Modified Files: src/sys/net: if_tun.c Log Message: tun(4): Allow IPv6 packets with TUNSLMODE configured. PR kern/58013 To generate a diff of this commit: cvs rdiff -u -r1.174 -r1.175 src/sys/net/if_tun.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net
Module Name:src Committed By: riastradh Date: Sat Mar 9 13:55:28 UTC 2024 Modified Files: src/sys/net: if_tun.c Log Message: tun(4): Allow IPv6 packets with TUNSLMODE configured. PR kern/58013 To generate a diff of this commit: cvs rdiff -u -r1.174 -r1.175 src/sys/net/if_tun.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_tun.c diff -u src/sys/net/if_tun.c:1.174 src/sys/net/if_tun.c:1.175 --- src/sys/net/if_tun.c:1.174 Fri Dec 29 23:01:02 2023 +++ src/sys/net/if_tun.c Sat Mar 9 13:55:27 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: if_tun.c,v 1.174 2023/12/29 23:01:02 chs Exp $ */ +/* $NetBSD: if_tun.c,v 1.175 2024/03/09 13:55:27 riastradh Exp $ */ /* * Copyright (c) 1988, Julian Onions @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.174 2023/12/29 23:01:02 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.175 2024/03/09 13:55:27 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -604,9 +604,7 @@ tun_output(struct ifnet *ifp, struct mbu goto out; } memcpy(mtod(m0, char *), dst, dst->sa_len); - } - - if (tp->tun_flags & TUN_IFHEAD) { + } else if (tp->tun_flags & TUN_IFHEAD) { /* Prepend the address family */ M_PREPEND(m0, sizeof(*af), M_DONTWAIT); if (m0 == NULL) {
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Mar 9 13:54:47 UTC 2024 Modified Files: src/usr.bin/xlint/lint1: README.md cgram.y ckbool.c ckctype.c ckgetopt.c cksnprintb.c debug.c emit1.c func.c init.c lint1.h tree.c Log Message: lint: inline accessor macros for tnode_t To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.bin/xlint/lint1/README.md cvs rdiff -u -r1.490 -r1.491 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.29 -r1.30 src/usr.bin/xlint/lint1/ckbool.c cvs rdiff -u -r1.10 -r1.11 src/usr.bin/xlint/lint1/ckctype.c cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/lint1/ckgetopt.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/xlint/lint1/cksnprintb.c cvs rdiff -u -r1.72 -r1.73 src/usr.bin/xlint/lint1/debug.c cvs rdiff -u -r1.91 -r1.92 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.183 -r1.184 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.262 -r1.263 src/usr.bin/xlint/lint1/init.c cvs rdiff -u -r1.220 -r1.221 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.611 -r1.612 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Mar 9 13:54:47 UTC 2024 Modified Files: src/usr.bin/xlint/lint1: README.md cgram.y ckbool.c ckctype.c ckgetopt.c cksnprintb.c debug.c emit1.c func.c init.c lint1.h tree.c Log Message: lint: inline accessor macros for tnode_t To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.bin/xlint/lint1/README.md cvs rdiff -u -r1.490 -r1.491 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.29 -r1.30 src/usr.bin/xlint/lint1/ckbool.c cvs rdiff -u -r1.10 -r1.11 src/usr.bin/xlint/lint1/ckctype.c cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/lint1/ckgetopt.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/xlint/lint1/cksnprintb.c cvs rdiff -u -r1.72 -r1.73 src/usr.bin/xlint/lint1/debug.c cvs rdiff -u -r1.91 -r1.92 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.183 -r1.184 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.262 -r1.263 src/usr.bin/xlint/lint1/init.c cvs rdiff -u -r1.220 -r1.221 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.611 -r1.612 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/xlint/lint1/README.md diff -u src/usr.bin/xlint/lint1/README.md:1.15 src/usr.bin/xlint/lint1/README.md:1.16 --- src/usr.bin/xlint/lint1/README.md:1.15 Mon Feb 5 23:11:22 2024 +++ src/usr.bin/xlint/lint1/README.md Sat Mar 9 13:54:47 2024 @@ -1,4 +1,4 @@ -[//]: # ($NetBSD: README.md,v 1.15 2024/02/05 23:11:22 rillig Exp $) +[//]: # ($NetBSD: README.md,v 1.16 2024/03/09 13:54:47 rillig Exp $) # Introduction @@ -108,15 +108,15 @@ Each node has an operator that defines w The operators and their properties are defined in `oper.c`. Some examples for operators: -| Operator | Meaning| -|--|| -| CON | compile-time constant in `tn_val` | -| NAME | references the identifier in `tn_sym` | -| UPLUS| the unary operator `+tn_left` | -| PLUS | the binary operator `tn_left + tn_right` | -| CALL | a direct function call | -| ICALL| an indirect function call | -| CVT | an implicit conversion or an explicit cast | +| Operator | Meaning| +|--|| +| CON | compile-time constant in `u.value` | +| NAME | references the identifier in `u.sym` | +| UPLUS| the unary operator `+u.ops.left` | +| PLUS | the binary operator `u.ops.left + u.ops.right` | +| CALL | a direct function call | +| ICALL| an indirect function call | +| CVT | an implicit conversion or an explicit cast | As an example, the expression `strcmp(names[i], "name")` has this internal structure: Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.490 src/usr.bin/xlint/lint1/cgram.y:1.491 --- src/usr.bin/xlint/lint1/cgram.y:1.490 Sat Mar 9 10:41:11 2024 +++ src/usr.bin/xlint/lint1/cgram.y Sat Mar 9 13:54:47 2024 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.490 2024/03/09 10:41:11 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.491 2024/03/09 13:54:47 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: cgram.y,v 1.490 2024/03/09 10:41:11 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.491 2024/03/09 13:54:47 rillig Exp $"); #endif #include @@ -625,7 +625,7 @@ gcc_statement_expr_item: } else { /* XXX: do that only on the last name */ if ($1->tn_op == NAME) -$1->tn_sym->s_used = true; +$1->u.sym->s_used = true; expr($1, false, false, false, false); suppress_fallthrough = false; $$ = $1; Index: src/usr.bin/xlint/lint1/ckbool.c diff -u src/usr.bin/xlint/lint1/ckbool.c:1.29 src/usr.bin/xlint/lint1/ckbool.c:1.30 --- src/usr.bin/xlint/lint1/ckbool.c:1.29 Sat Feb 3 12:57:12 2024 +++ src/usr.bin/xlint/lint1/ckbool.c Sat Mar 9 13:54:47 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ckbool.c,v 1.29 2024/02/03 12:57:12 rillig Exp $ */ +/* $NetBSD: ckbool.c,v 1.30 2024/03/09 13:54:47 rillig Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: ckbool.c,v 1.29 2024/02/03 12:57:12 rillig Exp $"); +__RCSID("$NetBSD: ckbool.c,v 1.30 2024/03/09 13:54:47 rillig Exp $"); #endif #include @@ -73,7 +73,7 @@ is_symmetric_bool_or_other(op_t op) static bool is_int_constant_zero(const tnode_t *tn, tspec_t t) { - return t == INT && tn->tn_op == CON && tn->tn_val.u.integer == 0; + return t == INT && tn->tn_op == CON && tn->u.value.u.integer == 0; } static bool @@ -201,7 +201,7 @@ bool is_typeok_bool_compares_with_zero(const tnode_t
CVS commit: src/lib/libcrypt
Module Name:src Committed By: mlelstv Date: Sat Mar 9 13:48:50 UTC 2024 Modified Files: src/lib/libcrypt: crypt-argon2.c Log Message: Don't use uninitialized variable. Fixes PR 57895. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/lib/libcrypt/crypt-argon2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libcrypt/crypt-argon2.c diff -u src/lib/libcrypt/crypt-argon2.c:1.19 src/lib/libcrypt/crypt-argon2.c:1.20 --- src/lib/libcrypt/crypt-argon2.c:1.19 Sun May 29 12:15:00 2022 +++ src/lib/libcrypt/crypt-argon2.c Sat Mar 9 13:48:50 2024 @@ -207,7 +207,7 @@ estimate_argon2_params(argon2_type atype if (clock_gettime(CLOCK_MONOTONIC, ) == -1) goto error; - for (; delta.tv_sec < 1 && time < ARGON2_MAX_TIME; ++time) { + for (; time < ARGON2_MAX_TIME; ++time) { if (argon2_hash(time, memory, threads, tmp_pwd, sizeof(tmp_pwd), tmp_salt, sizeof(tmp_salt), @@ -221,6 +221,8 @@ estimate_argon2_params(argon2_type atype if (timespeccmp(, , >)) break; /* broken system... */ timespecsub(, , ); + if (delta.tv_sec >= 1) +break; } } else { time = *etime;
CVS commit: src/lib/libcrypt
Module Name:src Committed By: mlelstv Date: Sat Mar 9 13:48:50 UTC 2024 Modified Files: src/lib/libcrypt: crypt-argon2.c Log Message: Don't use uninitialized variable. Fixes PR 57895. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/lib/libcrypt/crypt-argon2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint
Module Name:src Committed By: rillig Date: Sat Mar 9 13:20:55 UTC 2024 Modified Files: src/usr.bin/xlint/common: tyname.c src/usr.bin/xlint/lint1: debug.c decl.c emit1.c func.c init.c lint1.h tree.c Log Message: lint: inline accessor macros for type_t To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/usr.bin/xlint/common/tyname.c cvs rdiff -u -r1.71 -r1.72 src/usr.bin/xlint/lint1/debug.c cvs rdiff -u -r1.395 -r1.396 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.90 -r1.91 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.182 -r1.183 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.261 -r1.262 src/usr.bin/xlint/lint1/init.c cvs rdiff -u -r1.219 -r1.220 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.610 -r1.611 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/xlint/common/tyname.c diff -u src/usr.bin/xlint/common/tyname.c:1.61 src/usr.bin/xlint/common/tyname.c:1.62 --- src/usr.bin/xlint/common/tyname.c:1.61 Fri Feb 2 16:25:58 2024 +++ src/usr.bin/xlint/common/tyname.c Sat Mar 9 13:20:55 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: tyname.c,v 1.61 2024/02/02 16:25:58 rillig Exp $ */ +/* $NetBSD: tyname.c,v 1.62 2024/03/09 13:20:55 rillig Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tyname.c,v 1.61 2024/02/02 16:25:58 rillig Exp $"); +__RCSID("$NetBSD: tyname.c,v 1.62 2024/03/09 13:20:55 rillig Exp $"); #endif #include @@ -165,7 +165,7 @@ type_name_of_function(buffer *buf, const buf_add(buf, "("); if (tp->t_proto) { #if IS_LINT1 - const sym_t *param = tp->t_params; + const sym_t *param = tp->u.params; if (param == NULL) buf_add(buf, "void"); for (; param != NULL; param = param->s_next) { @@ -197,12 +197,12 @@ type_name_of_struct_or_union(buffer *buf { buf_add(buf, " "); #if IS_LINT1 - if (tp->t_sou->sou_tag->s_name == unnamed && - tp->t_sou->sou_first_typedef != NULL) { + if (tp->u.sou->sou_tag->s_name == unnamed && + tp->u.sou->sou_first_typedef != NULL) { buf_add(buf, "typedef "); - buf_add(buf, tp->t_sou->sou_first_typedef->s_name); + buf_add(buf, tp->u.sou->sou_first_typedef->s_name); } else { - buf_add(buf, tp->t_sou->sou_tag->s_name); + buf_add(buf, tp->u.sou->sou_tag->s_name); } #else buf_add(buf, tp->t_isuniqpos ? "*anonymous*" : tp->t_tag->h_name); @@ -214,12 +214,12 @@ type_name_of_enum(buffer *buf, const typ { buf_add(buf, " "); #if IS_LINT1 - if (tp->t_enum->en_tag->s_name == unnamed && - tp->t_enum->en_first_typedef != NULL) { + if (tp->u.enumer->en_tag->s_name == unnamed && + tp->u.enumer->en_first_typedef != NULL) { buf_add(buf, "typedef "); - buf_add(buf, tp->t_enum->en_first_typedef->s_name); + buf_add(buf, tp->u.enumer->en_first_typedef->s_name); } else { - buf_add(buf, tp->t_enum->en_tag->s_name); + buf_add(buf, tp->u.enumer->en_tag->s_name); } #else buf_add(buf, tp->t_isuniqpos ? "*anonymous*" : tp->t_tag->h_name); @@ -234,7 +234,7 @@ type_name_of_array(buffer *buf, const ty if (tp->t_incomplete_array) buf_add(buf, "unknown_size"); else - buf_add_int(buf, tp->t_dim); + buf_add_int(buf, tp->u.dimension); #else buf_add_int(buf, tp->t_dim); #endif @@ -263,7 +263,7 @@ type_name(const type_t *tp) buf_add(, "volatile "); #if IS_LINT1 - if (is_struct_or_union(t) && tp->t_sou->sou_incomplete) + if (is_struct_or_union(t) && tp->u.sou->sou_incomplete) buf_add(, "incomplete "); #endif buf_add(, tspec_name(t)); Index: src/usr.bin/xlint/lint1/debug.c diff -u src/usr.bin/xlint/lint1/debug.c:1.71 src/usr.bin/xlint/lint1/debug.c:1.72 --- src/usr.bin/xlint/lint1/debug.c:1.71 Mon Feb 5 23:11:22 2024 +++ src/usr.bin/xlint/lint1/debug.c Sat Mar 9 13:20:55 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: debug.c,v 1.71 2024/02/05 23:11:22 rillig Exp $ */ +/* $NetBSD: debug.c,v 1.72 2024/03/09 13:20:55 rillig Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: debug.c,v 1.71 2024/02/05 23:11:22 rillig Exp $"); +__RCSID("$NetBSD: debug.c,v 1.72 2024/03/09 13:20:55 rillig Exp $"); #endif #include @@ -156,10 +156,10 @@ debug_type_details(const type_t *tp) if (is_struct_or_union(tp->t_tspec)) { debug_indent_inc(); debug_step("size %u bits, align %u bits, %s", - tp->t_sou->sou_size_in_bits, tp->t_sou->sou_align_in_bits, - tp->t_sou->sou_incomplete ? "incomplete" : "complete"); + tp->u.sou->sou_size_in_bits, tp->u.sou->sou_align_in_bits, + tp->u.sou->sou_incomplete ? "incomplete" : "complete"); - for (const sym_t *mem = tp->t_sou->sou_first_member; + for (const sym_t *mem = tp->u.sou->sou_first_member; mem != NULL; mem = mem->s_next) { debug_sym("", mem, "\n"); debug_type_details(mem->s_type); @@ -168,7 +168,7 @@
CVS commit: src/usr.bin/xlint
Module Name:src Committed By: rillig Date: Sat Mar 9 13:20:55 UTC 2024 Modified Files: src/usr.bin/xlint/common: tyname.c src/usr.bin/xlint/lint1: debug.c decl.c emit1.c func.c init.c lint1.h tree.c Log Message: lint: inline accessor macros for type_t To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/usr.bin/xlint/common/tyname.c cvs rdiff -u -r1.71 -r1.72 src/usr.bin/xlint/lint1/debug.c cvs rdiff -u -r1.395 -r1.396 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.90 -r1.91 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.182 -r1.183 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.261 -r1.262 src/usr.bin/xlint/lint1/init.c cvs rdiff -u -r1.219 -r1.220 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.610 -r1.611 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man4
Module Name:src Committed By: riastradh Date: Sat Mar 9 12:36:07 UTC 2024 Modified Files: src/share/man/man4: wg.4 Log Message: wg(4): Spruce up example a bit. - Suggest umask so the private keys aren't world readable. - Suggest use of pre-shared key files. - Use TEST-NET-1 and TEST-NET-2 addresses for the example instead of real publicly routable addresses. Holding off on adding IPv6 example until the tun(4) issue is fixed (PR bin/58013). PR misc/58015 To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/wg.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/wg.4 diff -u src/share/man/man4/wg.4:1.6 src/share/man/man4/wg.4:1.7 --- src/share/man/man4/wg.4:1.6 Mon Aug 31 20:20:22 2020 +++ src/share/man/man4/wg.4 Sat Mar 9 12:36:07 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: wg.4,v 1.6 2020/08/31 20:20:22 riastradh Exp $ +.\" $NetBSD: wg.4,v 1.7 2024/03/09 12:36:07 riastradh Exp $ .\" .\" Copyright (c) 2020 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -75,7 +75,7 @@ endpoint IP address outside the tunnel. .Sh EXAMPLES Typical network topology: .Bd -literal -offset abcd -wm0 = 1.2.3.4 bge0 = 4.3.2.1 +wm0 = 192.0.2.123 bge0 = 198.51.100.45 Stationary server: Roaming client: +-++-+ @@ -95,17 +95,24 @@ Stationary server: .Pp Generate key pairs on A and B: .Bd -literal -offset abcd -A# wg-keygen > /etc/wg/wg0 +A# (umask 0077; wg-keygen > /etc/wg/wg0) A# wg-keygen --pub < /etc/wg/wg0 > /etc/wg/wg0.pub A# cat /etc/wg/wg0.pub N+B4Nelg+4ysvbLW3qenxIwrJVE9MdjMyqrIisH7V0Y= -B# wg-keygen > /etc/wg/wg0 +B# (umask 0077; wg-keygen > /etc/wg/wg0) B# wg-keygen --pub < /etc/wg/wg0 > /etc/wg/wg0.pub B# cat /etc/wg/wg0.pub X7EGm3T3IfodBcyilkaC89j0SH3XD6+/pwvp7Dgp5SU= .Ed .Pp +Generate a pre-shared key on A and copy it to B to defend against +potential future quantum cryptanalysis (not necessary for +functionality): +.Bd -literal -offset abcd +A# (umask 0077; wg-keygen > /etc/wg/wg0.A-B) +.Ed +.Pp Configure A to listen on port 1234 and allow connections from B to appear in the 10.0.1.0/24 subnet: .Bd -literal -offset abcd @@ -114,6 +121,7 @@ A# wgconfig wg0 set private-key /etc/wg/ A# wgconfig wg0 set listen-port 1234 A# wgconfig wg0 add peer B \e X7EGm3T3IfodBcyilkaC89j0SH3XD6+/pwvp7Dgp5SU= \e +--preshared-key=/etc/wg/wg0.A-B \e --allowed-ips=10.0.1.1/32 A# ifconfig wg0 up A# ifconfig wg0 @@ -122,15 +130,16 @@ wg0: flags=0x8041 inet6 fe80::22f7:d6ff:fe3a:1e60%wg0/64 flags 0 scopeid 0x3 .Ed .Pp -Configure B to connect to A at 1.2.3.4 on port 1234 and the packets can -begin to flow: +Configure B to connect to A at 192.0.2.123 on port 1234 and the packets +can begin to flow: .Bd -literal -offset abcd B# ifconfig wg0 create 10.0.1.1/24 B# wgconfig wg0 set private-key /etc/wg/wg0 B# wgconfig wg0 add peer A \e N+B4Nelg+4ysvbLW3qenxIwrJVE9MdjMyqrIisH7V0Y= \e +--preshared-key=/etc/wg/wg0.A-B \e --allowed-ips=10.0.1.0/32 \e ---endpoint=1.2.3.4:1234 +--endpoint=192.0.2.123:1234 B# ifconfig wg0 up B# ifconfig wg0 wg0: flags=0x8041 mtu 1420
CVS commit: src/share/man/man4
Module Name:src Committed By: riastradh Date: Sat Mar 9 12:36:07 UTC 2024 Modified Files: src/share/man/man4: wg.4 Log Message: wg(4): Spruce up example a bit. - Suggest umask so the private keys aren't world readable. - Suggest use of pre-shared key files. - Use TEST-NET-1 and TEST-NET-2 addresses for the example instead of real publicly routable addresses. Holding off on adding IPv6 example until the tun(4) issue is fixed (PR bin/58013). PR misc/58015 To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/wg.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/virtio
Module Name:src Committed By: isaki Date: Sat Mar 9 11:55:59 UTC 2024 Modified Files: src/sys/dev/virtio: virtio_mmio.c Log Message: Fix a null dereference (on attach failure). During cleanup, setup_queue may be called even before vsc->sc_vqs is assigned. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/dev/virtio/virtio_mmio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/virtio/virtio_mmio.c diff -u src/sys/dev/virtio/virtio_mmio.c:1.13 src/sys/dev/virtio/virtio_mmio.c:1.14 --- src/sys/dev/virtio/virtio_mmio.c:1.13 Sat Jan 6 06:59:33 2024 +++ src/sys/dev/virtio/virtio_mmio.c Sat Mar 9 11:55:59 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: virtio_mmio.c,v 1.13 2024/01/06 06:59:33 thorpej Exp $ */ +/* $NetBSD: virtio_mmio.c,v 1.14 2024/03/09 11:55:59 isaki Exp $ */ /* $OpenBSD: virtio_mmio.c,v 1.2 2017/02/24 17:12:31 patrick Exp $ */ /*- @@ -58,7 +58,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: virtio_mmio.c,v 1.13 2024/01/06 06:59:33 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: virtio_mmio.c,v 1.14 2024/03/09 11:55:59 isaki Exp $"); #include #include @@ -208,8 +208,7 @@ virtio_mmio_v2_setup_queue(struct virtio uint64_t addr) { struct virtio_mmio_softc *sc = (struct virtio_mmio_softc *)vsc; - struct virtqueue *vq = >sc_vqs[idx]; - KASSERT(vq->vq_index == idx); + struct virtqueue *vq; virtio_mmio_reg_write(sc, VIRTIO_MMIO_QUEUE_SEL, idx); if (addr == 0) { @@ -218,6 +217,9 @@ virtio_mmio_v2_setup_queue(struct virtio virtio_mmio_v2_set_addr(sc, VIRTIO_MMIO_V2_QUEUE_AVAIL_LOW, 0); virtio_mmio_v2_set_addr(sc, VIRTIO_MMIO_V2_QUEUE_USED_LOW, 0); } else { + vq = >sc_vqs[idx]; + KASSERT(vq->vq_index == idx); + virtio_mmio_reg_write(sc, VIRTIO_MMIO_QUEUE_NUM, virtio_mmio_reg_read(sc, VIRTIO_MMIO_QUEUE_NUM_MAX)); virtio_mmio_v2_set_addr(sc, VIRTIO_MMIO_V2_QUEUE_DESC_LOW,
CVS commit: src/sys/dev/virtio
Module Name:src Committed By: isaki Date: Sat Mar 9 11:55:59 UTC 2024 Modified Files: src/sys/dev/virtio: virtio_mmio.c Log Message: Fix a null dereference (on attach failure). During cleanup, setup_queue may be called even before vsc->sc_vqs is assigned. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/dev/virtio/virtio_mmio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/virt68k/dev
Module Name:src Committed By: isaki Date: Sat Mar 9 11:16:31 UTC 2024 Modified Files: src/sys/arch/virt68k/dev: virtio_mainbus.c Log Message: Fix a null dereference. free_interrupts may be called even when sc_ih has not been assigned yet. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/dev/virtio_mainbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/virt68k/dev/virtio_mainbus.c diff -u src/sys/arch/virt68k/dev/virtio_mainbus.c:1.1 src/sys/arch/virt68k/dev/virtio_mainbus.c:1.2 --- src/sys/arch/virt68k/dev/virtio_mainbus.c:1.1 Tue Jan 2 07:40:59 2024 +++ src/sys/arch/virt68k/dev/virtio_mainbus.c Sat Mar 9 11:16:31 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: virtio_mainbus.c,v 1.1 2024/01/02 07:40:59 thorpej Exp $ */ +/* $NetBSD: virtio_mainbus.c,v 1.2 2024/03/09 11:16:31 isaki Exp $ */ /* * Copyright (c) 2021, 2024 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: virtio_mainbus.c,v 1.1 2024/01/02 07:40:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: virtio_mainbus.c,v 1.2 2024/03/09 11:16:31 isaki Exp $"); #include #include @@ -170,6 +170,8 @@ virtio_mainbus_alloc_interrupts(struct v static void virtio_mainbus_free_interrupts(struct virtio_mmio_softc *msc) { - intr_disestablish(msc->sc_ih); - msc->sc_ih = NULL; + if (msc->sc_ih) { + intr_disestablish(msc->sc_ih); + msc->sc_ih = NULL; + } }
CVS commit: src/sys/arch/virt68k/dev
Module Name:src Committed By: isaki Date: Sat Mar 9 11:16:31 UTC 2024 Modified Files: src/sys/arch/virt68k/dev: virtio_mainbus.c Log Message: Fix a null dereference. free_interrupts may be called even when sc_ih has not been assigned yet. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/dev/virtio_mainbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Mar 9 11:05:05 UTC 2024 Modified Files: src/usr.bin/xlint/lint1: lint1.h Log Message: lint: clean up comments, use typedefs To generate a diff of this commit: cvs rdiff -u -r1.218 -r1.219 src/usr.bin/xlint/lint1/lint1.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.218 src/usr.bin/xlint/lint1/lint1.h:1.219 --- src/usr.bin/xlint/lint1/lint1.h:1.218 Sat Mar 9 10:54:12 2024 +++ src/usr.bin/xlint/lint1/lint1.h Sat Mar 9 11:05:05 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.218 2024/03/09 10:54:12 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.219 2024/03/09 11:05:05 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -71,19 +71,6 @@ typedef struct { int p_uniq; /* uniquifier */ } pos_t; -// TODO: Use bit-fields instead of plain bool, but keep an eye on arm and -// powerpc, on which NetBSD's GCC 10.5.0 (but not the upstream GCC) generates -// code that leads to extra 327 warnings, even in msg_327.c, which does not -// contain any type qualifier at all. -// -// A possible starting point for continuing the investigation is that -// type_qualifiers is a very small struct that contains only bool bit-fields, -// and this struct is a member of the parser's union. -// -// Instead of using plain bool instead of bit-fields, an alternative workaround -// is to compile cgram.c with -Os or -O1 instead of -O2. The generated code -// between -Os and -O2 differs too much though to give a hint at the root -// cause. typedef struct { bool tq_const; bool tq_restrict; @@ -128,9 +115,7 @@ typedef struct { sym_t *sou_first_typedef; } struct_or_union; -/* - * same as above for enums - */ +/* The same as in struct_or_union, only for enums. */ typedef struct { bool en_incomplete:1; sym_t *en_first_enumerator; @@ -138,28 +123,21 @@ typedef struct { sym_t *en_first_typedef; } enumeration; -/* - * The type of an expression or object. Complex types are formed via t_subt - * (for arrays, pointers and functions), as well as t_sou. - */ +/* The type of an expression, object or function. */ struct lint1_type { tspec_t t_tspec; /* type specifier */ bool t_incomplete_array:1; - bool t_const:1; /* const modifier */ - bool t_volatile:1; /* volatile modifier */ + bool t_const:1; + bool t_volatile:1; bool t_proto:1; /* function prototype (t_params valid) */ bool t_vararg:1; /* prototype with '...' */ bool t_typedef:1; /* type defined with typedef */ bool t_typeof:1; /* type defined with GCC's __typeof__ */ bool t_bitfield:1; /* - * Either the type is currently an enum (having t_tspec ENUM), or it is - * an integer type (typically INT) that has been implicitly converted - * from an enum type. In both cases, t_enum is valid. - * - * The information about a former enum type is retained to allow type - * checks in expressions such as ((var1 & 0x0001) == var2), to detect - * when var1 and var2 are from incompatible enum types. + * Either the type is currently an enum (having t_tspec ENUM), or it + * is an integer type (typically INT) that has been implicitly + * converted from an enum type. In both cases, t_enum is valid. */ bool t_is_enum:1; bool t_packed:1; @@ -179,7 +157,7 @@ struct lint1_type { #define t_dim t_u._t_dim #define t_sou t_u._t_sou #define t_enum t_u._t_enum -#define t_params t_u._t_params +#define t_params t_u._t_params typedef enum { @@ -189,16 +167,14 @@ typedef enum { SK_LABEL } symbol_kind; -/* - * storage classes and related things - */ +/* storage classes and related things */ typedef enum { NO_SCL, EXTERN, /* external symbols (independent of decl_t) */ STATIC, /* static symbols (local and global) */ AUTO, /* automatic symbols (except register) */ REG, /* register */ - TYPEDEF, /* typedef */ + TYPEDEF, THREAD_LOCAL, STRUCT_TAG, UNION_TAG, @@ -217,9 +193,7 @@ typedef enum { FS_NORETURN, /* since C11 */ } function_specifier; -/* - * symbol table entry - */ +/* A type, variable, keyword; basically anything that has a name. */ struct sym { const char *s_name; const char *s_rename; /* renamed symbol's given name */ @@ -232,26 +206,26 @@ struct sym { symbol_kind s_kind; const struct keyword *s_keyword; bool s_bitfield:1; - bool s_set:1; /* variable set, label defined */ - bool s_used:1; /* variable/label used */ - bool s_param:1; /* symbol is function parameter */ - bool s_register:1; /* symbol is register variable */ + bool s_set:1; + bool s_used:1; + bool s_param:1; + bool s_register:1; bool s_defparam:1; /* undefined symbol in old-style function * definition */ bool s_return_type_implicit_int:1; bool s_osdef:1; /* symbol stems from old-style function def. */ - bool s_inline:1; /* true if this is an inline function */ - struct
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Mar 9 11:05:05 UTC 2024 Modified Files: src/usr.bin/xlint/lint1: lint1.h Log Message: lint: clean up comments, use typedefs To generate a diff of this commit: cvs rdiff -u -r1.218 -r1.219 src/usr.bin/xlint/lint1/lint1.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sat Mar 9 11:04:22 UTC 2024 Modified Files: src/sys/dev/pci: ld_virtio.c Log Message: Modify a confused expression in ld_virtio_attach(). VIRTIO_BLK_MIN_SEGMENTS should be the total number of non-data segments, so I rename it to VIRTIO_BLK_CTRL_SEGMENTS. PR kern/57981. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/ld_virtio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/ld_virtio.c diff -u src/sys/dev/pci/ld_virtio.c:1.33 src/sys/dev/pci/ld_virtio.c:1.34 --- src/sys/dev/pci/ld_virtio.c:1.33 Mon Feb 12 02:28:28 2024 +++ src/sys/dev/pci/ld_virtio.c Sat Mar 9 11:04:22 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_virtio.c,v 1.33 2024/02/12 02:28:28 isaki Exp $ */ +/* $NetBSD: ld_virtio.c,v 1.34 2024/03/09 11:04:22 isaki Exp $ */ /* * Copyright (c) 2010 Minoura Makoto. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.33 2024/02/12 02:28:28 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.34 2024/03/09 11:04:22 isaki Exp $"); #include #include @@ -74,7 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld_virtio.c, * Each block request uses at least two segments - one for the header * and one for the status. */ -#define VIRTIO_BLK_MIN_SEGMENTS 2 +#define VIRTIO_BLK_CTRL_SEGMENTS 2 #define VIRTIO_BLK_FLAG_BITS \ VIRTIO_COMMON_FLAG_BITS \ @@ -222,7 +222,7 @@ ld_virtio_alloc_reqs(struct ld_virtio_so r = bus_dmamap_create(virtio_dmat(sc->sc_virtio), ld->sc_maxxfer, (ld->sc_maxxfer / NBPG) + - VIRTIO_BLK_MIN_SEGMENTS, + VIRTIO_BLK_CTRL_SEGMENTS, ld->sc_maxxfer, 0, BUS_DMA_WAITOK|BUS_DMA_ALLOCNOW, @@ -319,18 +319,15 @@ ld_virtio_attach(device_t parent, device if (features & VIRTIO_BLK_F_SEG_MAX) { maxnsegs = virtio_read_device_config_4(vsc, VIRTIO_BLK_CONFIG_SEG_MAX); - if (maxnsegs < VIRTIO_BLK_MIN_SEGMENTS) { + if (maxnsegs == 0) { aprint_error_dev(sc->sc_dev, - "Too small SEG_MAX %d minimum is %d\n", - maxnsegs, VIRTIO_BLK_MIN_SEGMENTS); - maxnsegs = maxxfersize / NBPG; - // goto err; + "Invalid SEG_MAX %d\n", maxnsegs); + goto err; } } else maxnsegs = maxxfersize / NBPG; - /* 2 for the minimum size */ - maxnsegs += VIRTIO_BLK_MIN_SEGMENTS; + maxnsegs += VIRTIO_BLK_CTRL_SEGMENTS; virtio_init_vq_vqdone(vsc, >sc_vq, 0, ld_virtio_vq_done); @@ -414,7 +411,7 @@ ld_virtio_start(struct ld_softc *ld, str } r = virtio_enqueue_reserve(vsc, vq, slot, vr->vr_payload->dm_nsegs + - VIRTIO_BLK_MIN_SEGMENTS); + VIRTIO_BLK_CTRL_SEGMENTS); if (r != 0) { bus_dmamap_unload(virtio_dmat(vsc), vr->vr_payload); return r; @@ -543,7 +540,7 @@ ld_virtio_dump(struct ld_softc *ld, void return r; r = virtio_enqueue_reserve(vsc, vq, slot, vr->vr_payload->dm_nsegs + - VIRTIO_BLK_MIN_SEGMENTS); + VIRTIO_BLK_CTRL_SEGMENTS); if (r != 0) { bus_dmamap_unload(virtio_dmat(vsc), vr->vr_payload); return r; @@ -679,7 +676,7 @@ ld_virtio_flush(struct ld_softc *ld, boo vr = >sc_reqs[slot]; KASSERT(vr->vr_bp == NULL); - r = virtio_enqueue_reserve(vsc, vq, slot, VIRTIO_BLK_MIN_SEGMENTS); + r = virtio_enqueue_reserve(vsc, vq, slot, VIRTIO_BLK_CTRL_SEGMENTS); if (r != 0) { return r; }
CVS commit: src/sys/dev/pci
Module Name:src Committed By: isaki Date: Sat Mar 9 11:04:22 UTC 2024 Modified Files: src/sys/dev/pci: ld_virtio.c Log Message: Modify a confused expression in ld_virtio_attach(). VIRTIO_BLK_MIN_SEGMENTS should be the total number of non-data segments, so I rename it to VIRTIO_BLK_CTRL_SEGMENTS. PR kern/57981. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/ld_virtio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Mar 9 10:54:12 UTC 2024 Modified Files: src/usr.bin/xlint/lint1: func.c lint1.h Log Message: lint: internally store case label values in order of appearance To generate a diff of this commit: cvs rdiff -u -r1.181 -r1.182 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.217 -r1.218 src/usr.bin/xlint/lint1/lint1.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Mar 9 10:54:12 UTC 2024 Modified Files: src/usr.bin/xlint/lint1: func.c lint1.h Log Message: lint: internally store case label values in order of appearance To generate a diff of this commit: cvs rdiff -u -r1.181 -r1.182 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.217 -r1.218 src/usr.bin/xlint/lint1/lint1.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/xlint/lint1/func.c diff -u src/usr.bin/xlint/lint1/func.c:1.181 src/usr.bin/xlint/lint1/func.c:1.182 --- src/usr.bin/xlint/lint1/func.c:1.181 Thu Feb 8 20:45:20 2024 +++ src/usr.bin/xlint/lint1/func.c Sat Mar 9 10:54:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: func.c,v 1.181 2024/02/08 20:45:20 rillig Exp $ */ +/* $NetBSD: func.c,v 1.182 2024/03/09 10:54:12 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: func.c,v 1.181 2024/02/08 20:45:20 rillig Exp $"); +__RCSID("$NetBSD: func.c,v 1.182 2024/03/09 10:54:12 rillig Exp $"); #endif #include @@ -162,12 +162,7 @@ end_control_statement(control_statement_ control_statement *cs = cstmt; cstmt = cs->c_surrounding; - case_label_t *cl, *next; - for (cl = cs->c_case_labels; cl != NULL; cl = next) { - next = cl->cl_next; - free(cl); - } - + free(cs->c_case_labels.vals); free(cs->c_switch_type); free(cs); } @@ -436,6 +431,34 @@ check_case_label_enum(const tnode_t *tn, #endif } +static bool +check_duplicate_case_label(control_statement *cs, const val_t *nv) +{ + case_labels *labels = >c_case_labels; + size_t i = 0, n = labels->len; + + while (i < n && labels->vals[i].u.integer != nv->u.integer) + i++; + + if (i < n) { + if (is_uinteger(nv->v_tspec)) + /* duplicate case '%lu' in switch */ + error(200, (unsigned long)nv->u.integer); + else + /* duplicate case '%ld' in switch */ + error(199, (long)nv->u.integer); + return false; + } + + if (labels->len >= labels->cap) { + labels->cap = 16 + 2 * labels->cap; + labels->vals = xrealloc(labels->vals, + sizeof(*labels->vals) * labels->cap); + } + labels->vals[labels->len++] = *nv; + return true; +} + static void check_case_label(tnode_t *tn) { @@ -487,27 +510,8 @@ check_case_label(tnode_t *tn) convert_constant(CASE, 0, cs->c_switch_type, , v); free(v); - /* look if we had this value already */ - case_label_t *cl; - for (cl = cs->c_case_labels; cl != NULL; cl = cl->cl_next) { - if (cl->cl_val.u.integer == nv.u.integer) - break; - } - if (cl != NULL && is_uinteger(nv.v_tspec)) - /* duplicate case '%lu' in switch */ - error(200, (unsigned long)nv.u.integer); - else if (cl != NULL) - /* duplicate case '%ld' in switch */ - error(199, (long)nv.u.integer); - else { + if (check_duplicate_case_label(cs, )) check_getopt_case_label(nv.u.integer); - - /* Prepend the value to the list of case values. */ - cl = xcalloc(1, sizeof(*cl)); - cl->cl_val = nv; - cl->cl_next = cs->c_case_labels; - cs->c_case_labels = cl; - } } void @@ -660,7 +664,6 @@ stmt_switch_expr_stmt(void) { int nenum = 0, nclab = 0; sym_t *esym; - case_label_t *cl; lint_assert(cstmt->c_switch_type != NULL); @@ -675,8 +678,7 @@ stmt_switch_expr_stmt(void) esym != NULL; esym = esym->s_next) { nenum++; } - for (cl = cstmt->c_case_labels; cl != NULL; cl = cl->cl_next) - nclab++; + nclab = (int)cstmt->c_case_labels.len; if (hflag && eflag && nclab < nenum && !cstmt->c_default) /* enumeration value(s) not handled in switch */ warning(206); Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.217 src/usr.bin/xlint/lint1/lint1.h:1.218 --- src/usr.bin/xlint/lint1/lint1.h:1.217 Sat Mar 9 10:47:16 2024 +++ src/usr.bin/xlint/lint1/lint1.h Sat Mar 9 10:54:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.217 2024/03/09 10:47:16 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.218 2024/03/09 10:54:12 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -425,14 +425,12 @@ typedef struct qual_ptr { struct qual_ptr *p_next; } qual_ptr; -/* - * The values of the 'case' labels, linked via cl_next in reverse order of - * appearance in the code, that is from bottom to top. - */ -typedef struct case_label { - val_t cl_val; - struct case_label *cl_next; -} case_label_t; +/* The values of the 'case' labels. */ +typedef struct { + val_t *vals; + size_t len; + size_t cap; +} case_labels; typedef enum { CS_DO_WHILE, @@ -466,7 +464,7 @@ typedef struct control_statement { type_t *c_switch_type; /* type of switch expression */ tnode_t *c_switch_expr; - case_label_t *c_case_labels; /* list of case values */ + case_labels c_case_labels; /* list of case values */ memory_pool c_for_expr3_mem; /* saved memory for end of loop * expression in for() */
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Mar 9 10:47:16 UTC 2024 Modified Files: src/usr.bin/xlint/lint1: cksnprintb.c lint1.h tree.c Log Message: lint: remove unneeded checks for left and right operands To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.bin/xlint/lint1/cksnprintb.c cvs rdiff -u -r1.216 -r1.217 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.609 -r1.610 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/xlint/lint1/cksnprintb.c diff -u src/usr.bin/xlint/lint1/cksnprintb.c:1.7 src/usr.bin/xlint/lint1/cksnprintb.c:1.8 --- src/usr.bin/xlint/lint1/cksnprintb.c:1.7 Sun Mar 3 16:09:01 2024 +++ src/usr.bin/xlint/lint1/cksnprintb.c Sat Mar 9 10:47:16 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cksnprintb.c,v 1.7 2024/03/03 16:09:01 rillig Exp $ */ +/* $NetBSD: cksnprintb.c,v 1.8 2024/03/09 10:47:16 rillig Exp $ */ /*- * Copyright (c) 2024 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: cksnprintb.c,v 1.7 2024/03/03 16:09:01 rillig Exp $"); +__RCSID("$NetBSD: cksnprintb.c,v 1.8 2024/03/09 10:47:16 rillig Exp $"); #endif #include @@ -59,7 +59,7 @@ static bool match_string_literal(const tnode_t *tn, const buffer **str) { while (tn->tn_op == CVT) - tn = tn_ck_left(tn); + tn = tn->tn_left; return tn->tn_op == ADDR && tn->tn_left->tn_op == STRING && (*str = tn->tn_left->tn_string, (*str)->data != NULL); Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.216 src/usr.bin/xlint/lint1/lint1.h:1.217 --- src/usr.bin/xlint/lint1/lint1.h:1.216 Sat Mar 9 10:41:11 2024 +++ src/usr.bin/xlint/lint1/lint1.h Sat Mar 9 10:47:16 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.216 2024/03/09 10:41:11 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.217 2024/03/09 10:47:16 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -555,20 +555,6 @@ typedef struct { assert_failed(__FILE__, __LINE__, __func__, #cond); \ } while (false) -static inline tnode_t * -tn_ck_left(const tnode_t *tn) -{ - lint_assert(has_operands(tn)); - return tn->tn_left; -} - -static inline tnode_t * -tn_ck_right(const tnode_t *tn) -{ - lint_assert(has_operands(tn)); - return tn->tn_right; -} - #ifdef DEBUG # include "err-msgs.h" Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.609 src/usr.bin/xlint/lint1/tree.c:1.610 --- src/usr.bin/xlint/lint1/tree.c:1.609 Sun Mar 3 16:09:01 2024 +++ src/usr.bin/xlint/lint1/tree.c Sat Mar 9 10:47:16 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.609 2024/03/03 16:09:01 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.610 2024/03/09 10:47:16 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.609 2024/03/03 16:09:01 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.610 2024/03/09 10:47:16 rillig Exp $"); #endif #include @@ -1236,7 +1236,7 @@ build_colon(bool sys, tnode_t *ln, tnode static bool is_cast_redundant(const tnode_t *tn) { - const type_t *ntp = tn->tn_type, *otp = tn_ck_left(tn)->tn_type; + const type_t *ntp = tn->tn_type, *otp = tn->tn_left->tn_type; tspec_t nt = ntp->t_tspec, ot = otp->t_tspec; if (nt == BOOL || ot == BOOL)
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Mar 9 10:47:16 UTC 2024 Modified Files: src/usr.bin/xlint/lint1: cksnprintb.c lint1.h tree.c Log Message: lint: remove unneeded checks for left and right operands To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.bin/xlint/lint1/cksnprintb.c cvs rdiff -u -r1.216 -r1.217 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.609 -r1.610 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Mar 9 10:41:11 UTC 2024 Modified Files: src/usr.bin/xlint/lint1: cgram.y decl.c externs1.h lint1.h Log Message: lint: use fewer struct keywords To generate a diff of this commit: cvs rdiff -u -r1.489 -r1.490 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.394 -r1.395 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.218 -r1.219 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.215 -r1.216 src/usr.bin/xlint/lint1/lint1.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Mar 9 10:41:11 UTC 2024 Modified Files: src/usr.bin/xlint/lint1: cgram.y decl.c externs1.h lint1.h Log Message: lint: use fewer struct keywords To generate a diff of this commit: cvs rdiff -u -r1.489 -r1.490 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.394 -r1.395 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.218 -r1.219 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.215 -r1.216 src/usr.bin/xlint/lint1/lint1.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.489 src/usr.bin/xlint/lint1/cgram.y:1.490 --- src/usr.bin/xlint/lint1/cgram.y:1.489 Thu Feb 8 20:45:20 2024 +++ src/usr.bin/xlint/lint1/cgram.y Sat Mar 9 10:41:11 2024 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.489 2024/02/08 20:45:20 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.490 2024/03/09 10:41:11 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: cgram.y,v 1.489 2024/02/08 20:45:20 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.490 2024/03/09 10:41:11 rillig Exp $"); #endif #include @@ -128,7 +128,7 @@ is_either(const char *s, const char *a, tspec_t y_tspec; type_qualifiers y_type_qualifiers; function_specifier y_function_specifier; - struct parameter_list y_parameter_list; + parameter_list y_parameter_list; function_call *y_arguments; type_t *y_type; tnode_t *y_tnode; @@ -137,7 +137,7 @@ is_either(const char *s, const char *a, qual_ptr *y_qual_ptr; bool y_seen_statement; struct generic_association *y_generic; - struct array_size y_array_size; + array_size y_array_size; bool y_in_system_header; designation y_designation; }; @@ -1421,7 +1421,7 @@ param_list: block_level++; begin_declaration_level(DLK_PROTO_PARAMS); } identifier_list T_RPAREN { - $$ = (struct parameter_list){ .first = $3 }; + $$ = (parameter_list){ .first = $3 }; } | abstract_decl_param_list ; @@ -1541,7 +1541,7 @@ direct_abstract_declarator: abstract_decl_param_list: /* specific to lint */ abstract_decl_lparen T_RPAREN type_attribute_opt { - $$ = (struct parameter_list){ .first = NULL }; + $$ = (parameter_list){ .first = NULL }; } | abstract_decl_lparen vararg_parameter_type_list T_RPAREN type_attribute_opt { @@ -1549,7 +1549,7 @@ abstract_decl_param_list: /* specific to $$.prototype = true; } | abstract_decl_lparen error T_RPAREN type_attribute_opt { - $$ = (struct parameter_list){ .first = NULL }; + $$ = (parameter_list){ .first = NULL }; } ; @@ -1574,14 +1574,14 @@ vararg_parameter_type_list: /* specific else if (allow_c90) /* C90 to C17 require formal parameter before '...' */ warning(84); - $$ = (struct parameter_list){ .vararg = true }; + $$ = (parameter_list){ .vararg = true }; } ; /* XXX: C99 6.7.5 defines the same name, but it looks different. */ parameter_type_list: parameter_declaration { - $$ = (struct parameter_list){ .first = $1 }; + $$ = (parameter_list){ .first = $1 }; } | parameter_type_list T_COMMA parameter_declaration { $$ = $1; Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.394 src/usr.bin/xlint/lint1/decl.c:1.395 --- src/usr.bin/xlint/lint1/decl.c:1.394 Sat Mar 2 09:32:18 2024 +++ src/usr.bin/xlint/lint1/decl.c Sat Mar 9 10:41:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.394 2024/03/02 09:32:18 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.395 2024/03/09 10:41:11 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: decl.c,v 1.394 2024/03/02 09:32:18 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.395 2024/03/09 10:41:11 rillig Exp $"); #endif #include @@ -1334,7 +1334,7 @@ old_style_function(sym_t *decl, sym_t *p } sym_t * -add_function(sym_t *decl, struct parameter_list params) +add_function(sym_t *decl, parameter_list params) { debug_enter(); Index: src/usr.bin/xlint/lint1/externs1.h diff -u src/usr.bin/xlint/lint1/externs1.h:1.218 src/usr.bin/xlint/lint1/externs1.h:1.219 --- src/usr.bin/xlint/lint1/externs1.h:1.218 Sun Mar 3 00:50:41 2024 +++ src/usr.bin/xlint/lint1/externs1.h Sat Mar 9 10:41:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: externs1.h,v 1.218 2024/03/03 00:50:41 rillig Exp $ */ +/* $NetBSD: externs1.h,v 1.219 2024/03/09 10:41:11 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -233,7 +233,7 @@ void add_type_qualifiers(type_qualifiers qual_ptr *append_qualified_pointer(qual_ptr *, qual_ptr *); sym_t *add_pointer(sym_t *, qual_ptr *); sym_t *add_array(sym_t *, bool, int); -sym_t *add_function(sym_t *, struct parameter_list); +sym_t *add_function(sym_t *, parameter_list); void check_extern_declaration(const sym_t *);
CVS commit: src/sys/external/bsd/common/include/linux
Module Name:src Committed By: mrg Date: Sat Mar 9 09:55:52 UTC 2024 Modified Files: src/sys/external/bsd/common/include/linux: printk.h Log Message: drm(4): make pr_debug equivalent to aprint_debug significantly reduces the default spam from amdgpu(4). To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/common/include/linux/printk.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/common/include/linux/printk.h diff -u src/sys/external/bsd/common/include/linux/printk.h:1.13 src/sys/external/bsd/common/include/linux/printk.h:1.14 --- src/sys/external/bsd/common/include/linux/printk.h:1.13 Fri Jul 29 23:50:44 2022 +++ src/sys/external/bsd/common/include/linux/printk.h Sat Mar 9 09:55:52 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: printk.h,v 1.13 2022/07/29 23:50:44 riastradh Exp $ */ +/* $NetBSD: printk.h,v 1.14 2024/03/09 09:55:52 mrg Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -47,7 +47,7 @@ #define pr_warn printf /* XXX */ #define pr_warn_once printf /* XXX */ #define pr_notice printf /* XXX */ -#define pr_debug printf /* XXX */ +#define pr_debug aprint_debug #define KERN_EMERG "emerg: " #define KERN_ALERT "alert: " #define KERN_CRIT "crit: "
CVS commit: src/sys/external/bsd/common/include/linux
Module Name:src Committed By: mrg Date: Sat Mar 9 09:55:52 UTC 2024 Modified Files: src/sys/external/bsd/common/include/linux: printk.h Log Message: drm(4): make pr_debug equivalent to aprint_debug significantly reduces the default spam from amdgpu(4). To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/common/include/linux/printk.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.