From nobody Tue Jun 23 02:30:53 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gkpwB3WJ6z6j4c9 for ; Tue, 23 Jun 2026 02:31:06 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-yx1-f54.google.com (mail-yx1-f54.google.com [74.125.224.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gkpwB0hvFz3whw for ; Tue, 23 Jun 2026 02:31:06 +0000 (UTC) (envelope-from rlibby@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-yx1-f54.google.com with SMTP id 956f58d0204a3-662dd616cdbso5310896d50.1 for ; Mon, 22 Jun 2026 19:31:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782181865; x=1782786665; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=t+rwBgpWNpM3tB65icGpX0oyWxwChYyHH0LRTTGCZk4=; b=Tw2BE//hD2wJLC4pK1MKVQ+eComt6AbgVyY3bDlZ+2jiRKswi01IB7VGvTmkUA4pwa IMHJto53ZVdnIHyyv5e1S8y4N/6pa10hh8lfTqDKsWaSCO7E7HEFZzNs81MKiPsIBfOK ciTCQmthITpMZq73OOyaetM7haE4tEfKLNK/enpiE6BVnlgi/Wox6ezTb/IluftB4kR9 iFYKKt2JQBV7OOoUxoCWe5bae4SmF8i33ujcnU6RWANVh+OBzm8vX0uyRXKTiRH3LBKp UYUv6PwxNRzkABz0sYxeoctRo+jFSnjrlIXa/AXGIL5mKhMf3kJ71MRY5Xt4IXGUwZOB jeMw== X-Forwarded-Encrypted: i=1; AHgh+Rqza7IWAPDVI+Gv3htRv43X2zfHaOubCgAJe/9SJahrYf0otYOh/e8K2389+lhC9CwpQaOjbBB9mGb4ju/+YK8Dl8cs@freebsd.org X-Gm-Message-State: AOJu0YyaK0I2UsZQ01ApbaJHVzkJDZYP1JsaQVMvLUmlAeQV4j1bxhHT hXanB+WZmrHMNPxUdQ4Wmx6u3mSb1wG21pNtYG7ekmpdmRDX7uAsdweqn6McLQ== X-Gm-Gg: AfdE7cnOGfbLXRZpYmq4uqyxsGp866If6h1eyTJ2AGstKvnrRWwtd6kIZWPoK+XJClf M7RVhl8rNMSSqf2uf7HwLjFxhYBSScppdzAwLYYmX7I2EefeGiyd+JoFC9cMHBZz3qsiCWLiZCx EWRLrhXkCCLnEBqkaZK2MQ5wZWnvmTwyec9sy/3Rc+6JTkyzbcvV/OiIi/Yry1H/LgCRZ4jsIlf hrDXCqGp9naBusILOg8Fe7BzaZhoxRpcOoGhv+3eSsSydkW+qU+FU9JExq3GnGi/rZqYqswxuTU 0RkAyM5LBdDuZuE0ytr8McJuqeIGW5I3CRYONyXCNgXghh2FTdmFMAjEyxxdEUUpAi8G/mgPoc0 5Xi2N3hucG3jtXxMym7Hv6Be5iUhqOcyMGaPGnXRAcPhz6x99fMdfgq5xsNMSLoxFqZND9ZZaip jHSNBlXnQkDTts8T6GqnMuPbQMUJTfcZwsKbTV1+wizikYGuC0veg/xyGESQ== X-Received: by 2002:a05:690e:1306:b0:660:86e7:e6cd with SMTP id 956f58d0204a3-662ffc5f481mr16186095d50.7.1782181865116; Mon, 22 Jun 2026 19:31:05 -0700 (PDT) Received: from mail-yx1-f49.google.com (mail-yx1-f49.google.com. [74.125.224.49]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-66314b90eadsm4542412d50.9.2026.06.22.19.31.04 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Jun 2026 19:31:04 -0700 (PDT) Received: by mail-yx1-f49.google.com with SMTP id 956f58d0204a3-6626cd98209so4535445d50.3 for ; Mon, 22 Jun 2026 19:31:04 -0700 (PDT) X-Forwarded-Encrypted: i=1; AHgh+RrzTGRJQO6g4Vsq5IUh0NOgrVF2Cwz5PnI9CfyEVSgvk5Nym7VL9nbUnvV3VR5TZaiNUVDSctRFtWvXC+bf8lcmJIsV@freebsd.org X-Received: by 2002:a53:d00a:0:b0:658:d26:d8cf with SMTP id 956f58d0204a3-662ffcefe23mr15839981d50.23.1782181864212; Mon, 22 Jun 2026 19:31:04 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 References: <6a33714c.187fe.20ec4acc@gitrepo.freebsd.org> In-Reply-To: From: Ryan Libby Date: Mon, 22 Jun 2026 19:30:53 -0700 X-Gmail-Original-Message-ID: X-Gm-Features: AVVi8Cfq25IaERPIP5z8IjIG4JuE5uHEYr2dbvtVmo30TTMuRSpnKwsjS7NvF7o Message-ID: Subject: Re: git: 08180f1b613b - main - witness: actually set read-only tunables in time for witness_startup To: Alan Somers Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:74.125.0.0/16, country:US] X-Rspamd-Queue-Id: 4gkpwB0hvFz3whw X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated On Mon, Jun 22, 2026 at 4:08=E2=80=AFPM Alan Somers w= rote: > > On Wed, Jun 17, 2026 at 10:18=E2=80=AFPM Ryan Libby = wrote: > > > > The branch main has been updated by rlibby: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D08180f1b613b6fe000135efa= 28b7c3293cbf1683 > > > > commit 08180f1b613b6fe000135efa28b7c3293cbf1683 > > Author: Ryan Libby > > AuthorDate: 2026-06-18 03:52:53 +0000 > > Commit: Ryan Libby > > CommitDate: 2026-06-18 04:05:43 +0000 > > > > witness: actually set read-only tunables in time for witness_startu= p > > > > SYSCTL_XXX with CTLFLAG_RDTUN and without CTLFLAG_NOFETCH should no= t be > > used for values that are needed before SI_SUB_KLD. Otherwise they = are > > tuned after they are needed. Set CTLFLAG_RDTUN | CTLFLAG_NOFETCH f= or > > the debug.witness.witness_count and debug.witness.skipspin sysctls = and > > add separate tunables for them, which run at SI_SUB_TUNABLES time, = i.e., > > in time for witness_startup. > > > > Reviewed by: kib, markj > > Sponsored by: Dell Inc. > > Differential Revision: https://reviews.freebsd.org/D57613 > > My dev VM instapanics on boot, and I've bisected it to this change. > Apparently it doesn't affect everybody, or it would've been reported > already. So I'm not asking you to revert it. But could you please > take a look at the problem? > > Stack trace: > > ---<>--- > Copyright (c) 1992-2026 The FreeBSD Project. > Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 > The Regents of the University of California. All rights reserved. > FreeBSD is a registered trademark of The FreeBSD Foundation. > FreeBSD 16.0-CURRENT #25 n286717-a9e12d3ec8bd: Mon Jun 22 16:50:06 MDT 20= 26 > somers@fbsd-head.lauralan.noip.me:/usr/obj/usr/home/somers/src/freebs= d.org/src/main/amd64.amd64/sys/GENERIC > amd64 > FreeBSD clang version 21.1.8 (https://github.com/llvm/llvm-project.git > llvmorg-21.1.8-0-g2078da43e25a) > WARNING: WITNESS option enabled, expect reduced performance. > SRAT: Ignoring memory at addr 0xff000000 > panic: physical address 0x4af918000 not covered by the DMAP > cpuid =3D 0 > time =3D 1 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x36/frame 0xffffffff829= 3bd60 > vpanic() at vpanic+0x149/frame 0xffffffff8293be90 > panic() at panic+0x43/frame 0xffffffff8293bef0 > pmap_map() at pmap_map+0x2c/frame 0xffffffff8293bf00 > vm_page_startup() at vm_page_startup+0x71c/frame 0xffffffff8293bf90 > vm_mem_init() at vm_mem_init+0x1a/frame 0xffffffff8293bfa0 > mi_startup() at mi_startup+0x1ed/frame 0xffffffff8293bff0 > KDB: enter: panic > [ thread pid 0 tid 0 ] > Stopped at kdb_enter+0x33: movq $0,0x15ad202(%rip) > > /boot/loader.conf contents: > > kern.boottrace.enabled=3D1 > debug.kasan.panic_on_violation=3D0 > debug.kmsan.panic_on_violation=3D0 > debug.witness.witness_count=3D49152 Thanks for the report. I'm able to repro with set debug.witness.witness_count=3D49152 at the loader prompt. The WITNESS_COUNT default is 1536. There is an allocation that is O(n^2) of witness_count. The setting of 49152 should end up attempting to allocate over 2.25 GiB... but actually it will overflow a 32-bit int to become negative, leading to us trying to pmap_map memory somewhere after the end of the biggest phys segment. I think a minimum fix would change the types to prevent overflow. Actually we also don't check that we aren't just exceeding the size of the segment, so presumably we could also hit another panic in just trying to allocate too much. This was a sort of latent issue: before your setting of witness_count was just being ignored. Ryan