From nobody Mon Jul 21 02:13:39 2025 X-Original-To: dev-commits-src-branches@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 4blkTb5XLXz61xtj; Mon, 21 Jul 2025 02:13:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTb4z2Nz3Mtj; Mon, 21 Jul 2025 02:13:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Byq2GWoZsapLqJDuLirx2wC4fItkwRJ8YgmxN01ZX2Q=; b=HJWtwZhbgXMUIvvR+HAOMvT3t9m4viB/AIvIrjXDK6+8kVbwG1FE3GkxCblbFhFEAWK1QL 6JAWnDfz4L4vNSSjJMosanqjoJuveoujvC2k3sOEkBCPUliKC1hQHeeYVkYyzlDcsr2QoB YVVCNzMGFM4pd4EamIfGSlWy7oEQ5ZU0NkFMWu6WfM0lTF/ylX33e/MWmieRpuIqKCUvVt 8Gj+69up2DOM73uhawJy95Is1fcA/kMGWylwg/mqaxZ5tQONAT0/nu8IBr9WPHoRThU53j pwhNt9NJ/O914lG0e8tZ5zhGj96k2g7R7AemKwwZeLyRfZ/4NrVAzOVFPzPTqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Byq2GWoZsapLqJDuLirx2wC4fItkwRJ8YgmxN01ZX2Q=; b=YA3JIKvkceuRM482d388y2p8L6CHFlM/ZMZq5fFdlZuoe2nCy3Nm93y4I+vfofd5Sz9aFl lX4wjuGPne5mr6JITP9ltbULJoMsGQXxexVbeuZfNoU145mr/cKVd6uNvhyyJxN8ipINsK on/aVUorK4TGYy+GzgySwrp/9Vl4bqyqZIo5q8F3XJDPlWl7yAzDg9Ufzw4anjgjL3+sqz r9Twv5wQ2OVj5kETeJMae8yygvjBpuqrgdW014AqbqKSuLaegkgbM7WN9hgWOfyhjBOfcj AQ06jeN4UCu1QzaTfBC2yE4IZhk7dD9XOtdurOCZ3tlH+H3IL9170YaDOieLbQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064019; a=rsa-sha256; cv=none; b=fPK8zNa+uzNFaJRFR+p6iJvljgdimxXrS6VRzATOnXgEO+dBCfr17FyB/HVNtyM5jOHyAK gWwtoVw3dE9+qOzu12iHQq1pGuXLjwq7AkOlXdxryyoXKoi660Kw2R8jNUk/pgz0iVfKXg U4K+R8MVyJrwvLABIOmnS5VFe6DDxQYJPx09fzmVyVEWVyT4XW7nx7fZXxSgs8EbGWcs3H V36bVI8/aOVfuGP5EMVM6CDUfMos3iGf3EdhP26GBBkunylb1iEmhfFJ8PUgJtkfjRS0Sn 17WGSLP4kCklQyQKN0hRR0agf5v/4k0ZG4KnJ2K9Xicp1+sesZrAPPfAqAVviw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTb4Zk6zdym; Mon, 21 Jul 2025 02:13:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2DdXd013335; Mon, 21 Jul 2025 02:13:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2DdSp013332; Mon, 21 Jul 2025 02:13:39 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:39 GMT Message-Id: <202507210213.56L2DdSp013332@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: a2328a1338e0 - stable/14 - mk: add PLAIN_TESTS_PORCH support List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a2328a1338e0bd17fc4c751228ba49b6de4ca5ec Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=a2328a1338e0bd17fc4c751228ba49b6de4ca5ec commit a2328a1338e0bd17fc4c751228ba49b6de4ca5ec Author: Kyle Evans AuthorDate: 2024-10-21 01:31:50 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:23 +0000 mk: add PLAIN_TESTS_PORCH support porch(1), available via sysutils/porch, is an expect(1)-like program that uses lua instead of tcl for scripting. Imminent use will be to execute tests of tty canonicalization to ensure we don't regress some of the corner cases we've fixed, but tests for other interactive programs are being considered as well. PLAIN_TESTS_PORCH is being introduced primarily to get the metadata right without writing it out for every single test; required_programs ensures that we skip the tests if the port is not installed. Reviewed by: 0mp (previous version), ngie (cherry picked from commit 44f736c385f6b8d451feb9d6543220e8e61abcaa) --- share/mk/bsd.README | 3 +++ share/mk/plain.test.mk | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/share/mk/bsd.README b/share/mk/bsd.README index 24acc355b9b5..b68d7b66402d 100644 --- a/share/mk/bsd.README +++ b/share/mk/bsd.README @@ -702,6 +702,9 @@ PLAIN_TESTS_C The names of the plain (legacy) programs to build. PLAIN_TESTS_CXX The names of the plain (legacy) test programs to build. +PLAIN_TESTS_PORCH The names of the plain (legacy) porch(1)-based + test programs to build. + PLAIN_TESTS_SH The names of the plain (legacy) test programs to build. TAP_PERL_INTERPRETER diff --git a/share/mk/plain.test.mk b/share/mk/plain.test.mk index cc6d268185da..485a78f8ea47 100644 --- a/share/mk/plain.test.mk +++ b/share/mk/plain.test.mk @@ -43,6 +43,17 @@ TEST_INTERFACE.${_T}= plain .endfor .endif +.if !empty(PLAIN_TESTS_PORCH) +SCRIPTS+= ${PLAIN_TESTS_PORCH:S/$/.orch/} +_TESTS+= ${PLAIN_TESTS_PORCH} +.for _T in ${PLAIN_TESTS_PORCH} +SCRIPTSDIR_${_T}.orch= ${TESTSDIR} + +TEST_INTERFACE.${_T}= plain +TEST_METADATA.${_T}+= required_programs="porch" +.endfor +.endif + .if !empty(PLAIN_TESTS_SH) SCRIPTS+= ${PLAIN_TESTS_SH} _TESTS+= ${PLAIN_TESTS_SH} From nobody Mon Jul 21 02:13:40 2025 X-Original-To: dev-commits-src-branches@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 4blkTd1MSbz61xnr; Mon, 21 Jul 2025 02:13:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTc6B4hz3N0b; Mon, 21 Jul 2025 02:13:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064020; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0csbvnz93KbFM3pBe/4Knes3aDMRCIbXmNkkXp3wSsk=; b=FtSBwtnhnNL1VcwrGm2Fh09Epb5mKPtIwy9ir9skAaH7w5Cc5mjVviuK4k+ALeLdz/3iFs JV/tLUwNyY7c4rhuJk9KUHN8VFLqAHMdwwfEtHRTjqKgnRQLXUquzVbxd9+HOC1qtS/Qas LIIyze8vInOnK+ImRQ9LNqB0PdAtGqB1yL3gZDqrut01c6O0UFxKPag2UugnOXUp+a74J1 VP2eL0L+ntZemRz8DhkVuzpiacOHCWRIj8Z0UnuRlxS5JUEfKF0hlFFbGtVrH4qfaVMf2s SjzfPMdFK4OJxenOGTLKg/iKuoDUxLpRsyoJBTrhQYgihh4hy197s5DDGarS8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064020; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0csbvnz93KbFM3pBe/4Knes3aDMRCIbXmNkkXp3wSsk=; b=sK+LzeR2r5kbt1WqpjFU38XXQZNnW5wDwNT3rugq9j7R0y2yq46tkTzOCOaE46ALMvfnjL Pz6yL/c+j0Rry21hdyGWkmJR/5vtJyE9Fd/ydB23SSglX2J0fms/OsmW7N0HLOQy7k8jcc UZJIxuGu0DosN6nS7qJXiIfFDgAClGOHudnQSdTEgVqEidwEy2YxKTT8ludCrxN7l2wmao gwSTp4ZiecOZclVaH64tvMfN0kgTg45Houi2Yu+PSb9gI+VG2Au8C3j92iC8V4H2OCbR2i CJnVEtOTtJDa5Ol8zERcb+1OO7E08427WYG89An0dDOh8kIM8yWWOwNbaMrKzQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064020; a=rsa-sha256; cv=none; b=dDh+cg6ormkXrS3sxOyqc8Drlql3L2rqR/dxuN3BbvlX17/gvXJyguZ+ARTJR7/UX3rvT3 z9TiUGlWtPunBtjyUpTUKlW5RXU3e/7bktDTk6ahpo7iKZkIF/6SaYPDfF2VyFKpg2Ehe/ 7oPfUcEr8Yel9w6H6R3JXNib5TAHxIGvZh4vRL1OunEThjiFqBLqlU8iTqDin+laeL8VcJ zwZV94wuI1qXKrGtgd6oVVZFzUENMmIBOjGPjNAWoS5ViuWN+zRbykFAlAG2NW08Gmw6ue j5e0apMmF+u2Mfu0ywlCUFkp5EIO5IdpNXBnrFhJNtEbg9AOqx0cZNgNMK9ZwQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTc5nYlzfdL; Mon, 21 Jul 2025 02:13:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2DeuS013376; Mon, 21 Jul 2025 02:13:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2De2s013373; Mon, 21 Jul 2025 02:13:40 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:40 GMT Message-Id: <202507210213.56L2De2s013373@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 1bc0b2112e94 - stable/14 - tests: kern: add some porch(1)-based tty tests List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1bc0b2112e94a8cb7243d9b3d229fa6ec6137368 Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=1bc0b2112e94a8cb7243d9b3d229fa6ec6137368 commit 1bc0b2112e94a8cb7243d9b3d229fa6ec6137368 Author: Kyle Evans AuthorDate: 2024-10-21 01:31:59 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:24 +0000 tests: kern: add some porch(1)-based tty tests If sysutils/porch is installed, we'll do some basic testing of tty behavior. The existing tests primarily cover ICANON-related processing and corner cases that have been fixed somewhat recently, but I anticipate growing this out a bit in due time. Reviewed by: ngie (cherry picked from commit 096c39fae4ad5135a317925d8749b7d83f65ebf8) --- etc/mtree/BSD.tests.dist | 2 + tests/sys/kern/Makefile | 1 + tests/sys/kern/tty/Makefile | 12 +++ tests/sys/kern/tty/fionread.c | 21 +++++ tests/sys/kern/tty/readsz.c | 130 +++++++++++++++++++++++++++++ tests/sys/kern/tty/test_canon.orch | 102 ++++++++++++++++++++++ tests/sys/kern/tty/test_canon_fullbuf.orch | 23 +++++ tests/sys/kern/tty/test_ncanon.orch | 39 +++++++++ tests/sys/kern/tty/test_recanon.orch | 90 ++++++++++++++++++++ 9 files changed, 420 insertions(+) diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index f29fad1395f8..6833d35bae76 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -826,6 +826,8 @@ .. pipe .. + tty + .. .. kqueue libkqueue diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile index 89c993a39dc7..cb6c3066a03d 100644 --- a/tests/sys/kern/Makefile +++ b/tests/sys/kern/Makefile @@ -125,6 +125,7 @@ WARNS?= 3 TESTS_SUBDIRS+= acct TESTS_SUBDIRS+= execve TESTS_SUBDIRS+= pipe +TESTS_SUBDIRS+= tty .include diff --git a/tests/sys/kern/tty/Makefile b/tests/sys/kern/tty/Makefile new file mode 100644 index 000000000000..c362793a8b64 --- /dev/null +++ b/tests/sys/kern/tty/Makefile @@ -0,0 +1,12 @@ +TESTSDIR= ${TESTSBASE}/sys/kern/tty +BINDIR= ${TESTSDIR} + +PLAIN_TESTS_PORCH+= test_canon +PLAIN_TESTS_PORCH+= test_canon_fullbuf +PLAIN_TESTS_PORCH+= test_ncanon +PLAIN_TESTS_PORCH+= test_recanon + +PROGS+= fionread +PROGS+= readsz + +.include diff --git a/tests/sys/kern/tty/fionread.c b/tests/sys/kern/tty/fionread.c new file mode 100644 index 000000000000..929d613f883b --- /dev/null +++ b/tests/sys/kern/tty/fionread.c @@ -0,0 +1,21 @@ +/*- + * Copyright (c) 2024 Kyle Evans + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include + +#include +#include +#include + +int +main(void) +{ + int nb; + + assert(ioctl(STDIN_FILENO, FIONREAD, &nb) == 0); + printf("%d", nb); + return (0); +} diff --git a/tests/sys/kern/tty/readsz.c b/tests/sys/kern/tty/readsz.c new file mode 100644 index 000000000000..95dafa02472f --- /dev/null +++ b/tests/sys/kern/tty/readsz.c @@ -0,0 +1,130 @@ +/*- + * Copyright (c) 2024 Kyle Evans + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +static void +usage(void) +{ + + fprintf(stderr, "usage: %s [-b bytes | -c lines | -e] [-s buffer-size]\n", + getprogname()); + exit(1); +} + +int +main(int argc, char *argv[]) +{ + char *buf; + const char *errstr; + size_t bufsz = 0, reps; + ssize_t ret; + enum { MODE_BYTES, MODE_COUNT, MODE_EOF } mode; + int ch; + + /* + * -b specifies number of bytes. + * -c specifies number of read() calls. + * -e specifies eof (default) + * -s to pass a buffer size + * + * Reading N lines is the same as -c with a high buffer size. + */ + mode = MODE_EOF; + while ((ch = getopt(argc, argv, "b:c:es:")) != -1) { + switch (ch) { + case 'b': + mode = MODE_BYTES; + reps = strtonum(optarg, 0, SSIZE_MAX, &errstr); + if (errstr != NULL) + errx(1, "strtonum: %s", errstr); + break; + case 'c': + mode = MODE_COUNT; + reps = strtonum(optarg, 1, SSIZE_MAX, &errstr); + if (errstr != NULL) + errx(1, "strtonum: %s", errstr); + break; + case 'e': + mode = MODE_EOF; + break; + case 's': + bufsz = strtonum(optarg, 1, SSIZE_MAX, &errstr); + if (errstr != NULL) + errx(1, "strtonum: %s", errstr); + break; + default: + usage(); + } + } + + if (bufsz == 0) { + if (mode == MODE_BYTES) + bufsz = reps; + else + bufsz = LINE_MAX; + } + + buf = malloc(bufsz); + if (buf == NULL) + err(1, "malloc"); + + for (;;) { + size_t readsz; + + /* + * Be careful not to over-read if we're in byte-mode. In every other + * mode, we'll read as much as we can. + */ + if (mode == MODE_BYTES) + readsz = MIN(bufsz, reps); + else + readsz = bufsz; + + ret = read(STDIN_FILENO, buf, readsz); + if (ret == -1 && errno == EINTR) + continue; + if (ret == -1) + err(1, "read"); + if (ret == 0) { + if (mode == MODE_EOF) + return (0); + errx(1, "premature EOF"); + } + + /* Write out what we've got */ + write(STDOUT_FILENO, buf, ret); + + /* + * Bail out if we've hit our metric (byte mode / count mode). + */ + switch (mode) { + case MODE_BYTES: + reps -= ret; + if (reps == 0) + return (0); + break; + case MODE_COUNT: + reps--; + if (reps == 0) + return (0); + break; + default: + break; + } + } + + return (0); +} diff --git a/tests/sys/kern/tty/test_canon.orch b/tests/sys/kern/tty/test_canon.orch new file mode 100644 index 000000000000..28018edfdcd6 --- /dev/null +++ b/tests/sys/kern/tty/test_canon.orch @@ -0,0 +1,102 @@ +#!/usr/bin/env -S porch -f +-- +-- Copyright (c) 2024 Kyle Evans +-- +-- SPDX-License-Identifier: BSD-2-Clause +-- + +timeout(3) + +spawn("cat") + +write "Complete\r" +match "Complete\r" + +write "Basic\rIncomplete" +match "Basic\r" + +-- We shouldn't see any of the "Incomplete" line +fail(function() +end) + +match "Incomp" { + callback = function() + exit(1) + end +} + +fail(nil) + +-- Pushing a ^D along should force a flush of the tty, cat(1) will write the +-- result without a trailing newline. +write " line^D" +match "Incomplete line$" + +-- Erase! +write "Dog^H^D" +match "Do$" + +-- More erase! +write "Cat Dog^W^D" +match "Cat $" + +write "^D" +eof() + +local function fionread_test(str, expected) + spawn("fionread") + + write(str) + match(expected) +end + +-- Incomplete line +fionread_test("Hello", "0") +-- VEOF does not count +fionread_test("Hello^D", "5") +-- VEOF still doesn't count, even if the next line is an extra VEOF later +fionread_test("Hello^D^D", "5") +-- read(2) definitely won't return the second incomplete line +fionread_test("Hello^Dther", "5") +-- read(2) also won't return a second complete line at once +fionread_test("Hello^Dthere^D", "5") +-- Finally, send a VEOF to terminate a blank line and signal EOF in read(2) +fionread_test("^D", "0") + +-- \r will instead show up in the input stream to the application, so we must +-- make sure those are counted where VEOF generally wouldn't be. +fionread_test("Hello\r", "6") +fionread_test("Hello\rther", "6") +fionread_test("Hello\rthere\r", "6") +fionread_test("\r", "1") + +local function readsz_test(str, arg, expected) + spawn("readsz", table.unpack(arg)) + + if type(str) == "table" then + assert(#str == 2) + write(str[1]) + release() + + -- Give readsz a chance to consume the partial input before we send more + -- along. + sleep(1) + write(str[2]) + else + write(str) + end + match(expected) +end + +readsz_test("partial", {"-b", 3}, "^$") +readsz_test("partial^D", {"-b", 3}, "^par$") +readsz_test("partial^D", {"-c", 1}, "^partial$") +for s = 1, #"partial" do + readsz_test("partial^D", {"-s", s}, "^partial$") +end +-- Send part of the line, release and pause, then finish it. +readsz_test({"par", "tial^D"}, {"-c", 1}, "^partial$") +-- line is incomplete, so we'll just see the "partial" even if we want two +readsz_test("partial^Dline", {"-c", 2}, "^partial$") +readsz_test("partial^Dline^D", {"-c", 1}, "^partial$") +readsz_test("partial^Dline^D", {"-c", 2}, "^partialline$") diff --git a/tests/sys/kern/tty/test_canon_fullbuf.orch b/tests/sys/kern/tty/test_canon_fullbuf.orch new file mode 100644 index 000000000000..1833703e4f45 --- /dev/null +++ b/tests/sys/kern/tty/test_canon_fullbuf.orch @@ -0,0 +1,23 @@ +#!/usr/bin/env -S porch -f +-- +-- Copyright (c) 2024 Kyle Evans +-- +-- SPDX-License-Identifier: BSD-2-Clause +-- + +timeout(3) + +local TTYINQ_DATASIZE = 128 +local scream = string.rep("A", TTYINQ_DATASIZE - 1) + +spawn("cat") + +-- Fill up a whole block with screaming + VEOF +write(scream .. "^D") +match(scream .. "$") + +scream = scream .. "A" + +-- Now fill up the next block, but spill the VEOF over to a third block. +write(scream .. "^D") +match(scream .. "$") diff --git a/tests/sys/kern/tty/test_ncanon.orch b/tests/sys/kern/tty/test_ncanon.orch new file mode 100644 index 000000000000..14a34d82fa9a --- /dev/null +++ b/tests/sys/kern/tty/test_ncanon.orch @@ -0,0 +1,39 @@ +#!/usr/bin/env -S porch -f +-- +-- Copyright (c) 2024 Kyle Evans +-- +-- SPDX-License-Identifier: BSD-2-Clause +-- + +timeout(3) + +local function spawn_one(...) + spawn(...) + + stty("lflag", 0, tty.lflag.ICANON) +end + +-- We can send one byte... +spawn_one("readsz", "-c", 1) +write "H" +match "^H$" + +-- or many. +spawn_one("readsz", "-c", 1) +write "Hello" +match "^Hello$" + +-- VEOF is a normal character here, passed through as-is. +spawn_one("readsz", "-c", 1) +write "Hello^D" +match "^Hello\x04$" +spawn_one("readsz", "-c", 1) +write "^D" +match "^\x04$" + +-- Confirm that FIONREAD agrees that VEOF will be returned, even if it was sent +-- while the tty was still in canonical mode. +spawn("fionread") +write "^D" +stty("lflag", 0, tty.lflag.ICANON) +match "^1$" diff --git a/tests/sys/kern/tty/test_recanon.orch b/tests/sys/kern/tty/test_recanon.orch new file mode 100644 index 000000000000..e3943495ca5d --- /dev/null +++ b/tests/sys/kern/tty/test_recanon.orch @@ -0,0 +1,90 @@ +#!/usr/bin/env -S porch -f +-- +-- Copyright (c) 2024 Kyle Evans +-- +-- SPDX-License-Identifier: BSD-2-Clause +-- + +timeout(3) + +local TTYINQ_DATASIZE = 128 +local scream = string.rep("A", TTYINQ_DATASIZE - 1) + +local function ncanon() + stty("lflag", nil, tty.lflag.ICANON) +end + +local function canon() + stty("lflag", tty.lflag.ICANON) +end + +spawn("readsz", "-e") +ncanon() + +-- Fill up a whole block with screaming + VEOF; when it gets recanonicalized, +-- the next line should be pointing to the beginning of the next block. +write(scream .. "^D") + +canon() +match(scream .. "$") + +-- The same as above, but spilling VEOF over to the next block. +spawn("readsz", "-e") +ncanon() + +write(scream .. "A^D") + +canon() +match(scream .. "A$") + +-- We'll do it again, except with one character spilled over to the next block +-- before we recanonicalize. We should then have the scream, followed by a +-- partial line containing the spill over. +spawn("cat") +ncanon() + +write(scream .. "^DZ") + +canon() +match(scream .. "$") + +-- Sending "B^D" should give us "ZB" to make sure that we didn't lose anything +-- at the beginning of the next block. + +write("B^D") +match("^ZB$") + +-- Next we'll VEOF at the beginning. +spawn("readsz", "-e") +ncanon() + +write("^D") +match("^$") + +-- Finally, we'll trigger recanonicalization with an empty buffer. This one is +-- just about avoiding a panic. +spawn("true") + +ncanon() +canon() +release() +eof() + +spawn("readsz", "-c", "1") + +write("Test^Dfoo") +ncanon() + +match("^Test\x04foo$") + +-- Finally, swap VEOF out with ^F; before recent changes, we would remain +-- canonicalized at Test^D and the kernel would block on it unless a short +-- buffer was used since VEOF would not appear within the canonicalized bit. +spawn("readsz", "-c", 1) + +write("Test^DLine^F") +stty("cc", { + VEOF = "^F" +}) + +match("^Test\x04Line$") From nobody Mon Jul 21 02:13:41 2025 X-Original-To: dev-commits-src-branches@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 4blkTf3z5rz61xT1; Mon, 21 Jul 2025 02:13:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTf00Zyz3Mlf; Mon, 21 Jul 2025 02:13:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064022; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CKVgpoW9zBVT0TG9HrNQ+Z2YFPqyM8STwhv1HqXZS0I=; b=YYRAWbrt4Ty92QPRmZwk+zWTRcdd0oEzNAsFOvqWWy4luXgVCPT8ymk2VLeM2YDyMwVMmy BjzBEV6rRnyJ9sTh9fb9TvoJDPEY6uG2Qv3jFZgsq0LOGZlAS2ABJTCD8z2B/8vz3qPwLV 5k83RgKwQAVEC0Gam9YAfepycmZu5xzi3HM2cQ13Hl9KdetDClThj3oH1g1zP5LL4Vl+f9 Wk8OF9yVBhqFxXgd2hHTg33U+hzoOPFGfQQpHa2RxNIPW6OBd5KwIFklhh/hWrCz+Ly1M5 3YVTfMy6rfsv0ERBua7oTi3jmDZ4oDtkZgP4QN5f/+HsEeL5sOUbAScmazD0Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064022; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CKVgpoW9zBVT0TG9HrNQ+Z2YFPqyM8STwhv1HqXZS0I=; b=SJILcYOBoReZ9CaKi9si/JjcDznirIhhVEJJQKx3LMB3MBiru3nyS/957xhqCJeMxn8X+b LPI6b8XZhqwGlCy2xxGse0nYw8LZI04W9f6AwsKXrz2Q2n+bYx++mTXw5+EFVYHRJ0x7A/ uQOIZAKkXb/HUKVG8uPny+NfPDCatIpVldOl9LXkdIe7g7roiaR/Tc+7f0PTi50EcJKDKF 5dEsngonHjwxIFU9R6Fa6l5sR2W2/E2zo2EyLKCJ4ge3YdQ4l4ttLL72r7MO/I4aiz8w34 TL/D2YfU0hQy61S0Gw0MkQZ61jbfup2p7974HR0YKqaAWTZ1hzBR5gQsJztApA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064022; a=rsa-sha256; cv=none; b=H5MZ+h+c2s2edYQ8eMDSvznARLemVuNUPzCevXVPQkP7BKI9O6CXe9JRahUbwHGEygMxJ5 5lDze9ziHo5Q1Zd/XJd69SSHTe3p4IzUrFa31TNFU4HxZZ5ijfRXw43Hq9h/B1pvbeF3JV D66N0qxbtdSfvwnMB9ClcSHlib9tp2pbhQkErf1lXkrqj+wgOgh5j3ndglKhyoaI55LP2B 7CgDMXGG1Q+dpIuQhEckjn7O/tHOdQk6bAB4KtD2EBCXxDHyxWyKG0bUgMRTIs9jxlucbl Uanrw2PTIwiRdeCKwfXHJlTS+qS2CpbM1QTRHza6QTaNEB/aye7kwYVLOz2sOA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTd6kBbzfgZ; Mon, 21 Jul 2025 02:13:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2Dfmp013410; Mon, 21 Jul 2025 02:13:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2DfHq013407; Mon, 21 Jul 2025 02:13:41 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:41 GMT Message-Id: <202507210213.56L2DfHq013407@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 9e09ab407983 - stable/14 - loader: Fix orb position List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 9e09ab407983bcda008d4047f33e7de68d1d1c41 Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=9e09ab407983bcda008d4047f33e7de68d1d1c41 commit 9e09ab407983bcda008d4047f33e7de68d1d1c41 Author: Emmanuel Vadot AuthorDate: 2025-01-07 08:57:57 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:24 +0000 loader: Fix orb position Fix the orb position to be aligned with the menu Reviewed by: imp, tsoome Sponsored by: Beckhoff Automation GmbH & Co. KG (cherry picked from commit 1b4e1171315398decb1ad3fceffcacf29cff218b) --- stand/lua/drawer.lua | 4 ++-- stand/lua/gfx-orb.lua | 2 +- stand/lua/gfx-orbbw.lua | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index 8c4307220642..1bf741b2373e 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -470,9 +470,9 @@ logodefs = { } brand_position = {x = 2, y = 1} -logo_position = {x = 46, y = 4} +logo_position = {x = 40, y = 10} menu_position = {x = 5, y = 10} -frame_size = {w = 42, h = 14} +frame_size = {w = 39, h = 14} default_shift = {x = 0, y = 0} shift = default_shift diff --git a/stand/lua/gfx-orb.lua b/stand/lua/gfx-orb.lua index 00f4aeb3bceb..cd834a2d6b8e 100644 --- a/stand/lua/gfx-orb.lua +++ b/stand/lua/gfx-orb.lua @@ -45,7 +45,7 @@ return { " .---.....----.\027[m", }, requires_color = true, - shift = {x = 2, y = 3}, + shift = {x = 2, y = -1}, image = "/boot/images/freebsd-logo-rev.png", image_rl = 15 } diff --git a/stand/lua/gfx-orbbw.lua b/stand/lua/gfx-orbbw.lua index 93ffd2366196..a97174a6a5a4 100644 --- a/stand/lua/gfx-orbbw.lua +++ b/stand/lua/gfx-orbbw.lua @@ -44,6 +44,6 @@ return { " .-- `--.", " .---.....----.", }, - shift = {x = 2, y = 4}, + shift = {x = 2, y = -1}, } } From nobody Mon Jul 21 02:13:42 2025 X-Original-To: dev-commits-src-branches@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 4blkTh0SNkz61xtr; Mon, 21 Jul 2025 02:13:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTg18N1z3Mlt; Mon, 21 Jul 2025 02:13:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064023; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WYfN8NC3ou6JROygOTOzHQsBqsDTThj4Mpg/KtNyD3E=; b=THUT707WNShTUj/gW0dYeT3LyeRQA7VxfQfpZ5te8efJwPeIP089Jeepsc+yJdpxtnx6zh iXCdHW+5SNbmJUPUjzMQfu+eubzdGBFJ7XzzzkNpzMWojA1i8DfG9/IUcEr7KhnDFtTQ0F JllZknUOC5RHMniOCXaEUnO2cYZeaXbNwtmFfFdDBDn3JYgjDUZUXJzQonRoo/girjeZKd 0IzWrPOXyy50VHPUJzwXzz6FfWSrW02h4SN/aCO5i7ANNEIGCkkwRn0MhcEWnAF/zmaR7J taKv/newFtTfArDNQC/D0LkPNfAJpV6wgbU3ZKntZrZbeJmqxzB0MXkmOaazLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064023; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WYfN8NC3ou6JROygOTOzHQsBqsDTThj4Mpg/KtNyD3E=; b=KgP1/LPcePVgoiRp/tt4yLqH/aFn3OsTyjj+fFfI2m4d9vpzfJtn7c8B9IIeSWPLT/fQE0 XFUkYBESCReTQwh1omwSVHCp4nsWGvpnMevzpVlKrcOs+FJ/iQ1MRJUiGw4Xz9HWZx4Z4i xAA5tYInH2Z9RGzb1DRh2fzMO4GOCt7JTMXZ/Z7GbR2Q1x89j777WShdrsCB3CB60LWpg3 u6W0Vl49EamaE55AgHacJm4hJP1mHgrDWwTr3AdCjR+qN7Crh8V83kqRwBDlFg7HqW+owL 0+7FVqi1OgUp9NIBCp8VYokxxW4dDJc1UoBbSFBJ3IQ0AHv89ICJ2HVRqnFtIw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064023; a=rsa-sha256; cv=none; b=ctV4aLlM/aFjHuFz6XqflqnL3PjwVGqR5lPQFNKZw6CIiParDDWx3do5WUbhXL7HearWeN kGbXmxKp9aht2F3ry44IYDYNWH7BZWTxdJoZMLnkDhWuE5APxiw5HmlMemTgg3+4tYzydv MGLZswhqgnTy3hNRrqeL/brraOJyYVhl/ABr3w3eQO7R3ESqoLGdT47kqALUq6AF1DG79c U5wW2jRmgelZweSc8D4XeuCPlNZlSRWvWGKSEKparmAHQR672R5IzqfrvgzAFPzUEqoV4f fv9CBlKKaIKTnu76wEIXBnBAOpbcWMFf4AdIA8Rmxae8OwkBtL2VXv24L6bPNA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTg0XvgzfGN; Mon, 21 Jul 2025 02:13:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2DgkW013443; Mon, 21 Jul 2025 02:13:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2Dg65013440; Mon, 21 Jul 2025 02:13:42 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:42 GMT Message-Id: <202507210213.56L2Dg65013440@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 410197011bdf - stable/14 - loader: ficl: restore isvirtualized? List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 410197011bdfbdf25b92d94f2bf3484e44eb209b Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=410197011bdfbdf25b92d94f2bf3484e44eb209b commit 410197011bdfbdf25b92d94f2bf3484e44eb209b Author: Kyle Evans AuthorDate: 2025-05-08 04:04:17 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:24 +0000 loader: ficl: restore isvirtualized? This word was accidentally removed when gfx bindings were made optional to remove some overhead not needed for all loaders. This one isn't graphics related, so we can safely restore it without irritating anyone. Reported by: sjg Reviewed by: adrian, imp Fixes: 9c8bf69a53f ("loader: Only create gfx 4th bindings when [...]") (cherry picked from commit 354fb783e6d5ff9abcb6529cbb17cbb2ff6a7375) --- stand/ficl/loader.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stand/ficl/loader.c b/stand/ficl/loader.c index 69a65ebedb73..32ec2d6fc172 100644 --- a/stand/ficl/loader.c +++ b/stand/ficl/loader.c @@ -864,6 +864,9 @@ void ficlCompilePlatform(FICL_SYSTEM *pSys) dictAppendWord(dp, "ccall", ficlCcall, FW_DEFAULT); dictAppendWord(dp, "uuid-from-string", ficlUuidFromString, FW_DEFAULT); dictAppendWord(dp, "uuid-to-string", ficlUuidToString, FW_DEFAULT); +#ifndef TESTMAIN + dictAppendWord(dp, "isvirtualized?", ficlIsvirtualizedQ, FW_DEFAULT); +#endif SET_FOREACH(fnpp, X4th_compile_set) (*fnpp)(pSys); From nobody Mon Jul 21 02:13:44 2025 X-Original-To: dev-commits-src-branches@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 4blkTj00kTz61xW1; Mon, 21 Jul 2025 02:13:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTh1l8Bz3NDs; Mon, 21 Jul 2025 02:13:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064024; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HYlf/UFxbAHEStE852Nj7FGq5ya28DS+Tg46rCxr1Fw=; b=BeEMYil/BzHGAOgv7zZ4WVX9X3qLlO2FYUtttoDwOQ2qT05IgfZ1CDIc4Bv3EJvBDh55pe 9dGQvLWOGvX9CJ26Nn9R5glI3Jkm4BbaMdgKE/ozoZEoB9mTAJaKhUPtjkr0Hrc3GkaDs6 o7pxYgrqwrRPU5fWiRhycSjwodshqFkohoUx9JcA0xxWmFds5Nzoyp+JUL973XHk7reae+ xqc5pdKoyFOEphtS07HfLC9FCC2yDiIjUDyBaQNyk/tAqulysPPDSKvPXYrsUFBVMaB2Y9 cRZaSyB0GDGwgYy8482u0qrjdOVvHpRqGPTsBBhNfTWQgeLq1i+v+ih8IUEqzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064024; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HYlf/UFxbAHEStE852Nj7FGq5ya28DS+Tg46rCxr1Fw=; b=B0HnEMTHZltFzaYCrfJekNAcNx5toziZQHSnUS/cmfCXZME2qeYjMV0tHVvxMddQ+nXuUO BzcHqpXRj3HPHRkzaGomdMQpq+D/JuwEZHznwatwJp9EMdsAe4iVp9RvEeGyE3zKCrFR4T zt4+GWcW7vnflE5961EJij9nnfFEctcwjEsyk6Q7aHVbvyBOKAx+KkIGnyshGGRKOBSEj1 yIGuAq5l6uyHfRyxqX7lBi7LrkC5JHykFWW7XhNMH/pSxybBb98IGy05vGlBuDBGBIalVr +0vpTSPNiFaGlwWXzv29tA3Bo3i5c59o93QQ9xIm7sc910v1IqSQVb2GuqDGYQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064024; a=rsa-sha256; cv=none; b=QIdA8Hdwp8Qq3ap1myNy1J8B7vNwtQFJYY0gF3P7QWGY0PZsGiYbU/9W1nuoe1R7cBQaeO KUcgO4zrVzH9PN4BPwRu6K17MQbxEVYl078iDj8l/7dJNbyC1d61oy6nPrLS09QUhZN3RO qvi4+QH9Br2KmcjHjIWYyWf/eg04uQe9oSN9hW+BrHKmoyiEymBMIko1ksui5/k05z6RNv q5wtJc04hWsjz6Au9PhUIysAt5+YYlMWLXGnrCsR7G1qUi7POBrZisBTHGbIt2N5h6Q1at tQMpsVilJVgT1PhNKfz56OZPZ63fBBkwmRxv6aJBbE6fiEJWz8vzgpeXvxJ25g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTh1Jw1zdjs; Mon, 21 Jul 2025 02:13:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2Di7C013476; Mon, 21 Jul 2025 02:13:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2Dibe013473; Mon, 21 Jul 2025 02:13:44 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:44 GMT Message-Id: <202507210213.56L2Dibe013473@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 785abf57ab46 - stable/14 - Merge commit '2a7e45eef31292cf9dd82caf3346eb2acb5b6225' List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 785abf57ab46cd890e5f5efc05d897b27edb2f35 Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=785abf57ab46cd890e5f5efc05d897b27edb2f35 commit 785abf57ab46cd890e5f5efc05d897b27edb2f35 Author: Kyle Evans AuthorDate: 2025-05-21 01:36:07 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:24 +0000 Merge commit '2a7e45eef31292cf9dd82caf3346eb2acb5b6225' Update wireguard-tools to the latest version, which has some stubbed out support for incremental Allowed-IPs updates that we would need to add kernel support for. (cherry picked from commit 137de4b34d45192985e21f6d6163533da547fbac) --- contrib/wireguard-tools/config.c | 23 +++++++++++++++++++++++ contrib/wireguard-tools/containers.h | 5 +++++ contrib/wireguard-tools/ipc-freebsd.h | 5 +++++ contrib/wireguard-tools/ipc-uapi.h | 2 +- contrib/wireguard-tools/man/wg.8 | 8 ++++++-- contrib/wireguard-tools/set.c | 2 +- contrib/wireguard-tools/show.c | 4 ++-- contrib/wireguard-tools/version.h | 2 +- 8 files changed, 44 insertions(+), 7 deletions(-) diff --git a/contrib/wireguard-tools/config.c b/contrib/wireguard-tools/config.c index 81ccb479c367..6b8aa58700ce 100644 --- a/contrib/wireguard-tools/config.c +++ b/contrib/wireguard-tools/config.c @@ -337,6 +337,20 @@ static bool validate_netmask(struct wgallowedip *allowedip) return true; } +static inline void parse_ip_prefix(struct wgpeer *peer, uint32_t *flags, char **mask) +{ + /* If the IP is prefixed with either '+' or '-' consider this an + * incremental change. Disable WGPEER_REPLACE_ALLOWEDIPS. */ + switch ((*mask)[0]) { + case '-': + *flags |= WGALLOWEDIP_REMOVE_ME; + /* fall through */ + case '+': + peer->flags &= ~WGPEER_REPLACE_ALLOWEDIPS; + ++(*mask); + } +} + static inline bool parse_allowedips(struct wgpeer *peer, struct wgallowedip **last_allowedip, const char *value) { struct wgallowedip *allowedip = *last_allowedip, *new_allowedip; @@ -353,10 +367,18 @@ static inline bool parse_allowedips(struct wgpeer *peer, struct wgallowedip **la } sep = mutable; while ((mask = strsep(&sep, ","))) { + uint32_t flags = 0; unsigned long cidr; char *end, *ip; + parse_ip_prefix(peer, &flags, &mask); + saved_entry = strdup(mask); + if (!saved_entry) { + perror("strdup"); + free(mutable); + return false; + } ip = strsep(&mask, "/"); new_allowedip = calloc(1, sizeof(*new_allowedip)); @@ -387,6 +409,7 @@ static inline bool parse_allowedips(struct wgpeer *peer, struct wgallowedip **la else goto err; new_allowedip->cidr = cidr; + new_allowedip->flags = flags; if (!validate_netmask(new_allowedip)) fprintf(stderr, "Warning: AllowedIP has nonzero host part: %s/%s\n", ip, mask); diff --git a/contrib/wireguard-tools/containers.h b/contrib/wireguard-tools/containers.h index a82e8ddee46a..8fd813aff342 100644 --- a/contrib/wireguard-tools/containers.h +++ b/contrib/wireguard-tools/containers.h @@ -28,6 +28,10 @@ struct timespec64 { int64_t tv_nsec; }; +enum { + WGALLOWEDIP_REMOVE_ME = 1U << 0, +}; + struct wgallowedip { uint16_t family; union { @@ -35,6 +39,7 @@ struct wgallowedip { struct in6_addr ip6; }; uint8_t cidr; + uint32_t flags; struct wgallowedip *next_allowedip; }; diff --git a/contrib/wireguard-tools/ipc-freebsd.h b/contrib/wireguard-tools/ipc-freebsd.h index 446f13cacac2..58e5e71ce5cb 100644 --- a/contrib/wireguard-tools/ipc-freebsd.h +++ b/contrib/wireguard-tools/ipc-freebsd.h @@ -307,6 +307,11 @@ static int kernel_set_device(struct wgdevice *dev) nvl_aips[j] = nvlist_create(0); if (!nvl_aips[j]) goto err_peer; + if (aip->flags) { + //TODO: implement me + ret = -EOPNOTSUPP; + goto err_peer; + } nvlist_add_number(nvl_aips[j], "cidr", aip->cidr); if (aip->family == AF_INET) nvlist_add_binary(nvl_aips[j], "ipv4", &aip->ip4, sizeof(aip->ip4)); diff --git a/contrib/wireguard-tools/ipc-uapi.h b/contrib/wireguard-tools/ipc-uapi.h index f582916ecc9f..1d8a2710250a 100644 --- a/contrib/wireguard-tools/ipc-uapi.h +++ b/contrib/wireguard-tools/ipc-uapi.h @@ -89,7 +89,7 @@ static int userspace_set_device(struct wgdevice *dev) continue; } else continue; - fprintf(f, "allowed_ip=%s/%d\n", ip, allowedip->cidr); + fprintf(f, "allowed_ip=%s%s/%d\n", (allowedip->flags & WGALLOWEDIP_REMOVE_ME) ? "-" : "", ip, allowedip->cidr); } } fprintf(f, "\n"); diff --git a/contrib/wireguard-tools/man/wg.8 b/contrib/wireguard-tools/man/wg.8 index 79845391ec02..a0fc04c04cf1 100644 --- a/contrib/wireguard-tools/man/wg.8 +++ b/contrib/wireguard-tools/man/wg.8 @@ -55,7 +55,7 @@ transfer-rx, transfer-tx, persistent-keepalive. Shows the current configuration of \fI\fP in the format described by \fICONFIGURATION FILE FORMAT\fP below. .TP -\fBset\fP \fI\fP [\fIlisten-port\fP \fI\fP] [\fIfwmark\fP \fI\fP] [\fIprivate-key\fP \fI\fP] [\fIpeer\fP \fI\fP [\fIremove\fP] [\fIpreshared-key\fP \fI\fP] [\fIendpoint\fP \fI:\fP] [\fIpersistent-keepalive\fP \fI\fP] [\fIallowed-ips\fP \fI/\fP[,\fI/\fP]...] ]... +\fBset\fP \fI\fP [\fIlisten-port\fP \fI\fP] [\fIfwmark\fP \fI\fP] [\fIprivate-key\fP \fI\fP] [\fIpeer\fP \fI\fP [\fIremove\fP] [\fIpreshared-key\fP \fI\fP] [\fIendpoint\fP \fI:\fP] [\fIpersistent-keepalive\fP \fI\fP] [\fIallowed-ips\fP \fI[+|-]/\fP[,\fI[+|-]/\fP]...] ]... Sets configuration values for the specified \fI\fP. Multiple \fIpeer\fPs may be specified, and if the \fIremove\fP argument is given for a peer, that peer is removed, not configured. If \fIlisten-port\fP @@ -72,7 +72,11 @@ the device. The use of \fIpreshared-key\fP is optional, and may be omitted; it adds an additional layer of symmetric-key cryptography to be mixed into the already existing public-key cryptography, for post-quantum resistance. If \fIallowed-ips\fP is specified, but the value is the empty string, all -allowed ips are removed from the peer. The use of \fIpersistent-keepalive\fP +allowed ips are removed from the peer. By default, \fIallowed-ips\fP replaces +a peer's allowed ips. If + or - is prepended to any of the ips then +the update is incremental; ips prefixed with '+' or '' are added to the peer's +allowed ips if not present while ips prefixed with '-' are removed if present. +The use of \fIpersistent-keepalive\fP is optional and is by default off; setting it to 0 or "off" disables it. Otherwise it represents, in seconds, between 1 and 65535 inclusive, how often to send an authenticated empty packet to the peer, for the purpose of keeping diff --git a/contrib/wireguard-tools/set.c b/contrib/wireguard-tools/set.c index 75560fd8cf62..992ffa205d6b 100644 --- a/contrib/wireguard-tools/set.c +++ b/contrib/wireguard-tools/set.c @@ -18,7 +18,7 @@ int set_main(int argc, const char *argv[]) int ret = 1; if (argc < 3) { - fprintf(stderr, "Usage: %s %s [listen-port ] [fwmark ] [private-key ] [peer [remove] [preshared-key ] [endpoint :] [persistent-keepalive ] [allowed-ips /[,/]...] ]...\n", PROG_NAME, argv[0]); + fprintf(stderr, "Usage: %s %s [listen-port ] [fwmark ] [private-key ] [peer [remove] [preshared-key ] [endpoint :] [persistent-keepalive ] [allowed-ips [+|-]/[,[+|-]/]...] ]...\n", PROG_NAME, argv[0]); return 1; } diff --git a/contrib/wireguard-tools/show.c b/contrib/wireguard-tools/show.c index 3fd3d9e2a151..13777cf04280 100644 --- a/contrib/wireguard-tools/show.c +++ b/contrib/wireguard-tools/show.c @@ -312,9 +312,9 @@ static bool ugly_print(struct wgdevice *device, const char *param, bool with_int else printf("off\n"); } else if (!strcmp(param, "endpoints")) { - if (with_interface) - printf("%s\t", device->name); for_each_wgpeer(device, peer) { + if (with_interface) + printf("%s\t", device->name); printf("%s\t", key(peer->public_key)); if (peer->endpoint.addr.sa_family == AF_INET || peer->endpoint.addr.sa_family == AF_INET6) printf("%s\n", endpoint(&peer->endpoint.addr)); diff --git a/contrib/wireguard-tools/version.h b/contrib/wireguard-tools/version.h index c3ca131aadf4..0a7ef8daf041 100644 --- a/contrib/wireguard-tools/version.h +++ b/contrib/wireguard-tools/version.h @@ -1,3 +1,3 @@ #ifndef WIREGUARD_TOOLS_VERSION -#define WIREGUARD_TOOLS_VERSION "1.0.20210914" +#define WIREGUARD_TOOLS_VERSION "1.0.20250521" #endif From nobody Mon Jul 21 02:13:45 2025 X-Original-To: dev-commits-src-branches@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 4blkTj592Nz61xv2; Mon, 21 Jul 2025 02:13:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTj2dKZz3NF1; Mon, 21 Jul 2025 02:13:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064025; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iLmS7HjVE/G+Xza35+NHDWm8hZq4jmbYCl4oqOhovvU=; b=O1P5o9WiUMW87cZXP7mmYpYRYCUdbka1SGFKJFDqzOvH3fT46znYmzMDEMFszaLvTsC6YQ E75Dg5YjULekx2UxFVg1SDVThGXfoljeL5md7AE89JzeTYG/xGg+6CmJihDVvVd9tqJrPu TJ2j6JPvmN8ZLGkeykgOVRLJ7VHi08lJgdeMIwztFxUlIMktEKHw6R72CIrcSBR9iGM7NU nWbW+q6qEk1BbqMe/PbpjCQGWhMUqnfwN6Ye9HUlboC5GXwTmTIumEXmzVDT4QPGsFDuZ8 SMIfBZuYRkFCkGFswK8/Y7Ps6YiJpomblMGzeFwUI9JcFd71Xj8GHWS7EtmEnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064025; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iLmS7HjVE/G+Xza35+NHDWm8hZq4jmbYCl4oqOhovvU=; b=Hp+kmInw8Xp4KOBX1PouXWEeU7BTk66RuQ9oeGo4a967YNxhCEsurZEGxRjE883ZZjCKVz JCbY2fGoVLVtN+1ZKDQPSQ5OWQwwhrvrZVLu9BazFVFfw+F9AYficxjWDOUY2wuP4cAjku 8Zx8HjPLJw1/nWrgLvX7Ia6MyQrdnIZh0jpdmCwa/jVFmIbZhpIh4n4hEQKKBB/E9IOPBD Hfyx3ZwNawBaWevUtUXetV7JikAxmg5gVDGxw/g/7nBiPqoB0aKvZj32WOrPEbVYmHpe6x 3RoNbGGxh8aLgZVTRCUbDe/2efy3ej6Lzhlqz0DPXWU2ySjZoCj2Pp93Ep8Cvg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064025; a=rsa-sha256; cv=none; b=Lm3yundr3TY2HiaFDH1gsuy4DMXSGohCOhKS033I4KFEOEgqqAy8jgbmiwZoGwO+6sqYmm Sord7Lu6XNhfPH9XXHjcnomrMNdXukTROXC1A+BETE3hqwlFwepS4uyvXXaLOk187IaGyX lkSRF3x7dPbi8j5ppgBi/MAlzR6E5nJMbH8WysTgMA3lFt0+9kR7xoY+oporZ8PEYZQbf0 yvptr+09uMiJ+pTTr7BL8062OPRxkZaT8dfKxkGMSk5oxW+6Pmu2DbzwVA4r64t6zAX3NL 9cqAfsDUNPaqH9ICsdSsK4jJ1Ws28ef5fCl+plfafxRix0dn4Bsvqnbn3w3HHw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTj2BVPzfJh; Mon, 21 Jul 2025 02:13:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2DjbS013509; Mon, 21 Jul 2025 02:13:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2Dj9l013506; Mon, 21 Jul 2025 02:13:45 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:45 GMT Message-Id: <202507210213.56L2Dj9l013506@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: f099c6b3a423 - stable/14 - kern: tty: refactor TIOCSTI privilege checks slightly List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f099c6b3a423a78c1367a11fd987457ae592924f Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f099c6b3a423a78c1367a11fd987457ae592924f commit f099c6b3a423a78c1367a11fd987457ae592924f Author: Kyle Evans AuthorDate: 2025-05-28 01:19:17 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:25 +0000 kern: tty: refactor TIOCSTI privilege checks slightly This removes some repetition from it and makes the flow a little more obvious. Future work may find some way to add more constraints to the unprivileged path, add a security sysctl to disable it, or perhaps some combination of the two. Reviewed by: kib, markj (cherry picked from commit 59fc4cda1bfa712c46d407d1e83bdd5c63e6e0e3) --- sys/kern/tty.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/sys/kern/tty.c b/sys/kern/tty.c index b1b3b268d0e9..47f9f25cec37 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1643,6 +1643,24 @@ tty_set_winsize(struct tty *tp, const struct winsize *wsz) tty_signal_pgrp(tp, SIGWINCH); } +static int +tty_sti_check(struct tty *tp, int fflag, struct thread *td) +{ + /* Root can bypass all of our constraints. */ + if (priv_check(td, PRIV_TTY_STI) == 0) + return (0); + + /* Unprivileged users must have it opened for read. */ + if ((fflag & FREAD) == 0) + return (EPERM); + + /* It must also be their controlling tty. */ + if (!tty_is_ctty(tp, td->td_proc)) + return (EACCES); + + return (0); +} + static int tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag, struct thread *td) @@ -1988,11 +2006,9 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag, tty_info(tp); return (0); case TIOCSTI: - if ((fflag & FREAD) == 0 && priv_check(td, PRIV_TTY_STI)) - return (EPERM); - if (!tty_is_ctty(tp, td->td_proc) && - priv_check(td, PRIV_TTY_STI)) - return (EACCES); + error = tty_sti_check(tp, fflag, td); + if (error != 0) + return (error); ttydisc_rint(tp, *(char *)data, 0); ttydisc_rint_done(tp); return (0); From nobody Mon Jul 21 02:13:46 2025 X-Original-To: dev-commits-src-branches@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 4blkTl0S9Yz61xff; Mon, 21 Jul 2025 02:13:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTk3sVdz3NFN; Mon, 21 Jul 2025 02:13:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064026; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5XEEDkL2fDAESAxsQfEQS10r0XzxXhgbn9u18T7znTM=; b=eUHNp14ZPwYMl2r3Cho1lnR4iEl+u4raMY1Qwx37Z1xsgrcepyJb3nS62FX9/B32jINxTn 2KWgyiUmHmy81JGXxTOdtEoB/X0NoDZuw0znHTW2Robl1/EGu10d31t1XcvVl/bErP6wL9 oBfxsYNAEsIavBgDFr13Qb+lZRKAcJe73pa3zRyNJH16uifBDi4Jx1WNWw2gORK1nc2jKp sWQkelZlgUdemIN4gY5bCJfsJnc7b0VbroQl3wxF+vOXwYDAjA9dodVz+QS2sviU6De/ug 5kOTw3GwMaE6AhKImDDTCzjgCQ2HUzXp9IQ+dEgZohZDVlNRDbRULQRkEgE4Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064026; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5XEEDkL2fDAESAxsQfEQS10r0XzxXhgbn9u18T7znTM=; b=DR9+TiQ4OxqmudAWSAn+qY/AJR2N+f7VTIZ97dExKapn8Ml3clE+tFotcCTvNXyagj5rEa BZq2S6a421Zrb2UTnWqt9jE5fnHgrJ2F94tmTRDYv9TpO3pZ08y0o0TEgakjk/EUbdV9U3 u6QntB57HYHBo6YtMAzSfc1w6CUWcaaoZyl4EvIsbLXEVFSVKUK+tOimgJt6rbzWpzGD0N YYwWYIJXnH/cASxlTg1TZHVSfIZKDps0anE0Y73xE+KmGuDhZVIJjweRUsi5vKM+251eO2 xYxewQ0ErAf276BsmPZIi39D22/TgwObH6pNo+gfRk7aXWQ5HpNdZBpdT71ksA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064026; a=rsa-sha256; cv=none; b=vItfgw/IhYep6yH01jYMRRVq/wU/ct2FRayQEuAyryXxTOBaRb9ef8QrubEtVUD42spsZY ADAipreoRZzW07jfxTJe4Gnn2JQvVCr+OoIMVlhMClr6BQsiiH1RXyGwVzAtRDa1CcLO7H e6/SZ7PmRk9gr+dTyVGJMkNYUlNy2mfiucxwXPhmacV5NPTiIp28iomnKtmUNLfLxHpRv1 ruyU8BJiFLQeyc+L4fYx0f337FCIePPGJmdPECaM+HGh5SAoukQ2Wi1fX4zEkNKVDIM13y YrxG0iXg9v4FJw1c+8yD5amzvSElwYsquXp6/K11IE1IW3RF4nVqcDactrptgA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTk36gwzfcC; Mon, 21 Jul 2025 02:13:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2DkVU013545; Mon, 21 Jul 2025 02:13:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2DkXs013542; Mon, 21 Jul 2025 02:13:46 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:46 GMT Message-Id: <202507210213.56L2DkXs013542@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 793f5473aa21 - stable/14 - tests: kern: add some tests for TIOCSTI List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 793f5473aa218f773314c9c1294c7067a4d2d15d Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=793f5473aa218f773314c9c1294c7067a4d2d15d commit 793f5473aa218f773314c9c1294c7067a4d2d15d Author: Kyle Evans AuthorDate: 2025-05-28 01:19:18 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:25 +0000 tests: kern: add some tests for TIOCSTI These offer at least rudimentary coverage of TIOCSTI, ensuring that it basically works and does what it's described to do and throws errors for unprivileged use that is supposed to be blocked. Reviewed by: kib (cherry picked from commit d094dd9071cea1a2f67c5058caa4d22611da20ad) --- tests/sys/kern/tty/Makefile | 3 + tests/sys/kern/tty/test_sti.c | 337 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 340 insertions(+) diff --git a/tests/sys/kern/tty/Makefile b/tests/sys/kern/tty/Makefile index c362793a8b64..8628ab79875f 100644 --- a/tests/sys/kern/tty/Makefile +++ b/tests/sys/kern/tty/Makefile @@ -5,8 +5,11 @@ PLAIN_TESTS_PORCH+= test_canon PLAIN_TESTS_PORCH+= test_canon_fullbuf PLAIN_TESTS_PORCH+= test_ncanon PLAIN_TESTS_PORCH+= test_recanon +ATF_TESTS_C+= test_sti PROGS+= fionread PROGS+= readsz +LIBADD.test_sti= util + .include diff --git a/tests/sys/kern/tty/test_sti.c b/tests/sys/kern/tty/test_sti.c new file mode 100644 index 000000000000..f792001b4e3f --- /dev/null +++ b/tests/sys/kern/tty/test_sti.c @@ -0,0 +1,337 @@ +/*- + * Copyright (c) 2025 Kyle Evans + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +enum stierr { + STIERR_CONFIG_FETCH, + STIERR_CONFIG, + STIERR_INJECT, + STIERR_READFAIL, + STIERR_BADTEXT, + STIERR_DATAFOUND, + STIERR_ROTTY, + STIERR_WOTTY, + STIERR_WOOK, + STIERR_BADERR, + + STIERR_MAXERR +}; + +static const struct stierr_map { + enum stierr stierr; + const char *msg; +} stierr_map[] = { + { STIERR_CONFIG_FETCH, "Failed to fetch ctty configuration" }, + { STIERR_CONFIG, "Failed to configure ctty in the child" }, + { STIERR_INJECT, "Failed to inject characters via TIOCSTI" }, + { STIERR_READFAIL, "Failed to read(2) from stdin" }, + { STIERR_BADTEXT, "read(2) data did not match injected data" }, + { STIERR_DATAFOUND, "read(2) data when we did not expected to" }, + { STIERR_ROTTY, "Failed to open tty r/o" }, + { STIERR_WOTTY, "Failed to open tty w/o" }, + { STIERR_WOOK, "TIOCSTI on w/o tty succeeded" }, + { STIERR_BADERR, "Received wrong error from failed TIOCSTI" }, +}; +_Static_assert(nitems(stierr_map) == STIERR_MAXERR, + "Failed to describe all errors"); + +/* + * Inject each character of the input string into the TTY. The caller can + * assume that errno is preserved on return. + */ +static ssize_t +inject(int fileno, const char *str) +{ + size_t nb = 0; + + for (const char *walker = str; *walker != '\0'; walker++) { + if (ioctl(fileno, TIOCSTI, walker) != 0) + return (-1); + nb++; + } + + return (nb); +} + +/* + * Forks off a new process, stashes the parent's handle for the pty in *termfd + * and returns the pid. 0 for the child, >0 for the parent, as usual. + * + * Most tests fork so that we can do them while unprivileged, which we can only + * do if we're operating on our ctty (and we don't want to touch the tty of + * whatever may be running the tests). + */ +static int +init_pty(int *termfd, bool canon) +{ + int pid; + + pid = forkpty(termfd, NULL, NULL, NULL); + ATF_REQUIRE(pid != -1); + + if (pid == 0) { + struct termios term; + + /* + * Child reconfigures tty to disable echo and put it into raw + * mode if requested. + */ + if (tcgetattr(STDIN_FILENO, &term) == -1) + _exit(STIERR_CONFIG_FETCH); + term.c_lflag &= ~ECHO; + if (!canon) + term.c_lflag &= ~ICANON; + if (tcsetattr(STDIN_FILENO, TCSANOW, &term) == -1) + _exit(STIERR_CONFIG); + } + + return (pid); +} + +static void +finalize_child(pid_t pid, int signo) +{ + int status, wpid; + + while ((wpid = waitpid(pid, &status, 0)) != pid) { + if (wpid != -1) + continue; + ATF_REQUIRE_EQ_MSG(EINTR, errno, + "waitpid: %s", strerror(errno)); + } + + /* + * Some tests will signal the child for whatever reason, and we're + * expecting it to terminate it. For those cases, it's OK to just see + * that termination. For all other cases, we expect a graceful exit + * with an exit status that reflects a cause that we have an error + * mapped for. + */ + if (signo >= 0) { + ATF_REQUIRE(WIFSIGNALED(status)); + ATF_REQUIRE_EQ(signo, WTERMSIG(status)); + } else { + ATF_REQUIRE(WIFEXITED(status)); + if (WEXITSTATUS(status) != 0) { + int err = WEXITSTATUS(status); + + for (size_t i = 0; i < nitems(stierr_map); i++) { + const struct stierr_map *map = &stierr_map[i]; + + if ((int)map->stierr == err) { + atf_tc_fail("%s", map->msg); + __assert_unreachable(); + } + } + } + } +} + +ATF_TC(basic); +ATF_TC_HEAD(basic, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test for basic functionality of TIOCSTI"); + atf_tc_set_md_var(tc, "require.user", "unprivileged"); +} +ATF_TC_BODY(basic, tc) +{ + int pid, term; + + /* + * We don't canonicalize on this test because we can assume that the + * injected data will be available after TIOCSTI returns. This is all + * within a single thread for the basic test, so we simplify our lives + * slightly in raw mode. + */ + pid = init_pty(&term, false); + if (pid == 0) { + static const char sending[] = "Text"; + char readbuf[32]; + ssize_t injected, readsz; + + injected = inject(STDIN_FILENO, sending); + if (injected != sizeof(sending) - 1) + _exit(STIERR_INJECT); + + readsz = read(STDIN_FILENO, readbuf, sizeof(readbuf)); + + if (readsz < 0 || readsz != injected) + _exit(STIERR_READFAIL); + if (memcmp(readbuf, sending, readsz) != 0) + _exit(STIERR_BADTEXT); + + _exit(0); + } + + finalize_child(pid, -1); +} + +ATF_TC(root); +ATF_TC_HEAD(root, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that root can inject into another TTY"); + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(root, tc) +{ + static const char sending[] = "Text\r"; + ssize_t injected; + int pid, term; + + /* + * We leave canonicalization enabled for this one so that the read(2) + * below hangs until we have all of the data available, rather than + * having to signal OOB that it's safe to read. + */ + pid = init_pty(&term, true); + if (pid == 0) { + char readbuf[32]; + ssize_t readsz; + + readsz = read(STDIN_FILENO, readbuf, sizeof(readbuf)); + if (readsz < 0 || readsz != sizeof(sending) - 1) + _exit(STIERR_READFAIL); + + /* + * Here we ignore the trailing \r, because it won't have + * surfaced in our read(2). + */ + if (memcmp(readbuf, sending, readsz - 1) != 0) + _exit(STIERR_BADTEXT); + + _exit(0); + } + + injected = inject(term, sending); + ATF_REQUIRE_EQ_MSG(sizeof(sending) - 1, injected, + "Injected %zu characters, expected %zu", injected, + sizeof(sending) - 1); + + finalize_child(pid, -1); +} + +ATF_TC(unprivileged_fail_noctty); +ATF_TC_HEAD(unprivileged_fail_noctty, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that unprivileged cannot inject into non-controlling TTY"); + atf_tc_set_md_var(tc, "require.user", "unprivileged"); +} +ATF_TC_BODY(unprivileged_fail_noctty, tc) +{ + const char sending[] = "Text"; + ssize_t injected; + int pid, serrno, term; + + pid = init_pty(&term, false); + if (pid == 0) { + char readbuf[32]; + ssize_t readsz; + + /* + * This should hang until we get terminated by the parent. + */ + readsz = read(STDIN_FILENO, readbuf, sizeof(readbuf)); + if (readsz > 0) + _exit(STIERR_DATAFOUND); + + _exit(0); + } + + /* Should fail. */ + injected = inject(term, sending); + serrno = errno; + + /* Done with the child, just kill it now to avoid problems later. */ + kill(pid, SIGINT); + finalize_child(pid, SIGINT); + + ATF_REQUIRE_EQ_MSG(-1, (ssize_t)injected, + "TIOCSTI into non-ctty succeeded"); + ATF_REQUIRE_EQ(EACCES, serrno); +} + +ATF_TC(unprivileged_fail_noread); +ATF_TC_HEAD(unprivileged_fail_noread, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that unprivileged cannot inject into TTY not opened for read"); + atf_tc_set_md_var(tc, "require.user", "unprivileged"); +} +ATF_TC_BODY(unprivileged_fail_noread, tc) +{ + int pid, term; + + /* + * Canonicalization actually doesn't matter for this one, we'll trust + * that the failure means we didn't inject anything. + */ + pid = init_pty(&term, true); + if (pid == 0) { + static const char sending[] = "Text"; + ssize_t injected; + int rotty, wotty; + + /* + * We open the tty both r/o and w/o to ensure we got the device + * name right; one of these will pass, one of these will fail. + */ + wotty = openat(STDIN_FILENO, "", O_EMPTY_PATH | O_WRONLY); + if (wotty == -1) + _exit(STIERR_WOTTY); + rotty = openat(STDIN_FILENO, "", O_EMPTY_PATH | O_RDONLY); + if (rotty == -1) + _exit(STIERR_ROTTY); + + /* + * This injection is expected to fail with EPERM, because it may + * be our controlling tty but it is not open for reading. + */ + injected = inject(wotty, sending); + if (injected != -1) + _exit(STIERR_WOOK); + if (errno != EPERM) + _exit(STIERR_BADERR); + + /* + * Demonstrate that it does succeed on the other fd we opened, + * which is r/o. + */ + injected = inject(rotty, sending); + if (injected != sizeof(sending) - 1) + _exit(STIERR_INJECT); + + _exit(0); + } + + finalize_child(pid, -1); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, basic); + ATF_TP_ADD_TC(tp, root); + ATF_TP_ADD_TC(tp, unprivileged_fail_noctty); + ATF_TP_ADD_TC(tp, unprivileged_fail_noread); + + return (atf_no_error()); +} From nobody Mon Jul 21 02:13:47 2025 X-Original-To: dev-commits-src-branches@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 4blkTl6vT8z61xfj; Mon, 21 Jul 2025 02:13:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTl4JNDz3NG9; Mon, 21 Jul 2025 02:13:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064027; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rLSbwFjpifHANmFc13QXgJenve1UG+hsFh6679h4W8Q=; b=hv00yvrUzbT7BWpUE2KImIdpOwe+fprprMzl0C70tQQTML94OVVF9SK6WiE9ftkWc7B7xN TRQRUvaZH8eQ/0b+JkmHshbj97nCJMiJVqF+D6PFPde3w25k863h56Ewheeq0JiiRRJFoD NZduX+vbKn5Qf2K2XGiet6KTgN5Oba8nhgXKwG4HMTXKZVEkxwhOX3ARIcKrdn5OtJpVVU GoqVP1puZENma6pSuZ6gf3FtQyf4UG4pIgV0lxzYbsAyp+BP07MCv3UXWGeLJ5H7AehAGF 4IG0yDiAKqUPHos3mFwZqlI9rRcpADUQVBl7AeL8dCQ8x9UxA3Wg1uludEobyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064027; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rLSbwFjpifHANmFc13QXgJenve1UG+hsFh6679h4W8Q=; b=vc/0K4Ug9UhO3QkG+vm0BxM8JcHybUgDpOTYHAM+ilijZEAHcBO/uN5piG843D3DjHnYz0 yk1qeG558KoJYPLVPN10rfpDel53fHVExejm3erzyk9xBb5igYrFUuE481gBSd7t/a6Eyt Pfi9uzWOr3ktLAG7ZobOqpX5a/y/D8/A1eVp1i2Ip+bPdXYFe0lHHjvFlPeVirvC8HDfum xhIT7IRf/QFp1jtThnkgQXQXafkS/Mg+wNJmA6I4gQ7HZ6q80fq7sy1JFRZFUL4r+ThZZL xMUYqAx3tCtdD4uOK+pOXUTMI4eq/7k3pT6Freo/4kA3G/x0DLR6jKKwtMaGRw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064027; a=rsa-sha256; cv=none; b=HutHJsU0IBhhxFgrgPfFyqLLMO6nPNV4ebVYzP0imXEK0n//1pi3nDm/M/FyWsyyX/9zqA 8bgBAGpWhBX1Vr8gP/T0bqnSE1wlBWE+gF9R/1K+Q75TuRCvLrBDFn3fAc0z9+3BkqJSAX babhMp9XA6Lnq9VO0xXe343bM3iyE3bCNCLNdCouyiUULcbe+rttvZAGm5AjrPX/28KyY6 S2pWyVgl12zNHn3Hcib8kfbbT5ebgzqHNymkNBvDGY1oTP2lUiNQSeOYamHSX87PyLNSBZ ofAVB2mCjNWwUZ8zdDo4pl4F9bT2IdcAUESIxDJlaiFApnA9tZ/TbBFVI1Yx5g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTl3vmlzfdM; Mon, 21 Jul 2025 02:13:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2Dlpp013582; Mon, 21 Jul 2025 02:13:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2DlDU013579; Mon, 21 Jul 2025 02:13:47 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:47 GMT Message-Id: <202507210213.56L2DlDU013579@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: a934ad15516b - stable/14 - lualoader: allow graphical bits to be disabled with loader_gfx List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a934ad15516b47ff2018141381ddabab55061a56 Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=a934ad15516b47ff2018141381ddabab55061a56 commit a934ad15516b47ff2018141381ddabab55061a56 Author: Kyle Evans AuthorDate: 2025-06-06 14:44:14 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:25 +0000 lualoader: allow graphical bits to be disabled with loader_gfx Some people prefer the old ASCII art look and it's good to have a way to confirm that the fallbacks still work right on systems that have a functional framebuffer available. Add a loader_gfx loader.conf(5) variable to disable the eager use of graphics for these use-cases. While we're here, clean up the style in the area a little bit; the early porting that I did to lualoader did a lot of redundant ~= nil that has carried over into some of the later work. We can drop some of that, and also re-organize some of these variables to improve readability. ziaee notes that the positioning of the orb is a bit off; this is due to a change in positioning that happened in 1b4e1171315398dec ("loader: Fix orb position") to account for the image dimensions. This should be partially reverted to get it right; we shouldn't assume that we can use the same shift in gfx-* definitions for both the ASCII art and the associated image -- the {image, image_rl} pair should be converted to something more like an fbimg or gfx table that has the image, image width and a shift override to avoid messing up the ASCII positioning when disabled (or with no graphics available). Reviewed by: imp, manu, ziaee (manpages) (cherry picked from commit bef6d85b6de55e0e7adcfa1fd2e4abdcecbf9564) --- stand/defaults/loader.conf | 1 + stand/defaults/loader.conf.5 | 8 +++++++- stand/lua/drawer.lua | 30 +++++++++++++++--------------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/stand/defaults/loader.conf b/stand/defaults/loader.conf index 7397082ac29b..610f4e3be4f9 100644 --- a/stand/defaults/loader.conf +++ b/stand/defaults/loader.conf @@ -104,6 +104,7 @@ efi_max_resolution="1x1" # Set the max resolution for EFI loader to use: # WidthxHeight (e.g. 1920x1080) #kernels="kernel kernel.old" # Kernels to display in the boot menu kernels_autodetect="YES" # Auto-detect kernel directories in /boot +#loader_gfx="YES" # Use graphical images when available #loader_logo="orbbw" # Desired logo: orbbw, orb, fbsdbw, beastiebw, beastie, none #comconsole_speed="115200" # Set the current serial console speed #console="vidconsole" # A comma separated list of console(s) diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5 index 1e302172af46..2f1ced192857 100644 --- a/stand/defaults/loader.conf.5 +++ b/stand/defaults/loader.conf.5 @@ -21,7 +21,7 @@ .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. -.Dd July 8, 2024 +.Dd July 3, 2025 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -410,6 +410,12 @@ be displayed. If set to .Dq YES , the beastie boot menu will be skipped. +.It Va loader_gfx +If set to +.Dq NO , +the ASCII art version of the brand and logo will be used even if graphical +versions are available. +Additionally, the menu frame will be drawn with ASCII art as well. .It Va loader_logo Pq Dq Li orbbw Selects a desired logo in the beastie boot menu. Possible values are: diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index 1bf741b2373e..013e7b43e126 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -213,6 +213,13 @@ local function defaultframe() return "double" end +local function gfxenabled() + return (loader.getenv("loader_gfx") or "yes"):lower() ~= "no" +end +local function gfxcapable() + return core.isFramebufferConsole() and gfx.term_putimage +end + local function drawframe() local x = menu_position.x - 3 local y = menu_position.y - 1 @@ -238,7 +245,7 @@ local function drawframe() x = x + shift.x y = y + shift.y - if core.isFramebufferConsole() and gfx.term_drawrect ~= nil then + if gfxenabled() and gfxcapable() then gfx.term_drawrect(x, y, x + w, y + h) return true end @@ -324,11 +331,9 @@ local function drawbrand() y = y + branddef.shift.y end - if core.isFramebufferConsole() and - gfx.term_putimage ~= nil and - branddef.image ~= nil then - if gfx.term_putimage(branddef.image, x, y, 0, 7, 0) - then + local gfx_requested = branddef.image and gfxenabled() + if gfx_requested and gfxcapable() then + if gfx.term_putimage(branddef.image, x, y, 0, 7, 0) then return true end end @@ -375,16 +380,11 @@ local function drawlogo() y = y + logodef.shift.y end - if core.isFramebufferConsole() and - gfx.term_putimage ~= nil and - logodef.image ~= nil then - local y1 = 15 + local gfx_requested = logodef.image and gfxenabled() + if gfx_requested and gfxcapable() then + local y1 = logodef.image_rl or 15 - if logodef.image_rl ~= nil then - y1 = logodef.image_rl - end - if gfx.term_putimage(logodef.image, x, y, 0, y + y1, 0) - then + if gfx.term_putimage(logodef.image, x, y, 0, y + y1, 0) then return true end end From nobody Mon Jul 21 02:13:48 2025 X-Original-To: dev-commits-src-branches@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 4blkTm6YS4z61xW8; Mon, 21 Jul 2025 02:13:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTm5FYwz3NS7; Mon, 21 Jul 2025 02:13:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064028; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bumuwXIEJoDrKI1zwfc08imqLTJqQE9PE9eeeAwVPLk=; b=arlnWwZf2AO/zGPeQaMfQk0gZryQVtKefa2vjTApoK5nd1JiGR74JAU+L/GytH0o37ryFJ 9/Bii0BEQ3VApojfiY3Z77Pxr+z5MyEfl4BsRHvq3miBkE67/3tqWB9QDVLsZEKISKU+nl 7NmjPPDaUd9ixOs32fmSnnE7rKkySZhYPBE79Qr0O9PSr7aJqX+1LQWjbbdxQfNv3N6xnh EbRI+cPA5eWJlvJgxJZxXgacwVYPDAmIpt0Xq/AtQBIZ4O6hqmv0tBQuoAjM/HcwnsaMLX gBFejgLBLqvGmdfm4+GfM4OYeuVYJ3PJe9N1OGr8NGO/tR0s3AEX9diFSvj6KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064028; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bumuwXIEJoDrKI1zwfc08imqLTJqQE9PE9eeeAwVPLk=; b=qutELjd95/z/FZKIgNGesYyLoymoCA4TRs8wFiQ9xjW7hwEZOPyNravD0/XY+20Tvlbb0y MWpwf0NKuHUP6ULQ8zzYMw/A6gUItVgs262k52iBaSVP8k+J/mvu3cWWpt5xVhZsYpi5cx xABEyAFRu+8eT8fCWeVjsSTgC7xVg2R252EQf6Q3A52j6A7eYh6wj1RpUjNP5Nyc2+4Owp WVMArbtAWwEA3iDfcEyOP36LtKjaFjqNibltE6Q8dmFKFwqe900GsYvI0ThwTcxIZ9DLWH RXSwnBL9GrNgFGHDfUgIglahPKW3ui4MVuOvfVOyuwV7MWeRQ9MonWlCDVgK/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064028; a=rsa-sha256; cv=none; b=jhGPYqCSw9NIdmi+cC1D7LEtiXlZtU73cb3Y/actZwaEVeh1sEUXoVW2zO43lEEyaGnF7b gYrZvtEzDFhbOX0TczXRHu4yzTAC4ter+GeAPqJbu+La4LMhqLd3zqp6EKZQv50EdS1PLl gEAUeEiIOK0kTr0Fi4Bx2pSuVEQpGRPquozwviUntMRLxYIaYHkURBJG54XmzE4l4eun5f uuFoR7M9SwOI3llC8XT9Bjh7fEwEvGy4t6H8rs/838qY2O4SbKwA36ZI1AQEwjE3ZLJFCg B0opMkT3XNlXNLAsP0XuN046u/BHzvwsHGma2uu1Fw8Z4450OKtMfFjzuv08dw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTm4p44zfgb; Mon, 21 Jul 2025 02:13:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2Dm68013615; Mon, 21 Jul 2025 02:13:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2DmVI013612; Mon, 21 Jul 2025 02:13:48 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:48 GMT Message-Id: <202507210213.56L2DmVI013612@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 6b35b45202d5 - stable/14 - lualoader: rename loop variable to cleanup luacheck List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 6b35b45202d5855aaca0f90a5d8e948ba7dc8628 Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=6b35b45202d5855aaca0f90a5d8e948ba7dc8628 commit 6b35b45202d5855aaca0f90a5d8e948ba7dc8628 Author: Kyle Evans AuthorDate: 2025-06-06 14:44:15 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:26 +0000 lualoader: rename loop variable to cleanup luacheck This shadows an `i` used for indexing earlier in the function, and we don't care that much about the name. (cherry picked from commit d0d5415881b7ed6908a2a734d893eb870b93b33f) --- stand/lua/core.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stand/lua/core.lua b/stand/lua/core.lua index 3582720f2a81..d66d9719fdcb 100644 --- a/stand/lua/core.lua +++ b/stand/lua/core.lua @@ -280,11 +280,11 @@ function core.kernelList() -- actually find any kernels, we just assume that they know what they're -- doing and leave it alone. if default_kernel and not present[default_kernel] and #kernels > 1 then - for i = 1, #kernels do - if i == #kernels then - kernels[i] = nil + for n = 1, #kernels do + if n == #kernels then + kernels[n] = nil else - kernels[i] = kernels[i + 1] + kernels[n] = kernels[n + 1] end end end From nobody Mon Jul 21 02:13:49 2025 X-Original-To: dev-commits-src-branches@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 4blkTp2bTJz61xWB; Mon, 21 Jul 2025 02:13:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTn6Drqz3NJs; Mon, 21 Jul 2025 02:13:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064029; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/B9ucaLRkWLxtzRCDAuVE9rbZpSBfYHM92u09oViO0c=; b=KSsmU7wgaI/2388Ilzjrru2irInXvG1YAdI4MGft/OSQYha5xoJibuvPj6DiCT1QylCgKL srKjftSVOqPGxrBxnPZUH8TgBY+Jn4aj/px5hCZ9SZaSnvqAkNV3iDTrFm5mbVJNh3RLh8 F/5Ql4TnzOgNRfCjqQZHRbXl7mQlGQjKvYiYszR4ckI2XEx0vxVlTbs036+k9kXw3wrj4Q KJjT91Gq9L9EyEXmN9hWoTYXm8wHI5dN8WKgacKerwgCjQVgf9WkcJ+CfpxsypE2IUbWoz WPaMEPP70EQnZMhptyvJVynSFqkFrP9i3zfWPoJIvwszh2Ni3VNpYnAkI61+3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064029; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/B9ucaLRkWLxtzRCDAuVE9rbZpSBfYHM92u09oViO0c=; b=eikG3BUvIcxvsf0dVS+NhGE945zd2h8Qd063x9miCkSAWHlsWahPbFmJdlTUfrwyzWn6KA i0uj6rrBHePi/DXRPZY5QGk2N+kIR4qIjXde+SNKm8fKDqCK8AQ3OInAqpmzbHELDjSx0v p5RZz0/ThzMO/GXzRi8npGzqZfhlm5KQehoxM31ba0WANbZk2MMxe7C44mMuYA5wfXYmy0 lBanFteuZhhKCw058JTp1j+Ei09iVD+oxPcp8HKJnXvuYrJ9mTantsY4q4Y9BfFF9va63C tLM3xmA18vh8f9bAINKclZzEpI4kntLWdNF7ZhpqyshnBd07oKCVfhQ2V2P1ag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064029; a=rsa-sha256; cv=none; b=CmaPk99aGDpU6evh1EMgK3DbxRIKqdfO2ajOHwof2Z4FqAtEc2t2W8P8LZ+lZa4NL+eNsm BbyE9wiWPj7O7/QUwSRb/gmMGnROKBTqOEmanuGzMfFZ855hKsZW49RqJ6GPRn4CgyFGLf t+99IF540Yj2V4HaN/1K1KLJDfnbdAoRIFyGQmYVuHOKAY4L1IRu7ErbM2qn/rqiHsm0ir W1Sm4pgaAXbiwEgyn14bHEmpxuVhl6zqpOsRTwCrJmOCV6wy5Z99I86HQkNP+ztrmniQba 61mr7A3AXB+DkXdWrtbz8JrSHHfNApwZaCDqF5eeMlv3GpedlHQAYijbr1+jIQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTn5pn8zfgc; Mon, 21 Jul 2025 02:13:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2Dnj3013653; Mon, 21 Jul 2025 02:13:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2Dn3B013649; Mon, 21 Jul 2025 02:13:49 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:49 GMT Message-Id: <202507210213.56L2Dn3B013649@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 9dc4d7aef37d - stable/14 - stand: lua: convert orb to a new format that allows per-graphic shift List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 9dc4d7aef37d3c2b639bb3ed0d46c888028d7659 Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=9dc4d7aef37d3c2b639bb3ed0d46c888028d7659 commit 9dc4d7aef37d3c2b639bb3ed0d46c888028d7659 Author: Kyle Evans AuthorDate: 2025-06-13 02:23:39 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:26 +0000 stand: lua: convert orb to a new format that allows per-graphic shift Previously, we had one shift that had to work for both the ASCII version and the image that we may draw if we have a framebuffer to play with. That makes it more difficult to get the positioning just right, so split them out into their own tables for convenience. While we're here, stop clipping off the bottom of the orb when the autoboot sequence is interrupted. There's plenty of space for it to move up a hair, so let's do that.. Reviewed by: imp, tsoome (cherry picked from commit 33d3373faf30d5e7a1890ab686d932c984bc4b75) --- stand/lua/drawer.lua | 104 ++++++++++++++++++++++++++++++++++-------------- stand/lua/gfx-orb.lua | 15 ++++--- stand/lua/gfx-orbbw.lua | 36 +++++++++-------- 3 files changed, 104 insertions(+), 51 deletions(-) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index 013e7b43e126..e853cc655269 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -322,20 +322,23 @@ local function drawbrand() branddef = getBranddef(drawer.default_brand) end - local graphic = branddef.graphic + local graphic = branddef.ascii.image x = x + shift.x y = y + shift.y - if branddef.shift ~= nil then - x = x + branddef.shift.x - y = y + branddef.shift.y - end - local gfx_requested = branddef.image and gfxenabled() + local gfx_requested = branddef.fb and gfxenabled() if gfx_requested and gfxcapable() then - if gfx.term_putimage(branddef.image, x, y, 0, 7, 0) then + if branddef.fb.shift then + x = x + (branddef.fb.shift.x or 0) + y = y + (branddef.fb.shift.y or 0) + end + if gfx.term_putimage(branddef.fb.image, x, y, 0, 7, 0) then return true end + elseif branddef.ascii.shift then + x = x + (branddef.ascii.shift.x or 0) + y = y + (branddef.ascii.shift.y or 0) end draw(x, y, graphic) end @@ -351,8 +354,8 @@ local function drawlogo() local logodef = getLogodef(logo) - if logodef == nil or logodef.graphic == nil or - (not colored and logodef.requires_color) then + if logodef == nil or logodef.ascii == nil or + (not colored and logodef.ascii.requires_color) then -- Choose a sensible default if colored then logodef = getLogodef(drawer.default_color_logodef) @@ -366,7 +369,8 @@ local function drawlogo() end end - if logodef ~= nil and logodef.graphic == none then + -- XXX What the hell is going on here? + if logodef and logodef.ascii.image == none then shift = logodef.shift else shift = default_shift @@ -375,20 +379,23 @@ local function drawlogo() x = x + shift.x y = y + shift.y - if logodef ~= nil and logodef.shift ~= nil then - x = x + logodef.shift.x - y = y + logodef.shift.y - end - - local gfx_requested = logodef.image and gfxenabled() + local gfx_requested = logodef.fb and gfxenabled() if gfx_requested and gfxcapable() then - local y1 = logodef.image_rl or 15 + local y1 = logodef.fb.width or 15 - if gfx.term_putimage(logodef.image, x, y, 0, y + y1, 0) then + if logodef.fb.shift then + x = x + (logodef.fb.shift.x or 0) + y = y + (logodef.fb.shift.y or 0) + end + if gfx.term_putimage(logodef.fb.image, x, y, 0, y + y1, 0) then return true end + elseif logodef.ascii.shift then + x = x + (logodef.ascii.shift.x or 0) + y = y + (logodef.ascii.shift.y or 0) end - draw(x, y, logodef.graphic) + + draw(x, y, logodef.ascii.image) end local function drawitem(func) @@ -445,11 +452,15 @@ branddefs = { -- Indexed by valid values for loader_brand in loader.conf(5). Valid -- keys are: graphic (table depicting graphic) ["fbsd"] = { - graphic = fbsd_brand, - image = "/boot/images/freebsd-brand-rev.png", + ascii = { + image = fbsd_brand, + }, + fb = { + image = "/boot/images/freebsd-brand-rev.png", + }, }, ["none"] = { - graphic = none, + fb = { image = none }, }, } @@ -458,13 +469,19 @@ logodefs = { -- are: requires_color (boolean), graphic (table depicting graphic), and -- shift (table containing x and y). ["tribute"] = { - graphic = fbsd_brand, + ascii = { + image = fbsd_brand, + }, }, ["tributebw"] = { - graphic = fbsd_brand, + ascii = { + image = fbsd_brand, + }, }, ["none"] = { - graphic = none, + ascii = { + image = none, + }, shift = {x = 17, y = 0}, }, } @@ -484,14 +501,43 @@ drawer.default_bw_logodef = 'orbbw' -- drawer module in case it's a filesystem issue. drawer.default_fallback_logodef = 'none' --- These should go away after FreeBSD 13; only available for backwards --- compatibility with old logo- files. +-- Backwards compatibility shims for previous FreeBSD versions, please document +-- new additions +local function adapt_fb_shim(def) + -- In FreeBSD 14.x+, we have improved framebuffer support in the loader + -- and some graphics may have images that we can actually draw on the + -- screen. Those graphics may come with shifts that are distinct from + -- the ASCII version, so we move both ascii and image versions into + -- their own tables. + if not def.ascii then + def.ascii = { + image = def.graphic, + requires_color = def.requires_color, + shift = def.shift, + } + end + if def.image then + assert(not def.fb, + "Unrecognized graphic definition format") + + -- Legacy images may have adapted a shift from the ASCII + -- version, or perhaps we just didn't care enough to adjust it. + -- Steal the shift. + def.fb = { + image = def.image, + width = def.image_rl, + shift = def.shift, + } + end + return def +end + function drawer.addBrand(name, def) - branddefs[name] = def + branddefs[name] = adapt_fb_shim(def) end function drawer.addLogo(name, def) - logodefs[name] = def + logodefs[name] = adapt_fb_shim(def) end drawer.frame_styles = { diff --git a/stand/lua/gfx-orb.lua b/stand/lua/gfx-orb.lua index cd834a2d6b8e..6845d6fa07bb 100644 --- a/stand/lua/gfx-orb.lua +++ b/stand/lua/gfx-orb.lua @@ -27,7 +27,8 @@ return { logo = { - graphic = { + ascii = { + image = { " \027[31m``` \027[31;1m`\027[31m", " s` `.....---...\027[31;1m....--.``` -/\027[31m", " +o .--` \027[31;1m/y:` +.\027[31m", @@ -43,10 +44,14 @@ return { " `:` \027[31;1m`:`", " \027[31;1m.-- `--.", " .---.....----.\027[m", + }, + requires_color = true, + shift = {x = 5, y = -1}, + }, + fb = { + image = "/boot/images/freebsd-logo-rev.png", + width = 15, + shift = {x = 2, y = -2}, }, - requires_color = true, - shift = {x = 2, y = -1}, - image = "/boot/images/freebsd-logo-rev.png", - image_rl = 15 } } diff --git a/stand/lua/gfx-orbbw.lua b/stand/lua/gfx-orbbw.lua index a97174a6a5a4..135ff806b67c 100644 --- a/stand/lua/gfx-orbbw.lua +++ b/stand/lua/gfx-orbbw.lua @@ -27,23 +27,25 @@ return { logo = { - graphic = { - " ``` `", - " s` `.....---.......--.``` -/", - " +o .--` /y:` +.", - " yo`:. :o `+-", - " y/ -/` -o/", - " .- ::/sy+:.", - " / `-- /", - " `: :`", - " `: :`", - " / /", - " .- -.", - " -- -.", - " `:` `:`", - " .-- `--.", - " .---.....----.", + ascii = { + image = { + " ``` `", + " s` `.....---.......--.``` -/", + " +o .--` /y:` +.", + " yo`:. :o `+-", + " y/ -/` -o/", + " .- ::/sy+:.", + " / `-- /", + " `: :`", + " `: :`", + " / /", + " .- -.", + " -- -.", + " `:` `:`", + " .-- `--.", + " .---.....----.", + }, + shift = {x = 2, y = -1}, }, - shift = {x = 2, y = -1}, } } From nobody Mon Jul 21 02:13:50 2025 X-Original-To: dev-commits-src-branches@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 4blkTq2w4Zz61xp4; Mon, 21 Jul 2025 02:13:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTq0FRCz3NGw; Mon, 21 Jul 2025 02:13:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IDeLGanJ/26D8deSTI0ziy9dJnUpvNom9lLi9IaXr4g=; b=Sspn3sQxKVzacGZBIdLYDDtoqSlLvjvxSaKd93NobrszdJ1gPdeQz3Lw0XBBDcteVSdu86 7ZapriwyVAE+CBeujapluqYO9vNPA7hROi50AQD3eBIabt4Qt3zYrnSefFBH9uWNju+o6H mx8I7BKO8AaEgSQXj5zVEwvlUYgmMIyJlVztlw1CoyJHdMth6Z0lH5MEGWNJk/0saGNWq6 V1dDjpTRr8LdMueHsWsPSYarWppR07BnslVIPUZ1d9j2wideH9nfYA3BHmxk135l17zpwE HBbh2n7GvYRZCx49jSS+nru9L6w3KZvB/dlSdrcaFkaF4TkTvztGfkOV0NO21w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IDeLGanJ/26D8deSTI0ziy9dJnUpvNom9lLi9IaXr4g=; b=a9gTAbe/Yp4fHTVv4xVUzb/QcfFRAcvGVNi5FLwNKdJPuImaePTI3YndD7Z+CKYMORSZAA szmq9XbWR3eoCKjwPsyJKoBKZYXOv7wP+TdgyPItHrTnS3M9GB+HuiNq4epMhJyaiX8Faa Law189ZJPDOWsQv+md/Ey/MiG6BJbDngPAOfdQS0tYD25bNrFMNAUw/f5iqewns75PXIyR FGKW5stj7Ois/wO9PMEvoG+aknPdxkeUgH0Q91NLpLXUq3HXgwz7/qvMnrfDMvIHkH+n8z +h8MoAaTmI1euxvfsKF3/osM+flINFuvIMW8mptojk9aomCGLm7mAgT569qr/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064031; a=rsa-sha256; cv=none; b=LY2TKoLxbWbg5C6ewJVIThSkfoCJJ3Go+Q636x7Nkd7pWjsG5sbhgg8ZwmzhYZGQg2784M k7RJry6DJ6zgpcubuIWgDrWskz29zHudyGzddb6x4I81rMZcf1vhVIK3DcWbucAgVUCUM2 768aHsv3a9/voukXbwUvI/V4nN7GEPbbEnDS6hu58A5VN7eSO8S2exLoEHPa7rUMd5fv85 aJAj7KA0KgkgY1b/5+Kv25bXBhL8pGf+vGlVXrBO8HgZ/OlGclHP4E8VAceKoQsMXTPL/o yRpAS3pQJMz0RtdxxBS7De/y4XZTovABaMMK8eEpKIxB/XmFDtDwy61A1AZFvw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTp6vwczdyn; Mon, 21 Jul 2025 02:13:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2Do3j013688; Mon, 21 Jul 2025 02:13:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2Dons013686; Mon, 21 Jul 2025 02:13:50 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:50 GMT Message-Id: <202507210213.56L2Dons013686@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: a0b8aa915469 - stable/14 - stand: lua: add a more productive comment List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a0b8aa91546934bb3d0e2ae30ada7a0a48522b3b Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=a0b8aa91546934bb3d0e2ae30ada7a0a48522b3b commit a0b8aa91546934bb3d0e2ae30ada7a0a48522b3b Author: Kyle Evans AuthorDate: 2025-06-13 02:31:54 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:26 +0000 stand: lua: add a more productive comment The global `shift` is a special little hack for shifting everything when the logo is gone, and we should explain that. Fixes: 33d3373faf30d ("stand: lua: convert orb to a new format [...]") (cherry picked from commit 1beab149d0b9768ad6d07501326a2060d7b0ba58) --- stand/lua/drawer.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index e853cc655269..01802d8e9d81 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -369,7 +369,9 @@ local function drawlogo() end end - -- XXX What the hell is going on here? + -- This is a special little hack for the "none" logo to re-align the + -- menu and the brand to avoid having a lot of extraneous whitespace on + -- the right side. if logodef and logodef.ascii.image == none then shift = logodef.shift else From nobody Mon Jul 21 02:13:53 2025 X-Original-To: dev-commits-src-branches@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 4blkTs5bJ5z61y0F; Mon, 21 Jul 2025 02:13:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTs29fcz3NKb; Mon, 21 Jul 2025 02:13:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4CPcXfHH9lQY3G7dvXLWjyyxasNCFfgU2ej99o3pX7A=; b=WYQ9LKPf0WOw0GgJWoF18aHcAOy5Ph9WeJVX/ZrNVj+kubBj7KPWRVS7x6rzEInRiiE8tW AxNwd9wqzN8OCO1YS1U79CnnTY2YQ1htGGKx7zS20iPl2JvUdiWllyBjAMfzYBmLN/E+FW 61BT57dSEQXh75XE6VQ0KMyePC+xUyL/jx9xZyhQsCGn5lhIdvT7XClKTbqax2jPKRQM5R AR/SC4LsvozI/agUNqzMy4kpMjG6n29zxZrtivCTvDXaRBZeUSYefbEmu4yQjIsNctfc0q mTmGtVrmB2Cl4/Vfd48i1t5lUCXkk2RzMx4IwRqtc76BBZqEkSggZdvi4oe7qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4CPcXfHH9lQY3G7dvXLWjyyxasNCFfgU2ej99o3pX7A=; b=k1agGOLa0iHZetCrDdxMIJlCHa0PeP+bV96bgVrLhtHYJo5ijsMYRnLs3Ne7cH1KrCx05G gZTsbUiL+bRDqjQpM/aMRpC0xogGjuaz474oSKc2+sgnM+wlb58pzqVdxmU5lukt3UukB7 L/4rCl9ypD97iCvG3+Znr3oWBiHCIrQgP2076TgDpt3LIXlvyMIYLZZPyq42SG/KWBSINV zsOqb9JYTtlUIusR/LQ5EDMSZKU7KWfpFrBmZ1fqs9QZ5HXCXAqWu9iHSV2Jd/VYXQ0ez8 2aSdmFeXp1cTN6poTNVk3lBujSp3sJbdpkuHhfVu2dNNYIep0HfwfYidoFfv6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064033; a=rsa-sha256; cv=none; b=LISBontgl2zE14r2iEI2KAkU6SA6WClA8q8ZZ3jmrKDx8Mn+FK7QfWj8vNS4j57fMC5oTA Ijj9uzU4qqJWssoDWK66LTXZ8JZGzWwSQgsepTUv1nHr+lUQM7oQYy8VbdvK+in/MU1fT4 eiG7hwDGLz9GdPjYKsqZB1KSgMTE5x0gEiwsLhGx2iQLRl19fHeXWljK8oSUDj7aLE5Q1y Zn5Hpq6JrIjeNGoh/S1wDU37CQzYMVlRLbxCbAhyLfwRx1f6ZhDzttDEf3P4etRyK03gQc gIEfmA7lno4GQsgTF9J/5jI9PB/BalsVA9gGHjsPnNS+Xq3/A8gyCCw01hWOVg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTs1lxJzfdP; Mon, 21 Jul 2025 02:13:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2Drrq013764; Mon, 21 Jul 2025 02:13:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2DrJa013761; Mon, 21 Jul 2025 02:13:53 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:53 GMT Message-Id: <202507210213.56L2DrJa013761@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: cd8ab8cecff5 - stable/14 - lualoader: adapt builtin brand/logo definitions as well List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: cd8ab8cecff5eca1b6aaf671a840ee840c8e73c7 Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=cd8ab8cecff5eca1b6aaf671a840ee840c8e73c7 commit cd8ab8cecff5eca1b6aaf671a840ee840c8e73c7 Author: Kyle Evans AuthorDate: 2025-06-18 15:12:54 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:27 +0000 lualoader: adapt builtin brand/logo definitions as well While these should be moved to the new format, it wasn't my intention to force them over immediately. Downstreams may embed their own brands in drawer.lua, and we shouldn't break them for something like this. Move adapt_fb_shim() up and use it for preloaded definitions to avoid forcing the matter for now. Perhaps in the future we'll start writing out warnings for those that do need adapted. Reported by: 0x1eef on IRC (cherry picked from commit abdbd85d1b6af892c18eaae0330a146b01ff6712) --- stand/lua/drawer.lua | 68 ++++++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index 46390590352e..b8fcb0b35ba5 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -101,6 +101,39 @@ local function processFile(gfxname) return true end +-- Backwards compatibility shims for previous FreeBSD versions, please document +-- new additions +local function adapt_fb_shim(def) + -- In FreeBSD 14.x+, we have improved framebuffer support in the loader + -- and some graphics may have images that we can actually draw on the + -- screen. Those graphics may come with shifts that are distinct from + -- the ASCII version, so we move both ascii and image versions into + -- their own tables. + if not def.ascii then + def.ascii = { + image = def.graphic, + requires_color = def.requires_color, + shift = def.shift, + } + end + if def.image then + assert(not def.fb, + "Unrecognized graphic definition format") + + -- Legacy images may have adapted a shift from the ASCII + -- version, or perhaps we just didn't care enough to adjust it. + -- Steal the shift. + def.fb = { + image = def.image, + width = def.image_rl, + shift = def.shift, + } + end + + def.adapted = true + return def +end + local function getBranddef(brand) if brand == nil then return nil @@ -123,6 +156,8 @@ local function getBranddef(brand) end branddef = branddefs[brand] + elseif not branddef.adapted then + adapt_fb_shim(branddef) end return branddef @@ -150,6 +185,8 @@ local function getLogodef(logo) end logodef = logodefs[logo] + elseif not logodef.adapted then + adapt_fb_shim(logodef) end return logodef @@ -503,37 +540,6 @@ drawer.default_bw_logodef = 'orbbw' -- drawer module in case it's a filesystem issue. drawer.default_fallback_logodef = 'none' --- Backwards compatibility shims for previous FreeBSD versions, please document --- new additions -local function adapt_fb_shim(def) - -- In FreeBSD 14.x+, we have improved framebuffer support in the loader - -- and some graphics may have images that we can actually draw on the - -- screen. Those graphics may come with shifts that are distinct from - -- the ASCII version, so we move both ascii and image versions into - -- their own tables. - if not def.ascii then - def.ascii = { - image = def.graphic, - requires_color = def.requires_color, - shift = def.shift, - } - end - if def.image then - assert(not def.fb, - "Unrecognized graphic definition format") - - -- Legacy images may have adapted a shift from the ASCII - -- version, or perhaps we just didn't care enough to adjust it. - -- Steal the shift. - def.fb = { - image = def.image, - width = def.image_rl, - shift = def.shift, - } - end - return def -end - function drawer.addBrand(name, def) branddefs[name] = adapt_fb_shim(def) end From nobody Mon Jul 21 02:13:52 2025 X-Original-To: dev-commits-src-branches@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 4blkTr6bfLz61xfs; Mon, 21 Jul 2025 02:13:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTr1TNBz3NKK; Mon, 21 Jul 2025 02:13:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064032; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vILUR2NaRtDiSkoQvepMlb4xFjGRrj9k6mnVcYt5bHk=; b=yQJSlrMOPodKM2HBexonOwAbVdcGqCNeconE6ENstNYYtBQaLDjMJKOYQCuijeqND5oSy/ lVoSMUCxks4708bm5TzrH55tV5iIA3B8R3U6HZ+tiYxNzRzKv1/fVZ/p2oNoYrQJyDAJrq Vh5Zm7drLXKoYCASwpe/BaCW75qhgDUNKn/RpR1aG0yKz1pI/2+s6UGVgqTc1pz7vmEoZa vzYAbdCivsdXtp9kE3g66tdU11JbpUYwZmzR7ofx9AK8BhAtCElFuJNbKR5aVQ2rZF8NVw VXhARLfchBKlkpYJwLi9/+nLt/ZeiWJ2CYZ93ySldog9FHPP0jCZtDXqwzDPIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064032; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vILUR2NaRtDiSkoQvepMlb4xFjGRrj9k6mnVcYt5bHk=; b=fQ8Q3UtfFkTdxAXucFybcNeZfNTD0OcGQDiClQixtKnmxiy2i6OYVVgUvPqzFGS9piPt8N 4+Oe3VnOLl5brWeKrgAV89pRLOKkuHn5VT/Ud5dZDgxqHF21WVCWac7lUAx2yHcDTVZG1G dY9Rp8NaybKjIGrfvThDgTn7wFv4iKRseYQijKbODH0W9NAHSQJS854hUvkGRphdZ1XkXk boAW1rtZ7yRd22eoFEYghEs70BN2MqZdcSLjuJ1hguQKJd9EmFVzf+JWRZBPsFBsE6Nd8R fYx59s9cfsV+sFrQfKggHQxk10+6YeBG9FQQKLXVLkYAS4LepXD3T0lExGUpXw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064032; a=rsa-sha256; cv=none; b=ZuIgehiH4HQfZvQHZpf8yLKwE5UPlpXMH3SwoNAIVgncKZfhm+tEvbV0rVeBp920imKr+Y b8xi3/B+Vd0VjNbONEuv2Ovfw6ma5KZEnqb/1+i+9O1q6g3DEvm7DvpEy328ysD+NiT+il WVjktHhTCt270q2y/j7YikRF3Gzw0Iw4et4lxr4pX4ZfJ7ZZMXUtqE+W+U0tCkV0G15IdQ pSwsEByeHCZ0diiQw5uh/zffvuRdgUv7nadV/KY9gBtfj+AQWEksGL3i2BPsC+IGN/HLxd K2jbsgemAhyP/MXP1Ex1LSRDYETALwACw0rjv/pnHaEBfV5h9zc0UOA479Fw5A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTr0tWDzfdN; Mon, 21 Jul 2025 02:13:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2DqHV013724; Mon, 21 Jul 2025 02:13:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2Dq7H013721; Mon, 21 Jul 2025 02:13:52 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:52 GMT Message-Id: <202507210213.56L2Dq7H013721@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 8b6be727885d - stable/14 - loader: Fix loader_brand = none List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 8b6be727885d1b9eedae4b0e66674dc9cf2b69bb Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=8b6be727885d1b9eedae4b0e66674dc9cf2b69bb commit 8b6be727885d1b9eedae4b0e66674dc9cf2b69bb Author: Emmanuel Vadot AuthorDate: 2025-06-16 12:23:07 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:26 +0000 loader: Fix loader_brand = none Setting loader_brand to none in loader.conf now result in a lua error as we try to get a non-existant table Defines it Fixes: bef6d85b6de5 ("lualoader: allow graphical bits to be disabled with loader_gfx") Reviewed by: kevans, tsoome Sponsored by: Beckhoff Automation GmbH & Co. KG (cherry picked from commit 7e1930480bef285cca1c14c25b4fd62abdf5dabf) --- stand/lua/drawer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index 01802d8e9d81..46390590352e 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -462,7 +462,7 @@ branddefs = { }, }, ["none"] = { - fb = { image = none }, + ascii = { image = none }, }, } From nobody Mon Jul 21 02:13:54 2025 X-Original-To: dev-commits-src-branches@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 4blkTv00yfz61y0H; Mon, 21 Jul 2025 02:13:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTt32BDz3NKx; Mon, 21 Jul 2025 02:13:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8fPpGXYjxXoplQTSp6mv+cl7uiXk097vNgVCdvJmB2w=; b=uU0V6lDkh0wt1sD3Apzb0GVU5teq9GzCTwSrLhFsZ/bkDT6lIQblmNWSX/7PfTs8Ry3Wzb l/y8OxGgJ2tTbtaqvbA+Dl9LVjDZt+V7jmUV2Ivhz01qHRRAN97pwr+JINmMZ/OwquVHUG Vn7gZnT8Q4KwRGUif/jzkHomRbXA1T6Sq6q0C97qfoMEGkkCS2h+Adi8pDxY3BdQXr/vbk UwQEFI68fzUM+9JxI0SuBh5gh1eWEXK+2VVbivBiHWNvN1hstFjLe/9OIIj7ovcuKFQPO7 0btp16twSaHYoGjPSMyteA9OsokGx07RkW+1ST2EJGCG22FF7M8h7WhAeRPpqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8fPpGXYjxXoplQTSp6mv+cl7uiXk097vNgVCdvJmB2w=; b=jpQekMy0LL1SGxJF0Ua4IUOb3xQjFzUBkClTqm69Vwkjzvh+GCLWkHenSNJn+8OgHP2MoM cnRPLMeGmKDWuWjVb94k8cru6d2JOHTwgIo4KwY61y+LI0FcALMIqc4wJr+2vKZGuVL5iI kfqNk0AfAWSgWBuIjXzr8EEfhwRxutpgm/BGH1GD1ZPfO4UulPN8u+eHf5b08sgcbNAE6m lhvCoJQM/My+6zZqVSj8+RuGmYaTlpYLM3hsPBsZo/Zyu48TDCXNBOw4V8PRa3Dre13dFR tgRbSGWMGIkREGfoNIE72hE3STupy8UvQKLe9EpZTUggUz+kYJuliVXsuzyxyw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064034; a=rsa-sha256; cv=none; b=NVcRHG/Et6FEQIHINqdyixHI479Ag48p7B7R4HoK9s/xEp13zRqs7KPfseYGfqwF3f/D5X qQaHgXOzFUch18Ce2UB5MwSIZ4NecZ1Q4NMtHfaPSxpYYjKfV4iL8bx7Psc914jQSY1nVH ttszlHflLvMvfJmT44kRcs7DxBm20coymImIaSxEU5LcvOI5JY87V7jCgug9xWHb99I7FK 7JFZia2DFOKGFkI7iQbyIUYYtPtaWFgZ9mMBBwMHWZrzwbuZ9/cwoMtxpBspwh8ZGtqe8n 072B/1BTLayF9EfBp5ntUxloAlqXkBoJCmPzsavQt/IkdWLVW2ShsMaXIcCfBQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTt2Z5fzdyp; Mon, 21 Jul 2025 02:13:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2DshI013803; Mon, 21 Jul 2025 02:13:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2DsFY013800; Mon, 21 Jul 2025 02:13:54 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:54 GMT Message-Id: <202507210213.56L2DsFY013800@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 462b13ebf6c6 - stable/14 - kern: send parent a SIGCHLD when the debugger has detached List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 462b13ebf6c6d71613ab88464b907e38492cf726 Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=462b13ebf6c6d71613ab88464b907e38492cf726 commit 462b13ebf6c6d71613ab88464b907e38492cf726 Author: Kyle Evans AuthorDate: 2025-06-19 15:31:58 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:27 +0000 kern: send parent a SIGCHLD when the debugger has detached The practical scenario that leads to this is porch(1) spawning some utility and sending it a SIGSTOP as a debugging aide. The user then attaches a debugger and walks through how some specific input is processed, then detaches to allow the script to continue. When ptrace is detached, the process resumes execution but the parent is never notified and may be stuck in wait(2) for it to continue or terminate. Other platforms seem to re-suspend the process after the debugger is detached, but neither behavior seems unreasonable. Just notifying the parent that the child has resumed is a relatively low-risk departure from our current behavior and had apparently been considered in the past, based on pre-existing comments. Move p_flag and p_xsig handling into childproc_continued(), as just sending the SIGCHLD here isn't really useful without P_CONTINUED set and the other caller already sets these up as well. Reviewed by: kib, markj (cherry picked from commit ee9895e10d266b7bb0a25677aee3debdc17ab4bf) --- lib/libc/sys/ptrace.2 | 12 +++++++- lib/libc/sys/wait.2 | 8 ++++-- sys/kern/kern_sig.c | 5 ++-- sys/kern/sys_process.c | 11 +++++-- tests/sys/kern/ptrace_test.c | 68 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 97 insertions(+), 7 deletions(-) diff --git a/lib/libc/sys/ptrace.2 b/lib/libc/sys/ptrace.2 index 9b789a0e45b3..7aa24a3f820b 100644 --- a/lib/libc/sys/ptrace.2 +++ b/lib/libc/sys/ptrace.2 @@ -1,7 +1,7 @@ .\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $ .\" .\" This file is in the public domain. -.Dd August 18, 2023 +.Dd June 19, 2025 .Dt PTRACE 2 .Os .Sh NAME @@ -473,6 +473,16 @@ This request is like PT_CONTINUE, except that it does not allow specifying an alternate place to continue execution, and after it succeeds, the traced process is no longer traced and continues execution normally. +.Pp +The parent of the traced process will be sent a +.Dv SIGCHLD +to indicate that the process has continued from a stopped state regardless of +whether the process was in a stopped state prior to the corresponding +.Dv PT_ATTACH +request. +A +.Xr wait 2 +for the traced process would indicate that it had been continued. .It Dv PT_GETREGS This request reads the traced process's machine registers into the .Do diff --git a/lib/libc/sys/wait.2 b/lib/libc/sys/wait.2 index b62ed585a333..165b79a7f36f 100644 --- a/lib/libc/sys/wait.2 +++ b/lib/libc/sys/wait.2 @@ -27,7 +27,7 @@ .\" .\" @(#)wait.2 8.2 (Berkeley) 4/19/94 .\" -.Dd June 24, 2022 +.Dd July 3, 2025 .Dt WAIT 2 .Os .Sh NAME @@ -275,6 +275,10 @@ Report the status of selected processes that have continued from a job control stop by receiving a .Dv SIGCONT signal. +.Xr ptrace 2 +can also cause a process to be continued, when a +.Dv PT_DETACH +request is issued to detach the debugger. .It Dv WNOHANG Do not block when there are no processes wishing to report status. @@ -452,7 +456,7 @@ value: .Bl -tag -width Ds .It Fn WIFCONTINUED status True if the process has not terminated, and -has continued after a job control stop. +has continued after a job control stop or detach of a debugger. This macro can be true only if the wait call specified the .Dv WCONTINUED option. diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index d8be29779386..eb5d0815caf8 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -2458,8 +2458,6 @@ tdsendsignal(struct proc *p, struct thread *td, int sig, ksiginfo_t *ksi) PROC_SLOCK(p); if (p->p_numthreads == p->p_suspcount) { PROC_SUNLOCK(p); - p->p_flag |= P_CONTINUED; - p->p_xsig = SIGCONT; PROC_LOCK(p->p_pptr); childproc_continued(p); PROC_UNLOCK(p->p_pptr); @@ -3796,6 +3794,9 @@ childproc_stopped(struct proc *p, int reason) void childproc_continued(struct proc *p) { + PROC_LOCK_ASSERT(p, MA_OWNED); + p->p_flag |= P_CONTINUED; + p->p_xsig = SIGCONT; childproc_jobstate(p, CLD_CONTINUED, SIGCONT); } diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index a33e3fa4b73c..3fb4595bb5f7 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -1330,8 +1330,15 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) p->p_flag2 &= ~P2_PTRACE_FSTP; } - /* should we send SIGCHLD? */ - /* childproc_continued(p); */ + /* + * Send SIGCHLD and wakeup the parent as needed. It + * may be the case that they had stopped the child + * before it got ptraced, and now they're in the middle + * of a wait(2) for it to continue. + */ + PROC_LOCK(p->p_pptr); + childproc_continued(p); + PROC_UNLOCK(p->p_pptr); break; } diff --git a/tests/sys/kern/ptrace_test.c b/tests/sys/kern/ptrace_test.c index 50acda94642f..8831d298d554 100644 --- a/tests/sys/kern/ptrace_test.c +++ b/tests/sys/kern/ptrace_test.c @@ -4525,6 +4525,73 @@ ATF_TC_BODY(ptrace__PT_ATTACH_no_EINTR, tc) ATF_REQUIRE(timespeccmp(&shm->sleep_time, &twelve_sec, <=)); } +ATF_TC_WITHOUT_HEAD(ptrace__PT_DETACH_continued); +ATF_TC_BODY(ptrace__PT_DETACH_continued, tc) +{ + char buf[256]; + pid_t debuggee, debugger; + int dpipe[2] = {-1, -1}, status; + + /* Setup the debuggee's pipe, which we'll use to let it terminate. */ + ATF_REQUIRE(pipe(dpipe) == 0); + ATF_REQUIRE((debuggee = fork()) != -1); + + if (debuggee == 0) { + ssize_t readsz; + + /* + * The debuggee will just absorb everything until the parent + * closes it. In the process, we expect it to get SIGSTOP'd, + * then ptrace(2)d and finally, it should resume after we detach + * and the parent will be notified. + */ + close(dpipe[1]); + while ((readsz = read(dpipe[0], buf, sizeof(buf))) != 0) { + if (readsz > 0 || errno == EINTR) + continue; + _exit(1); + } + + _exit(0); + } + + close(dpipe[0]); + + ATF_REQUIRE(kill(debuggee, SIGSTOP) == 0); + REQUIRE_EQ(waitpid(debuggee, &status, WUNTRACED), debuggee); + ATF_REQUIRE(WIFSTOPPED(status)); + + /* Child is stopped, enter the debugger to attach/detach. */ + ATF_REQUIRE((debugger = fork()) != -1); + if (debugger == 0) { + REQUIRE_EQ(ptrace(PT_ATTACH, debuggee, 0, 0), 0); + REQUIRE_EQ(waitpid(debuggee, &status, 0), debuggee); + ATF_REQUIRE(WIFSTOPPED(status)); + REQUIRE_EQ(WSTOPSIG(status), SIGSTOP); + + REQUIRE_EQ(ptrace(PT_DETACH, debuggee, 0, 0), 0); + _exit(0); + } + + REQUIRE_EQ(waitpid(debugger, &status, 0), debugger); + ATF_REQUIRE(WIFEXITED(status)); + REQUIRE_EQ(WEXITSTATUS(status), 0); + + REQUIRE_EQ(waitpid(debuggee, &status, WCONTINUED), debuggee); + ATF_REQUIRE(WIFCONTINUED(status)); + + /* + * Closing the pipe will trigger the debuggee to exit now that the + * child has resumed following detach. + */ + close(dpipe[1]); + + REQUIRE_EQ(waitpid(debuggee, &status, 0), debuggee); + ATF_REQUIRE(WIFEXITED(status)); + REQUIRE_EQ(WEXITSTATUS(status), 0); + +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, ptrace__parent_wait_after_trace_me); @@ -4594,6 +4661,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, ptrace__PT_SC_REMOTE_getpid); ATF_TP_ADD_TC(tp, ptrace__reap_kill_stopped); ATF_TP_ADD_TC(tp, ptrace__PT_ATTACH_no_EINTR); + ATF_TP_ADD_TC(tp, ptrace__PT_DETACH_continued); return (atf_no_error()); } From nobody Mon Jul 21 02:13:56 2025 X-Original-To: dev-commits-src-branches@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 4blkTw6sPZz61xrW; Mon, 21 Jul 2025 02:13:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTw4Vfjz3Nf6; Mon, 21 Jul 2025 02:13:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064036; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MxmpwUPmAXaCIzjChleCuxUsABb4WqoxXZehr5MNMU4=; b=sCOT6TrNgZPPcgMkKC7Ct5isolQTrbV6MtIPsEXlZh75MYzFxrkyvy0QKS2Iy04YqTXbHi rns+aePcVI6oVM6DrzOOzT5ZrndgbKyh1oba3NsMa6ssa/VQoax0Q+gHJKqgJDypGdOYUu bwJbY7LLqSZoCXUHdaPWG+P6YNokKf3cEoJ1Ei151Y925LqtUzm5QKSbnP30sraAdNZF/8 SXCh1eAg5GQCCND5SY1EDK1SZN7eK04wxyxHQfw2D0+KhYi0j/BhALTIkrmodt8wHfdsOb 0U7RxVpGAwJuVEilFWDddwCatiBkMUCeo6sf92s3oqAUgjlNkQQDcbx27iBBVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064036; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MxmpwUPmAXaCIzjChleCuxUsABb4WqoxXZehr5MNMU4=; b=sLU8kj3mCy1ZVLZp8N27F4wmxyCj8hnLDzieyFglxV+oY8QC343ichPgWuFpBxbsLbwww+ sG01t0jcTSiyO5DWExgxJUJkdjcCObBtI7O6GrnGM8hmsGvfMnfJC8r/GJN1ANiQ7NfYc/ 7q/sD+ZcibBXffSHO8h7fKHoNO0WH+y7BFlV3GaZacYIFppwPJrPwAhz2UAvq53QRlOS2K owZdOVV4UJM2KDfx9u/COGLAuOzOEnzRWlP/uB6m0IK81r7g8G5EejmWgBO8frQKBbZQHb uP3P3HBgr0ETPDz+3uhwZJnAIMEBudue37uJsHTsprYQ2KKwvacUzqQ9LxOQ4A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064036; a=rsa-sha256; cv=none; b=ByY9Lqz+yDcYjl+xENRwTHL4XuhlCIyiT2vSCInZv95lAhb9+tEjBrAMNE9b/1AF3FZh/3 zKPQVIDD8C24Z2bGpgxByeU90Jd+AnpHQcMc1030p9q5NLRlkNuPb1KwP5t3pLHymbLw/H s6tkxKUGugMSsgvL4FR+k2BVNKM5w51PkiDYEkatI59+XNEmoZgvpJjnIRftL/zheyV2xd Jow/u1IH0k3TFiwyq5wm8U0N7INZELIqEARBrPr/rmeo5yqg0FquqEVwDwXaqjDlyUGtJI 1n73hhgY4ZynAFcqZuvp5Xtzg3h/9k6xlESvnux8t6Q/5ZGkAABNE9wkS91O1Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTw44j2zfDS; Mon, 21 Jul 2025 02:13:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2Dui1013873; Mon, 21 Jul 2025 02:13:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2Du3n013870; Mon, 21 Jul 2025 02:13:56 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:56 GMT Message-Id: <202507210213.56L2Du3n013870@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 1cacf672e3ee - stable/14 - kern: wg: refactor out some repetitive bits in allowed-ip config List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1cacf672e3ee3719b72534347cf7d5ce69cf716f Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=1cacf672e3ee3719b72534347cf7d5ce69cf716f commit 1cacf672e3ee3719b72534347cf7d5ce69cf716f Author: Kyle Evans AuthorDate: 2025-06-26 02:57:02 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:28 +0000 kern: wg: refactor out some repetitive bits in allowed-ip config The only difference in the wg_aip_add() call after IP validation is the address family. Just pull that out into a variable and avoid the two different callsites for wg_aip_add(). A future change will add a new call for each case to remove an address from the peer, so it's nice to avoid needing to repeat the logic for two different branches. Reviewed by: Aaron LI, Jason A. Donenfeld, ivy, jhb, markj (cherry picked from commit ba2607ae7dff17957d9e62ccd567ba716c168e77) --- sys/dev/wg/if_wg.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/dev/wg/if_wg.c b/sys/dev/wg/if_wg.c index 2534929a1e37..9e86e1074ef5 100644 --- a/sys/dev/wg/if_wg.c +++ b/sys/dev/wg/if_wg.c @@ -2459,8 +2459,12 @@ wg_peer_add(struct wg_softc *sc, const nvlist_t *nvl) aipl = nvlist_get_nvlist_array(nvl, "allowed-ips", &allowedip_count); for (size_t idx = 0; idx < allowedip_count; idx++) { + sa_family_t ipaf; + if (!nvlist_exists_number(aipl[idx], "cidr")) continue; + + ipaf = AF_UNSPEC; cidr = nvlist_get_number(aipl[idx], "cidr"); if (nvlist_exists_binary(aipl[idx], "ipv4")) { addr = nvlist_get_binary(aipl[idx], "ipv4", &size); @@ -2468,19 +2472,23 @@ wg_peer_add(struct wg_softc *sc, const nvlist_t *nvl) err = EINVAL; goto out; } - if ((err = wg_aip_add(sc, peer, AF_INET, addr, cidr)) != 0) - goto out; + + ipaf = AF_INET; } else if (nvlist_exists_binary(aipl[idx], "ipv6")) { addr = nvlist_get_binary(aipl[idx], "ipv6", &size); if (addr == NULL || cidr > 128 || size != sizeof(struct in6_addr)) { err = EINVAL; goto out; } - if ((err = wg_aip_add(sc, peer, AF_INET6, addr, cidr)) != 0) - goto out; + + ipaf = AF_INET6; } else { continue; } + + MPASS(ipaf != AF_UNSPEC); + if ((err = wg_aip_add(sc, peer, ipaf, addr, cidr)) != 0) + goto out; } } if (remote != NULL) From nobody Mon Jul 21 02:13:55 2025 X-Original-To: dev-commits-src-branches@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 4blkTv5Rfgz61xWJ; Mon, 21 Jul 2025 02:13:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTv4CQMz3NL5; Mon, 21 Jul 2025 02:13:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064035; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=unFdSOt/AFMc/s1VtRhiXyik3jup6lIVmhMiK+1Mr+k=; b=XVDY/vqM/xhV+KHRCK/hGpL24Rl1qslHP/P6uQzvJYA7t/1ZFfHuOKaX/qe3JKxITMAAUz 7U4Aq6QHQJTvowsLnSlPD8Si3iuXFzQdsld1aiw/DsJwq8A0EJgZM/Ki+akyEG/H9iOD8Q +qtfH18R34yHnBINpoGtA2mAhi4CE8njWD8fkyelle2TR6MmJuY4LWAu9O0t9Ibf7cAwuo I/GsKwR1LR++fcZGQ0QOjeLbazrBHOmhSi4iCg4atH0+5oPzgdQ4BDeeVL2rktqfTC1I+e CxiUIAnApQhyAz6tnkArP6icBGMYORgIzPBVKlC+SJBn44UEY8D8zzPWd++uOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064035; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=unFdSOt/AFMc/s1VtRhiXyik3jup6lIVmhMiK+1Mr+k=; b=Q4NrUiqymJSiv5IFxjBnkLPnIkfn3ugQth89sKRzdetl2/2B2aRkG6Rq74vJ38JSq8nVug VSqLWhO/lSlzIMcZP9Tll5BnN/KtjzSIbRmSI2DQ6ioJa4oLyspaQuD0GNy6wU6CxI64X+ UVcLA1mLYjY4CIyWsxFKKYiCy3VA3ja40OdCIWHx0kY6nrlH4/AOJ3cqxibU5wdIx8mPgo P14LQ3XzEpmMCSbnoNlP8xJovzTospti9V5wW5WtU2WlLuyVpeYY/NxOgUkB8LzSevJJiT C8nrJ3s8Dl3oUMpKWQxBqa76R6AUB/GvghxJVwsEMM18vg8TiJxxZo9fouyhDw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064035; a=rsa-sha256; cv=none; b=AInbdp7BnX+GeDZlGbfOCF7gdlXkbVTo7e75xNaWZbZKhddtg4Da7LMsyn6zR/4xfIuz8b NZTwOm9aaE5nHv1/01lBkV5bpPxngc+Qd0fxFD24Gkc42fLmLcK9tyN5lgRk5YY3CaS+uu Hlw4NSnAT3xaj89fAahVBb10DKOqUBMukg5bqi8J9NMSeooeorDV6SfU75XHmmtx0PbI41 D/lrMkAGBV8Of6TPbUB13xL9j/1sZIwb+IbFUglJ9iihk5uxRCG4LoabfBRKkCUPl1sP6D yTP5xHU+fSJCmwcMsva23IpJTG7GEoZolm9YHrXpgOA+Bc+lWhF/45kyaSg28w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTv3HnRzdyq; Mon, 21 Jul 2025 02:13:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2Dt9i013838; Mon, 21 Jul 2025 02:13:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2Dt0F013835; Mon, 21 Jul 2025 02:13:55 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:55 GMT Message-Id: <202507210213.56L2Dt0F013835@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 4354f62149b2 - stable/14 - pkill: better document ancestor-hiding List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 4354f62149b23feb7de04f73c46abc13eb34d63b Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=4354f62149b23feb7de04f73c46abc13eb34d63b commit 4354f62149b23feb7de04f73c46abc13eb34d63b Author: Kyle Evans AuthorDate: 2025-06-24 14:49:31 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:28 +0000 pkill: better document ancestor-hiding More prominently note that we'll hide ancestors in the first two paragraphs that provide an overview of pkill/pgrep. It also seems worth noting in the description of -a that we won't ever unhide the pgrep/pkill command itself, as mypid is skipped in all process iteration by way of PSKIP(). Reviewed by: allanjude, des Sponsored by: Klara, Inc. (cherry picked from commit 88a2d48d39d9845e36c8e95a9204001b11e7257e) --- bin/pkill/pkill.1 | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/bin/pkill/pkill.1 b/bin/pkill/pkill.1 index f06b448b5df8..40abbba96362 100644 --- a/bin/pkill/pkill.1 +++ b/bin/pkill/pkill.1 @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd October 5, 2020 +.Dd June 24, 2025 .Dt PKILL 1 .Os .Sh NAME @@ -71,12 +71,17 @@ The .Nm pgrep command searches the process table on the running system and prints the process IDs of all processes that match the criteria given on the command -line. +line, excluding itself and all direct ancestors unless the +.Fl a +option is specified. .Pp The .Nm pkill command searches the process table on the running system and signals all -processes that match the criteria given on the command line. +processes that match the criteria given on the command line, excluding itself +and all direct ancestors unless the +.Fl a +option is specified. .Pp The following options are available: .Bl -tag -width ".Fl F Ar pidfile" @@ -130,6 +135,16 @@ or process and all of its ancestors are excluded (unless .Fl v is used). +Note that the +.Fl a +option will not +.Dq unhide +the +.Nm pgrep +or +.Nm pkill +process itself, even with +.Fl v . .It Fl c Ar class Restrict matches to processes running with specified login class .Ar class . From nobody Mon Jul 21 02:13:58 2025 X-Original-To: dev-commits-src-branches@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 4blkTz3HSmz61xx7; Mon, 21 Jul 2025 02:13:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTz0CH2z3NlB; Mon, 21 Jul 2025 02:13:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OkRGLPxyZAHnKc5jlkwmF94G2Va+V3tLeiAA9qrg6nY=; b=HgQAIZWEjhPHNO5S3jagzAjG9NFOJ0xcpXvuvw12GSVCMKz/2QIBRoNUAiixRTYjMjW3ZJ cWViD2P0Zx8CYFlMfw0K2FrgtkF2bnAVntuk0xsq0NhQO//Ft9clPrLvjdU+t7PV8OPVlb jZxyds35Ik9YY3JxHjVjg8lcOOy+CvDoHXZy48trdu3aQxoowq2zwDknSJcvDuWwoD7V9/ ChI4d4wKUs5SIwKG0mZ3k8ImS4vm5YVZ7UBjZ53f/0MTFOFWExEzOe1GM/YwKikQ8D+/TR rQP4fpyN2SD0TaQsrK9Mila6GjOlC2D+aUQSl3nqi3BR0zJ9/VA5IBSGohZh5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OkRGLPxyZAHnKc5jlkwmF94G2Va+V3tLeiAA9qrg6nY=; b=TWg/aOa51FnxMh03TZxbMwUT5LrgyzfqUMHGnVQ36/JRNekuvYnq7o7EHnILb+lHUqGY+G W2LiuDjaNT2NRWF6cRgR2OL7Sqq/wu/awgpLyVloX1Gw7eGCaHZ5ly+MxUF8VyN4Uq7afl iV4thPqF7yUwS8dHejVEFcLiyc0BCK5X0evlhyHRT8+uPdXNInjsjIaq21dJaDHqMDlEfr MmMPitIW0yEw9bMaXGFwtXnAsWlMZqWHrX6yWbKR1bM2KKQLRsLDh13Epd14MfqCpapXi6 TF1PmrH/nrNs3IGpTVfcvzKH2TPBSQLHi+TcP/RL2kGjw7j+7t+9yOVBj0Xb8g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064039; a=rsa-sha256; cv=none; b=BQYvmAQOc7HpTom/XN5M7IG8lnbWLZc84Oj2VxoFoiLWoXpqUbTSpb3tzY4cuir61g6xDC yLqjVPoAceD8NnpEBP5jkzThAMXiE9bRmLYZFTTA1+nQtTTzhGqJdoIdE8NlgeX5oBBv/N Y3t9DCt6M0NSgdGJBRN9NXLyFp7kZVzDUpPlys/GLw3Ev/neQfOn1PURyAFpn/k+C4DFne PjPbnmxpJdbElxK5GskCh5vRrTV+z4Lwc+Q+W/ZEpgF6HWW5+dB22z7LmjfFrnWMxMHoSH 1DlpnqDJAAMxyhKPm1jv+kkolTvtRPAJJb5lvUsQ2AGcTUBBy7eFI26eHRzfGg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTy6QBvzfgd; Mon, 21 Jul 2025 02:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2Dw5j013947; Mon, 21 Jul 2025 02:13:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2Dw1F013944; Mon, 21 Jul 2025 02:13:58 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:58 GMT Message-Id: <202507210213.56L2Dw1F013944@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 684dd4e8c008 - stable/14 - kern: wg: add support for removing Allowed-IPs List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 684dd4e8c0085f4e64016a44d4cd699b2fc29681 Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=684dd4e8c0085f4e64016a44d4cd699b2fc29681 commit 684dd4e8c0085f4e64016a44d4cd699b2fc29681 Author: Kyle Evans AuthorDate: 2025-06-26 02:57:02 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:59 +0000 kern: wg: add support for removing Allowed-IPs This was recently added to Linux to improve incremental update support, as you could previously add Allowed-IPs but not remove without replacing the whole set (and thus, potentially disrupting existing traffic). Removal is incredibly straightforward; we'll find it in p_aips first to ensure that it's actually valid for this peer, then we'll delete it from the radix tree before we remove the corresponding p_aips entry. Reviewed by: Jason A. Donenfeld, jhb (cherry picked from commit d15d610fac97df4fefed3f14b31dcfbdcec65bf9) (cherry picked from commit d1ac3e245f084ee0637bde9a446687621358c418) --- sys/dev/wg/if_wg.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++- sys/dev/wg/if_wg.h | 6 +++++ 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/sys/dev/wg/if_wg.c b/sys/dev/wg/if_wg.c index 380e579eed07..75af5e279669 100644 --- a/sys/dev/wg/if_wg.c +++ b/sys/dev/wg/if_wg.c @@ -314,6 +314,8 @@ static void wg_timers_run_zero_key_material(void *); static void wg_timers_run_persistent_keepalive(void *); static int wg_aip_add(struct wg_softc *, struct wg_peer *, sa_family_t, const void *, uint8_t); +static int wg_aip_del(struct wg_softc *, struct wg_peer *, sa_family_t, + const void *, uint8_t); static struct wg_peer *wg_aip_lookup(struct wg_softc *, sa_family_t, void *); static void wg_aip_remove_all(struct wg_softc *, struct wg_peer *); static struct wg_peer *wg_peer_create(struct wg_softc *, @@ -530,10 +532,12 @@ wg_peer_get_endpoint(struct wg_peer *peer, struct wg_endpoint *e) static int wg_aip_addrinfo(struct wg_aip *aip, const void *baddr, uint8_t cidr) { +#if defined(INET) || defined(INET6) struct aip_addr *addr, *mask; addr = &aip->a_addr; mask = &aip->a_mask; +#endif switch (aip->a_af) { #ifdef INET case AF_INET: @@ -608,6 +612,58 @@ wg_aip_add(struct wg_softc *sc, struct wg_peer *peer, sa_family_t af, return (ret); } +static int +wg_aip_del(struct wg_softc *sc, struct wg_peer *peer, sa_family_t af, + const void *baddr, uint8_t cidr) +{ + struct radix_node_head *root = NULL; + struct radix_node *dnode __diagused, *node; + struct wg_aip *aip, addr; + int ret = 0; + + /* + * We need to be sure that all padding is cleared, as it is above when + * new AllowedIPs are added, since we want to do a direct comparison. + */ + memset(&addr, 0, sizeof(addr)); + addr.a_af = af; + + ret = wg_aip_addrinfo(&addr, baddr, cidr); + if (ret != 0) + return (ret); + + root = af == AF_INET ? sc->sc_aip4 : sc->sc_aip6; + + MPASS(root != NULL); + RADIX_NODE_HEAD_LOCK(root); + + node = root->rnh_lookup(&addr.a_addr, &addr.a_mask, &root->rh); + if (node == NULL) { + RADIX_NODE_HEAD_UNLOCK(root); + return (0); + } + + aip = (struct wg_aip *)node; + if (aip->a_peer != peer) { + /* + * They could have specified an allowed-ip that belonged to a + * different peer, in which case our job is done because the + * AllowedIP has been removed. + */ + RADIX_NODE_HEAD_UNLOCK(root); + return (0); + } + + dnode = root->rnh_deladdr(&aip->a_addr, &aip->a_mask, &root->rh); + MPASS(dnode == node); + RADIX_NODE_HEAD_UNLOCK(root); + + LIST_REMOVE(aip, a_entry); + peer->p_aips_num--; + free(aip, M_WG); + return (0); +} + static struct wg_peer * wg_aip_lookup(struct wg_softc *sc, sa_family_t af, void *a) { @@ -2477,11 +2533,19 @@ wg_peer_add(struct wg_softc *sc, const nvlist_t *nvl) aipl = nvlist_get_nvlist_array(nvl, "allowed-ips", &allowedip_count); for (size_t idx = 0; idx < allowedip_count; idx++) { sa_family_t ipaf; + int ipflags; if (!nvlist_exists_number(aipl[idx], "cidr")) continue; ipaf = AF_UNSPEC; + ipflags = 0; + if (nvlist_exists_number(aipl[idx], "flags")) + ipflags = nvlist_get_number(aipl[idx], "flags"); + if ((ipflags & ~WGALLOWEDIP_VALID_FLAGS) != 0) { + err = EOPNOTSUPP; + goto out; + } cidr = nvlist_get_number(aipl[idx], "cidr"); if (nvlist_exists_binary(aipl[idx], "ipv4")) { addr = nvlist_get_binary(aipl[idx], "ipv4", &size); @@ -2504,7 +2568,13 @@ wg_peer_add(struct wg_softc *sc, const nvlist_t *nvl) } MPASS(ipaf != AF_UNSPEC); - if ((err = wg_aip_add(sc, peer, ipaf, addr, cidr)) != 0) + if ((ipflags & WGALLOWEDIP_REMOVE_ME) != 0) { + err = wg_aip_del(sc, peer, ipaf, addr, cidr); + } else { + err = wg_aip_add(sc, peer, ipaf, addr, cidr); + } + + if (err != 0) goto out; } } diff --git a/sys/dev/wg/if_wg.h b/sys/dev/wg/if_wg.h index f00b7f676319..801eaf38141d 100644 --- a/sys/dev/wg/if_wg.h +++ b/sys/dev/wg/if_wg.h @@ -32,4 +32,10 @@ struct wg_data_io { #define SIOCSWG _IOWR('i', 210, struct wg_data_io) #define SIOCGWG _IOWR('i', 211, struct wg_data_io) + +/* Keep these in sync with wireguard-tools:containers.h */ +#define WGALLOWEDIP_REMOVE_ME 0x0001 + +#define WGALLOWEDIP_VALID_FLAGS WGALLOWEDIP_REMOVE_ME + #endif /* __IF_WG_H__ */ From nobody Mon Jul 21 02:13:57 2025 X-Original-To: dev-commits-src-branches@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 4blkTy5QNNz61xvV; Mon, 21 Jul 2025 02:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkTx6HWfz3NfQ; Mon, 21 Jul 2025 02:13:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=liGzPgikJ3zb8iwPapXj6Df7u66Rq00cz7p/9aaQUPo=; b=n8D9IZSKWJHTv8KGD7Z0+ebfGGxJYwBPsqFhEsCdSdT/FVBB6sBc6nvP53UiXvT70zqBfw NHFc2yrbhPeObkCZoeePLIpmWYi0fTOl5t/izqKOu2ff+w2HyClRw+1/KffF2UyXfrHeT5 3ge7ccVZatkc6Ic3hu02VVQt7+VL1CfVNP2c0zKQyJdsp5vFdggAYI/C4tFp94NEtMCKYB YbAsWY2ILsE8ZxUexwGT/7wLU4vEp/L8XlLgbydQ/UEpG7tSUjKrYVDzfY+f9miNWhuIAk +sCEfxnqLdn9KkeRyyDNqRYjxhMPZoPOeGviO/ngbnE87SAyq6MvT9c+wltY1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=liGzPgikJ3zb8iwPapXj6Df7u66Rq00cz7p/9aaQUPo=; b=H+SKgcJ7l4Dzg4hk7jHJg8qY6l6o6ixKnJZ365kCuAP43BVUZeX2KlkTDdtkbqxp+Dx6Mj bf2ELyNjAbDQIaatzvvltRA7gxiHNIW8uHm16FIU+AlA0YByrFV0Q/6qrVqgOINtZ8dsRz YwIYqpWw59/h3NMjGldYaiwI496t5oY0A9WMntQX3BBmpqBZJKlK/KLrZ9kxQxzQoNMVp/ TJsLj2e9bjg1apawIt4ng5m2L0SZyv0SMjNV3yQQMNPNq5sZ9HwGzNAR/U0Qoi9jAz5DD8 lZ1FjKF7zfLNbvJiOFvHJf6sK6BOIpVijXFZgvUxpCQ6enh7hHe5HccAEkaowQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064037; a=rsa-sha256; cv=none; b=LKv4DXjl3wd547IrUYq0Z526yC837G831ouFZKsTsLGH8fx1tX6c4ezPPJQ7legduUO8Kq yL5SpashD2yhmd6bEmBlT2iAYnMaU5vhoiDK/Ou+B+iodTBT3rNd29YoczpnC2szVONd+0 +CKc9Sgz/f7gM+18gRcQ+30xwafT9otL7FIuqKLFfZot6XEOSSq9acITKmYlvoYWQ2kdNO UjUtf+uvWAWQirjNuM9RBnQ/FhW30+9SWozyfqMx7Hi4gqNiAPCEdUI2fp+YZeFDrZIhcj LcvEFzMwmRhw1xwdy4GNf7JNrgazaDypKhcxRwt42UL7bR42OCw9t9cKrs9K9w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTx5NLVzfcD; Mon, 21 Jul 2025 02:13:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2DvGL013907; Mon, 21 Jul 2025 02:13:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2DvBW013904; Mon, 21 Jul 2025 02:13:57 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:57 GMT Message-Id: <202507210213.56L2DvBW013904@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: d0b6c358e748 - stable/14 - kern: wg: split address/mask construction out of wg_aip_add() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: d0b6c358e7486ac560f99f9dfb8166f1f5d014e4 Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d0b6c358e7486ac560f99f9dfb8166f1f5d014e4 commit d0b6c358e7486ac560f99f9dfb8166f1f5d014e4 Author: Kyle Evans AuthorDate: 2025-06-26 02:57:02 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:12:28 +0000 kern: wg: split address/mask construction out of wg_aip_add() We'll re-use these in a future wg_aip_del() to perfectly reconstruct what we expect to find in a_addr/a_mask. Reviewed by: ivy, markj (both earlier version), Aaron LI, jhb (cherry picked from commit 2475a3dab0d5c5614e303c0022a834f725e2a078) --- sys/dev/wg/if_wg.c | 63 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/sys/dev/wg/if_wg.c b/sys/dev/wg/if_wg.c index 9e86e1074ef5..380e579eed07 100644 --- a/sys/dev/wg/if_wg.c +++ b/sys/dev/wg/if_wg.c @@ -312,7 +312,8 @@ static void wg_timers_run_send_keepalive(void *); static void wg_timers_run_new_handshake(void *); static void wg_timers_run_zero_key_material(void *); static void wg_timers_run_persistent_keepalive(void *); -static int wg_aip_add(struct wg_softc *, struct wg_peer *, sa_family_t, const void *, uint8_t); +static int wg_aip_add(struct wg_softc *, struct wg_peer *, sa_family_t, + const void *, uint8_t); static struct wg_peer *wg_aip_lookup(struct wg_softc *, sa_family_t, void *); static void wg_aip_remove_all(struct wg_softc *, struct wg_peer *); static struct wg_peer *wg_peer_create(struct wg_softc *, @@ -526,46 +527,62 @@ wg_peer_get_endpoint(struct wg_peer *peer, struct wg_endpoint *e) rw_runlock(&peer->p_endpoint_lock); } -/* Allowed IP */ static int -wg_aip_add(struct wg_softc *sc, struct wg_peer *peer, sa_family_t af, const void *addr, uint8_t cidr) +wg_aip_addrinfo(struct wg_aip *aip, const void *baddr, uint8_t cidr) { - struct radix_node_head *root; - struct radix_node *node; - struct wg_aip *aip; - int ret = 0; - - aip = malloc(sizeof(*aip), M_WG, M_WAITOK | M_ZERO); - aip->a_peer = peer; - aip->a_af = af; + struct aip_addr *addr, *mask; - switch (af) { + addr = &aip->a_addr; + mask = &aip->a_mask; + switch (aip->a_af) { #ifdef INET case AF_INET: if (cidr > 32) cidr = 32; - root = sc->sc_aip4; - aip->a_addr.in = *(const struct in_addr *)addr; - aip->a_mask.ip = htonl(~((1LL << (32 - cidr)) - 1) & 0xffffffff); - aip->a_addr.ip &= aip->a_mask.ip; - aip->a_addr.length = aip->a_mask.length = offsetof(struct aip_addr, in) + sizeof(struct in_addr); + addr->in = *(const struct in_addr *)baddr; + mask->ip = htonl(~((1LL << (32 - cidr)) - 1) & 0xffffffff); + addr->ip &= mask->ip; + addr->length = mask->length = offsetof(struct aip_addr, in) + sizeof(struct in_addr); break; #endif #ifdef INET6 case AF_INET6: if (cidr > 128) cidr = 128; - root = sc->sc_aip6; - aip->a_addr.in6 = *(const struct in6_addr *)addr; - in6_prefixlen2mask(&aip->a_mask.in6, cidr); + addr->in6 = *(const struct in6_addr *)baddr; + in6_prefixlen2mask(&mask->in6, cidr); for (int i = 0; i < 4; i++) - aip->a_addr.ip6[i] &= aip->a_mask.ip6[i]; - aip->a_addr.length = aip->a_mask.length = offsetof(struct aip_addr, in6) + sizeof(struct in6_addr); + addr->ip6[i] &= mask->ip6[i]; + addr->length = mask->length = offsetof(struct aip_addr, in6) + sizeof(struct in6_addr); break; #endif default: - free(aip, M_WG); return (EAFNOSUPPORT); } + return (0); +} + +/* Allowed IP */ +static int +wg_aip_add(struct wg_softc *sc, struct wg_peer *peer, sa_family_t af, + const void *baddr, uint8_t cidr) +{ + struct radix_node_head *root = NULL; + struct radix_node *node; + struct wg_aip *aip; + int ret = 0; + + aip = malloc(sizeof(*aip), M_WG, M_WAITOK | M_ZERO); + aip->a_peer = peer; + aip->a_af = af; + + ret = wg_aip_addrinfo(aip, baddr, cidr); + if (ret != 0) { + free(aip, M_WG); + return (ret); + } + + root = af == AF_INET ? sc->sc_aip4 : sc->sc_aip6; + MPASS(root != NULL); RADIX_NODE_HEAD_LOCK(root); node = root->rnh_addaddr(&aip->a_addr, &aip->a_mask, &root->rh, aip->a_nodes); if (node == aip->a_nodes) { From nobody Mon Jul 21 02:13:59 2025 X-Original-To: dev-commits-src-branches@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 4blkV03ryLz61y0N; Mon, 21 Jul 2025 02:14:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkV00SYBz3NjR; Mon, 21 Jul 2025 02:14:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064040; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=50quHk369p6oZ0MOB7Lwx6BtgloIApUAXxkIVLv2tyg=; b=ADTGaJkGiXONZbR5spUFSCNB5SCgifiCd2icht0iTnIRg6AdrIFA0h360s+8WVR4AHRsJa PRb5TQsoitlEoIQeDnDIkAbmV2PrvanEqxPW2e9xEUWeGvQNrzDg4NE6pTrff80RVfAYdD 5Zy9aRAD1B/a5a27IiNsUWZzPXNLFVIvvKNX6bb32ddZhIMnJrxqTH2GtThDkMoQf/+woM wSQD2vMefmeMo2lfYSTKeAT2tQT6e1lyEp58iVGQ+dIa5WIqCe6N8UXyaQv1TXfK0VMT7z 0oTbnIYd2E6VM//LPsoD6yVsvYZFgyghgTJLxcKw1G899q1SGFCrzlOCv0fwOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064040; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=50quHk369p6oZ0MOB7Lwx6BtgloIApUAXxkIVLv2tyg=; b=CE9r96Gu1RPhRnMCwjPygfOs8eTsQfeylHEAanJWZ6CXkTDjSVELCyoEIvVjf4ZXlLBsHV 6EzzntZ/vaxFf/RzPoqv41GC2TEJijfWc2UvHoSd9eWTy+ig0UE+Lv9m9uB8SrdUI2dk94 KnoWtG4umCVas+vzxJjGXAasmCyoTUGKYIx8ZE0UjXl+erdI+ZBBbfbHBzOxmoAYps0pqj QugSc6WOjpLqsHpdJaCg0dioNzpnLyY53NOw71OEm4YHn+0HGwXay7MeiHJWNjJ/15OEm2 kvbRaJA9Lh51JGVGSex5dAmE4IBai0ZDwtlXhXK8BDZvudWdP5WbDYesYKJf4g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064040; a=rsa-sha256; cv=none; b=qokgJSETCT+vKsJSTVKv9RrFn63Doh1qZNdCZMu2nymjtvM9aQ9tNb7Vf8Gx9/2JXZPHTQ Ujf5xeyPJTmyRZ9R2vaKpa7JWphAZO+mytcxxA3Sv4/qgE6hpxeQ2uphWkkMIunnRkxbig I6tAsUrp5gqhpNsvTTzNvlPSwey7hduviqItq40Y51oTmCzE4oqqAr0q1y9OZFJMskiPHp YN1CZB5KWa/GKXGp+sLNFY6XGqoFgXJHMKHa2u9JSLhjU9fC56VXveyioxGb2W3mdX4JYO eVnFpjr3mP90XMSKKg5MvoF+u7L01mTZg9gASRtqXzfDumTZw9zol8rDKzhG7g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkTz752ZzfcF; Mon, 21 Jul 2025 02:13:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2DxcT013982; Mon, 21 Jul 2025 02:13:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2DxCa013979; Mon, 21 Jul 2025 02:13:59 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:13:59 GMT Message-Id: <202507210213.56L2DxCa013979@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: e95cf8b04b47 - stable/14 - wg: ipc: add allowed-ip flags support for FreeBSD List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: e95cf8b04b47ee9abf544bb754452e6f30b2dc18 Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e95cf8b04b47ee9abf544bb754452e6f30b2dc18 commit e95cf8b04b47ee9abf544bb754452e6f30b2dc18 Author: Kyle Evans AuthorDate: 2025-06-26 02:57:03 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:13:15 +0000 wg: ipc: add allowed-ip flags support for FreeBSD For $reasons, we can't rely on flags in wireguard-tools for the kernel side of WireGuard. Provide a mapping function that uses flags from the kernel that we're building against and fail the operation if we made it to the end without turning some wg(8) flag off. Signed-off-by: Kyle Evans Reviewed by: ivy (previous version), Jason A. Donenfeld, jhb (cherry picked from commit f6d9e22982a1d0354c0199e94ebdb4474eaa74b9) --- contrib/wireguard-tools/ipc-freebsd.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/contrib/wireguard-tools/ipc-freebsd.h b/contrib/wireguard-tools/ipc-freebsd.h index 58e5e71ce5cb..69077038a15a 100644 --- a/contrib/wireguard-tools/ipc-freebsd.h +++ b/contrib/wireguard-tools/ipc-freebsd.h @@ -307,11 +307,8 @@ static int kernel_set_device(struct wgdevice *dev) nvl_aips[j] = nvlist_create(0); if (!nvl_aips[j]) goto err_peer; - if (aip->flags) { - //TODO: implement me - ret = -EOPNOTSUPP; - goto err_peer; - } + if (aip->flags) + nvlist_add_number(nvl_aips[j], "flags", aip->flags); nvlist_add_number(nvl_aips[j], "cidr", aip->cidr); if (aip->family == AF_INET) nvlist_add_binary(nvl_aips[j], "ipv4", &aip->ip4, sizeof(aip->ip4)); From nobody Mon Jul 21 02:14:02 2025 X-Original-To: dev-commits-src-branches@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 4blkV30XM6z61xWX; Mon, 21 Jul 2025 02:14:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkV22CDRz3NdY; Mon, 21 Jul 2025 02:14:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064042; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IrRoQUOqKG8ksQMlzP2PwjwGI8bbN/Gt24MgEpCV8LQ=; b=dLzI5lw5x0eHNyLCHsUlZJtLY/H9AB+obAnZG7TFV81+2Mg91Tq0XU2yP9FvLcG4Aj3zZU crBI8rY/yUanVM0LF7+FW+1qnqwa762l+l+EZybpp9TGnBIXnmxijkwH884GH30QEJqC7i S1L0YJjdm5voPl5UZArnFiRxgekqVyFlFYafjHpkkk/mnsFxbeB3UaXufUWuboWVq1qFTl R8CaWNB6zzGnmRA5FMImhp9yir3BmdMh9oMZjRIcVXFT4XRhhcEcibZ3sd3smVqcb70N44 XTi79ECSTTkMHs/dwYg1NCjyiIGHcddCQhwYBJnctPbejNUb2z/t5Zl61e9auw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064042; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IrRoQUOqKG8ksQMlzP2PwjwGI8bbN/Gt24MgEpCV8LQ=; b=SozsvI91TC/bwxaUjJKGUUD2D+53j/dBSIQMyilmD/9lnGtpIB6G+ic0bxhQVgI+rWjQ8U GxpI20K09TMieCxFPpgpAJiRDGVpyZoW59MvhZ4HNQ/QY5VMkDKnx21BBgJa4NdhTSmRcc lbQ7TgQqnyWSoT0zdOTc3UDGL/tvGtPHj+F+wlG5H1fXYyZxI6dD7XSIJI3OXMZpyrRS8U YHnpO9PBq5WbuxcmcTHC/8GEpfXUGJk2bnuXsAep3G07d3a6yHVPhUrUOZ5c2PzbXysL3B MCFca0H2mmKrByaMi2RzhER/nq2iN9W5LBZ96f+feEOsxXtGCya6ok74EI8eYg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064042; a=rsa-sha256; cv=none; b=PQrsTu7L55PtvnfOCxLuuKMUPVSEluWcxNC3RVwBF2fvGxjiZsX9SMtffkhJ6TOoJ5IncB KTBpD9rULg9qjop8W8tjGK1Dr37EBykAicvdQlmuGNOFP9DpyeiDcuhLFtYjpUeu9Jv137 qLbs2QNSrNekZvbXQX8OAvqaLnJqzBU846J2Fy6+8rD/tLMAJbR8Ry2/hqTjUJ+r0/6RFf p6Rdor6Bq20Tb4BbK2Uu7BaGeKjMq0NzmjMWNQ6b9QJugniDNr36+tfu7lwEzPwGHtA3Ag neoiz0Qyl3S2Ig0Y0FdmBrmH6SZAxNyTeFWvHvEjrftM9DundtyrQMOq4OMA2Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkV21kJXzfGP; Mon, 21 Jul 2025 02:14:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2E2Ga014058; Mon, 21 Jul 2025 02:14:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2E2Ac014055; Mon, 21 Jul 2025 02:14:02 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:14:02 GMT Message-Id: <202507210214.56L2E2Ac014055@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: dd695839efd8 - stable/14 - route: fix `route -n monitor` when its output is redirected List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: dd695839efd80fe81143cd6c7a552c30df8448f6 Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=dd695839efd80fe81143cd6c7a552c30df8448f6 commit dd695839efd80fe81143cd6c7a552c30df8448f6 Author: Oleg Streejak AuthorDate: 2025-07-17 17:06:50 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:13:16 +0000 route: fix `route -n monitor` when its output is redirected This is a small oversight in the transition to netlink; the non-netlink implementation would explicitly flush its stdout as necessary to avoid apparent long stalls in output when we end up fully-buffered. Adjust the netlink implementation to do the same. This was noticed while trying to triage failures in the wg-quick script. Commit message by kevans, patch by author. PR: 278265 Fixes: 091fec1188929 ("route: switch transport protocol [...]") (cherry picked from commit 97b61b22edba74c62adba1d022fb73541aa5ff93) --- sbin/route/route_netlink.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/route/route_netlink.c b/sbin/route/route_netlink.c index 28766b062e18..2870d256aadd 100644 --- a/sbin/route/route_netlink.c +++ b/sbin/route/route_netlink.c @@ -733,6 +733,7 @@ print_nlmsg(struct nl_helper *h, struct nlmsghdr *hdr, struct snl_msg_info *cinf print_nlmsg_generic(h, hdr, cinfo); } + fflush(stdout); snl_clear_lb(&h->ss_cmd); } From nobody Mon Jul 21 02:14:01 2025 X-Original-To: dev-commits-src-branches@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 4blkV14tSnz61xTN; Mon, 21 Jul 2025 02:14:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4blkV11bx6z3NbW; Mon, 21 Jul 2025 02:14:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064041; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xGnlh3V2RLeyq5hYGgOR7I/0AAAksdtoPP/bnz1XQMk=; b=HXfNPE9OdooeuBvgH8OLzQ3pBUGgitGfJHWVyE55hGRwmp9EfFJyvvOdGuVBSxtNUr/rL/ HSDZtbfoB5zHa6hod0oaztzYrZdur16ioJjIuKEMQy2Dl+rnnTwGzHeIkcnB9BsEKcEYVT TpCby2V1Uhqw45sE/Yg7DoEaNAAOsHajFpRlo+/4D3UuApiOVioJTan0USelTwpGdsa17u ogCzQTLUfwl3tH5bSz0WVE5UJiCLRkonayZd5Zf36DIap8zZ3g2O/vdFRIC2h/4uZIgDxw /QF1HGMiAx4OW7paQCv41obZuG/KVymy4aPGtVAXv65wROZbD8oFq8Il/3zz3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753064041; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xGnlh3V2RLeyq5hYGgOR7I/0AAAksdtoPP/bnz1XQMk=; b=xv81boiALiTA490NvfAdzz4yOjgpvsJ9/PF43OLPEsvw3VToE4F/BPv+cs69A8U4aC/wbm sujhmxiCMF+/FxamqPAALeokpjQYMlQWICnATnSogQ5s3PRYYq45VpbMtjasWO87EcwGcB kTALHkRHrpqZPtJ/G2IpLLoBSC+7ubtpNRlIx1e4zp1DUu/HZ773rvuiWH/I1KMah7rW3U ACZilVLUWPmR3mvTZePZIMTpQU3yPJDIy1d1Mo7DAwOt5Z4M5fUu4JYG4PQNke3bHnRDW9 ztEA3ckJZ785317yZ3M6TH+NS8rWlfCGavQexis2giI1c4zb0OyWBegPw0qLUw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753064041; a=rsa-sha256; cv=none; b=uvjwfmnZ5nkZfeTuSFL/8O6VNub0TNg92EPAfN/5j/UPWnBQaMCfes9+RN+drCM7yIjuLY I2kkt2hWzbwJOB7ihk3T7Cmygc8aqg7VhjNpr58xz4mrsBuhVsC2ElwmkF6+DY8WNP+Bvg +ktEY2xQv+TvD6TFt98PVWOyWTl0hJomRblRryRA1Kn+I+JFIRKSRLxu83wATYL0SoURD1 y8mMwq350pKbWee5iWFy1MYw4F9C+QMfVBSxAXsISm2m/qtqqzNtfjNeL8VjFdABrTnB2+ BDyuUXysG1Iz8Gwtg7azcXxHGW0MJhKaWRmHDrRteNrVyDyfzFRRVjEMtc59XA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4blkV118Btzdjt; Mon, 21 Jul 2025 02:14:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L2E1nN014022; Mon, 21 Jul 2025 02:14:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L2E1aX014019; Mon, 21 Jul 2025 02:14:01 GMT (envelope-from git) Date: Mon, 21 Jul 2025 02:14:01 GMT Message-Id: <202507210214.56L2E1aX014019@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 34f71ebee8bd - stable/14 - tests: extend wireguard test to cover incremental allowed-ips updates List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 34f71ebee8bd73d6d7bf56aaddf4aeffd754c8d0 Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=34f71ebee8bd73d6d7bf56aaddf4aeffd754c8d0 commit 34f71ebee8bd73d6d7bf56aaddf4aeffd754c8d0 Author: Kyle Evans AuthorDate: 2025-06-26 02:57:03 +0000 Commit: Kyle Evans CommitDate: 2025-07-21 02:13:15 +0000 tests: extend wireguard test to cover incremental allowed-ips updates New +/- syntax in wg(8) allows us to add or remove just a single allowed-ip rather than forcing replacement or weird tricks to do an atomic removal. Ensure that it works now that we've added kernel support for it. Reviewed by: ivy (cherry picked from commit 716b6667b65b50c15900be9f88cc67f2326872b4) --- tests/sys/net/if_wg.sh | 205 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 205 insertions(+) diff --git a/tests/sys/net/if_wg.sh b/tests/sys/net/if_wg.sh index e5df6afface1..aaeec4b95964 100644 --- a/tests/sys/net/if_wg.sh +++ b/tests/sys/net/if_wg.sh @@ -424,6 +424,208 @@ wg_vnet_parent_routing_cleanup() vnet_cleanup } +# The kernel should now allow removing a single allowed-ip without having to +# replace the whole list. We can't really test the atomicity of it all that +# easily, but we'll trust that it worked right if just that addr/mask is gone. +atf_test_case "wg_allowedip_incremental" "cleanup" +wg_allowedip_incremental_head() +{ + atf_set descr "Add/remove allowed-ips from a peer with the +/- incremental syntax" + atf_set require.user root +} + +wg_allowedip_incremental_body() +{ + local pri1 pri2 pub1 pub2 wg1 + local tunnel1 tunnel2 tunnel3 + + kldload -n if_wg || atf_skip "This test requires if_wg and could not load it" + + pri1=$(wg genkey) + pri2=$(wg genkey) + pub2=$(echo "$pri2" | wg pubkey) + + tunnel1=169.254.0.1 + tunnel2=169.254.0.2 + tunnel3=169.254.0.3 + + vnet_mkjail wgtest1 + + wg1=$(jexec wgtest1 ifconfig wg create) + echo "$pri1" | jexec wgtest1 wg set $wg1 private-key /dev/stdin + pub1=$(jexec wgtest1 wg show $wg1 public-key) + + atf_check -s exit:0 \ + jexec wgtest1 wg set $wg1 peer $pub2 \ + allowed-ips "${tunnel1}/32,${tunnel2}/32" + + atf_check -o save:wg.allowed jexec wgtest1 wg show $wg1 allowed-ips + atf_check grep -q "${tunnel1}/32" wg.allowed + atf_check grep -q "${tunnel2}/32" wg.allowed + + atf_check -s exit:0 \ + jexec wgtest1 wg set $wg1 peer $pub2 \ + allowed-ips "-${tunnel2}/32" + + atf_check -o save:wg-2.allowed jexec wgtest1 wg show $wg1 allowed-ips + atf_check grep -q "${tunnel1}/32" wg-2.allowed + atf_check -s not-exit:0 grep -q "${tunnel2}/32" wg-2.allowed + + atf_check -s exit:0 \ + jexec wgtest1 wg set $wg1 peer $pub2 \ + allowed-ips "+${tunnel2}/32" + + atf_check -o save:wg-3.allowed jexec wgtest1 wg show $wg1 allowed-ips + atf_check grep -q "${tunnel1}/32" wg-3.allowed + atf_check grep -q "${tunnel2}/32" wg-3.allowed + + # Now attempt to add the address yet again to confirm that it's not + # harmful. + atf_check -s exit:0 \ + jexec wgtest1 wg set $wg1 peer $pub2 \ + allowed-ips "+${tunnel2}/32" + + atf_check -o save:wg-4.allowed -x \ + "jexec wgtest1 wg show $wg1 allowed-ips | cut -f2 | tr ' ' '\n'" + atf_check -o match:"2 wg-4.allowed$" wc -l wg-4.allowed + + # Finally, let's try removing an address that we never had at all and + # confirm that we still have our two addresses. + atf_check -s exit:0 \ + jexec wgtest1 wg set $wg1 peer $pub2 \ + allowed-ips "-${tunnel3}/32" + + atf_check -o save:wg-5.allowed -x \ + "jexec wgtest1 wg show $wg1 allowed-ips | cut -f2 | tr ' ' '\n'" + atf_check cmp -s wg-4.allowed wg-5.allowed +} + +wg_allowedip_incremental_cleanup() +{ + vnet_cleanup +} + +atf_test_case "wg_allowedip_incremental_inet6" "cleanup" +wg_allowedip_incremental_inet6_head() +{ + atf_set descr "Add/remove IPv6 allowed-ips from a peer with the +/- incremental syntax" + atf_set require.user root +} + +wg_allowedip_incremental_inet6_body() +{ + local pri1 pri2 pub1 pub2 wg1 + local tunnel1 tunnel2 + + kldload -n if_wg || atf_skip "This test requires if_wg and could not load it" + + pri1=$(wg genkey) + pri2=$(wg genkey) + pub2=$(echo "$pri2" | wg pubkey) + + tunnel1=2001:db8:1::1 + tunnel2=2001:db8:1::2 + + vnet_mkjail wgtest1 + + wg1=$(jexec wgtest1 ifconfig wg create) + echo "$pri1" | jexec wgtest1 wg set $wg1 private-key /dev/stdin + pub1=$(jexec wgtest1 wg show $wg1 public-key) + + atf_check -s exit:0 \ + jexec wgtest1 wg set $wg1 peer $pub2 \ + allowed-ips "${tunnel1}/128" + atf_check -o save:wg.allowed jexec wgtest1 wg show $wg1 allowed-ips + atf_check grep -q "${tunnel1}/128" wg.allowed + + atf_check -s exit:0 \ + jexec wgtest1 wg set $wg1 peer $pub2 \ + allowed-ips "+${tunnel2}/128" + atf_check -o save:wg-2.allowed jexec wgtest1 wg show $wg1 allowed-ips + atf_check grep -q "${tunnel1}/128" wg-2.allowed + atf_check grep -q "${tunnel2}/128" wg-2.allowed + + atf_check -s exit:0 \ + jexec wgtest1 wg set $wg1 peer $pub2 \ + allowed-ips "-${tunnel1}/128" + atf_check -o save:wg-3.allowed jexec wgtest1 wg show $wg1 allowed-ips + atf_check -s not-exit:0 grep -q "${tunnel1}/128" wg-3.allowed + atf_check grep -q "${tunnel2}/128" wg-3.allowed +} + +wg_allowedip_incremental_inet6_cleanup() +{ + vnet_cleanup +} + + +atf_test_case "wg_allowedip_incremental_stealing" "cleanup" +wg_allowedip_incremental_stealing_head() +{ + atf_set descr "Add/remove allowed-ips from a peer with the +/- incremental syntax to steal" + atf_set require.user root +} + +wg_allowedip_incremental_stealing_body() +{ + local pri1 pri2 pri3 pub1 pub2 pub3 wg1 + local regex2 regex3 + local tunnel1 tunnel2 + + kldload -n if_wg || atf_skip "This test requires if_wg and could not load it" + + pri1=$(wg genkey) + pri2=$(wg genkey) + pri3=$(wg genkey) + pub2=$(echo "$pri2" | wg pubkey) + pub3=$(echo "$pri3" | wg pubkey) + + regex2=$(echo "$pub2" | sed -e 's/[+]/[+]/g') + regex3=$(echo "$pub3" | sed -e 's/[+]/[+]/g') + + tunnel1=169.254.0.1 + tunnel2=169.254.0.2 + tunnel3=169.254.0.3 + + vnet_mkjail wgtest1 + + wg1=$(jexec wgtest1 ifconfig wg create) + echo "$pri1" | jexec wgtest1 wg set $wg1 private-key /dev/stdin + pub1=$(jexec wgtest1 wg show $wg1 public-key) + + atf_check -s exit:0 \ + jexec wgtest1 wg set $wg1 peer $pub2 \ + allowed-ips "${tunnel1}/32,${tunnel2}/32" + + atf_check -s exit:0 \ + jexec wgtest1 wg set $wg1 peer $pub3 \ + allowed-ips "${tunnel3}/32" + + # First, confirm that the negative syntax doesn't do anything because + # we have the wrong peer. + atf_check -s exit:0 \ + jexec wgtest1 wg set $wg1 peer $pub2 \ + allowed-ips "-${tunnel3}/32" + + atf_check -o save:wg.allowed jexec wgtest1 wg show $wg1 allowed-ips + atf_check grep -Eq "^${regex3}.+${tunnel3}/32" wg.allowed + + # Next, steal it with an incremental move and check that it moved. + atf_check -s exit:0 \ + jexec wgtest1 wg set $wg1 peer $pub2 \ + allowed-ips "+${tunnel3}/32" + + atf_check -o save:wg-2.allowed jexec wgtest1 wg show $wg1 allowed-ips + + atf_check grep -Eq "^${regex2}.+${tunnel3}/32" wg-2.allowed + atf_check grep -Evq "^${regex3}.+${tunnel3}/32" wg-2.allowed +} + +wg_allowedip_incremental_stealing_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "wg_basic" @@ -432,4 +634,7 @@ atf_init_test_cases() atf_add_test_case "wg_key_peerdev_shared" atf_add_test_case "wg_key_peerdev_makeshared" atf_add_test_case "wg_vnet_parent_routing" + atf_add_test_case "wg_allowedip_incremental" + atf_add_test_case "wg_allowedip_incremental_inet6" + atf_add_test_case "wg_allowedip_incremental_stealing" } From nobody Mon Jul 21 03:04:15 2025 X-Original-To: dev-commits-src-branches@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 4bllbz66p1z621xY; Mon, 21 Jul 2025 03:04:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bllbz4VxBz3FvC; Mon, 21 Jul 2025 03:04:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753067055; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TpLnWRw7PYAQaMefME59jd0qzPFyzcA/aARgpd9yB5Q=; b=OV2Kke88ammCM7owsu5mkMzS/VJK1PigQI0SMD/LRqdpGDPKHxuSYabcPK4cBq2B43ZMCN XUd4uF09t+/YD4hN6ey+kmtcDmnR8dACEu6JKpDB7bbdZ5dpYm1S9bNdYieSZs+0XsekYg kv7FrZJo+ozJcra1wsJvqfiLCYW66tBpVHPO+p7rDhgxoqSC4hli+iYFaZl2ueriEy5Nq6 ueYignjUayQep8dAMZ6JfKqWEiauL0m4+7oWT4ZQDwWDeKJFsu/13aYgbPc0DuRtTL0O1u P9LJVEBecSYI8tWS1yB/vbDedu6nt+zPFyAvqth9fgfOJua0RL1s4oOGSuGxcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753067055; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TpLnWRw7PYAQaMefME59jd0qzPFyzcA/aARgpd9yB5Q=; b=ROG7OUymqnjAykC3QKdIFyleFhX0qbsoLOqzD2x+joG4MUMPnBLsCwqOc75G0mTPOI0bGf H38xmX8z23igEq7nPdQbepMaJpWmE2V5HVBa4FgsJwO/J0M1N/+BxhiXOlhu3TXueFRA7K wXwxbWt/32qMPoSO+XFLmpXUTfDeOE3LJ0A8gFqor2mRoFkXu0CQRH2IaxY19y3VxUkJ6M P4OeNB6/tKztZVxs75GFlT5iGXGnx800IS69HJJJCWdk10gBfIMk1xm58rtFaeTRZJkYQH gGT/pGB1nueYqaoFqfychUYi629X5fOoekunsy+Se7SeL4kFNWviFY2i1QteMA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753067055; a=rsa-sha256; cv=none; b=ivGp79xz1HOe39C8iZb94QzgHc1Q8HBooMFIbjfIYI8ackJ4pbrw5TulrrVmsjJP6XSkFX rEgItNAkI1n9OS6PNiZIhvU1WWL4EzpDjQkZMo1bBG3Rrqd9mC0+qvmKT1Q+pekcopEJXU yGXtKFEKf+aNXxUnJxGeRyhw9Ln6gNld4WKS7vIiCx7nRmDjV9A621ry1mpIFD+uWCi5pw 3RpUzZ7YQ7xd6wqWON+kHrMjaM3KZkBawkELtmU6q7MFIASR2WBnRsXLp0JJllb6sBlatj 5DsblHpX+Rgp6S7mDn7la2MydHV7OUoliflU38XGJfGYWiRdvwPkjPkwCkluCA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bllbz40lzzgjy; Mon, 21 Jul 2025 03:04:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L34Ff6009737; Mon, 21 Jul 2025 03:04:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L34Fd0009734; Mon, 21 Jul 2025 03:04:15 GMT (envelope-from git) Date: Mon, 21 Jul 2025 03:04:15 GMT Message-Id: <202507210304.56L34Fd0009734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Justin Hibbits Subject: git: e04d629d5394 - stable/14 - powerpc: Reserve correct scratch region size below stack List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: e04d629d5394ed85c53febeb8688344236fb9483 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=e04d629d5394ed85c53febeb8688344236fb9483 commit e04d629d5394ed85c53febeb8688344236fb9483 Author: Timothy Pearson AuthorDate: 2025-07-06 19:24:07 +0000 Commit: Justin Hibbits CommitDate: 2025-07-21 02:56:58 +0000 powerpc: Reserve correct scratch region size below stack According to the ELF ABI v2, two scratch regions are reserved below the stack pointer, one 288 byte general region and one 224 byte compiler region. FreeBSD only reserved the 288 byte region. Follow the ELV v2 ABI and reserve the full 512 byte region as specified. Signed-off-by: Timothy Pearson MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1756 (cherry picked from commit 645bb3efc3209a9ca6dfabb48b1c6475c1d965a9) --- sys/powerpc/powerpc/exec_machdep.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c index 2e4e0ebfd7ed..bdd1da9c9cbd 100644 --- a/sys/powerpc/powerpc/exec_machdep.c +++ b/sys/powerpc/powerpc/exec_machdep.c @@ -214,10 +214,10 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) sfpsize = sizeof(sf); #ifdef __powerpc64__ /* - * 64-bit PPC defines a 288 byte scratch region - * below the stack. + * 64-bit PPC defines a 512 byte red zone below + * the existing stack (ELF ABI v2 §2.2.2.4) */ - rndfsize = 288 + roundup(sizeof(sf), 48); + rndfsize = 512 + roundup(sizeof(sf), 48); #else rndfsize = roundup(sizeof(sf), 16); #endif From nobody Mon Jul 21 03:04:16 2025 X-Original-To: dev-commits-src-branches@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 4bllc06cXvz621rF; Mon, 21 Jul 2025 03:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bllc05rZ4z3GCN; Mon, 21 Jul 2025 03:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753067056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iDXXLUAU/BIJ1B1/VujWUj6QzoPNAslEKpfzqVcG4jU=; b=c+IgY/DhiOTGnWl7jFLW8KnGd/kCwTDu3r7ktMh9qM3E/BQOq3JOfoLLDm3IJ9qd5c6dne 32Z9CanILefQTDSHQX07Zqmv2nT65xZIh4ESHW9KqEhRysGSYclCxZgkZUgbDPf5hJdKeq 229ZBYYBK4+DWAuoocMNUCRjxvdFcTHrwy+6f7zFPYe2ph5hFa9tjkS8/e/DdZ2TqawBhR IZSLks2Y8Hp2jp/p19dJ6MtftJduq8Rx7Tj3kEH0pROy4ZR22VYwDjC/hyygeos02wj3tX W3W1zd5scL7z84Yolw0gDQ6abQjCxm4mnqLulZNbdyMfuOgCsW3k3nRCp+UJHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753067056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iDXXLUAU/BIJ1B1/VujWUj6QzoPNAslEKpfzqVcG4jU=; b=s6f7+WfaASYpLGTbTgg7DRts/ih/mMdV7iXFxUACv1ogVM1INxBJgwhDipyUQV4KOX5ARv Os7SUOzwWVgQCagoYt2zmDjBvYKmkpyt8jXKiHidq7VSAgvOTVpR1AiGujTd7FPwdn+l55 QljO4I2dzLNv0o7OMGQi/7DOdDynmxAgZms77pHUGpk+hJi+emwjOndQ/S0ZJFLfeULBnr KsD9rdjraL5/WZ6N5r083GZ8BY5Vq/H5ML0WLOj/JXQJfSXNQLHvv++hYt5raET3LKGoll 9OAzRgRzP06lzGReDv9hNcvR40J/3YBVmayhnLC1CJG5a6XgVqCylEcYloa7Kw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753067056; a=rsa-sha256; cv=none; b=ufiNmtBZupRcbL8/eHNdhmMHpJNS+J8wxY7sFC1drJw2sWp9xyUJU2+FhluBEVjUtmHu4v rv33B4V2ROO+L4dGjv7nD9chQ4WDEcOMiJtatlk5sbSUg2w72Q9aHBWOSvJN98Olz0Fb9n uSLQcQANMqiq+YrKCX/fbFxwo9CX8gixnOeLsxRPqfWCS7Oe5aQmTmQ4RB3y1EQQm81o3c ZkouaMyQHl061xBYbD/csRE084v2rss29JOjR/pMLer3eUZatUSnzEVOTwzK7829WIe4kT 8xHqI8cBCxrCyh0hyEHCZXgVfFdL0pqBKUY6gWF+cO/sNgWDcFVHHCMmJV1ZfQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bllc04y8xzgk0; Mon, 21 Jul 2025 03:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L34GGR009771; Mon, 21 Jul 2025 03:04:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L34GHi009768; Mon, 21 Jul 2025 03:04:16 GMT (envelope-from git) Date: Mon, 21 Jul 2025 03:04:16 GMT Message-Id: <202507210304.56L34GHi009768@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Justin Hibbits Subject: git: 90a9ce456740 - stable/14 - powerpc: Fix multiple issues with FP/VSX save/restore List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 90a9ce456740d9e2ef20e781e5a57f5d611d1c83 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=90a9ce456740d9e2ef20e781e5a57f5d611d1c83 commit 90a9ce456740d9e2ef20e781e5a57f5d611d1c83 Author: Timothy Pearson AuthorDate: 2025-07-06 19:28:30 +0000 Commit: Justin Hibbits CommitDate: 2025-07-21 02:56:59 +0000 powerpc: Fix multiple issues with FP/VSX save/restore Multiple issues existed within the powerpc FP/VSX save/restore functionality, leading to register corruption and loss of register contents in specific scenarios involving high signal load and use of both floating point and VSX instructions. Issue #1 On little endian systems the PCB used the wrong location for the shadowed FP register within the larger VSX register. This appears to have been an attempt to correct issue #2 without understanding how the vector load/store instructions actually operate. Issue #2 On little endian systems, the VSX state save/restore routines swapped 32-bit words within the 64-bit aliased double word for the associated floating point register. This was due to the use of a word-oriented load/store vs. doubleword oriented load/store. Issue #3 The FPU was turned off in the PCB but not in hardware, leading to a potential race condition if the same thread was scheduled immediately after sigreturn. The triggering codebase for this is Go, which makes heavy use of signals and and generates an unusual mix of floating point and VSX assembler. As a result, when combined with th powerpc lazy FPU restore, a condition was repeatedly hit whereby the thread was interrupted in FP+VSX mode, then restored in FP only mode, thus reliably triggering the issues above. Also clean up the associated asm() style issue flagged by GitHub Actions. Signed-off-by: Timothy Pearson MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1756 (cherry picked from commit 077e30e61d7e1c90af7df31989bb976a3ace0c69) --- sys/powerpc/include/pcb.h | 10 +--------- sys/powerpc/include/ucontext.h | 2 ++ sys/powerpc/powerpc/exec_machdep.c | 33 ++++++++++++++++++++++++--------- sys/powerpc/powerpc/fpu.c | 30 ++++++++++++++++++++++++++---- 4 files changed, 53 insertions(+), 22 deletions(-) diff --git a/sys/powerpc/include/pcb.h b/sys/powerpc/include/pcb.h index 050ada6b0f64..0230cf78aba7 100644 --- a/sys/powerpc/include/pcb.h +++ b/sys/powerpc/include/pcb.h @@ -66,16 +66,8 @@ struct pcb { #define PCB_VECREGS 0x200 /* Process had Altivec registers initialized */ struct fpu { union { -#if _BYTE_ORDER == _BIG_ENDIAN - double fpr; - uint32_t vsr[4]; -#else uint32_t vsr[4]; - struct { - double padding; - double fpr; - }; -#endif + double fpr; } fpr[32]; double fpscr; /* FPSCR stored as double for easier access */ } pcb_fpu; /* Floating point processor */ diff --git a/sys/powerpc/include/ucontext.h b/sys/powerpc/include/ucontext.h index d35c6c773fe0..dc87edd578bc 100644 --- a/sys/powerpc/include/ucontext.h +++ b/sys/powerpc/include/ucontext.h @@ -41,6 +41,7 @@ typedef struct __mcontext { int mc_flags; #define _MC_FP_VALID 0x01 #define _MC_AV_VALID 0x02 +#define _MC_VS_VALID 0x04 int mc_onstack; /* saved onstack flag */ int mc_len; /* sizeof(__mcontext) */ __uint64_t mc_avec[32*2]; /* vector register file */ @@ -56,6 +57,7 @@ typedef struct __mcontext32 { int mc_flags; #define _MC_FP_VALID 0x01 #define _MC_AV_VALID 0x02 +#define _MC_VS_VALID 0x04 int mc_onstack; /* saved onstack flag */ int mc_len; /* sizeof(__mcontext) */ uint64_t mc_avec[32*2]; /* vector register file */ diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c index bdd1da9c9cbd..073266f87c46 100644 --- a/sys/powerpc/powerpc/exec_machdep.c +++ b/sys/powerpc/powerpc/exec_machdep.c @@ -349,13 +349,6 @@ sys_sigreturn(struct thread *td, struct sigreturn_args *uap) if (error != 0) return (error); - /* - * Save FPU state if needed. User may have changed it on - * signal handler - */ - if (uc.uc_mcontext.mc_srr1 & PSL_FP) - save_fpu(td); - kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x", @@ -432,6 +425,7 @@ grab_mcontext(struct thread *td, mcontext_t *mcp, int flags) } if (pcb->pcb_flags & PCB_VSX) { + mcp->mc_flags |= _MC_VS_VALID; for (i = 0; i < 32; i++) memcpy(&mcp->mc_vsxfpreg[i], &pcb->pcb_fpu.fpr[i].vsr[2], sizeof(double)); @@ -481,6 +475,7 @@ set_mcontext(struct thread *td, mcontext_t *mcp) struct pcb *pcb; struct trapframe *tf; register_t tls; + register_t msr; int i; pcb = td->td_pcb; @@ -531,6 +526,22 @@ set_mcontext(struct thread *td, mcontext_t *mcp) tf->srr1 &= ~(PSL_FP | PSL_VSX | PSL_VEC); pcb->pcb_flags &= ~(PCB_FPU | PCB_VSX | PCB_VEC); + /* + * Ensure the FPU is also disabled in hardware. + * + * Without this, it's possible for the register reload to fail if we + * don't switch to a FPU disabled context before resuming the original + * thread. Specifically, if the FPU/VSX unavailable exception is never + * hit, then whatever data is still in the FP/VSX registers when + * sigresume is callled will used by the resumed thread, instead of the + * previously saved data from the mcontext. + */ + critical_enter(); + msr = mfmsr() & ~(PSL_FP | PSL_VSX | PSL_VEC); + isync(); + mtmsr(msr); + critical_exit(); + if (mcp->mc_flags & _MC_FP_VALID) { /* enable_fpu() will happen lazily on a fault */ pcb->pcb_flags |= PCB_FPREGS; @@ -539,8 +550,12 @@ set_mcontext(struct thread *td, mcontext_t *mcp) for (i = 0; i < 32; i++) { memcpy(&pcb->pcb_fpu.fpr[i].fpr, &mcp->mc_fpreg[i], sizeof(double)); - memcpy(&pcb->pcb_fpu.fpr[i].vsr[2], - &mcp->mc_vsxfpreg[i], sizeof(double)); + } + if (mcp->mc_flags & _MC_VS_VALID) { + for (i = 0; i < 32; i++) { + memcpy(&pcb->pcb_fpu.fpr[i].vsr[2], + &mcp->mc_vsxfpreg[i], sizeof(double)); + } } } diff --git a/sys/powerpc/powerpc/fpu.c b/sys/powerpc/powerpc/fpu.c index 8f5df2f7d576..a66dcf2ae3be 100644 --- a/sys/powerpc/powerpc/fpu.c +++ b/sys/powerpc/powerpc/fpu.c @@ -65,8 +65,19 @@ save_fpu_int(struct thread *td) * Save the floating-point registers and FPSCR to the PCB */ if (pcb->pcb_flags & PCB_VSX) { - #define SFP(n) __asm ("stxvw4x " #n ", 0,%0" \ +#if _BYTE_ORDER == _BIG_ENDIAN + #define SFP(n) __asm("stxvw4x " #n ", 0,%0" \ :: "b"(&pcb->pcb_fpu.fpr[n])); +#else + /* + * stxvw2x will swap words within the FP double word on LE systems, + * leading to corruption if VSX is used to store state and FP is + * subsequently used to restore state. + * Use stxvd2x instead. + */ + #define SFP(n) __asm("stxvd2x " #n ", 0,%0" \ + :: "b"(&pcb->pcb_fpu.fpr[n])); +#endif SFP(0); SFP(1); SFP(2); SFP(3); SFP(4); SFP(5); SFP(6); SFP(7); SFP(8); SFP(9); SFP(10); SFP(11); @@ -77,7 +88,7 @@ save_fpu_int(struct thread *td) SFP(28); SFP(29); SFP(30); SFP(31); #undef SFP } else { - #define SFP(n) __asm ("stfd " #n ", 0(%0)" \ + #define SFP(n) __asm("stfd " #n ", 0(%0)" \ :: "b"(&pcb->pcb_fpu.fpr[n].fpr)); SFP(0); SFP(1); SFP(2); SFP(3); SFP(4); SFP(5); SFP(6); SFP(7); @@ -150,8 +161,19 @@ enable_fpu(struct thread *td) :: "b"(&pcb->pcb_fpu.fpscr)); if (pcb->pcb_flags & PCB_VSX) { - #define LFP(n) __asm ("lxvw4x " #n ", 0,%0" \ +#if _BYTE_ORDER == _BIG_ENDIAN + #define LFP(n) __asm("lxvw4x " #n ", 0,%0" \ + :: "b"(&pcb->pcb_fpu.fpr[n])); +#else + /* + * lxvw4x will swap words within the FP double word on LE systems, + * leading to corruption if FP is used to store state and VSX is + * subsequently used to restore state. + * Use lxvd2x instead. + */ + #define LFP(n) __asm("lxvd2x " #n ", 0,%0" \ :: "b"(&pcb->pcb_fpu.fpr[n])); +#endif LFP(0); LFP(1); LFP(2); LFP(3); LFP(4); LFP(5); LFP(6); LFP(7); LFP(8); LFP(9); LFP(10); LFP(11); @@ -162,7 +184,7 @@ enable_fpu(struct thread *td) LFP(28); LFP(29); LFP(30); LFP(31); #undef LFP } else { - #define LFP(n) __asm ("lfd " #n ", 0(%0)" \ + #define LFP(n) __asm("lfd " #n ", 0(%0)" \ :: "b"(&pcb->pcb_fpu.fpr[n].fpr)); LFP(0); LFP(1); LFP(2); LFP(3); LFP(4); LFP(5); LFP(6); LFP(7); From nobody Mon Jul 21 03:04:17 2025 X-Original-To: dev-commits-src-branches@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 4bllc2467nz621b9; Mon, 21 Jul 2025 03:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bllc16Ydsz3FrP; Mon, 21 Jul 2025 03:04:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753067057; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7erx+m9NdKsTpXpDie6lNf1r1nVLOS8JCK6BccGNd7M=; b=QJ/Gj94GkNT6dp8hfZHDls8gKQzaAs3mXpyMAYb6ZAMKbYGHMvk6P/3JguNGCp+lbY93Hl o2syzGIlOtYLM1X4BZUbRGeAmdQOB45z43USdgH/mAhI5b77cEET7b6vzheidFIRATQr3N s3R88NsK6ms3r4ASxe9EpmnDkVHFcetY2hnvwK6EW1vsWAQOCcYSsvK5k/5wuPIe64t0sq JEoOOCYIdky9DMCjFsTjYsc/7VI7Af3ORgwm4PGfE/NGdxG/0xwr6C0vaJB7obo33iRC1h r8+dpEqXpRfj27jR9TeCM6A79vNkVpR6B7rsy0/zuUCVZhPW+vxA9iA9q3CPSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753067057; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7erx+m9NdKsTpXpDie6lNf1r1nVLOS8JCK6BccGNd7M=; b=OWeMpD8ZYDVNxVP9vcGbwBSAfjDQZhKr7y6x/dNyA5J0uU2BBdsHaA0NDqo1GjvZeQclOT QGDgl+P9iQSAtXlhoX0wOx7ZBGseK6sK5fmzvdhmIRHjyQ8GJebY5NvScD7IvgjO9Wmdhf XVgW1xWsqwJK9RKEemtiWxNQAO9lmIoJZ+gj0SZMjngA0mbkH8dcWfk3reZfMHtWWDMR/B cUZmatuj5LVKfQeB+Mm+KS8dsQiIr+i3QqYSjWVpDi9suojhYRKNC1AQtKcJVeyoV+Ui9N R5aNDFwRD4ZDD4LBGPbI8o1Yo0f/nQVxwN7NbuNFdwnyxpp6baPCiPdvEx+9eQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753067057; a=rsa-sha256; cv=none; b=V+ftSss8FrjsdTl6KTYWzWUrzz3Thy3s93xz7P9c4OVFXnHXYOH1RU5DBp/zi3QccdFw4j h/0Z53u/CRudkfpb3jsOoPC3oXhDWmjpHXR4sS16LimNBuF0+o6oXZskokpjcR/eW4ZHv2 Bd+KGlievcE4bcHL+FEQ7sseL2AcbRIBWfVf2m9bOOuj0EIrKAGVXSE9yTbgTVToUBJ8fd aAaJAl3NzHCfH2iq53bLEaO/wAZ2A4wJW7KYqHboWji9u0FL39ZX1yjQmtt6GctGnlnORx b0ld5aYTVSffncbY1Lf9KY6jnGX019m67SwP1ZOc2O2/xOpkvXXyPEHTAkt4kg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bllc15xtbzgk1; Mon, 21 Jul 2025 03:04:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56L34Hs2009803; Mon, 21 Jul 2025 03:04:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56L34HgV009800; Mon, 21 Jul 2025 03:04:17 GMT (envelope-from git) Date: Mon, 21 Jul 2025 03:04:17 GMT Message-Id: <202507210304.56L34HgV009800@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Justin Hibbits Subject: git: 6e211ff4902a - stable/14 - libc/powerpc64: Fix swapcontext(3) List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 6e211ff4902a4cab3552b7bc21b9688a7f0e6dbd Auto-Submitted: auto-generated The branch stable/14 has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=6e211ff4902a4cab3552b7bc21b9688a7f0e6dbd commit 6e211ff4902a4cab3552b7bc21b9688a7f0e6dbd Author: Timothy Pearson AuthorDate: 2025-07-08 13:41:15 +0000 Commit: Justin Hibbits CommitDate: 2025-07-21 02:56:59 +0000 libc/powerpc64: Fix swapcontext(3) On PowerPC platforms a valid link to the Table of Contents (TOC) is required for PLT lookups to function. This TOC pointer is stored in a dedicated register, and is used along with the stack pointer by both C prologue and PLT lookup code. When calling swapcontext() with uc_link != NULL, a PLT lookup to setcontext(3) is attempted from within the _ctx_done context. The exiting process has usually trashed both r1 and r2 at this point, leading to a crash within the PLT lookup before setcontext(2) is reached to restore the linked context. Save and restore r2 as in a regular function. This ensures the subsequent PLT lookup to setcontext(3) succeeds. Signed-off-by: Timothy Pearson MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1759 (cherry picked from commit 8efa35fea384d209c683dfbae8f49f2737a41941) --- lib/libc/powerpc64/gen/_ctx_start.S | 14 ++++++++ lib/libc/powerpc64/gen/makecontext.c | 3 +- lib/libc/tests/sys/Makefile | 4 +-- lib/libc/tests/sys/swapcontext_test.c | 63 +++++++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 3 deletions(-) diff --git a/lib/libc/powerpc64/gen/_ctx_start.S b/lib/libc/powerpc64/gen/_ctx_start.S index c2f8abfd6486..98225f9c1138 100644 --- a/lib/libc/powerpc64/gen/_ctx_start.S +++ b/lib/libc/powerpc64/gen/_ctx_start.S @@ -34,6 +34,16 @@ ld %r2,8(%r14) ld %r14,0(%r14) #else + /* + * The stack frame was already set up in makecontext(), + * so we can safely use the guaranteed fields here. + * + * Note we do step on the allocated stack frame's TOC, + * but since we never return from this function (i.e. + * never restore the stack frame) this should be safe. + */ + std %r2,24(%r1) /* save TOC */ + /* Load global entry point */ mr %r12,%r14 #endif @@ -41,6 +51,10 @@ blrl /* branch to start function */ mr %r3,%r15 /* pass pointer to ucontext as argument */ nop +#if defined(_CALL_ELF) && _CALL_ELF != 1 + /* Restore TOC */ + ld %r2,24(%r1) +#endif bl CNAME(_ctx_done) /* branch to ctxt completion func */ /* * we should never return from the diff --git a/lib/libc/powerpc64/gen/makecontext.c b/lib/libc/powerpc64/gen/makecontext.c index 75c2d40bdd60..9e3a976fa1bd 100644 --- a/lib/libc/powerpc64/gen/makecontext.c +++ b/lib/libc/powerpc64/gen/makecontext.c @@ -78,7 +78,7 @@ __makecontext(ucontext_t *ucp, void (*start)(void), int argc, ...) */ stackargs = (argc > 8) ? argc - 8 : 0; sp = (char *) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size - - sizeof(uintptr_t)*(stackargs + 2); + - sizeof(uintptr_t)*(stackargs + 6); sp = (char *)((uintptr_t)sp & ~0x1f); mc = &ucp->uc_mcontext; @@ -119,6 +119,7 @@ __makecontext(ucontext_t *ucp, void (*start)(void), int argc, ...) mc->mc_srr0 = *(uintptr_t *)_ctx_start; #else mc->mc_srr0 = (uintptr_t) _ctx_start; + mc->mc_gpr[12] = (uintptr_t) _ctx_start;/* required for prologue */ #endif mc->mc_gpr[1] = (uintptr_t) sp; /* new stack pointer */ mc->mc_gpr[14] = (uintptr_t) start; /* r14 <- start */ diff --git a/lib/libc/tests/sys/Makefile b/lib/libc/tests/sys/Makefile index 380b3b511049..e93535288532 100644 --- a/lib/libc/tests/sys/Makefile +++ b/lib/libc/tests/sys/Makefile @@ -8,11 +8,11 @@ ATF_TESTS_C+= brk_test .endif ATF_TESTS_C+= cpuset_test ATF_TESTS_C+= errno_test +ATF_TESTS_C+= swapcontext_test ATF_TESTS_C+= queue_test ATF_TESTS_C+= sendfile_test -# TODO: clone, lwp_create, lwp_ctl, posix_fadvise, recvmmsg, -# swapcontext +# TODO: clone, lwp_create, lwp_ctl, posix_fadvise, recvmmsg NETBSD_ATF_TESTS_C+= access_test NETBSD_ATF_TESTS_C+= bind_test NETBSD_ATF_TESTS_C+= chroot_test diff --git a/lib/libc/tests/sys/swapcontext_test.c b/lib/libc/tests/sys/swapcontext_test.c new file mode 100644 index 000000000000..f341a746e515 --- /dev/null +++ b/lib/libc/tests/sys/swapcontext_test.c @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2025 Raptor Computing Systems, LLC + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include +#include +#include + +#include + +#define STACK_SIZE (64ull << 10) + +static volatile int callback_reached = 0; + +static ucontext_t uctx_save, uctx_switch; + +static void swapcontext_callback() +{ + // Increment callback reached variable + // If this is called multiple times, we will fail the test + // If this is not called at all, we will fail the test + callback_reached++; +} + +ATF_TC(swapcontext_basic); +ATF_TC_HEAD(swapcontext_basic, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify basic functionality of swapcontext"); +} + +ATF_TC_BODY(swapcontext_basic, tc) +{ + char *stack; + int res; + + stack = malloc(STACK_SIZE); + ATF_REQUIRE_MSG(stack != NULL, "malloc failed: %s", strerror(errno)); + res = getcontext(&uctx_switch); + ATF_REQUIRE_MSG(res == 0, "getcontext failed: %s", strerror(errno)); + + uctx_switch.uc_stack.ss_sp = stack; + uctx_switch.uc_stack.ss_size = STACK_SIZE; + uctx_switch.uc_link = &uctx_save; + makecontext(&uctx_switch, swapcontext_callback, 0); + + res = swapcontext(&uctx_save, &uctx_switch); + + ATF_REQUIRE_MSG(res == 0, "swapcontext failed: %s", strerror(errno)); + ATF_REQUIRE_MSG(callback_reached == 1, + "callback failed, reached %d times", callback_reached); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, swapcontext_basic); + + return (atf_no_error()); +} + From nobody Tue Jul 22 04:05:50 2025 X-Original-To: dev-commits-src-branches@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 4bmNwb3496z62P2p; Tue, 22 Jul 2025 04:05:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bmNwZ4kJrz3jWg; Tue, 22 Jul 2025 04:05:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753157150; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0oPyIoEEzFGseD9QlRGDw46Eus+iAKD//Q0Fl8H2/sY=; b=ZWE8VET9maiZEw9qdHal5qVFzEd+GGPdg/dCRuYTdVEfYEPF9HI0C2xTVeq1G6RuCyO4gG sOaWB3ki0J9mtZPw0O13RIqVwgRW6HQLSkaQNRiCK7r9rkiVtq6x/TGZNx45yRkGHDGOFx Dy9NycuA2jIePmwki13MOVcGAbccWlZK4iI+EPoCAbhWvvSx5xczv4hiyYok8AefjtV2Ok ddeZEWMt8tZmFrd0Xc1up4JrjZgjdGjPq/WxGtxKUROuj0G+dK2vU73aUYDFzsEAFfUZSP 7ZwUcCkcAdK2Hh+bKRo7JWDw7OBxFVvxvVDdVLg9zaBOjF/sC0OvRG2bNpXLbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753157150; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0oPyIoEEzFGseD9QlRGDw46Eus+iAKD//Q0Fl8H2/sY=; b=VqH34ZxWEB7jo6aRvtwc5GZy9YqeFa5bxj9/yZASvRI6wP0Ll8UT/ImtwlC7UV6rwEjwGg 6tNvAIbxplez6XqWtK53779F06JpnbTf+Ygn3YfabSzWTbl9IiFr7FQFOpq0R8/mS5Lf/0 dUD4YCFcO/8/WZkwfGRh3oq+gQKdWpVzNvXalnnT5GjMAu0kodUcTsyn7d7WED/Lcp4CZY 5L4SnPs9y0bQn03gAMalFJZifHLsnWHACjkYI04GIJxOtOwNVlmnFueXZpV3GTCBV908sA +Fojjj/mvjawHdDFif53bUZn5C29DLO03iogo8K8kZBOLxvoyRKQaztIaI5PuQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753157150; a=rsa-sha256; cv=none; b=oyoxpye3jHf2/CxTj3JuhBVRUK4DfDbgieTg17+7rFH/Zztq7BsDobtD+jMXYB4gtuq/BH wDaIkVuzpr4u3+WcDQsU9Pjvj35kL0khSSIOTfcT3HBPnqkgZSBTMDuYJYpGYFJE/RzuNW 5wUW5o93gCezToYp3dIyETsSs8EmXLgL8H56pn40p9sFHjmCm7Rlf9pBv7on9DGjf7JSLN K5sH/hSyjQyhMfOOHpwuWzPtSwtO+9DpxLY8F3P3lK3pCN+0DduN3A3P6Focxb0T+if42o tIKS4x/VZdRkMMJeZF2BrTLLGevbfKLubLpsdxPBYiIPu/BHIyX6x5ri54ednQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bmNwZ1hFPz1Q8B; Tue, 22 Jul 2025 04:05:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56M45oYn041306; Tue, 22 Jul 2025 04:05:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56M45oL2041303; Tue, 22 Jul 2025 04:05:50 GMT (envelope-from git) Date: Tue, 22 Jul 2025 04:05:50 GMT Message-Id: <202507220405.56M45oL2041303@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: 97d5f16c6966 - stable/14 - if_genet: Consistently use the boolean form List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 97d5f16c6966e2ae261ddabe1f16a9675dedf43a Auto-Submitted: auto-generated The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=97d5f16c6966e2ae261ddabe1f16a9675dedf43a commit 97d5f16c6966e2ae261ddabe1f16a9675dedf43a Author: Zhenlei Huang AuthorDate: 2025-07-19 17:07:54 +0000 Commit: Zhenlei Huang CommitDate: 2025-07-22 04:04:51 +0000 if_genet: Consistently use the boolean form The variable eaddr_found is declared as bool. This change improves readability a little. No functional change intended. MFC after: 3 days (cherry picked from commit 2fc051d090933203e1af6a8452cdd87a4c76ad5b) --- sys/arm64/broadcom/genet/if_genet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/broadcom/genet/if_genet.c b/sys/arm64/broadcom/genet/if_genet.c index 8fb46a7552f1..23fd45857d65 100644 --- a/sys/arm64/broadcom/genet/if_genet.c +++ b/sys/arm64/broadcom/genet/if_genet.c @@ -350,7 +350,7 @@ gen_attach(device_t dev) } /* If address was not found, create one based on the hostid and name. */ - if (eaddr_found == 0) + if (!eaddr_found) ether_gen_addr(sc->ifp, &eaddr); /* Attach ethernet interface */ ether_ifattach(sc->ifp, eaddr.octet); From nobody Tue Jul 22 13:36:21 2025 X-Original-To: dev-commits-src-branches@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 4bmdZt0xBGz5pQ5d; Tue, 22 Jul 2025 13:36:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bmdZt0P0hz3hKd; Tue, 22 Jul 2025 13:36:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753191382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KppG/J/YJXaAmt49Xs/f/pkguUlatA3vI/DIl/JR3CI=; b=vtFL4LI3+3Zey7oJlyHxaSN2Ecn6wzVmnQ3EVPufzdx/vdkXwCGCAi2sp5fwz0CxESRhGz Yaix+Vd7eCNChGQzKMQLBHMRyDK8ZIyR3UL9tGuS6F/Y5uGXqgKl83W0F5DKgEf5FgMaa2 VQWV8tCRJQLlNw0vtby9MECOuQCAd9jmJVmADW/rLx6DmpSGRY2W2A0UagnpVCc62qzO+w MaTTjt59EXTbIgu/RVu6iHJXKNIBLl/P3vsaYYLAtrfrtc+j74O4IPW5V6Y/8eUvAfrHZT fZQFmvlSGDNe5xrbZN0a3Vm9YzD4ndKvhv7T46XyPWwNKqjeCt9kZlvDc6NSjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753191382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KppG/J/YJXaAmt49Xs/f/pkguUlatA3vI/DIl/JR3CI=; b=bnuhiVmrtsycc789TQgOPWhafVO3YS5HmuS2kBVIcqpf6KLF7ah4zH7Eo73oGdk+uYOvPF tCXuQSSs00hPEBTTKEZsyf6yXB4IVVLbu8MIWWPYBxpwiVKgpaSnMw/6Nd0yH0+r1+Q92o W8jGK6fm+Jl/0t27X5ntsUmr6PDDbCdWWqIbDQjax2v6CQ28ltBDZgP2xssrsEovi985Zj 3k/OO/lHwyOS4KODb0WQTplsiFuCnssWVPhuSNNBP6BN8YmfVDIQWVSUa1XKYOUk6RSeLl E2vV9SkWYWKmGWYXD5rF+xLV+RZpGse3FGyXOOV+dnIJ+wJZt60AhFyssIiVBQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753191382; a=rsa-sha256; cv=none; b=rcmAHXnY9cYwaGJEer8f3YxfQLf1YDH0dnvfIdSeUAT44km+ZF8/sui08Aqkj2sXSykJAY Rknz4VIQeLFTPFuVRI82aUQMjfm+wXX8zvTG2AmDQ6xB065sirKu6Q5hJywDWA0EtqaZfz q1DAISLaxXFsRtBYG3gtpXVxtSfT/FuKfvIFX2J2Eqgk1qZbAyJaYL10Yj08ABl0K9w+wA 3m37Im2Y4Le+0FsqLn7TL+J/GMJM8/KqZUPufrJGM+NgDYeM2UubIlAQYdevheYhb7C5yK ZqwBMFpz1V4aoEUTV3/79pUor9x1fY2Xfbng3OO2KBybyiqH0JB0l1PY3yoimg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bmdZs72xFzTWs; Tue, 22 Jul 2025 13:36:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56MDaLna015196; Tue, 22 Jul 2025 13:36:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56MDaLpL015193; Tue, 22 Jul 2025 13:36:21 GMT (envelope-from git) Date: Tue, 22 Jul 2025 13:36:21 GMT Message-Id: <202507221336.56MDaLpL015193@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: a94dd3955a9f - stable/14 - bsdinstall: wlanconfig: properly format regdomain dialog input List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a94dd3955a9f7ae51da152c31a4565c1a040c83c Auto-Submitted: auto-generated The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=a94dd3955a9f7ae51da152c31a4565c1a040c83c commit a94dd3955a9f7ae51da152c31a4565c1a040c83c Author: Bjoern A. Zeeb AuthorDate: 2025-07-14 18:32:53 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-07-22 08:21:46 +0000 bsdinstall: wlanconfig: properly format regdomain dialog input Without the extra '\n' the dual-column ('REGD' '') are not properly separated for dialog which leads to an [misleading] error hidden on the command line: Error: --menu bad arguments items number. [Writing this I wonder why the dual-column input is needed]. It is still unclear as to where the error message quoted in PR287538 suddenly came from for 14.3-RELEASE given the code was broken since 2016 (or noone ever noticed or reported). Looking at manual ifconfig output: ifconfig wlan0 country GB regdomain Expected -> ifconfig: unknown regdomain Expected and "ifconfig: " gets stripped by the script, which means the regdomain variable would have to be set to "Expected" or more likely to "Expected eval: Use: not found" which looks like a concatination of errors. Sponsored by: The FreeBSD Foundation Fixes: 95ee591e83a91 PR: 287538 Reviewed by: emaste, thj Differential Revision: https://reviews.freebsd.org/D51313 (cherry picked from commit 5a1e2927d63ed6394b767088eb2d66676f275467) --- usr.sbin/bsdinstall/scripts/wlanconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bsdinstall/scripts/wlanconfig b/usr.sbin/bsdinstall/scripts/wlanconfig index 728833f8d4a0..6f44ce1b8410 100755 --- a/usr.sbin/bsdinstall/scripts/wlanconfig +++ b/usr.sbin/bsdinstall/scripts/wlanconfig @@ -92,7 +92,7 @@ dialog_country_select() sub(/.*domains:/, ""), /[^[:alnum:][[:space:]]/ { n = split($0, domains) for (i = 1; i <= n; i++) - printf "'\''%s'\'' '\'\''", domains[i] + printf "'\''%s'\'' '\'\''\n", domains[i] } ' | sort ) countries=$( echo "$input" | awk ' From nobody Tue Jul 22 13:36:22 2025 X-Original-To: dev-commits-src-branches@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 4bmdZv2zgFz5pPm9; Tue, 22 Jul 2025 13:36:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bmdZv102lz3hVT; Tue, 22 Jul 2025 13:36:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753191383; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BWPdUiZKZZizQJ0aji6Ila7vdKKztRkAcR5XHp/nDWg=; b=auU0Jq7zs1k39XjzhwJkPKlYnap4E1x2rNbfMxl9nvE135z07B1m4GkQvDjJOQEY1W24if +LiELtavq7FLpe2ANq5sUVuyIXoENJUemhLPl+vflrdvtl6FAWXdAfqRsVf9kaebDq0E3l si5nV/pE28tWhEqQNI6GGntPs32fLP8vizu+6+3M+tAuRpkKY0vcw3VBCTVqKTArBkPqV5 T2ZwgxbmXM/8h97ZI88BLEwGPVB/38xsg8QHf9wrA2jpIp0ICYZWppdudvhZI2mtQiXEZA wbuwL0cWL3n7qXDz85gHg9QlpcVpJEdSoNE2pOkOmROoSzIaSaGFhBq9vHmy+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753191383; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BWPdUiZKZZizQJ0aji6Ila7vdKKztRkAcR5XHp/nDWg=; b=rcIZMiFOl4CF28DqI0vAaWmwUqfQo3OVHJdaOA6PXEMUP+utaNqye4Fthp2yr+RY5hT9xf xy7qPoRm0dgujtMWmqHKTau3cRbWMKSNR5WE6aJfRjkFMdVa/+8GC0XVzXexbAlwbCWBLT 72OgmXeOgd8c2Bo36jDx5czymtlF9rdkeYLP1Z9nWO7naAjnk80WJ5J8EAldlr1rbaCg4k WPcM3+oxN9ueJXp5dbJz4ZXlY4UPwb+/0JCPszP0OBTimbJn7F62PJJZmC1dH6XX/w11yb sn/v7Igsp/EZmnhqkkWIM0yHCihLenuOYG/5bGhGnMgI6HrlGIytytxtsvwFoA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753191383; a=rsa-sha256; cv=none; b=rU6PbwVniiQxVkobu5onTIZXD6+lWQakfFv4TiQvtPhXJibHLLiQEaRXwg05OkPr6SN5bh Ui1n58MC7GPNlNPeRFnr23gvpyddto6V4U42LBM3pel7Su7vnQxH8CG6x54R10KttXixKK B6ziODuMM7RKXG8NbUiC9Hx9a7SJgexJCohiVOw8Pa8z1F+lD4s94CXpLxMLINtzgO7CKS auhOWxq8qAtoI6HzhuUkutl2x6WkDyxR0VwkBXKXRfZqgVlipJgwxaRoGB45nuA8YSpbMz 6CUKU/8y0CaqZDG+URWCSlYZ7w1js7DTiohK06NgPbwV0nS3KO9Eo3O1JF5dnQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bmdZv0bDMzDVL; Tue, 22 Jul 2025 13:36:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56MDaMrJ015232; Tue, 22 Jul 2025 13:36:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56MDaMDP015229; Tue, 22 Jul 2025 13:36:22 GMT (envelope-from git) Date: Tue, 22 Jul 2025 13:36:22 GMT Message-Id: <202507221336.56MDaMDP015229@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 9fa537692fa1 - stable/14 - bsdinstall: wlanconfig: ensure the interface is always up for scanning List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 9fa537692fa1b3bcb5ce436b8b755e2b6cff5dcb Auto-Submitted: auto-generated The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=9fa537692fa1b3bcb5ce436b8b755e2b6cff5dcb commit 9fa537692fa1b3bcb5ce436b8b755e2b6cff5dcb Author: Bjoern A. Zeeb AuthorDate: 2025-07-14 18:32:06 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-07-22 08:21:53 +0000 bsdinstall: wlanconfig: ensure the interface is always up for scanning Sponsored by: The FreeBSD Foundation Reviewed by: thj (earlier), emaste Differential Revision: https://reviews.freebsd.org/D51312 (cherry picked from commit 153e73d782f3f1b06c502a708a3b30236ab332bd) --- usr.sbin/bsdinstall/scripts/wlanconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/usr.sbin/bsdinstall/scripts/wlanconfig b/usr.sbin/bsdinstall/scripts/wlanconfig index 6f44ce1b8410..b5c488b22b2f 100755 --- a/usr.sbin/bsdinstall/scripts/wlanconfig +++ b/usr.sbin/bsdinstall/scripts/wlanconfig @@ -200,6 +200,12 @@ fi while :; do SCANSSID=0 + # While wpa_supplicant may IFF_UP the interface, we do not want to rely + # in this. In case the script is run manually (outside the installer, + # e.g., for testing) wpa_supplicant may be running and the wlanN + # interface may be down (especially if dialog_country_select is not + # run successfully either) and scanning will not work. + f_eval_catch -d wlanconfig ifconfig "ifconfig $WLAN_IFACE up" f_eval_catch -d wlanconfig wpa_cli "wpa_cli scan" f_dialog_title "Scanning" f_dialog_pause "Waiting 5 seconds to scan for wireless networks..." 5 || From nobody Tue Jul 22 14:03:28 2025 X-Original-To: dev-commits-src-branches@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 4bmfB94d2rz5pRYt; Tue, 22 Jul 2025 14:03:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bmfB916YTz41pB; Tue, 22 Jul 2025 14:03:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753193009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8RL3guuFSlsLxncLsmONyl4xu9dZjngNVNTmRL3OzMw=; b=A4urhM7pO6e2uit7IFbAaGTt6sDRFo9S/vy8Qjf/LnzhgtQzJu9hcajk1QW9R772E+D4Ra Bm1IZ9GoFD5PWiN593AwdswL8dh3HoB3JpmjqnASDW0lKx5GLj619gapPsthZRDczHmJig 6cLB1O4tqC76og406qUwOl8wD/ObRnERNgbvlqew75vW2a+vRDf0bvWmrE1L9jplVwm15b 6XIjzkjZo4m08KKVJ8butkGZ6HB/xzARItkQA6JKP6vav96JtPuDcHqL8EU/cWuMk6RDUH UvG1ARHeKIjBtzLGlZKlG5D87DR5A8YnQGbw+b/IHVnG7J70BR+Ca1vNfBQZQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753193009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8RL3guuFSlsLxncLsmONyl4xu9dZjngNVNTmRL3OzMw=; b=Ur3I7gXhoIZU67L1nhJ/o2RvNX+56dozo7f+L7ABCURQOq3MIAQN4YwmxlYR0QzKD8MFJq KsKbznkdfz25JaF5NudsONgQAYi7pnzK/uDtgxUUYaDm0vFWxtmj7ZhB7NmGPXVd3utYLE dty+FG1EXA4BPucn9+RhQSi7nsRWKHA9+YMKlSZeya2w1P2fIfSkSjzTmE0jAq4QfhAny3 XVIx6iopNP+UEK11zp5jSLkpYmUpp8caN+0eDFcHrhtDv46Wd0f//ISvrCABhZTfum4sYO UhjNmfU5D+A1/TzJcWMTBdk+JrB0/GXAPgeB3XhkHYcQEP0eRJc9Hq00oBxLCg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753193009; a=rsa-sha256; cv=none; b=L/WGxcUzvO7hJYwR3WPrvyEGZo0/YgiC8FPiE9vyT/Kkdby78EUAUHiXxuTLynYjknr08b GJ+oCuCArcKieZ+LRRY3T7v1oU8zVbU077J5frRmVE/Z+bbJrzMZLhKLw4moavA7P4NdBg Rz9q5xkw1EG0qwVSL2g6nm3T/DCBv/LxGS7DPvbVSgBGpiQwgdHGVQGYzlubMW1MAYIKz0 ndu7tmjjwRZTlLxLLPXO3s+H4dA4h2G6Y9BSSoxIwsuktKmDWbXvxY6a98EIPtom6M8WxP mtTRmSbketNL5AzEbfxPB/5n8rTsGgHhFLCaIViagUBM5sq9UmmPwpt6U0IUVg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bmfB90TZlzVbM; Tue, 22 Jul 2025 14:03:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56ME3SN9071384; Tue, 22 Jul 2025 14:03:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56ME3SkU071380; Tue, 22 Jul 2025 14:03:28 GMT (envelope-from git) Date: Tue, 22 Jul 2025 14:03:28 GMT Message-Id: <202507221403.56ME3SkU071380@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: c477deccbfc2 - stable/14 - mgb: Fix mac tx disable bug in teardown List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: c477deccbfc2dfb91e1bca12950bb8d7567d9a8a Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c477deccbfc2dfb91e1bca12950bb8d7567d9a8a commit c477deccbfc2dfb91e1bca12950bb8d7567d9a8a Author: jefby AuthorDate: 2025-07-05 02:52:08 +0000 Commit: Ed Maste CommitDate: 2025-07-22 14:03:09 +0000 mgb: Fix mac tx disable bug in teardown Signed-off-by: jefby Reviewed-by: emaste Pull-request: https://github.com/freebsd/freebsd-src/pull/1755 (cherry picked from commit 5f9a73c22fea8973e047477853529feaedea6fe6) --- sys/dev/mgb/if_mgb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mgb/if_mgb.c b/sys/dev/mgb/if_mgb.c index 05c4c242f739..78abc5376b04 100644 --- a/sys/dev/mgb/if_mgb.c +++ b/sys/dev/mgb/if_mgb.c @@ -1436,7 +1436,7 @@ mgb_hw_teardown(struct mgb_softc *sc) /* Stop MAC */ CSR_CLEAR_REG(sc, MGB_MAC_RX, MGB_MAC_ENBL); - CSR_WRITE_REG(sc, MGB_MAC_TX, MGB_MAC_ENBL); + CSR_CLEAR_REG(sc, MGB_MAC_TX, MGB_MAC_ENBL); if ((err = mgb_wait_for_bits(sc, MGB_MAC_RX, MGB_MAC_DSBL, 0))) return (err); if ((err = mgb_wait_for_bits(sc, MGB_MAC_TX, MGB_MAC_DSBL, 0))) From nobody Tue Jul 22 16:02:56 2025 X-Original-To: dev-commits-src-branches@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 4bmhr126dnz5pZdl; Tue, 22 Jul 2025 16:02:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bmhr11605z3Pc5; Tue, 22 Jul 2025 16:02:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753200177; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=f6+NGpTIBFPiqptFGKtRKT9inEEiHZl6GE6gQi+grs8=; b=TY4j2rtlN13BFPNDe9XohObX2Av9SeZyqehP8f54boxLkSjuwm/X5c24apfCT1E9nzF2SA cLNGVAa5gNeEi32qYDNLmW+9xuOhJj94f3HCodzOFvNqjbtXiHLr37Z7Van9tLwTh4MuRl uYdUmiRU17+vqF5hFCX3cJ6swkO94RaMUXGD/cY2m9nbTX+ZpBxc5mVI3CmTo/zFG5aHGk GDmbdeGGOU+IEa1soPDMUyyF5u+r3/7JLmQ1JSSlGohVBuwq7PB9LX9tVuHh5D6nS8wehf ZTf2z8n1A8n5JkBlaf1BRlKUbwF83bb6SZeXuqkIqAfx7mzj8dmYKYudW0KlAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753200177; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=f6+NGpTIBFPiqptFGKtRKT9inEEiHZl6GE6gQi+grs8=; b=YcDHXcFtBIzr+PhVnr9Mpp6x7latkPdT4JLLpm0d92tNQMWHvF4NreN0DdDR2ah1BxS1r4 FWJVZva+Y6a4KGlpGoVLRtgdkulPkVlohwx2lecBN/4uQhCmVuLSvePykpszE+TVqoG2/e BLXcfTIZb3VhJTRWUyDMnDq42N6k1KNuDSgwqLe7bo1kT/4ezLLKZbqD7w6VhJLbiaVelV W53W5TGO/7drmHyHziZBBj3ZnCskFhcZ+aZ0h1tgZ5vsOIrcmG2zCzgvL0OqY8DS5yEm58 w1LFrZw9pu2tgIDzzIFFL88IAQ5/5iibEH1wBZEoB2P0TehvDSxrjFaXal0HYA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753200177; a=rsa-sha256; cv=none; b=rgpt7OnWDSPqSAQgq9UV3jyUpP9lPidQG5U1Had6C9vuc97RLr/k2niG6jSqSknOZfc3q3 g46xUM1WIfjE3979LAsOMiv2YXCb7E9kHfAv95NkvyXbju9tAoCH78PbS1056/TF9jS2FX +zzRr0DQ8QDVXc+1yrT4vAP8rZ6WDbHfTYOP4vWmAz4P2B35CxkKQos4WaZu+L0KvUsMkM VxoikCdlKkGf40Xz9eZsn2JoroTXDuN6gsevFbdj3CV/2FLEnfS38HrxJhymiFdcSpjENr DOb6jC3JsYdNxPJiyN340Sm/ZrEgKlkZUgiqJ4rOv+HLFl7AnCBDCuyZO25INg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bmhr10jcLzbMK; Tue, 22 Jul 2025 16:02:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56MG2ust097327; Tue, 22 Jul 2025 16:02:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56MG2uZl097324; Tue, 22 Jul 2025 16:02:56 GMT (envelope-from git) Date: Tue, 22 Jul 2025 16:02:56 GMT Message-Id: <202507221602.56MG2uZl097324@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 786f7133b513 - stable/14 - sys: Correct osreldate descriptions List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 786f7133b513a856fd8d468c2cf8dd8ffedde59b Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=786f7133b513a856fd8d468c2cf8dd8ffedde59b commit 786f7133b513a856fd8d468c2cf8dd8ffedde59b Author: Ed Maste AuthorDate: 2025-06-19 14:20:03 +0000 Commit: Ed Maste CommitDate: 2025-07-22 15:59:55 +0000 sys: Correct osreldate descriptions The kern.osreldate sysctl reports the kernel version, not a release date. Also correct a comment about /usr/include/osreldate.h. Reviewed by: kp, olce Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50938 (cherry picked from commit 5110a74afe5680882e3274d57da881511ea7c440) --- sys/kern/kern_mib.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c index f69275fc3d1d..c239e5ca89b5 100644 --- a/sys/kern/kern_mib.c +++ b/sys/kern/kern_mib.c @@ -570,12 +570,11 @@ sysctl_osreldate(SYSCTL_HANDLER_ARGS) } /* - * NOTICE: The *userland* release date is available in - * /usr/include/osreldate.h + * NOTICE: The *userland* version is available in /usr/include/osreldate.h */ SYSCTL_PROC(_kern, KERN_OSRELDATE, osreldate, CTLTYPE_INT | CTLFLAG_CAPRD | CTLFLAG_RD | CTLFLAG_MPSAFE, - NULL, 0, sysctl_osreldate, "I", "Kernel release date"); + NULL, 0, sysctl_osreldate, "I", "Kernel version"); /* * The build-id is copied from the ELF section .note.gnu.build-id. The linker From nobody Tue Jul 22 16:02:58 2025 X-Original-To: dev-commits-src-branches@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 4bmhr25Ffcz5pZdm; Tue, 22 Jul 2025 16:02:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bmhr22H07z3PYq; Tue, 22 Jul 2025 16:02:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753200178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Qf3HWOTd5GASHKC68fL2EAyqW/ga0LDM9DjQ2E2VYzg=; b=dt1TXAOcECCmBx2rdd+nbT6nGVeDgdd+gWVPXlwrpVzECFWtySH6ZXMRySYKNhfFWLYB6N DW+CKcjGtQa1lm01jaNCaG0vYHJgrPiVCV5f+U6qH5SmdC1L/eR2nBwq36YVSLGKRUwwjd NJEjRiwjfLFQLtYcvyksGseWsOeiqS7GHXIcNZzsFBwuQTbKbMMoc6x1JWQSqV7wXzZYgz yR3THamxUJp/nDDQBE8frZ870cSnUyo17CQvppfHQjOS7SoQYVGAvnlVwmZyT+EjfVTd+E QsMuHwJyPqBQZdDY4GBkngWzQYBdooFcFwPd9736Q1BRUNl28p1ZtjcK8uHR5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753200178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Qf3HWOTd5GASHKC68fL2EAyqW/ga0LDM9DjQ2E2VYzg=; b=yI2HRClvjT90vXN5/gf3n+jsJqHhwXUEkCcGPhIiFixVH/Pnr2GsNJz5Om4e3iJ5VSOGzk 96zpYD7r9EJDbu00kxHs2fiVeMR15Fu1Pk3lXkw2u605/wDRwjBQ2tUgBKEVfyyZtKXhbg qOHtxmf5TNlskuVyo6UITwLOveOCrsB2iNPCp9K4ZFYq0/oL4FqMXfY3qoOrKEIwNYmc/q KdSi5Q4emV8R58fOgn6oxst9kyFHCli1iLGggX/1fRtnFSheeZ9/T7dy5qbdCFmqp/Tt6+ EplkE22CFIrAoap5TPQ2K9gpX/c4vO8US6/8HS21YQMkZ6m94iOgfbPJB74+nQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753200178; a=rsa-sha256; cv=none; b=PkxT1LjZpJdPLpazTyEtNWhsMY+54re6pRA8nZdTsiVg7Q8SNFg1H4I/O3qfJ6zaGHpETQ TKaaEWxF823lyrT8P32ARqkjKHyhYFE2I/HH+AgtHJ3xZDEV5UHv0X5f1y3ni9m4pXHptd ZZ2w9KnSpsfchmKaa0eHwktmYz5CTYMDMpH8nmCDJcSosQs6SxsEcLGi4fCiPmKq5ycxTm aDisNpaPpysdH+H/X5cC5J44A2DdUm62Fi5icClxp/uy7G8hFjNcIj6eDiHpSSUmGcSoCF ocWQKsH4unmEOz89r/pyWS6whx9+31rDeAIMczPkkwWUz7KklFhaKH9QIvzRSA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bmhr21cDgzb3t; Tue, 22 Jul 2025 16:02:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56MG2wDQ097363; Tue, 22 Jul 2025 16:02:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56MG2wB5097360; Tue, 22 Jul 2025 16:02:58 GMT (envelope-from git) Date: Tue, 22 Jul 2025 16:02:58 GMT Message-Id: <202507221602.56MG2wB5097360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: b84dd938c913 - stable/14 - linuxkpi: Remove incorrect + 1 from HWEIGHT* macros List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b84dd938c9130a0416a5c55fc0d012ecafc5b231 Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b84dd938c9130a0416a5c55fc0d012ecafc5b231 commit b84dd938c9130a0416a5c55fc0d012ecafc5b231 Author: Ed Maste AuthorDate: 2025-06-24 13:36:54 +0000 Commit: Ed Maste CommitDate: 2025-07-22 15:59:55 +0000 linuxkpi: Remove incorrect + 1 from HWEIGHT* macros Fixes: 4cc8a9da491d ("LinuxKPI: add HWEIGHT32()") Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51010 (cherry picked from commit cdbff1b2999660b31b2de076d04670722a555ed2) --- sys/compat/linuxkpi/common/include/linux/bitops.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h index 1415d5224084..2af891791130 100644 --- a/sys/compat/linuxkpi/common/include/linux/bitops.h +++ b/sys/compat/linuxkpi/common/include/linux/bitops.h @@ -62,10 +62,10 @@ #define hweight64(x) bitcount64(x) #define hweight_long(x) bitcountl(x) -#define HWEIGHT8(x) (bitcount8((uint8_t)(x)) + 1) -#define HWEIGHT16(x) (bitcount16(x) + 1) -#define HWEIGHT32(x) (bitcount32(x) + 1) -#define HWEIGHT64(x) (bitcount64(x) + 1) +#define HWEIGHT8(x) (bitcount8((uint8_t)(x))) +#define HWEIGHT16(x) (bitcount16(x)) +#define HWEIGHT32(x) (bitcount32(x)) +#define HWEIGHT64(x) (bitcount64(x)) static inline int __ffs(int mask) From nobody Tue Jul 22 20:30:58 2025 X-Original-To: dev-commits-src-branches@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 4bmpnH0hPwz5q7bx; Tue, 22 Jul 2025 20:30:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bmpnG4HZbz3CWb; Tue, 22 Jul 2025 20:30:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753216258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xuDCZmKT+us/cxpjCnaZ3DoBQUVHfkPHxLLJg8dLoCs=; b=TqCEXtg1VZGcKUTyfdJ0TOWgW2RywVR5Kl1k15eVi1J22PJlTl79ZxG3ptuplBKWHmzqtk hlOvb9gspQDpiLDBP0vlbYm4x85O8rAR6KlQq8hmr68E0ln4dTkAJ7vXq6FvUAEC3Fi7DQ Hfs+9Cbf82idJXmdDIuaUGWBj4kzZpBWGjCddN6h9WavU3YhT/wMk5Y8Zz3s92LiEKkqap Zw6xfJT4qC8RfeR8CrENli32KBaPDMXNFPp3x/om1zhGjNwwudLM+xMVch95t2liakCuAA QB+wdwawqYEyjLmDxGMuAD/ROo9xEkCTAmDA3fDFZEV4dIw8T14ZvkM1ekqn6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753216258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xuDCZmKT+us/cxpjCnaZ3DoBQUVHfkPHxLLJg8dLoCs=; b=pQXQLdhhKlVtN+bO2Kag/9Q4VjVMqP/vTXGw7YeRC8YSwf+8fx7kEyzuSCxxHEeo2hYga2 lekHgwfq8aQRN32SR2RkEYN9umgoeNpg9UvyHZ4+3Sll/KaFVhX5vzecRVBjI5+D6ENO9V OMqRFjNP4xfpZeSZEureekqzDix/Ggiqu+z4wXH+JRORx4w27AstQZEm9pET/+Z+65go/6 8hmq9PYukTgbkBj3HojndYsMu6+jC8zdNFXNECahvede0UtImlNzWR8n9usHhxhp2oPqPK 2CcJpt2uX5VvMk+3W/wMkvnd9SvLQA4NCjITijOJbCWHdJLnXZ0PFTkZQ2tlsA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753216258; a=rsa-sha256; cv=none; b=lz7VJtaYsdmhsQMmvhGYv88ObkIAgULwoglHz+D1Kbl+B374/zv3v95xV8o61KzM+AgCV/ L1O9vgxZ6/ECtsZW2cprzKZQpghnGZtiBoRrjmCULQJbpNMLInbdv/SVZsmfkl9/ErolyO eAvofx85DhNT1M17YIRkxmMekt6SxKN/kBL8+yzVBsbTyxFsNAOWtIBYq6p0dKaPwwYESh ILHMxNUVjy0az64C+NYGUsz+YNyWhNmJnNi0P7gdvla8SpWyP3e/6L0NFacRVF1geRs8JG 0YCIZVWxRZUMbdE40x/dc3l4a+bUwl/JUZaAPW88pr5ABZmoRc/AjIVbG/OrpA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bmpnG3hLczjf4; Tue, 22 Jul 2025 20:30:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56MKUwln000222; Tue, 22 Jul 2025 20:30:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56MKUwCj000219; Tue, 22 Jul 2025 20:30:58 GMT (envelope-from git) Date: Tue, 22 Jul 2025 20:30:58 GMT Message-Id: <202507222030.56MKUwCj000219@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: f58fb8abc465 - stable/14 - capsicum.4: Add capsicum_helpers and libcasper references List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f58fb8abc465303ec756b15ef1c8f0e75a33067b Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f58fb8abc465303ec756b15ef1c8f0e75a33067b commit f58fb8abc465303ec756b15ef1c8f0e75a33067b Author: Ed Maste AuthorDate: 2025-06-05 21:22:13 +0000 Commit: Ed Maste CommitDate: 2025-07-22 20:30:30 +0000 capsicum.4: Add capsicum_helpers and libcasper references These were present in the SEE ALSO section but were not explicitly mentioned. Add a brief description of both. Reviewed by: ziaee Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50707 (cherry picked from commit 6d46fd2cbea43002689ae1a8a0e388e9774da1bc) --- share/man/man4/capsicum.4 | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/share/man/man4/capsicum.4 b/share/man/man4/capsicum.4 index 3c3eab5d798b..6aefae9d6df2 100644 --- a/share/man/man4/capsicum.4 +++ b/share/man/man4/capsicum.4 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 3, 2024 +.Dd June 5, 2025 .Dt CAPSICUM 4 .Os .Sh NAME @@ -101,6 +101,20 @@ restrict access to global namespaces: Processes can only act upon their own process ID with syscalls such as .Xr cpuset_setaffinity 2 . .El +.Pp +.Fx +provides some additional functionality to support application sandboxing that +is not part of +.Nm +itself: +.Bl -tag -width indent +.It Xr capsicum_helpers 3 +A set of a inline functions which simplify modifying programs to use +.Nm . +.It Xr libcasper 3 +A library that provides services for sandboxed applications, such as operating +on files specified on a command line or establishing network connections. +.El .Sh SEE ALSO .Xr cap_enter 2 , .Xr cap_fcntls_limit 2 , From nobody Wed Jul 23 03:04:29 2025 X-Original-To: dev-commits-src-branches@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 4bmzWK4QgHz62PRD; Wed, 23 Jul 2025 03:04:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bmzWK1zkZz49Z8; Wed, 23 Jul 2025 03:04:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753239869; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xyVULRUUjk7+8DCFZ1cRMDxr00uhmJJTj+90TB3ceuA=; b=v4mGBlw+my1arA1mJuuLyQOVeYKDZbpH+XzukUGL+L8O08BZmGb87DsoDtAi54Vb1oboM7 WLpBXJ7j1mwbDZjZM7zXn0+lhYVcuwsN/UjKyKHpbfzUHlHRCKmn25Qog4LM8+0ZLBBIv+ ZnXxvdSOJ5wJtsSiScWmuzak/B+0JdW1cKdKR4/RQqeFaK7rwpbkUSYKOQnzOOqouAPNaw SidpLAUEcDKAZf+MdKF8eEE83uSOcq/mU6UCCx3FgRlfzd02vtmTISta0wDW/EpzYCqVKA C6x57+DBY5OcAwXyM6XdgZ0Aswb4V8wkwFPGqC4Xb/CvGDMJEYTy1h6atfiNpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753239869; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xyVULRUUjk7+8DCFZ1cRMDxr00uhmJJTj+90TB3ceuA=; b=NRrbcOU5wuTeV8kGPUmAAAlCaeZ5bHc+gw0tWnfMyhDaQT6acT3MNmj4VRMg9HNgo1HIrA X/Y0xK8IiHdu9HmVFCoD69m6Qn0nUF1w+BY7iPuyL99H5gRlFet/GV9wc6rpmdKysbAiS8 QTJavwTedTvGwXSBdW/ax7Gw5igtACKMhRhNihQ3W1fpTEMIRbpiAf3XnwOJ9vrJ0itYXm RJFRIbNLG4nGagwd3Xvba6sprqEiYJljzXfP8S4+vQe+Ar2KtTXADcbHeXIZNznK4fIKRZ ZRJ2lBq04fg0cQu5DMB9mKoOPiAun4kc3c3snoueqfor4FOlLDNiQtv4qBvEHQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753239869; a=rsa-sha256; cv=none; b=sbc4N6MKUt9tztZrk0swS2SMybaKUDf+MBPSSLdPFc+qdAwBJ9xS9QsJJk4MVEj0F+v37b y/ZzSlTXkCdLvHWFIJI7IEIEyf1380mf3ymo7m8NsxXXyqhC8Cx6DWy5fg+PEDajn14dug /B0WqZWw61x72xs7iP5ppl1LoGPDIcWETDgo97mv6hjRQANVnNibgygTdpE6nHpdFLWxLd S6z88WzosHp9agLIIv279p/P4vJ2Wcc1TukB6YnM+oATu6no1Way0wcIVVDQDki4m3Wu9H U3LngPcdidldzcl4r7CGip9FZh7Az+4I14j5/XhIyjWj3cLt79Cxu+NEpJCwRw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bmzWK1KkVzvXh; Wed, 23 Jul 2025 03:04:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56N34TKL044090; Wed, 23 Jul 2025 03:04:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56N34TrT044087; Wed, 23 Jul 2025 03:04:29 GMT (envelope-from git) Date: Wed, 23 Jul 2025 03:04:29 GMT Message-Id: <202507230304.56N34TrT044087@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: a1df3755a5fa - stable/14 - mlx5en: fix TLS Rx hardware offload initialization List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a1df3755a5fa544d05410bbac0e7b06fcb284df8 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a1df3755a5fa544d05410bbac0e7b06fcb284df8 commit a1df3755a5fa544d05410bbac0e7b06fcb284df8 Author: Ariel Ehrenberg AuthorDate: 2025-07-03 08:57:40 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-23 03:00:21 +0000 mlx5en: fix TLS Rx hardware offload initialization (cherry picked from commit d6d66936c45e99ec284554292181d26b6a5558d3) --- sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls_rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls_rx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls_rx.c index f584e5228657..9598884a611c 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls_rx.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls_rx.c @@ -638,7 +638,8 @@ mlx5e_tls_rx_set_params(void *ctx, struct inpcb *inp, const struct tls_session_p return (EINVAL); MLX5_SET64(sw_tls_rx_cntx, ctx, param.initial_record_number, tls_sn_he); - MLX5_SET(sw_tls_rx_cntx, ctx, param.resync_tcp_sn, tcp_sn_he); + MLX5_SET(sw_tls_rx_cntx, ctx, param.resync_tcp_sn, 0); + MLX5_SET(sw_tls_rx_cntx, ctx, progress.next_record_tcp_sn, tcp_sn_he); return (0); } From nobody Wed Jul 23 22:55:47 2025 X-Original-To: dev-commits-src-branches@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 4bnTxw2cpJz636Hm; Wed, 23 Jul 2025 22:55:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnTxw184rz3J8B; Wed, 23 Jul 2025 22:55:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753311348; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u55JjiprmQ0I3NwqSaaNy/BxyYtpS9PL7mCRpYvg6k4=; b=A8TRmm78INHtBfZGzYDvaFE3zfazXyoZCoZvNSoy6W0gZncrvNxLG+LwJrAL0UHCkqaxcj XV0TLDnQyXCQHFhMJF7KvrAjVuyvwkeYK2zxKC+KXZsCVidxHrrB9AODxeYmpPdk+7JX2s Bc31gyGWqqZ4ZTNLpokY5Us+28o3fTcN4qFc+2MrRc2V0x56MfcMskqdgOE6UqilSKjSdb 0S6vRiLFJF5cjVjm55pib2q/z8JsBM8k4HOmoytwfqkkB8TRe9HInsgSdsWtkYxNIT+hSM BSd/Qu4xKkqK5da9rRWwROWVhAhSN46/Z2EmTeHzMJupg/ALh9gZbrP1vPDrdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753311348; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u55JjiprmQ0I3NwqSaaNy/BxyYtpS9PL7mCRpYvg6k4=; b=YL0RU9Lp1JsuSP1ObZ3c9Q2Dm7KD5vVIVQ/738pl/kw3Igl3omjY+TCICoQNMOOHIot/zX 4JusfbeMq2r7zCK0ulaojWDtgjS02EfrTqqD9R1b1PqnEe4tkh2b4Qy6ZRAqZVBScmAHRE 1u1NRmjVwxdWa/Z1kHCCKz2bit0+Fo/Dnpu2JRliF5bMG5NjhDCJhSo6Vqr/3+0cdXmWer JAEoqmxYih7CsQ6DRSujUwsD3Od8bdxM9sYnhywjxKvwBoaYENJYcz7r1ZCjT7DA3kho8y lC9ICCUtDtG/tDwU1AgnbqjxLGmUwvnDg1d11cNyZv6tUmFZc8TUad35h/E8sQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753311348; a=rsa-sha256; cv=none; b=Zb5nW63AhH5Vphvp0Mi4I8OsBdCkfcBAvD92znjn/XwRdEDs+FBm7m0QbAMGxbO4eJZOGl R0BvbQ9FnVTSV310jG6x88Wltjlpg6BveEiGNt7F9g2Rvc5aPZCqYJkHD33EFC0Jg+iT7M q2zK+/IW3VWcm0IQS+gGxERs6ZZqZkBZCKknUAixBIt6t/uxmnoQWm4A7GS/fufun2UGUk y9UhguaBF7WA9pSbqeNuRBDiGITdNibGkhl+yZh3GLKqtrJQEH3c6O1BJehj2XL0+A6FvG QvR+xIu9bP7VWFsgWTExNpVyiR9PBG0GRWe0savRD0VaTdlBTSloj7Uleo2uRg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnTxw0PDhzYqR; Wed, 23 Jul 2025 22:55:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56NMtlHP093848; Wed, 23 Jul 2025 22:55:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56NMtl6E093845; Wed, 23 Jul 2025 22:55:47 GMT (envelope-from git) Date: Wed, 23 Jul 2025 22:55:47 GMT Message-Id: <202507232255.56NMtl6E093845@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 9a9e93f38642 - stable/14 - Fix the zfsd_fault_001_pos test List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 9a9e93f386421270b721392183fc3c5088f0055f Auto-Submitted: auto-generated The branch stable/14 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=9a9e93f386421270b721392183fc3c5088f0055f commit 9a9e93f386421270b721392183fc3c5088f0055f Author: Alan Somers AuthorDate: 2025-05-02 14:48:58 +0000 Commit: Alan Somers CommitDate: 2025-07-23 22:55:00 +0000 Fix the zfsd_fault_001_pos test Due to a regression in ZFS, a pool's status may not change to DEGRADED promptly after a vdev becomes faulted. This test is primarily concerned with vdev status, not pool status, so work around the bug by doing a "zpool reopen". Otherwise the test would time out waiting for a status change that never came. https://github.com/openzfs/zfs/issues/16245 Sponsored by: ConnectWise (cherry picked from commit 01a1dd321807ba8a3ef3a4bfad52d8aa23130d10) --- tests/sys/cddl/zfs/tests/zfsd/zfsd_fault_001_pos.ksh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/sys/cddl/zfs/tests/zfsd/zfsd_fault_001_pos.ksh b/tests/sys/cddl/zfs/tests/zfsd/zfsd_fault_001_pos.ksh index 3456a328e7f9..df704e183fb0 100644 --- a/tests/sys/cddl/zfs/tests/zfsd/zfsd_fault_001_pos.ksh +++ b/tests/sys/cddl/zfs/tests/zfsd/zfsd_fault_001_pos.ksh @@ -78,6 +78,10 @@ for type in "raidz" "mirror"; do $DD if=/dev/zero bs=128k count=1 >> \ /$TESTPOOL/$TESTFS/$TESTFILE 2> /dev/null $FSYNC /$TESTPOOL/$TESTFS/$TESTFILE + # Due to a bug outside of zfsd, it may be necessary to reopen + # the pool before it will become DEGRADED. + # https://github.com/openzfs/zfs/issues/16245 + $ZPOOL reopen $TESTPOOL # Check to see if the pool is faulted yet $ZPOOL status $TESTPOOL | grep -q 'state: DEGRADED' if [ $? == 0 ] From nobody Wed Jul 23 22:58:53 2025 X-Original-To: dev-commits-src-branches@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 4bnV1V0MH0z636C7; Wed, 23 Jul 2025 22:58:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnV1T6Tlrz3LTC; Wed, 23 Jul 2025 22:58:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753311533; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Zg8cHotNaOJ0O6+yhjFtAajLvMse/RtJxm2nkDDPbus=; b=sodWXtdpfz8R40aLmwsfcQuO856Wg5+c/9dy4F18YfbkAxkcb0ENVRx2u6S7kh5kmtaPZh G134oKl6KxbAGS7LJJ9sdlu7TFMOU5XKe8F4iBEk9STtLS6uJ50PDaQK4CwQETErCK+hH2 pkaM0P7orDQXf/cLpxVTXoy1CsukaYFfFcs0zBg2X8D3PaleYNp2XX3U2h29knS3Xw0TFJ lL/PGxiNra/xmCgeEQbIlkWPYrpNls41iKXL3rHEXdZbQIqTUqLbmdqxbAbCr58EbdjLEr g3I8h9RXdwrf6gDCWI7R7hGjfrbgqydUtvTMw5aLhZv7fq1CAUFGbYMDoIn/rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753311533; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Zg8cHotNaOJ0O6+yhjFtAajLvMse/RtJxm2nkDDPbus=; b=Xo7gNI10guAgGmyY5YyFGB5QK7rGbrZgaoMmNiPV5huwi6c+HqObCh3H1NXY2AtPDPbbLW lM/dKeJcGPkflCDUO4xZXrD9NLmuhdVYQVQGNGw/6EimlXDroaLAz8WnNQ46PtlggFb2Zr CQ1+VewhqFoOh/2AwY3JX9CcAC5Z9OOp0lV41WHIhYbKFfF9fL4hVeHC4TLyDub53X6pN7 n3hu23ys6LdC8y+QkiKmW+wwdpTIxOHVmmd066gSKht7bEPfOPyj869hAduS4ZbnDA1ptL qVWgCae7+q06oJj3cys0WO6kUxhh/sr5Rjwq/v8hPDHpjzFiLk+bsfhn4xnnGA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753311533; a=rsa-sha256; cv=none; b=h+/GvzlHzS7Wv5ESgseifEvlEmFjLuqvEKGd1R/XfSwpTBTiFK+ZicGZ8LyOzNmMdgBriL mKBsoq53AE3m0sX3gwvIUZg/AcQeLQnQx61zZN6VkxPuQvh0KcS2MYHuIBQsZC/xE2FaAE dLeFUw2xYtczONPYn4dNlHkgi+5ON2Dg/SpZyiNFtmnIUcKM5kum6LhYhngkTZQbedhpq/ rh8092KNdiaZd5sdTUXFqP6EfgqEXz9+QXi+1MeCN5f2GEP+54ReP1B8dAT1mivGutfTix Gz1HvKRmfpWPAOy2I+kK65N7N2OK17iFBSlm7FlDl1mY+Gsj+p9pawM+lfFgww== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnV1T5vQFzYww; Wed, 23 Jul 2025 22:58:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56NMwrUe094896; Wed, 23 Jul 2025 22:58:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56NMwr9h094893; Wed, 23 Jul 2025 22:58:53 GMT (envelope-from git) Date: Wed, 23 Jul 2025 22:58:53 GMT Message-Id: <202507232258.56NMwr9h094893@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: f1e63fcb0c4a - stable/14 - fusefs: revert a workaround for a googletest bug List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f1e63fcb0c4a52d040f3ca9513043c799259471b Auto-Submitted: auto-generated The branch stable/14 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=f1e63fcb0c4a52d040f3ca9513043c799259471b commit f1e63fcb0c4a52d040f3ca9513043c799259471b Author: Alan Somers AuthorDate: 2025-06-05 14:44:43 +0000 Commit: Alan Somers CommitDate: 2025-07-23 22:56:29 +0000 fusefs: revert a workaround for a googletest bug This bug was fixed by googletest back in 2019 and released in googletest 1.10.0, I think. Using GTEST_SKIP from a test environment works now. https://github.com/google/googletest/issues/2189 MFC after: 2 weeks Sponsored by: ConnectWise (cherry picked from commit 35c4ea02cb9fe199dd88b19cf51fef56838c8cba) --- tests/sys/fs/fusefs/utils.cc | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/sys/fs/fusefs/utils.cc b/tests/sys/fs/fusefs/utils.cc index d059221b2e55..d702dec50247 100644 --- a/tests/sys/fs/fusefs/utils.cc +++ b/tests/sys/fs/fusefs/utils.cc @@ -124,6 +124,7 @@ bool is_unsafe_aio_enabled(void) { class FuseEnv: public Environment { virtual void SetUp() { + check_environment(); } }; @@ -132,14 +133,6 @@ void FuseTest::SetUp() { const char *maxphys_node = "kern.maxphys"; size_t size; - /* - * XXX check_environment should be called from FuseEnv::SetUp, but - * can't due to https://github.com/google/googletest/issues/2189 - */ - check_environment(); - if (IsSkipped()) - return; - size = sizeof(m_maxbcachebuf); ASSERT_EQ(0, sysctlbyname(maxbcachebuf_node, &m_maxbcachebuf, &size, NULL, 0)) << strerror(errno); From nobody Wed Jul 23 22:58:52 2025 X-Original-To: dev-commits-src-branches@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 4bnV1T1rflz636Ld; Wed, 23 Jul 2025 22:58:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnV1S69zQz3LYQ; Wed, 23 Jul 2025 22:58:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753311532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WklHeI1x8s3pZmlIGX1+i9DFKuuPe8KawbkV4KIBodY=; b=hSpf8ZK3W9h4iXxi2DwhI68jafY99qrZhgf6DIsdLcZ3L8NsV0spuA05QvXvNsC8gfJcru 6REWcAmFsLxpBYIUj/lB1XL6kULN4ROKWItZFQMvpv/UMWnqnLsGRmVsiH1RHuehTOPpr8 yBqhs6KpCbUdKz8BbfjGFxRtaCkyFZbTcAwmKvSqa9tjMl6ySarRz0aXSuUlGpQqANnQS/ 3E/gZ4FiSvuNfqbw2iWrIsTd7NSncwkM651Yawq835v/RfbcwgtJFbwicJ1GM9N1lmRtVn 4xvZRmaj6t5WWspoAY1x5+4BkLbYbfJCM5P6jfgEq8VwRsVSpYnw1rr+nNcxkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753311532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WklHeI1x8s3pZmlIGX1+i9DFKuuPe8KawbkV4KIBodY=; b=t7wX4ZJlws/dv0OXYZPze/1KTUbIsHI+gNqSI9J4QX2D29aKtgMqoSkPeRhBj0jooVhEug 4E3f3ebNKz9KiZZv1MmFndeAIXA1pcPXWStovByeFRsku3vUWRbB2F/A4irk0YjJ0MaUJ5 jlSXn/B8nifDpeOkWBn+E4JwpHJikYYuYUYSfhW9afA3DE/DQXMFo3pV8tJh/B+WSEpAWO IUnhTaT2oNVU7tdwlee5B986q+ndd/0zdEN4DKi7qdsl944bRUndvCP3QlJiIdD3Au1PsI cmZdzsbu4TcKO5NoPj/Eofq07Wx1TWltg5EkTfAdIT9p3weNMQ3/ScuLg9bVjQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753311532; a=rsa-sha256; cv=none; b=ZTO+4mN8pbc+Y4O/T/QYCjukmH/EUeFjwjaMB0VFMDSPQNYAChTsZKDOoJP7Vkx5WwXkOz 4ybtyCY7H/m6w3bx7GgbQ3683M2VEU3WdWP1SgF1rNV6Ot9V57gz8uQrPJ4ZxmvfBgnT/P VEnI2F680QXXBp8AKOfxHEQSF/AqrUSJmMNh7SS+Dm6RuYF1q5WZitHf/1mNqkl/Vgd1mV qqsVP0KW57Bt584xGaFr7a/arwDW+UbAnshdi9876g+z8BWmcCw/WCfSnqQuFIuk0lqXEx lu49HP72HZpcEY6Pj3a45WQbguDPrQrM3mbNjvAAehXTve1HosZzQQChu/q/Hg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnV1S5TVtzZCF; Wed, 23 Jul 2025 22:58:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56NMwqTk094859; Wed, 23 Jul 2025 22:58:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56NMwq11094856; Wed, 23 Jul 2025 22:58:52 GMT (envelope-from git) Date: Wed, 23 Jul 2025 22:58:52 GMT Message-Id: <202507232258.56NMwq11094856@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 0432511d3ff6 - stable/14 - fusefs: correct a comment in the tests List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 0432511d3ff6f72abc2de326c47a69a0e0be6512 Auto-Submitted: auto-generated The branch stable/14 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=0432511d3ff6f72abc2de326c47a69a0e0be6512 commit 0432511d3ff6f72abc2de326c47a69a0e0be6512 Author: Alan Somers AuthorDate: 2025-05-30 16:54:06 +0000 Commit: Alan Somers CommitDate: 2025-07-23 22:56:25 +0000 fusefs: correct a comment in the tests It's been wrong ever since the original commit in 2019. [skip ci] MFC after: 1 week Sponsored by: ConnectWise (cherry picked from commit 7f07575084a279c7f0cc330fe7e2c04d5a05a487) --- tests/sys/fs/fusefs/destroy.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/fs/fusefs/destroy.cc b/tests/sys/fs/fusefs/destroy.cc index 16d50da19b9b..45acb1f99724 100644 --- a/tests/sys/fs/fusefs/destroy.cc +++ b/tests/sys/fs/fusefs/destroy.cc @@ -60,7 +60,7 @@ static void* open_th(void* arg) { * Check for any memory leaks like this: * 1) kldunload fusefs, if necessary * 2) kldload fusefs - * 3) ./destroy --gtest_filter=Destroy.unsent_operations + * 3) ./destroy --gtest_filter=Death.unsent_operations * 4) kldunload fusefs * 5) check /var/log/messages for anything like this: Freed UMA keg (fuse_ticket) was not empty (31 items). Lost 2 pages of memory. From nobody Wed Jul 23 22:58:54 2025 X-Original-To: dev-commits-src-branches@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 4bnV1W5cj4z636C8; Wed, 23 Jul 2025 22:58:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnV1V6zxJz3LNK; Wed, 23 Jul 2025 22:58:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753311535; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3ds3hUvOZ6mGb+2sOzQlQNVxR+UCOzVj1bBwEbf4alU=; b=oTCibKPUwbwpgpqTtt0hgUvkOKZh7qPVs5p+rF66T19lak+TOyPGeaQ4Oda1AGTDiJmLjH o2rKZoRYzoBwQAYuWsbDgoXu3GrXRQJdc/+qAkKZfGN0QbDEdsaVtmAX1+zijJXhpABRQR LWcffZp11vlLHp4/Qo35m7aRLw800iaS6VM8LI63TkhCF+rEwNBaU93jkggKi4GbJaVjU8 psDwZ7PWxmK2WQhmCuHqrGI1kxMCXjdIcBAif/atKHRlztA4S1DP6YX+/mQ8WoBYyI7Ki1 Rpv81N2pC5lpr7Sb/s++ut1Hv/l4CLawHZPfKYBWEdwVgr7p3YN5m5JWAbWxZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753311535; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3ds3hUvOZ6mGb+2sOzQlQNVxR+UCOzVj1bBwEbf4alU=; b=n7HeXxaSIXco2NuVrhQjXWhqI6kJ52SUs8N7Ax4fbQ/+RINA+ijQhgfSuszYLZ496Ms6m1 Iw0vfRun1X5FWBmLBluv6zC9+5QuNDUsyzfy8BUcri3MC2v3QXvAovvXkUYBM3SwJQ0XO1 Gbw50/CMn8OpykmV+YNPNgAPMR5XhIAuA3A8VRvgjR2ykU11BrK1paQBjaY3NFfHVJwdwS EEGKnA+GfujDT36m0Tri8Bpj2jQ6ojE7jJR4jp0owD4XBZJa9IXGB/W4n+T+5Xa46yWEhE rvBtzaBG03++x4xvJ2Zwsik+bZWFL4NcK+tLGeEhKGjSOXVmm5/CX0ou5Y/lIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753311535; a=rsa-sha256; cv=none; b=v1XsxfZgjR/YlXroHRxqAOKi4cj4W2EH1KRLiwZrN9t/I6BtMx0z7nMFN03BO9Laj77GOe QDo6CzABuWXm11qY1xJmm/lHW/go8KGwuw57KlrdlX3eyvbhw0FRKU4y9/uqFzzaUTuYgP 4URBlA2dFXZq5YEgG4Pw6wfhxFvMdMfZZPJQ5fv4ioR+4WEM8WDQU5LGaP5lK8svKC2Yul 47rBQJgcSUAAV18zAtBbSwI1uj1h+bqWTr9BhI0PnMXFuAtKE7YPGrARETJQWOX2zKKdPe +ekoTDipJ8YH6PyeaG9rpQok3PsLhy50zz/ofOUdrQaA+BR33IJafnR6LFviEg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnV1V6Y4nzYsx; Wed, 23 Jul 2025 22:58:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56NMwsRi094942; Wed, 23 Jul 2025 22:58:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56NMws1I094939; Wed, 23 Jul 2025 22:58:54 GMT (envelope-from git) Date: Wed, 23 Jul 2025 22:58:54 GMT Message-Id: <202507232258.56NMws1I094939@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 0a0d323157cb - stable/14 - fusefs: delete dead code List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 0a0d323157cb54970b5c525db307c17c2e7ff864 Auto-Submitted: auto-generated The branch stable/14 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=0a0d323157cb54970b5c525db307c17c2e7ff864 commit 0a0d323157cb54970b5c525db307c17c2e7ff864 Author: Alan Somers AuthorDate: 2025-06-05 20:32:22 +0000 Commit: Alan Somers CommitDate: 2025-07-23 22:56:33 +0000 fusefs: delete dead code These lines have been commented out ever since the first import of fuse. The intention seems to be for the original developer to experiment with different error handling strategies, but they're very obsolete by now. Delete them. MFC after: 2 weeks Sponsored by: ConnectWise (cherry picked from commit 7ce93195ddb30b371022ae3adbd9bd24189e1444) --- sys/fs/fuse/fuse_ipc.c | 5 ----- sys/fs/fuse/fuse_vnops.c | 4 +--- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/sys/fs/fuse/fuse_ipc.c b/sys/fs/fuse/fuse_ipc.c index 21787b6b543a..379306f8ef2e 100644 --- a/sys/fs/fuse/fuse_ipc.c +++ b/sys/fs/fuse/fuse_ipc.c @@ -444,11 +444,6 @@ retry: if (err == EWOULDBLOCK) { SDT_PROBE2(fusefs, , ipc, trace, 3, "fticket_wait_answer: EWOULDBLOCK"); -#ifdef XXXIP /* die conditionally */ - if (!fdata_get_dead(data)) { - fdata_set_dead(data); - } -#endif err = ETIMEDOUT; fticket_set_answered(ftick); } else if ((err == EINTR || err == ERESTART)) { diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index 423ce05a595f..88bf20382c05 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -1937,10 +1937,8 @@ fuse_vnop_readdir(struct vop_readdir_args *ap) if (fuse_isdeadfs(vp)) { return ENXIO; } - if ( /* XXXIP ((uio_iovcnt(uio) > 1)) || */ - (uio_resid(uio) < sizeof(struct dirent))) { + if (uio_resid(uio) < sizeof(struct dirent)) return EINVAL; - } tresid = uio->uio_resid; err = fuse_filehandle_get_dir(vp, &fufh, cred, pid); From nobody Wed Jul 23 23:29:31 2025 X-Original-To: dev-commits-src-branches@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 4bnVhr44SNz637Ly; Wed, 23 Jul 2025 23:29:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnVhq2lXxz3qZv; Wed, 23 Jul 2025 23:29:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753313371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CNUQe5f8AvgInKDOKy9/CrljVAsvZHkejsGbWMmusOM=; b=mhvPsFrH8e5Gpkq/K5nBuIK/ESAYYH1UylilGmFnKb8FYvGcZ133/aNSRLjuHTapL3bYr2 hPOJHWt0XHIMuUBnNNAMU7ZgM3tseQL1IIRX/6aEIIUvVFe0QLRiRttfY2XLg1I8q1N4fC O28kBJmpxslv8HjAR4Aeh+yKr8yzH83uQJVFlfeU2m6DglUra9bMQH0SPMb9YKsSWEdTs0 Hg4FywB5E9Q5cg5v+MSRqFJ1mqFXtEUvx/jwkGT2uV9CFObgP15lyDR05H/ByHmFi4lHOe hdRI6VbPeOI8R13WbYEl4fT82lHra5ELB1hO8K4LDjzFzhxGR3/dztTGzwTytw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753313371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CNUQe5f8AvgInKDOKy9/CrljVAsvZHkejsGbWMmusOM=; b=x1Ysel9/G09/QFWp+1eIw4i7rD//gnBXdbxLA6uqPYJ1RKgZX3dD70PVxbqByEuAhyFVlG iCcqNzndBU8+kZ+MG/RlBCtlqDbDmB7ri8QkNzOaH9FfFA2GciHIBnkGePi/sslJui1utx JQLXBZCA2r1fUznZ4FU1L10yGFZVxuKG8/4u8NrNop0Wly/HD+KRo48JUNUwldgTqIxlS2 m8cX5sa1H24bP+zduMIm6RHY+R6XVfs792ISc5Fz90npYztqVafXkeXtim1itk5TpAEfwU gBgY2UmyyGT39kkzUNwQJx7gD/OZ4PVGIUQK11QeOegj4BzyvfoAi4epTDGkbg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753313371; a=rsa-sha256; cv=none; b=ASeUNnoL0rMGXuNFH6bc+DJTucNHZaugyE4o1kIF7LEpfKnY37uo5lsXsrEGKq1DcF9oPA FnIHlgWnNVO+T9FnhsQqpnlZziDV1Jmhp/Aq5HJa1PgUdvctUOB9dZ/xldtSeJTPRZHia+ mzrFN7bcjWmFufNbzduGjbdv7pif6rMmgaMTCQ0yZkhIJPZhZCM3eW5Q6XPTcDXstlTza8 obq3EwEGK0uL0I4jbDNlVNzepQHDB8FSTLuVnItpf5nXKDI+QJGT9IkN3bh/K3Oo7O2qke CZtsv1B1VFU6WEja+aQSvFNUslm8fY1foxHuH4i2JEaNPneOy9Ei7jHDd+COtQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnVhq2LbmzZNc; Wed, 23 Jul 2025 23:29:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56NNTVUC052323; Wed, 23 Jul 2025 23:29:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56NNTV4s052320; Wed, 23 Jul 2025 23:29:31 GMT (envelope-from git) Date: Wed, 23 Jul 2025 23:29:31 GMT Message-Id: <202507232329.56NNTV4s052320@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 34a893a0ab10 - stable/14 - fusefs: Fix a panic when unmounting before init List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 34a893a0ab1050db08c0c4cbd21261537b779549 Auto-Submitted: auto-generated The branch stable/14 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=34a893a0ab1050db08c0c4cbd21261537b779549 commit 34a893a0ab1050db08c0c4cbd21261537b779549 Author: Alan Somers AuthorDate: 2025-06-05 20:00:48 +0000 Commit: Alan Somers CommitDate: 2025-07-23 23:28:51 +0000 fusefs: Fix a panic when unmounting before init fusefs would page fault due to the following sequence of events: * The server did not respond to FUSE_INIT in timely fashion. * Some other process tried to do unmount. * That other process got killed by a signal. * The server finally responded to FUSE_INIT. PR: 287438 Sponsored by: ConnectWise Reviewed by: arrowd Differential Revision: https://reviews.freebsd.org/D50799 (cherry picked from commit cc9c213086795fd821e6c17ee99a1db81a2141b2) --- sys/fs/fuse/fuse_internal.c | 3 + tests/sys/fs/fusefs/Makefile | 1 + tests/sys/fs/fusefs/mockfs.cc | 18 +++-- tests/sys/fs/fusefs/mockfs.hh | 6 +- tests/sys/fs/fusefs/pre-init.cc | 154 ++++++++++++++++++++++++++++++++++++++++ tests/sys/fs/fusefs/utils.cc | 3 +- tests/sys/fs/fusefs/utils.hh | 2 + 7 files changed, 179 insertions(+), 8 deletions(-) diff --git a/sys/fs/fuse/fuse_internal.c b/sys/fs/fuse/fuse_internal.c index f3206a3ddf9c..ffea3afacb4f 100644 --- a/sys/fs/fuse/fuse_internal.c +++ b/sys/fs/fuse/fuse_internal.c @@ -980,6 +980,9 @@ fuse_internal_init_callback(struct fuse_ticket *tick, struct uio *uio) struct fuse_data *data = tick->tk_data; struct fuse_init_out *fiio = NULL; + if (fdata_get_dead(data)) + goto out; + if ((err = tick->tk_aw_ohead.error)) { goto out; } diff --git a/tests/sys/fs/fusefs/Makefile b/tests/sys/fs/fusefs/Makefile index cff8a0a483ad..9d9a6785c838 100644 --- a/tests/sys/fs/fusefs/Makefile +++ b/tests/sys/fs/fusefs/Makefile @@ -40,6 +40,7 @@ GTESTS+= nfs GTESTS+= notify GTESTS+= open GTESTS+= opendir +GTESTS+= pre-init GTESTS+= read GTESTS+= readdir GTESTS+= readlink diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc index 35ae6c207229..f48165f6a151 100644 --- a/tests/sys/fs/fusefs/mockfs.cc +++ b/tests/sys/fs/fusefs/mockfs.cc @@ -421,7 +421,7 @@ MockFS::MockFS(int max_read, int max_readahead, bool allow_other, bool push_symlinks_in, bool ro, enum poll_method pm, uint32_t flags, uint32_t kernel_minor_version, uint32_t max_write, bool async, bool noclusterr, unsigned time_gran, bool nointr, bool noatime, - const char *fsname, const char *subtype) + const char *fsname, const char *subtype, bool no_auto_init) : m_daemon_id(NULL), m_kernel_minor_version(kernel_minor_version), m_kq(pm == KQ ? kqueue() : -1), @@ -530,7 +530,9 @@ MockFS::MockFS(int max_read, int max_readahead, bool allow_other, ON_CALL(*this, process(_, _)) .WillByDefault(Invoke(this, &MockFS::process_default)); - init(flags); + if (!no_auto_init) + init(flags); + bzero(&sa, sizeof(sa)); sa.sa_handler = sigint_handler; sa.sa_flags = 0; /* Don't set SA_RESTART! */ @@ -544,10 +546,7 @@ MockFS::MockFS(int max_read, int max_readahead, bool allow_other, MockFS::~MockFS() { kill_daemon(); - if (m_daemon_id != NULL) { - pthread_join(m_daemon_id, NULL); - m_daemon_id = NULL; - } + join_daemon(); ::unmount("mountpoint", MNT_FORCE); rmdir("mountpoint"); if (m_kq >= 0) @@ -788,6 +787,13 @@ void MockFS::kill_daemon() { m_fuse_fd = -1; } +void MockFS::join_daemon() { + if (m_daemon_id != NULL) { + pthread_join(m_daemon_id, NULL); + m_daemon_id = NULL; + } +} + void MockFS::loop() { std::vector> out; diff --git a/tests/sys/fs/fusefs/mockfs.hh b/tests/sys/fs/fusefs/mockfs.hh index 1de77767d0c9..ba6f7fded9d0 100644 --- a/tests/sys/fs/fusefs/mockfs.hh +++ b/tests/sys/fs/fusefs/mockfs.hh @@ -366,13 +366,17 @@ class MockFS { enum poll_method pm, uint32_t flags, uint32_t kernel_minor_version, uint32_t max_write, bool async, bool no_clusterr, unsigned time_gran, bool nointr, - bool noatime, const char *fsname, const char *subtype); + bool noatime, const char *fsname, const char *subtype, + bool no_auto_init); virtual ~MockFS(); /* Kill the filesystem daemon without unmounting the filesystem */ void kill_daemon(); + /* Wait until the daemon thread terminates */ + void join_daemon(); + /* Process FUSE requests endlessly */ void loop(); diff --git a/tests/sys/fs/fusefs/pre-init.cc b/tests/sys/fs/fusefs/pre-init.cc new file mode 100644 index 000000000000..e990d3cafffa --- /dev/null +++ b/tests/sys/fs/fusefs/pre-init.cc @@ -0,0 +1,154 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2025 ConnectWise + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +extern "C" { +#include +#include +#include +#include + +#include +#include +#include +#include +} + +#include "mockfs.hh" +#include "utils.hh" + +using namespace testing; + +/* Tests for behavior that happens before the server responds to FUSE_INIT */ +class PreInit: public FuseTest { +void SetUp() { + m_no_auto_init = true; + FuseTest::SetUp(); +} +}; + +static void* unmount1(void* arg __unused) { + ssize_t r; + + r = unmount("mountpoint", 0); + if (r >= 0) + return 0; + else + return (void*)(intptr_t)errno; +} + +/* + * Attempting to unmount the file system before it fully initializes should + * work fine. The unmount will complete after initialization does. + */ +TEST_F(PreInit, unmount_before_init) +{ + sem_t sem0; + pthread_t th1; + + ASSERT_EQ(0, sem_init(&sem0, 0, 0)) << strerror(errno); + + EXPECT_CALL(*m_mock, process( + ResultOf([](auto in) { + return (in.header.opcode == FUSE_INIT); + }, Eq(true)), + _) + ).WillOnce(Invoke(ReturnImmediate([&](auto in, auto& out) { + SET_OUT_HEADER_LEN(out, init); + out.body.init.major = FUSE_KERNEL_VERSION; + out.body.init.minor = FUSE_KERNEL_MINOR_VERSION; + out.body.init.flags = in.body.init.flags & m_init_flags; + out.body.init.max_write = m_maxwrite; + out.body.init.max_readahead = m_maxreadahead; + out.body.init.time_gran = m_time_gran; + sem_wait(&sem0); + }))); + expect_destroy(0); + + ASSERT_EQ(0, pthread_create(&th1, NULL, unmount1, NULL)); + nap(); /* Wait for th1 to block in unmount() */ + sem_post(&sem0); + /* The daemon will quit after receiving FUSE_DESTROY */ + m_mock->join_daemon(); +} + +/* + * Don't panic in this very specific scenario: + * + * The server does not respond to FUSE_INIT in timely fashion. + * Some other process tries to do unmount. + * That other process gets killed by a signal. + * The server finally responds to FUSE_INIT. + * + * Regression test for bug 287438 + * https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=287438 + */ +TEST_F(PreInit, signal_during_unmount_before_init) +{ + sem_t sem0; + pid_t child; + + ASSERT_EQ(0, sem_init(&sem0, 0, 0)) << strerror(errno); + + EXPECT_CALL(*m_mock, process( + ResultOf([](auto in) { + return (in.header.opcode == FUSE_INIT); + }, Eq(true)), + _) + ).WillOnce(Invoke(ReturnImmediate([&](auto in, auto& out) { + SET_OUT_HEADER_LEN(out, init); + out.body.init.major = FUSE_KERNEL_VERSION; + /* + * Use protocol 7.19, like libfuse2 does. The server must use + * protocol 7.27 or older to trigger the bug. + */ + out.body.init.minor = 19; + out.body.init.flags = in.body.init.flags & m_init_flags; + out.body.init.max_write = m_maxwrite; + out.body.init.max_readahead = m_maxreadahead; + out.body.init.time_gran = m_time_gran; + sem_wait(&sem0); + }))); + + if ((child = ::fork()) == 0) { + /* + * In child. This will block waiting for FUSE_INIT to complete + * or the receipt of an asynchronous signal. + */ + (void) unmount("mountpoint", 0); + _exit(0); /* Unreachable, unless parent dies after fork */ + } else if (child > 0) { + /* In parent. Wait for child process to start, then kill it */ + nap(); + kill(child, SIGINT); + waitpid(child, NULL, WEXITED); + } else { + FAIL() << strerror(errno); + } + m_mock->m_quit = true; /* Since we are by now unmounted. */ + sem_post(&sem0); + m_mock->join_daemon(); +} diff --git a/tests/sys/fs/fusefs/utils.cc b/tests/sys/fs/fusefs/utils.cc index d702dec50247..125b7e2d6fc7 100644 --- a/tests/sys/fs/fusefs/utils.cc +++ b/tests/sys/fs/fusefs/utils.cc @@ -151,7 +151,8 @@ void FuseTest::SetUp() { m_default_permissions, m_push_symlinks_in, m_ro, m_pm, m_init_flags, m_kernel_minor_version, m_maxwrite, m_async, m_noclusterr, m_time_gran, - m_nointr, m_noatime, m_fsname, m_subtype); + m_nointr, m_noatime, m_fsname, m_subtype, + m_no_auto_init); /* * FUSE_ACCESS is called almost universally. Expecting it in * each test case would be super-annoying. Instead, set a diff --git a/tests/sys/fs/fusefs/utils.hh b/tests/sys/fs/fusefs/utils.hh index 9dd8dad6b5cc..91bbba909672 100644 --- a/tests/sys/fs/fusefs/utils.hh +++ b/tests/sys/fs/fusefs/utils.hh @@ -69,6 +69,7 @@ class FuseTest : public ::testing::Test { bool m_async; bool m_noclusterr; bool m_nointr; + bool m_no_auto_init; unsigned m_time_gran; MockFS *m_mock = NULL; const static uint64_t FH = 0xdeadbeef1a7ebabe; @@ -95,6 +96,7 @@ class FuseTest : public ::testing::Test { m_async(false), m_noclusterr(false), m_nointr(false), + m_no_auto_init(false), m_time_gran(1), m_fsname(""), m_subtype(""), From nobody Wed Jul 23 23:29:33 2025 X-Original-To: dev-commits-src-branches@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 4bnVht0Z9Hz637RW; Wed, 23 Jul 2025 23:29:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnVhs49m1z3qSS; Wed, 23 Jul 2025 23:29:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753313373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QsceILQhR/Cp5mkL3qdkjK7ST+vdsQBjSCMVuJjcAoE=; b=XsNtG4NjMQy9yk34LNzgoCuaPg1WN2kEDdS1q3dzZ5njaWtfoA9WKhoo5Y9AFa50fPT/r0 JnK3Ovl1IJCv/DajtsvNS3bZ4jDrvsJKvEiJbqGt+VN0qsmn7B1x6YpEWSrhB69ilxuxuw AzdzPi/eGciVBtClIBa9/YXxPYDSSU7mrA8x9dNWbiuqhhR/T7FUGoVlaok8R9+smkqrFw k8g8qBLUSAofCgcWsj0WE/Q5R2nGfkoxfu5Vzit94N3KKKisPLJezBvxFWx2PFUS4Rzow0 o70XX+YukegpmX4+8LU2/NaW68+xrbxToLiQH+ZhbHe/MJuParDSfZUcsfn7mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753313373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QsceILQhR/Cp5mkL3qdkjK7ST+vdsQBjSCMVuJjcAoE=; b=mQEvutCnASVJfungo7JhK1bqYMtesB1hBhUQdQ3ZwUtVHSKIOROT2bqxK30KsGHz87x1a7 wyHiP6Dl+SlcALf72MREui7TO+oYt/Io+pb9eBNOIdC4fa7YF5/juKaIk6yiCpkRh96LPW K2R2VJb4qb1xhi2IVlVr5cy2/XaoB0eCV9HsRHgnGMZQqFOsYFGIfFI59852b60xL1YJXX L4a0FT90InUUSforne8kY8RL4G6QvNZucP0wt41GKJGrbNpSpoGf76OoK3dbm2eoSIYkZ/ DXQ6bQy1tt9RJ1hKqBbIYXJRdsgYKdHoqx6HCp3sTqSB35lRebwsZcVgoyyKPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753313373; a=rsa-sha256; cv=none; b=jQUVrbBz4/znLVukbALigi+CVFkpo5wz5PNImTFjxR1nAk5YFu77Ti7juiP27N0qXppmun hjE9Uj/b2g3N7xGo92IzNE9ePsfpKIEYpUtguOMkXKcEeO9vMbmaXtBOHUvUM/XycVjMXS iex0oB0RksznvpjC63YiRFgMYvyszQIPKz/jebmvoaH5dUozMdT1UuhkkTR9EnocrzEXdK 2yI9NCB6nnPAbzt+Gh52/jHX+2k15ZOuz8nxULxGC+rRZoQ/I4L5/s8T+ScDMBR56kg8If OVXenfNid97zoMBxLLHe46TURPjQQy92FbSjHWEnV+e3A/j2PWhfFkn23hr57w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnVhs3TpBzZWq; Wed, 23 Jul 2025 23:29:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56NNTXxr052391; Wed, 23 Jul 2025 23:29:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56NNTXI4052388; Wed, 23 Jul 2025 23:29:33 GMT (envelope-from git) Date: Wed, 23 Jul 2025 23:29:33 GMT Message-Id: <202507232329.56NNTXI4052388@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 6f433f2b4f37 - stable/14 - fusefs: fix a panic in vop_close with a CTL consumer List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 6f433f2b4f376c963a456eedf8c690e98d07188d Auto-Submitted: auto-generated The branch stable/14 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=6f433f2b4f376c963a456eedf8c690e98d07188d commit 6f433f2b4f376c963a456eedf8c690e98d07188d Author: Alan Somers AuthorDate: 2024-12-18 18:02:34 +0000 Commit: Alan Somers CommitDate: 2025-07-23 23:28:57 +0000 fusefs: fix a panic in vop_close with a CTL consumer Kernel consumers like CTL may lack ucred objects. That led to a panic when CTL closed a fuse file, if atime was enabled on the mountpoint. Fix it by checking the ucred during close. PR: 283402 Sponsored by: ConnectWise Differential Revision: https://reviews.freebsd.org/D48165 (cherry picked from commit 9350e9236242f51c88b3e5c19ceeae7869b9cf83) --- sys/fs/fuse/fuse_vnops.c | 3 ++ tests/sys/cam/ctl/ctl.subr | 18 ++++++++++-- tests/sys/fs/fusefs/Makefile | 5 ++++ tests/sys/fs/fusefs/ctl.sh | 69 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 93 insertions(+), 2 deletions(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index 88bf20382c05..d4809b647143 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -797,6 +797,9 @@ fuse_vnop_close(struct vop_close_args *ap) if (fflag & IO_NDELAY) return 0; + if (cred == NULL) + cred = td->td_ucred; + err = fuse_flush(vp, cred, pid, fflag); if (err == 0 && (fvdat->flag & FN_ATIMECHANGE) && !vfs_isrdonly(mp)) { struct vattr vap; diff --git a/tests/sys/cam/ctl/ctl.subr b/tests/sys/cam/ctl/ctl.subr index 868b1c809571..5da441b806f0 100644 --- a/tests/sys/cam/ctl/ctl.subr +++ b/tests/sys/cam/ctl/ctl.subr @@ -80,7 +80,20 @@ find_device() { done } -# Create a CTL LUN +# Create a CTL LUN backed by a file +create_block() { + EXTRA_ARGS=$* + + atf_check -o save:lun-create.txt ctladm create -b block $EXTRA_ARGS + atf_check egrep -q "LUN created successfully" lun-create.txt + LUN=`awk '/LUN ID:/ {print $NF}' lun-create.txt` + if [ -z "$LUN" ]; then + atf_fail "Could not find LUN id" + fi + find_device $LUN +} + +# Create a CTL LUN backed by RAM create_ramdisk() { EXTRA_ARGS=$* @@ -95,7 +108,8 @@ create_ramdisk() { cleanup() { if [ -e "lun-create.txt" ]; then + backend=`awk '/backend:/ {print $NF}' lun-create.txt` lun_id=`awk '/LUN ID:/ {print $NF}' lun-create.txt` - ctladm remove -b ramdisk -l $lun_id > /dev/null + ctladm remove -b $backend -l $lun_id > /dev/null fi } diff --git a/tests/sys/fs/fusefs/Makefile b/tests/sys/fs/fusefs/Makefile index 9d9a6785c838..9e2065be434a 100644 --- a/tests/sys/fs/fusefs/Makefile +++ b/tests/sys/fs/fusefs/Makefile @@ -5,6 +5,8 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/fs/fusefs +ATF_TESTS_SH+= ctl + # We could simply link all of these files into a single executable. But since # Kyua treats googletest programs as plain tests, it's better to separate them # out, so we get more granular reporting. @@ -67,6 +69,9 @@ TEST_METADATA.default_permissions+= required_user="unprivileged" TEST_METADATA.default_permissions_privileged+= required_user="root" TEST_METADATA.mknod+= required_user="root" TEST_METADATA.nfs+= required_user="root" +# ctl must be exclusive because it disables/enables camsim +TEST_METADATA.ctl+= is_exclusive="true" +TEST_METADATA.ctl+= required_user="root" TEST_METADATA+= timeout=10 diff --git a/tests/sys/fs/fusefs/ctl.sh b/tests/sys/fs/fusefs/ctl.sh new file mode 100644 index 000000000000..7d2e7593cbdc --- /dev/null +++ b/tests/sys/fs/fusefs/ctl.sh @@ -0,0 +1,69 @@ +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2024 ConnectWise +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +. $(atf_get_srcdir)/../../cam/ctl/ctl.subr + +# Regression test for https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283402 +# +# Almost any fuse file system would work, but this tests uses fusefs-ext2 +# because it's simple and its download is very small. +atf_test_case remove_lun_with_atime cleanup +remove_lun_with_atime_head() +{ + atf_set "descr" "Remove a fuse-backed CTL LUN when atime is enabled" + atf_set "require.user" "root" + atf_set "require.progs" "fuse-ext2 mkfs.ext2" +} +remove_lun_with_atime_body() +{ + MOUNTPOINT=$PWD/mnt + atf_check mkdir $MOUNTPOINT + atf_check truncate -s 1g ext2.img + atf_check mkfs.ext2 -q ext2.img + # Note: both default_permissions and atime must be enabled + atf_check fuse-ext2 -o default_permissions,allow_other,rw+ ext2.img \ + $MOUNTPOINT + + atf_check truncate -s 1m $MOUNTPOINT/file + create_block -o file=$MOUNTPOINT/file + + # Force fusefs to open the file, and dirty its atime + atf_check dd if=/dev/$dev of=/dev/null count=1 status=none + + # Finally, remove the LUN. Hopefully it won't panic. + atf_check -o ignore ctladm remove -b block -l $LUN + + rm lun-create.txt # So we don't try to remove the LUN twice +} +remove_lun_with_atime_cleanup() +{ + cleanup + umount $PWD/mnt +} + +atf_init_test_cases() +{ + atf_add_test_case remove_lun_with_atime +} From nobody Wed Jul 23 23:31:57 2025 X-Original-To: dev-commits-src-branches@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 4bnVld6NKFz637ZJ; Wed, 23 Jul 2025 23:31:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnVld2R6vz3rwm; Wed, 23 Jul 2025 23:31:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753313517; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=41iPPPnF30Nalqsgs1asJN5PvoE7ADuMuuM0T+tQfx4=; b=DdkM0mbvCBWsvDQKv7tWksxEQfsKND4l+3bLBO2z/zb4mvp/K8eEGj7eIGcQWoeLM3Lzce Bs6YoZd3kUKJ4ou9BwpdBpDM8ziTxaWX+aTaa81KJIQyGkyf7CxtbMVCiWNf9Ecn+xYhqJ Sq2/bWa1rofSO439nGqL/IUAKyq9ucY2OloMxlWuYKTJ51QcEZlge6utFTcQuFNSNXVXvJ 8IcMLNGexCtN+5NPFgcTzlVYaoTauBC7/HGmK6cS61pXCnB1NW/8NDyKRFU8AR6tRWPMGO C5ZKXBm6c9G2UmtvXDYE5pLM54bSRJ+bOxXF2AU6ChYpvoSFI0fvIUwlnEzjVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753313517; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=41iPPPnF30Nalqsgs1asJN5PvoE7ADuMuuM0T+tQfx4=; b=O55+I6G0fJm8sfdu7wUlkmPG7wXLqoHRERoEoSa3RjS3ST9Wscjg8yvs0LLPkXkuBV7Lgv gBDaTQlV0prc0z7CtvJwqmg4yMr3bz6ny+WeWsUwWeo5itim3z7R2VBEXYE/kiOMWwUAiG CJ+c0E3jlCQh4VFy/9UU61xeTkkcRIjhEMe54YFoAjJB/XQsVXhEgD3KkbWe0PsYIYDaAN XR6qRfPrBBQQszbJSjKTRrBmEIx/rSlHWNKIsstIMuikQOSrB1wOplkGyMDewLcdU8AVmu D8VeH7ayIcG5BkHUcuyIhZYp1iFTCEVvNTUCleaVuG5jWk8o5gV15Y14Q6aAVQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753313517; a=rsa-sha256; cv=none; b=xfTcDtbP2MM2EK6EVR4Sdp6A/ze+8P2DBnC79t3MpRs7Fkrtnnone/CGWQiJ8HAZhZLMqd rU319f/5r8c9j+g8y/O6GxWB6oWrFty549BarFX927hR3tLR+23ujMMZ02qtvFNLIst23d FCrZn5ar+WiUY7JdsIWHFl64uOlqgc5rAKf1yuGZ4DrziWb/9vpVHLKTayGcM/SZyocCDL DBOXkAXE/frKDRtW8MSIVG1aEWQpSkvsrYiWMJGBRvzdvv9qdKIekFZG/GOYsy6NF4pICQ qhSchWeCKNV2DqS6KfJyVOAEJk7kLnKmk8aRO2ZG4I5IbwVHSfURwDT6+uBxaQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnVld20QZzZlf; Wed, 23 Jul 2025 23:31:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56NNVvZv068335; Wed, 23 Jul 2025 23:31:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56NNVvot068332; Wed, 23 Jul 2025 23:31:57 GMT (envelope-from git) Date: Wed, 23 Jul 2025 23:31:57 GMT Message-Id: <202507232331.56NNVvot068332@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: f0a7a1bda375 - stable/14 - fstat: identify kqueue, mqueue, and procdesc file descriptors List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f0a7a1bda3752c906ef732e89c00371a3ba0760f Auto-Submitted: auto-generated The branch stable/14 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=f0a7a1bda3752c906ef732e89c00371a3ba0760f commit f0a7a1bda3752c906ef732e89c00371a3ba0760f Author: Alan Somers AuthorDate: 2025-01-28 17:59:41 +0000 Commit: Alan Somers CommitDate: 2025-07-23 23:31:20 +0000 fstat: identify kqueue, mqueue, and procdesc file descriptors When displaying kqueue, mqueue, and procdesc file descriptors, identify them as such. There aren't any details, but it's better than a scary warning like "unknown file type 15 for file 6 of pid 26393". Sponsored by: ConnectWise Differential Revision: https://reviews.freebsd.org/D48706 (cherry picked from commit b3168306a13b9d95c2b01bf7a483c1af9ec0d797) --- usr.bin/fstat/fstat.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c index c3374ecfffac..3462033c3617 100644 --- a/usr.bin/fstat/fstat.c +++ b/usr.bin/fstat/fstat.c @@ -300,14 +300,26 @@ print_file_info(struct procstat *procstat, struct filestat *fst, case PS_FST_TYPE_PTS: print_pts_info(procstat, fst); break; + case PS_FST_TYPE_KQUEUE: + printf(" [kqueue]"); + break; + case PS_FST_TYPE_MQUEUE: + printf(" [mqueue]"); + break; case PS_FST_TYPE_SHM: print_shm_info(procstat, fst); break; case PS_FST_TYPE_SEM: print_sem_info(procstat, fst); break; + case PS_FST_TYPE_PROCDESC: + printf(" [procdesc]"); + break; case PS_FST_TYPE_DEV: break; + case PS_FST_TYPE_EVENTFD: + printf(" [eventfd]"); + break; default: if (vflg) fprintf(stderr, From nobody Thu Jul 24 02:53:24 2025 X-Original-To: dev-commits-src-branches@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 4bnbD54fstz5pxk3; Thu, 24 Jul 2025 02:53:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnbD46WbMz3RcG; Thu, 24 Jul 2025 02:53:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753325604; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4H0eNOsQd148XQBE+lbmFqQf32TGcSbkv8YovmPrVAQ=; b=V6VB2R5ILTpSzSsqcgpEzGTeXrGFguXH7l+/OsGURwy9F2GwAlPhSA+RoUXZ39NBsRerd5 suQdb6RB/GItOIJmNYIHMxKmECC+wuYMQufGmBQykvmANfPSK+OBfxJIHg8FJNE0wm2ulV cG+6Oe5J8O5krqubdFEdI9hraDT1p6bpJ52ihsi1APe0d4saaIdLtioYi08MI5IjPc1Dep sJwfl3kZaScO2sS/AAXDK5jvijzeIgrWetAVjG/JmC3qLzZJu8B3h9LoWrEMy3YZekdzOn kDtZzRiS8bSirRTqXoVNL8hi/UZTqTs1c7UtQ8JuCA+3esp9ZOBGMkErrh214A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753325604; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4H0eNOsQd148XQBE+lbmFqQf32TGcSbkv8YovmPrVAQ=; b=Uy1LQ4BPkUiglTHvsMzuC9W+donp8xE7HPYb8IqF45GB9klMRtEhgM6Xz5qyqBElnhSzBy OpsP/yG+ZISDEy7CngZBt7Zx2IQEJeHdn+ut4qu8vfZwRdmW6gXvPUo53iQaq0KeDT/Wde ZhIIWiDkLBUn7OnK5ziQjhYZxjQryvsEey5pZWp7u0jnY7XWaqlT0HZnvuvLmtkJbCSDb5 1eghXrSUeqtpaRSiRUdpp8a32mMNa84uE/62349UegPMfBHxGJ5VgArQifKQqmWnjOVLBd OVmfsw425d9b7pG5seYF222Z6yIp8zQoBgTalosLUtrjfiywVRnAvtOyOyltjA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753325604; a=rsa-sha256; cv=none; b=BxSRIoGsq0Dyew6Y3JO3wrYv+hlpoG3r6hDGj39zJR6Q8g+Utw/rMak6VaauJo72fKEmTb kqjIWA6fKOfxvuaZe56YDhuLeNXVbUSsJf+UHF98uY7+HbsNfSstVNKi1bLKOsgD7SsVtL sUwbTV3BoXClWYCD1RvLaI6KpIIdFU/Jk1gvdCgAl4/uMPiYrDejMODdLmm8M74v/WmwCP A929FP969z1dUGN40l+Q9xPRiZRjulxeVCprCgYvLaix3qyP2XJY5+HpUGwaV3ZVMhTc7f pRb1nIV7ePqMS5DHEHDkfp+8846+XIbP3Dad16neu3ri99QYYusGZnLTkq5NIg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnbD464Mqzgq7; Thu, 24 Jul 2025 02:53:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56O2rOBT044422; Thu, 24 Jul 2025 02:53:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56O2rOjC044419; Thu, 24 Jul 2025 02:53:24 GMT (envelope-from git) Date: Thu, 24 Jul 2025 02:53:24 GMT Message-Id: <202507240253.56O2rOjC044419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 442f01cb8860 - stable/14 - msdosfs: replace '/' in direntries with '?' List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 442f01cb8860226685e378c222a57614d941825d Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=442f01cb8860226685e378c222a57614d941825d commit 442f01cb8860226685e378c222a57614d941825d Author: Konstantin Belousov AuthorDate: 2025-07-17 01:12:05 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-24 02:52:25 +0000 msdosfs: replace '/' in direntries with '?' PR: 288266 (cherry picked from commit 29af6d2e2ec9fe8df7cf1e1a0bf3597028831b18) --- sys/fs/msdosfs/msdosfs_conv.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/fs/msdosfs/msdosfs_conv.c b/sys/fs/msdosfs/msdosfs_conv.c index da4848169173..208b64930e61 100644 --- a/sys/fs/msdosfs/msdosfs_conv.c +++ b/sys/fs/msdosfs/msdosfs_conv.c @@ -797,19 +797,24 @@ mbsadjpos(const char **instr, size_t inlen, size_t outlen, int weight, int flag, static u_char * dos2unixchr(u_char *outbuf, const u_char **instr, size_t *ilen, int lower, struct msdosfsmount *pmp) { - u_char c, *outp; - size_t len, olen; + u_char c, *outp, *outp1; + size_t i, len, olen; outp = outbuf; if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) { olen = len = 4; + outp1 = outp; if (lower & (LCASE_BASE | LCASE_EXT)) msdosfs_iconv->convchr_case(pmp->pm_d2u, (const char **)instr, ilen, (char **)&outp, &olen, KICONV_LOWER); else msdosfs_iconv->convchr(pmp->pm_d2u, (const char **)instr, ilen, (char **)&outp, &olen); + for (i = 0; i < outp - outp1; i++) { + if (outp1[i] == '/') + outp1[i] = '?'; + } len -= olen; /* @@ -826,6 +831,8 @@ dos2unixchr(u_char *outbuf, const u_char **instr, size_t *ilen, int lower, struc c = dos2unix[c]; if (lower & (LCASE_BASE | LCASE_EXT)) c = u2l[c]; + if (c == '/') + c = '?'; *outp++ = c; outbuf[1] = '\0'; } From nobody Thu Jul 24 07:45:08 2025 X-Original-To: dev-commits-src-branches@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 4bnjhh4fS1z628YV; Thu, 24 Jul 2025 07:45:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnjhh3CcHz3rTH; Thu, 24 Jul 2025 07:45:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753343108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3bpEQbNh9H7fkK3fMyvI62y+OHHXccXJLCvhikOs+Kg=; b=LHecA6OvG6sXo+HHpesRrAnC7w4QlQL+gHjwa7y9KMPWAHvJ5F1OsDGRLB8T6Y82fmHdbX bi7xeqrYnQ6CpmkDxVqz9wlJ6QH9Ry3URIKAjxuzSzxlxzE2fRPS9+DnZG/ZQ862bbuBLQ LxsHku1w2Vr8Ll4f1dfkDH7/PPFWkC+abBTefTtfzLlSLFC17x3j+pDfj7U04/SS+K1RoJ aNJiQFtKZHBULGqaq4MDEAFWLE9ODcIJ3JkwRe7JYxLNQNUAVfU5b/7qUibjFghTWXvcqk 4iqPP0ASqzFg0Wfd5SgWbYYRACk66zZ12iElNOkGEGmCfqP+ZPiHDJ70O35aRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753343108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3bpEQbNh9H7fkK3fMyvI62y+OHHXccXJLCvhikOs+Kg=; b=UsasUwZqtfBWMnBX3ezn19VmOLEqkqk9jw8N8mejH+AwOMsNqBwOCaaU23VqNhqvOs0Ab5 ov5brbziA/39W5mgaBQFwnJW/hW1J43XJMemBDcqVb7w5GfPPCJi61x3Uycb7ZgkeCjiaR GKCz+er8F1R9+tSw6DKXWGchBNs+1sGMC7nLmW9JUanbfyVIs8agYWQkR7ls5BKdbAlwAq GUDi18a6Yu1vMALklI5UvhX/HYe2ofoDi6ahoi0xP/I4JzgZ+/8lWcru7UkH4NpQzOQLr7 f376ZG892jWNNAZLd4A73QMoSd7YYWaXTcv3q6I2YET2yGwH/CqDHohlcStQwg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753343108; a=rsa-sha256; cv=none; b=PJMZDAxEOMSF3gWUfERsdji29JZqsa8ybnUg+InKztvI8LmGN5hE7KUUbeCPD7HxcIsk73 EPhNk5Pg9MGh10O+lOET1xrwjAkpHyYwpqt7OGA7TKUpzhfuR6xP4jT13mVcnXU2tnPh2s UArGPuc8M67N1j4lq/yb9mMjBIkWknrwlOCND/2h8smbyNjEx3+BExarmQHaTJhtOiI48c 92oZVuXIy5jquqcb1uAVZkAB6ig+niBgJZ69V5A7XQMA+6udEh+HwUQQEinadKCDAZU9SY i3dgpJbQk/alzY0UFR49SkVKwyHbticvc/k3PACtAauIK6n8yRZArN8Bku7RLA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnjhh2X7rzqRr; Thu, 24 Jul 2025 07:45:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56O7j8jI091177; Thu, 24 Jul 2025 07:45:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56O7j8RZ091174; Thu, 24 Jul 2025 07:45:08 GMT (envelope-from git) Date: Thu, 24 Jul 2025 07:45:08 GMT Message-Id: <202507240745.56O7j8RZ091174@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: ae7fdd715466 - stable/14 - Merge commit 8ac140f39084 from llvm git (by Younan Zhang): List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ae7fdd715466490d91813179475ea103c8c8e30d Auto-Submitted: auto-generated The branch stable/14 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=ae7fdd715466490d91813179475ea103c8c8e30d commit ae7fdd715466490d91813179475ea103c8c8e30d Author: Dimitry Andric AuthorDate: 2025-07-21 16:55:23 +0000 Commit: Dimitry Andric CommitDate: 2025-07-24 07:44:45 +0000 Merge commit 8ac140f39084 from llvm git (by Younan Zhang): [Clang][NFCI] Cleanup the fix for default function argument substitution (#104911) (This is one step towards tweaking `getTemplateInstantiationArgs()` as discussed in https://github.com/llvm/llvm-project/pull/102922) We don't always substitute into default arguments while transforming a function parameter. In that case, we would preserve the uninstantiated expression until after, e.g. building up a CXXDefaultArgExpr and instantiate the expression there. For member function instantiation, this algorithm used to cause a problem in that the default argument of an out-of-line member function specialization couldn't get properly instantiated. This is because, in `getTemplateInstantiationArgs()`, we would give up visiting a function's declaration context if the function is a specialization of a member template. For example, ```cpp template struct S { template void f(T = sizeof(T)); }; template <> template void S::f(int) {} ``` The default argument `sizeof(U)` that lexically appears inside the declaration would be copied to the function declaration in the class template specialization `S`, as well as to the function's out-of-line definition. We use template arguments collected from the out-of-line function definition when substituting into the default arguments. We would therefore give up the traversal after the function, resulting in a single-level template argument of the `f` itself. However the default argument here could still reference the template parameters of the primary template, hence the error. In fact, this is similar to constraint checking in some respects: we actually want the "whole" template arguments relative to the primary template, not those relative to the function definition. So this patch adds another flag to indicate `getTemplateInstantiationArgs()` for that. This patch also consolidates the tests for default arguments and removes some unnecessary tests. This fixes a crash or assertion failure while building tests for the devel/hpx port. PR: 288352 MFC after: 3 days (cherry picked from commit ffc5ee0f57d56459df93f4107b9835ae78a546b5) --- .../llvm-project/clang/include/clang/Sema/Sema.h | 9 ++++++++- .../clang/lib/Sema/SemaTemplateInstantiate.cpp | 23 ++++++++-------------- .../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 10 ++++++---- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/contrib/llvm-project/clang/include/clang/Sema/Sema.h b/contrib/llvm-project/clang/include/clang/Sema/Sema.h index 7bfdaaae45a9..a59a9342341d 100644 --- a/contrib/llvm-project/clang/include/clang/Sema/Sema.h +++ b/contrib/llvm-project/clang/include/clang/Sema/Sema.h @@ -13052,12 +13052,19 @@ public: /// ForConstraintInstantiation indicates we should continue looking when /// encountering a lambda generic call operator, and continue looking for /// arguments on an enclosing class template. + /// + /// \param SkipForSpecialization when specified, any template specializations + /// in a traversal would be ignored. + /// \param ForDefaultArgumentSubstitution indicates we should continue looking + /// when encountering a specialized member function template, rather than + /// returning immediately. MultiLevelTemplateArgumentList getTemplateInstantiationArgs( const NamedDecl *D, const DeclContext *DC = nullptr, bool Final = false, std::optional> Innermost = std::nullopt, bool RelativeToPrimary = false, const FunctionDecl *Pattern = nullptr, bool ForConstraintInstantiation = false, - bool SkipForSpecialization = false); + bool SkipForSpecialization = false, + bool ForDefaultArgumentSubstitution = false); /// RAII object to handle the state changes required to synthesize /// a function body. diff --git a/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp b/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp index a09e3be83c45..c2e8ed0c602e 100644 --- a/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -269,7 +269,8 @@ HandleClassTemplateSpec(const ClassTemplateSpecializationDecl *ClassTemplSpec, Response HandleFunction(Sema &SemaRef, const FunctionDecl *Function, MultiLevelTemplateArgumentList &Result, const FunctionDecl *Pattern, bool RelativeToPrimary, - bool ForConstraintInstantiation) { + bool ForConstraintInstantiation, + bool ForDefaultArgumentSubstitution) { // Add template arguments from a function template specialization. if (!RelativeToPrimary && Function->getTemplateSpecializationKindForInstantiation() == @@ -299,7 +300,8 @@ Response HandleFunction(Sema &SemaRef, const FunctionDecl *Function, // If this function was instantiated from a specialized member that is // a function template, we're done. assert(Function->getPrimaryTemplate() && "No function template?"); - if (Function->getPrimaryTemplate()->isMemberSpecialization()) + if (!ForDefaultArgumentSubstitution && + Function->getPrimaryTemplate()->isMemberSpecialization()) return Response::Done(); // If this function is a generic lambda specialization, we are done. @@ -465,7 +467,7 @@ MultiLevelTemplateArgumentList Sema::getTemplateInstantiationArgs( const NamedDecl *ND, const DeclContext *DC, bool Final, std::optional> Innermost, bool RelativeToPrimary, const FunctionDecl *Pattern, bool ForConstraintInstantiation, - bool SkipForSpecialization) { + bool SkipForSpecialization, bool ForDefaultArgumentSubstitution) { assert((ND || DC) && "Can't find arguments for a decl if one isn't provided"); // Accumulate the set of template argument lists in this structure. MultiLevelTemplateArgumentList Result; @@ -507,7 +509,8 @@ MultiLevelTemplateArgumentList Sema::getTemplateInstantiationArgs( SkipForSpecialization); } else if (const auto *Function = dyn_cast(CurDecl)) { R = HandleFunction(*this, Function, Result, Pattern, RelativeToPrimary, - ForConstraintInstantiation); + ForConstraintInstantiation, + ForDefaultArgumentSubstitution); } else if (const auto *Rec = dyn_cast(CurDecl)) { R = HandleRecordDecl(*this, Rec, Result, Context, ForConstraintInstantiation); @@ -3231,7 +3234,6 @@ bool Sema::SubstDefaultArgument( // default argument expression appears. ContextRAII SavedContext(*this, FD); std::unique_ptr LIS; - MultiLevelTemplateArgumentList NewTemplateArgs = TemplateArgs; if (ForCallExpr) { // When instantiating a default argument due to use in a call expression, @@ -3244,19 +3246,10 @@ bool Sema::SubstDefaultArgument( /*ForDefinition*/ false); if (addInstantiatedParametersToScope(FD, PatternFD, *LIS, TemplateArgs)) return true; - const FunctionTemplateDecl *PrimaryTemplate = FD->getPrimaryTemplate(); - if (PrimaryTemplate && PrimaryTemplate->isOutOfLine()) { - TemplateArgumentList *CurrentTemplateArgumentList = - TemplateArgumentList::CreateCopy(getASTContext(), - TemplateArgs.getInnermost()); - NewTemplateArgs = getTemplateInstantiationArgs( - FD, FD->getDeclContext(), /*Final=*/false, - CurrentTemplateArgumentList->asArray(), /*RelativeToPrimary=*/true); - } } runWithSufficientStackSpace(Loc, [&] { - Result = SubstInitializer(PatternExpr, NewTemplateArgs, + Result = SubstInitializer(PatternExpr, TemplateArgs, /*DirectInit*/ false); }); } diff --git a/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index a12d2eff1d2c..614e6ea12541 100644 --- a/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -4659,10 +4659,12 @@ bool Sema::InstantiateDefaultArgument(SourceLocation CallLoc, FunctionDecl *FD, // // template // A Foo(int a = A::FooImpl()); - MultiLevelTemplateArgumentList TemplateArgs = - getTemplateInstantiationArgs(FD, FD->getLexicalDeclContext(), - /*Final=*/false, /*Innermost=*/std::nullopt, - /*RelativeToPrimary=*/true); + MultiLevelTemplateArgumentList TemplateArgs = getTemplateInstantiationArgs( + FD, FD->getLexicalDeclContext(), + /*Final=*/false, /*Innermost=*/std::nullopt, + /*RelativeToPrimary=*/true, /*Pattern=*/nullptr, + /*ForConstraintInstantiation=*/false, /*SkipForSpecialization=*/false, + /*ForDefaultArgumentSubstitution=*/true); if (SubstDefaultArgument(CallLoc, Param, TemplateArgs, /*ForCallExpr*/ true)) return true; From nobody Thu Jul 24 07:45:25 2025 X-Original-To: dev-commits-src-branches@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 4bnjj227D0z6298S; Thu, 24 Jul 2025 07:45:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnjj211Hrz3rkj; Thu, 24 Jul 2025 07:45:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753343126; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4fdS76CtSt461P0nOerNsMdxC+cyXdaDviLHSeoqye4=; b=TZY1+U63jKr9K+1+uUH7EvlfxDmp7/UyOzdlMGzw8HP1ETOzjqGlcDXxlPEr2sAQD0dxZm ioM+lBVAqC0UtDViuCrDvXXwaXkDqUxgRWtLpJi+o3mb9+/hj26iQ9rV9YcRjW9m6M1IqG SDiAbDTzADPJk+pDcJCCuCJwExQr+xqNqXTt/mglDMThS/aw0wL3p5wGjcfOhVy2UALfP3 9ThEFc+WnM5+Wzlx+ZO7BO7ivHein+cTPXekBfbI1VJeDDiW06CczhEgkfzSGF7ofke3oD JHQiO+heFI/Y3PwQoOsKzzdkEqjyGNmQfqFJvGERZBcWqPanVhMhIrvhyyX1uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753343126; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4fdS76CtSt461P0nOerNsMdxC+cyXdaDviLHSeoqye4=; b=LqqYW1grfLvfUYbt2BmaDcwRCM2hfi4sQWfwQ/pQtJAndXTr2OJ62Lc/d8X564wSYS7YZa RI3QcKjveTrlu/OPJPd9+O58UaKIHqL3jfNB16mARIXQNottgdJwtAh5MWWXi7FtkiacE6 eSYd9Hg6/LNfnOEdIPGwo42C1uoQYh/tg37JvN6atrJ2GlQ6z/gzu3qesA209HiYAQGZlS UQcfzfQYgw9gejHLqe5dexDQeffgvBhxU0s7/A81O5I340GBdQcNdo6ogz/Te/LBt2qkFR J/MXD8ABUsqtweRH75z0nXbXLyUBm+qg4JywvtMR0U4gynTaBn+mDMhlbGCwMQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753343126; a=rsa-sha256; cv=none; b=u3NhuujdgNQ0P1JzguqizWO6u4v2CZiycatoGj1Mr4OEf8xKNOSAeOVpb0lXdlGtF/0gwW aZoTZcJgw/jpO5NtFUDiHy7fiDkhtK22paQ1pFqgKXJdrd9ZXm5zD0e/Yv/O/OO89a4eOU rAeterN47IYfO9UH55Qv8dDz2CNwCa7xVrVr5mrrE1J9DYhIE1ds7MlWDebIwIAmGlsIek MkHi58cirS4xnGJMXpWbtCWl77EgD3R7smF+GKiX2tt9LSWv2W9VG0EtCO/1U6GlCPeMgM xBdE0kCDu0/MI9lUxGsBuRQxT/PfEtHsW8DnbCGvv4QfC4Q3z+EmDcbvuptFbA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnjj20cH7zqgs; Thu, 24 Jul 2025 07:45:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56O7jP0U091370; Thu, 24 Jul 2025 07:45:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56O7jPRc091367; Thu, 24 Jul 2025 07:45:25 GMT (envelope-from git) Date: Thu, 24 Jul 2025 07:45:25 GMT Message-Id: <202507240745.56O7jPRc091367@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: e5fcb8c32fbd - stable/13 - Merge commit 8ac140f39084 from llvm git (by Younan Zhang): List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e5fcb8c32fbdf7208ab5e2b250bec6686141dfc7 Auto-Submitted: auto-generated The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=e5fcb8c32fbdf7208ab5e2b250bec6686141dfc7 commit e5fcb8c32fbdf7208ab5e2b250bec6686141dfc7 Author: Dimitry Andric AuthorDate: 2025-07-21 16:55:23 +0000 Commit: Dimitry Andric CommitDate: 2025-07-24 07:44:49 +0000 Merge commit 8ac140f39084 from llvm git (by Younan Zhang): [Clang][NFCI] Cleanup the fix for default function argument substitution (#104911) (This is one step towards tweaking `getTemplateInstantiationArgs()` as discussed in https://github.com/llvm/llvm-project/pull/102922) We don't always substitute into default arguments while transforming a function parameter. In that case, we would preserve the uninstantiated expression until after, e.g. building up a CXXDefaultArgExpr and instantiate the expression there. For member function instantiation, this algorithm used to cause a problem in that the default argument of an out-of-line member function specialization couldn't get properly instantiated. This is because, in `getTemplateInstantiationArgs()`, we would give up visiting a function's declaration context if the function is a specialization of a member template. For example, ```cpp template struct S { template void f(T = sizeof(T)); }; template <> template void S::f(int) {} ``` The default argument `sizeof(U)` that lexically appears inside the declaration would be copied to the function declaration in the class template specialization `S`, as well as to the function's out-of-line definition. We use template arguments collected from the out-of-line function definition when substituting into the default arguments. We would therefore give up the traversal after the function, resulting in a single-level template argument of the `f` itself. However the default argument here could still reference the template parameters of the primary template, hence the error. In fact, this is similar to constraint checking in some respects: we actually want the "whole" template arguments relative to the primary template, not those relative to the function definition. So this patch adds another flag to indicate `getTemplateInstantiationArgs()` for that. This patch also consolidates the tests for default arguments and removes some unnecessary tests. This fixes a crash or assertion failure while building tests for the devel/hpx port. PR: 288352 MFC after: 3 days (cherry picked from commit ffc5ee0f57d56459df93f4107b9835ae78a546b5) --- .../llvm-project/clang/include/clang/Sema/Sema.h | 9 ++++++++- .../clang/lib/Sema/SemaTemplateInstantiate.cpp | 23 ++++++++-------------- .../clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 10 ++++++---- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/contrib/llvm-project/clang/include/clang/Sema/Sema.h b/contrib/llvm-project/clang/include/clang/Sema/Sema.h index 7bfdaaae45a9..a59a9342341d 100644 --- a/contrib/llvm-project/clang/include/clang/Sema/Sema.h +++ b/contrib/llvm-project/clang/include/clang/Sema/Sema.h @@ -13052,12 +13052,19 @@ public: /// ForConstraintInstantiation indicates we should continue looking when /// encountering a lambda generic call operator, and continue looking for /// arguments on an enclosing class template. + /// + /// \param SkipForSpecialization when specified, any template specializations + /// in a traversal would be ignored. + /// \param ForDefaultArgumentSubstitution indicates we should continue looking + /// when encountering a specialized member function template, rather than + /// returning immediately. MultiLevelTemplateArgumentList getTemplateInstantiationArgs( const NamedDecl *D, const DeclContext *DC = nullptr, bool Final = false, std::optional> Innermost = std::nullopt, bool RelativeToPrimary = false, const FunctionDecl *Pattern = nullptr, bool ForConstraintInstantiation = false, - bool SkipForSpecialization = false); + bool SkipForSpecialization = false, + bool ForDefaultArgumentSubstitution = false); /// RAII object to handle the state changes required to synthesize /// a function body. diff --git a/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp b/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp index a09e3be83c45..c2e8ed0c602e 100644 --- a/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -269,7 +269,8 @@ HandleClassTemplateSpec(const ClassTemplateSpecializationDecl *ClassTemplSpec, Response HandleFunction(Sema &SemaRef, const FunctionDecl *Function, MultiLevelTemplateArgumentList &Result, const FunctionDecl *Pattern, bool RelativeToPrimary, - bool ForConstraintInstantiation) { + bool ForConstraintInstantiation, + bool ForDefaultArgumentSubstitution) { // Add template arguments from a function template specialization. if (!RelativeToPrimary && Function->getTemplateSpecializationKindForInstantiation() == @@ -299,7 +300,8 @@ Response HandleFunction(Sema &SemaRef, const FunctionDecl *Function, // If this function was instantiated from a specialized member that is // a function template, we're done. assert(Function->getPrimaryTemplate() && "No function template?"); - if (Function->getPrimaryTemplate()->isMemberSpecialization()) + if (!ForDefaultArgumentSubstitution && + Function->getPrimaryTemplate()->isMemberSpecialization()) return Response::Done(); // If this function is a generic lambda specialization, we are done. @@ -465,7 +467,7 @@ MultiLevelTemplateArgumentList Sema::getTemplateInstantiationArgs( const NamedDecl *ND, const DeclContext *DC, bool Final, std::optional> Innermost, bool RelativeToPrimary, const FunctionDecl *Pattern, bool ForConstraintInstantiation, - bool SkipForSpecialization) { + bool SkipForSpecialization, bool ForDefaultArgumentSubstitution) { assert((ND || DC) && "Can't find arguments for a decl if one isn't provided"); // Accumulate the set of template argument lists in this structure. MultiLevelTemplateArgumentList Result; @@ -507,7 +509,8 @@ MultiLevelTemplateArgumentList Sema::getTemplateInstantiationArgs( SkipForSpecialization); } else if (const auto *Function = dyn_cast(CurDecl)) { R = HandleFunction(*this, Function, Result, Pattern, RelativeToPrimary, - ForConstraintInstantiation); + ForConstraintInstantiation, + ForDefaultArgumentSubstitution); } else if (const auto *Rec = dyn_cast(CurDecl)) { R = HandleRecordDecl(*this, Rec, Result, Context, ForConstraintInstantiation); @@ -3231,7 +3234,6 @@ bool Sema::SubstDefaultArgument( // default argument expression appears. ContextRAII SavedContext(*this, FD); std::unique_ptr LIS; - MultiLevelTemplateArgumentList NewTemplateArgs = TemplateArgs; if (ForCallExpr) { // When instantiating a default argument due to use in a call expression, @@ -3244,19 +3246,10 @@ bool Sema::SubstDefaultArgument( /*ForDefinition*/ false); if (addInstantiatedParametersToScope(FD, PatternFD, *LIS, TemplateArgs)) return true; - const FunctionTemplateDecl *PrimaryTemplate = FD->getPrimaryTemplate(); - if (PrimaryTemplate && PrimaryTemplate->isOutOfLine()) { - TemplateArgumentList *CurrentTemplateArgumentList = - TemplateArgumentList::CreateCopy(getASTContext(), - TemplateArgs.getInnermost()); - NewTemplateArgs = getTemplateInstantiationArgs( - FD, FD->getDeclContext(), /*Final=*/false, - CurrentTemplateArgumentList->asArray(), /*RelativeToPrimary=*/true); - } } runWithSufficientStackSpace(Loc, [&] { - Result = SubstInitializer(PatternExpr, NewTemplateArgs, + Result = SubstInitializer(PatternExpr, TemplateArgs, /*DirectInit*/ false); }); } diff --git a/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index a12d2eff1d2c..614e6ea12541 100644 --- a/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -4659,10 +4659,12 @@ bool Sema::InstantiateDefaultArgument(SourceLocation CallLoc, FunctionDecl *FD, // // template // A Foo(int a = A::FooImpl()); - MultiLevelTemplateArgumentList TemplateArgs = - getTemplateInstantiationArgs(FD, FD->getLexicalDeclContext(), - /*Final=*/false, /*Innermost=*/std::nullopt, - /*RelativeToPrimary=*/true); + MultiLevelTemplateArgumentList TemplateArgs = getTemplateInstantiationArgs( + FD, FD->getLexicalDeclContext(), + /*Final=*/false, /*Innermost=*/std::nullopt, + /*RelativeToPrimary=*/true, /*Pattern=*/nullptr, + /*ForConstraintInstantiation=*/false, /*SkipForSpecialization=*/false, + /*ForDefaultArgumentSubstitution=*/true); if (SubstDefaultArgument(CallLoc, Param, TemplateArgs, /*ForCallExpr*/ true)) return true; From nobody Thu Jul 24 13:02:39 2025 X-Original-To: dev-commits-src-branches@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 4bnrl34pqSz62TqW; Thu, 24 Jul 2025 13:02:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnrl337Slz3TCD; Thu, 24 Jul 2025 13:02:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753362159; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qQ1xiltlmdcR42GMc5Q+G6i5BIzvvjolI4yfFrCJHNo=; b=cTM26BBgoU372QqXDt67VeFFSXZne28yd5glP0d1eXndoAJURcOJYmhG4A0utuT9g8X/ym 1qXAC3zUr8mbiRyA/VRVOzDyZHFloSqh3QLPkMDBoMKQpwNzG8NMrACSnDWu2ZfhgZ3SHk NOEv0lqLMmFrb/fA/3V0aUWh7sS/n3DNfWzT1zJ5mkvi2hUGvrmRzqCPPZqeiG7lv7aTnU Dt8S/tdw4qVHjOm4gRZt1h/Gv5a66EdMbuEKodG8XsgcSOdL+mT9DKHl67dVoxnq20wK7z 1ylZLvarPCma4Wf7bxNreEfOQrFqPoQaYAawS5kED+1knN4iA0wxBIvwz8najw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753362159; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qQ1xiltlmdcR42GMc5Q+G6i5BIzvvjolI4yfFrCJHNo=; b=XAf4FZXiZGkvTRNDCpf5N8hVDVvYh3XsQ9cq80wmxxuHa02iwH3RRaJUctnfkXLuwwzEx+ r4FgTKBoZdsijg5d97uIAkL7WK3udDBSrLkbRytsRPqJC8NvuJuCIcvX3shWIeG5NwpUeP NV3CqezDBvY0SKlyhs+IM3GP4rXRCLhLcxWVyh/vVHVvj0+cj5th75uBbURfhmiOOWSOrq Rl8VeZrGYm43a34UVdIAUZuyAuvuyCMZqUJ8TKnBZAWmu2yGhaPGr/LJNi5HNGaVk1uLGL CsbZpBEhO1owdzDVCOKwFRRZJbRLQ2MtxStDe+b3lwE+oAoO3NFDpj3L3eUJ4Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753362159; a=rsa-sha256; cv=none; b=S6vzWNYH3aWKqdVAOhmzTfnZ8PH4NFmR9Q/GslXImk2kmd9H4wA4UGnlVkg9sORD4yBtn3 3kVqZcKkJ70K9fmZG034lgOWavKPbqfaPpmMk+SQJuqoM7Lr9NgiFFJsflcWiziORMgOwT 7GHr8kN5kE+NaB3Il4n3pFYfDlXegB8ciPGXH0Juc54pm/+dvSNA2tY0chbGcbnK1B2lGt tABq/DnKK784NzUPYry/bPJ9mkvn3XjjZFOaKH70HmYUuTWRU8fXdDq6FNrucsWSa6tg0/ xAG5Hoc4nLkMonoVIqbqqPablqSM+kEhYBk+VEMV6Wy7h3rGibcR8m/WRwnvCw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnrl32lVmz10my; Thu, 24 Jul 2025 13:02:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56OD2d6c001627; Thu, 24 Jul 2025 13:02:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56OD2dSf001624; Thu, 24 Jul 2025 13:02:39 GMT (envelope-from git) Date: Thu, 24 Jul 2025 13:02:39 GMT Message-Id: <202507241302.56OD2dSf001624@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: a7b4e2e9d0ca - stable/13 - kyua: Try harder to delete directories. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a7b4e2e9d0caddf72c1cbe9e8e36b2edcbbbbff3 Auto-Submitted: auto-generated The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=a7b4e2e9d0caddf72c1cbe9e8e36b2edcbbbbff3 commit a7b4e2e9d0caddf72c1cbe9e8e36b2edcbbbbff3 Author: Dag-Erling Smørgrav AuthorDate: 2025-07-09 20:28:47 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-07-24 13:02:12 +0000 kyua: Try harder to delete directories. When recursing into a directory to delete it, start by chmod'ing it to 0700. This fixes an issue where kyua is able to run, but not debug, a test case that creates unwriteable directories, because when debugging it tries (and fails) to delete the directory after the test completes. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: igoro Differential Revision: https://reviews.freebsd.org/D51229 (cherry picked from commit 9bf14f2a475e221c48488984dc5a02a4608bb877) --- contrib/kyua/utils/fs/operations.cpp | 2 ++ contrib/kyua/utils/fs/operations_test.cpp | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/contrib/kyua/utils/fs/operations.cpp b/contrib/kyua/utils/fs/operations.cpp index 7a96d0b2058a..185d164b88d7 100644 --- a/contrib/kyua/utils/fs/operations.cpp +++ b/contrib/kyua/utils/fs/operations.cpp @@ -692,6 +692,7 @@ fs::rm_r(const fs::path& directory) { const fs::directory dir(directory); + ::chmod(directory.c_str(), 0700); for (fs::directory::const_iterator iter = dir.begin(); iter != dir.end(); ++iter) { if (iter->name == "." || iter->name == "..") @@ -701,6 +702,7 @@ fs::rm_r(const fs::path& directory) if (fs::is_directory(entry)) { LD(F("Descending into %s") % entry); + ::chmod(entry.c_str(), 0700); fs::rm_r(entry); } else { LD(F("Removing file %s") % entry); diff --git a/contrib/kyua/utils/fs/operations_test.cpp b/contrib/kyua/utils/fs/operations_test.cpp index f1349351166e..6f0fa52811c9 100644 --- a/contrib/kyua/utils/fs/operations_test.cpp +++ b/contrib/kyua/utils/fs/operations_test.cpp @@ -664,6 +664,19 @@ ATF_TEST_CASE_BODY(rm_r__files_and_directories) } +ATF_TEST_CASE_WITHOUT_HEAD(rm_r__bad_perms); +ATF_TEST_CASE_BODY(rm_r__bad_perms) +{ + fs::mkdir(fs::path("root"), 0755); + fs::mkdir(fs::path("root/dir"), 0755); + atf::utils::create_file("root/dir/file", ""); + ::chmod(fs::path("root/dir").c_str(), 0000); + ATF_REQUIRE(lookup(".", "root", S_IFDIR)); + fs::rm_r(fs::path("root")); + ATF_REQUIRE(!lookup(".", "root", S_IFDIR)); +} + + ATF_TEST_CASE_WITHOUT_HEAD(rmdir__ok) ATF_TEST_CASE_BODY(rmdir__ok) { @@ -811,6 +824,7 @@ ATF_INIT_TEST_CASES(tcs) ATF_ADD_TEST_CASE(tcs, rm_r__empty); ATF_ADD_TEST_CASE(tcs, rm_r__files_and_directories); + ATF_ADD_TEST_CASE(tcs, rm_r__bad_perms); ATF_ADD_TEST_CASE(tcs, rmdir__ok); ATF_ADD_TEST_CASE(tcs, rmdir__fail); From nobody Thu Jul 24 13:02:40 2025 X-Original-To: dev-commits-src-branches@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 4bnrl46R3Wz62Tds; Thu, 24 Jul 2025 13:02:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnrl44Kkjz3T9K; Thu, 24 Jul 2025 13:02:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753362160; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nwTodgoQ9QdfycpG4alokaVxgV7nDfrUfd3UV4+wgtw=; b=diMJJHvVP/915H1sEda7868Oz/WkxdbbCBc0Ko4YRhbE8aheOoR5i+5Xoqbi3kPnPQ1WHC 9Hn3UzLD8IuvyiirsXw0cmBZGU3XSItMpO74YPY7gvE9h5pXtisCPjgIMa4GAnlqKacFKm aQZJBYZ1osdPykFm+NyaW+jLmM9G0Qscyh/RPokvTB68XRqkCD1GjcjTyZO5Eymn76lmLG Vx2cft18I2c3xzdTExz25rbdZgY67Anh/lBll9ADVlRXOHqa1vGJeGixjdS5OyG8sVkUSP xoL3xNaA1IdakISdBhK3S0ZdpIev4uNylZOpoSAPM+mC/Km1Y37GERwkL5QC3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753362160; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nwTodgoQ9QdfycpG4alokaVxgV7nDfrUfd3UV4+wgtw=; b=a/GDdrn1zluQsHogAUlymvlSRZKyuPmkHIYpxdeQ/D85OA7bn1fhaCTt3aehCA1VFZmFXF Yrbuur2ukDuLDlU2q6KsBjrk6sJi7UAGmlLyjy7SIJKBJqvt0yfEs11g/qYXPBz3ceYPRg W8wda0bxIXAK/ge03iNSRWa0UFqJbQy6fzIwyDk6OFf3zA4tlfM9/0uezAerYFvnEw2+Lq ExiNmAQz95CnMFXyRjc6IeQp+T7t32AjmLK5yksurmsyCWzvjYuEql6ebRUv+kuGfQt2S6 JG0DxYgtiJCTDzFQpr3FungdNMQeCI12J+xRWfaB0UiBNbyk6m7WaC8Nxl2B0A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753362160; a=rsa-sha256; cv=none; b=RfVqQzh1/w3SJZ1sZDs/f+3jZWaXSjnohFSA3mu6F+/jsuJ995fO30YTj+Zyd4k+Isu3pb pRozFesFGTypyR1RGuyNvMtinSeETezJIu9Blrx4sKEIa1HWgkNXhvtgKZWv2rQ2qHKoA+ 2jo9+0cxLIbxYLlsTh/Cyu7aKOobbcSqGSE7x+CTGl7BckiETs+jZJDBihc30YAs9m9eXP UJi4D/B+MuKegnpJQfpzcpFJhyDHBno/X7eeHfOnHWQmOiDtHslgagzu2hxpP/zQ9UyKFU sd3ZK7RM+BDu12p7t6Ex6bL7+YgAUVijY9MgwobDVS/zkVGq49/lrhuifO728w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnrl43lFPz10Cd; Thu, 24 Jul 2025 13:02:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56OD2eYZ001665; Thu, 24 Jul 2025 13:02:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56OD2esR001662; Thu, 24 Jul 2025 13:02:40 GMT (envelope-from git) Date: Thu, 24 Jul 2025 13:02:40 GMT Message-Id: <202507241302.56OD2esR001662@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 4cafd1021a5b - stable/13 - udf: Improve input validation. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4cafd1021a5b6002812f4446794541eab8c08534 Auto-Submitted: auto-generated The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=4cafd1021a5b6002812f4446794541eab8c08534 commit 4cafd1021a5b6002812f4446794541eab8c08534 Author: Dag-Erling Smørgrav AuthorDate: 2025-07-16 19:33:24 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-07-24 13:02:12 +0000 udf: Improve input validation. The existing code frequently assigns unsigned 64-bit values to variables that are signed and / or shorter without checking for overflow. Try to deal with these cases. While here, fix two structs that used single-element arrays in place of flexible array members. PR: 287896 MFC after: 1 week Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D51339 (cherry picked from commit 55f80afa17e8926f69660f19631194bcf7fa66f4) --- sys/fs/udf/ecma167-udf.h | 4 ++-- sys/fs/udf/udf_vfsops.c | 7 ++++++- sys/fs/udf/udf_vnops.c | 48 ++++++++++++++++++++++++++++++++++++------------ 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/sys/fs/udf/ecma167-udf.h b/sys/fs/udf/ecma167-udf.h index 839bbec08254..19e114763cac 100644 --- a/sys/fs/udf/ecma167-udf.h +++ b/sys/fs/udf/ecma167-udf.h @@ -243,7 +243,7 @@ struct part_map_spare { uint8_t n_st; /* Number of Sparing Tables */ uint8_t reserved1; uint32_t st_size; - uint32_t st_loc[1]; + uint32_t st_loc[]; } __packed; union udf_pmap { @@ -266,7 +266,7 @@ struct udf_sparing_table { uint16_t rt_l; /* Relocation Table len */ uint8_t reserved[2]; uint32_t seq_num; - struct spare_map_entry entries[1]; + struct spare_map_entry entries[]; } __packed; /* Partition Descriptor [3/10.5] */ diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c index 4c9208642dea..cebc136b418a 100644 --- a/sys/fs/udf/udf_vfsops.c +++ b/sys/fs/udf/udf_vfsops.c @@ -81,6 +81,7 @@ #include #include #include +#include #include #include #include @@ -739,7 +740,7 @@ udf_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp) struct ifid *ifhp; struct vnode *nvp; struct udf_node *np; - off_t fsize; + uint64_t fsize; int error; ifhp = (struct ifid *)fhp; @@ -751,6 +752,10 @@ udf_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp) np = VTON(nvp); fsize = le64toh(np->fentry->inf_len); + if (fsize > OFF_MAX) { + *vpp = NULLVP; + return (EIO); + } *vpp = nvp; vnode_create_vobject(*vpp, fsize, curthread); diff --git a/sys/fs/udf/udf_vnops.c b/sys/fs/udf/udf_vnops.c index d85bb9970913..8051b1e24d22 100644 --- a/sys/fs/udf/udf_vnops.c +++ b/sys/fs/udf/udf_vnops.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -182,11 +183,14 @@ udf_access(struct vop_access_args *a) } static int -udf_open(struct vop_open_args *ap) { +udf_open(struct vop_open_args *ap) +{ struct udf_node *np = VTON(ap->a_vp); - off_t fsize; + uint64_t fsize; fsize = le64toh(np->fentry->inf_len); + if (fsize > OFF_MAX) + return (EIO); vnode_create_vobject(ap->a_vp, fsize, ap->a_td); return 0; } @@ -317,12 +321,13 @@ udf_getattr(struct vop_getattr_args *a) * that directories consume at least one logical block, * make it appear so. */ - if (fentry->logblks_rec != 0) { - vap->va_size = - le64toh(fentry->logblks_rec) * node->udfmp->bsize; - } else { + vap->va_size = le64toh(fentry->logblks_rec); + if (vap->va_size == 0) vap->va_size = node->udfmp->bsize; - } + else if (vap->va_size > UINT64_MAX / node->udfmp->bsize) + vap->va_size = UINT64_MAX; + else + vap->va_size *= node->udfmp->bsize; } else { vap->va_size = le64toh(fentry->inf_len); } @@ -449,6 +454,7 @@ udf_read(struct vop_read_args *ap) struct buf *bp; uint8_t *data; daddr_t lbn, rablock; + uint64_t len; off_t diff, fsize; ssize_t n; int error = 0; @@ -474,7 +480,12 @@ udf_read(struct vop_read_args *ap) return (error); } - fsize = le64toh(node->fentry->inf_len); + len = le64toh(node->fentry->inf_len); + if (len > OFF_MAX) { + /* too big, just cap to the requested length */ + len = uio->uio_resid; + } + fsize = len; udfmp = node->udfmp; do { lbn = lblkno(udfmp, uio->uio_offset); @@ -786,6 +797,7 @@ udf_readdir(struct vop_readdir_args *a) struct udf_uiodir uiodir; struct udf_dirstream *ds; u_long *cookies = NULL; + uint64_t len; int ncookies; int error = 0; @@ -815,8 +827,12 @@ udf_readdir(struct vop_readdir_args *a) * Iterate through the file id descriptors. Give the parent dir * entry special attention. */ - ds = udf_opendir(node, uio->uio_offset, le64toh(node->fentry->inf_len), - node->udfmp); + len = le64toh(node->fentry->inf_len); + if (len > INT_MAX) { + /* too big, just cap to INT_MAX */ + len = INT_MAX; + } + ds = udf_opendir(node, uio->uio_offset, len, node->udfmp); while ((fid = udf_getfid(ds)) != NULL) { /* XXX Should we return an error on a bad fid? */ @@ -908,7 +924,8 @@ udf_readlink(struct vop_readlink_args *ap) struct udf_node *node; void *buf; char *cp; - int error, len, root; + uint64_t len; + int error, root; /* * A symbolic link in UDF is a list of variable-length path @@ -918,6 +935,8 @@ udf_readlink(struct vop_readlink_args *ap) vp = ap->a_vp; node = VTON(vp); len = le64toh(node->fentry->inf_len); + if (len > MAXPATHLEN) + return (EIO); buf = malloc(len, M_DEVBUF, M_WAITOK); iov[0].iov_len = len; iov[0].iov_base = buf; @@ -1120,13 +1139,14 @@ udf_lookup(struct vop_cachedlookup_args *a) struct udf_mnt *udfmp; struct fileid_desc *fid = NULL; struct udf_dirstream *ds; + uint64_t fsize; u_long nameiop; u_long flags; char *nameptr; long namelen; ino_t id = 0; int offset, error = 0; - int fsize, lkflags, ltype, numdirpasses; + int lkflags, ltype, numdirpasses; dvp = a->a_dvp; node = VTON(dvp); @@ -1137,6 +1157,10 @@ udf_lookup(struct vop_cachedlookup_args *a) nameptr = a->a_cnp->cn_nameptr; namelen = a->a_cnp->cn_namelen; fsize = le64toh(node->fentry->inf_len); + if (fsize > INT_MAX) { + /* too big, just cap to INT_MAX */ + fsize = INT_MAX; + } /* * If this is a LOOKUP and we've already partially searched through From nobody Thu Jul 24 13:02:41 2025 X-Original-To: dev-commits-src-branches@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 4bnrl60znJz62VHm; Thu, 24 Jul 2025 13:02:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnrl55Cj8z3TNg; Thu, 24 Jul 2025 13:02:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753362161; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=USaEQd1XdCMF3W5Yx5nEG2GFFaTXuH8wG1KJUmm+GnA=; b=f2x295k7A+gRqbuYFAuv9pGi70Kn5N5fSQ0fb3liXAWzgu+DThLFQ0DY7VdfNBa+2bfAH8 El62NFjd0vt0EpW/vCvWb53dLbtvZpqY/3bPhI0l8zyNT30Z1oTioRnHB8bYcp7JN3aeGd jSL6sxwYfTNIlm1UC3J6AMTDnWOrXEC2yW3QFJXl4d4qxxpAE0UQ61TzFmH+HcKwZFDRUl nC4l9NiVAhzV4Yu/q/YUTHBc8C+dYIHgnlKTrjX5U5JFQ+YHOoNqIN/lZCXPCbNrIAlujP QhRpeS9COn0Ksuz2leh3uWDveG7aXBcK+8aCkYWf8uSfly3fKTgXk2awDvkiNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753362161; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=USaEQd1XdCMF3W5Yx5nEG2GFFaTXuH8wG1KJUmm+GnA=; b=SZ+No8m3FM3Kqd+ggDqdLEQOe4UNaE83xcPlbGSrz2fBuBXEo46hmiB+Eq9PrgwT45CDaE 7m00oAdLNoeHyQ7K2IxJavZZmT20uXteT1h0dqJokuQdpjSFfYBQ2ZjlHsK873Ui6v2wZw 8ymrwS3JUys1s3kw2fdTFDVyxf2HXJldMk1wFPDCJ4ir4N2u26vj65KsApvd83ERE+DLoj 8oU54WWmfwgu8N1g5OvuzJGV46p/tsAOexq05nP3ASkMG859+EMtMJTwDj0704o1a+0sqj jQLdKRE4Rvm8rJ3I+FlZyCFLIdZ9TzqFc7yeaVSEiYGlYebwix86JHZrvgZy6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753362161; a=rsa-sha256; cv=none; b=vcx5n8M494buu6n82D40IUYnjbHmUc4lFd9QcUQViYVCvMGzyPnSyNrewpg8B/d2jBbR3C 2EjUJG1McXhDTNiqQBOIj+641wZLKbYhHxb7Xk7vZhi/pa/Ta+CVCMI16rpcqoQr3e5lXI jnVZLm9g04TjvV53ZPeoNNZtSMTCz4Bae+dPY4AhMsLTTwYRaoQaewhNDHig8iMOR9cecF aPOGUCdz3UGOm3puBbGsXZLfSXvwGg5XXywEBe9/a9YRZRAfusIR6ZRc9f3q7PlTz9IZPG uprJPVtPtRyRmT2mGfQ2ZhayXq/a0bSWs5IRbEBxglGdll0Z8zGjJRYLwnqAYQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnrl54fsLz10VX; Thu, 24 Jul 2025 13:02:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56OD2fc3001703; Thu, 24 Jul 2025 13:02:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56OD2fQB001700; Thu, 24 Jul 2025 13:02:41 GMT (envelope-from git) Date: Thu, 24 Jul 2025 13:02:41 GMT Message-Id: <202507241302.56OD2fQB001700@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: b86c6997047e - stable/13 - tzcode: Fix time zone change detection. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b86c6997047e6caee085b05dcc864f7878db3b69 Auto-Submitted: auto-generated The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=b86c6997047e6caee085b05dcc864f7878db3b69 commit b86c6997047e6caee085b05dcc864f7878db3b69 Author: Dag-Erling Smørgrav AuthorDate: 2025-07-18 17:48:59 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-07-24 13:02:13 +0000 tzcode: Fix time zone change detection. Prior to the 2022g import, tzloadbody() returned -1 on error. Now it returns an errno code. When I updated the time zone change detection logic to match, I improperly returned errno in all cases, which means that if the time zone file has not changed since we last loaded it, tzloadbody() returns a random errno value instead of 0. Fixes: bc42155199b5 MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51405 (cherry picked from commit d63ffdd1ef6368407b35d415237b95cc739d8073) tzcode: Add an explicit "the timezone file has changed" case This is required for the WITHOUT_DETECT_TZ_CHANGES case, since there the value being tested is a numeric literal. Fixes: d63ffdd1ef63 ("tzcode: Fix time zone change detection.") (cherry picked from commit 0bf113e9041fe20e8c671fe6b2cca8612dc77b77) --- contrib/tzcode/localtime.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/contrib/tzcode/localtime.c b/contrib/tzcode/localtime.c index f5814a43da54..bdec08e4abae 100644 --- a/contrib/tzcode/localtime.c +++ b/contrib/tzcode/localtime.c @@ -408,10 +408,8 @@ change_in_tz(const char *name) static char old_name[PATH_MAX]; static struct stat old_sb; struct stat sb; - int error; - error = stat(name, &sb); - if (error != 0) + if (stat(name, &sb) != 0) return -1; if (strcmp(name, old_name) != 0) { @@ -510,13 +508,13 @@ tzloadbody(char const *name, struct state *sp, bool doextend, * 'doextend' to ignore TZDEFRULES; the change_in_tz() * function can only keep state for a single file. */ - int ret = change_in_tz(name); - if (ret <= 0) { - /* - * Returns an errno value if there was an error, - * and 0 if the timezone had not changed. - */ + switch (change_in_tz(name)) { + case -1: return errno; + case 0: + return 0; + case 1: + break; } } fid = _open(name, O_RDONLY | O_BINARY); From nobody Thu Jul 24 13:02:59 2025 X-Original-To: dev-commits-src-branches@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 4bnrlR6HXbz62VHr; Thu, 24 Jul 2025 13:02:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnrlR1rDrz3TnQ; Thu, 24 Jul 2025 13:02:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753362179; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=thgJoZHqlN4EQ/+fAw57AUntWOhHjg2NbHZeTWNAiKA=; b=yJDQxJ3oFRjQTCS5IpCt16f1nweN1Bc6uSJH4F850gmfkMuogzuhsEB1oC9MtuaDCuUnD+ vq+hTUv+AM87Xdb/Fpw9BXVtsSUgg5Waia/OfBnhIyIyVGTx0doWicKEjxhJGuwakuos1d VbtnWVfg99KdO2gI34WLlgv5pRipdFaPCTz2AQ1K7k8E/3tUNwjwPNbaJilV7f3M5j2JJK 9zogmJXcbFDK+dnvAzyAsB2xx31fs7BG4tZ9acWvJ1aFcGuxAlOmU39+UR2yuN0vm8EuZN 0V+omMirTV1ZpXJMLIPgCwd6UXslLNabVIEZpMXLCgoOh4QRWyxx9DMJFkfMTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753362179; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=thgJoZHqlN4EQ/+fAw57AUntWOhHjg2NbHZeTWNAiKA=; b=fbNo35Uw46ApBGsgvXW2JFgTIWxtXNyr4/jBQ3W5Y+f/zJd5cg5Uj/4tza7Ov8Y4Bm7CjV it8UBQP2UJBc7grH7GjJpVZtB0+DkbiSpDY38exALbDq0GOThi1z3dJtxxH1V9G3F6zFBO tLCRTIDTk/14ZapgS1k+WJPOR0cJDNvhGg3v4Bhxph32DM8XxLuji/dGfiiQDHpvlUUHk9 HSDsVIfSsDwW2IML6ygV4kYNTQEjG9mJZKSQxpCT9Vp6s7QSMB+D0ymoOATQfYkAIQE3jH ZdUzi6A9IISzZnHENUdDHcquHaqqdLY4vljegXE0Zo5fsZrol2Bhb/EcZrpHYw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753362179; a=rsa-sha256; cv=none; b=XrQXd/xa9DP9VIIpMjVh6XUrcL19phuLUdl43eY1Z/4D2lmgZPbLCAII/4vn/Q9FsIgCu4 DF5Z9bdn2qSnTs/zS6yH8tzOJQObzMEBnA4tkRu+FuIV+UndmKd/K3LVAQZflDOiUWRQEK +Buh1JIU1cbMbE05hzmkqhGxC4VJxzjg7dib/CuyTTI89zgDzdmoyytaliGr8bN/EbbSRf oMvDayzvoT/xsRUR+A3wY4keaCExUy2EX82/6p86K+gsbUaC60pUPA1QAFDw507MtDTlly cy2mpyamC+SkOE1bpKyERoF8Vdeqg2Waa8W8iNEIFFwRND2fLTijJtceH933zQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnrlR1PLjz10Vb; Thu, 24 Jul 2025 13:02:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56OD2x1a002009; Thu, 24 Jul 2025 13:02:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56OD2xTa002005; Thu, 24 Jul 2025 13:02:59 GMT (envelope-from git) Date: Thu, 24 Jul 2025 13:02:59 GMT Message-Id: <202507241302.56OD2xTa002005@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 99dfaac790a3 - stable/14 - udf: Improve input validation. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 99dfaac790a3f252d38d1fbe4b3ec2e19f23127f Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=99dfaac790a3f252d38d1fbe4b3ec2e19f23127f commit 99dfaac790a3f252d38d1fbe4b3ec2e19f23127f Author: Dag-Erling Smørgrav AuthorDate: 2025-07-16 19:33:24 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-07-24 13:02:45 +0000 udf: Improve input validation. The existing code frequently assigns unsigned 64-bit values to variables that are signed and / or shorter without checking for overflow. Try to deal with these cases. While here, fix two structs that used single-element arrays in place of flexible array members. PR: 287896 MFC after: 1 week Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D51339 (cherry picked from commit 55f80afa17e8926f69660f19631194bcf7fa66f4) --- sys/fs/udf/ecma167-udf.h | 4 ++-- sys/fs/udf/udf_vfsops.c | 7 ++++++- sys/fs/udf/udf_vnops.c | 48 ++++++++++++++++++++++++++++++++++++------------ 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/sys/fs/udf/ecma167-udf.h b/sys/fs/udf/ecma167-udf.h index 839bbec08254..19e114763cac 100644 --- a/sys/fs/udf/ecma167-udf.h +++ b/sys/fs/udf/ecma167-udf.h @@ -243,7 +243,7 @@ struct part_map_spare { uint8_t n_st; /* Number of Sparing Tables */ uint8_t reserved1; uint32_t st_size; - uint32_t st_loc[1]; + uint32_t st_loc[]; } __packed; union udf_pmap { @@ -266,7 +266,7 @@ struct udf_sparing_table { uint16_t rt_l; /* Relocation Table len */ uint8_t reserved[2]; uint32_t seq_num; - struct spare_map_entry entries[1]; + struct spare_map_entry entries[]; } __packed; /* Partition Descriptor [3/10.5] */ diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c index c7438147c0a0..c5ef1f686093 100644 --- a/sys/fs/udf/udf_vfsops.c +++ b/sys/fs/udf/udf_vfsops.c @@ -81,6 +81,7 @@ #include #include #include +#include #include #include #include @@ -729,7 +730,7 @@ udf_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp) struct ifid *ifhp; struct vnode *nvp; struct udf_node *np; - off_t fsize; + uint64_t fsize; int error; ifhp = (struct ifid *)fhp; @@ -741,6 +742,10 @@ udf_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp) np = VTON(nvp); fsize = le64toh(np->fentry->inf_len); + if (fsize > OFF_MAX) { + *vpp = NULLVP; + return (EIO); + } *vpp = nvp; vnode_create_vobject(*vpp, fsize, curthread); diff --git a/sys/fs/udf/udf_vnops.c b/sys/fs/udf/udf_vnops.c index 88bf4917a851..37889241e8c3 100644 --- a/sys/fs/udf/udf_vnops.c +++ b/sys/fs/udf/udf_vnops.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -182,11 +183,14 @@ udf_access(struct vop_access_args *a) } static int -udf_open(struct vop_open_args *ap) { +udf_open(struct vop_open_args *ap) +{ struct udf_node *np = VTON(ap->a_vp); - off_t fsize; + uint64_t fsize; fsize = le64toh(np->fentry->inf_len); + if (fsize > OFF_MAX) + return (EIO); vnode_create_vobject(ap->a_vp, fsize, ap->a_td); return 0; } @@ -314,12 +318,13 @@ udf_getattr(struct vop_getattr_args *a) * that directories consume at least one logical block, * make it appear so. */ - if (fentry->logblks_rec != 0) { - vap->va_size = - le64toh(fentry->logblks_rec) * node->udfmp->bsize; - } else { + vap->va_size = le64toh(fentry->logblks_rec); + if (vap->va_size == 0) vap->va_size = node->udfmp->bsize; - } + else if (vap->va_size > UINT64_MAX / node->udfmp->bsize) + vap->va_size = UINT64_MAX; + else + vap->va_size *= node->udfmp->bsize; } else { vap->va_size = le64toh(fentry->inf_len); } @@ -446,6 +451,7 @@ udf_read(struct vop_read_args *ap) struct buf *bp; uint8_t *data; daddr_t lbn, rablock; + uint64_t len; off_t diff, fsize; ssize_t n; int error = 0; @@ -471,7 +477,12 @@ udf_read(struct vop_read_args *ap) return (error); } - fsize = le64toh(node->fentry->inf_len); + len = le64toh(node->fentry->inf_len); + if (len > OFF_MAX) { + /* too big, just cap to the requested length */ + len = uio->uio_resid; + } + fsize = len; udfmp = node->udfmp; do { lbn = lblkno(udfmp, uio->uio_offset); @@ -783,6 +794,7 @@ udf_readdir(struct vop_readdir_args *a) struct udf_uiodir uiodir; struct udf_dirstream *ds; uint64_t *cookies = NULL; + uint64_t len; int ncookies; int error = 0; @@ -811,8 +823,12 @@ udf_readdir(struct vop_readdir_args *a) * Iterate through the file id descriptors. Give the parent dir * entry special attention. */ - ds = udf_opendir(node, uio->uio_offset, le64toh(node->fentry->inf_len), - node->udfmp); + len = le64toh(node->fentry->inf_len); + if (len > INT_MAX) { + /* too big, just cap to INT_MAX */ + len = INT_MAX; + } + ds = udf_opendir(node, uio->uio_offset, len, node->udfmp); while ((fid = udf_getfid(ds)) != NULL) { /* XXX Should we return an error on a bad fid? */ @@ -904,7 +920,8 @@ udf_readlink(struct vop_readlink_args *ap) struct udf_node *node; void *buf; char *cp; - int error, len, root; + uint64_t len; + int error, root; /* * A symbolic link in UDF is a list of variable-length path @@ -914,6 +931,8 @@ udf_readlink(struct vop_readlink_args *ap) vp = ap->a_vp; node = VTON(vp); len = le64toh(node->fentry->inf_len); + if (len > MAXPATHLEN) + return (EIO); buf = malloc(len, M_DEVBUF, M_WAITOK); iov[0].iov_len = len; iov[0].iov_base = buf; @@ -1116,13 +1135,14 @@ udf_lookup(struct vop_cachedlookup_args *a) struct udf_mnt *udfmp; struct fileid_desc *fid = NULL; struct udf_dirstream *ds; + uint64_t fsize; u_long nameiop; u_long flags; char *nameptr; long namelen; ino_t id = 0; int offset, error = 0; - int fsize, lkflags, ltype, numdirpasses; + int lkflags, ltype, numdirpasses; dvp = a->a_dvp; node = VTON(dvp); @@ -1133,6 +1153,10 @@ udf_lookup(struct vop_cachedlookup_args *a) nameptr = a->a_cnp->cn_nameptr; namelen = a->a_cnp->cn_namelen; fsize = le64toh(node->fentry->inf_len); + if (fsize > INT_MAX) { + /* too big, just cap to INT_MAX */ + fsize = INT_MAX; + } /* * If this is a LOOKUP and we've already partially searched through From nobody Thu Jul 24 13:02:58 2025 X-Original-To: dev-commits-src-branches@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 4bnrlQ3tbRz62VNh; Thu, 24 Jul 2025 13:02:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnrlQ1Gc7z3Tbq; Thu, 24 Jul 2025 13:02:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753362178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zWyT+A01SubbrhqQnlNb4v6kJGcLpQO/cTcLj2cGdt8=; b=LZpDreaBlsnVh2S7kOTkVXlsUWr+KwpE4z9AKQIWd2nFq4L/NVCttaJ6HdUUT3SvxthuG4 3r4HOBSN6jbSdeEICxlPOB4PbTLunaiNsWkNhchz9XymvWwq4m4KUiP2oQu4IbPlrAlyAU 8eMTLZVkJVUR8RbelF48dTGcj+HbfvjDRRk4+hmmSe3zG0bS00hnf/KOGsDcK1PoL3kSB4 dQkfklfQn4DgRE1wfZNrp4TWGPa9S3Ciwkiwt4TpRcbV5pXgVC7HJpp5KKAitHiutrm0DN FHkNUZHIL+2hYsRQrO/x7F440BarOD+eJSLuYGJavcpHQHCnGTwhQLrWG6d+Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753362178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zWyT+A01SubbrhqQnlNb4v6kJGcLpQO/cTcLj2cGdt8=; b=P8fI19sjxpGHx7ssQrRFukB/o1/ULmaydY6vnZUVBb6ALwYJxFBJbMky4lmFznDV66Ew4G YHC+nKt8cygUkAtd3vQZAwO5Dg9EXHbLLolRWlLtGC22soxz0snvk8Y7g/PAaP6ylphJ9q eBbfseXCMwxtiHSvv4ceelu1z+UKqwxJnk2MoQmJLhxiw+PW5yXDCZdeDH6dvLUzkLER7p Wm3PW884M62HKUIjDGHHP2H/6MT51GY7UxrQ8ovqvK5TxJfEzcpImU92xIUEtrvb86hffb FdRLb/C6WZ/bs/QmGHcZEnACH3qHii71lnEjsGbdYf7YGfMo1PsDjrDjzcw+mw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753362178; a=rsa-sha256; cv=none; b=D4sNWEtNCuCn4bGytFmMSdYmG+lNxJgE620PSF0tR+e6EvJtJCp72VGBVhlK1swY40qrEm eIeNV+Vse3J9GkIBuhlKoEpcjr6J/yqsiYLMWE6hLFjdI+G65+PiRWkfEwNPdKnd73vSYA iFweoh7Z5UYbsM3AVsb/wjX/0KXsbgSk3/buzK+XvSrLlZWzJNHY7zrARnPnsT+7KpIAlF GX8mV8C2MUSwKTSSx8bnnZVyEVTRDosbPvvsMP1QHEgWqCB/qfA5xFHi21Dl77msaWaLiJ aJn0svZL3CWAU+0GbNsq7FfoFa8n+m/0Q9f5YS6M+fSUd8/cj3Ey0reCH4/EAA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnrlQ0WTjz10Ns; Thu, 24 Jul 2025 13:02:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56OD2wiI001969; Thu, 24 Jul 2025 13:02:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56OD2wMA001966; Thu, 24 Jul 2025 13:02:58 GMT (envelope-from git) Date: Thu, 24 Jul 2025 13:02:58 GMT Message-Id: <202507241302.56OD2wMA001966@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 91a6bf215cb1 - stable/14 - kyua: Try harder to delete directories. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 91a6bf215cb13e40b80e54ad5194c9aaf777cc3c Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=91a6bf215cb13e40b80e54ad5194c9aaf777cc3c commit 91a6bf215cb13e40b80e54ad5194c9aaf777cc3c Author: Dag-Erling Smørgrav AuthorDate: 2025-07-09 20:28:47 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-07-24 13:02:45 +0000 kyua: Try harder to delete directories. When recursing into a directory to delete it, start by chmod'ing it to 0700. This fixes an issue where kyua is able to run, but not debug, a test case that creates unwriteable directories, because when debugging it tries (and fails) to delete the directory after the test completes. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: igoro Differential Revision: https://reviews.freebsd.org/D51229 (cherry picked from commit 9bf14f2a475e221c48488984dc5a02a4608bb877) --- contrib/kyua/utils/fs/operations.cpp | 2 ++ contrib/kyua/utils/fs/operations_test.cpp | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/contrib/kyua/utils/fs/operations.cpp b/contrib/kyua/utils/fs/operations.cpp index 7a96d0b2058a..185d164b88d7 100644 --- a/contrib/kyua/utils/fs/operations.cpp +++ b/contrib/kyua/utils/fs/operations.cpp @@ -692,6 +692,7 @@ fs::rm_r(const fs::path& directory) { const fs::directory dir(directory); + ::chmod(directory.c_str(), 0700); for (fs::directory::const_iterator iter = dir.begin(); iter != dir.end(); ++iter) { if (iter->name == "." || iter->name == "..") @@ -701,6 +702,7 @@ fs::rm_r(const fs::path& directory) if (fs::is_directory(entry)) { LD(F("Descending into %s") % entry); + ::chmod(entry.c_str(), 0700); fs::rm_r(entry); } else { LD(F("Removing file %s") % entry); diff --git a/contrib/kyua/utils/fs/operations_test.cpp b/contrib/kyua/utils/fs/operations_test.cpp index f1349351166e..6f0fa52811c9 100644 --- a/contrib/kyua/utils/fs/operations_test.cpp +++ b/contrib/kyua/utils/fs/operations_test.cpp @@ -664,6 +664,19 @@ ATF_TEST_CASE_BODY(rm_r__files_and_directories) } +ATF_TEST_CASE_WITHOUT_HEAD(rm_r__bad_perms); +ATF_TEST_CASE_BODY(rm_r__bad_perms) +{ + fs::mkdir(fs::path("root"), 0755); + fs::mkdir(fs::path("root/dir"), 0755); + atf::utils::create_file("root/dir/file", ""); + ::chmod(fs::path("root/dir").c_str(), 0000); + ATF_REQUIRE(lookup(".", "root", S_IFDIR)); + fs::rm_r(fs::path("root")); + ATF_REQUIRE(!lookup(".", "root", S_IFDIR)); +} + + ATF_TEST_CASE_WITHOUT_HEAD(rmdir__ok) ATF_TEST_CASE_BODY(rmdir__ok) { @@ -811,6 +824,7 @@ ATF_INIT_TEST_CASES(tcs) ATF_ADD_TEST_CASE(tcs, rm_r__empty); ATF_ADD_TEST_CASE(tcs, rm_r__files_and_directories); + ATF_ADD_TEST_CASE(tcs, rm_r__bad_perms); ATF_ADD_TEST_CASE(tcs, rmdir__ok); ATF_ADD_TEST_CASE(tcs, rmdir__fail); From nobody Thu Jul 24 13:03:00 2025 X-Original-To: dev-commits-src-branches@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 4bnrlS57SQz62VLL; Thu, 24 Jul 2025 13:03:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnrlS2rCSz3TrN; Thu, 24 Jul 2025 13:03:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753362180; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tKONXw9Y8a/KbMhAqiqo9W4Ep+CZ69Eime6NxkVilVY=; b=eFbC6+KIOKCM34XcpRQ5s7DjsCp73mgcXb6lMLUUxDogSdD7mqOURejAS5I5yxcqxYGkIs 8j9f8HRVHQzGXdTb3LuqVkf/KbyqFB4R1ww7bU3/hQzsXtHOIsShGeY/QMynczucmKb2b4 F7ipGjAAdTzn+aXx/gsQ69LzsbLR/X1pKyGPmNYQSIy69hvyTniv67cTcYhnTZ0DrclMnT 6hBxQDdKG6Q5xbUWlth8nTP5CVP0D5C68R9cLVZGtIeIL8Dz2X23hi9jQLhl7B3xlcq0qo BsLPdIE46Jw0/IKYRouJzmj2hx1iRtQX0yD31IXf2trsHp64PpewA2mKXKltHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753362180; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tKONXw9Y8a/KbMhAqiqo9W4Ep+CZ69Eime6NxkVilVY=; b=TQ2jbUGPCnyIdrGMXC1MB10m4/JWU1v5MP/3ETn7vOknhT/sH8B+oK3n8+7sO9yfPrzxZh UuBpExcr1py60uo+xu5bmP+Bfbqu9FG6sALEImAsFN4caIP2gmVd+mcD7oBtwhcHFHj3u8 Pn82jkrEOsHwnibUFDppLY80pVQS/nLXtemKAkYACr5gwuIJ0QMwhBvGdUwEq/ciZQDc6X gAhrMO1gK8B9yukwWuITvKnX9uKu6NIJF4B/zBsh3e2JGqylbcvQKOegfvVJLtt3SvPHY3 +U0Bp2fU2kCU7/ncUKVyTMSEIwYE9Fy7DKqQ6pg6Vyg9FlNK0JRm2L/N6NftpA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753362180; a=rsa-sha256; cv=none; b=BuxwXTA7ma7tqKKA5dHB/6FAO6JGdlrjh/wZYC46EpsCDm4n17jrJM9DC1kl8Jh6ObOdvv KF5ApMFewt3KcK6q1pdpcyqejFKbD6VkF8dKIXvo12OlY+l9Bsxvi5ODCWdoTvJITZBl3y dzYve4yIqXadR1bgtdAng26GygfGL4bDabqEKmVL2WFulXto/Ae1AWAeJrSBiTulT5FfXm skTE43liSct6WfU9l/N+tsVbIda5Tmb5/dAAP/wbTN25iYAgJl4MC1aY7ndpk9cCRKXO6K fRUHJ5aeKHBnHK/MaNZEuUNr7eVsNGK/6rZpAJx4rhi8FRM2dsMiZwKrT4KgzQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnrlS2NQZz10cG; Thu, 24 Jul 2025 13:03:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56OD30kB002052; Thu, 24 Jul 2025 13:03:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56OD30sv002049; Thu, 24 Jul 2025 13:03:00 GMT (envelope-from git) Date: Thu, 24 Jul 2025 13:03:00 GMT Message-Id: <202507241303.56OD30sv002049@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 6a21ccee94ee - stable/14 - tzcode: Fix time zone change detection. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 6a21ccee94eefc22692b9aa267a27f4776f775f9 Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=6a21ccee94eefc22692b9aa267a27f4776f775f9 commit 6a21ccee94eefc22692b9aa267a27f4776f775f9 Author: Dag-Erling Smørgrav AuthorDate: 2025-07-18 17:48:59 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-07-24 13:02:45 +0000 tzcode: Fix time zone change detection. Prior to the 2022g import, tzloadbody() returned -1 on error. Now it returns an errno code. When I updated the time zone change detection logic to match, I improperly returned errno in all cases, which means that if the time zone file has not changed since we last loaded it, tzloadbody() returns a random errno value instead of 0. Fixes: bc42155199b5 MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51405 (cherry picked from commit d63ffdd1ef6368407b35d415237b95cc739d8073) tzcode: Add an explicit "the timezone file has changed" case This is required for the WITHOUT_DETECT_TZ_CHANGES case, since there the value being tested is a numeric literal. Fixes: d63ffdd1ef63 ("tzcode: Fix time zone change detection.") (cherry picked from commit 0bf113e9041fe20e8c671fe6b2cca8612dc77b77) --- contrib/tzcode/localtime.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/contrib/tzcode/localtime.c b/contrib/tzcode/localtime.c index f5814a43da54..bdec08e4abae 100644 --- a/contrib/tzcode/localtime.c +++ b/contrib/tzcode/localtime.c @@ -408,10 +408,8 @@ change_in_tz(const char *name) static char old_name[PATH_MAX]; static struct stat old_sb; struct stat sb; - int error; - error = stat(name, &sb); - if (error != 0) + if (stat(name, &sb) != 0) return -1; if (strcmp(name, old_name) != 0) { @@ -510,13 +508,13 @@ tzloadbody(char const *name, struct state *sp, bool doextend, * 'doextend' to ignore TZDEFRULES; the change_in_tz() * function can only keep state for a single file. */ - int ret = change_in_tz(name); - if (ret <= 0) { - /* - * Returns an errno value if there was an error, - * and 0 if the timezone had not changed. - */ + switch (change_in_tz(name)) { + case -1: return errno; + case 0: + return 0; + case 1: + break; } } fid = _open(name, O_RDONLY | O_BINARY); From nobody Thu Jul 24 13:03:01 2025 X-Original-To: dev-commits-src-branches@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 4bnrlT5mwhz62VHs; Thu, 24 Jul 2025 13:03:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bnrlT3t0rz3TtC; Thu, 24 Jul 2025 13:03:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753362181; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Cg7y99x7isL3D2HZ6LDulP22lRO9ZAtDUfdtkMiAQFM=; b=ADx0rGFaUY37l7s3nkN4F832R40AoYXthuU/bJ0o8Yn4Rwit4Idf+BlAc7pNmfSLFLoXoy qcryuN0fqDdX/GgXPo/FOPmY3cqLwnwmoip8dd/DqPejhc30pG6RJ0E0KoLWnW14eeCiDI oHntG63umO8WkqldgMEtIaY/dF6CjNT5ggC/1WXvboiRrfJkpTxwi5vUbTyoBL6gSxG7lZ 5F6af8YmDl7QIKBjg3XFoPnQKYYSo9thLRjGPBV9gvnNqP1a4D92+zqvTIul7sjoG7et3N OTu/xiinuWWzod9nmaaTdKZATYCpmxlX3XyWqDuvipvOnuMusRVHHFc4V1/8gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753362181; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Cg7y99x7isL3D2HZ6LDulP22lRO9ZAtDUfdtkMiAQFM=; b=TKVVNY97tXgv5B0kQYUz1NZ0+MBXVaCKJt1OItSZWjqKkE2dAynK81Rvxjjr+NEfA5TOIi 3WyDpoNZRW72I+NZ8fJlYVf5uyEet4W8C+Lnkhnn2lbxe9SEO58WSKmfO1f0v30CS4gz24 WPTg1mnk0ngASbxBW76fhNRkPlBXEWj9rV97BHl7Oa7tOaAgmkp2F+IXYBb7A7/1Be8C26 GJhS+kXFttX3d+zl2pU1WzemZMNFNlOifKyqN5C1lH9f1duswkBnEEtk1U3I/lsm3Qvrb6 JGgLPQAEiumv/5gm6+/wHz1dDVDRwOYX24iWKqQihsoR44hpuOcr0P8o1lO2Gw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753362181; a=rsa-sha256; cv=none; b=sEvphE2w/6g1shSGdLEeFAZEMK7/r2FYKLprU1trU73hiZANU/fTeyYiPaQjBNr9KW3ogk NccP5g4i4JqBff6Tt4yYY+FdSoAzbJ/QKMux/XDlryEo6I6rlr02SupYUlCsjmJGqGjrlA iaetQPadQloNYafufPdZPF1Q9QtMqG/HlBXNjNRySO0ecQCYowM3QSc4+Sm3fo9s07rlXP LLJ93XuQe0cXLMPJ6F5Dm8viVTNMh0l+Ri7QRgPbrdUAAWEyEdT8vQVqMBo+EbgNwxz6Uu VudXRGd2bXI1HVO2dQsBa6Ohtodpd/gh5DZ0vIYpMLtX9ZZyNOWgc13RI03evA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bnrlT3LJwz10Cf; Thu, 24 Jul 2025 13:03:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56OD31C1002092; Thu, 24 Jul 2025 13:03:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56OD3110002089; Thu, 24 Jul 2025 13:03:01 GMT (envelope-from git) Date: Thu, 24 Jul 2025 13:03:01 GMT Message-Id: <202507241303.56OD3110002089@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 986c43bd80e7 - stable/14 - certctl: Add an option to copy files. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 986c43bd80e750937d02966883b3182ded828c97 Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=986c43bd80e750937d02966883b3182ded828c97 commit 986c43bd80e750937d02966883b3182ded828c97 Author: Dag-Erling Smørgrav AuthorDate: 2025-07-17 18:10:56 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-07-24 13:02:45 +0000 certctl: Add an option to copy files. This is slower than linking but is the only method that works for all cases, including running certctl from outside a jail that does not contain the raw certificate data. While here, fix a bug that occurs in unprivileged mode if DESTDIR is unset or the root directory. MFC after: 1 week Reviewed by: dfr Differential Revision: https://reviews.freebsd.org/D51373 (cherry picked from commit 92b9f43c788da24d2d8376a50953ef67c2303ba7) --- usr.sbin/certctl/certctl.8 | 10 ++++++---- usr.sbin/certctl/certctl.sh | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/usr.sbin/certctl/certctl.8 b/usr.sbin/certctl/certctl.8 index 4ce61916d79a..569bd0f85d55 100644 --- a/usr.sbin/certctl/certctl.8 +++ b/usr.sbin/certctl/certctl.8 @@ -24,7 +24,7 @@ .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd July 13, 2022 +.Dd July 17, 2025 .Dt CERTCTL 8 .Os .Sh NAME @@ -38,15 +38,15 @@ .Op Fl v .Ic untrusted .Nm -.Op Fl nUv +.Op Fl cnUv .Op Fl D Ar destdir .Op Fl M Ar metalog .Ic rehash .Nm -.Op Fl nv +.Op Fl cnv .Ic untrust Ar file .Nm -.Op Fl nv +.Op Fl cnv .Ic trust Ar file .Sh DESCRIPTION The @@ -56,6 +56,8 @@ applications that use OpenSSL. .Pp Flags: .Bl -tag -width 4n +.It Fl c +Copy certificates instead of linking to them. .It Fl D Ar destdir Specify the DESTDIR (overriding values from the environment). .It Fl d Ar distbase diff --git a/usr.sbin/certctl/certctl.sh b/usr.sbin/certctl/certctl.sh index 458f5c53682f..2bde651de126 100755 --- a/usr.sbin/certctl/certctl.sh +++ b/usr.sbin/certctl/certctl.sh @@ -36,6 +36,7 @@ set -u ############################################################ GLOBALS SCRIPTNAME="${0##*/}" +LINK=-lrs ERRORS=0 NOOP=false UNPRIV=false @@ -110,7 +111,6 @@ create_trusted() { local hash certhash otherfile otherhash local suffix - local link=${2:+-lrs} hash=$(do_hash "$1") || return certhash=$(openssl x509 -sha1 -in "$1" -noout -fingerprint) @@ -130,7 +130,7 @@ create_trusted() done suffix=$(get_decimal "$CERTDESTDIR" "$hash") verbose "Adding $hash.$suffix to trust store" - perform install ${INSTALLFLAGS} -m 0444 ${link} \ + perform install ${INSTALLFLAGS} -m 0444 ${LINK} \ "$(realpath "$1")" "$CERTDESTDIR/$hash.$suffix" } @@ -159,7 +159,6 @@ resolve_certname() create_untrusted() { local srcfile filename - local link=${2:+-lrs} set -- $(resolve_certname "$1") srcfile=$1 @@ -170,7 +169,7 @@ create_untrusted() fi verbose "Adding $filename to untrusted list" - perform install ${INSTALLFLAGS} -m 0444 ${link} \ + perform install ${INSTALLFLAGS} -m 0444 ${LINK} \ "$srcfile" "$UNTRUSTDESTDIR/$filename" } @@ -190,7 +189,7 @@ do_scan() 0) ;; 1) - "$CFUNC" "$CFILE" link + "$CFUNC" "$CFILE" ;; *) verbose "Multiple certificates found, splitting..." @@ -303,19 +302,20 @@ usage() echo " List trusted certificates" echo " $SCRIPTNAME [-v] untrusted" echo " List untrusted certificates" - echo " $SCRIPTNAME [-nUv] [-D ] [-d ] [-M ] rehash" - echo " Generate hash links for all certificates" - echo " $SCRIPTNAME [-nv] untrust " + echo " $SCRIPTNAME [-cnUv] [-D ] [-d ] [-M ] rehash" + echo " Rehash all trusted and untrusted certificates" + echo " $SCRIPTNAME [-cnv] untrust " echo " Add to the list of untrusted certificates" - echo " $SCRIPTNAME [-nv] trust " + echo " $SCRIPTNAME [-cnv] trust " echo " Remove from the list of untrusted certificates" exit 64 } ############################################################ MAIN -while getopts D:d:M:nUv flag; do +while getopts cD:d:M:nUv flag; do case "$flag" in + c) LINK=-c ;; D) DESTDIR=${OPTARG} ;; d) DISTBASE=${OPTARG} ;; M) METALOG=${OPTARG} ;; @@ -334,7 +334,7 @@ fi : ${METALOG:=${DESTDIR}/METALOG} INSTALLFLAGS= if "$UNPRIV" ; then - INSTALLFLAGS="-U -M ${METALOG} -D ${DESTDIR} -o root -g wheel" + INSTALLFLAGS="-U -M ${METALOG} -D ${DESTDIR:-/} -o root -g wheel" fi : ${LOCALBASE:=$(sysctl -n user.localbase)} : ${TRUSTPATH:=${DESTDIR}${DISTBASE}/usr/share/certs/trusted:${DESTDIR}${LOCALBASE}/share/certs:${DESTDIR}${LOCALBASE}/etc/ssl/certs} From nobody Thu Jul 24 14:25:53 2025 X-Original-To: dev-commits-src-branches@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 4bntb55f1wz62pmj; Thu, 24 Jul 2025 14:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bntb555gTz3GDB; Thu, 24 Jul 2025 14:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753367153; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=16YlSCPFLViVacMjNZcYVItiQAbJDMYStfgZZSKm5m4=; b=SWQjHcyZHw8YfJCy95fmtb16FQvZklGcxQ2RZpoSSy293FBVsDvgUynYObT1q1+muyKQxp wcPDB5IjaPAdePebPsCE3VswdFrqqw7myr6RZJa76RZ8m8XNBpUj2svrERnBtGKxXtqX+q WCzmnVbFWYsiEmwMdSfT7n+ZHSq5gda3JtE8RQJErin2u/NRB+cAuUtr249CheJdgwbxvX TyDtJ/LrTk9etGQFqxkRviELPJ31Gt8bVFnXc0cY9vr3oRV7yFCQ6W5rUQ8ZYhpUTHQvCP fZvhOWQQmCYj5ANMVHNSucNeTGjuVqRdFCxaYtlziAsALSyVk2C/uEwhKZh+7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753367153; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=16YlSCPFLViVacMjNZcYVItiQAbJDMYStfgZZSKm5m4=; b=or/Y5kPW1ZLIdGmKQrBa1JLr0ZdhdsuNIgTaoGpDF6n1wpwBA5kTnZHH5Nf1Cb/+UuZZzE 5AlG5CI0b333fNn+HbpV8fqGTxZfwHssFo9qdnPUbFuOI9UhUCtQwuo2bkWog6go96qLzV xAJwvIufNTnraK1Dde2rqYp9QqqTog1CDCck3TJ1sl7OzEyRgOHdQ9itNUlfcJFSoz5K5k 8FjAqa8nujaQSkQ24JCnkmzIbkE3G1WrJwPMYu3YKPtZVdqRPOtkGIj6V8y8c7iqCsVmn5 WbfGplmBsVsQbjc10iLUVJ4Ha8F5tHaY3uO8Nj7QvGEpJlxczqLY5Oip39jOmw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753367153; a=rsa-sha256; cv=none; b=XCkK3loI9wBy/lnjayCSJb0zisyn6lsLl+qbQtblmfmtEklS/Z312/Cp3K0EOyLjq9JoQ4 36DIeFS3KgdxI3GjnNXwA2mZDxSMl7P22kcd6MyFjKSymg539FY2ukIhqYdHv5nJrK15Lg eJw7ZG7oauvH4xZZGyKtsVI7k0cF2yccGMFPSBf+udi6vfPl+3oNLU8M7TMA+oUt+xblmB 5Al8NgpOoHwriGhbJGGwTj6RZfa3HUCnZmnQJFOk6XFH8Lb5+yrVvpW7U13DhIBi4mJBNl RezI6jrVsnxOhAIqsyAuIy+EW4nSiKDXxKdYr+vect+zaohL7VJbzxTOTrgMzQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bntb54R8Nz12qG; Thu, 24 Jul 2025 14:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56OEPrL8053679; Thu, 24 Jul 2025 14:25:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56OEPr3T053676; Thu, 24 Jul 2025 14:25:53 GMT (envelope-from git) Date: Thu, 24 Jul 2025 14:25:53 GMT Message-Id: <202507241425.56OEPr3T053676@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Krzysztof Galazka Subject: git: 66b1d696db12 - stable/13 - ice_ddp: Update to 1.3.41.0 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kgalazka X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 66b1d696db1284ac9f9bb4037ffc288091f5ba84 Auto-Submitted: auto-generated The branch stable/13 has been updated by kgalazka: URL: https://cgit.FreeBSD.org/src/commit/?id=66b1d696db1284ac9f9bb4037ffc288091f5ba84 commit 66b1d696db1284ac9f9bb4037ffc288091f5ba84 Author: Eric Joyner AuthorDate: 2024-10-28 22:48:47 +0000 Commit: Krzysztof Galazka CommitDate: 2025-07-24 14:17:45 +0000 ice_ddp: Update to 1.3.41.0 Primarily adds support for E830 devices, unlocking all of their functionality. As well, update the README and remove the non-FreeBSD sections from it. Signed-off-by: Eric Joyner Sponsored by: Intel Corporation (cherry picked from commit f68513e7a446b4b0598b7f3d1b3e13f592b85d92) --- sys/conf/files.amd64 | 6 +- sys/conf/files.arm64 | 6 +- sys/conf/files.powerpc | 6 +- sys/contrib/dev/ice/README | 330 ++++++++------------- .../dev/ice/{ice-1.3.36.0.pkg => ice-1.3.41.0.pkg} | Bin 692776 -> 1352580 bytes sys/modules/ice_ddp/Makefile | 2 +- 6 files changed, 133 insertions(+), 217 deletions(-) diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index 48f2d8408007..2fc4b12e6e18 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -207,7 +207,7 @@ dev/ice/irdma_di_if.m optional ice pci \ dev/ice/ice_ddp_common.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ - compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01032400 -mice_ddp -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01032900 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ clean "ice_ddp.c" ice_ddp.fwo optional ice_ddp \ @@ -216,8 +216,8 @@ ice_ddp.fwo optional ice_ddp \ no-implicit-rule \ clean "ice_ddp.fwo" ice_ddp.fw optional ice_ddp \ - dependency "$S/contrib/dev/ice/ice-1.3.36.0.pkg" \ - compile-with "${CP} $S/contrib/dev/ice/ice-1.3.36.0.pkg ice_ddp.fw" \ + dependency "$S/contrib/dev/ice/ice-1.3.41.0.pkg" \ + compile-with "${CP} $S/contrib/dev/ice/ice-1.3.41.0.pkg ice_ddp.fw" \ no-obj no-implicit-rule \ clean "ice_ddp.fw" dev/ioat/ioat.c optional ioat pci diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 2aaa19a8c7b7..a3bf60ddd450 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -238,7 +238,7 @@ dev/ice/irdma_di_if.m optional ice pci \ dev/ice/ice_ddp_common.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ - compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01032400 -mice_ddp -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01032900 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ clean "ice_ddp.c" ice_ddp.fwo optional ice_ddp \ @@ -247,8 +247,8 @@ ice_ddp.fwo optional ice_ddp \ no-implicit-rule \ clean "ice_ddp.fwo" ice_ddp.fw optional ice_ddp \ - dependency "$S/contrib/dev/ice/ice-1.3.36.0.pkg" \ - compile-with "${CP} $S/contrib/dev/ice/ice-1.3.36.0.pkg ice_ddp.fw" \ + dependency "$S/contrib/dev/ice/ice-1.3.41.0.pkg" \ + compile-with "${CP} $S/contrib/dev/ice/ice-1.3.41.0.pkg ice_ddp.fw" \ no-obj no-implicit-rule \ clean "ice_ddp.fw" diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc index 22016c77e049..f9719c5b0849 100644 --- a/sys/conf/files.powerpc +++ b/sys/conf/files.powerpc @@ -82,7 +82,7 @@ dev/ice/irdma_di_if.m optional ice pci powerpc64 | ice pci powerpc64le \ dev/ice/ice_ddp_common.c optional ice pci powerpc64 | ice pci powerpc64le \ compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp powerpc64 | ice pci powerpc64le \ - compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01032400 -mice_ddp -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01032900 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ clean "ice_ddp.c" ice_ddp.fwo optional ice_ddp powerpc64 | ice pci powerpc64le \ @@ -91,8 +91,8 @@ ice_ddp.fwo optional ice_ddp powerpc64 | ice pci powerpc64le \ no-implicit-rule \ clean "ice_ddp.fwo" ice_ddp.fw optional ice_ddp powerpc64 | ice pci powerpc64le \ - dependency "$S/contrib/dev/ice/ice-1.3.36.0.pkg" \ - compile-with "${CP} $S/contrib/dev/ice/ice-1.3.36.0.pkg ice_ddp.fw" \ + dependency "$S/contrib/dev/ice/ice-1.3.41.0.pkg" \ + compile-with "${CP} $S/contrib/dev/ice/ice-1.3.41.0.pkg ice_ddp.fw" \ no-obj no-implicit-rule \ clean "ice_ddp.fw" dev/ixl/if_ixl.c optional ixl pci powerpc64 \ diff --git a/sys/contrib/dev/ice/README b/sys/contrib/dev/ice/README index e2ce84d72e71..c0840ecb499f 100644 --- a/sys/contrib/dev/ice/README +++ b/sys/contrib/dev/ice/README @@ -1,285 +1,201 @@ OS Default Dynamic Device Personalization (DDP) Package -====================================================================== -May 12, 2022 +******************************************************* +August 09, 2024 -Contents -======== -- Overview -- Supported Operating Systems -- Safe Mode -- Notes -- Installation -- Troubleshooting -- Legal +Contents +^^^^^^^^ -Overview -======== -Devices based on the Intel(R) Ethernet 800 Series require a Dynamic Device -Personalization (DDP) package file to enable advanced features (such as dynamic -tunneling, Intel(R) Ethernet Flow Director, RSS, and ADQ). - -DDP allows you to change the packet processing pipeline of a device by applying -a profile package to the device at runtime. Profiles can be used to, for -example, add support for new protocols, change existing protocols, or change -default settings. DDP profiles can also be rolled back without rebooting the -system. - -The DDP package loads during device initialization or driver runtime, depending -on the operating system. The driver checks to see if the DDP package is present -and compatible. If this file exists, the driver will load it into the device. -If the DDP package file is missing or incompatible with the driver, the driver -will go into Safe Mode where it will use the configuration contained in the -device's NVM. Refer to the Intel(R) Ethernet Adapters and Devices User Guide -for more information on Safe Mode. - -A general-purpose, default DDP package is automatically installed with all -supported Intel Ethernet 800 Series drivers on supported operating systems. -Additional DDP packages are available to address needs for specific market -segments or targeted solutions. - -The default DDP package supports the following: -- MAC -- EtherType -- VLAN -- IPv4 -- IPv6 -- TCP -- ARP -- UDP -- SCTP -- ICMP -- ICMPv6 -- CTRL -- LLDP -- VXLAN-GPE -- VXLAN (non-GPE) -- Geneve -- GRE -- NVGRE -- RoCEv2 -- MPLS (up to 5 consecutive MPLS labels in the outermost Layer 2 header group) +* OS Default Dynamic Device Personalization (DDP) Package + * Overview -Supported Operating Systems -=========================== -This DDP package is supported on the following operating systems: -- Microsoft* Windows Server* -- Linux* -- FreeBSD* -- VMware* ESXi* + * Supported Operating Systems -Refer to the Intel(R) Ethernet Adapters and Devices User Guide for currently -supported versions of these operating systems. + * Contents of This Package + * Related Documentation -Safe Mode -========= -Safe Mode disables advanced and performance features, and supports only basic -traffic and minimal functionality, such as updating the NVM or downloading a -new driver or DDP package. + * Notes -Refer to the Intel(R) Ethernet Adapters and Devices User Guide for more details -on DDP and Safe Mode. + * Installation + * Troubleshooting -Notes -===== -- In Linux, FreeBSD, and Windows, you cannot update the DDP package if any PF -drivers are already loaded. To overwrite a package, unload all PFs and then -reload the driver with the new package. + * Legal / Disclaimers -- In ESXi, use esxcli to load and unload DDP packages for specific market -segments during driver runtime. - -- In FreeBSD and Windows, you can only use one DDP package per driver, even if -you have more than one device installed that uses the driver. -- In Linux, FreeBSD, and Windows, only the first loaded PF per device can -download a package for that device. In ESXi, you can load different DDP -packages for different PFs associated with a device. +Overview +======== -- If you are using DPDK, see the DPDK documentation at https://www.dpdk.org/ -for installation instructions and more information. +Devices based on the Intel(R) Ethernet 800 Series require a Dynamic +Device Personalization (DDP) package file to enable advanced features +(such as dynamic tunneling, Intel(R) Ethernet Flow Director, RSS, and +ADQ). +DDP allows you to change the packet processing pipeline of a device by +applying a profile package to the device at runtime. Profiles can be +used to, for example, add support for new protocols, change existing +protocols, or change default settings. DDP profiles can also be rolled +back without rebooting the system. -Installation -============ +The DDP package loads during device initialization or driver runtime, +depending on the operating system. The driver checks to see if the DDP +package is present and compatible. If this file exists, the driver +will load it into the device. If the DDP package file is missing or +incompatible with the driver, the driver will go into Safe Mode where +it will use the configuration contained in the device's NVM. -Microsoft Windows ------------------ -TO INSTALL THE OS DEFAULT DDP PACKAGE: +Safe Mode disables advanced and performance features, and supports +only basic traffic and minimal functionality, such as updating the NVM +or downloading a new driver or DDP package. -The default DDP package is installed as part of the driver binary. You don't -need to take additional steps to install the DDP package file. +Refer to the Intel(R) Ethernet Adapters and Devices User Guide for +more details on DDP and Safe Mode. +A general-purpose, default DDP package is automatically installed with +all supported Intel Ethernet 800 Series drivers on supported operating +systems. Additional DDP packages are available to address needs for +specific market segments or targeted solutions. -FreeBSD -------- -TO INSTALL THE OS DEFAULT DDP PACKAGE: - -The FreeBSD driver automatically installs the default DDP package file during -driver installation. See the base driver README for general installation and -building instructions. - -The DDP package loads during device initialization. The driver looks for the -ice_ddp module and checks that it contains a valid DDP package file. +The default DDP package supports the following: -NOTE: It's important to do 'make install' during initial ice driver -installation so that the driver loads the DDP package automatically. +* MAC +* EtherType -Linux ------ -TO INSTALL THE OS DEFAULT DDP PACKAGE: +* VLAN -The Linux driver automatically installs the default DDP package file during -driver installation. Read the base driver README for general installation and -building instructions. +* IPv4 -The DDP package loads during device initialization. The driver looks for -intel/ice/ddp/ice.pkg in your firmware root (typically /lib/firmware/ or -/lib/firmware/updates/) and checks that it contains a valid DDP package file. -The ice.pkg file is a symbolic link to the default DDP package file installed -by the linux-firmware software package or the out-of-tree driver installation. +* IPv6 +* TCP -TO INSTALL A DDP PACKAGE FOR SPECIFIC MARKET SEGMENTS: +* ARP -You can install specific DDP package files for different physical devices in -the same system. To install a specific DDP package: +* UDP -1. Download the DDP package file (ice-x.x.x.x.zip) you want for your device. In -addition to licensing information and this README, this zip file contains the -following files: - ice-x.x.x.x.pkg - ice.pkg +* SCTP -NOTE: The ice.pkg file is a Linux symbolic link file pointing to -ice-x.x.x.x.pkg (in the same path). +* ICMP -2. Rename the ice-x.x.x.x.pkg file as ice-xxxxxxxxxxxxxxxx.pkg, where -'xxxxxxxxxxxxxxxx' is the unique 64-bit PCI Express device serial number (in -hex) of the device you want the package downloaded on. The filename must -include the complete serial number (including leading zeros) and be all -lowercase. For example, if the 64-bit serial number is b887a3ffffca0568, then -the file name would be ice-b887a3ffffca0568.pkg. +* ICMPv6 -To find the serial number from the PCI bus address, you can use the following -command: +* CTRL -# lspci -vv -s af:00.0 | grep -i Serial -Capabilities: [150 v1] Device Serial Number b8-87-a3-ff-ff-ca-05-68 +* LLDP -You can use the following command to format the serial number without the -dashes: +* VXLAN-GPE -# lspci -vv -s af:00.0 | grep -i Serial | awk '{print $7}' | sed s/-//g -b887a3ffffca0568 +* VXLAN (non-GPE) -3. Copy the renamed DDP package file to /lib/firmware/updates/intel/ice/ddp/. -If the directory does not yet exist, create it before copying the file. +* Geneve -4. Unload all of the PFs on the device. +* GRE -5. Reload the driver with the new package. +* NVGRE -NOTE: The presence of a device-specific DDP package file overrides the loading -of the default DDP package file. +* RoCEv2 +* MPLS (up to 5 consecutive MPLS labels in the outermost Layer 2 + header group) -ESX ---- -TO INSTALL THE OS DEFAULT DDP PACKAGE: -The default DDP package is installed as part of the driver binary. You don't -need to take additional steps to install the DDP package file. +Supported Operating Systems +=========================== -TO INSTALL A DDP PACKAGE FOR SPECIFIC MARKET SEGMENTS: +This DDP package is supported on the following operating systems: -You must first install the Intel(R) ESXCLI Plug-In for Managing Intel(R) -Ethernet Network Adapters to be able to install and load market-specific DDP -packages. Download it from: -https://www.intel.com/content/www/us/en/download/19380/intel-esxcli-plug-in-for- -managing-intel-ethernet-network-adapters.html +* Microsoft* Windows Server* -NOTE: ESXi support for DDP packages for specific market segments requires the -following: -- OS: ESXi 6.7 or higher -- Driver: icen 1.9.1.x or higher -- Tool: intnet 1.8.3.x or higher +* Linux* -To install and load this DDP package: +* FreeBSD* -1. Download and install the esxcli plug-in from the URL above. +* VMware* ESXi* -2. Download the DDP package. +Refer to the Intel(R) Ethernet Adapters and Devices User Guide for +currently supported versions of these operating systems. -3. Copy the DDP package file to the following location: /store/intel/icen/ddp/. - If the directory does not yet exist, create it before copying the file. -4. From the command prompt, run the following command to load the DDP package: +Related Documentation +===================== - # esxcli intnet ddp load -n -p -f +See the "Intel(R) Ethernet Adapters and Devices User Guide" for +additional information on features: - Where: - = the name of the NIC - = the name of the DDP package to load - -f = forces the package to load +* https://cdrdv2.intel.com/v1/dl/getContent/705831/ - NOTE: This operation will cause the driver to reset. +Additionally, a detailed technology guide is available for this DDP +package: -5. Wait for the load result status. +* https://cdrdv2.intel.com/v1/dl/getContent/617015 -To list all active DDP packages for all virtual NICs, run the following: +Notes +===== -# esxcli intnet ddp list +* In Linux, FreeBSD, and Windows, you cannot update the DDP package if + any PF drivers are already loaded. To overwrite a package, unload + all PFs and then reload the driver with the new package. -To unload (roll back) a DDP package, run the following: +* In FreeBSD and Windows, you can only use one DDP package per driver, + even if you have more than one device installed that uses the + driver. -# esxcli intnet ddp rollback -n -f +* In Linux, FreeBSD, and Windows, only the first loaded PF per device + can download a package for that device. In ESXi, you can load + different DDP packages for different PFs associated with a device. -NOTE: This operation will cause the driver to reset. +* If you are using DPDK, see the DPDK documentation at + https://www.dpdk.org/ for installation instructions and more + information. Troubleshooting =============== -Microsoft Windows ------------------ -If you encounter issues with the DDP package file, download the latest driver. FreeBSD ------- -If you encounter issues with the DDP package file, you may need to download an -updated driver or ice_ddp module. See the log messages for more information. -Linux ------ -If you encounter issues with the DDP package file, you may need to download an -updated driver or DDP package file. Refer to the log messages for more -information. - -ESX ---- -If you encounter issues with the DDP package file, download the latest driver. +If you encounter issues with the DDP package file, you may need to +download an updated driver or ice_ddp module. See the log messages for +more information. Legal / Disclaimers =================== -Copyright (c) 2019 - 2022, Intel Corporation. -Intel and the Intel logo are trademarks of Intel Corporation or its -subsidiaries in the U.S. and/or other countries. +Copyright (c) 2019 - 2024, Intel Corporation. + +Intel technologies may require enabled hardware, software or service +activation. + +No product or component can be absolutely secure. + +Your costs and results may vary. + +Intel, the Intel logo, and other Intel marks are trademarks of Intel +Corporation or its subsidiaries. Other names and brands may be +claimed as the property of others. + +Performance varies by use, configuration, and other factors. Learn +more at https://www.Intel.com/PerformanceIndex. + +The products described may contain design defects or errors known as +errata which may cause the product to deviate from published +specifications. Current characterized errata are available on request. -*Other names and brands may be claimed as the property of others. +This software and the related documents are Intel copyrighted +materials, and your use of them is governed by the express license +under which they were provided to you ("License"). Unless the License +provides otherwise, you may not use, modify, copy, publish, +distribute, disclose or transmit this software or the related +documents without Intel's prior written permission. -This software and the related documents are Intel copyrighted materials, and -your use of them is governed by the express license under which they were -provided to you ("License"). Unless the License provides otherwise, you may not -use, modify, copy, publish, distribute, disclose or transmit this software or -the related documents without Intel's prior written permission. -This software and the related documents are provided as is, with no express or -implied warranties, other than those that are expressly stated in the License. +This software and the related documents are provided as is, with no +express or implied warranties, other than those that are expressly +stated in the License. diff --git a/sys/contrib/dev/ice/ice-1.3.36.0.pkg b/sys/contrib/dev/ice/ice-1.3.41.0.pkg similarity index 50% rename from sys/contrib/dev/ice/ice-1.3.36.0.pkg rename to sys/contrib/dev/ice/ice-1.3.41.0.pkg index ce5dbf41f557..71e75a5d7836 100644 Binary files a/sys/contrib/dev/ice/ice-1.3.36.0.pkg and b/sys/contrib/dev/ice/ice-1.3.41.0.pkg differ diff --git a/sys/modules/ice_ddp/Makefile b/sys/modules/ice_ddp/Makefile index 7329f0897325..dd6c88712f01 100644 --- a/sys/modules/ice_ddp/Makefile +++ b/sys/modules/ice_ddp/Makefile @@ -1,5 +1,5 @@ KMOD= ice_ddp -FIRMWS= ${SRCTOP}/sys/contrib/dev/ice/ice-1.3.36.0.pkg:ice_ddp:0x01032400 +FIRMWS= ${SRCTOP}/sys/contrib/dev/ice/ice-1.3.41.0.pkg:ice_ddp:0x01032900 .include From nobody Thu Jul 24 14:25:54 2025 X-Original-To: dev-commits-src-branches@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 4bntb72QG1z62pVK; Thu, 24 Jul 2025 14:25:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bntb706csz3GGC; Thu, 24 Jul 2025 14:25:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753367155; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=893mOwIqFizQyNQ1ojl58WIYWhKmq0TJylyFDx5Hrco=; b=sBZzQ8KImzXlkdPBTfKzS5DNlTaccBkQNr0akc51pNj+LHVWZCRqieL7fGOHXnuQcKWych MgAS1a6zZvWvYaV0sZsfrZ3MuvXQ+iVWxNMqO0az1ocGULMzEHar7NUiwJVSYB6/5p+qsW x/Aw3BWNLFsAnotTi8BtpSqaxRsWg5x7VWgJQwSiCKJPjyrDzAXmcFwUvcE6EauE/AvIQU Q1GFnTAaUw7ngZGM9piB/e0UGMUQid8k2GG2D04wrFcgK/DLmEr9YLWQcwPs7wYnKll/dI T7OxlYGlTj8AIFv0PO4THRjqeNvpkKQ5a4pVc09a9Oeik44TnlCGeatJuIDD/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753367155; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=893mOwIqFizQyNQ1ojl58WIYWhKmq0TJylyFDx5Hrco=; b=Pdvc+NXvS8PFiejz+6AJO4QZa8PavFq/Z6O5La9urJQy5LNWtTFeK4Peqwrmm6r04pmZWv IEdXcMwEBHzfxcNX1+gNH2ilOlHbz2QfUVW5iUQDgjRccn1PLjRCt/+YH6ZpKyXCSzbgjC PqZgjCc3+RBNzAAquzvIfJMUKl6UYKfLnT1uyNb7vSseyoyqPRBrzsQ4tWAGdHNEQftmlN OdQ7tJfq/S1TpFPNSl6Ka+QzK1CGj+gbUuI2RiU24rZP1/sLCjYSQPTwwviTHi4rFS8u0B g0hbOdYRJ1ll+BgCAqK6ZuWF+xZK9wUIXzMKy69zTXPKlqCLHPFnSl6/TqXwqw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753367155; a=rsa-sha256; cv=none; b=EiPbiCRlC749Es5VErrXSEeIQb9hjlaoTYNtKcFuQ/K7MO6d8A8qyFRPacFRN2D9vknrVO DPdvIzbVCLTPvkbRMRMEIxIQYChon04h6EZFxLdyhLm54L4AWe/jcFLVemb5cfWykjjtBA 76W6bSzOhbcREIfR/pTlvTwoOOPMznzOufaxGrSx9fkbqN74ezX/dn4hklWL799fPvpETz yP/Rka090Y6ivuJHTKzpKCtufLmQyIABepHCH0a5wSuHn1SfcNIHC/Fp3RD0pSBDoEK1jv RMgpCKuzOtNlFpa5lToCMkAl5Y5Z1nKdd86UNARoyzYyDac+MCh+K9CQoOescQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bntb66pCJz12qH; Thu, 24 Jul 2025 14:25:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56OEPsuc053718; Thu, 24 Jul 2025 14:25:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56OEPs6M053715; Thu, 24 Jul 2025 14:25:54 GMT (envelope-from git) Date: Thu, 24 Jul 2025 14:25:54 GMT Message-Id: <202507241425.56OEPs6M053715@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Krzysztof Galazka Subject: git: 00daa1b56a8b - stable/13 - ice: Update to 1.42.1-k List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kgalazka X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 00daa1b56a8b069dbf335d383b29a845bc616bd3 Auto-Submitted: auto-generated The branch stable/13 has been updated by kgalazka: URL: https://cgit.FreeBSD.org/src/commit/?id=00daa1b56a8b069dbf335d383b29a845bc616bd3 commit 00daa1b56a8b069dbf335d383b29a845bc616bd3 Author: Eric Joyner AuthorDate: 2024-08-29 22:41:20 +0000 Commit: Krzysztof Galazka CommitDate: 2025-07-24 14:17:53 +0000 ice: Update to 1.42.1-k Summary: - Adds E830 device support - Adds pre-release E825C support (for the Ethernet device included in an upcoming Xeon D platform) - Add sysctl for E810 devices to print out PHY debug statistics (mostly for FEC debugging) - Adds per-TX-queue tso counter sysctl to count how many times a TSO offload was requested for a packet, matching other Intel drivers - Various bug fixes Signed-off-by: Eric Joyner Tested by: Jeffrey Pieper Relnotes: yes Sponsored by: Intel Corporation Differential Revisison: https://reviews.freebsd.org/D46949 (cherry picked from commit f2635e844dd138ac9dfba676f27d41750049af26) --- sys/dev/ice/ice_adminq_cmd.h | 191 ++- sys/dev/ice/ice_bitops.h | 4 +- sys/dev/ice/ice_common.c | 967 ++++++++++------ sys/dev/ice/ice_common.h | 189 +-- sys/dev/ice/ice_common_txrx.h | 2 +- sys/dev/ice/ice_controlq.c | 143 ++- sys/dev/ice/ice_controlq.h | 24 +- sys/dev/ice/ice_dcb.c | 90 +- sys/dev/ice/ice_dcb.h | 42 +- sys/dev/ice/ice_ddp_common.c | 123 +- sys/dev/ice/ice_ddp_common.h | 19 +- sys/dev/ice/ice_devids.h | 38 +- sys/dev/ice/ice_drv_info.h | 49 +- sys/dev/ice/ice_features.h | 3 + sys/dev/ice/ice_flex_pipe.c | 266 ++--- sys/dev/ice/ice_flex_pipe.h | 38 +- sys/dev/ice/ice_flow.c | 100 +- sys/dev/ice/ice_flow.h | 14 +- sys/dev/ice/ice_fw_logging.c | 4 +- sys/dev/ice/ice_fwlog.c | 39 +- sys/dev/ice/ice_fwlog.h | 12 +- sys/dev/ice/ice_hw_autogen.h | 2557 +++++++++++++++++++++++++++++++++++------ sys/dev/ice/ice_iflib.h | 1 - sys/dev/ice/ice_lan_tx_rx.h | 8 +- sys/dev/ice/ice_lib.c | 1113 +++++++++++++++--- sys/dev/ice/ice_lib.h | 109 +- sys/dev/ice/ice_nvm.c | 374 +++--- sys/dev/ice/ice_nvm.h | 56 +- sys/dev/ice/ice_rdma.c | 2 +- sys/dev/ice/ice_sbq_cmd.h | 120 ++ sys/dev/ice/ice_sched.c | 487 ++++---- sys/dev/ice/ice_sched.h | 102 +- sys/dev/ice/ice_strings.c | 4 +- sys/dev/ice/ice_switch.c | 304 ++--- sys/dev/ice/ice_switch.h | 93 +- sys/dev/ice/ice_type.h | 36 +- sys/dev/ice/ice_vlan_mode.c | 22 +- sys/dev/ice/ice_vlan_mode.h | 2 +- sys/dev/ice/if_ice_iflib.c | 59 +- sys/dev/ice/virtchnl.h | 28 + 40 files changed, 5678 insertions(+), 2156 deletions(-) diff --git a/sys/dev/ice/ice_adminq_cmd.h b/sys/dev/ice/ice_adminq_cmd.h index 70b56144faf2..6225abc0f38b 100644 --- a/sys/dev/ice/ice_adminq_cmd.h +++ b/sys/dev/ice/ice_adminq_cmd.h @@ -187,7 +187,7 @@ struct ice_aqc_list_caps_elem { #define ICE_AQC_CAPS_ROCEV2_LAG 0x0092 #define ICE_AQC_BIT_ROCEV2_LAG 0x01 #define ICE_AQC_BIT_SRIOV_LAG 0x02 - +#define ICE_AQC_CAPS_NEXT_CLUSTER_ID 0x0096 u8 major_ver; u8 minor_ver; /* Number of resources described by this capability */ @@ -320,7 +320,12 @@ struct ice_aqc_set_port_params { (0x3F << ICE_AQC_SET_P_PARAMS_LOGI_PORT_ID_S) #define ICE_AQC_SET_P_PARAMS_IS_LOGI_PORT BIT(14) #define ICE_AQC_SET_P_PARAMS_SWID_VALID BIT(15) - u8 reserved[10]; + u8 lb_mode; +#define ICE_AQC_SET_P_PARAMS_LOOPBACK_MODE_VALID BIT(2) +#define ICE_AQC_SET_P_PARAMS_LOOPBACK_MODE_NORMAL 0x00 +#define ICE_AQC_SET_P_PARAMS_LOOPBACK_MODE_NO 0x01 +#define ICE_AQC_SET_P_PARAMS_LOOPBACK_MODE_HIGH 0x02 + u8 reserved[9]; }; /* These resource type defines are used for all switch resource @@ -1389,7 +1394,18 @@ struct ice_aqc_get_phy_caps { #define ICE_PHY_TYPE_HIGH_100G_CAUI2 BIT_ULL(2) #define ICE_PHY_TYPE_HIGH_100G_AUI2_AOC_ACC BIT_ULL(3) #define ICE_PHY_TYPE_HIGH_100G_AUI2 BIT_ULL(4) -#define ICE_PHY_TYPE_HIGH_MAX_INDEX 4 +#define ICE_PHY_TYPE_HIGH_200G_CR4_PAM4 BIT_ULL(5) +#define ICE_PHY_TYPE_HIGH_200G_SR4 BIT_ULL(6) +#define ICE_PHY_TYPE_HIGH_200G_FR4 BIT_ULL(7) +#define ICE_PHY_TYPE_HIGH_200G_LR4 BIT_ULL(8) +#define ICE_PHY_TYPE_HIGH_200G_DR4 BIT_ULL(9) +#define ICE_PHY_TYPE_HIGH_200G_KR4_PAM4 BIT_ULL(10) +#define ICE_PHY_TYPE_HIGH_200G_AUI4_AOC_ACC BIT_ULL(11) +#define ICE_PHY_TYPE_HIGH_200G_AUI4 BIT_ULL(12) +#define ICE_PHY_TYPE_HIGH_200G_AUI8_AOC_ACC BIT_ULL(13) +#define ICE_PHY_TYPE_HIGH_200G_AUI8 BIT_ULL(14) +#define ICE_PHY_TYPE_HIGH_400GBASE_FR8 BIT_ULL(15) +#define ICE_PHY_TYPE_HIGH_MAX_INDEX 15 struct ice_aqc_get_phy_caps_data { __le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */ @@ -1541,11 +1557,14 @@ struct ice_aqc_get_link_status { enum ice_get_link_status_data_version { ICE_GET_LINK_STATUS_DATA_V1 = 1, + ICE_GET_LINK_STATUS_DATA_V2 = 2, }; #define ICE_GET_LINK_STATUS_DATALEN_V1 32 +#define ICE_GET_LINK_STATUS_DATALEN_V2 56 /* Get link status response data structure, also used for Link Status Event */ +#pragma pack(1) struct ice_aqc_get_link_status_data { u8 topo_media_conflict; #define ICE_AQ_LINK_TOPO_CONFLICT BIT(0) @@ -1618,7 +1637,7 @@ struct ice_aqc_get_link_status_data { #define ICE_AQ_LINK_PWR_QSFP_CLASS_3 2 #define ICE_AQ_LINK_PWR_QSFP_CLASS_4 3 __le16 link_speed; -#define ICE_AQ_LINK_SPEED_M 0x7FF +#define ICE_AQ_LINK_SPEED_M 0xFFF #define ICE_AQ_LINK_SPEED_10MB BIT(0) #define ICE_AQ_LINK_SPEED_100MB BIT(1) #define ICE_AQ_LINK_SPEED_1000MB BIT(2) @@ -1630,12 +1649,37 @@ struct ice_aqc_get_link_status_data { #define ICE_AQ_LINK_SPEED_40GB BIT(8) #define ICE_AQ_LINK_SPEED_50GB BIT(9) #define ICE_AQ_LINK_SPEED_100GB BIT(10) +#define ICE_AQ_LINK_SPEED_200GB BIT(11) #define ICE_AQ_LINK_SPEED_UNKNOWN BIT(15) - __le32 reserved3; /* Aligns next field to 8-byte boundary */ + __le16 reserved3; /* Aligns next field to 8-byte boundary */ + u8 ext_fec_status; +#define ICE_AQ_LINK_RS_272_FEC_EN BIT(0) /* RS 272 FEC enabled */ + u8 reserved4; __le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */ __le64 phy_type_high; /* Use values from ICE_PHY_TYPE_HIGH_* */ + /* Get link status version 2 link partner data */ + __le64 lp_phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */ + __le64 lp_phy_type_high; /* Use values from ICE_PHY_TYPE_HIGH_* */ + u8 lp_fec_adv; +#define ICE_AQ_LINK_LP_10G_KR_FEC_CAP BIT(0) +#define ICE_AQ_LINK_LP_25G_KR_FEC_CAP BIT(1) +#define ICE_AQ_LINK_LP_RS_528_FEC_CAP BIT(2) +#define ICE_AQ_LINK_LP_50G_KR_272_FEC_CAP BIT(3) +#define ICE_AQ_LINK_LP_100G_KR_272_FEC_CAP BIT(4) +#define ICE_AQ_LINK_LP_200G_KR_272_FEC_CAP BIT(5) + u8 lp_fec_req; +#define ICE_AQ_LINK_LP_10G_KR_FEC_REQ BIT(0) +#define ICE_AQ_LINK_LP_25G_KR_FEC_REQ BIT(1) +#define ICE_AQ_LINK_LP_RS_528_FEC_REQ BIT(2) +#define ICE_AQ_LINK_LP_KR_272_FEC_REQ BIT(3) + u8 lp_flowcontrol; +#define ICE_AQ_LINK_LP_PAUSE_ADV BIT(0) +#define ICE_AQ_LINK_LP_ASM_DIR_ADV BIT(1) + u8 reserved[5]; }; +#pragma pack() + /* Set event mask command (direct 0x0613) */ struct ice_aqc_set_event_mask { u8 lport_num; @@ -1793,14 +1837,46 @@ struct ice_aqc_dnl_call_command { u8 ctx; /* Used in command, reserved in response */ u8 reserved; __le16 activity_id; +#define ICE_AQC_ACT_ID_DNL 0x1129 __le32 reserved1; __le32 addr_high; __le32 addr_low; }; +struct ice_aqc_dnl_equa_param { + __le16 data_in; +#define ICE_AQC_RX_EQU_SHIFT 8 +#define ICE_AQC_RX_EQU_PRE2 (0x10 << ICE_AQC_RX_EQU_SHIFT) +#define ICE_AQC_RX_EQU_PRE1 (0x11 << ICE_AQC_RX_EQU_SHIFT) +#define ICE_AQC_RX_EQU_POST1 (0x12 << ICE_AQC_RX_EQU_SHIFT) +#define ICE_AQC_RX_EQU_BFLF (0x13 << ICE_AQC_RX_EQU_SHIFT) +#define ICE_AQC_RX_EQU_BFHF (0x14 << ICE_AQC_RX_EQU_SHIFT) +#define ICE_AQC_RX_EQU_DRATE (0x15 << ICE_AQC_RX_EQU_SHIFT) +#define ICE_AQC_TX_EQU_PRE1 0x0 +#define ICE_AQC_TX_EQU_PRE3 0x3 +#define ICE_AQC_TX_EQU_ATTEN 0x4 +#define ICE_AQC_TX_EQU_POST1 0x8 +#define ICE_AQC_TX_EQU_PRE2 0xC + __le16 op_code_serdes_sel; +#define ICE_AQC_OP_CODE_SHIFT 4 +#define ICE_AQC_OP_CODE_RX_EQU (0x9 << ICE_AQC_OP_CODE_SHIFT) +#define ICE_AQC_OP_CODE_TX_EQU (0x10 << ICE_AQC_OP_CODE_SHIFT) + __le32 reserved[3]; +}; + +struct ice_aqc_dnl_equa_resp { + /* Equalization value can be -ve */ + int val; + __le32 reserved[3]; +}; + /* DNL call command/response buffer (indirect 0x0682) */ struct ice_aqc_dnl_call { - __le32 stores[4]; + union { + struct ice_aqc_dnl_equa_param txrx_equa_reqs; + __le32 stores[4]; + struct ice_aqc_dnl_equa_resp txrx_equa_resp; + } sto; }; /* Used for both commands: @@ -1902,8 +1978,8 @@ struct ice_aqc_link_topo_addr { #define ICE_AQC_LINK_TOPO_HANDLE_M (0x3FF << ICE_AQC_LINK_TOPO_HANDLE_S) /* Used to decode the handle field */ #define ICE_AQC_LINK_TOPO_HANDLE_BRD_TYPE_M BIT(9) -#define ICE_AQC_LINK_TOPO_HANDLE_BRD_TYPE_LOM BIT(9) -#define ICE_AQC_LINK_TOPO_HANDLE_BRD_TYPE_MEZZ 0 +#define ICE_AQC_LINK_TOPO_HANDLE_BRD_TYPE_LOM 0 +#define ICE_AQC_LINK_TOPO_HANDLE_BRD_TYPE_MEZZ BIT(9) #define ICE_AQC_LINK_TOPO_HANDLE_NODE_S 0 /* In case of a Mezzanine type */ #define ICE_AQC_LINK_TOPO_HANDLE_MEZZ_NODE_M \ @@ -1919,7 +1995,7 @@ struct ice_aqc_link_topo_addr { struct ice_aqc_get_link_topo { struct ice_aqc_link_topo_addr addr; u8 node_part_num; -#define ICE_ACQ_GET_LINK_TOPO_NODE_NR_PCA9575 0x21 +#define ICE_AQC_GET_LINK_TOPO_NODE_NR_PCA9575 0x21 u8 rsvd[9]; }; @@ -2054,6 +2130,7 @@ struct ice_aqc_get_port_options_elem { #define ICE_AQC_PORT_OPT_MAX_LANE_25G 5 #define ICE_AQC_PORT_OPT_MAX_LANE_50G 6 #define ICE_AQC_PORT_OPT_MAX_LANE_100G 7 +#define ICE_AQC_PORT_OPT_MAX_LANE_200G 8 u8 global_scid[2]; u8 phy_scid[2]; u8 pf2port_cid[2]; @@ -2201,6 +2278,29 @@ struct ice_aqc_nvm { #define ICE_AQC_NVM_LLDP_STATUS_M_LEN 4 /* In Bits */ #define ICE_AQC_NVM_LLDP_STATUS_RD_LEN 4 /* In Bytes */ +#define ICE_AQC_NVM_SDP_CFG_PTR_OFFSET 0xD8 +#define ICE_AQC_NVM_SDP_CFG_PTR_RD_LEN 2 /* In Bytes */ +#define ICE_AQC_NVM_SDP_CFG_PTR_M MAKEMASK(0x7FFF, 0) +#define ICE_AQC_NVM_SDP_CFG_PTR_TYPE_M BIT(15) +#define ICE_AQC_NVM_SDP_CFG_HEADER_LEN 2 /* In Bytes */ +#define ICE_AQC_NVM_SDP_CFG_SEC_LEN_LEN 2 /* In Bytes */ +#define ICE_AQC_NVM_SDP_CFG_DATA_LEN 14 /* In Bytes */ +#define ICE_AQC_NVM_SDP_CFG_MAX_SECTION_SIZE 7 +#define ICE_AQC_NVM_SDP_CFG_PIN_SIZE 10 +#define ICE_AQC_NVM_SDP_CFG_PIN_OFFSET 6 +#define ICE_AQC_NVM_SDP_CFG_PIN_MASK MAKEMASK(0x3FF, \ + ICE_AQC_NVM_SDP_CFG_PIN_OFFSET) +#define ICE_AQC_NVM_SDP_CFG_CHAN_OFFSET 4 +#define ICE_AQC_NVM_SDP_CFG_CHAN_MASK MAKEMASK(0x3, \ + ICE_AQC_NVM_SDP_CFG_CHAN_OFFSET) +#define ICE_AQC_NVM_SDP_CFG_DIR_OFFSET 3 +#define ICE_AQC_NVM_SDP_CFG_DIR_MASK MAKEMASK(0x1, \ + ICE_AQC_NVM_SDP_CFG_DIR_OFFSET) +#define ICE_AQC_NVM_SDP_CFG_SDP_NUM_OFFSET 0 +#define ICE_AQC_NVM_SDP_CFG_SDP_NUM_MASK MAKEMASK(0x7, \ + ICE_AQC_NVM_SDP_CFG_SDP_NUM_OFFSET) +#define ICE_AQC_NVM_SDP_CFG_NA_PIN_MASK MAKEMASK(0x1, 15) + #define ICE_AQC_NVM_MINSREV_MOD_ID 0x130 #define ICE_AQC_NVM_TX_TOPO_MOD_ID 0x14B #define ICE_AQC_NVM_CMPO_MOD_ID 0x153 @@ -2265,6 +2365,29 @@ struct ice_aqc_nvm_checksum { u8 rsvd2[12]; }; +/* Used for NVM Sanitization command - 0x070C */ +struct ice_aqc_nvm_sanitization { + u8 cmd_flags; +#define ICE_AQ_NVM_SANITIZE_REQ_READ 0 +#define ICE_AQ_NVM_SANITIZE_REQ_OPERATE BIT(0) + +#define ICE_AQ_NVM_SANITIZE_READ_SUBJECT_NVM_BITS 0 +#define ICE_AQ_NVM_SANITIZE_READ_SUBJECT_NVM_STATE BIT(1) +#define ICE_AQ_NVM_SANITIZE_OPERATE_SUBJECT_CLEAR 0 + u8 values; +#define ICE_AQ_NVM_SANITIZE_NVM_BITS_HOST_CLEAN_SUPPORT BIT(0) +#define ICE_AQ_NVM_SANITIZE_NVM_BITS_BMC_CLEAN_SUPPORT BIT(2) +#define ICE_AQ_NVM_SANITIZE_NVM_STATE_HOST_CLEAN_DONE BIT(0) +#define ICE_AQ_NVM_SANITIZE_NVM_STATE_HOST_CLEAN_SUCCESS BIT(1) +#define ICE_AQ_NVM_SANITIZE_NVM_STATE_BMC_CLEAN_DONE BIT(2) +#define ICE_AQ_NVM_SANITIZE_NVM_STATE_BMC_CLEAN_SUCCESS BIT(3) +#define ICE_AQ_NVM_SANITIZE_OPERATE_HOST_CLEAN_DONE BIT(0) +#define ICE_AQ_NVM_SANITIZE_OPERATE_HOST_CLEAN_SUCCESS BIT(1) +#define ICE_AQ_NVM_SANITIZE_OPERATE_BMC_CLEAN_DONE BIT(2) +#define ICE_AQ_NVM_SANITIZE_OPERATE_BMC_CLEAN_SUCCESS BIT(3) + u8 reserved[14]; +}; + /* * Send to PF command (indirect 0x0801) ID is only used by PF * @@ -2560,6 +2683,15 @@ struct ice_aqc_get_set_rss_lut { __le32 addr_low; }; +/* Sideband Control Interface Commands */ +/* Neighbor Device Request (indirect 0x0C00); also used for the response. */ +struct ice_aqc_neigh_dev_req { + __le16 sb_data_len; + u8 reserved[6]; + __le32 addr_high; + __le32 addr_low; +}; + /* Add Tx LAN Queues (indirect 0x0C30) */ struct ice_aqc_add_txqs { u8 num_qgrps; @@ -2812,19 +2944,33 @@ struct ice_aqc_event_lan_overflow { /* Debug Dump Internal Data (indirect 0xFF08) */ struct ice_aqc_debug_dump_internals { __le16 cluster_id; /* Expresses next cluster ID in response */ -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_SW 0 -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_TXSCHED 2 -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_PROFILES 3 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_SW_E810 0 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_ACL_E810 1 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_TXSCHED_E810 2 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_PROFILES_E810 3 /* EMP_DRAM only dumpable in device debug mode */ -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_EMP_DRAM 4 -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_LINK 5 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_EMP_DRAM_E810 4 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_LINK_E810 5 /* AUX_REGS only dumpable in device debug mode */ -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_AUX_REGS 6 -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_DCB 7 -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_L2P 8 -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_QUEUE_MNG 9 -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_FULL_CSR_SPACE 21 -#define ICE_AQC_DBG_DUMP_CLUSTER_ID_MNG_TRANSACTIONS 22 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_AUX_REGS_E810 6 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_DCB_E810 7 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_L2P_E810 8 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_QUEUE_MNG_E810 9 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_FULL_CSR_SPACE_E810 21 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_MNG_TRANSACTIONS_E810 22 + +/* Start cluster to discover first available cluster */ +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_START_ALL 0 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_SW_E830 100 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_ACL_E830 101 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_TXSCHED_E830 102 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_PROFILES_E830 103 +/* EMP_DRAM only dumpable in device debug mode */ +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_LINK_E830 105 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_DCB_E830 107 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_L2P_E830 108 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_QUEUE_MNG_E830 109 +#define ICE_AQC_DBG_DUMP_CLUSTER_ID_FULL_CSR_SPACE_E830 121 __le16 table_id; /* Used only for non-memory clusters */ __le32 idx; /* In table entries for tables, in bytes for memory */ __le32 addr_high; @@ -3076,6 +3222,7 @@ struct ice_aq_desc { struct ice_aqc_nvm nvm; struct ice_aqc_nvm_cfg nvm_cfg; struct ice_aqc_nvm_checksum nvm_checksum; + struct ice_aqc_nvm_sanitization sanitization; struct ice_aqc_pf_vf_msg virt; struct ice_aqc_read_write_alt_direct read_write_alt_direct; struct ice_aqc_read_write_alt_indirect read_write_alt_indirect; @@ -3095,6 +3242,7 @@ struct ice_aq_desc { struct ice_aqc_lldp_filter_ctrl lldp_filter_ctrl; struct ice_aqc_get_set_rss_lut get_set_rss_lut; struct ice_aqc_get_set_rss_key get_set_rss_key; + struct ice_aqc_neigh_dev_req neigh_dev; struct ice_aqc_add_txqs add_txqs; struct ice_aqc_dis_txqs dis_txqs; struct ice_aqc_move_txqs move_txqs; @@ -3330,6 +3478,7 @@ enum ice_adminq_opc { ice_aqc_opc_nvm_update_empr = 0x0709, ice_aqc_opc_nvm_pkg_data = 0x070A, ice_aqc_opc_nvm_pass_component_tbl = 0x070B, + ice_aqc_opc_nvm_sanitization = 0x070C, /* PF/VF mailbox commands */ ice_mbx_opc_send_msg_to_pf = 0x0801, @@ -3360,6 +3509,8 @@ enum ice_adminq_opc { ice_aqc_opc_set_rss_lut = 0x0B03, ice_aqc_opc_get_rss_key = 0x0B04, ice_aqc_opc_get_rss_lut = 0x0B05, + /* Sideband Control Interface commands */ + ice_aqc_opc_neighbour_device_request = 0x0C00, /* Tx queue handling commands/events */ ice_aqc_opc_add_txqs = 0x0C30, diff --git a/sys/dev/ice/ice_bitops.h b/sys/dev/ice/ice_bitops.h index 499ee41228c3..c480900596f4 100644 --- a/sys/dev/ice/ice_bitops.h +++ b/sys/dev/ice/ice_bitops.h @@ -445,10 +445,10 @@ ice_bitmap_set(ice_bitmap_t *dst, u16 pos, u16 num_bits) * Note that this function assumes it is operating on a bitmap declared using * ice_declare_bitmap. */ -static inline int +static inline u16 ice_bitmap_hweight(ice_bitmap_t *bm, u16 size) { - int count = 0; + u16 count = 0; u16 bit = 0; while (size > (bit = ice_find_next_bit(bm, size, bit))) { diff --git a/sys/dev/ice/ice_common.c b/sys/dev/ice/ice_common.c index ef487bcfd0f4..ad4ea4c8e7a1 100644 --- a/sys/dev/ice/ice_common.c +++ b/sys/dev/ice/ice_common.c @@ -32,7 +32,6 @@ #include "ice_common.h" #include "ice_sched.h" #include "ice_adminq_cmd.h" - #include "ice_flow.h" #include "ice_switch.h" @@ -111,6 +110,17 @@ static const char * const ice_link_mode_str_high[] = { ice_arr_elem_idx(2, "100G_CAUI2"), ice_arr_elem_idx(3, "100G_AUI2_AOC_ACC"), ice_arr_elem_idx(4, "100G_AUI2"), + ice_arr_elem_idx(5, "200G_CR4_PAM4"), + ice_arr_elem_idx(6, "200G_SR4"), + ice_arr_elem_idx(7, "200G_FR4"), + ice_arr_elem_idx(8, "200G_LR4"), + ice_arr_elem_idx(9, "200G_DR4"), + ice_arr_elem_idx(10, "200G_KR4_PAM4"), + ice_arr_elem_idx(11, "200G_AUI4_AOC_ACC"), + ice_arr_elem_idx(12, "200G_AUI4"), + ice_arr_elem_idx(13, "200G_AUI8_AOC_ACC"), + ice_arr_elem_idx(14, "200G_AUI8"), + ice_arr_elem_idx(15, "400GBASE_FR8"), }; /** @@ -151,7 +161,7 @@ ice_dump_phy_type(struct ice_hw *hw, u64 low, u64 high, const char *prefix) * This function sets the MAC type of the adapter based on the * vendor ID and device ID stored in the HW structure. */ -enum ice_status ice_set_mac_type(struct ice_hw *hw) +int ice_set_mac_type(struct ice_hw *hw) { ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); @@ -188,13 +198,43 @@ enum ice_status ice_set_mac_type(struct ice_hw *hw) case ICE_DEV_ID_E823C_SGMII: hw->mac_type = ICE_MAC_GENERIC; break; + case ICE_DEV_ID_E825C_BACKPLANE: + case ICE_DEV_ID_E825C_QSFP: + case ICE_DEV_ID_E825C_SFP: + case ICE_DEV_ID_E825C_SGMII: + hw->mac_type = ICE_MAC_GENERIC_3K_E825; + break; + case ICE_DEV_ID_E830_BACKPLANE: + case ICE_DEV_ID_E830_QSFP56: + case ICE_DEV_ID_E830_SFP: + case ICE_DEV_ID_E830C_BACKPLANE: + case ICE_DEV_ID_E830_L_BACKPLANE: + case ICE_DEV_ID_E830C_QSFP: + case ICE_DEV_ID_E830_L_QSFP: + case ICE_DEV_ID_E830C_SFP: + case ICE_DEV_ID_E830_L_SFP: + hw->mac_type = ICE_MAC_E830; + break; default: hw->mac_type = ICE_MAC_UNKNOWN; break; } ice_debug(hw, ICE_DBG_INIT, "mac_type: %d\n", hw->mac_type); - return ICE_SUCCESS; + return 0; +} + +/** + * ice_is_generic_mac + * @hw: pointer to the hardware structure + * + * returns true if mac_type is ICE_MAC_GENERIC, false if not + */ +bool ice_is_generic_mac(struct ice_hw *hw) +{ + return (hw->mac_type == ICE_MAC_GENERIC || + hw->mac_type == ICE_MAC_GENERIC_3K || + hw->mac_type == ICE_MAC_GENERIC_3K_E825); } /** @@ -223,7 +263,7 @@ bool ice_is_e810t(struct ice_hw *hw) case ICE_SUBDEV_ID_E810T2: case ICE_SUBDEV_ID_E810T3: case ICE_SUBDEV_ID_E810T4: - case ICE_SUBDEV_ID_E810T5: + case ICE_SUBDEV_ID_E810T6: case ICE_SUBDEV_ID_E810T7: return true; } @@ -231,8 +271,8 @@ bool ice_is_e810t(struct ice_hw *hw) case ICE_DEV_ID_E810C_QSFP: switch (hw->subsystem_device_id) { case ICE_SUBDEV_ID_E810T2: + case ICE_SUBDEV_ID_E810T3: case ICE_SUBDEV_ID_E810T5: - case ICE_SUBDEV_ID_E810T6: return true; } break; @@ -243,6 +283,17 @@ bool ice_is_e810t(struct ice_hw *hw) return false; } +/** + * ice_is_e830 + * @hw: pointer to the hardware structure + * + * returns true if the device is E830 based, false if not. + */ +bool ice_is_e830(struct ice_hw *hw) +{ + return hw->mac_type == ICE_MAC_E830; +} + /** * ice_is_e823 * @hw: pointer to the hardware structure @@ -268,6 +319,25 @@ bool ice_is_e823(struct ice_hw *hw) } } +/** + * ice_is_e825c + * @hw: pointer to the hardware structure + * + * returns true if the device is E825-C based, false if not. + */ +bool ice_is_e825c(struct ice_hw *hw) +{ + switch (hw->device_id) { + case ICE_DEV_ID_E825C_BACKPLANE: + case ICE_DEV_ID_E825C_QSFP: + case ICE_DEV_ID_E825C_SFP: + case ICE_DEV_ID_E825C_SGMII: + return true; + default: + return false; + } +} + /** * ice_clear_pf_cfg - Clear PF configuration * @hw: pointer to the hardware structure @@ -275,7 +345,7 @@ bool ice_is_e823(struct ice_hw *hw) * Clears any existing PF configuration (VSIs, VSI lists, switch rules, port * configuration, flow director filters, etc.). */ -enum ice_status ice_clear_pf_cfg(struct ice_hw *hw) +int ice_clear_pf_cfg(struct ice_hw *hw) { struct ice_aq_desc desc; @@ -299,14 +369,14 @@ enum ice_status ice_clear_pf_cfg(struct ice_hw *hw) * ice_discover_dev_caps is expected to be called before this function is * called. */ -enum ice_status +int ice_aq_manage_mac_read(struct ice_hw *hw, void *buf, u16 buf_size, struct ice_sq_cd *cd) { struct ice_aqc_manage_mac_read_resp *resp; struct ice_aqc_manage_mac_read *cmd; struct ice_aq_desc desc; - enum ice_status status; + int status; u16 flags; u8 i; @@ -340,7 +410,7 @@ ice_aq_manage_mac_read(struct ice_hw *hw, void *buf, u16 buf_size, ETH_ALEN, ICE_NONDMA_TO_NONDMA); break; } - return ICE_SUCCESS; + return 0; } /** @@ -401,16 +471,21 @@ static void ice_set_media_type(struct ice_port_info *pi) * type is FIBER */ else if (ice_phy_maps_to_media(phy_type_low, phy_type_high, - ICE_MEDIA_OPT_PHY_TYPE_LOW_M, 0) || - (phy_type_low & ICE_MEDIA_OPT_PHY_TYPE_LOW_M && - phy_type_low & ICE_MEDIA_C2M_PHY_TYPE_LOW_M)) + ICE_MEDIA_OPT_PHY_TYPE_LOW_M, + ICE_MEDIA_OPT_PHY_TYPE_HIGH_M) || + ((phy_type_low & ICE_MEDIA_OPT_PHY_TYPE_LOW_M || + phy_type_high & ICE_MEDIA_OPT_PHY_TYPE_HIGH_M) && + (phy_type_low & ICE_MEDIA_C2M_PHY_TYPE_LOW_M || + phy_type_high & ICE_MEDIA_C2C_PHY_TYPE_HIGH_M))) *media_type = ICE_MEDIA_FIBER; /* else if PHY types are only DA, or DA and C2C, then media type DA */ else if (ice_phy_maps_to_media(phy_type_low, phy_type_high, - ICE_MEDIA_DAC_PHY_TYPE_LOW_M, 0) || - (phy_type_low & ICE_MEDIA_DAC_PHY_TYPE_LOW_M && - (phy_type_low & ICE_MEDIA_C2C_PHY_TYPE_LOW_M || - phy_type_high & ICE_MEDIA_C2C_PHY_TYPE_HIGH_M))) + ICE_MEDIA_DAC_PHY_TYPE_LOW_M, + ICE_MEDIA_DAC_PHY_TYPE_HIGH_M) || + ((phy_type_low & ICE_MEDIA_DAC_PHY_TYPE_LOW_M || + phy_type_high & ICE_MEDIA_DAC_PHY_TYPE_HIGH_M) && + (phy_type_low & ICE_MEDIA_C2C_PHY_TYPE_LOW_M || + phy_type_high & ICE_MEDIA_C2C_PHY_TYPE_HIGH_M))) *media_type = ICE_MEDIA_DA; /* else if PHY types are only C2M or only C2C, then media is AUI */ else if (ice_phy_maps_to_media(phy_type_low, phy_type_high, @@ -435,7 +510,7 @@ static void ice_set_media_type(struct ice_port_info *pi) * * Returns the various PHY capabilities supported on the Port (0x0600) */ -enum ice_status +int ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode, struct ice_aqc_get_phy_caps_data *pcaps, struct ice_sq_cd *cd) @@ -443,9 +518,9 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode, struct ice_aqc_get_phy_caps *cmd; u16 pcaps_size = sizeof(*pcaps); struct ice_aq_desc desc; - enum ice_status status; const char *prefix; struct ice_hw *hw; + int status; cmd = &desc.params.get_phy; @@ -510,7 +585,7 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode, ice_debug(hw, ICE_DBG_LINK, "%s: module_type[2] = 0x%x\n", prefix, pcaps->module_type[2]); - if (status == ICE_SUCCESS && report_mode == ICE_AQC_REPORT_TOPO_CAP_MEDIA) { + if (!status && report_mode == ICE_AQC_REPORT_TOPO_CAP_MEDIA) { pi->phy.phy_type_low = LE64_TO_CPU(pcaps->phy_type_low); pi->phy.phy_type_high = LE64_TO_CPU(pcaps->phy_type_high); ice_memcpy(pi->phy.link_info.module_type, &pcaps->module_type, @@ -525,81 +600,65 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode, } /** - * ice_aq_get_netlist_node - * @hw: pointer to the hw struct - * @cmd: get_link_topo AQ structure - * @node_part_number: output node part number if node found - * @node_handle: output node handle parameter if node found + * ice_aq_get_phy_equalization - function to read serdes equalizer value from + * firmware using admin queue command. + * @hw: pointer to the HW struct + * @data_in: represents the serdes equalization parameter requested + * @op_code: represents the serdes number and flag to represent tx or rx + * @serdes_num: represents the serdes number + * @output: pointer to the caller-supplied buffer to return serdes equalizer + * + * Returns 0 on success, + * non-zero status on error */ -enum ice_status -ice_aq_get_netlist_node(struct ice_hw *hw, struct ice_aqc_get_link_topo *cmd, - u8 *node_part_number, u16 *node_handle) +int ice_aq_get_phy_equalization(struct ice_hw *hw, u16 data_in, u16 op_code, + u8 serdes_num, int *output) { + struct ice_aqc_dnl_call_command *cmd; + struct ice_aqc_dnl_call buf; struct ice_aq_desc desc; + int err = 0; - ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_link_topo); - desc.params.get_link_topo = *cmd; + if (!hw || !output) + return (ICE_ERR_PARAM); - if (ice_aq_send_cmd(hw, &desc, NULL, 0, NULL)) - return ICE_ERR_NOT_SUPPORTED; + memset(&buf, 0, sizeof(buf)); + buf.sto.txrx_equa_reqs.data_in = CPU_TO_LE16(data_in); + buf.sto.txrx_equa_reqs.op_code_serdes_sel = + CPU_TO_LE16(op_code | (serdes_num & 0xF)); - if (node_handle) - *node_handle = - LE16_TO_CPU(desc.params.get_link_topo.addr.handle); - if (node_part_number) - *node_part_number = desc.params.get_link_topo.node_part_num; + cmd = &desc.params.dnl_call; + ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_dnl_call); + desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_BUF | ICE_AQ_FLAG_RD | + ICE_AQ_FLAG_SI); + desc.datalen = CPU_TO_LE16(sizeof(struct ice_aqc_dnl_call)); + cmd->activity_id = CPU_TO_LE16(ICE_AQC_ACT_ID_DNL); + cmd->ctx = 0; - return ICE_SUCCESS; + err = ice_aq_send_cmd(hw, &desc, &buf, + sizeof(struct ice_aqc_dnl_call), NULL); + if (!err) + *output = buf.sto.txrx_equa_resp.val; + + return err; } -#define MAX_NETLIST_SIZE 10 +#define ice_get_link_status_data_ver(hw) ((hw)->mac_type == ICE_MAC_E830 ? \ + ICE_GET_LINK_STATUS_DATA_V2 : ICE_GET_LINK_STATUS_DATA_V1) + /** - * ice_find_netlist_node - * @hw: pointer to the hw struct - * @node_type_ctx: type of netlist node to look for - * @node_part_number: node part number to look for - * @node_handle: output parameter if node found - optional + * ice_get_link_status_datalen + * @hw: pointer to the HW struct * - * Find and return the node handle for a given node type and part number in the - * netlist. When found ICE_SUCCESS is returned, ICE_ERR_DOES_NOT_EXIST - * otherwise. If node_handle provided, it would be set to found node handle. + * return Get Link Status datalen */ -enum ice_status -ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx, u8 node_part_number, - u16 *node_handle) +static u16 ice_get_link_status_datalen(struct ice_hw *hw) { - struct ice_aqc_get_link_topo cmd; - u8 rec_node_part_number; - u16 rec_node_handle; - u8 idx; - - for (idx = 0; idx < MAX_NETLIST_SIZE; idx++) { - enum ice_status status; - - memset(&cmd, 0, sizeof(cmd)); - - cmd.addr.topo_params.node_type_ctx = - (node_type_ctx << ICE_AQC_LINK_TOPO_NODE_TYPE_S); - cmd.addr.topo_params.index = idx; - - status = ice_aq_get_netlist_node(hw, &cmd, - &rec_node_part_number, - &rec_node_handle); - if (status) - return status; - - if (rec_node_part_number == node_part_number) { - if (node_handle) - *node_handle = rec_node_handle; - return ICE_SUCCESS; - } - } - - return ICE_ERR_DOES_NOT_EXIST; + return (ice_get_link_status_data_ver(hw) == + ICE_GET_LINK_STATUS_DATA_V1) ? ICE_GET_LINK_STATUS_DATALEN_V1 : + ICE_GET_LINK_STATUS_DATALEN_V2; } -#define ice_get_link_status_datalen(hw) ICE_GET_LINK_STATUS_DATALEN_V1 - /** * ice_aq_get_link_info * @pi: port information structure @@ -609,7 +668,7 @@ ice_find_netlist_node(struct ice_hw *hw, u8 node_type_ctx, u8 node_part_number, * * Get Link Status (0x607). Returns the link status of the adapter. */ -enum ice_status +int ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse, struct ice_link_status *link, struct ice_sq_cd *cd) { @@ -619,9 +678,9 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse, struct ice_fc_info *hw_fc_info; bool tx_pause, rx_pause; struct ice_aq_desc desc; - enum ice_status status; struct ice_hw *hw; u16 cmd_flags; + int status; if (!pi) return ICE_ERR_PARAM; @@ -639,7 +698,7 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse, status = ice_aq_send_cmd(hw, &desc, &link_data, ice_get_link_status_datalen(hw), cd); - if (status != ICE_SUCCESS) + if (status) return status; /* save off old link status information */ @@ -696,7 +755,7 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse, /* flag cleared so calling functions don't call AQ again */ pi->phy.get_link_info = false; - return ICE_SUCCESS; + return 0; } /** @@ -721,17 +780,28 @@ ice_fill_tx_timer_and_fc_thresh(struct ice_hw *hw, * Also, because we are operating on transmit timer and fc * threshold of LFC, we don't turn on any bit in tx_tmr_priority */ -#define IDX_OF_LFC PRTMAC_HSEC_CTL_TX_PAUSE_QUANTA_MAX_INDEX +#define E800_IDX_OF_LFC E800_PRTMAC_HSEC_CTL_TX_PAUSE_QUANTA_MAX_INDEX - /* Retrieve the transmit timer */ - val = rd32(hw, PRTMAC_HSEC_CTL_TX_PAUSE_QUANTA(IDX_OF_LFC)); - tx_timer_val = val & - PRTMAC_HSEC_CTL_TX_PAUSE_QUANTA_HSEC_CTL_TX_PAUSE_QUANTA_M; - cmd->tx_tmr_value = CPU_TO_LE16(tx_timer_val); + if ((hw)->mac_type == ICE_MAC_E830) { + /* Retrieve the transmit timer */ + val = rd32(hw, E830_PRTMAC_CL01_PAUSE_QUANTA); + tx_timer_val = val & E830_PRTMAC_CL01_PAUSE_QUANTA_CL0_PAUSE_QUANTA_M; + cmd->tx_tmr_value = CPU_TO_LE16(tx_timer_val); - /* Retrieve the fc threshold */ - val = rd32(hw, PRTMAC_HSEC_CTL_TX_PAUSE_REFRESH_TIMER(IDX_OF_LFC)); - fc_thres_val = val & PRTMAC_HSEC_CTL_TX_PAUSE_REFRESH_TIMER_M; + /* Retrieve the fc threshold */ + val = rd32(hw, E830_PRTMAC_CL01_QUANTA_THRESH); + fc_thres_val = val & E830_PRTMAC_CL01_QUANTA_THRESH_CL0_QUANTA_THRESH_M; + } else { + /* Retrieve the transmit timer */ + val = rd32(hw, E800_PRTMAC_HSEC_CTL_TX_PAUSE_QUANTA(E800_IDX_OF_LFC)); + tx_timer_val = val & + E800_PRTMAC_HSEC_CTL_TX_PAUSE_QUANTA_HSEC_CTL_TX_PAUSE_QUANTA_M; + cmd->tx_tmr_value = CPU_TO_LE16(tx_timer_val); + + /* Retrieve the fc threshold */ + val = rd32(hw, E800_PRTMAC_HSEC_CTL_TX_PAUSE_REFRESH_TIMER(E800_IDX_OF_LFC)); + fc_thres_val = val & E800_PRTMAC_HSEC_CTL_TX_PAUSE_REFRESH_TIMER_M; + } cmd->fc_refresh_threshold = CPU_TO_LE16(fc_thres_val); } @@ -745,7 +815,7 @@ ice_fill_tx_timer_and_fc_thresh(struct ice_hw *hw, * * Set MAC configuration (0x0603) */ -enum ice_status +int ice_aq_set_mac_cfg(struct ice_hw *hw, u16 max_frame_size, bool auto_drop, struct ice_sq_cd *cd) { @@ -772,10 +842,10 @@ ice_aq_set_mac_cfg(struct ice_hw *hw, u16 max_frame_size, bool auto_drop, * ice_init_fltr_mgmt_struct - initializes filter management list and locks * @hw: pointer to the HW struct */ -static enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw) +int ice_init_fltr_mgmt_struct(struct ice_hw *hw) { struct ice_switch_info *sw; - enum ice_status status; + int status; hw->switch_info = (struct ice_switch_info *) ice_malloc(hw, sizeof(*hw->switch_info)); @@ -793,7 +863,7 @@ static enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw) ice_free(hw, hw->switch_info); return status; } - return ICE_SUCCESS; + return 0; } /** @@ -866,7 +936,7 @@ ice_cleanup_fltr_mgmt_single(struct ice_hw *hw, struct ice_switch_info *sw) * ice_cleanup_fltr_mgmt_struct - cleanup filter management list and locks * @hw: pointer to the HW struct */ -static void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw) +void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw) { ice_cleanup_fltr_mgmt_single(hw, hw->switch_info); } @@ -911,7 +981,7 @@ void ice_print_rollback_msg(struct ice_hw *hw) orom = &hw->flash.orom; nvm = &hw->flash.nvm; - SNPRINTF(nvm_str, sizeof(nvm_str), "%x.%02x 0x%x %d.%d.%d", + (void)SNPRINTF(nvm_str, sizeof(nvm_str), "%x.%02x 0x%x %d.%d.%d", nvm->major, nvm->minor, nvm->eetrack, orom->major, orom->build, orom->patch); ice_warn(hw, @@ -934,12 +1004,12 @@ void ice_set_umac_shared(struct ice_hw *hw) * ice_init_hw - main hardware initialization routine * @hw: pointer to the hardware structure */ -enum ice_status ice_init_hw(struct ice_hw *hw) +int ice_init_hw(struct ice_hw *hw) { struct ice_aqc_get_phy_caps_data *pcaps; - enum ice_status status; u16 mac_buf_len; void *mac_buf; + int status; ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); @@ -957,6 +1027,8 @@ enum ice_status ice_init_hw(struct ice_hw *hw) return status; ice_get_itr_intrl_gran(hw); + hw->fw_vsi_num = ICE_DFLT_VSI_INVAL; + status = ice_create_all_ctrlq(hw); if (status) goto err_unroll_cqinit; @@ -987,9 +1059,11 @@ enum ice_status ice_init_hw(struct ice_hw *hw) if (ice_get_fw_mode(hw) == ICE_FW_MODE_ROLLBACK) ice_print_rollback_msg(hw); - status = ice_clear_pf_cfg(hw); - if (status) - goto err_unroll_cqinit; + if (!hw->skip_clear_pf) { + status = ice_clear_pf_cfg(hw); + if (status) + goto err_unroll_cqinit; + } ice_clear_pxe_mode(hw); @@ -1005,6 +1079,8 @@ enum ice_status ice_init_hw(struct ice_hw *hw) goto err_unroll_cqinit; } + hw->port_info->loopback_mode = ICE_AQC_SET_P_PARAMS_LOOPBACK_MODE_NORMAL; + /* set the back pointer to HW */ hw->port_info->hw = hw; @@ -1088,7 +1164,7 @@ enum ice_status ice_init_hw(struct ice_hw *hw) goto err_unroll_fltr_mgmt_struct; ice_init_lock(&hw->tnl_lock); - return ICE_SUCCESS; + return 0; err_unroll_fltr_mgmt_struct: ice_cleanup_fltr_mgmt_struct(hw); @@ -1135,7 +1211,7 @@ void ice_deinit_hw(struct ice_hw *hw) * ice_check_reset - Check to see if a global reset is complete * @hw: pointer to the hardware structure */ -enum ice_status ice_check_reset(struct ice_hw *hw) +int ice_check_reset(struct ice_hw *hw) { u32 cnt, reg = 0, grst_timeout, uld_mask, reset_wait_cnt; *** 16783 LINES SKIPPED *** From nobody Thu Jul 24 23:40:19 2025 X-Original-To: dev-commits-src-branches@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 4bp6tr1XVXz625P0; Thu, 24 Jul 2025 23:40:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bp6tr0cYDz3WJj; Thu, 24 Jul 2025 23:40:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753400420; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sJZviwnWxXKr1io9bxZVQ53C5mOr1CRudtnwIXfkaEo=; b=u4QAIA7yZitPnPiFwcp+nHReFDyXK+I8taWdGh2cIPlvyUHxH8CG5NO7Gs00TNSEr4rJcY scoeqPg39PoBY0EYB2p9cjgEtLRTuGfBcOYZqIU7iDNOR/+mld4knQ0bWPaX/CGDbr0+8S zSBvd6Igtqhh4gPklGCCABDes+1M+stmi6cuGxCC/gCznEKcnRnddaxqQVmxqm/UgqJJVs azbMkLAP9t5DEFo1SQc1LZJLuw9u7lOwqheUZCnOTF6s3KtavrSqEh0qzbZMo9oYbQ7swP 2hYI8XNWnFqYy+NONgDKrZL1FUaQT/2Ut7reh6g11ZdtasdfmELpFMOovWCjDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753400420; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sJZviwnWxXKr1io9bxZVQ53C5mOr1CRudtnwIXfkaEo=; b=w4dnzUIZSaGP3FsNPUwFNycB8Sxvs9I3TXi/YrdAdm9N7O7B9kc8t+yG4AlD8GXHR44OOR LVhrUfNSZfS4L6b7xeVH4rl+hVB9z/1GQ0346cnDCRXAGp1FTRWXmholpVpwKAy2PtPvaf 2FydVOb4hGpDXTjJc+1L6Bb/Px246KfXPVTaHTDcR6K9qCQxTWiuco7lE78kAdMyvLuJKT TjdO9HfCS2KcqTxbY/lDbpuli88Xgv5fsVoVjT5X9EuEh/dvMwRMbGC2pBUJAcn4B5WFRU i1I1mPsHOqzLlz+GjXe+pMNaPEpyVq9E16SzeHkVjErNWC8GkrQnBwXN+2stXA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753400420; a=rsa-sha256; cv=none; b=gpyO1ww+/5uFrT1So5Aii5+QMYCMon7wQSLDROmfoApBjZSDXGY3CfcJYm4vfg0mo9InlJ meZ0enKB+/WD4ZObd3RtRIjZGW+yIeyRoNdb2ckINUPVjdNciEgKQOZFm+tZ+eSrRYYGJ5 VL4gwgdBRLTuvY/JqNIW6sn7ugcITFSlfXzDysibyg0zS/zmGB0uMxlWvvWjJkjQXcGI/H 1BmYDZ9gPouiEYvn7124KVQH7ua0cjwSMsGB2QgX7gCselUe62rnCsDrEeTKUVdXXYmuLJ 5oXHLOHYR06hxOD5qLfcV841O3vQqkPboGh4wXchdZUpRDG+0djOFydZqYIjWg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bp6tq6rrVz4Xv; Thu, 24 Jul 2025 23:40:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56ONeJXu097955; Thu, 24 Jul 2025 23:40:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56ONeJ96097952; Thu, 24 Jul 2025 23:40:19 GMT (envelope-from git) Date: Thu, 24 Jul 2025 23:40:19 GMT Message-Id: <202507242340.56ONeJ96097952@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Pierre Pronchery Subject: git: d0d92b35d540 - stable/14 - bsdinstall: restore the environment when restarting List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khorben X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: d0d92b35d5404243dc25dee8cf12b75288e0eacb Auto-Submitted: auto-generated The branch stable/14 has been updated by khorben: URL: https://cgit.FreeBSD.org/src/commit/?id=d0d92b35d5404243dc25dee8cf12b75288e0eacb commit d0d92b35d5404243dc25dee8cf12b75288e0eacb Author: Pierre Pronchery AuthorDate: 2025-05-23 15:50:42 +0000 Commit: Pierre Pronchery CommitDate: 2025-07-24 23:37:49 +0000 bsdinstall: restore the environment when restarting It is possible to restart the installation process upon errors, when installing normally through the `auto` script, or when installing a jail with the `jail` script. However, some values obtained interactively from the user or guessed by some scripts were kept in the environment when restarting the process; this made it impossible to re-run some steps as expected after the restart. For instance, if a bad choice of mirror was made in the `mirrorselect` phase, restarting the installer remembered the choice made, and would never prompt for a different one again. Rebooting was then the only easy way out of this situation. This change restores a pre-defined list of environment variables when restarting the installation process. PR: 266987 Reviewed by: emaste Approved by: philip (mentor) Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D42281 (cherry picked from commit 9de72af2cceb6fc4aead0990cccdf565531bc248) --- usr.sbin/bsdinstall/scripts/auto | 33 ++++++++++++++++++++++++++ usr.sbin/bsdinstall/scripts/jail | 51 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 80 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index abd445282316..ab0191feea17 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -34,6 +34,13 @@ f_include $BSDCFG_SHARE/dialog.subr ############################################################ GLOBALS +# +# List of environment variables that may be defined by the user, but modified +# during the installation process. They are then restored when restarting this +# script. +# +user_env_vars="BSDINSTALL_DISTSITE DISTRIBUTIONS WORKAROUND_GPTACTIVE WORKAROUND_LENOVO ZFSBOOT_PARTITION_SCHEME" + # # Strings that should be moved to an i18n file and loaded with f_include_lang() # @@ -90,6 +97,7 @@ error() --yes-label "$msg_restart" \ --yesno "$prompt" $height $width then + environment_restore exec $0 # NOTREACHED fi @@ -138,10 +146,35 @@ dialog_workaround() --yesno "$prompt" $height $width } +# environment_restore +# +# Restore a list of environment variables when this script is restarted. +# +environment_restore() +{ + for var in $user_env_vars; do + eval "if [ -n \"\${ORIG_$var}\" -o -z \"\${ORIG_$var-z}\" ]; then $var=\${ORIG_$var}; else unset $var; fi" + done +} + +# environment_save +# +# Save any user-defined environment variable that may be modified during the +# installation process. They are then restored when restarting this script. +# +environment_save() +{ + for var in $user_env_vars; do + eval "if [ -n \"\${$var}\" -o -z \"\${$var-z}\" ]; then ORIG_$var=\${$var}; else unset ORIG_$var; fi" + done +} + ############################################################ MAIN f_dprintf "Began Installation at %s" "$( date )" +environment_save + rm -rf $BSDINSTALL_TMPETC mkdir $BSDINSTALL_TMPETC diff --git a/usr.sbin/bsdinstall/scripts/jail b/usr.sbin/bsdinstall/scripts/jail index e5822087e97b..191cc5e89563 100755 --- a/usr.sbin/bsdinstall/scripts/jail +++ b/usr.sbin/bsdinstall/scripts/jail @@ -31,13 +31,23 @@ BSDCFG_SHARE="/usr/share/bsdconfig" . $BSDCFG_SHARE/common.subr || exit 1 -############################################################ MAIN +############################################################ GLOBALS -: ${BSDDIALOG_OK=0} +# +# List of environment variables that may be defined by the user, but modified +# during the installation process. They are then restored when restarting this +# script. +# +user_env_vars="BSDINSTALL_DISTSITE DISTRIBUTIONS" -f_dprintf "Began Installation at %s" "$( date )" -export BSDINSTALL_CHROOT=$1 +############################################################ FUNCTIONS +# error [$msg] +# +# Display generic error message when a script fails. An optional message +# argument can preceed the generic message. User is given the choice of +# restarting the installer or exiting. +# error() { local msg if [ -n "$1" ]; then @@ -49,10 +59,43 @@ error() { if [ $? -ne $BSDDIALOG_OK ]; then exit else + environment_restore exec $0 $BSDINSTALL_CHROOT fi } +# environment_restore +# +# Restore a list of environment variables when this script is restarted. +# +environment_restore() +{ + for var in $user_env_vars; do + eval "if [ -n \"\${ORIG_$var}\" -o -z \"\${ORIG_$var-z}\" ]; then $var=\${ORIG_$var}; else unset $var; fi" + done +} + +# environment_save +# +# Save any user-defined environment variable that may be modified during the +# installation process. They are then restored when restarting this script. +# +environment_save() +{ + for var in $user_env_vars; do + eval "if [ -n \"\${$var}\" -o -z \"\${$var-z}\" ]; then ORIG_$var=\${$var}; else unset ORIG_$var; fi" + done +} + +############################################################ MAIN + +: ${BSDDIALOG_OK=0} + +f_dprintf "Began Installation at %s" "$( date )" +export BSDINSTALL_CHROOT=$1 + +environment_save + rm -rf $BSDINSTALL_TMPETC mkdir $BSDINSTALL_TMPETC mkdir -p $1 || error "mkdir failed for $1" From nobody Fri Jul 25 03:24:25 2025 X-Original-To: dev-commits-src-branches@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 4bpCsP4cTsz62K1p; Fri, 25 Jul 2025 03:24:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bpCsP3g6Dz3NQY; Fri, 25 Jul 2025 03:24:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753413865; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k4ZBU5hrgbl/C8C3oAHf+oWFcckoAtF49soZeDYo3Sg=; b=doB94s1noS0lm0n2qRxxupgCcF0QbV4lCa+8K7cYy/87B0IxLZekwA3i8KMhOv5+bxPZNU vVecixEefukT5M44FsmP24DOpGIHmmUHO+Zp5KoWhp61wzmTusimdy0SVYRg9Lj2rRwFH5 nWZu7Fi/l2MEblpvBaptMCcYdsrR2LO37T8CWqK48+yCCwuTDwk3TBTvYI9+cOlp/9o8LK zwKwUlB8VEp+UuUAwsKtI7XfWYLcWc7Rp5YJvynPW84tZ5K691Qhu7FmZfp49KbFB/mpjk eRbg54DNIP5tQRt54Yv1i2EW/ojd3hJK7DRMDre9c0iVuz8ld36BPrfatAlIAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753413865; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k4ZBU5hrgbl/C8C3oAHf+oWFcckoAtF49soZeDYo3Sg=; b=hhkCKmapCchXwx4Wa8gRehIBrNZ9qnLORTYlimPrcEMRu5+eFruKIUnze0dOpU+alvQX5S Fk2YbYotfKOGjvKHTZ6o5tJQLeJIOdjJPV8R9fmNDBcpK/ZQb6zBA/DyYJPk1xyy177ClW L5Nm53FlmivpS6UcO0lRCdW3B60cv82Ajdn4hev5BX3Jwp89U40agpK5MTstA1asqZhjve mOljAli7WOdFfEh5Pf7M38+dERiLZZ5wrYNPNzaxp7CWPaELswLFVE7I/MJ2uKYzX7LJ8u BFPVJzVcfa4/Nbo93xqisz0A7/T/m4yE+MNXuCcWsY6a93ocmrJrW4HwQLvHpw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753413865; a=rsa-sha256; cv=none; b=qx8e+J3dBJ4/9v0UzUX+mgzPffeE60js/VADKzBK60LzTTwoun/McEyj11THsIfyu45jfh rXm1HLceBDK/l4imGvdTUqKR5UVOQ76Oxzlf1t4dOTpBiiRg19PdOXyBHF7itxn9OiAcJt a7ewnUAk4CHXQtesRu8YPT1Z9C4ptjeYmHR/72m/l7U0flsMUU75zzDQOCptrul0DkysIK xZpWSN8wxZG5TDQU0IUa5FeyLnlqHU1ENjB72sdJmIPAy1l9fgdGvCFc0sYd2lHntcStNX KH5EwYOAs+Bg7CBDepntbcpe5Ixpk5lN7qbzuOeO8+6yUFliz7Ew3frRIFw2cw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bpCsP3BzFzC17; Fri, 25 Jul 2025 03:24:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56P3OPZQ018448; Fri, 25 Jul 2025 03:24:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56P3OPgR018445; Fri, 25 Jul 2025 03:24:25 GMT (envelope-from git) Date: Fri, 25 Jul 2025 03:24:25 GMT Message-Id: <202507250324.56P3OPgR018445@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 1c250e04505f - stable/14 - rtld: do not relocate tlsinit address twice List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1c250e04505f0d3e9b103fa22fe1cf103182a695 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1c250e04505f0d3e9b103fa22fe1cf103182a695 commit 1c250e04505f0d3e9b103fa22fe1cf103182a695 Author: Konstantin Belousov AuthorDate: 2025-07-21 04:09:53 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-25 03:23:49 +0000 rtld: do not relocate tlsinit address twice PR: 288334 (cherry picked from commit db9ef9d5f517a14160bb3d0a599b8392e01fb400) --- libexec/rtld-elf/map_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c index 0b1500a15183..06be8c02137e 100644 --- a/libexec/rtld-elf/map_object.c +++ b/libexec/rtld-elf/map_object.c @@ -320,7 +320,7 @@ map_object(int fd, const char *path, const struct stat *sb) obj->tlsalign = phtls->p_align; obj->tlspoffset = phtls->p_offset; obj->tlsinitsize = phtls->p_filesz; - obj->tlsinit = mapbase + phtls->p_vaddr; + obj->tlsinit = obj->relocbase + phtls->p_vaddr; } obj->stack_flags = stack_flags; obj->relro_page = obj->relocbase + rtld_trunc_page(relro_page); From nobody Fri Jul 25 03:24:26 2025 X-Original-To: dev-commits-src-branches@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 4bpCsQ62F1z62Jpv; Fri, 25 Jul 2025 03:24:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bpCsQ4WKTz3NHn; Fri, 25 Jul 2025 03:24:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753413866; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Tnfd2gKBtDsdbPdb6baYNz4D4rHu4slnaIPifgY/Og0=; b=l8T+h9uzZi7sXbjw/LPKZgBTvjc8YKghQb2kA6qhoCYhEAW1EMQoPJcOmiq8NK1sjQuu6y RRaKh+7djcp04UlmZhT2PIWoCmM7KwSPMO5ZmnabCOnDm9v5psGBtFpdmeSHAwHeJ0eNoC uj2tuSUvbs8ibJaQQ0Qlvi9XdcpjjQtNKXN3xzLHS9kTCALFQyb5nb7R+vcF2KhGuH1aVk d7LHFqntTf1nPUkg/EDJyK3oxL5Aq7kHojkxVVh6zsVgQtWAbtUwzuBQBtE9QCybWmhuuQ nhSv9I10evQGCgPeUiM4q8/pX5P4Y/eVuFi+DuyGlMOSuUyy94xwKmFTf+CLVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753413866; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Tnfd2gKBtDsdbPdb6baYNz4D4rHu4slnaIPifgY/Og0=; b=aMBhD9SPn3naEXxfxj4SICpw8lawVvM6Rv8Yp77r1g+14ssWjimAg/l+eIfFuCSAe2w04q gYLPzu6T/YJNT6V8pHT2HNnBR3UzgbHUqxAvDU+Nq4iPS3/cWcsaXCCqhx5nG3nwgtJYqh UB5VpYdkMH2x8fd/i9ESkbGgOLg3AwuDix2Evd7J5Ew6xZcTE55Ol3E7yzEsvbXAvU91QG Khb51X0ky3Odgsv/+0xdAd3F64pHlGX1tx/Gn1XQOwDygQXXE7zwPdxE/WEZKsD3wWjFUy z6Ni3U+5h8UorDO/oKyWpAM+FFEBeipV8jEF++T/RrL5spqJp43+PDCeez0mDA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753413866; a=rsa-sha256; cv=none; b=YHPEHCy/ANBfHf1vrjNwmeD7ncllXsrsJJn6uZsCjHksTiRy409fwY7BEWxPk56hdsSGt8 4uC4/YMnJSh+RNjlRC07RvpCbKhoAUhXT9WfBgJllVPAkfBGlmDN3IXxKaWmqt4rBXpU3U XefltiWsiTUfPK2Qg6dN0iCc0p5qW1aR6UH/A0mWb4xJvb6kJDn27FgAr95iaby+BC+rvQ zknSPleaWBSVQPFelELqKTimcfhsMZ8Tqn91s3GZpIQcf9/mRGCsI87QlZCyXn9GaBBcEP /AtDCaA6Sb9zEYKdFTsRkMxmawvCGgEI4RIkfK1sAfaleYzIYuBEA9O7qTk6Xw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bpCsQ3xG0zC1Z; Fri, 25 Jul 2025 03:24:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56P3OQIW018481; Fri, 25 Jul 2025 03:24:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56P3OQsx018478; Fri, 25 Jul 2025 03:24:26 GMT (envelope-from git) Date: Fri, 25 Jul 2025 03:24:26 GMT Message-Id: <202507250324.56P3OQsx018478@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 823b81ac9c75 - stable/14 - memchr.3: mention the len argument in the functions description List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 823b81ac9c75f4c86b8e85e12bf1f0219ae59608 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=823b81ac9c75f4c86b8e85e12bf1f0219ae59608 commit 823b81ac9c75f4c86b8e85e12bf1f0219ae59608 Author: Konstantin Belousov AuthorDate: 2025-07-19 12:15:44 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-25 03:23:49 +0000 memchr.3: mention the len argument in the functions description (cherry picked from commit 441995e161a2564d37947d054a2f1219754deb5f) --- lib/libc/string/memchr.3 | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/libc/string/memchr.3 b/lib/libc/string/memchr.3 index 72a4fa70e536..52343c23f9db 100644 --- a/lib/libc/string/memchr.3 +++ b/lib/libc/string/memchr.3 @@ -54,7 +54,10 @@ locates the first occurrence of (converted to an .Vt "unsigned char" ) in string -.Fa b . +.Fa b , +limited to at most +.Fa len +characters. .Pp The .Fn memrchr @@ -63,15 +66,18 @@ function behaves like except that it locates the last occurrence of .Fa c in string -.Fa b . +.Fa b , +limited to the first +.Fa len +characters. .Sh RETURN VALUES The .Fn memchr and .Fn memrchr -functions -return a pointer to the byte located, -or NULL if no such byte exists within +functions return a pointer to the byte located, or +.Dv NULL +if no such byte exists within .Fa len bytes. .Sh SEE ALSO From nobody Sat Jul 26 07:08:44 2025 X-Original-To: dev-commits-src-branches@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 4bpwnn0JTFz639Yh; Sat, 26 Jul 2025 07:08:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bpwnm6Cg5z3Jhp; Sat, 26 Jul 2025 07:08:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753513724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zbA5Aqywq90pJU9osSzezNsQfe5LC7qyEtfXnuQKok8=; b=UKcbd4Rtt36s7m5xZ69B8SMTXRdWdgsrPD5rDO/dW+BXnCLe3HK3i6zkXgiD34bE9B46Px Id/i8cdFwyAl06lZUaLAFbIgIyyJq8nIfz/4ZSk1K/yje31lfObNVitQ0xMX8SAP7Smtq3 VahEy0OEYn1yL6nw6cHdw0Wii7C+I6xpEWaIVruRaTCJUl0/+wY/IEiomNNl+WCB/pjOT5 8SLyeTO9sEeNoN7YqJHwe3Zmka5bzGbTsInUyXRO0jlkdcUwrJ9oArEd4dPylB8D404hYr HuOZZLZoPImP5APT42yEnP07qtGSTf/NnVqLN6totxUWzx1WVUMajR4UW5enaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753513724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zbA5Aqywq90pJU9osSzezNsQfe5LC7qyEtfXnuQKok8=; b=eEkc2OCAmGCYCne36vAE/A94b7OEAgoc8pTEDc081odOavV/cMwi6ZEeLSO4rUrglFe4eH 4bIefWWwg8rziqWOjGcAzBJi2n5s7kEXeVPLa3u+rtvU4EzaO9i6By81HK1tSYBpqckzHW zFbCM7dERum57/3TNOjtYUdxSxoYtCEi35bE7jFJ7CqkEm/RXgBf3pYIWyllaL+vLb9gdM TzPJkZmIGagBMDx0E4DCT7bLlBWZUUxAG1y/s04DnZdVsZ16tkwk+OrUoCAZm697kFiqpv 9MhsNOtsb6k7B4ca/rfImH60aSu+TwSR/sjE1Q8yfnMoEmvE1KiVKD0kgksiiA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753513724; a=rsa-sha256; cv=none; b=OaOqYwpxPvbCKYDchUvA7WTSQKpmxoldCsyvRrz6nI6a8u+AfsmCfFh0k6zpx0/e7fY4nC e3eFRsL9vF/GgIzklyH1yHdLVvBguySo5cwQbZnNp6tuvBndwLKWMxFAAcT4PgVEqGESlF JbQ6PTz0xznPtEtF+VRzXhv40QV+mmeUfBoumZ1klW10wCq8vDqpf+y9AsJOtB2f/BbVVD aiZujC96TBKEaLnC90fvyjw/713LCqEgdV4aVMx0jB9L0JwUkDpOW0aiuLmsnWqioM8YWK kJyiF6mhEVo2DQ+O2u2/iLe0npTrbKwPpaEXVwHuSGw5AlpS8+9R2MGcZJ4Tlg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bpwnm5ZNpz48F; Sat, 26 Jul 2025 07:08:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56Q78iS0037062; Sat, 26 Jul 2025 07:08:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56Q78irs037059; Sat, 26 Jul 2025 07:08:44 GMT (envelope-from git) Date: Sat, 26 Jul 2025 07:08:44 GMT Message-Id: <202507260708.56Q78irs037059@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: bbe75ea73442 - stable/14 - devd: Add vm_guest variable List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: bbe75ea73442651b8e6277984b817308663193b6 Auto-Submitted: auto-generated The branch stable/14 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=bbe75ea73442651b8e6277984b817308663193b6 commit bbe75ea73442651b8e6277984b817308663193b6 Author: Warner Losh AuthorDate: 2025-07-19 05:31:50 +0000 Commit: Eugene Grosbein CommitDate: 2025-07-26 07:07:44 +0000 devd: Add vm_guest variable Fetch vm_guest on startup in case we're running under a hypervisor. Co-authored-by: eugen@ PR: 287873 Sponsored by: Netflix (cherry picked from commit bd4a4e46ceacd8dfc5a5469ec6edd8c92c53605a) --- sbin/devd/devd.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sbin/devd/devd.cc b/sbin/devd/devd.cc index 28aab82803c8..e4abf0e33fae 100644 --- a/sbin/devd/devd.cc +++ b/sbin/devd/devd.cc @@ -154,6 +154,8 @@ static volatile sig_atomic_t romeo_must_die = 0; static const char *configfile = CF; +static char vm_guest[80]; + static void devdlog(int priority, const char* message, ...) __printflike(2, 3); static void event_loop(void); @@ -868,6 +870,8 @@ process_event(char *buffer) cfg.set_variable("timestamp", timestr); free(timestr); + cfg.set_variable("vm_guest", vm_guest); + // Match doesn't have a device, and the format is a little // different, so handle it separately. switch (type) { @@ -1323,6 +1327,7 @@ int main(int argc, char **argv) { int ch; + size_t len; check_devd_enabled(); while ((ch = getopt(argc, argv, "df:l:nq")) != -1) { @@ -1347,6 +1352,12 @@ main(int argc, char **argv) } } + len = sizeof(vm_guest); + if (sysctlbyname("kern.vm_guest", vm_guest, &len, NULL, 0) < 0) { + devdlog(LOG_ERR, + "sysctlbyname(kern.vm_guest) failed: %d\n", errno); + } + cfg.parse(); if (!no_daemon && daemonize_quick) { cfg.open_pidfile(); From nobody Sat Jul 26 07:14:08 2025 X-Original-To: dev-commits-src-branches@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 4bpww13fPvz639bk; Sat, 26 Jul 2025 07:14:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bpww06zJrz3LxH; Sat, 26 Jul 2025 07:14:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753514049; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I44TasudBxj0BwTwH0zj6q/kKCz8+75Iuf+oDR8ufZY=; b=e+67S+YFNyxWQT1LhHajo+jXy21WMTgeYJOZtaEJ1kKDPl3kGOBDcecg0WdhfAEnywcHb4 FN59nFextvhoJhmJm1Fg1eYLLBJ1YoJ8BAaYaCobhQY9Ss8s8ru8SiEI0GvHI1rTqTkxfS 0Bwl/qW7SQRhzEtEPO0q0BAiZFVJILtysjh5Qv5w+Q5NY+LjeIgE0hpuKRVeWxndrB1IDy ZrB2nL7MuVpAsQST21JS0BxqLaxmsPqdeR6AxCrHMNGoJe54yOCVWWeUSc+3FsG4MNFO9Z mYeNVFJzVmBLrVbZiO9aj5by60IPpyOjx3tjj4YBkcEvQdC4RS7TfWNeApzucg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753514049; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I44TasudBxj0BwTwH0zj6q/kKCz8+75Iuf+oDR8ufZY=; b=XBGxutleJhj0wPBukDx64MhG7glAPEyhzp2IBNI4KQLFOQ9PAb8DL3wU5qRWDyKv0lgAZV vz6kxZ/7GQt8Xtre9I3D3Vju0QITrNH82AL1tCfu4rb/Gpk+v1JXH/5JBV2XWSAtVZs+Gw ypqm1XtgxeBi87W4KVjFJYoxORVzlgijifRarH2EABYWmjDm1Mbiktttv9Dfrohov8m7cz fvvchRYDRD0w36jt/iwHMHKkL9Ra2jNUjLLk6DU+jpiKHXhCm+/j2so4RrOEF4PZX+ZcUm vCIHf1zB/R+uhrxiJ3vwpVS1Xw4cN7OtldW5l1AejkfsVmA+GhYjkwYOVQRWSA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753514049; a=rsa-sha256; cv=none; b=DyOER9IrF4ImEVCV3OiHVu+gNL8ekzHyEyTskPn0RcstYBiUHON17mtQoAb2p2J+TDR42U BrRegktN/P8WwBmCrz3uH2CTOD1pB6z0saU2lJWkLRbeOpuro9L6RyErtjFc7q/9T5wyk0 KIXXZDnGI3HJpciwotZH2dAayw1FU0LF4x7YIKCzojRFFbUE3jjyV+D6hFAwCtTQ6/WATp qTt+5B4PPAAMaDUduGpClNODAX0Dw+er7FGG6HbcJ2ji/uEjdlVvjLtvp5yDXwzwV019Ec 7bfOTh4mL9ynMF92ZIhyGknUUO9Fid27G8b4ItdbuMC6WqD/AuhYt8In0cKrTw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bpww064Qqz4ZN; Sat, 26 Jul 2025 07:14:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56Q7E8fr054632; Sat, 26 Jul 2025 07:14:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56Q7E8Da054629; Sat, 26 Jul 2025 07:14:08 GMT (envelope-from git) Date: Sat, 26 Jul 2025 07:14:08 GMT Message-Id: <202507260714.56Q7E8Da054629@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: a04e1adff054 - stable/14 - devd.conf(5): call hyperv_vfattach in a Hyper-V guest only List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a04e1adff054e0bb644759b39b54d4c172655801 Auto-Submitted: auto-generated The branch stable/14 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=a04e1adff054e0bb644759b39b54d4c172655801 commit a04e1adff054e0bb644759b39b54d4c172655801 Author: Eugene Grosbein AuthorDate: 2025-07-22 10:06:24 +0000 Commit: Eugene Grosbein CommitDate: 2025-07-26 07:13:34 +0000 devd.conf(5): call hyperv_vfattach in a Hyper-V guest only Limit calls to /usr/libexec/hyperv/hyperv_vfattach to Hyper-V guests. PR: 287873 (cherry picked from commit d4a0e749cc66cd5d019d8fb8f43427109aef4c9f) --- sbin/devd/hyperv.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/devd/hyperv.conf b/sbin/devd/hyperv.conf index 13695a0c75b6..70108ac36e54 100644 --- a/sbin/devd/hyperv.conf +++ b/sbin/devd/hyperv.conf @@ -103,5 +103,6 @@ notify 10 { notify 10 { match "system" "ETHERNET"; match "type" "IFATTACH"; + match "vm_guest" "hv"; action "/usr/libexec/hyperv/hyperv_vfattach $subsystem 0"; }; From nobody Sat Jul 26 07:17:18 2025 X-Original-To: dev-commits-src-branches@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 4bpwzg158fz639ln; Sat, 26 Jul 2025 07:17:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bpwzf6ZTbz3P3w; Sat, 26 Jul 2025 07:17:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753514239; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ovUQeNlfAzJtnTBKna5ffd99ge3y4ZJx/CCZGlOzjis=; b=WZGtvXLbO4c0oGtZsG224eqa2eGUSrHtDjXTp+NyJ18kMpsaj+mTxTkCeprQKZbtTBzg6L lFzCD2WkGTv0tGQPlFTW5Sf73A9/gUBCSdtyyFG0p6NTExMiLlv3wgUk4dzU4Jurf9kiNF GvvaIy15sx7RrXvZ6SIBytLBa0afFNv4K5lCK83VWJ54l/35FqUJUnfShk1RfHnKjhrPQA ugvMU7Hsrm4sdMWK8rNspDSDx2xQk9OZ0klH6dRVKdLDs0pUyVAVZIVP+4eEdCLUA1r4Nx 3/rrzswlQi3x3a1kEdCkX088Et5xzNBmEdXc1TBCe1BpI1rFCTh6lo8ghn+HHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753514239; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ovUQeNlfAzJtnTBKna5ffd99ge3y4ZJx/CCZGlOzjis=; b=pG8JmnTIcaykqxPPS0mKzU3BxmXXsX9EK0fc/axh30bSfoTk8L3lEXTfIR9e9BuBofXLYn zrFNt1uXxtK/0oq20Uc6RYq/El6F2moEYnudzevHMUmxaR8rsAkK0Onk4LOteWL4zoWNdo PgeAS89tWRVn/HMml725LMFUhu8E2wsZSmAc1pF972YuP61cKS6PfOCvPplEzbAA/Uljoq Hx7kaastFGqNCIo+xJvi+xH4TnGrEYreiYY5BrWZg42UhR7fjHBOMyUXmp0zm7ccS+vev+ s8i9rEtUSqpzoYFUExv9h0Lq8EkPMK6xl9tn0mwgeyDqxWkPmN+juld3asny/g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753514239; a=rsa-sha256; cv=none; b=RbuDOhjvvm9s+TSLFFkoK2md7woxWSJVzqKAxZ/Sr+LbtjjG6l4sHkalIZrn0h8sm7WOQ0 SEoWyJcPLl0WDXgP53vqUcxYCAdtqj1GF+6ncWJy/lTQ05amZt1ZMWOhDPrF0qP7O904a2 qBifRXwrO88lyJ6hx7VeHl7kNxTCoBSRcgFZyDQmLShjIDNVzmOxFPyOslOZLCx2T02lVq 4mez4xOVaEBjeIAYgZEs1H8lhryQU4tr7WtTZ4ZyOufZPyw5m5++U7JcE/X0Sc+p8IrnaS 8nLOX6PjbgZ3dVJjSiFEDMWu2GhWMvuEsk9ec8XC7WgXE9XPh4zc7ad8Asu0PQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bpwzf66GHz4P2; Sat, 26 Jul 2025 07:17:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56Q7HIq3055673; Sat, 26 Jul 2025 07:17:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56Q7HISu055670; Sat, 26 Jul 2025 07:17:18 GMT (envelope-from git) Date: Sat, 26 Jul 2025 07:17:18 GMT Message-Id: <202507260717.56Q7HISu055670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: 8812941de64d - stable/13 - devd.conf(5): call hyperv_vfattach in a Hyper-V guest only List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8812941de64d964ea0b169c8cca4fceccb4315c7 Auto-Submitted: auto-generated The branch stable/13 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=8812941de64d964ea0b169c8cca4fceccb4315c7 commit 8812941de64d964ea0b169c8cca4fceccb4315c7 Author: Eugene Grosbein AuthorDate: 2025-07-22 10:06:24 +0000 Commit: Eugene Grosbein CommitDate: 2025-07-26 07:15:56 +0000 devd.conf(5): call hyperv_vfattach in a Hyper-V guest only Limit calls to /usr/libexec/hyperv/hyperv_vfattach to Hyper-V guests. PR: 287873 MFC after: 3 days (cherry picked from commit d4a0e749cc66cd5d019d8fb8f43427109aef4c9f) --- sbin/devd/hyperv.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/devd/hyperv.conf b/sbin/devd/hyperv.conf index 13695a0c75b6..70108ac36e54 100644 --- a/sbin/devd/hyperv.conf +++ b/sbin/devd/hyperv.conf @@ -103,5 +103,6 @@ notify 10 { notify 10 { match "system" "ETHERNET"; match "type" "IFATTACH"; + match "vm_guest" "hv"; action "/usr/libexec/hyperv/hyperv_vfattach $subsystem 0"; }; From nobody Sat Jul 26 07:17:20 2025 X-Original-To: dev-commits-src-branches@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 4bpwzj5dr2z639lp; Sat, 26 Jul 2025 07:17:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bpwzj13zlz3Nsn; Sat, 26 Jul 2025 07:17:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753514241; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CaShD/e/BYnPENVtZrnmxpaBnmSv7ZOL4JafzlROB/8=; b=nxhjPgCELVJZLdSWQgB+18fwNjeD20Y3vFpPGx3fqPf+o+hJShqA9WMLuPmtCRVp+ifSIU r1hjPzMpTSDdfSGgATIDwqiFXK5RT4eBFUSq0SfqwQNrCwB+xqpbioIauXn+WedGEDkOgx tZGA8Jl59DFRWEvk8BsO6xl0RdnIaKaOO+HmwLCa1AQ81/k+l04p9/8gW7I3k4ARFKVJwS S11gBouokzCKN5/Wp04VTf8j+fVHsu5TPldIZRevBh0hgXC+wvQyOdwAva0C4vVRIV6vM1 ggcmr1sXPai74mwTsQfKklJPFRjCUMnNHjqRTxl78hWjN5i9jSpPtDpv0hMWWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753514241; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CaShD/e/BYnPENVtZrnmxpaBnmSv7ZOL4JafzlROB/8=; b=Jr+I1XOOsVnhzlcHPfBOdYBYXg2LU4EJ6rv3AaJTl4b8h8JJuLYQbQNUdOuqKOB68K59h8 TwP0OVnygP8sQlSNb8zToo5wJ4CvBRaNdZolnYcTtKjxbtwYBInt1Ml13Pj18VJcUn0jFq +VkcfDlKidJlhO2mC9hxbSL7dsaoPCAWOd5pRZ4buALtBTRJCVfLOUnUGmMhv56+HT2Iy1 HRnbbzbA5oHHtkIPrZ0vQ1I3qZV+0VqTQX7uJmSGLXS7GBOfrZypTNNnJCYZCPiargew5+ QG8EqMxnaj43na7JIgFcfDOGO2yDw//F0PggMI/jC6ESIO6v2c1+wgUFlhIh5Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753514241; a=rsa-sha256; cv=none; b=Wac31SX4Hwu0SeH4Df1ZMtq02hk+QBCEDGVC19UjDT4UxAJix2KaPjgTLVhoGNqR56e2bm MBysNEMgjKKzUQ9ndtdSmja+EqNg7xpcwhLhF2ApHO873q74qNnMgcHYTd0vBAivlh/U0l BBLXOiD6YP8d9uZlxnPRPxXojwGjW5XHO1hkpABnQPa7bxjpUVpu+4T0d6DioGbUNqKzjc Ur0rC01TdZHCAvyvqeFw8FGJ4IE4XJvywFNTUaV72PIYUcnrmXEa5KhW4nG+HNot90jQi7 phaa4fMBpLOH4eV+CmPLk0Gg3z3YNITZSXPNvFpgRTxw+qnvSCh5KJPjIHIU4Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bpwzj0Z4Pz4rj; Sat, 26 Jul 2025 07:17:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56Q7HKBw055746; Sat, 26 Jul 2025 07:17:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56Q7HKuF055743; Sat, 26 Jul 2025 07:17:20 GMT (envelope-from git) Date: Sat, 26 Jul 2025 07:17:20 GMT Message-Id: <202507260717.56Q7HKuF055743@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: f12f5d1d6629 - stable/13 - devd(8): correct error logging List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f12f5d1d6629ed17af1d096e5a906dc773df2064 Auto-Submitted: auto-generated The branch stable/13 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=f12f5d1d6629ed17af1d096e5a906dc773df2064 commit f12f5d1d6629ed17af1d096e5a906dc773df2064 Author: Eugene Grosbein AuthorDate: 2025-07-22 09:55:08 +0000 Commit: Eugene Grosbein CommitDate: 2025-07-26 07:16:47 +0000 devd(8): correct error logging Fix a mistake in a log message that leaked from my preliminary patch. PR: 287873 MFC after: 3 days X-MFC-with: bd4a4e46ceacd8dfc5a5469ec6edd8c92c53605a (cherry picked from commit 044febb24a26d92066b2849eb583f57e37acdbfd) --- sbin/devd/devd.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sbin/devd/devd.cc b/sbin/devd/devd.cc index 139bb912881d..d25e60a08cba 100644 --- a/sbin/devd/devd.cc +++ b/sbin/devd/devd.cc @@ -1321,8 +1321,7 @@ main(int argc, char **argv) len = sizeof(vm_guest); if (sysctlbyname("kern.vm_guest", vm_guest, &len, NULL, 0) < 0) { devdlog(LOG_ERR, - "sysctlnametomib(kern.vm_guest) failed: %d\n", - errno); + "sysctlbyname(kern.vm_guest) failed: %d\n", errno); } cfg.parse(); From nobody Sat Jul 26 11:12:33 2025 X-Original-To: dev-commits-src-branches@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 4bq2C53238z63MQj; Sat, 26 Jul 2025 11:12:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bq2C529XYz4P10; Sat, 26 Jul 2025 11:12:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753528353; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dQPwGwMvyHHMA5lBM0wFJ9TY0/XqooOlpA1te8Y9YP0=; b=cYrzj+k8AcLtnZPLhyC7vflVR1AnYrwp74cj4QeCWIOIBtB0KRM47Pzj3RYg412b3JoDQN nf+7kDbCIHjoxY4BE5sKQCH68yKGJeUvKe+ens8SXagRBagij7H9woze3+9y0s0c/hwQMx OBZW+eOoozsrjdAYklwoR/LK/da+IBWsr9UeJZPR3+9iV7mlxTGBg6j5K5mdEftgpDaEWA Q229tgt5A2SMtjoR+lwdWRSc2zDPgIQmz6EBx8aViFt6cij5ZRH3b5op/P5xiVMTfu4z+m oW7irTusvridv6/dCp5c/fFJTf5uN1socm+WaTyiTENuOi/sv7AJF5vTz9y4Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753528353; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dQPwGwMvyHHMA5lBM0wFJ9TY0/XqooOlpA1te8Y9YP0=; b=UB4fUymbxlAZL6PoCG7FNOmzJkEPG/LZnXxciaxJyTH0p2yEGdeUHNQZF28CGOgFIs3WZJ 5PLNlKeRy9OTxOtVH202Qq6BP0jd99vF4c6yE1TVSkIq7lwBbv38vGu7WAamVBgJGlMmVf J7dQh7vJf9z3/JEC44PkHFAwss3ZE9Q/kGS+pRZjd7o/fDdM7AQFuSnHYugs9SzvBQthzi fisKzCM9ieoeJzIMSFWlok+t4lHgV8LAETUwxul0WTcK1iaVF0TcTYZGlBg55iXqLIOWJq K8OX2eMI6QZONiuq6XqhtT36QKRdYu/xuIh4b9euXhppvuhNaB73GmlLGXMD0g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753528353; a=rsa-sha256; cv=none; b=cB9Sr5WqSfoG69aEqjKLb2B9/wnqONgb4BJhcqwASiwFJjPbbjl6P5uW1ttMJIw2dHoqZG 9gc8wHRyvatvaEYiuDDoHefHltqxOOm26fbXHmfCe11tXJTbyBl+dnOvF2mQTCXs7ECwQO ZN1vDGYRNcRI4k2DXl+Tt3THgEjeeZD9gYK3a8l6RiZsqBSF0qtxavs6pGH8lVh3dufOJl C7yBn+kEtEbn06yCcWcrjuTqofUypbTPVlfh8zhDBr2PwYTrCDat6Iaw1SmtXyZd8x2SjK wL997Wz62Xc3n83PS96LV9IemBPji481/g2SR0lFAbx3lpyobJcemsFTTZ8l5A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bq2C51G9FzCJH; Sat, 26 Jul 2025 11:12:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56QBCXPX005635; Sat, 26 Jul 2025 11:12:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56QBCXkM005632; Sat, 26 Jul 2025 11:12:33 GMT (envelope-from git) Date: Sat, 26 Jul 2025 11:12:33 GMT Message-Id: <202507261112.56QBCXkM005632@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: 4f8cb9f1daf8 - stable/13 - MFC: ice: unbreak build with update to 1.42.5-k List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4f8cb9f1daf80f7e23d581a86bb47cd47717f095 Auto-Submitted: auto-generated The branch stable/13 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=4f8cb9f1daf80f7e23d581a86bb47cd47717f095 commit 4f8cb9f1daf80f7e23d581a86bb47cd47717f095 Author: Eric Joyner AuthorDate: 2024-08-30 00:28:59 +0000 Commit: Eugene Grosbein CommitDate: 2025-07-26 11:11:17 +0000 MFC: ice: unbreak build with update to 1.42.5-k - Removes duplicate E825C printout - Fixes a package download issue with E830 - Updates mentions of E830-XXV to E830-L - Fix FW logging on load issue by limiting the setting of FW log masks and other global configuration to just the first PF of the controller - Update ice_hw_autogen.h with timesync registers (unused in this driver) - Fix possible overflow condition in NVM access function - Blocks RDMA load on E830 devices Signed-off-by: Eric Joyner Tested by: Jeffrey Pieper Relnotes: yes Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D46950 (cherry picked from commit 440addc642496f8d04fe17af9eb905ac4a5bdbd8) (cherry picked from commit 5f92347a9bc8f372eef46555e2ba3de65259f97d) --- sys/dev/ice/ice_ddp_common.c | 31 +++++++++++++++++--- sys/dev/ice/ice_ddp_common.h | 5 +++- sys/dev/ice/ice_devids.h | 12 ++++---- sys/dev/ice/ice_drv_info.h | 20 ++++++------- sys/dev/ice/ice_fw_logging.c | 69 +++++++++++++++++++++++--------------------- sys/dev/ice/ice_hw_autogen.h | 14 +++++++++ sys/dev/ice/ice_lib.c | 38 ------------------------ sys/dev/ice/ice_lib.h | 1 - sys/dev/ice/ice_nvm.c | 36 +++++++++++++++-------- sys/dev/ice/if_ice_iflib.c | 9 +++--- 10 files changed, 126 insertions(+), 109 deletions(-) diff --git a/sys/dev/ice/ice_ddp_common.c b/sys/dev/ice/ice_ddp_common.c index 87ecdad5e7bf..dfc50cc1f966 100644 --- a/sys/dev/ice/ice_ddp_common.c +++ b/sys/dev/ice/ice_ddp_common.c @@ -526,12 +526,13 @@ ice_download_pkg_sig_seg(struct ice_hw *hw, struct ice_sign_seg *seg) * @idx: segment index * @start: starting buffer * @count: buffer count + * @last_seg: last segment being downloaded * * Note: idx must reference a ICE segment */ static enum ice_ddp_state ice_download_pkg_config_seg(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr, - u32 idx, u32 start, u32 count) + u32 idx, u32 start, u32 count, bool last_seg) { struct ice_buf_table *bufs; enum ice_ddp_state state; @@ -549,7 +550,7 @@ ice_download_pkg_config_seg(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr, return ICE_DDP_PKG_ERR; state = ice_dwnld_cfg_bufs_no_lock(hw, bufs->buf_array, start, count, - true); + last_seg); return state; } @@ -568,9 +569,11 @@ ice_dwnld_sign_and_cfg_segs(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr, { enum ice_ddp_state state; struct ice_sign_seg *seg; + bool last_seg = true; u32 conf_idx; u32 start; u32 count; + u32 flags; seg = (struct ice_sign_seg *)ice_get_pkg_seg_by_idx(pkg_hdr, idx); if (!seg) { @@ -581,6 +584,10 @@ ice_dwnld_sign_and_cfg_segs(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr, conf_idx = LE32_TO_CPU(seg->signed_seg_idx); start = LE32_TO_CPU(seg->signed_buf_start); count = LE32_TO_CPU(seg->signed_buf_count); + flags = LE32_TO_CPU(seg->flags); + + if (flags & ICE_SIGN_SEG_FLAGS_VALID) + last_seg = !!(flags & ICE_SIGN_SEG_FLAGS_LAST); state = ice_download_pkg_sig_seg(hw, seg); if (state) @@ -595,7 +602,7 @@ ice_dwnld_sign_and_cfg_segs(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr, } state = ice_download_pkg_config_seg(hw, pkg_hdr, conf_idx, start, - count); + count, last_seg); exit: return state; @@ -2321,6 +2328,22 @@ void ice_release_change_lock(struct ice_hw *hw) ice_release_res(hw, ICE_CHANGE_LOCK_RES_ID); } +/** + * ice_is_get_tx_sched_new_format + * @hw: pointer to the HW struct + * + * Determines if the new format for the Tx scheduler get api is supported + */ +static bool +ice_is_get_tx_sched_new_format(struct ice_hw *hw) +{ + if (ice_is_e830(hw)) + return true; + if (ice_is_e825c(hw)) + return true; + return false; +} + /** * ice_get_set_tx_topo - get or set tx topology * @hw: pointer to the HW struct @@ -2354,7 +2377,7 @@ ice_get_set_tx_topo(struct ice_hw *hw, u8 *buf, u16 buf_size, ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_tx_topo); cmd->get_flags = ICE_AQC_TX_TOPO_GET_RAM; - if (!ice_is_e830(hw)) + if (!ice_is_get_tx_sched_new_format(hw)) desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD); } diff --git a/sys/dev/ice/ice_ddp_common.h b/sys/dev/ice/ice_ddp_common.h index b7dae1f526f0..a7b717c3e15e 100644 --- a/sys/dev/ice/ice_ddp_common.h +++ b/sys/dev/ice/ice_ddp_common.h @@ -204,7 +204,10 @@ struct ice_sign_seg { __le32 signed_seg_idx; __le32 signed_buf_start; __le32 signed_buf_count; -#define ICE_SIGN_SEG_RESERVED_COUNT 44 +#define ICE_SIGN_SEG_FLAGS_VALID 0x80000000 +#define ICE_SIGN_SEG_FLAGS_LAST 0x00000001 + __le32 flags; +#define ICE_SIGN_SEG_RESERVED_COUNT 40 u8 reserved[ICE_SIGN_SEG_RESERVED_COUNT]; struct ice_buf_table buf_tbl; }; diff --git a/sys/dev/ice/ice_devids.h b/sys/dev/ice/ice_devids.h index 396f59b9d6d9..9b142a1110b2 100644 --- a/sys/dev/ice/ice_devids.h +++ b/sys/dev/ice/ice_devids.h @@ -52,16 +52,16 @@ #define ICE_DEV_ID_E830_SFP 0x12D3 /* Intel(R) Ethernet Controller E830-C for backplane */ #define ICE_DEV_ID_E830C_BACKPLANE 0x12D5 -/* Intel(R) Ethernet Controller E830-XXV for backplane */ -#define ICE_DEV_ID_E830_XXV_BACKPLANE 0x12DC +/* Intel(R) Ethernet Controller E830-L for backplane */ +#define ICE_DEV_ID_E830_L_BACKPLANE 0x12DC /* Intel(R) Ethernet Controller E830-C for QSFP */ #define ICE_DEV_ID_E830C_QSFP 0x12D8 -/* Intel(R) Ethernet Controller E830-XXV for QSFP */ -#define ICE_DEV_ID_E830_XXV_QSFP 0x12DD +/* Intel(R) Ethernet Controller E830-L for QSFP */ +#define ICE_DEV_ID_E830_L_QSFP 0x12DD /* Intel(R) Ethernet Controller E830-C for SFP */ #define ICE_DEV_ID_E830C_SFP 0x12DA -/* Intel(R) Ethernet Controller E830-XXV for SFP */ -#define ICE_DEV_ID_E830_XXV_SFP 0x12DE +/* Intel(R) Ethernet Controller E830-L for SFP */ +#define ICE_DEV_ID_E830_L_SFP 0x12DE /* Intel(R) Ethernet Controller E810-C for backplane */ #define ICE_DEV_ID_E810C_BACKPLANE 0x1591 /* Intel(R) Ethernet Controller E810-C for QSFP */ diff --git a/sys/dev/ice/ice_drv_info.h b/sys/dev/ice/ice_drv_info.h index 6f4d5f05edd0..22e23ee53491 100644 --- a/sys/dev/ice/ice_drv_info.h +++ b/sys/dev/ice/ice_drv_info.h @@ -62,16 +62,16 @@ * @var ice_rc_version * @brief driver release candidate version number */ -const char ice_driver_version[] = "1.42.1-k"; +const char ice_driver_version[] = "1.42.5-k"; const uint8_t ice_major_version = 1; const uint8_t ice_minor_version = 42; -const uint8_t ice_patch_version = 1; +const uint8_t ice_patch_version = 5; const uint8_t ice_rc_version = 0; #define PVIDV(vendor, devid, name) \ - PVID(vendor, devid, name " - 1.42.1-k") + PVID(vendor, devid, name " - 1.42.5-k") #define PVIDV_OEM(vendor, devid, svid, sdevid, revid, name) \ - PVID_OEM(vendor, devid, svid, sdevid, revid, name " - 1.42.1-k") + PVID_OEM(vendor, devid, svid, sdevid, revid, name " - 1.42.5-k") /** * @var ice_vendor_info_array @@ -217,12 +217,12 @@ static const pci_vendor_info_t ice_vendor_info_array[] = { "Intel(R) Ethernet Connection E830-C for QSFP"), PVIDV(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E830C_SFP, "Intel(R) Ethernet Connection E830-C for SFP"), - PVIDV(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E830_XXV_BACKPLANE, - "Intel(R) Ethernet Connection E830-XXV for backplane"), - PVIDV(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E830_XXV_QSFP, - "Intel(R) Ethernet Connection E830-XXV for QSFP"), - PVIDV(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E830_XXV_SFP, - "Intel(R) Ethernet Connection E830-XXV for SFP"), + PVIDV(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E830_L_BACKPLANE, + "Intel(R) Ethernet Connection E830-L for backplane"), + PVIDV(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E830_L_QSFP, + "Intel(R) Ethernet Connection E830-L for QSFP"), + PVIDV(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E830_L_SFP, + "Intel(R) Ethernet Connection E830-L for SFP"), PVIDV(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E825C_BACKPLANE, "Intel(R) Ethernet Connection E825-C for backplane"), PVIDV(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E825C_QSFP, diff --git a/sys/dev/ice/ice_fw_logging.c b/sys/dev/ice/ice_fw_logging.c index 8e52e34b2752..0025a65d73fc 100644 --- a/sys/dev/ice/ice_fw_logging.c +++ b/sys/dev/ice/ice_fw_logging.c @@ -359,23 +359,6 @@ ice_add_fw_logging_tunables(struct ice_softc *sc, struct sysctl_oid *parent) "Firmware Logging"); fwlog_list = SYSCTL_CHILDREN(fwlog_node); - cfg->log_resolution = 10; - SYSCTL_ADD_PROC(ctx, fwlog_list, OID_AUTO, "log_resolution", - ICE_CTLFLAG_DEBUG | CTLTYPE_U8 | CTLFLAG_RWTUN, sc, - 0, ice_sysctl_fwlog_log_resolution, - "CU", ICE_SYSCTL_HELP_FWLOG_LOG_RESOLUTION); - - cfg->options |= ICE_FWLOG_OPTION_ARQ_ENA; - SYSCTL_ADD_PROC(ctx, fwlog_list, OID_AUTO, "arq_en", - ICE_CTLFLAG_DEBUG | CTLTYPE_U8 | CTLFLAG_RWTUN, sc, - ICE_FWLOG_OPTION_ARQ_ENA, ice_sysctl_fwlog_set_cfg_options, - "CU", ICE_SYSCTL_HELP_FWLOG_ARQ_ENA); - - SYSCTL_ADD_PROC(ctx, fwlog_list, OID_AUTO, "uart_en", - ICE_CTLFLAG_DEBUG | CTLTYPE_U8 | CTLFLAG_RWTUN, sc, - ICE_FWLOG_OPTION_UART_ENA, ice_sysctl_fwlog_set_cfg_options, - "CU", ICE_SYSCTL_HELP_FWLOG_UART_ENA); - SYSCTL_ADD_PROC(ctx, fwlog_list, OID_AUTO, "on_load", ICE_CTLFLAG_DEBUG | CTLTYPE_U8 | CTLFLAG_RWTUN, sc, ICE_FWLOG_OPTION_REGISTER_ON_INIT, ice_sysctl_fwlog_set_cfg_options, @@ -386,23 +369,43 @@ ice_add_fw_logging_tunables(struct ice_softc *sc, struct sysctl_oid *parent) 0, ice_sysctl_fwlog_register, "CU", ICE_SYSCTL_HELP_FWLOG_REGISTER); - module_node = SYSCTL_ADD_NODE(ctx, fwlog_list, OID_AUTO, "severity", - ICE_CTLFLAG_DEBUG | CTLFLAG_RD, NULL, - "Level of log output"); - - module_list = SYSCTL_CHILDREN(module_node); - - for (i = 0; i < ICE_AQC_FW_LOG_ID_MAX; i++) { - /* Setup some defaults */ - cfg->module_entries[i].module_id = i; - cfg->module_entries[i].log_level = ICE_FWLOG_LEVEL_NONE; - module = (enum ice_aqc_fw_logging_mod)i; + hw->pf_id = ice_get_pf_id(hw); + if (hw->pf_id == 0) { + module_node = SYSCTL_ADD_NODE(ctx, fwlog_list, OID_AUTO, "severity", + ICE_CTLFLAG_DEBUG | CTLFLAG_RD, NULL, + "Level of log output"); + + module_list = SYSCTL_CHILDREN(module_node); + + for (i = 0; i < ICE_AQC_FW_LOG_ID_MAX; i++) { + /* Setup some defaults */ + cfg->module_entries[i].module_id = i; + cfg->module_entries[i].log_level = ICE_FWLOG_LEVEL_NONE; + module = (enum ice_aqc_fw_logging_mod)i; + + SYSCTL_ADD_PROC(ctx, module_list, + OID_AUTO, ice_fw_module_str(module), + ICE_CTLFLAG_DEBUG | CTLTYPE_STRING | CTLFLAG_RWTUN, sc, + module, ice_sysctl_fwlog_module_log_severity, + "A", ICE_SYSCTL_HELP_FWLOG_MODULE_SEVERITY); + } - SYSCTL_ADD_PROC(ctx, module_list, - OID_AUTO, ice_fw_module_str(module), - ICE_CTLFLAG_DEBUG | CTLTYPE_STRING | CTLFLAG_RWTUN, sc, - module, ice_sysctl_fwlog_module_log_severity, - "A", ICE_SYSCTL_HELP_FWLOG_MODULE_SEVERITY); + cfg->log_resolution = 10; + SYSCTL_ADD_PROC(ctx, fwlog_list, OID_AUTO, "log_resolution", + ICE_CTLFLAG_DEBUG | CTLTYPE_U8 | CTLFLAG_RWTUN, sc, + 0, ice_sysctl_fwlog_log_resolution, + "CU", ICE_SYSCTL_HELP_FWLOG_LOG_RESOLUTION); + + cfg->options |= ICE_FWLOG_OPTION_ARQ_ENA; + SYSCTL_ADD_PROC(ctx, fwlog_list, OID_AUTO, "arq_en", + ICE_CTLFLAG_DEBUG | CTLTYPE_U8 | CTLFLAG_RWTUN, sc, + ICE_FWLOG_OPTION_ARQ_ENA, ice_sysctl_fwlog_set_cfg_options, + "CU", ICE_SYSCTL_HELP_FWLOG_ARQ_ENA); + + SYSCTL_ADD_PROC(ctx, fwlog_list, OID_AUTO, "uart_en", + ICE_CTLFLAG_DEBUG | CTLTYPE_U8 | CTLFLAG_RWTUN, sc, + ICE_FWLOG_OPTION_UART_ENA, ice_sysctl_fwlog_set_cfg_options, + "CU", ICE_SYSCTL_HELP_FWLOG_UART_ENA); } } diff --git a/sys/dev/ice/ice_hw_autogen.h b/sys/dev/ice/ice_hw_autogen.h index 47256263d66c..3f2778d91a4b 100644 --- a/sys/dev/ice/ice_hw_autogen.h +++ b/sys/dev/ice/ice_hw_autogen.h @@ -40,6 +40,20 @@ #define PRTMAC_CTL_RX_PAUSE_ENABLE_BY_MAC(hw) ((hw)->mac_type == ICE_MAC_E830 ? E830_PRTMAC_CTL_RX_PAUSE_ENABLE : E800_PRTMAC_HSEC_CTL_RX_PAUSE_ENABLE) #define PRTMAC_CTL_RX_PAUSE_ENABLE_RX_PAUSE_ENABLE_S_BY_MAC(hw) ((hw)->mac_type == ICE_MAC_E830 ? E830_PRTMAC_CTL_RX_PAUSE_ENABLE_RX_PAUSE_ENABLE_S : E800_PRTMAC_HSEC_CTL_RX_PAUSE_ENABLE_HSEC_CTL_RX_PAUSE_ENABLE_S) #define PRTMAC_CTL_RX_PAUSE_ENABLE_RX_PAUSE_ENABLE_M_BY_MAC(hw) ((hw)->mac_type == ICE_MAC_E830 ? E830_PRTMAC_CTL_RX_PAUSE_ENABLE_RX_PAUSE_ENABLE_M : E800_PRTMAC_HSEC_CTL_RX_PAUSE_ENABLE_HSEC_CTL_RX_PAUSE_ENABLE_M) +#define E830_GLTCLAN_TSYN_REG_RANGE_ENFORCE(_i) (0x000FD000 + ((_i) * 64)) /* _i=0...7 */ /* Reset Source: CORER */ +#define E830_GLTCLAN_TSYN_REG_RANGE_ENFORCE_MAX_INDEX 7 +#define E830_GLTCLAN_TSYN_REG_RANGE_ENFORCE_START_S 0 +#define E830_GLTCLAN_TSYN_REG_RANGE_ENFORCE_START_M MAKEMASK(0x3F, 0) +#define E830_GLTCLAN_TSYN_REG_RANGE_ENFORCE_END_S 6 +#define E830_GLTCLAN_TSYN_REG_RANGE_ENFORCE_END_M MAKEMASK(0x3F, 6) +#define E830_GLTCLAN_TSYN_REG_RANGE_ENFORCE_VM_VF_TYPE_S 12 +#define E830_GLTCLAN_TSYN_REG_RANGE_ENFORCE_VM_VF_TYPE_M MAKEMASK(0x3, 12) +#define E830_GLTCLAN_TSYN_REG_RANGE_ENFORCE_VM_VF_NUM_S 14 +#define E830_GLTCLAN_TSYN_REG_RANGE_ENFORCE_VM_VF_NUM_M MAKEMASK(0x3FF, 14) +#define E830_GLTCLAN_TSYN_REG_RANGE_ENFORCE_PF_NUM_S 24 +#define E830_GLTCLAN_TSYN_REG_RANGE_ENFORCE_PF_NUM_M MAKEMASK(0x7, 24) +#define E830_GLTCLAN_TSYN_REG_RANGE_ENFORCE_ENABLE_S 31 +#define E830_GLTCLAN_TSYN_REG_RANGE_ENFORCE_ENABLE_M BIT(31) #define GL_HIDA(_i) (0x00082000 + ((_i) * 4)) #define GL_HIBA(_i) (0x00081000 + ((_i) * 4)) #define GL_HICR 0x00082040 diff --git a/sys/dev/ice/ice_lib.c b/sys/dev/ice/ice_lib.c index 88600a05eeee..24dae96326a6 100644 --- a/sys/dev/ice/ice_lib.c +++ b/sys/dev/ice/ice_lib.c @@ -11875,44 +11875,6 @@ ice_sysctl_allow_no_fec_mod_in_auto(SYSCTL_HANDLER_ARGS) return (0); } -/** - * ice_print_dual_nac_info - Print NAC status/ID information - * @sc: device softc structure - * - * Prints out information about the NAC mode if the device is capable of - * being part of a system with multiple NACs. - * - * @pre Must be called after ice_init_hw() and ice_init_device_features() - * sometime during driver load. - */ -void -ice_print_dual_nac_info(struct ice_softc *sc) -{ - struct ice_hw *hw = &sc->hw; - device_t dev = sc->dev; - bool is_dual_nac, is_primary_nac; - u8 cpk_id; - - is_dual_nac = (hw->dev_caps.nac_topo.mode & ICE_NAC_TOPO_DUAL_M); - is_primary_nac = (hw->dev_caps.nac_topo.mode & ICE_NAC_TOPO_PRIMARY_M); - cpk_id = hw->dev_caps.nac_topo.id; - - if (ice_is_bit_set(sc->feat_cap, ICE_FEATURE_DUAL_NAC)) { - log(LOG_INFO, "%s: In %s NAC mode\n", - device_get_nameunit(dev), - is_dual_nac ? "Dual" : "Single"); - - if (is_dual_nac) { - ice_set_bit(ICE_FEATURE_DUAL_NAC, sc->feat_en); - log(LOG_INFO, - "%s: PF is configured in %s mode with IP instance ID %u\n", - device_get_nameunit(dev), - is_primary_nac ? "primary" : "secondary", - cpk_id); - } - } -} - /** * ice_sysctl_temperature - Retrieve NIC temp via AQ command * @oidp: sysctl oid structure diff --git a/sys/dev/ice/ice_lib.h b/sys/dev/ice/ice_lib.h index bbb2bad1c488..ca736746206d 100644 --- a/sys/dev/ice/ice_lib.h +++ b/sys/dev/ice/ice_lib.h @@ -1013,7 +1013,6 @@ void ice_init_health_events(struct ice_softc *sc); void ice_cfg_pba_num(struct ice_softc *sc); int ice_handle_debug_dump_ioctl(struct ice_softc *sc, struct ifdrv *ifd); u8 ice_dcb_get_tc_map(const struct ice_dcbx_cfg *dcbcfg); -void ice_print_dual_nac_info(struct ice_softc *sc); void ice_do_dcb_reconfig(struct ice_softc *sc, bool pending_mib); int ice_setup_vsi_mirroring(struct ice_vsi *vsi); diff --git a/sys/dev/ice/ice_nvm.c b/sys/dev/ice/ice_nvm.c index 9a41f30386c0..ff30adfe8fa7 100644 --- a/sys/dev/ice/ice_nvm.c +++ b/sys/dev/ice/ice_nvm.c @@ -711,6 +711,8 @@ int ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data) return status; } +#define check_add_overflow __builtin_add_overflow + /** * ice_get_pfa_module_tlv - Reads sub module TLV from NVM PFA * @hw: pointer to hardware structure @@ -726,8 +728,7 @@ int ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len, u16 module_type) { - u16 pfa_len, pfa_ptr; - u32 next_tlv; + u16 pfa_len, pfa_ptr, next_tlv, max_tlv; int status; status = ice_read_sr_word(hw, ICE_SR_PFA_PTR, &pfa_ptr); @@ -740,11 +741,23 @@ ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len, ice_debug(hw, ICE_DBG_INIT, "Failed to read PFA length.\n"); return status; } - /* Starting with first TLV after PFA length, iterate through the list + + if (check_add_overflow(pfa_ptr, (u16)(pfa_len - 1), &max_tlv)) { + ice_debug(hw, ICE_DBG_INIT, "PFA starts at offset %u. PFA length of %u caused 16-bit arithmetic overflow.\n", + pfa_ptr, pfa_len); + return ICE_ERR_INVAL_SIZE; + } + + /* The Preserved Fields Area contains a sequence of TLVs which define + * its contents. The PFA length includes all of the TLVs, plus its + * initial length word itself, *and* one final word at the end of all + * of the TLVs. + * + * Starting with first TLV after PFA length, iterate through the list * of TLVs to find the requested one. */ next_tlv = pfa_ptr + 1; - while (next_tlv < ((u32)pfa_ptr + pfa_len)) { + while (next_tlv < max_tlv) { u16 tlv_sub_module_type; u16 tlv_len; @@ -761,10 +774,6 @@ ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len, ice_debug(hw, ICE_DBG_INIT, "Failed to read TLV length.\n"); break; } - if (tlv_len > pfa_len) { - ice_debug(hw, ICE_DBG_INIT, "Invalid TLV length.\n"); - return ICE_ERR_INVAL_SIZE; - } if (tlv_sub_module_type == module_type) { if (tlv_len) { *module_tlv = (u16)next_tlv; @@ -773,10 +782,13 @@ ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len, } return ICE_ERR_INVAL_SIZE; } - /* Check next TLV, i.e. current TLV pointer + length + 2 words - * (for current TLV's type and length) - */ - next_tlv = next_tlv + tlv_len + 2; + + if (check_add_overflow(next_tlv, (u16)2, &next_tlv) || + check_add_overflow(next_tlv, tlv_len, &next_tlv)) { + ice_debug(hw, ICE_DBG_INIT, "TLV of type %u and length 0x%04x caused 16-bit arithmetic overflow. The PFA starts at 0x%04x and has length of 0x%04x\n", + tlv_sub_module_type, tlv_len, pfa_ptr, pfa_len); + return ICE_ERR_INVAL_SIZE; + } } /* Module does not exist */ return ICE_ERR_DOES_NOT_EXIST; diff --git a/sys/dev/ice/if_ice_iflib.c b/sys/dev/ice/if_ice_iflib.c index 56bd56d8d2ea..72482d534eb5 100644 --- a/sys/dev/ice/if_ice_iflib.c +++ b/sys/dev/ice/if_ice_iflib.c @@ -546,8 +546,6 @@ reinit_hw: ice_init_device_features(sc); - ice_print_dual_nac_info(sc); - /* Keep flag set by default */ ice_set_state(&sc->state, ICE_STATE_LINK_ACTIVE_ON_DOWN); @@ -2612,7 +2610,9 @@ ice_rebuild(struct ice_softc *sc) } /* Re-enable FW logging. Keep going even if this fails */ - status = ice_fwlog_set(hw, &hw->fwlog_cfg); + status = ICE_SUCCESS; + if (hw->pf_id == 0) + status = ice_fwlog_set(hw, &hw->fwlog_cfg); if (!status) { /* * We should have the most updated cached copy of the @@ -2908,7 +2908,8 @@ ice_init_device_features(struct ice_softc *sc) /* Disable features due to hardware limitations... */ if (!hw->func_caps.common_cap.rss_table_size) ice_clear_bit(ICE_FEATURE_RSS, sc->feat_cap); - if (!hw->func_caps.common_cap.iwarp || !ice_enable_irdma) + if (!hw->func_caps.common_cap.iwarp || !ice_enable_irdma || + ice_is_e830(hw)) ice_clear_bit(ICE_FEATURE_RDMA, sc->feat_cap); if (!hw->func_caps.common_cap.dcb) ice_clear_bit(ICE_FEATURE_DCB, sc->feat_cap); From nobody Sat Jul 26 20:41:51 2025 X-Original-To: dev-commits-src-branches@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 4bqGqz4nD6z62Rfy; Sat, 26 Jul 2025 20:41:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bqGqz3vXnz3lnj; Sat, 26 Jul 2025 20:41:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753562511; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jEWb7U14w9snMlCq+WoMqDHae4ytU1/ClUiom8NvvzE=; b=K7lB0uM9Y8twzfGsMMkeE89tYlrPCakIi2QhwjbZaKPB2reGlDZQOf9olkjT1Sa0tYZmvz 3LwN+Ts8GZKGN2OtuwQPy8BlSLbPlc8YgndqVSHiccDJXuAU+FO/moYwafaBCTGf1Z1tBW fRQsfpY1tSAN4Tt1ZCV5yyJwlsg7duN22iFJ1+FlPNJYt6LU2NClPwuId6FUQEWoENurp3 qeunYPc4/MSGdnD40FdV1B3R+ukjpVmsQkQW3B3yQgSYMD4DIWMqYr5tUkzE1TBpeWnUZ6 Fe1iF54AqiTV4tA7aDxMhP5GyroJLxfV3EYBKlRevWSVsbXwUfZLhuIpg2jkLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753562511; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jEWb7U14w9snMlCq+WoMqDHae4ytU1/ClUiom8NvvzE=; b=Bqu0HcEvSJXJUHhK7x0nWEIqea+x17dJ457aih+tZqu+ZWvTT9s16VXMQxMQ4ahrNK3sjP 9SCc3L/fV5FxHDWAjhYDzMIp6HAxyeEupQxNBrvDEhEphReJVunjllOSi2oEbk1TUKe2MZ bKYeLhdsDYM5FREYU6aIYOuMYM3Vp+hcbifoqcPQSgRX+yKqCfcmil4UtBKcxS6hwwwyvB jYCTZSBpPXZLPKN9XpLTHwpD0/A8laFe8cMwrMmGYEY7Q4DmneKxvk/MDqAX13EVrHE6Fh kSKpwC25XrHDV40+9sO+awdwFVJv2ItLWNNGLxgom3J5OOlYaSGROsSfFuOVjg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753562511; a=rsa-sha256; cv=none; b=GKGLmOlLgYJxLDHO1O63DnsQ9vPRkHL0lOHoUuqw8uXOcHV/aFC0Uko+MMCgn9wM3ybu15 bIr0nhwJI+o9kzsninijlN2Xmxk24upBASFrQmRYgCqL231/TBMaRn5PWUF+8QcpPE6loj RZxBwOYr0vsMcowayu0u6b88xEUIJfSHSRq/PrtDalu/unNmmzr3UuTmLuOCXdqWqvODoi t1EZJxZKXN9m9Om3tfOnULr7+AWh1RYzWJ/zrYhCHjZHZikFsEc6qr2bnuUZEPGS7ukgh0 4Xl3dZ0XhGj4EG2Gj3JkjG8z19lRw1/qHY2hiPq0k8vdVtkXIdnvh4/qUvh5qQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bqGqz3W3DzlXj; Sat, 26 Jul 2025 20:41:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56QKfpu8075749; Sat, 26 Jul 2025 20:41:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56QKfpU3075746; Sat, 26 Jul 2025 20:41:51 GMT (envelope-from git) Date: Sat, 26 Jul 2025 20:41:51 GMT Message-Id: <202507262041.56QKfpU3075746@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Gallatin Subject: git: 83a352bcac0a - stable/14 - lagg: Fix if_hw_tsomax_update() not being called List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 83a352bcac0a72feb04e441b5a54ad7f63f9922a Auto-Submitted: auto-generated The branch stable/14 has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=83a352bcac0a72feb04e441b5a54ad7f63f9922a commit 83a352bcac0a72feb04e441b5a54ad7f63f9922a Author: Andrew Gallatin AuthorDate: 2025-07-12 22:35:29 +0000 Commit: Andrew Gallatin CommitDate: 2025-07-26 20:07:37 +0000 lagg: Fix if_hw_tsomax_update() not being called In a mixed lagg, its likely that ifcaps or hwassist may not match between members. If this is true, the logical OR will be short-circuited and if_hw_tsomax_update() will not be called. Fix this by calling it inside the body of the if as well Sponsored by: Netflix (cherry picked from commit 78bdaa57cfbac759a6d79ecad2fae570e294a4b3) --- sys/net/if_lagg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index f226ce11ca37..b7b41ee22434 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -714,6 +714,7 @@ lagg_capabilities(struct lagg_softc *sc) sc->sc_ifp->if_capenable = ena; sc->sc_ifp->if_capenable2 = ena2; sc->sc_ifp->if_hwassist = hwa; + (void)if_hw_tsomax_update(sc->sc_ifp, &hw_tsomax); getmicrotime(&sc->sc_ifp->if_lastchange); if (sc->sc_ifflags & IFF_DEBUG)