From nobody Tue Jun 23 02:30:53 2026 X-Original-To: dev-commits-src-main@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 4gkpwB55mrz6j4Yw for ; Tue, 23 Jun 2026 02:31:06 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) (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 4gkpwB1MQ0z3wTm for ; Tue, 23 Jun 2026 02:31:06 +0000 (UTC) (envelope-from rlibby@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-7fe4808741eso54346107b3.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=En6/DiXPcuAUiO31pTFgOdSvnjFppy47NU8v+XQrv4MPbgaZXiKWa9urSOKB8sNN56 YepEo0FagbyTLF6fyY/FsEvefwgLO3UYZlEkUmIa6D1qbnLX0bUvG35YNNegKn12zgyb yNbS6Klw78AlOSHRXTsqtOCYwPK6aJeRvN7K31tTqy7JOJbh0elGSTZCo2C8YI10mbuC ScschF1sVa8UMv2zczP0sjRxW6GLJNJYnVIQevKKhdWptF+hsdw4OrTRXvoNn+TF4cLI 8I2k8MUSfsb1M+mtaPxg2lSp+tP9UjUk9/o1vxWY6kywdowkG2P8lPEf3RhFO+hklPLz BgVA== X-Forwarded-Encrypted: i=1; AHgh+RrqbAhp3BOjKZUUFtBVtLyC133Desy2Ow/B/yAYgQrd38S3JzMWoTV5rOl3H8QCoedfrv2mMOI5oa170ETzjfLAxkEmmQ==@freebsd.org X-Gm-Message-State: AOJu0YymV1Dn+CQwEiFQaZYVB4142GKUBhtKSJqbUv1oI7Pnnp7Z4pzq 4StdkXL1nB2ByqK0J5tJSdxiJbmsDJb/v4zunDTS5jLojO/BeQg71iAxqs0U2w== X-Gm-Gg: AfdE7cneK5ULuJbD0OThfQtcp09UE2flEkkugzljZwNyFjcLT0uqgILWCfZ8cWWmhnt pan6jH9wdodi+LwoqAKw9JC5llqVCJyh+XIMmBU1yjlLyY/4oNY2NrCmb8tNzOB/MSHEMfDYGZf 8GF7OYTG05HIcIhg8HQvtBwtkUKrZiS3UUb9KSg4n5I18m+UMMK7wNRb2ii1ZG2bUYlpwbXTIDC o34s44d6ZxFoD3+WPGw9PLhXfjmjuK+vhQlfcfx5YEwg570VNSAbPOkFja0ztETfBzG6HAm2X/x qR+VLWsMJ47cZ6Qaybr/rim8n+r0tBQ0cXquE/3OLxLrZfytC8gtdQNQ5frMZGTgPgzLBd0WArR pHRRbyyws2QCjB6yJBA45SPB5cIT+O/ynx5N/zT6KIo6MRP4y5PN8sr4gfPG+6rqHpjHINLOvCm kqmj8ahKvtZxcMpFUj0lL69ITSPfaOiLdUEUd1MyE2L89j3YU+3jU= X-Received: by 2002:a05:690c:46c5:b0:7b3:3a49:752 with SMTP id 00721157ae682-80132e2d780mr191346917b3.41.1782181864957; Mon, 22 Jun 2026 19:31:04 -0700 (PDT) Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com. [209.85.128.182]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8025f9d8624sm40496587b3.24.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-yw1-f182.google.com with SMTP id 00721157ae682-7fe723ca5e5so54822707b3.2 for ; Mon, 22 Jun 2026 19:31:04 -0700 (PDT) X-Forwarded-Encrypted: i=1; AHgh+RoIqhjQlLjW3S5k8tY1p+TIlBzKVjGdFh8XLGzi+IHVEbybR+xHiImbjq5Ove6dN+gdeSPdaM3kJqxYlpWXkUshQ2BgrQ==@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 the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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:209.85.128.0/17, country:US] X-Rspamd-Queue-Id: 4gkpwB1MQ0z3wTm 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