From nobody Mon Jul 8 10:44:26 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHgjR28gPz5Psfk; Mon, 08 Jul 2024 10:44:27 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHgjR04Bvz4Q8Y; Mon, 8 Jul 2024 10:44:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720435467; 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=Vd/33S1nb0TFHMZxE0J3k85x9DDD8lGCaxqw5xBpV4M=; b=EzMbmirTFV2vEqcFB8zaO+6duDzKy/exIPoZGgEmx76zNb/NE/Z953etV5TDOt7KuD8pZm iwtySxlL/IdW7pL8+RbGZcRMdUjEPS5WbAurqymP+quVdWCqtNGICx6VcCYG4g5xf/25or X1Lb5/VufFsu7pFOZ5/6T997Bxmd0bAxnIU99i6zQdyG3lOWMg4SvAbURzqbEzw6tZiuE1 unZIWNSrt1TJU5aF2TyIEhT34hXnb6a2f6yXsfiVkTIh4TgRx5KGcCHP61gp81Ra7gdHZF H753qqho0+ePOCT7QXw+4wiZqX5YxYawr2GOZWl8YTQagxF5gQbs1mxLr1tJhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720435467; a=rsa-sha256; cv=none; b=Bx5oeUyJFasJKrObDa77nAACw8/MmsRCOfjcX8Os2QVBbekyk/2QIqZRc7Ir2LrLYLVEwz Spd4AlX8cwVevAa8/mW8WnIoGboxVdckVx80KJQsCjvx4/B6LopmGMwFaTgGPckPaUJBxj ZODN0b+x9gRS3s1c1ihyIyAIkj3hhkKe9C+cYnSH3lnodN4UfWXQMy+moJN38mb+g/nzqd KTRHAK8efbsJQTYzTgdc7aJTLuFfkriHOsw4OzBwO2URbQbGXQzyl2vK6VHKStN4grB6KM zek+CSU9bL1DG0oD5TKxA7ox9+/xHJIOu5WSem+O6cZ8ISCPRELewf4EIDxJJg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720435467; 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=Vd/33S1nb0TFHMZxE0J3k85x9DDD8lGCaxqw5xBpV4M=; b=WvwUySUxZgChgvUiWi6YuXM/VmjikuxWP3zz5gajuQDHUVOXpkww9nJOgDdpoxy4EwdyQA /Fnt88PULIPnSzaaB/kx85Tsqx5L3/65ogMDSJweGEYPpotHnoC9k/2ArtBHFxT6qyIKAl k5vH9V7ZB7g6NELZVTSZLvp3RUwkzPkHra+Msw/76kRffLVsfHkK4x509uYPRjGvxUySek NicIRdevdITzvH12PCIMLzJPIS9Uy38weV415AN8PXcAkydBN5ViQmjv3pxGPU6wKNYKnO 0H6SStEXgGFUrIn1JQrcbRaUYw7nZswXrLIAJNxCO51YjcIjb/kjdUa2IdBpiQ== 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 4WHgjQ6p1yzpB6; Mon, 8 Jul 2024 10:44: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 468AiQfw021738; Mon, 8 Jul 2024 10:44:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468AiQM1021735; Mon, 8 Jul 2024 10:44:26 GMT (envelope-from git) Date: Mon, 8 Jul 2024 10:44:26 GMT Message-Id: <202407081044.468AiQM1021735@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: 96d8f35f2a2b - main - bde: remove lingering references List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 96d8f35f2a2bf13e0ecf203e3ce514a3c05e3691 Auto-Submitted: auto-generated The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=96d8f35f2a2bf13e0ecf203e3ce514a3c05e3691 commit 96d8f35f2a2bf13e0ecf203e3ce514a3c05e3691 Author: Mariusz Zaborski AuthorDate: 2024-07-08 10:43:38 +0000 Commit: Mariusz Zaborski CommitDate: 2024-07-08 10:43:38 +0000 bde: remove lingering references Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D45874 --- share/man/man4/geom.4 | 3 +-- sys/conf/NOTES | 1 - sys/conf/options | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/share/man/man4/geom.4 b/share/man/man4/geom.4 index c0f3bb23499d..18ecf7e5f852 100644 --- a/share/man/man4/geom.4 +++ b/share/man/man4/geom.4 @@ -32,14 +32,13 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 6, 2023 +.Dd July 8, 2024 .Dt GEOM 4 .Os .Sh NAME .Nm GEOM .Nd "modular disk I/O request transformation framework" .Sh SYNOPSIS -.Cd options GEOM_BDE .Cd options GEOM_CACHE .Cd options GEOM_CONCAT .Cd options GEOM_ELI diff --git a/sys/conf/NOTES b/sys/conf/NOTES index bcaac1c85899..ecfa7aa5b33a 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -154,7 +154,6 @@ options BOOT_TAG=\"\" # size for both BOOT_TAG and the assocated tunable. options BOOT_TAG_SZ=32 -options GEOM_BDE # Disk encryption. options GEOM_CACHE # Disk cache. options GEOM_CONCAT # Disk concatenation. options GEOM_ELI # Disk encryption. diff --git a/sys/conf/options b/sys/conf/options index 52fafffabd99..f50d009987bc 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -112,7 +112,6 @@ FULL_PREEMPTION opt_sched.h GZIO opt_gzio.h IMGACT_BINMISC opt_dontuse.h IPI_PREEMPTION opt_sched.h -GEOM_BDE opt_geom.h GEOM_CACHE opt_geom.h GEOM_CONCAT opt_geom.h GEOM_ELI opt_geom.h From nobody Mon Jul 8 12:40:44 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHkHd1DM2z5Q64v; Mon, 08 Jul 2024 12:40: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHkHd0ghCz4gNP; Mon, 8 Jul 2024 12:40:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720442445; 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=nORL/NxRyaotdN4bFGAWy/6lDXYj+3hD1BehcN0lasE=; b=jConAUw/z513Pp8JcJy3ocFHT3foydgt0LYThQ3ek3CwK04GL9aFV2Vf80DaHbBhnqLqJd DhEh4gOALy3v06UCn3lsMNODteaPFy2h4S4QZjYa29zrQp4RCFtMCBLwuIPvATbb8WWo3H rVtx4ZW+k9mnagEshh7b49LlsnWGHAyeV8+24tFRYO3k3UE2GumvINQsYFvbtkxYNQ53px NZiX5QCHsVLBVx66/OWpvKwUdGK4uU9a/NpQALrUuG2hFjzCeL1QKRvpNjiXe0Edlkb5WR dL9CMdk0X72ljVzI1I9zqjvkvmTnD4zW93E6yCYrxnwcZ+mSdG5Vthp3xHfvhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720442445; a=rsa-sha256; cv=none; b=LZP9PL1zTPrgu8Dwi/6P6vDKx/f3r+l3gg4C1RMUbf6Cb7IBY06M4qzKPLMKqVpxWIksPr CnZZAmdpBp/F01Mlq3j67iXvfZ7M3V5G5axYITAyldfDsF2yKjAJ3POC52z7UCaR2aSpmt IEONwqMoyLrL1oYd2DLHGfLFwkMg8/d0dv7jPT6eJbArmbas8AZBiwU7DNscCl49FAGaSE rd9CvWmPsT8bcxC50ySNDCzXveoImgIIRQ1q3OAqrmXyX7ZHxP75VdO9uaeHL9zG4PCdhy LdCjEuK0jZXOjSBYcdlLG3qGoqM26tt5faJRYEhulakQL0dpDtdYFB1o+AaE8Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720442445; 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=nORL/NxRyaotdN4bFGAWy/6lDXYj+3hD1BehcN0lasE=; b=q0R4cpTI9+ZOnq9BzYReMfq0E/ZS+oHNZ7x5gcu2OmpekAcM84Trd1hTtkv8uzmkERDOlu fRBlbXNfjPjfEsX24Jiq6Rt1b72+TD9NmzVuHK58EK1vTKCg7q7qgBDJ2Fnb+QihOz8A1c O78OqNWUAevdZlVoV185LzS7oxlK8zAgNac/GNZFNOUmvWZrqeOXSo8Cq1c7x023ronTZi WGrpCnNGzTdyirqrOIzyPSJpDZlcvDAPWg4b4N05z06Ir1GiaVmPC1U7Nm1B7Y9DTGI8vI U6jn9AT0oAc1juoN+PhpqkycLofMfxovwhDrkskIJUxoxTWetME0HRw4S+Bvcg== 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 4WHkHd0HC1zs4C; Mon, 8 Jul 2024 12:40: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 468Ceidx020248; Mon, 8 Jul 2024 12:40:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468CeiqP020245; Mon, 8 Jul 2024 12:40:44 GMT (envelope-from git) Date: Mon, 8 Jul 2024 12:40:44 GMT Message-Id: <202407081240.468CeiqP020245@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 0a9aa6fdf584 - main - vfs: make skipping LRU requeue optional List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0a9aa6fdf58468945240e86bf16c268acc8c1776 Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=0a9aa6fdf58468945240e86bf16c268acc8c1776 commit 0a9aa6fdf58468945240e86bf16c268acc8c1776 Author: Mateusz Guzik AuthorDate: 2024-07-08 12:24:41 +0000 Commit: Mateusz Guzik CommitDate: 2024-07-08 12:40:20 +0000 vfs: make skipping LRU requeue optional As explained in the comment in the code it is a bottleneck in certain workloads. On the other hand it does not need to be skipped in most cases, while transiently running into the lock being contended happens a lot. --- sys/kern/vfs_subr.c | 54 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 52712b99abac..8012fab29081 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -222,6 +222,10 @@ static counter_u64_t vnode_skipped_requeues; SYSCTL_COUNTER_U64(_vfs_vnode_stats, OID_AUTO, skipped_requeues, CTLFLAG_RD, &vnode_skipped_requeues, "Number of times LRU requeue was skipped due to lock contention"); +static __read_mostly bool vnode_can_skip_requeue; +SYSCTL_BOOL(_vfs_vnode_param, OID_AUTO, can_skip_requeue, CTLFLAG_RW, + &vnode_can_skip_requeue, 0, "Is LRU requeue skippable"); + static u_long deferred_inact; SYSCTL_ULONG(_vfs, OID_AUTO, deferred_inact, CTLFLAG_RD, &deferred_inact, 0, "Number of times inactive processing was deferred"); @@ -3835,31 +3839,41 @@ vdbatch_process(struct vdbatch *vd) * lock contention, where vnode_list_mtx becomes the primary bottleneck * if multiple CPUs get here (one real-world example is highly parallel * do-nothing make , which will stat *tons* of vnodes). Since it is - * quasi-LRU (read: not that great even if fully honoured) just dodge - * the problem. Parties which don't like it are welcome to implement - * something better. + * quasi-LRU (read: not that great even if fully honoured) provide an + * option to just dodge the problem. Parties which don't like it are + * welcome to implement something better. */ - critical_enter(); - if (mtx_trylock(&vnode_list_mtx)) { - for (i = 0; i < VDBATCH_SIZE; i++) { - vp = vd->tab[i]; - vd->tab[i] = NULL; - TAILQ_REMOVE(&vnode_list, vp, v_vnodelist); - TAILQ_INSERT_TAIL(&vnode_list, vp, v_vnodelist); - MPASS(vp->v_dbatchcpu != NOCPU); - vp->v_dbatchcpu = NOCPU; + if (vnode_can_skip_requeue) { + if (!mtx_trylock(&vnode_list_mtx)) { + counter_u64_add(vnode_skipped_requeues, 1); + critical_enter(); + for (i = 0; i < VDBATCH_SIZE; i++) { + vp = vd->tab[i]; + vd->tab[i] = NULL; + MPASS(vp->v_dbatchcpu != NOCPU); + vp->v_dbatchcpu = NOCPU; + } + vd->index = 0; + critical_exit(); + return; + } - mtx_unlock(&vnode_list_mtx); + /* fallthrough to locked processing */ } else { - counter_u64_add(vnode_skipped_requeues, 1); + mtx_lock(&vnode_list_mtx); + } - for (i = 0; i < VDBATCH_SIZE; i++) { - vp = vd->tab[i]; - vd->tab[i] = NULL; - MPASS(vp->v_dbatchcpu != NOCPU); - vp->v_dbatchcpu = NOCPU; - } + mtx_assert(&vnode_list_mtx, MA_OWNED); + critical_enter(); + for (i = 0; i < VDBATCH_SIZE; i++) { + vp = vd->tab[i]; + vd->tab[i] = NULL; + TAILQ_REMOVE(&vnode_list, vp, v_vnodelist); + TAILQ_INSERT_TAIL(&vnode_list, vp, v_vnodelist); + MPASS(vp->v_dbatchcpu != NOCPU); + vp->v_dbatchcpu = NOCPU; } + mtx_unlock(&vnode_list_mtx); vd->index = 0; critical_exit(); } From nobody Mon Jul 8 14:52:33 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHnCj5cDzz5QMX6; Mon, 08 Jul 2024 14:52: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHnCj58CZz3wqf; Mon, 8 Jul 2024 14:52:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720450353; 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=U+2tPirVldpECWcRRRspE8dbHEFQxksa3MlDjRoyQiA=; b=NOKcG55Jm5au/Qc/gdyAUvLyw+Y/Ij7b9umJiU75/SDE7AihbnaV4kgq6mqtQ0my3oZlbf gPsRIOowJosu7kt+8cxsGDJiv/0/pBNtm5LBhs2pXXbkXX4w1WCc/NyNcxLzW4mgg2a3dh qlu9FcqiJTGcYC/XcwDrgWil8JZAkwEgtBsQlASvtQUd17AXeuZjsg1xQtUJLsiyRYthgh Oaws6o1K7qjGQy6v5/4jN78IFcbbhuaQiQic6bviW5aE3WKotIjwDAuGjRPo1Sx9RnDvB3 uQMgdUSBkh+Jt49YGTy7kDPlr1nRwuT5yKsRA+KyX4+tuOlDubUMY0wso01aWQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720450353; a=rsa-sha256; cv=none; b=FAccakYwOR27qWAvGkHm8yDJ27i14OivL3kIHoPtT9Hpf8V/olk/XKt3hpABrjvY/Ow5Yr /lEOwLFEc++ta6y+Eu/tgIWXZkmVLwko8covsdtDe6+nrypjCY14uP6dC+eIfc1XUZzDbV x/aYBvGgAoC0bexlyaRZrvC2qHFFHeRM4uPflD7mF2Ge6jG7L8C+9mj6k7lx/qCgyti8Eh flby3ChS2pAUOEyMu/AYimB04wsoxIKIF3zmjzRhbDPg/1y60HMHUd5dwxYlGd47UsDD+8 1w3QfuNtQM3Rq5VFAiFpxnLMuvHiUjF/NZhq/lrdJCiVF/2TvoScsZpg5ruP1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720450353; 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=U+2tPirVldpECWcRRRspE8dbHEFQxksa3MlDjRoyQiA=; b=jpOF1um+kuUnxIwwSYTsAEYgHjZLHN8uISwjcwmN15VVRu5qy99wJYOiAJP6m7Kn17jqBC ZdA+i5zKYMykJWQU6zK33msXRhXERPeLq7jZ63Gbdl6GpNKzar1yxG46I8a9BgTiMBS6b9 /c7MWBDM6e6Paj1hyI05fB4uQFX5QjJltbT4y+gaGlBhOt8+0x0WD00tcziiJdnK1s9cWT vvp51BWHuYxgseYxwoR8/BIFKcJL6O3yx1qCP3khZ5XwU+gfUPc0clCa+/aAnS54/2QCmy X7GxNFC0TCQU84TqZ4ptPBl3SE04tVN9/SDU39fDZ+Tij6ZOxYShnhAwhTBEmQ== 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 4WHnCj4lL9zwKD; Mon, 8 Jul 2024 14:52: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 468EqXHW046613; Mon, 8 Jul 2024 14:52:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468EqXDu046610; Mon, 8 Jul 2024 14:52:33 GMT (envelope-from git) Date: Mon, 8 Jul 2024 14:52:33 GMT Message-Id: <202407081452.468EqXDu046610@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 88d81453b115 - main - riscv: support PV_STATS pmap option List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 88d81453b1151f8b133023073f3a773dd78cdc3a Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=88d81453b1151f8b133023073f3a773dd78cdc3a commit 88d81453b1151f8b133023073f3a773dd78cdc3a Author: Mitchell Horne AuthorDate: 2024-07-08 14:44:10 +0000 Commit: Mitchell Horne CommitDate: 2024-07-08 14:44:10 +0000 riscv: support PV_STATS pmap option It is rarely used but trivially supported; add the missing stat calls and enable it in LINT. Reviewed by: markj, br (previous version), jhb (previous version) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45475 --- sys/conf/options.riscv | 2 +- sys/riscv/conf/NOTES | 3 +++ sys/riscv/riscv/pmap.c | 13 ++++++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/sys/conf/options.riscv b/sys/conf/options.riscv index 6a8df1d2f54e..5e1b76140ec7 100644 --- a/sys/conf/options.riscv +++ b/sys/conf/options.riscv @@ -1,3 +1,3 @@ - RISCV opt_global.h # For cpu RISCV to work INTRNG opt_global.h +PV_STATS opt_pmap.h diff --git a/sys/riscv/conf/NOTES b/sys/riscv/conf/NOTES index 36d2e06fb698..102ee26811b3 100644 --- a/sys/riscv/conf/NOTES +++ b/sys/riscv/conf/NOTES @@ -17,6 +17,9 @@ options KDTRACE_HOOKS # Kernel DTrace hooks options DDB_CTF # Kernel ELF linker loads CTF data options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default +# Enable detailed accounting by the PV entry allocator. +options PV_STATS + # RISC-V SBI console device rcons diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 781f6b250a18..f49f18ba87bb 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -93,7 +93,6 @@ * SUCH DAMAGE. */ -#include /* * Manages physical address maps. * @@ -113,6 +112,8 @@ * and to when physical maps must be made correct. */ +#include "opt_pmap.h" + #include #include #include @@ -1891,7 +1892,6 @@ static const uint64_t pc_freemask[_NPCM] = { [_NPCM - 1] = PC_FREEL }; -#if 0 #ifdef PV_STATS static int pc_chunk_count, pc_chunk_allocs, pc_chunk_frees, pc_chunk_tryfail; @@ -1916,7 +1916,6 @@ SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, &pv_entry_count, 0, SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_spare, CTLFLAG_RD, &pv_entry_spare, 0, "Current number of spare pv entries"); #endif -#endif /* 0 */ /* * We are in a serious low memory condition. Resort to @@ -2101,7 +2100,8 @@ retry: goto retry; reclaimed = true; } - /* XXX PV STATS */ + PV_STAT(atomic_add_int(&pc_chunk_count, 1)); + PV_STAT(atomic_add_int(&pc_chunk_allocs, 1)); #if 0 dump_add_page(m->phys_addr); #endif @@ -2112,6 +2112,7 @@ retry: pc->pc_map[2] = PC_FREEL; TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); TAILQ_INSERT_TAIL(&new_tail, pc, pc_lru); + PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV)); /* * The reclaim might have freed a chunk from the current pmap. @@ -2222,6 +2223,7 @@ pmap_pv_demote_l2(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); m->md.pv_gen++; /* Instantiate the remaining 511 pv entries. */ + PV_STAT(atomic_add_long(&pv_entry_allocs, Ln_ENTRIES - 1)); va_last = va + L2_SIZE - PAGE_SIZE; for (;;) { pc = TAILQ_FIRST(&pmap->pm_pvchunk); @@ -2250,7 +2252,8 @@ out: TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list); } - /* XXX PV stats */ + PV_STAT(atomic_add_long(&pv_entry_count, Ln_ENTRIES - 1)); + PV_STAT(atomic_add_int(&pv_entry_spare, -(Ln_ENTRIES - 1))); } #if VM_NRESERVLEVEL > 0 From nobody Mon Jul 8 14:52:34 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHnCk6rNRz5QMml; Mon, 08 Jul 2024 14:52: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHnCk6776z4vqq; Mon, 8 Jul 2024 14:52:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720450354; 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=beqCgXLon8fNxPd4u+KtfuI28PY2AMBCXdZBWqh3LHE=; b=N0v+JCJoulhAZk1f2gonWF5iiyD0DLhSUQvAO9UOtb+KQzF2Up9WBWMObEN9JXIkrp5bV/ hfSKMfHXxrSZx0fxgBc2cEJqRVmftbkeu53NVXcP5ktwqkFVVwu6yMiwgJ1fScJCgpNmK4 3O+B5ZJeNb50rjorIGaSgaS9bgdDSF034BFbGAxSQa9tdchyKcjDK+qU9RJKS60oCnJGqL ImIcF00KelwyQj4mrT/iAxarFsqr6h3teZLC2xRFHlm2NCPZWLRtJX+aPke/d+AQLeV3se 5XYgD3cKT7TijLGVcG51Rh4CRfi/x6xMlxxszD/iz53gAWd7yziQT6jPd5C3vQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720450354; a=rsa-sha256; cv=none; b=u1OHvFknVzNi1GJhew/lLNop5wl9PgCUkYKWLldJspLdZH5u8gqG3JcMuumintHO5YruXi bu1WUS0vUkyOzufEAG9CSNbCCnY05i2eK0YrmzykCKlMV1mqeDjmUIRuwFntUll9flzb3E hDgVttvuMj2+ZadEUxfLl9p4Ym+wMsdb1Ad6J/5pWvLFZceX3dj0aJ1MevjJkjX530EbHA FkNu7JNcCK53xzMfxkxcP98UVzGIU4fqWSgA4yAwtO6GF6weBPWvilEPRDOf6ZkOtKFAKt 9s3dT07EsTYFCgAjY7bYl14OQUZJBxNF7mgQwFz9qDYx5ytpkeGAOqtVcgBVKw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720450354; 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=beqCgXLon8fNxPd4u+KtfuI28PY2AMBCXdZBWqh3LHE=; b=Yeoqvuf9xeZ9YCHsReScG7+TYonGB7Y6/PPe57PhFYaQtjH41BXuWsDQo9ODSefxypuoDA jlS+kfgPszwSAYET6sRdRPK0+AgBuvO2x8Y5O6a10Ucgtqyrw4BiB3oYs7g0/W4N8fdGxv 2IH6BJB7WeN7YPKEwwFT5BsVNvERkeY52iYXxPrmNDB3IS8NwP3x8R3J5NBCRDhDd4Rl8d Bbuse38osotsubqCXTqKmfWhVmeU22XZxyHMHNdTb64Ohp9n4Or1pv8vGeAHKrz0ws3FoF PCB4Vh9RNKyx0LPAo5ewsVTHPq9Ohq6V6bwC6sXF3pbwcz1FKu94Jd1lLHCOdg== 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 4WHnCk5kgXzw2K; Mon, 8 Jul 2024 14:52:34 +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 468EqYc6046663; Mon, 8 Jul 2024 14:52:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468EqYfp046660; Mon, 8 Jul 2024 14:52:34 GMT (envelope-from git) Date: Mon, 8 Jul 2024 14:52:34 GMT Message-Id: <202407081452.468EqYfp046660@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 4e148a7baa1c - main - riscv: include PV chunks in kernel dump List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4e148a7baa1cb7fcc17f4ffb5e2b91ab78925fa6 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=4e148a7baa1cb7fcc17f4ffb5e2b91ab78925fa6 commit 4e148a7baa1cb7fcc17f4ffb5e2b91ab78925fa6 Author: Mitchell Horne AuthorDate: 2024-07-08 14:46:55 +0000 Commit: Mitchell Horne CommitDate: 2024-07-08 14:46:55 +0000 riscv: include PV chunks in kernel dump Un-ifdef the call to dump_add_page() in reserve_pv_entries(). We want PV chunks available in the kernel dump, in case they need inspection. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45760 --- sys/riscv/riscv/pmap.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index f49f18ba87bb..110f321a9461 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -2102,9 +2102,7 @@ retry: } PV_STAT(atomic_add_int(&pc_chunk_count, 1)); PV_STAT(atomic_add_int(&pc_chunk_allocs, 1)); -#if 0 dump_add_page(m->phys_addr); -#endif pc = (void *)PHYS_TO_DMAP(m->phys_addr); pc->pc_pmap = pmap; pc->pc_map[0] = PC_FREEN; From nobody Mon Jul 8 14:52:35 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHnCm32qDz5QMfQ; Mon, 08 Jul 2024 14:52:36 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHnCm0Jz0z3wcC; Mon, 8 Jul 2024 14:52:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720450356; 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=+Vvgcher4B/qF+Urv6bmJvcK2jtpw5fCpyaJhc+9fLk=; b=L6DFfwDf0/kZkX0f6nsT5DQpHZD7eHH2klmzRQu6/qQ3stUhyeTW8bhCLk+y1FrAx9pWFN Rrf0+8EQk3bbXZht15NIbqcc7YdC0YGSv+bgY7z23wv+OCPA8npk+Lvw9wLu+onMLOFVoz yspqE1MzKvUsCglbcs8CAKz0PQl06aWAhYb5wYunsSl9UXntAQxo5B02np56on58S2BtgS Xp70mXJv3d9ptvYqmvnlWiOwAK2s/4Iwdm+eYVgUZ5krkxSqngzwgNhJU6/N4Any00XvAj KUPrGBCwMQtvmH78TbCn3nwoc10SvsrmIKWj19FygZHEUaIV3SFrJUdgBSVbxQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720450356; a=rsa-sha256; cv=none; b=h7o/1MgXtvzc5JJPMQX8SQe8lsVmrlo0CM8PIcDbQYjAU7K4Lie5/VKw+ykq/dkpdfG5Ge xdFfINiPuWHKbxMpCuLYaHYtjgt3KuEwHPA2LIAYRZYtkr09JBqsCiyWcknhUThq7ioPLF dWyajbcEPXmWQ8vG7dEuekvXo224Wvee1x0DjcTbRGxv5NVTTHqpF6lxwd/33CmIvvw0pR I3z1uwR7WybEx0AQ1G5d/BVYRaYpAjBb0u3b1M+XX8c3CJHbyHVN8fJkWtg1FCnCRra7IK A0KGwcREO68dBjjTGl1imQ9xNZfzqEwacKqATtJXozWGya++fyHwaptZle/mFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720450356; 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=+Vvgcher4B/qF+Urv6bmJvcK2jtpw5fCpyaJhc+9fLk=; b=DEaGaprh0DJiSJWRk/SZ1Um7y0eNk7a4rTe5/9nHzVSns3jD0hdfy1uMXfKZD7dkGI61az 2pBoo2Cw4+wkjAXJtfcE4xP+BgMlEEK3RAB074FFncuur8SxdeGG/SsaLrw09oPUmCyQ7Y rdqIwGAOlMoPTXRuU1kKIFxIxcsEBu9pF3mYcKG76+o9qwZTlshy7MGuDZLK4Udz1XrZBa XYySIVKNEqe0khB0545wWM5fH4EhhnJ7G5CKQwwgb96yzogR1XQp5YnQQmSASOna35o3C1 pJ3fR8lKSfDRDfMkluRD5XfHSD0/CUJsvZdEXv51wEHdiru0LucuQAbtnOjzGw== 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 4WHnCl6jldzw5M; Mon, 8 Jul 2024 14:52:35 +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 468EqZ50046717; Mon, 8 Jul 2024 14:52:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468EqZWf046714; Mon, 8 Jul 2024 14:52:35 GMT (envelope-from git) Date: Mon, 8 Jul 2024 14:52:35 GMT Message-Id: <202407081452.468EqZWf046714@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 558c1b37334c - main - busdma: avoid buflen underflow List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 558c1b37334c4dcc9913b7c157a491f9d244e335 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=558c1b37334c4dcc9913b7c157a491f9d244e335 commit 558c1b37334c4dcc9913b7c157a491f9d244e335 Author: Mitchell Horne AuthorDate: 2024-07-08 14:51:31 +0000 Commit: Mitchell Horne CommitDate: 2024-07-08 14:51:31 +0000 busdma: avoid buflen underflow The loop condition in the dmamap_load_buffer() method is 'buflen > 0', and buflen is an unsigned type (bus_size_t). A recent change made it possible for sgsize to exceed the remaining buflen, when the tag has a large alignment requirement. The result is that we would not break out of the loop at the correct time. Fix this by avoiding underflow in the subtraction at the end of the loop. PR: 279383 Reported by: Robert Morris Reviewed by: jhibbits Fixes: a77e1f0f81df ("busdma: better handling of small segment bouncing") Differential Revision: https://reviews.freebsd.org/D45732 --- sys/arm/arm/busdma_machdep.c | 2 +- sys/arm64/arm64/busdma_bounce.c | 2 +- sys/powerpc/powerpc/busdma_machdep.c | 2 +- sys/riscv/riscv/busdma_bounce.c | 2 +- sys/x86/x86/busdma_bounce.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c index 13af7eb682d6..99a72c9e79d0 100644 --- a/sys/arm/arm/busdma_machdep.c +++ b/sys/arm/arm/busdma_machdep.c @@ -1035,7 +1035,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, segp)) break; vaddr += sgsize; - buflen -= sgsize; + buflen -= MIN(sgsize, buflen); /* avoid underflow */ } cleanup: diff --git a/sys/arm64/arm64/busdma_bounce.c b/sys/arm64/arm64/busdma_bounce.c index f218bc062642..3836f8c74b45 100644 --- a/sys/arm64/arm64/busdma_bounce.c +++ b/sys/arm64/arm64/busdma_bounce.c @@ -898,7 +898,7 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, segp)) break; vaddr += sgsize; - buflen -= sgsize; + buflen -= MIN(sgsize, buflen); /* avoid underflow */ } /* diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c index b023e7f353b9..5f7f88041a67 100644 --- a/sys/powerpc/powerpc/busdma_machdep.c +++ b/sys/powerpc/powerpc/busdma_machdep.c @@ -656,7 +656,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat, segp)) break; vaddr += sgsize; - buflen -= sgsize; + buflen -= MIN(sgsize, buflen); /* avoid underflow */ } /* diff --git a/sys/riscv/riscv/busdma_bounce.c b/sys/riscv/riscv/busdma_bounce.c index e1c217f1d12e..68525bb742bc 100644 --- a/sys/riscv/riscv/busdma_bounce.c +++ b/sys/riscv/riscv/busdma_bounce.c @@ -705,7 +705,7 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, segp)) break; vaddr += sgsize; - buflen -= sgsize; + buflen -= MIN(sgsize, buflen); /* avoid underflow */ } cleanup: diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c index 5aa4ffcff3cc..656b76159250 100644 --- a/sys/x86/x86/busdma_bounce.c +++ b/sys/x86/x86/busdma_bounce.c @@ -733,7 +733,7 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, segp)) break; vaddr += sgsize; - buflen -= sgsize; + buflen -= MIN(sgsize, buflen); /* avoid underflow */ } /* @@ -808,7 +808,7 @@ bounce_bus_dmamap_load_ma(bus_dma_tag_t dmat, bus_dmamap_t map, break; KASSERT(buflen >= sgsize, ("Segment length overruns original buffer")); - buflen -= sgsize; + buflen -= MIN(sgsize, buflen); /* avoid underflow */ if (((ma_offs + sgsize) & ~PAGE_MASK) != 0) page_index++; ma_offs = (ma_offs + sgsize) & PAGE_MASK; From nobody Mon Jul 8 14:54:46 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHnGH3HDTz5QN7G; Mon, 08 Jul 2024 14:54: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHnGH1nDjz3xrs; Mon, 8 Jul 2024 14:54:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720450487; 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=SiWRugpBs51SUoAwWOuIm/4kF33nweON15RhAvFgmng=; b=uTNr4vva+7juUauL2eYRYXzdPR5Q/nF3kkqU+NW8Oct/0ZPccf8VZxiVzOrX0xnkp0At17 e5PqO1Rc032jy6MArfP6Kcd+80bZf45nxSBbpUeCX22wpesr/sTRK9jDqXV+5LhXo9Hp6q 7eXglgN/xXUMo2fCgipmXMxESXsK92rIbUKdbMrCQzQmoWcWXNrmAGM/EkBKrB5mqYO6LK +3D4Jc6UuJsTTcN8lgm6O8JAUiJdmgnLplLhdScGXu0n6DKLvdaU3lpULuFHXy0IPTkI8A 1VEE+SXJIiIodxWWtaTOUY2IBN8Lk/LiRCaZ9cZuk42JgsCkwO+cj214gn4tLQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720450487; a=rsa-sha256; cv=none; b=B262sUiYwzqMRiN1yTctkGWBQPelIGH1r3l4IU6qeyNcEH0rtn1b5PTyTDVPpxUFD9TcXO 9ig30FKxmQlA2Gc88wB3pkOHG6Xet/el+iX0Ex+o+tkPEaNO2nx12BZKDpYUnYZXEDIhwQ rv0b9BWVXczGjeZpj+xryR+uy3egatiqDFcz5pEBaBlzQXVHglcrsvqbw76SRFO47mZBhk NgmndL1zS0niMFaGGf3hxBohtv7hzdpPA/u/jFwK3YXAiM+AxtndMEey3HM3w6K8L8WwAT tthAxr+omnslZGiAwRRNfM4E5PaV0XXOnYLlnZCEMpziOa3JfpEtYlojd4AtGg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720450487; 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=SiWRugpBs51SUoAwWOuIm/4kF33nweON15RhAvFgmng=; b=yGW20VH9L1VQDm46n2Q6GhiOatg/gmGTi2fyp6H7C6mEgzPb7uCJeIC/k2i6UA2L+Fdtkd xUc1jDLl9kxdX4QiSSs8SZ95NeCl3BZoVTadfMTyudFMHkFhO1DywW2TH/1M5U2Svhq7y8 ueMHwy759W+yIQRaAuLpkQkduL0umG5SiwHYvoUHYK135uC2xl9k+rG+AhWLh7+TJ3Jj/l HZi4pmuxDsaObxCM8PRUsd+k/NfaPxoN3YL+L58X/vo1OwsSmTPeQ8HSoz5BpmAMCW/0mM oxoLYpXPJ2/RP01qtiQ+TftYQ9sdNFLdG7fONUmlv9vNeI+QqORzEwMwelsrJA== 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 4WHnGG6BtXzwKG; Mon, 8 Jul 2024 14:54: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 468EskLc047173; Mon, 8 Jul 2024 14:54:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468EskAe047170; Mon, 8 Jul 2024 14:54:46 GMT (envelope-from git) Date: Mon, 8 Jul 2024 14:54:46 GMT Message-Id: <202407081454.468EskAe047170@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: b426b8b3b000 - main - arm64: simplify physmap usage in pmap_bootstrap() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b426b8b3b000080d9c582c2de32f0fa73e7c2649 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=b426b8b3b000080d9c582c2de32f0fa73e7c2649 commit b426b8b3b000080d9c582c2de32f0fa73e7c2649 Author: Mitchell Horne AuthorDate: 2024-07-08 14:54:00 +0000 Commit: Mitchell Horne CommitDate: 2024-07-08 14:54:00 +0000 arm64: simplify physmap usage in pmap_bootstrap() The subr_physmem.c facility provides guarantees about non-empty ranges. Push this into pmap_bootstrap_dmap() and simplify; the lowest physical memory range is always in the first item. No functional change intended. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45759 --- sys/arm64/arm64/pmap.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 29552f722aa4..c3357900e1be 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -1207,11 +1207,14 @@ pmap_bootstrap_l3_page(struct pmap_bootstrap_state *state, int i) } static void -pmap_bootstrap_dmap(vm_paddr_t min_pa) +pmap_bootstrap_dmap(void) { int i; - dmap_phys_base = min_pa & ~L1_OFFSET; + /* Fill in physmap array. */ + physmap_idx = physmem_avail(physmap, nitems(physmap)); + + dmap_phys_base = physmap[0] & ~L1_OFFSET; dmap_phys_max = 0; dmap_max_addr = 0; @@ -1299,8 +1302,7 @@ void pmap_bootstrap(vm_size_t kernlen) { vm_offset_t dpcpu, msgbufpv; - vm_paddr_t start_pa, pa, min_pa; - int i; + vm_paddr_t start_pa, pa; /* Verify that the ASID is set through TTBR0. */ KASSERT((READ_SPECIALREG(tcr_el1) & TCR_A1) == 0, @@ -1319,28 +1321,13 @@ pmap_bootstrap(vm_size_t kernlen) kernel_pmap->pm_ttbr = kernel_pmap->pm_l0_paddr; kernel_pmap->pm_asid_set = &asids; - /* Assume the address we were loaded to is a valid physical address */ - min_pa = pmap_early_vtophys(KERNBASE); - - physmap_idx = physmem_avail(physmap, nitems(physmap)); - - /* - * Find the minimum physical address. physmap is sorted, - * but may contain empty ranges. - */ - for (i = 0; i < physmap_idx; i += 2) { - if (physmap[i] == physmap[i + 1]) - continue; - if (physmap[i] <= min_pa) - min_pa = physmap[i]; - } - bs_state.freemempos = KERNBASE + kernlen; bs_state.freemempos = roundup2(bs_state.freemempos, PAGE_SIZE); /* Create a direct map region early so we can use it for pa -> va */ - pmap_bootstrap_dmap(min_pa); + pmap_bootstrap_dmap(); bs_state.dmap_valid = true; + /* * We only use PXN when we know nothing will be executed from it, e.g. * the DMAP region. From nobody Mon Jul 8 15:43:12 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHpL91TY5z5Pyhg; Mon, 08 Jul 2024 15:43:13 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHpL911h9z43Kk; Mon, 8 Jul 2024 15:43:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720453393; 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=42FBlRx8wRqrXky5Dm5sD4nqWhL8hLv9EeYXcOL6DXg=; b=PzIveKbUq+yY5vUT8LQD2fLRYKnuJpbHv0ObrOovcbQrZdgelxgdu9/RjHvURnvCrQTvTm N/M2TTSKgjvTgUm5Np6qn9vs9WDxTTqjxZPfEVdvfZoY+cUdIhSobbn3R3HI4waX99WFuK 8uO6rbvF0K8Ju0mA3+ZFcmFwQvx9lAG1Btm5MslO5OCcdm8a13LUXzJApSiCUSWEqlZjq5 xqL1sNrr+W43RF25tNu+T8Os6X4oxOP/xohtb6tYK/mMCj4WV3BOwkDj86hOVC5E+lFRso Txiwb4e2NbcKFuYcaYtPnP4PpWVslKJxs1G8JwQK85HilesH/x6b4nQISY51UA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720453393; a=rsa-sha256; cv=none; b=cniDBUfXiemullhueZIZgHWN47Hn01f3/i7IxkU6iIIweUI0qUinW+4quZRT590pCdTfC+ BryO461DbOL4Kg2lKnWdH/UtQ2RqEDJ7/ALkX8IlNh26tmug07/k6N3F+fsjxbtZeZlqT8 nEeTXIe2oMS6udu8xPEdzOlrKdjQKdavg1KWe8B+BQ6kDIbwDDVXocTsPAG7515iLyMMaC Ntm4/tiCGtSQpjbhTc0c+J4AqIzuAPCPdHsA58Us/y1pX+IN+SrhzQQ68Q/fPL+Lgp6UWl RK7zKvLaIO/MaJpVwL+/QmOylEIw7vVckFDYtA8r2M4cpTNEkpV0j5XlBx8MZA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720453393; 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=42FBlRx8wRqrXky5Dm5sD4nqWhL8hLv9EeYXcOL6DXg=; b=YrdEkER69+YY8yY/WcMhGISx5M+BMPMg5Ozxax92nUaZoXic/UiEUL1aG1cF+EcHynrIKF vlRaC5VRyh1R2mJFtlpo9ZFLGZiA2NzUdwxfCXElx+4CmPLtuGIfljfOVDl3kt5UCm0/4w ipMaB5hMawouAnZfbAAO046yMKpQ27b1hcXmGi4qxBSOGHKqJ/Ivmq2NJCLNrLdfzH6eHd r67jtLjh4KUhdfUoYTlaDInTWEaxv8LbZ+Ms701R5dzMRmgm4GsOoajINsIUb7VZYWTK3n Q9s53v6RyCv2TR+DyZ67/7IVmp+sqB1tIsx3TeZRSGy7EWfIEQy0sExNYNPTgQ== 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 4WHpL90dLyzxK9; Mon, 8 Jul 2024 15:43:13 +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 468FhCFS032107; Mon, 8 Jul 2024 15:43:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468FhC5c032104; Mon, 8 Jul 2024 15:43:12 GMT (envelope-from git) Date: Mon, 8 Jul 2024 15:43:12 GMT Message-Id: <202407081543.468FhC5c032104@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: fa6cbe8d60b1 - main - sdt: Use a multibyte nop for tracepoints on amd64 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fa6cbe8d60b1728062f7f5f337428770b89cb13d Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fa6cbe8d60b1728062f7f5f337428770b89cb13d commit fa6cbe8d60b1728062f7f5f337428770b89cb13d Author: Mark Johnston AuthorDate: 2024-07-08 15:40:06 +0000 Commit: Mark Johnston CommitDate: 2024-07-08 15:40:06 +0000 sdt: Use a multibyte nop for tracepoints on amd64 Differential Revision: https://reviews.freebsd.org/D45666 --- sys/amd64/include/sdt_machdep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/include/sdt_machdep.h b/sys/amd64/include/sdt_machdep.h index 2434abed2e0e..497ca26d5277 100644 --- a/sys/amd64/include/sdt_machdep.h +++ b/sys/amd64/include/sdt_machdep.h @@ -7,6 +7,6 @@ #ifndef _SYS_SDT_MACHDEP_H_ #define _SYS_SDT_MACHDEP_H_ -#define _SDT_ASM_PATCH_INSTR "nop; nop; nop; nop; nop" +#define _SDT_ASM_PATCH_INSTR "nopw 0(%%rax,%%rax,1)" #endif From nobody Mon Jul 8 15:43:14 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHpLB2vxqz5PyTj; Mon, 08 Jul 2024 15:43:14 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHpLB1cBkz42xy; Mon, 8 Jul 2024 15:43:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720453394; 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=bWMo75QBBQt7UcqI1MJAfDfq8bctCAHfp9nG7kuEnfE=; b=jR1/7+dX8MM6jF6Xf4IG5ubCs+7hQXHHzTt3J1vJJ34SmFkdFGyTAv9h3Tb1E8SusriO7v vXPGCAbxknyHJax6dBrbtc7H/dur2ylqYT8389eI+fVx/ybNuMA2KYlX2Lqm2BFQ2Bl1i+ w7ZUv/9BU38HaeD1rdYyMwy+lPueYzz5K9g49ayICuZOlmItpfH2qU7vtNBquWYYhhl8ax oJbSMc2X9DKOcrFcJCF5nQgxNz852cWHYIUW/4pD6pc7B011zmE/nJJWGAN/pwDE9Rq6CK yybM/mHkKjxOhkTiM++2BXto6FMEmH4wFTopPOglsgAgvesnn0kKM+gmqMav1A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720453394; a=rsa-sha256; cv=none; b=IRKVEkYIQjjSqOM1JcEfDCgHxAwppuDSSEtcwm0hld1ziMy5CvbbtdfP8iI1LKVGf4uMoD 3catQIg43sRPrrJp/AKi5fIS09A9LMK0Xp9KaERNEHM2PmI5Knk7qaxw9pS3t82wcfDsPS BUtAxWuHBIHRT9udmlNlzAH96sCuzJuMCQX28ol5N1YDJV7dRHyUfE1f1/7O1P+qXEtwN/ eupk286xVButxSUIoC3bqnWMuNJQgBID4qfGkjqd9bISxEmY1VCnweNI3CQ8vLozsWfO3r F4TcvZlsOKjeUvLnl09KYUT+tsgKZv2aS8ZHXc38ryobxolXzm9bQGOjWErw4Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720453394; 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=bWMo75QBBQt7UcqI1MJAfDfq8bctCAHfp9nG7kuEnfE=; b=Wkltbw55XzYkO8pNtJLuv37LLvxd7HAN1yE4jwhDz21yvuDkmT6p+uRMkI9r0Kwcz3Z4/R 0vgWk9uR8EMuInVb23raN171NfsSnuUEGgsoQkGMRNiOIrwWOz3b2awtr2qz3bgPpCbvIk SE2utNMFmdC2+K9yQmY9H8T+yekV9wWZ6qufyOE0YPmo3e7XbQcM3Yptea/qFuMsDI9M7O zmrn26BI2Eh93JVaqdR5JJAD2t1DqrumMneoEKzFHbPtnE1eioys9jXcSuEJ7vfQHoUNll l5v8JV2MKnz3dJZZYDg+K87Yj0Y5Z8tQCpo5fY6ohArbEkPjD6DuYFD8ay+Oog== 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 4WHpLB1CT0zx58; Mon, 8 Jul 2024 15:43:14 +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 468FhE0q032155; Mon, 8 Jul 2024 15:43:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468FhEIo032152; Mon, 8 Jul 2024 15:43:14 GMT (envelope-from git) Date: Mon, 8 Jul 2024 15:43:14 GMT Message-Id: <202407081543.468FhEIo032152@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 85f7c98d85e4 - main - sdt: Fix aframe handling after commit ddf0ed09bd8f List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 85f7c98d85e4523943f40d0fa74581e5dd774f7b Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=85f7c98d85e4523943f40d0fa74581e5dd774f7b commit 85f7c98d85e4523943f40d0fa74581e5dd774f7b Author: Mark Johnston AuthorDate: 2024-07-08 15:40:24 +0000 Commit: Mark Johnston CommitDate: 2024-07-08 15:40:24 +0000 sdt: Fix aframe handling after commit ddf0ed09bd8f DTrace probes have an "aframes" attribute, used when unwinding the stack from dtrace_probe(). It counts the number of leading frames to skip when returning a stack trace, thus is used to hide internal functions. Commit ddf0ed09bd8f set the aframes value for SDT probes to 0, which was correct for an earlier iteration of the patch, but now doesn't take sdt_probe()/sdt_probe6() into account. Fix the aframes definition for SDT probes. Also try to improve lockstat(1) output by adding an additional aframe for lockstat probes, which otherwise show internal mtx(9), rwlock(9), etc. functions as the probe "caller". This is not quite correct as the number of frames to skip may differ depending on the lock type and kernel configuration (see e.g., the MUTEX_NOINLINE kernel option), but this is not a new problem. Reported by: mjg Fixes: ddf0ed09bd8f ("sdt: Implement SDT probes using hot-patching") --- sys/cddl/dev/sdt/sdt.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/cddl/dev/sdt/sdt.c b/sys/cddl/dev/sdt/sdt.c index 461f454186a3..88ceb390876b 100644 --- a/sys/cddl/dev/sdt/sdt.c +++ b/sys/cddl/dev/sdt/sdt.c @@ -144,6 +144,7 @@ sdt_create_probe(struct sdt_probe *probe) const char *from; char *to; size_t len; + int aframes; if (probe->version != (int)sizeof(*probe)) { printf("ignoring probe %p, version %u expected %u\n", @@ -190,7 +191,17 @@ sdt_create_probe(struct sdt_probe *probe) if (dtrace_probe_lookup(prov->id, mod, func, name) != DTRACE_IDNONE) return; - (void)dtrace_probe_create(prov->id, mod, func, name, 0, probe); + aframes = 1; /* unwind past sdt_probe() */ + if (strcmp(prov->name, "lockstat") == 0) { + /* + * Locking primitives instrumented by lockstat automatically + * disable inlining. Step forward an extra frame so that DTrace + * variables like "caller" provide the function trying to + * acquire or release the lock rather than an internal function. + */ + aframes++; + } + (void)dtrace_probe_create(prov->id, mod, func, name, aframes, probe); } /* From nobody Mon Jul 8 15:44:02 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHpM70Chmz5Pyy6; Mon, 08 Jul 2024 15:44: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHpM66p3Gz43nQ; Mon, 8 Jul 2024 15:44:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720453443; 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=WUiwkaOd7MmqmtNLyYBkqnqLPv9q1r8lmbO4VdS3U/w=; b=gUCfjH6kFohCdQ395LNrm3znbWXskeI6qZotL6HN1sgz7Ocogk5SFfP3Aq5zpTHZN62GrI OcLgbFfrMAsV45Rmu0iXcmBt8Hm/IZiENSqSepNhUY+tcShIzCDsGvy1NqHqFE0IiL/5gk D9BR84lZ9/frFDwTxtxNppyrMbxppAXNpO2OBg891kF4V0KartMQzb+ITrvkdkqSzFUggx QEgYrRxxmOgiHfgcTEWS97TdelHX6Wd5TaGwT80Kq4Cdz/xw6dEKzYooLlZLEZYG6IFuvX Z6jEklv4p4bKVq1/QSMKsvl5HRG9e/gge/eLl+4AHcqS5UVu/O+oqDz/0PvCvg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720453443; a=rsa-sha256; cv=none; b=Ngd242gcckolq5vUlHbDlGJXKj6HSv5tLd2hXNjxADYUue0tMuCAm+v9/NLUilW/FE7DGX pdmDWfv8cwW0uMtHRvIwqC+T5i6RRCYlN8Fda2LjnPcG6rqxIWaDb5P9H3x97Pc8+vCGJj 10XOOixPzma47NtjSaoEb3EigjxnUV2QmVCvyzrH8HS0HGpWTUGjVmJ2Dufl5jyAwDmj/n 7Ve1Ok4PSiW/SANUJjRf8nlWx79rGPJXeYFM54K9jEv5WyztHYMgQW91smHcOJpv0whXDU LKYwKuoySrlm+KjGK2/EKIqAsrvIABonpZZTbB48Gn2pskJaBVh/pKVO+prgXw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720453443; 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=WUiwkaOd7MmqmtNLyYBkqnqLPv9q1r8lmbO4VdS3U/w=; b=PqrL9tU/B0uYGGdNzVA1roC+ksSvztFA/4edv8fp0rl4C1hwEDv0FOin+G7rUBawErIY38 56ZFJH7Sm/qNzVF5GhBKYpRffa/zX4XaSaumURRCY1pXbx1EHPoSGSVRJhk/HDm9MfL6En p9sM6Mr7m7EhckrpbM1AEGb74m6waqgOD8NOrbmnqAO3zHNIW375UcplJ76uwIOpS5Rjfd 6nnEOcic5hOyueZGhmJ8ahjKxb8bO+KnkGNqouD/GUi1tV+lwxBfIfybH6PaZ6X/B9Ab+a kNNlRN+bftV3rUvF/Zv3rCOwq34HqqHj+3jnZV+UPnJ6eKH1r6O4HURkRJx2mQ== 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 4WHpM666LvzxKB; Mon, 8 Jul 2024 15:44: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 468Fi27I032482; Mon, 8 Jul 2024 15:44:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468Fi2nA032479; Mon, 8 Jul 2024 15:44:02 GMT (envelope-from git) Date: Mon, 8 Jul 2024 15:44:02 GMT Message-Id: <202407081544.468Fi2nA032479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: bdf2c8fff9ce - main - riscv: Don't need to check the return value with NULL List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bdf2c8fff9ced12a0cf6fc6b0e6757995c9a4412 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=bdf2c8fff9ced12a0cf6fc6b0e6757995c9a4412 commit bdf2c8fff9ced12a0cf6fc6b0e6757995c9a4412 Author: wy-chung AuthorDate: 2024-07-01 09:01:07 +0000 Commit: Mitchell Horne CommitDate: 2024-07-08 15:43:48 +0000 riscv: Don't need to check the return value with NULL The return value from pmap_l1_to_l2 and pmap_l2_to_l3 will never be NULL, so don't need to check their return value with NULL. Reviewed by: markj, mhorne MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1311 --- sys/riscv/riscv/pmap.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 110f321a9461..8fb017f66951 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -1051,10 +1051,8 @@ pmap_extract(pmap_t pmap, vm_offset_t va) if (l2p != NULL && ((l2 = pmap_load(l2p)) & PTE_V) != 0) { if ((l2 & PTE_RWX) == 0) { l3p = pmap_l2_to_l3(l2p, va); - if (l3p != NULL) { - pa = PTE_TO_PHYS(pmap_load(l3p)); - pa |= (va & L3_OFFSET); - } + pa = PTE_TO_PHYS(pmap_load(l3p)); + pa |= (va & L3_OFFSET); } else { /* L2 is a superpage mapping. */ pa = L2PTE_TO_PHYS(l2); @@ -1128,8 +1126,6 @@ pmap_kextract(vm_offset_t va) } l3 = pmap_l2_to_l3(&l2e, va); - if (l3 == NULL) - panic("pmap_kextract: No l3..."); pa = PTE_TO_PHYS(pmap_load(l3)); pa |= (va & PAGE_MASK); } @@ -2505,8 +2501,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) va_next = eva; l2 = pmap_l1_to_l2(l1, sva); - if (l2 == NULL) - continue; if ((l2e = pmap_load(l2)) == 0) continue; if ((l2e & PTE_RWX) != 0) { @@ -2690,7 +2684,7 @@ resume: va_next = eva; l2 = pmap_l1_to_l2(l1, sva); - if (l2 == NULL || (l2e = pmap_load(l2)) == 0) + if ((l2e = pmap_load(l2)) == 0) continue; if ((l2e & PTE_RWX) != 0) { if (sva + L2_SIZE == va_next && eva >= va_next) { @@ -2770,7 +2764,7 @@ pmap_fault(pmap_t pmap, vm_offset_t va, vm_prot_t ftype) goto done; if ((l2e & PTE_RWX) == 0) { pte = pmap_l2_to_l3(l2, va); - if (pte == NULL || ((oldpte = pmap_load(pte)) & PTE_V) == 0) + if (((oldpte = pmap_load(pte)) & PTE_V) == 0) goto done; } else { pte = l2; @@ -4770,7 +4764,7 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode) continue; } l2 = pmap_l1_to_l2(l1, tmpva); - if (l2 == NULL || ((l2e = pmap_load(l2)) & PTE_V) == 0) + if (((l2e = pmap_load(l2)) & PTE_V) == 0) return (EINVAL); if ((l2e & PTE_RWX) != 0) { /* @@ -4784,7 +4778,7 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode) continue; } l3 = pmap_l2_to_l3(l2, tmpva); - if (l3 == NULL || ((l3e = pmap_load(l3)) & PTE_V) == 0) + if (((l3e = pmap_load(l3)) & PTE_V) == 0) return (EINVAL); /* * TODO: Update the L3 entry if the attributes don't match once From nobody Mon Jul 8 16:10:56 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHpy90qBKz5Q3N6; Mon, 08 Jul 2024 16:10: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHpy905rXz465s; Mon, 8 Jul 2024 16:10:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720455057; 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=g0hwIhPh9fnuUjHtw3TrNkfxJngD2NkdscYdlLbWjuY=; b=KF/AlcfV7WdHy37AOuE9oEcPY00hOW+0d9QKOrMmu1+f/B3jIz1xGCotBkLSJ45xU8dSW+ KYo/Ln5b4wOzbq7aUX+mkKxJg7yfhy/End6tvYjgDOzPBSTGnWqCZdLko3MJLhWOEq6vey El3OF0TacAMKa5i8j8KOKNfUHGq+iQ+JrwLj9A7lupYWbuWBBjJvyKJtQ2kG/edrCOqowo a39DMUc1YQCME4bPOHBPJy5auKsAjL3yIgAijhB3dgoIlQQCz5g98QzFTnuySFFdpEWBnV 5BrSPPPIo8kdgUTRB1MMukrdGEZkAxBDPu/Opv+8veVB1ZlaH/7f+dGUYrfNIg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720455057; a=rsa-sha256; cv=none; b=Fg9bBFIo93aLODYRZsxNZMUafsmoZ4Oh3hO6Ht6poXA+je8/ZMzP2ZihVOBmabxZRxisi8 Q/MpXtSh1bdRy49xseIP9aj6lzx1Wsoe6cjmC3uAT/Bzrra3I5ZGtzm9LdaHobg6o/7YA6 LPe3UseAaM7wRTYgz7dCLjeerzpP27WCWeasCy6eswpkJlb+ylPXA/UTKXfTejCc3YIVeT 2SW93H9id04Ts0M4Fad5zTAYdEOxGQ/EbncRvMCjlSBABrQ/TdgtH22aSUm6CRnQiWk2yi cijQQMTr9MvquDczNjDPC9oP7l8RtVWh8DIa+9hJQLxaLvx3zp4U2IyD83h42A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720455057; 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=g0hwIhPh9fnuUjHtw3TrNkfxJngD2NkdscYdlLbWjuY=; b=rbGil0c6Envz3Ex7lys3u8xpBh48sKWbInGZOLZ1+xbu5WD+feJrtmZa4Mnq8M7YvSZmgq 9gymFxX2ghSvFEsfmpOpw/J2J4uywJ6T3rRBg5xqlcKzwalkD9I7xBVmKL5Hliak8PiD+X mmjspKypr1mxl2TczTAfMvLE2fRFJnPDQ+S/vkYKPVT+jsHfYRnQDnc1RlCGpbhIIyygBo pYp+3aE2N/B47BBB8L4fYMuG0jH8UNvf29M8//zjI/FxbSJ2SeDuo8giIerK7gZRc2f4bf jYFNuW30GYYb0wF3KztVY7/svt0v02pYaASpLRJCN1MrjsO9IO7h3YEBSdtrAQ== 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 4WHpy86q4FzyCF; Mon, 8 Jul 2024 16:10: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 468GAuYm077248; Mon, 8 Jul 2024 16:10:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468GAu49077245; Mon, 8 Jul 2024 16:10:56 GMT (envelope-from git) Date: Mon, 8 Jul 2024 16:10:56 GMT Message-Id: <202407081610.468GAu49077245@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e2e771deeca7 - main - socket: Pass capsicum rights down to socket option handlers List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e2e771deeca7c10eaa46f380a9b64079468ec209 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e2e771deeca7c10eaa46f380a9b64079468ec209 commit e2e771deeca7c10eaa46f380a9b64079468ec209 Author: Mark Johnston AuthorDate: 2024-07-08 15:46:33 +0000 Commit: Mark Johnston CommitDate: 2024-07-08 16:10:48 +0000 socket: Pass capsicum rights down to socket option handlers One needs the CAP_GETSOCKOPT and CAP_SETSOCKOPT rights to call getsockopt(2) and setsockopt(2) on a socket descriptor, respectively. The syscall layer checks this, but individual socket option handlers have no access to the file descriptor and so can't check for additional rights, should the want to do so. In particular, a forthcoming implementation of SO_SPLICE logically requires at least CAP_RECV and CAP_SEND rights. Modify the syscall layer to look up Capsicum rights on the descriptor and pass that along to socket option handlers; this way, the handlers can check for additional rights if they need to. Reviewed by: gallatin, glebius MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45673 --- sys/kern/uipc_syscalls.c | 9 +++++++-- sys/sys/sockopt.h | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 318415245ab7..e0bb7ace92c6 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1220,6 +1220,7 @@ kern_setsockopt(struct thread *td, int s, int level, int name, const void *val, { struct socket *so; struct file *fp; + struct filecaps fcaps; struct sockopt sopt; int error; @@ -1245,8 +1246,10 @@ kern_setsockopt(struct thread *td, int s, int level, int name, const void *val, } AUDIT_ARG_FD(s); - error = getsock(td, s, &cap_setsockopt_rights, &fp); + error = getsock_cap(td, s, &cap_setsockopt_rights, &fp, + &fcaps); if (error == 0) { + sopt.sopt_rights = &fcaps.fc_rights; so = fp->f_data; error = sosetopt(so, &sopt); fdrop(fp, td); @@ -1284,6 +1287,7 @@ kern_getsockopt(struct thread *td, int s, int level, int name, void *val, { struct socket *so; struct file *fp; + struct filecaps fcaps; struct sockopt sopt; int error; @@ -1309,8 +1313,9 @@ kern_getsockopt(struct thread *td, int s, int level, int name, void *val, } AUDIT_ARG_FD(s); - error = getsock(td, s, &cap_getsockopt_rights, &fp); + error = getsock_cap(td, s, &cap_getsockopt_rights, &fp, &fcaps); if (error == 0) { + sopt.sopt_rights = &fcaps.fc_rights; so = fp->f_data; error = sogetopt(so, &sopt); *valsize = sopt.sopt_valsize; diff --git a/sys/sys/sockopt.h b/sys/sys/sockopt.h index 0b3d0d5ed08c..6cc8875a2665 100644 --- a/sys/sys/sockopt.h +++ b/sys/sys/sockopt.h @@ -35,6 +35,7 @@ #error "no user-serviceable parts inside" #endif +struct cap_rights; struct thread; struct socket; @@ -50,6 +51,7 @@ struct sockopt { int sopt_name; /* third arg of [gs]etsockopt */ void *sopt_val; /* fourth arg of [gs]etsockopt */ size_t sopt_valsize; /* (almost) fifth arg of [gs]etsockopt */ + struct cap_rights *sopt_rights; /* Capsicum rights attached to the fd */ struct thread *sopt_td; /* calling thread or null if kernel */ }; From nobody Mon Jul 8 16:10:58 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHpyB2dd5z5Q33F; Mon, 08 Jul 2024 16:10: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHpyB1SDBz463M; Mon, 8 Jul 2024 16:10:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720455058; 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=qEyJx4xCu9rjO/11Mm0BGaezCjWMbEZizPybtLpCFA0=; b=pti1cprRWuFJ0hI0u4qssver0MPQ9Rcvg8G3hHVZWxUtxzjbsJIoTbPZXzuYLHZi679qMl 9Bk3CSW1EDD9j2VKuAaQ4sMGcbSpHWAj14YsrEcL9N3Hd8rNEmmUqXbG+EaAz7EWMM9diw 6tBL71/Q67kkeRrPOGyTNvvQmkmvRvOEHYfhdeGvdynPz/tgQujDvv43/AVNeFLwbRatrd 6QRuQTW3Ger4aTfXml7/dG/A7gUPup3ee1GwHsu6dI919LFpWCKBiwOnGCslmOopeZWzsY PV02fr3RLqGgipGSR3myCZGo+nwTExT/jXCu34PsCuEJH5upWBMORq7M6DqyTw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720455058; a=rsa-sha256; cv=none; b=KJEwyegfJ48w+dGF9yaNdHj7RlVivSldmunBsDBa6te0+sG/NazBsW8SmMUQcDtOIL1sVx z/b9z78pC50LUqmXndHZQQgl/eh9xEGhX/NaenEUP7tnD8oubEVVTraZxdghfBkuMYeefr zACicyh5MDFjqyBoUyqxWQzIL55Uu9YEcCUs8A8CL6kYxZCQwQlXqC9aUjBHfGubqZbyRU FSCg7fbgGVrFprm0d5Smr3M8ZP1n33tIseJkDD8SuZOOYULI1OqQOtKnVQyUUBvXPCuT/c LzEdJEnhW6htRs9buIdPA9rI9IyYg1BHTaJ4XNh8SC17/aK2x4ewxJ9ieW7bqA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720455058; 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=qEyJx4xCu9rjO/11Mm0BGaezCjWMbEZizPybtLpCFA0=; b=GU05bU4Z+BqnHbFroRJyOzskpqaTRK0P7Pq/ZxN0WNKuqZghDFVImekz/SzmxXWNFXuF1z nqbSUHrmkZNdmSgjAainbi5siftds0DTx7QVA5hRMMLKPB1YYBITNhdtPPkuaLdDGL5q5U SJ9uoyFxKRBpvONIV/Zj26rU8Km7nRiqSme21i94GQTznOBrcnUzGBvek36ev0HY18Ru9h ci/tlta7xIRZXgmiVzYOxBm+/7tsCoR3FWfY3+9eF6pP/b2QsWOM0BVe1d7Ug3RQOyVSGR PJGYws4JXGNMVDKcN0LYT3/Bg56VKysP5C4nFA1IP8qXa2aT5f0rijD1ki8BcQ== 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 4WHpyB13dKzxgk; Mon, 8 Jul 2024 16:10: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 468GAwwb077306; Mon, 8 Jul 2024 16:10:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468GAwKi077303; Mon, 8 Jul 2024 16:10:58 GMT (envelope-from git) Date: Mon, 8 Jul 2024 16:10:58 GMT Message-Id: <202407081610.468GAwKi077303@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 163cdf6a32b9 - main - ktls: Fix races that can lead to double initialization List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 163cdf6a32b9a0f84226a70101d143c10707336f Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=163cdf6a32b9a0f84226a70101d143c10707336f commit 163cdf6a32b9a0f84226a70101d143c10707336f Author: Mark Johnston AuthorDate: 2024-07-08 15:49:29 +0000 Commit: Mark Johnston CommitDate: 2024-07-08 16:10:48 +0000 ktls: Fix races that can lead to double initialization ktls_enable_rx() and ktls_enable_tx() have checks to return EALREADY if the socket already has KTLS enabled. However, these are done without any locks held and nothing blocks concurrent attempts to set the socket option. I believe the worst outcome of the race is leaked memory. Fix the problem by rechecking under the sockbuf lock. While here, unify the locking protocol for sb_tls_info: require both the sockbuf and socket I/O locks in order to enable KTLS. This means that either lock is sufficient for checking whether KTLS is enabled in a given sockbuf, which simplifies some refactoring further down the road. Note that the SOLISTENING() check can go away because SOCK_IO_RECV_LOCK() atomically locks the socket buffer and checks whether the socket is a listening socket. This changes the returned errno value, so update a test which checks it. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45674 --- sys/kern/uipc_ktls.c | 23 +++++++++++++++++++++-- sys/sys/sockbuf.h | 3 ++- tests/sys/kern/ktls_test.c | 2 +- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index fd1bc7bf8bfe..5ea99966bf13 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -1320,12 +1320,23 @@ ktls_enable_rx(struct socket *so, struct tls_enable *en) return (error); } + /* + * Serialize with soreceive_generic() and make sure that we're not + * operating on a listening socket. + */ + error = SOCK_IO_RECV_LOCK(so, SBL_WAIT); + if (error) { + ktls_free(tls); + return (error); + } + /* Mark the socket as using TLS offload. */ SOCK_RECVBUF_LOCK(so); - if (SOLISTENING(so)) { + if (__predict_false(so->so_rcv.sb_tls_info != NULL)) { SOCK_RECVBUF_UNLOCK(so); + SOCK_IO_RECV_UNLOCK(so); ktls_free(tls); - return (EINVAL); + return (EALREADY); } so->so_rcv.sb_tls_seqno = be64dec(en->rec_seq); so->so_rcv.sb_tls_info = tls; @@ -1335,6 +1346,7 @@ ktls_enable_rx(struct socket *so, struct tls_enable *en) sb_mark_notready(&so->so_rcv); ktls_check_rx(&so->so_rcv); SOCK_RECVBUF_UNLOCK(so); + SOCK_IO_RECV_UNLOCK(so); /* Prefer TOE -> ifnet TLS -> software TLS. */ #ifdef TCP_OFFLOAD @@ -1420,6 +1432,13 @@ ktls_enable_tx(struct socket *so, struct tls_enable *en) inp = so->so_pcb; INP_WLOCK(inp); SOCK_SENDBUF_LOCK(so); + if (__predict_false(so->so_snd.sb_tls_info != NULL)) { + SOCK_SENDBUF_UNLOCK(so); + INP_WUNLOCK(inp); + SOCK_IO_SEND_UNLOCK(so); + ktls_free(tls); + return (EALREADY); + } so->so_snd.sb_tls_seqno = be64dec(en->rec_seq); so->so_snd.sb_tls_info = tls; if (tls->mode != TCP_TLS_MODE_SW) { diff --git a/sys/sys/sockbuf.h b/sys/sys/sockbuf.h index c6093883be4a..a2e327bbb5df 100644 --- a/sys/sys/sockbuf.h +++ b/sys/sys/sockbuf.h @@ -128,7 +128,8 @@ struct sockbuf { struct mbuf *sb_mtls; /* TLS mbuf chain */ struct mbuf *sb_mtlstail; /* last mbuf in TLS chain */ uint64_t sb_tls_seqno; /* TLS seqno */ - struct ktls_session *sb_tls_info; /* TLS state */ + /* TLS state, locked by sockbuf and sock I/O mutexes. */ + struct ktls_session *sb_tls_info; }; /* * PF_UNIX/SOCK_DGRAM diff --git a/tests/sys/kern/ktls_test.c b/tests/sys/kern/ktls_test.c index f57ae74112a2..72497196b945 100644 --- a/tests/sys/kern/ktls_test.c +++ b/tests/sys/kern/ktls_test.c @@ -2812,7 +2812,7 @@ ATF_TC_BODY(ktls_listening_socket, tc) TLS_MINOR_VER_THREE, (uint64_t)random(), &en); ATF_REQUIRE_ERRNO(ENOTCONN, setsockopt(s, IPPROTO_TCP, TCP_TXTLS_ENABLE, &en, sizeof(en)) != 0); - ATF_REQUIRE_ERRNO(EINVAL, + ATF_REQUIRE_ERRNO(ENOTCONN, setsockopt(s, IPPROTO_TCP, TCP_RXTLS_ENABLE, &en, sizeof(en)) != 0); ATF_REQUIRE(close(s) == 0); } From nobody Mon Jul 8 16:10:59 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHpyD2pzmz5Q30D; Mon, 08 Jul 2024 16:11: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHpyC6zktz46B7; Mon, 8 Jul 2024 16:10:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720455060; 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=42VAn1ujTvfyf4AosxUOX01mcFfkE0lJ6m9/71/ELYg=; b=v+TPecpwLf/4Q5zQLxKq4WBfSpqhp35YVBpblPljki0frTsOJFOC2vlCRFY1sB3O64yH14 lR408ri/r7WJSSDn5e0uG02bPSlPOw3AxmRlZqf9urtbTxBBI13vm9Wmv7cwu9UR2Z/pQ6 m2obxDPni87779MgckKXs/gxYC4/5TYGtrM6SEKHgkgZ6NcW66eOZKhtkoaTGxdGIvgrNf FapPq7QW7lC1vmckNtQLa0MK4YjF39AH2qTaqLIbcR/2FWsX4JJhupSxwQ4nTNo4jif79A pztnDnqrd5I5uE7K+p9S7GnQbSXbi3X0O8cvwjO7z3drb5cAdkZwFxM04MJ4IQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720455060; a=rsa-sha256; cv=none; b=Nm1BMfItEXpp3XPe642HinppIXTXm9NTZMdcSIq21Ifu4JoWgpA99EhFpUuf1nFDHzT9C4 Ys4ewf8d3z5CdSH8embs2htqz1jCku25N56I/oVOtUoA2keMTd9UfDiYL8XvWYV3hnJblF nJaC2gSLEdPZhkjOfGgMjNGYOl7k6NMYxCvN9qTymXeAdkjVBtcofoM/MF/n0znxFcCwXf FVOVsGcSnFzpRLk3xtlfxkIetvvX204mFBqczlwz7VblmUxzaJcsYqTLOEF0U6vGUJPpin B/ulamCytlQQ+eq/6vjN7YDmv/JjloOvV4GRFoAQnvtGj2La0AfzoBWQYLKzYw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720455060; 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=42VAn1ujTvfyf4AosxUOX01mcFfkE0lJ6m9/71/ELYg=; b=ZWBhDdaZIHAOPW5yT38D5P3sZHzgPmIPUWD0zctCjYuQVZ/eZVKZdYXnCoMEgfYmSfZgHb rm4kw46FYwQWloEL9SGYpaMIz5RuhjcUtCuTHdsCN4SZIa1UKJ2ElfHuo1zh8vs7cjzYUE ko093YSoY81uYfL2zr6ZDQwXDIZmkCpzmSfwPwzBlwdvMKsJLaSUnqTbunhS3md8IrVNHq Vi/QV1P0ERtn6gaBMH9OwxU0kNbnSP4vIamZ90KJNfwdSMHoPkZ1Z1WOswTESB5bGJBNFw Zf6KVBQamDMJfI75KKThc9g9ZHFt15e9a3iAzwwnN6Wk6AZijzUF0ObXxzoWDw== 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 4WHpyC259qzxp6; Mon, 8 Jul 2024 16:10: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 468GAx4L077361; Mon, 8 Jul 2024 16:10:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468GAxN9077358; Mon, 8 Jul 2024 16:10:59 GMT (envelope-from git) Date: Mon, 8 Jul 2024 16:10:59 GMT Message-Id: <202407081610.468GAxN9077358@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5dfca6c375d5 - main - ktls: Remove the socket parameter to ktls_ocf_try() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5dfca6c375d530908eedb7f103681c2493cf0ca3 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5dfca6c375d530908eedb7f103681c2493cf0ca3 commit 5dfca6c375d530908eedb7f103681c2493cf0ca3 Author: Mark Johnston AuthorDate: 2024-07-08 15:52:07 +0000 Commit: Mark Johnston CommitDate: 2024-07-08 16:10:48 +0000 ktls: Remove the socket parameter to ktls_ocf_try() The socket is unused, and not passing it means that there's less to think about when considering how KTLS is synchronized with the rest of the socket code. No functional change intended. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45675 --- sys/kern/uipc_ktls.c | 10 +++++----- sys/opencrypto/ktls.h | 2 +- sys/opencrypto/ktls_ocf.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 5ea99966bf13..1e4a933d4e4f 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -1153,11 +1153,11 @@ ktls_use_sw(struct ktls_session *tls) } static int -ktls_try_sw(struct socket *so, struct ktls_session *tls, int direction) +ktls_try_sw(struct ktls_session *tls, int direction) { int error; - error = ktls_ocf_try(so, tls, direction); + error = ktls_ocf_try(tls, direction); if (error) return (error); ktls_use_sw(tls); @@ -1314,7 +1314,7 @@ ktls_enable_rx(struct socket *so, struct tls_enable *en) if (error) return (error); - error = ktls_ocf_try(so, tls, KTLS_RX); + error = ktls_ocf_try(tls, KTLS_RX); if (error) { ktls_free(tls); return (error); @@ -1407,7 +1407,7 @@ ktls_enable_tx(struct socket *so, struct tls_enable *en) #endif error = ktls_try_ifnet(so, tls, KTLS_TX, false); if (error) - error = ktls_try_sw(so, tls, KTLS_TX); + error = ktls_try_sw(tls, KTLS_TX); if (error) { ktls_free(tls); @@ -1599,7 +1599,7 @@ ktls_set_tx_mode(struct socket *so, int mode) if (mode == TCP_TLS_MODE_IFNET) error = ktls_try_ifnet(so, tls_new, KTLS_TX, true); else - error = ktls_try_sw(so, tls_new, KTLS_TX); + error = ktls_try_sw(tls_new, KTLS_TX); if (error) { counter_u64_add(ktls_switch_failed, 1); ktls_free(tls_new); diff --git a/sys/opencrypto/ktls.h b/sys/opencrypto/ktls.h index 0fe02b7f50f5..efba25e17013 100644 --- a/sys/opencrypto/ktls.h +++ b/sys/opencrypto/ktls.h @@ -48,7 +48,7 @@ struct ktls_ocf_encrypt_state { void ktls_encrypt_cb(struct ktls_ocf_encrypt_state *state, int error); void ktls_ocf_free(struct ktls_session *tls); -int ktls_ocf_try(struct socket *so, struct ktls_session *tls, int direction); +int ktls_ocf_try(struct ktls_session *tls, int direction); int ktls_ocf_encrypt(struct ktls_ocf_encrypt_state *state, struct ktls_session *tls, struct mbuf *m, struct iovec *outiov, int outiovcnt); diff --git a/sys/opencrypto/ktls_ocf.c b/sys/opencrypto/ktls_ocf.c index 5f0339e82962..74b48f2366c1 100644 --- a/sys/opencrypto/ktls_ocf.c +++ b/sys/opencrypto/ktls_ocf.c @@ -982,7 +982,7 @@ ktls_ocf_free(struct ktls_session *tls) } int -ktls_ocf_try(struct socket *so, struct ktls_session *tls, int direction) +ktls_ocf_try(struct ktls_session *tls, int direction) { struct crypto_session_params csp, mac_csp, recrypt_csp; struct ktls_ocf_session *os; From nobody Mon Jul 8 16:20:43 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHq9R2gc3z5Q455; Mon, 08 Jul 2024 16:20:43 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHq9R2DMWz47nY; Mon, 8 Jul 2024 16:20:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720455643; 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=1kXS03sYfsFs9BKvUJjtucdQ1pFFLpDbhPxwg22e09c=; b=Tf75vCxxO7gFl5b0jQFNx1y/qVILLmMLZKhdDPAevYB7E2dE+DW2aFyYCdGr7D2TuGuFbZ naNk/FticGlcRAOLTyDEGyWXVoYpfAgt1ihsRb2XXfnZfXyO9rB7P5DHK5H0kQ5ok7jf4u w/gW4fP+zDpLYv2WOeZ6wFZDQM91w92TMDI+p8YJHb5cmn4fd4zG1fv2+iEM8Bshgghdet D9NYvn0FS77PW98uyUkxiAXtFWKVkQf3Vomvbo/GuB3o15juf5RvoZdqmFVfG8DBfsRmrI a1ivMiopNaB4mFA27PywWYjf21UTF32KzV7Gj8/jciMxNtRTstpS7xgCTobgoQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720455643; a=rsa-sha256; cv=none; b=cBF74Lca5odqouDZu+oiidE0uFy6barycbP99gjd9MJMQ14wOxPRmJvZAiJremR2miI7kq NL8p3pLY9/zPntvwytB1oX0+yXGWi5WKNfxCacRuI9lbyERtJX8MbUK9PKD0i3f3+gytGh Q+FLTZiGFlvMn7+4SCHarsZA9rUMJNvSS4NiuZaZ8kHhfdze31GFUFQowKGaM5sP61t+u8 lgTfvBdmLidnWi6tQEuqe3ujGD4esi+Udoec1eSH0p6j2AeUBvHm2APfwiqB/aychrNDZE Dbl0i/iSOpUb1nImAHpcMDTg/iqIYVuFoMwOm4tadpSxy5OwXKB86dpHQj3/AQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720455643; 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=1kXS03sYfsFs9BKvUJjtucdQ1pFFLpDbhPxwg22e09c=; b=i4bEsebE5E11xi5IMJQVYpymIetKE7tUtRroBE45gp5cHa9uawp3CdZHepfew00NHh9oAj 7GNz5PMh0UDXhX+i6o4INwXIQamQrgxxDwAFsrzvUX8rkfOV2BaNxl84uegKmNjBW3eqEq 8ckDsun7m3mtRvxxiLQQiYkLEq0iACOrnxMvtVGPxWXX2gObZTvOYas1u/PU1mcoL16sVe 5XsED3gQGk3Gni96j9ghjgCqLUYwDfBgG6RMkv6ZkvX2WuhgdeQkhJ5xxfZv380jZFapJF uXPHpsgFS2xQRlsXfdrCcljdEOCdYw4Dn2GyGHj5jOJzRO3JCeYr7LSMm8NrWA== 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 4WHq9R1qydzyFw; Mon, 8 Jul 2024 16:20: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 468GKh1s093499; Mon, 8 Jul 2024 16:20:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468GKhWF093496; Mon, 8 Jul 2024 16:20:43 GMT (envelope-from git) Date: Mon, 8 Jul 2024 16:20:43 GMT Message-Id: <202407081620.468GKhWF093496@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 713c77b927f2 - main - man9: Add an MLINK for taskqueue_enqueue_timeout_sbt.9 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 713c77b927f2feb7d51a96f4bc9184cf8dce61b4 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=713c77b927f2feb7d51a96f4bc9184cf8dce61b4 commit 713c77b927f2feb7d51a96f4bc9184cf8dce61b4 Author: Mark Johnston AuthorDate: 2024-07-08 16:20:06 +0000 Commit: Mark Johnston CommitDate: 2024-07-08 16:20:06 +0000 man9: Add an MLINK for taskqueue_enqueue_timeout_sbt.9 MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: Stormshield --- share/man/man9/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 38d836b1647a..ea86d465a3ea 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -2249,6 +2249,7 @@ MLINKS+=taskqueue.9 TASK_INIT.9 \ taskqueue.9 taskqueue_drain_timeout.9 \ taskqueue.9 taskqueue_enqueue.9 \ taskqueue.9 taskqueue_enqueue_timeout.9 \ + taskqueue.9 taskqueue_enqueue_timeout_sbt.9 \ taskqueue.9 TASKQUEUE_FAST_DEFINE.9 \ taskqueue.9 TASKQUEUE_FAST_DEFINE_THREAD.9 \ taskqueue.9 taskqueue_free.9 \ From nobody Mon Jul 8 17:48:24 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHs6c48fvz5QG3J; Mon, 08 Jul 2024 17:48:24 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHs6c3LF9z4QL9; Mon, 8 Jul 2024 17:48:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720460904; 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=YComnYd/WrbbN3TUEM+ZRP5tRflo7vXVg0+/UI2XAzg=; b=mdFnsFg56XCvGCAtdbF3hj5ySU7VJrw79fz7cx+oJfyUPzV6EQGYslDiavZghz/wu4RIRG nr2S/q8kexqS5J+KHEHHTi/9wq7ROEWRgUGnkL2SXeaLzlW36h5IeFgWnamX0ftXEsLok3 KHfjrFEPmpCHxPWBb7WoLy2Gy2UvDyNpWQq4x2FlsMEyf4L36Ee4sCUNWr5MHINF9Q9Aks /rI9WsdOfU8qkCqcCvAMs1THM96q6V4HCm/etMGX0kjpldT2s3CNuPCMwatnmNfc9HOgmZ LoSTc2xVTbTSWbLi+UMrte4qXA392YOhRagcr7yWH6yDdWytNJ+f8ibMv24ASw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720460904; a=rsa-sha256; cv=none; b=xtwrd7ENPPtsH4Ke+4MvVQw+YUqHyEqPcVSovG/OyaQWND0POw9d6f7pu4ekCM474s9Nfx WiqwuHLW6L0nRO2QEB1k6WwmzP7Gc8elPkYOLJjc/fGHA5bLO00c11Fr2OeZ3arz5ir9Tj RsDqMfJb7kkVosXK9NL/8r05GZOmFXjz5vHOkHhUaOm5OZ8VKYkHC6eL30AwGAvMdvk379 SNTloNnTWZQ0PW3mzXHNQWl2lLdOTQiea7huqbykDj8phVUxlggHuIW1rFGc4YugAjhMhn Yi+qVXiwuheBqV5rMC9rpqJUEL5Iivz9D5H3Vaf8YWdkvyuADNjwMjMtCwTK7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720460904; 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=YComnYd/WrbbN3TUEM+ZRP5tRflo7vXVg0+/UI2XAzg=; b=UlVbFvt8VrF3ZCZlKdEw7HXrMo4EHQAwq/J3WEcPyyMlpVlqjXimz+ypFsbfsch/ruLxfi o7Zek8ttIFLSiQSl+JVC0K7NxWN9cfnqsWCZ5clW50b8SJNHowuyCt64Q0eFRfLZNh84WN 38qpDYUwzNbai42nK+6+DNurQJXCDKojKrVjAFDOl0SNdHdqBNl3kp13GdKS5cFSqukbZO 8Mj6swC8QyzNXOD+kXzeU/Xx6O41rpsjKhO4iIixfaBJszK1egx8Ar6W83dPTfdIfXqxzd Qg5AyDvhjaRVyOZ+2BlOnwhZlQ4Yx0NwdnJ1IKS2nM2ubUpgDf50dKZlppC/aQ== 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 4WHs6c2qZqz11fn; Mon, 8 Jul 2024 17:48: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 468HmOXd041036; Mon, 8 Jul 2024 17:48:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468HmOb0041033; Mon, 8 Jul 2024 17:48:24 GMT (envelope-from git) Date: Mon, 8 Jul 2024 17:48:24 GMT Message-Id: <202407081748.468HmOb0041033@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: bea256f3c5b9 - main - taskqueue: Move the timeout_task definition to _task.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bea256f3c5b9d9608278377576047bf0e591a4e7 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bea256f3c5b9d9608278377576047bf0e591a4e7 commit bea256f3c5b9d9608278377576047bf0e591a4e7 Author: Mark Johnston AuthorDate: 2024-07-08 16:26:35 +0000 Commit: Mark Johnston CommitDate: 2024-07-08 16:26:35 +0000 taskqueue: Move the timeout_task definition to _task.h So that timeout_task may be embedded into structures without pulling in too many other definitions. No functional change intended. MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: Stormshield --- sys/sys/_task.h | 10 ++++++++++ sys/sys/taskqueue.h | 8 -------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sys/sys/_task.h b/sys/sys/_task.h index 0e6f212990ec..86c68da8bab0 100644 --- a/sys/sys/_task.h +++ b/sys/sys/_task.h @@ -29,6 +29,7 @@ #ifndef _SYS__TASK_H_ #define _SYS__TASK_H_ +#include #include /* @@ -58,6 +59,15 @@ struct task { #define TASK_IS_NET(ta) ((ta)->ta_flags & TASK_NETWORK) +struct taskqueue; + +struct timeout_task { + struct taskqueue *q; + struct task t; + struct callout c; + int f; +}; + #ifdef _KERNEL typedef void gtask_fn_t(void *context); diff --git a/sys/sys/taskqueue.h b/sys/sys/taskqueue.h index 34d64a5042a6..9757e1fce575 100644 --- a/sys/sys/taskqueue.h +++ b/sys/sys/taskqueue.h @@ -35,7 +35,6 @@ #include #include -#include #include struct taskqueue; @@ -43,13 +42,6 @@ struct taskqgroup; struct proc; struct thread; -struct timeout_task { - struct taskqueue *q; - struct task t; - struct callout c; - int f; -}; - enum taskqueue_callback_type { TASKQUEUE_CALLBACK_TYPE_INIT, TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, From nobody Mon Jul 8 18:17:58 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHsml0wbBz5QK9f; Mon, 08 Jul 2024 18:17: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHsmk6jF4z4V4k; Mon, 8 Jul 2024 18:17:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720462679; 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=aQXvUsVrTD/MYSHYSvzS7E5+rayPU6+vnU4cowIWVFk=; b=Wnn2l/jsndd9mEvkQDJepejadmQdoe7pkTKo6+qrym7eGMkFH5oANEgxgtloObOw7wHl22 MlkfTtPUX8RaYPeXQ7vzy++n2qmCf47Ch9QuyPS0FmapzMubTa3bvzCLfk9bphTPM7T32z ULDi0VQ+krIIH1Qm5Ml6jnHJfX6e7halmYKiHjZHybwCauwj38zVjxOPumUCRusE2CWw4f 3h3fou5MZrvKDDKxz66j+sESafcO0dmrHW5POhjfATeuaD+ymY7dQFJZp2wdMWjx97LUPZ XOqqwYMOfWZ311wxZ+vcU13r31TIdXeT4C4AgMVJHB0xhG3DZoG56hHaV1I+JQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720462679; a=rsa-sha256; cv=none; b=mKh7uT55kurWmgx3CUpaA2mYfZLmjlj9JcSHGGK8yBsgwoHhNyGDu1iPoDLajx8pdRakiC Kr5lLNIIovzbhFsLk3ayNt8nt6os+N2zP8HqYd+/pKoCLfHc5th4Zgwc+7XKTekLfSy4x4 GWZZnIPfq4+G4wg/3AjXZT8lJKMwdDu0WdJiDQHu5XwrL366Iss7U+j0rtAzwLP+JMpS+j Zbw0bGF70RbOUyp6TR09qfoahgF7uK2e5UZczTgXD6JUtkh8zw9Obn20QKhTBmwx9RyA4V 1RajgB77cWs7fNxBHsH7dB319posh7eImQZKnvcBRGVCXde/ErxIhHAVxHLM8w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720462679; 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=aQXvUsVrTD/MYSHYSvzS7E5+rayPU6+vnU4cowIWVFk=; b=vzuPXc4MMTclEkLdGyikbVbDhCPNDy1T2hr2g1TpbIGizE7s6feIY2o3KWigUkaX92yFXQ a+f7ABfaWFjLi+/JHVIkq/vGRKxQxBlXya0dkaoYt1JR90AQ6i+VYe66ztxDPR03nEMkx8 B1WlZi+u/3Ixdy0nZku0rLM9qln93AjPcaZKb58WfOja7h1nWLF7iatxBn4fAp1swKlyN5 Ym3G76xSRrXcSiE0ZvZvOiauos0gFuGdgLPddIpoXJCleS+vH7DSz/1xyXEPhxC9SkGM2s 1vzdUF3ScKaIcIeIqJTO/5DgPumXIti+D0YCA2jleEpeMPzKkgUhAgFLTByYkQ== 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 4WHsmk69FPz12C1; Mon, 8 Jul 2024 18:17: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 468IHwqf092070; Mon, 8 Jul 2024 18:17:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468IHwKr092067; Mon, 8 Jul 2024 18:17:58 GMT (envelope-from git) Date: Mon, 8 Jul 2024 18:17:58 GMT Message-Id: <202407081817.468IHwKr092067@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 0a487207227b - main - vfs cache: add sysctl vfs.cache.param.hitpct List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0a487207227badcbfbec029103ac7e2d5291bd30 Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=0a487207227badcbfbec029103ac7e2d5291bd30 commit 0a487207227badcbfbec029103ac7e2d5291bd30 Author: Mateusz Guzik AuthorDate: 2024-07-08 17:57:39 +0000 Commit: Mateusz Guzik CommitDate: 2024-07-08 18:17:54 +0000 vfs cache: add sysctl vfs.cache.param.hitpct Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/kern/vfs_cache.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 375b682e1f3a..fa6b23fe3d6f 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -1071,6 +1071,26 @@ SYSCTL_PROC(_vfs_cache, OID_AUTO, nchstats, CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, 0, 0, sysctl_nchstats, "LU", "VFS cache effectiveness statistics"); +static int +sysctl_hitpct(SYSCTL_HANDLER_ARGS) +{ + long poshits, neghits, miss, total; + long pct; + + poshits = counter_u64_fetch(numposhits); + neghits = counter_u64_fetch(numneghits); + miss = counter_u64_fetch(nummiss); + total = poshits + neghits + miss; + + pct = 0; + if (total != 0) + pct = ((poshits + neghits) * 100) / total; + return (sysctl_handle_int(oidp, 0, pct, req)); +} +SYSCTL_PROC(_vfs_cache_stats, OID_AUTO, hitpct, + CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD, NULL, 0, sysctl_hitpct, + "I", "Percentage of hits"); + static void cache_recalc_neg_min(void) { From nobody Mon Jul 8 22:54:24 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WHzvh5znBz5Qp9Q; Mon, 08 Jul 2024 22:54:24 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WHzvh5mp3z4tWh; Mon, 8 Jul 2024 22:54:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720479264; 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=aWRawNugOPgF4y1FY97NEfJISdI84yK0s9PF1nEtwQI=; b=WKi4jWzBPiUmxCFyTfU0dxFj4Lxm+dyrfRUq/Qt81dehBhsxJxqVSSpWIY5B8BQUtM/810 YwTbxb/z6u5oE8IejYUQ4CH62OW+jqBFAYZWngpqVD0gZfeyTIwlw2cRR5RQeosMa9Vni+ gldvJKzP9T5SRn9GwuKYESf8bkslj5w+n8mWGupbrTt2+hYJ8yvVdY9knSfbIdKKFZESz/ 2LpsBDmPksF67PWk0nuk/R08fF9gdfncE97z5OI9Hpbhd6BZ5B7OpWzzFL34fbroD89G5O iqrMvpqRMBSjyJn8a3RcHVru3q0u8HBedaux1cJgbZsC1K1VeQF418eY8+XVbQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720479264; a=rsa-sha256; cv=none; b=hNxgcM00I3MMOii3unA0DWQVbAFNI39qd+PIaYCnRmfAflXrkLgV4gRsQwLfM9j/kiNwz0 Jy9ezgU94/OdkoLbOTOVSNyxo1iDx7lNmvSvHmI2c04ylwfyc8UhGBOOK0tp+2oMzpNZJ2 yKQWQTHRI25AnaPqs22RCJqfRLQkkXXofFVvBkd86k172h15PvIRY4UIHA+eBicfq0KkG+ /aU1Xz1aJfjcOekka12TKcGMzQhOimmrw+b+XfHGNjUa7KX+GSiPmAwpLPxAgnkyo7c3RT w0GYYZUcjgS8KqnlFm6YIy1qrX+LWe/k6nDpr6cM6XKFnc56Nfx3wIXo5cXX8Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720479264; 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=aWRawNugOPgF4y1FY97NEfJISdI84yK0s9PF1nEtwQI=; b=AmJBqSgHQIqY7LRxzMrsQ2I/v4jJYJNFRHsMXM49k7Lx549r1z8ae1zPsprCZy3dx1CwIh eqe6y+ZdrdIWcHZb3pEv2cxGhvuT2vhntYN7r50Kt1XN24WvjU7+6OpJVipWTaN2aSFbX+ o1tyXXcpkXPBvUa0GAW+Yn9jM+7XZR5NSe0ay6Xn8MwkqFcZxxiMvaWjkNa4pwv0rZ7HbW b4DGManQTiNmAb2WxmA/Q9159RsiLO3A1ECffzQ+XpYjNHFgj0Lo3dl6CgkCdmr/9+SyND vkeCq6nEhLFCB2KJpXp2WIIprUMYWI5+/XRBH42LuuI6xczhcYKTYqEfgAMXvg== 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 4WHzvh5Mzrz19DL; Mon, 8 Jul 2024 22:54: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 468MsONJ064772; Mon, 8 Jul 2024 22:54:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468MsOMU064769; Mon, 8 Jul 2024 22:54:24 GMT (envelope-from git) Date: Mon, 8 Jul 2024 22:54:24 GMT Message-Id: <202407082254.468MsOMU064769@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 4122295afcbf - main - cdefs(9): Start to document what sys/cdefs.h does List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4122295afcbf4b7ad0623bbf35f36dc3278ac028 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4122295afcbf4b7ad0623bbf35f36dc3278ac028 commit 4122295afcbf4b7ad0623bbf35f36dc3278ac028 Author: Warner Losh AuthorDate: 2024-07-02 22:45:49 +0000 Commit: Warner Losh CommitDate: 2024-07-08 22:54:02 +0000 cdefs(9): Start to document what sys/cdefs.h does Start to document all the macros and such used to implment our portability layer. It also describes what compilation environments we support, what compilers we support and some of the details. This is round one. All the macros, etc are in here, but some need descriptions. These macros, while FreeBSD internal only, do need documentation on when/where to use them. This man page likely needs better organization. While better than sys/cdefs.h, the underlying chaos in that file was hard to leave completely behind. Suggestions welcome. Feedback by: mhorne, Graham Perrin, Alexander Ziaee Sponsored by: Netflix Pull Request: https://github.com/freebsd/freebsd-src/pull/1313 --- share/man/man9/Makefile | 1 + share/man/man9/cdefs.9 | 405 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 406 insertions(+) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index ea86d465a3ea..35eec7b2c6ce 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -62,6 +62,7 @@ MAN= accept_filter.9 \ callout.9 \ casuword.9 \ cd.9 \ + cdefs.9 \ cnv.9 \ condvar.9 \ config_intrhook.9 \ diff --git a/share/man/man9/cdefs.9 b/share/man/man9/cdefs.9 new file mode 100644 index 000000000000..a065e0bd7d1d --- /dev/null +++ b/share/man/man9/cdefs.9 @@ -0,0 +1,405 @@ +.\"- +.\" Copyright (c) 2024 M. Warner Losh +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.Dd July 8, 2024 +.Dt CDEFS 9 +.Os +.Sh NAME +.Nm cdefs +.Nd compiler portability macro definitions +.Sh DESCRIPTION +.In sys/cdefs.h +defines macros for compiler, C language standard portability, POSIX standards +compliance and symbol visibility. +It defines programming interfaces for the system header files to adopt to the +many environments +.Fx +supports compilation for. +It defines convenience macros for the +.Fx +sources, tailored to the base +system's needs. +.Pp +Most of these macros are for use inside the +.Fx +sources only. +They are not intended as a general portability layer. +.Sh Supported Compilers +.Bl -tag -offset 2n -width 0 +.It Compilers supported for building programs on Fx : +.Bl -column -offset 0n indent-two +.It Sy Compiler Ta Sy Versions +.It gcc Ta 9, 10, 11, 12, 13, 14 +.It clang Ta 10, 11, 12, 13, 14, 15, 16, 17, 18 +.It TinyC (tcc) Ta 0.9 +.It pcc Ta 1.1 +.El +.Pp +Due to testing constraints, tcc and pcc may not always work. +.It Compilers supported for building Fx itself: +.Bl -column -offset 0n indent-two +.It Sy Compiler Ta Sy Versions +.It gcc Ta 12, 13 +.It clang Ta 16, 17, 19 +.El +.Sh Macros and Magic for Programming Environment +.Nm +defines (or refrains from defining) a number of macros to increase portability +of compiled programs. +These are to allow more advanced language features to appear in header files. +The header files assume a compiler that accepts C prototype function +declarations. +They also assume that the compiler accepts ANSI C89 keywords for all language +dialects. +.Ss General Macros +General macros that facilitate multiple language environments and language +dialects. +.Bl -column "---------------" +.It Sy Macro Ta Sy Description +.It Dv __volatile Ta expands to volatile in C++ and C89 and newer environments, +__volatile in pre-ANSI environments that support this extension or nothing +otherwise. +.It Dv __inline Ta expands to inline in C++ and C89 and newer environments, +__inline in pre-ANSI environments that support this extension or nothing +otherwise. +.It Dv __restrict Ta expands to restrict in C99 and newer environments, or +__restrict otherwise. +.It Dv __CONCAT Ta used to paste two pre-processor tokens. +.It Dv __STRING Ta used to convert the argument to a string. +.It Dv __BEGIN_DECLS Ta Start a group of functions. +.It Dv __END_DECLS Ta End a group of functions. +In a C environment, these are defined as nothing. +In a C++ environment, these declare the functions to have +.Dq C +linkage. +.El +.Ss Function, Structure and Variable Modifiers +.Bl -column "---------------" +.It Sy Macro Ta Sy Description +.It Sy __weak_symbol Ta Declare the symbol to be a weak symbol +.It Sy __dead2 Ta Function will not return +.It Sy __pure2 Ta Function has no side effects +.It Sy __unused Ta To Variable may be unused (usually arguments), so do not warn about it +.It Sy __used Ta Function really is used, so emit it even if it appears unused. +.It Sy __packed Ta \&Do not have space between structure elements for natural alignment. +Used when communicating with external protocols. +.It Sy __aligned(x) Ta Specify in bytes the minimum alignment for the specified field, structure or variable +.It Sy __section(x) Ta Place function or variable in section Fa x +.It Sy __writeonly Ta Hint that the variable is only assigned to, but do not warn about it. +Useful for macros and other places the eventual use of the result is unknown. +.It Sy __alloc_size(x) Ta The function always returns at least the number of +bytes determined by argument number Fa x +.It Sy __alloc_size2(x,n) Ta The function always returns an array, whose size +is at least the number of bytes determined by argument number Fa x times the +number of elements specified by argument number Fa n +.It Sy __alloc_align(x) Ta Function either returns a pointer aligned to Fa x bytes +or Dv NULL. +.It Sy __min_size Ta Declare the array to have a certain, minimum size +.It Sy __malloc_like Ta Function behaves like the +.Dq malloc +family of functions. +.It Sy __pure Ta Function has no side effects +.It Sy __always_inline Ta Always inline this function when called +.It Sy __fastcall Ta Use the +.Dq fastcall +ABI to call and name mangle this function. +.It Sy __result_use_check Ta Warn if function caller does not use it's return value +.It Sy __result_use_or_ignore_check Ta Warn if function caller does not use it's return value. +Allows the value to be explicitly ignored with a (void) cast. +.It Sy __returns_twice Ta Returns multiple times, like +.Xr fork 2 +.It Sy __unreachable Ta This code is not reachable at runtime +.It Sy __predict_true(x) Ta Hint to the compiler that +.Fa x +is true most of the time. +Should only be used when performance is improved for a frequently called bit of code. +.It Sy __predict_false(x) Ta Hint to the compiler that +.Fa x +is false most of the time. +Should only be used when performance is improved for a frequently called bit of code. +.It Sy __null_sentinel Ta The varadic function contains a parameter that is +a NULL sentinel to mark the end of its arguments. +.It Sy __exported Ta +.It Sy __hidden Ta +.It Sy __printflike(fmtarg,firstvararg) Ta Function is similar to +.Fn printf +which specifies the format argument with +.Fa fmtarg +and where the arguments formatted by that format start with the +.Fa firstvararg , +with 0 meaning that +.Dv va_arg +is used and cannot be checked. +.It Sy __scanflike(fmtarg,firstvararg) Ta Function is similar to +.Fn scanf +which specifies the format argument with +.Fa fmtarg +and where the arguments formatted by that format start with the +.Fa firstvararg , +with 0 meaning that +.Dv va_arg +is used and cannot be checked. +.It Sy __format_arg(f) Ta Specifies that arg +.Fa f +contains a string that will be passed to a function like +.Fn printf +or +.Fa scanf +after being translated in some way. +.It Sy __strfmonlike(fmtarg,firstvararg) Ta Function is similar to +.Fn scanf +which specifies the format argument with +.Fa fmtarg +and where the arguments formatted by that format start with the +.Fa firstvararg , +with 0 meaning that +.Dv va_arg +is used and cannot be checked. +.It Sy __strtimelike(fmtarg,firstvararg) Ta Function is similar to +.Fn scanf +which specifies the format argument with +.Fa fmtarg +and where the arguments formatted by that format start with the +.Fa firstvararg , +with 0 meaning that +.Dv va_arg +is used and cannot be checked. +.It Sy __printf0like(fmtarg,firstvararg) Ta Exactly the same +as +.Sy __printflike +except +.Fa fmtarg +may be +.Dv NULL. +.It Sy __strong_reference(sym,aliassym) Ta +.It Sy __weak_reference(sym,alias) Ta +.It Sy __warn_references(sym,msg) Ta +.It Sy __sym_compat(sym,impl,verid) Ta +.It Sy __sym_default(sym,impl,verid) Ta +.It Sy __GLOBAL(sym) Ta +.It Sy __WEAK(sym) Ta +.It Sy __DECONST(type,var) Ta +.It Sy __DEVOLATILE(type,var) Ta +.It Sy __DEQUALIFY(type,var) Ta +.It Sy __RENAME(x) Ta +.It Sy __arg_type_tag Ta +.It Sy __datatype_type_tag Ta +.It Sy __align_up(x,y) Ta +.It Sy __align_down(x,y) Ta +.It Sy __is_aligned(x,y) Ta +.El +.Ss Locking and Debugging Macros +Macros for lock annotation and debugging, as well as some general debugging +macros for address sanitizers. +.Bl -column "---------------" +.It Sy __lock_annotate(x) Ta +.It Sy __lockable Ta +.It Sy __locks_exclusive Ta +.It Sy __locks_shared Ta +.It Sy __trylocks_exclusive Ta +.It Sy __trylocks_shared Ta +.It Sy __unlocks Ta +.It Sy __asserts_exclusive Ta +.It Sy __asserts_shared Ta +.It Sy __requires_exclusive Ta +.It Sy __requires_shared Ta +.It Sy __requires_unlocked Ta +.It Sy __no_lock_analysis Ta +.It Sy __nosanitizeaddress Ta +.It Sy __nosanitizememory Ta +.It Sy __nosanitizethread Ta +.It Sy __nostackprotector Ta +.It Sy __guarded_by(x) Ta +.It Sy __pt_guarded_by(x) Ta +.El +.Ss Emulated Keywords +As C evolves, many of the old macros we once used have been incorporated into +the standard language. +As this happens, we add support for these keywords as macros for older +compilation environments. +Sometimes this results in a nop in the older environment. +.Bl -column "---------------" +.It Sy Keyword Ta Sy Description +.It Sy _Alignas(x) Ta +.It Sy _Alignof(x) Ta +.It Sy _Noreturn Ta Expands to +.Dq [[noreturn]] +in C++-11 and newer compilation environments, otherwise +.Dq __dead2 +.It Sy _Static_assert(x, y) Ta Compile time assertion that +.Fa x +is true, otherwise emit +.Fa y +as the error message. +.It Sy _Thread_local Ta Designate variable as thread local storage +.It Sy __generic Ta implement _Generic-like features which aren't entirely possible to emulate the _Generic keyword +.It Sy __noexcept Ta to emulate the C++11 argument-less noexcept form +.It Sy __noexcept_if Ta to emulate the C++11 conditional noexcept form +.It Sy _Nonnull Ta +.It Sy _Nullable Ta +.It Sy _Null_unspecified Ta +.El +.Ss Support Macros +The following macros are defined, or have specific values, to denote certain +things about the build environment. +.Bl -column "---------------" +.It Sy Macro Ta Sy Description +.It Sy __LONG_LONG_SUPPORTED Ta Variables may be declared +.Dq long long . +This is defined for C99 or newer and C++ environments. +.It Sy __STDC_LIMIT_MACROS Ta +.It Sy __STDC_CONSTANT_MACROS Ta +.El +.Ss Convenience Macros +These macros make it easier to do a number of things, even though strictly +speaking the standard places their normal form in another header. +.Bl -column "---------------" +.It Sy Macro Ta Sy Description +.It Sy __offsetof(type,field) Ta +.It Sy __rangeof(type,start,end) Ta +.It Sy __containerof(x,s,m) Ta +.El +.Ss ID Strings +This section is deprecated, but is kept around because too much contrib software +still uses these. +.Bl -column "---------------" +.It Sy Macro Ta Sy Description +.It Sy __IDSTRING(name,string) Ta +.It Sy __FBSDID(s) Ta +.It Sy __RCSID(s) Ta +.It Sy __RCSID_SOURCE(s) Ta +.It Sy __SCCSID(s) Ta +.It Sy __COPYRIGHT(s) Ta +.El +.Sh Supported C Environments +.Fx +supports a number C standard environments. +Selection of the language dialect is a compiler-dependent command line option, +though it is usually +.Fl cstd=XX +where XX is the standard to set for compiling, such as c89 or c23. +.Fx +provides a number of selection macros to control visibility of symbols. +Please see the section on Selection Macros for the specifics. +.Pp +.Bl -tag +.It K \*(Am R +Pre-ANSI Kernighan and Ritchie C. +Sometimes called +.Dq knr +or +.Dq C78 +to distinguish it from newer standards. +Support for this compilation environment is dependent on compilers supporting +this configuration. +Most of the old forms of C have been deprecated or removed in +ISO/IEC 9899:2024 (“ISO C23”). +Compilers make compiling in this mode increasingly difficult and support for it +may ultimately be removed from the tree. +.It St -ansiC +.Dv __STDC__ +is defined, however +.Dv __STDC_VERSION__ +is not. +.Pp +Strict environment selected with +.Dv _ANSI_SOURCE . +.It St -isoC-99 +.Dv __STDC_VERSION__ = 199901L +.Pp +Strict environment selected with +.Dv _C99_SOURCE . +.It St -isoC-2011 +.Dv __STDC_VERSION__ = 201112L +.Pp +Strict environment selected with +.Dv _C11_SOURCE . +.It ISO/IEC 9899:2018 (“ISO C17”) +.Dv __STDC_VERSION__ = 201710L +.Pp +Strict environment selected with +.Dv _C11_SOURCE +since there are no new C17 only symbols or macros. +.Pp +This version of the standard did not introduce any new features, only made +minor, technical corrections. +.It ISO/IEC 9899:2024 (“ISO C23”) +.Dv __STDC_VERSION__ = 202311L +Strict environment selected with +.Dv _C23_SOURCE +though this is not yet implemented. +.El +.Pp +For more information on C standards, see +.Xr c 7 . +.Ss Programming Environment Selection Macros +Defining the macros outlined below requests that the system header files provide +only the functions, structures and macros (symbols) defined by the appropriate +standard, while suppressing all extensions. +However, system headers not defined by that standard may define extensions. +.Bl -column "---------------" +.It Sy Macro Ta Sy Environment +.It Dv _POSIX_SOURCE Ta St -p1003.1-88 including St -ansiC +.It Dv _POSIX_C_SOURCE = 1 Ta St -p1003.1-88 including St -ansiC +.It Dv _POSIX_C_SOURCE = 2 Ta St -p1003.1-90 including St -ansiC +.It Dv _POSIX_C_SOURCE = 199309 Ta St -p1003.1b-93 including St -ansiC +.It Dv _POSIX_C_SOURCE = 199506 Ta St -p1003.1c-95 including St -ansiC +.It Dv _POSIX_C_SOURCE = 200112 Ta St -p1003.1-2001 including St -isoC-99 +.It Dv _POSIX_C_SOURCE = 200809 Ta St -p1003.1-2008 including St -isoC-99 +.It Dv _POSIX_C_SOURCE = 202405 Ta in the future IEEE Std 1003.1-2024 (“POSIX.1”) including ISO/IEC 9899:2024 (“ISO C23”) +.It Dv _XOPEN_SOURCE = 500 Ta St -p1003.1c-95 and XPG extensions to St -susv2 including St -ansiC +.It Dv _XOPEN_SOURCE = 600 Ta St -p1003.1-2001 and XPG extensions to St -susv3 including St -isoC-99 +.It Dv _XOPEN_SOURCE = 700 Ta St -p1003.1-2008 and XPG extensions to St -susv4 including St -isoC-99 +.It Dv _XOPEN_SOURCE = 800 Ta in the future IEEE Std 1003.1-2024 (“POSIX.1”) and XPG extensions to Version 5 of the Single UNIX Specification (“SUSv5”) including ISO/IEC 9899:2024 (“ISO C23”) +.It Dv _ANSI_SOURCE Ta St -ansiC +.It Dv _C99_SOURCE Ta St -isoC-99 +.It Dv _C11_SOURCE Ta St -isoC-2011 +.It Dv _C23_SOURCE Ta in the future ISO/IEC 9899:2024 (“ISO C23”) +.It Dv _BSD_SOURCE Ta Everything, including Fx extensions +.El +.Pp +When both POSIX and C environments are selected, the POSIX environment selects +which C environment is used. +However, when C11 dialect is selected with +.St -p1003.1-2008 , +definitions for +.St -isoC-11 +are included. +.Ss Header Visibility Macros +These macros are set by +.Nm +to control the visibility of different standards. +Users should not use these, but they are documented here for developers. +.Bl -column "---------------" +.It Dv __XSI_VISIBLE Ta Restricts the visibility of XOPEN Single Unix Standard version. +Possible values are 500, 600, 700 or 800, corresponding to Issue 5, 6, 7, or 8 +of the Single Unix Standard. +These are extra functions in addition to the normal POSIX ones. +.It Dv __POSIX_VISIBLE Ta Make symbols associated with certain standards versions visible. +Set to the value assigned to +.Dv _POSIX_C_SOURCE +by convention with 199009 for +.St -p1003.1-88 +and 199209 +.St -p1003.1-90 . +.It Dv __ISO_C_VISIBLE Ta The C level that's visible. +Possible values include 1990, 1999, and 2011 for +.St -isoC-90 , +.St -isoC-99 +and +.St -isoC-2011 +respectively. +In the future, 2023 will be used for ISO C2023. +.It Dv __BSD_VISIBLE Ta 1 if the +.Fx +extensions are visible, 0 otherwise. +.It Dv __EXT1_VISIBLE Ta 1 if the +.St -isoC-2011 +Appendix K 3.7.4.1 +extensions are visible, 0 otherwise. +.Sh HISTORY +.In sys/cdefs.h +first appeared in +.Bx 4.3 NET/2 . From nobody Mon Jul 8 23:31:39 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJ0kg5PlLz5Qsc3; Mon, 08 Jul 2024 23:31: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJ0kg4qZRz3xXd; Mon, 8 Jul 2024 23:31:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720481499; 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=Quzdsx6niI7Mru3Na+Kj1LLIuLckvOmIcUl6TFZYzv4=; b=amXv+4iKlZscIhw3diz9Jh+VcDMfZVbLCq8yG5aeTUMw/oW+XGOwqpCv0KGwuOfJ1lTR27 8GXa/tZDs97tXWdSVECXiRwqz6YyyXYt7L7mPpkLYCqw2t1hB3uw+Az6Ue55OPtUGvWZsS Rjmp+jZo/VvuDH9vQnP7T1AZ7PLwW+tXNrewjgX/QVQVxI6WvPQeITOSl9/xgKc3hM/TR8 auvlKvsAOWS4AykpUmKHsE6cpU6+YiQePOrwxx4dZ4KihbGI7e0nSGQ3HkApVPFhi+6ZnR I8vwTFRVeuOL8qr+8XhTzPVlHOCyoXGUge4YZZEtodsvSiHTkk9inug1JjAeXQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720481499; a=rsa-sha256; cv=none; b=uwJgAc3WDfYFY0sJpi3mYV2zjxC5AjPZLtxc8P/F5QxJ//XeZyf3J3LI5I+hsXMusT2omE R2m6c5BHHOilu+rhaWqUKVvQgBS8HZXo3V+bJIj87Lf3kyAJBc+ESLK5GwAsoOuJMbOfKH nRnY+412mYXr7O8C2eED3D8GggLjPkeaBO226Lm6EYVUyCU6nidzwEudKB67H0IlbMbb/Y TrJH2ip7l3v+kA1h/H110CEJbUbYiGxa8CpXpf79Z45O8h0wEFjlWDyptI4b/t2I5CAnPv S5i2GW4DDDIDh1IzozOE/UGvMXf+hWJgqY6l4bsFyfcZ0sIO11CLIt6xcm+c9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720481499; 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=Quzdsx6niI7Mru3Na+Kj1LLIuLckvOmIcUl6TFZYzv4=; b=O1vA9dHYL2Ed8Z5mQGAFtkrZPkbruGc1tdp6kaSMwGbPbXN9g8OZJe4ASkNduRy2g8FxLu HaRch5HD1rI48tVYC74A4e1o1EaOIm21Ru6XvDt1f18A2fFIGBHVMJO5IBR428ZuJzqOcq t/0EFALEE1Wrml8TMY27ekXPNf0zo9e6rCRvWBx1E/tKRfMkSUwPcXtaix/j32gomZcgAG CIP+ltXhu3v4GlI+V9ww7xrhYibz8nNPUllFFBN2EYOiuKeKX77Rdhv1glN/Zc4gP4MnFZ ThtkXRXNmGYx6TzUosvoQjJ07NxmY+pvjVGD3C/Q2xV2R942IRav4Z9+pWvRUQ== 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 4WJ0kg4QFzz19wC; Mon, 8 Jul 2024 23:31: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 468NVdIp031254; Mon, 8 Jul 2024 23:31:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468NVd2X031251; Mon, 8 Jul 2024 23:31:39 GMT (envelope-from git) Date: Mon, 8 Jul 2024 23:31:39 GMT Message-Id: <202407082331.468NVd2X031251@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 3b68c491d371 - main - efi_console: Stay inline with the UEFI spec List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b68c491d37196bb76a95bce3c02f7c6d5ba22fd Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3b68c491d37196bb76a95bce3c02f7c6d5ba22fd commit 3b68c491d37196bb76a95bce3c02f7c6d5ba22fd Author: Ahmad Khalifa AuthorDate: 2024-06-13 23:17:25 +0000 Commit: Warner Losh CommitDate: 2024-07-08 23:29:32 +0000 efi_console: Stay inline with the UEFI spec The UEFI spec states that the minimum garunteed terminal resolution is 80x25. Signed-off-by: Ahmad Khalifa Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1292 --- stand/efi/libefi/efi_console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/efi/libefi/efi_console.c b/stand/efi/libefi/efi_console.c index 2e28cf1ec460..5813e2d20aef 100644 --- a/stand/efi/libefi/efi_console.c +++ b/stand/efi/libefi/efi_console.c @@ -63,7 +63,7 @@ void HO(void); void end_term(void); #endif -#define TEXT_ROWS 24 +#define TEXT_ROWS 25 #define TEXT_COLS 80 static tf_bell_t efi_cons_bell; From nobody Mon Jul 8 23:31:40 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJ0kj00Gzz5QsSk; Mon, 08 Jul 2024 23:31: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJ0kh5sSPz3xVC; Mon, 8 Jul 2024 23:31:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720481500; 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=c25F4TZ6sE/DQiMV22r7Up2d2cn6bWy8AW+IqPyGKg0=; b=AzZ5i36f74rzGr1oajhfeNxZ+wy0GpLhWm4h81JcRPGxtLogtMAqP3mRw1UAW0/wivUk24 qzcIMg7ez8IR6LQTKMhsnbU3dP33NiroirUuJqfOb5WnlwpenVwX9N2s8eENI3U1/U799X ydp20KJtLthN4vZZgMOgrbMtKyYN5vrHapvDes7kMWYBfrdUdK+vFhJhtfpM6WnmsngB1h GQFCRET3d/dFQdP578iW82IXs591rwwVv4/P3m9Vz5aeFv+CumHGk0cboEjrDPnv+zM3Q5 7iaMmqpUqASlpF6VQbkj+cZfuN69mEGKkr2ueHQoCT8bUZ3UGp654appm8Dz9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720481500; a=rsa-sha256; cv=none; b=cbLYzy/3ZI1MNfgPhvaLAjnLHXMhEW7Q0ZjAR3ovzSo4eXXteOH9g0P1nF6o1y1jbLgp3x 5MDVd5n6ajduiga3HQX0Gwi0c94YqFm1xEONffhO3d/ivsKIxxkBg40NaYLpA/JrKFYdVA L0Lkv+uKs6QM6bOFaYoSkQOcRM/mIPU/CKENnY5rVlFjfakdBM0YsR81eB9VO+F4DzRCeu WvZFalHcMASAYNDq5iPNcHZCrQfPCPj5af2KBmdWRhoKW6QqgqwKRRjtdhcAsDWGxodrMn WPH/aOOsiqRlGWuzq5xE/0agXNuGMUWmTfLmLE7kESyHekp6XD6ZUDg9cziWRQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720481500; 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=c25F4TZ6sE/DQiMV22r7Up2d2cn6bWy8AW+IqPyGKg0=; b=SdSUtwcfkzTwPW/44DGcjX/9gISenwBRDrRKjKYJm5t0Owwc1yDMbfO+SLcySn2l20v3gH Fl6xTaWoET/NMtWNkoZNuM5gb+orUsCsyxoQ9tzQZWWduBYcrpoE/8oli8dCiEIVj57ERI 3H4pQkTQNpc4jEkdBpz1DUQBXUzSpEIGbbvq1H3oKul+OvZrWp2LTDHduiDCq7kbGyhEcI QqqLDr6+2EfAMOocqs4cri6RF6YNhhvb82qB8MJqN+OO0ZM/5IJWJ2KE2OmIM/kbnZvACt rt4QNtjBuQRYc3US9oKgLnO6xGms1lCznFiXCi0OHZpkJVLAb6l4CBZW3SS73g== 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 4WJ0kh5Pwtz19nP; Mon, 8 Jul 2024 23:31: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 468NVen8031299; Mon, 8 Jul 2024 23:31:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468NVe4C031296; Mon, 8 Jul 2024 23:31:40 GMT (envelope-from git) Date: Mon, 8 Jul 2024 23:31:40 GMT Message-Id: <202407082331.468NVe4C031296@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 1dbbce974450 - main - loader.conf.5: Correct terminal size List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1dbbce9744500f2fa4d6ca5ec888835c0f7b9161 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1dbbce9744500f2fa4d6ca5ec888835c0f7b9161 commit 1dbbce9744500f2fa4d6ca5ec888835c0f7b9161 Author: Ahmad Khalifa AuthorDate: 2024-06-14 00:17:59 +0000 Commit: Warner Losh CommitDate: 2024-07-08 23:31:02 +0000 loader.conf.5: Correct terminal size Signed-off-by: Ahmad Khalifa Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1292 --- stand/defaults/loader.conf.5 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5 index e38ad865c288..a67edd93929d 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 February 2, 2024 +.Dd July 8, 2024 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -331,8 +331,8 @@ replacing it with character (useful for embedded products and such). .It Va screen.font Set font size for framebuffer mode. -Default font size is selected based on screen resolution, to achieve -terminal dimensions 80x24. +The default font size is selected based on screen resolution. +Note that the terminal's size may vary. .It Va screen.textmode Value .Dq 0 From nobody Mon Jul 8 23:39:27 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJ0vh1VJRz5Qt7d; Mon, 08 Jul 2024 23:39:28 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJ0vh10QRz40WN; Mon, 8 Jul 2024 23:39:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720481968; 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=AyxgsMUO9aPhQ207YXNj1zY7MjBXX9mlc5I55rTprzI=; b=kckh2/tua3ksXKOpZkrSfnxt7iJYyTuN60f+gPSfoPyiAuDAndDCeVn89DsFOQcv7WWZDV jsXn+q7hSCn5j4ZnYqpHmzfQzJp/Xd57mNAKkhdpzapd5u7t58EgiFJK/nFwXa/2P23OFc VVhTvGDGLC3DriurZDCa8td+A5R3nvQu2wr9rgD774aar/335+eKkF5brEPtMe1tBJhBfP E1UuUJF+l6JP/GzIrcdYRcvgFXkUowWiGaIWh08IboR3d1sni18reR/T4qRIKyGr6iGX5B e5JNXfaIbrcAXGgUckbjYZvdCF6HHyP9qo+RCiIvityal+kaTcPvS1prphFE1A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720481968; a=rsa-sha256; cv=none; b=JzQr4QRV8TfcJUngvZtGuyjD8Iwv4RhCCq8lxG49g7shcHuBqNgfgh3+42wPhDeh9PQN1C 3KTjfUSQ2SltK+wl51ncBBK0bDk6Ey+UkgYehZyDUDVJzL9EU2caDGLZOsACobXu067oUz aqXFP3RHwCcCsGeUoPtIpEK/v57YHeVK/9/dleHAj1V1XbOOWVgwh28BCG1Q19ZIrsHr/p X97U/xp3jykGpq9lR7jYRbxB1wbDsKXc4X9qedFWQiszjq1PdKYq69FdB8M6LAX5esZVui OSs8cLbQQU3qZYmhFMYN+xMJTQyMK6JwgmYmAeWk436+5cx6yNwsMyQhdcJlGg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720481968; 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=AyxgsMUO9aPhQ207YXNj1zY7MjBXX9mlc5I55rTprzI=; b=ISsnh8oM4Yelv49DKi+8292Y9UyGbBfcNiROEPnRYvRgF4K+5L+pz9TJHHsxMm7Lkz9uwv yX1C0rx09sP29bo8SPeMcfBKNqWCZIGOsFxfBJg2+k4Sm9cX7piM3PkVPQbTj7Lc9OqQDm EG1DP6SLNuD3k0fufx+oaodsvTZHegyE4lDy8icoJ1w6otDsfbUEs/eGqIMFYMTk2yxoZH BMD2AQoY+eMqwxTjF+OjMRr+o+APJa0ZU4oiHTAh/PMxmqZMvD0VUfDa9czL1OUlf9dhG5 5fl9mBcYZM/fzrbR3A5mdAruyvkKVrGeiST1zsIwv0If3gckUpstYNcdkN3KDw== 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 4WJ0vh0Szzz1B6R; Mon, 8 Jul 2024 23:39:28 +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 468NdRvE033640; Mon, 8 Jul 2024 23:39:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 468NdRmZ033637; Mon, 8 Jul 2024 23:39:27 GMT (envelope-from git) Date: Mon, 8 Jul 2024 23:39:27 GMT Message-Id: <202407082339.468NdRmZ033637@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 53734ccd4261 - main - Potential typo/copy issue List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 53734ccd42614e48ae227f88161af89c807cdbcf Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=53734ccd42614e48ae227f88161af89c807cdbcf commit 53734ccd42614e48ae227f88161af89c807cdbcf Author: Ted Spence AuthorDate: 2024-07-05 04:22:42 +0000 Commit: Warner Losh CommitDate: 2024-07-08 23:36:03 +0000 Potential typo/copy issue This test here appears to be clamping the start and stop values to a minimum and maximum. But it looks like one of these lines may have been copied incorrectly. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1317 --- sys/dev/cxgb/cxgb_sge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/cxgb/cxgb_sge.c b/sys/dev/cxgb/cxgb_sge.c index a2b3918032bb..1b82f2ebcaae 100644 --- a/sys/dev/cxgb/cxgb_sge.c +++ b/sys/dev/cxgb/cxgb_sge.c @@ -266,7 +266,7 @@ check_pkt_coalesce(struct sge_qset *qs) if (cxgb_tx_coalesce_enable_start > COALESCE_START_MAX) cxgb_tx_coalesce_enable_start = COALESCE_START_MAX; if (cxgb_tx_coalesce_enable_stop < COALESCE_STOP_MIN) - cxgb_tx_coalesce_enable_start = COALESCE_STOP_MIN; + cxgb_tx_coalesce_enable_stop = COALESCE_STOP_MIN; /* * if the hardware transmit queue is more than 1/8 full * we mark it as coalescing - we drop back from coalescing From nobody Tue Jul 9 05:52:22 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJ99z5s4pz5Pqp9; Tue, 09 Jul 2024 05:52: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJ99z4tTVz4YGn; Tue, 9 Jul 2024 05:52:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720504343; 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=O4cJFPKcfiypoKVpkigKobcoXES6s0sZmUIeXmdkAkQ=; b=DeGw4BRonpXdvYLdiStG6AIGyILA7GuAnqeswjIEmKLArWCEWXaB1wpQ/okRN9AgI0kfoC dELCB9ADO/rP5xFeXb54QnBTXpN8YviyjGKA1Zzoq7+y8TOab8nvBCgP8BP1oG5xuvckVD qoLS9zDr1A52u10kMlim5e+Q5Snyy318PRy160yV759nVahEtup+f493otFNtpB6qDrdim d2hcxWvsxCUvB+cyznU0FjaPo5Gs7S2imiD+efrU8YCYts/q+8Uj5wf6JRVWWOXDLuRRhy arq/V8Y5A/dYgnFyPy3qf1Em2n3wuJNl2gECVj8Pu1Ug+3nGgZ/SWLsrqbTeXA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720504343; a=rsa-sha256; cv=none; b=WfdltTYEBB0DbYpSetf0nTsGx0SQMt4JiACVmoLY4nRbJPUfED3TC2QbuyEJkLwTVu2pCj Pelv/nB76iKh7iuHBRlffcUOB3/Rnd+J/pMVFCWVmfRtMzYSIij6YyvDWs9hLkedqmMmF7 Vox/VXq5Q29Yf8mALKuB2JOEwy9IOXL2DColAMkGspg4czYenq7brtqwpI6VQAEfKXVHwN ixmxVKp87Ozau87mRpHul7/RthUhSGKNNlbEXXuJ2IOymxIVoRDtUMDwpAosTrJjNpSYwU gh3ywbUXl/GLWfOjfzLGx/XKPl/tgb5X893/vctLL7WbWncIazvxqMs/muWw7w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720504343; 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=O4cJFPKcfiypoKVpkigKobcoXES6s0sZmUIeXmdkAkQ=; b=GZv0f513uwOD/iAOxgmIma4VgZoVhZqpTO2uT8GhpWRsQc5bsAY41w5+6fBgOb/fjCYfnV D5onm8/xDtd2i2GcEIu/D5sLq9+z7yrqg3JlkHoW9ZicnixeeJKqED3SfM2uLMfvsWrwBk JEJe4e/wRPNGrS8fQtdJn/7JRHXTozobUCNoXBqm3uqqCOGbusaaJjQAJT90vqUI9fRfHn 1/MxFHINsOttdu0D7eqpbXAeTWjVkIbzfoIdosn+sqcJCqqjADQjhVpSKNHMnjtxOhtTHo QrAObcmXMmkPop0JpynPeDhh0XUNZZDATYv2JJ0MXvROfXtBlawpQ4E9XsIIdQ== 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 4WJ99z4TrJzNDc; Tue, 9 Jul 2024 05:52: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 4695qMof077721; Tue, 9 Jul 2024 05:52:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4695qMgj077718; Tue, 9 Jul 2024 05:52:22 GMT (envelope-from git) Date: Tue, 9 Jul 2024 05:52:22 GMT Message-Id: <202407090552.4695qMgj077718@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Stefan =?utf-8?Q?E=C3=9Fer?= Subject: git: a970610a3af6 - main - contrib/bc: upgrade to version 6.7.6 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a970610a3af63b3f4df5b69d91c6b4093a00ed8f Auto-Submitted: auto-generated The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=a970610a3af63b3f4df5b69d91c6b4093a00ed8f commit a970610a3af63b3f4df5b69d91c6b4093a00ed8f Author: Stefan Eßer AuthorDate: 2024-07-09 05:49:27 +0000 Commit: Stefan Eßer CommitDate: 2024-07-09 05:49:27 +0000 contrib/bc: upgrade to version 6.7.6 This update fixes a potential issue when flushing stdout on exit fails: longjmp could use an uninitialized target address variable. Most files are included in this commit due to a changed date in the copyright note. (cherry picked from commit 52a5ec1b178fd07651446c7e31b1512794a04dbf) MFC after: 3 days --- contrib/bc/LICENSE.md | 4 +- contrib/bc/MEMORY_BUGS.md | 7 + contrib/bc/Makefile.in | 2 +- contrib/bc/NEWS.md | 7 + contrib/bc/NOTICE.md | 2 +- contrib/bc/README.md | 6 +- contrib/bc/compile_flags.txt | 15 + contrib/bc/configure.sh | 20 +- contrib/bc/gen/bc_help.txt | 2 +- contrib/bc/gen/dc_help.txt | 2 +- contrib/bc/gen/lib.bc | 2 +- contrib/bc/gen/lib2.bc | 2 +- contrib/bc/gen/strgen.c | 4 +- contrib/bc/gen/strgen.sh | 4 +- contrib/bc/include/args.h | 2 +- contrib/bc/include/bc.h | 21 +- contrib/bc/include/bcl.h | 2 +- contrib/bc/include/dc.h | 5 +- contrib/bc/include/file.h | 26 +- contrib/bc/include/history.h | 2 +- contrib/bc/include/lang.h | 2 +- contrib/bc/include/lex.h | 2 +- contrib/bc/include/library.h | 2 +- contrib/bc/include/num.h | 2 +- contrib/bc/include/opt.h | 2 +- contrib/bc/include/parse.h | 2 +- contrib/bc/include/program.h | 2 +- contrib/bc/include/rand.h | 7 +- contrib/bc/include/read.h | 2 +- contrib/bc/include/status.h | 6 +- contrib/bc/include/vector.h | 2 +- contrib/bc/include/version.h | 4 +- contrib/bc/include/vm.h | 12 +- contrib/bc/locales/de_DE.ISO8859-1.msg | 2 +- contrib/bc/locales/de_DE.UTF-8.msg | 2 +- contrib/bc/locales/en_US.msg | 2 +- contrib/bc/locales/es_ES.ISO8859-1.msg | 2 +- contrib/bc/locales/es_ES.UTF-8.msg | 2 +- contrib/bc/locales/fr_FR.ISO8859-1.msg | 2 +- contrib/bc/locales/fr_FR.UTF-8.msg | 2 +- contrib/bc/locales/ja_JP.UTF-8.msg | 2 +- contrib/bc/locales/ja_JP.eucJP.msg | 2 +- contrib/bc/locales/nl_NL.ISO8859-1.msg | 2 +- contrib/bc/locales/nl_NL.UTF-8.msg | 2 +- contrib/bc/locales/pl_PL.ISO8859-2.msg | 2 +- contrib/bc/locales/pl_PL.UTF-8.msg | 2 +- contrib/bc/locales/pt_PT.ISO8859-1.msg | 2 +- contrib/bc/locales/pt_PT.UTF-8.msg | 2 +- contrib/bc/locales/ru_RU.CP1251.msg | 2 +- contrib/bc/locales/ru_RU.CP866.msg | 2 +- contrib/bc/locales/ru_RU.ISO8859-5.msg | 2 +- contrib/bc/locales/ru_RU.KOI8-R.msg | 2 +- contrib/bc/locales/ru_RU.UTF-8.msg | 2 +- contrib/bc/locales/zh_CN.GB18030.msg | 2 +- contrib/bc/locales/zh_CN.GB2312.msg | 2 +- contrib/bc/locales/zh_CN.GBK.msg | 2 +- contrib/bc/locales/zh_CN.UTF-8.msg | 2 +- contrib/bc/locales/zh_CN.eucCN.msg | 2 +- contrib/bc/manuals/bc/A.1 | 681 +++++++++++++++++---------------- contrib/bc/manuals/bc/A.1.md | 5 +- contrib/bc/manuals/bc/E.1 | 482 +++++++++++------------ contrib/bc/manuals/bc/E.1.md | 5 +- contrib/bc/manuals/bc/EH.1 | 474 ++++++++++++----------- contrib/bc/manuals/bc/EH.1.md | 5 +- contrib/bc/manuals/bc/EHN.1 | 474 ++++++++++++----------- contrib/bc/manuals/bc/EHN.1.md | 5 +- contrib/bc/manuals/bc/EN.1 | 482 +++++++++++------------ contrib/bc/manuals/bc/EN.1.md | 5 +- contrib/bc/manuals/bc/H.1 | 673 ++++++++++++++++---------------- contrib/bc/manuals/bc/H.1.md | 5 +- contrib/bc/manuals/bc/HN.1 | 673 ++++++++++++++++---------------- contrib/bc/manuals/bc/HN.1.md | 5 +- contrib/bc/manuals/bc/N.1 | 681 +++++++++++++++++---------------- contrib/bc/manuals/bc/N.1.md | 5 +- contrib/bc/manuals/bcl.3 | 95 ++--- contrib/bc/manuals/bcl.3.md | 2 +- contrib/bc/manuals/dc/A.1 | 478 +++++++++++------------ contrib/bc/manuals/dc/A.1.md | 2 +- contrib/bc/manuals/dc/E.1 | 376 +++++++++--------- contrib/bc/manuals/dc/E.1.md | 2 +- contrib/bc/manuals/dc/EH.1 | 368 +++++++++--------- contrib/bc/manuals/dc/EH.1.md | 2 +- contrib/bc/manuals/dc/EHN.1 | 368 +++++++++--------- contrib/bc/manuals/dc/EHN.1.md | 2 +- contrib/bc/manuals/dc/EN.1 | 376 +++++++++--------- contrib/bc/manuals/dc/EN.1.md | 2 +- contrib/bc/manuals/dc/H.1 | 470 ++++++++++++----------- contrib/bc/manuals/dc/H.1.md | 2 +- contrib/bc/manuals/dc/HN.1 | 470 ++++++++++++----------- contrib/bc/manuals/dc/HN.1.md | 2 +- contrib/bc/manuals/dc/N.1 | 478 +++++++++++------------ contrib/bc/manuals/dc/N.1.md | 2 +- contrib/bc/scripts/exec-install.sh | 2 +- contrib/bc/scripts/format.sh | 2 +- contrib/bc/scripts/functions.sh | 2 +- contrib/bc/scripts/karatsuba.py | 2 +- contrib/bc/scripts/link.sh | 2 +- contrib/bc/scripts/lint.sh | 2 +- contrib/bc/scripts/locale_install.sh | 2 +- contrib/bc/scripts/locale_uninstall.sh | 2 +- contrib/bc/scripts/sqrt_frac_guess.bc | 2 +- contrib/bc/scripts/sqrt_int_guess.bc | 2 +- contrib/bc/scripts/sqrt_random.bc | 2 +- contrib/bc/scripts/sqrt_random.sh | 2 +- contrib/bc/src/args.c | 2 +- contrib/bc/src/bc.c | 6 +- contrib/bc/src/bc_lex.c | 2 +- contrib/bc/src/bc_parse.c | 2 +- contrib/bc/src/data.c | 4 +- contrib/bc/src/dc.c | 6 +- contrib/bc/src/dc_lex.c | 2 +- contrib/bc/src/dc_parse.c | 2 +- contrib/bc/src/file.c | 34 +- contrib/bc/src/history.c | 2 +- contrib/bc/src/lang.c | 2 +- contrib/bc/src/lex.c | 2 +- contrib/bc/src/library.c | 2 +- contrib/bc/src/main.c | 16 +- contrib/bc/src/num.c | 76 +++- contrib/bc/src/opt.c | 2 +- contrib/bc/src/parse.c | 2 +- contrib/bc/src/program.c | 2 +- contrib/bc/src/rand.c | 2 +- contrib/bc/src/read.c | 2 +- contrib/bc/src/vector.c | 2 +- contrib/bc/src/vm.c | 62 ++- contrib/bc/tests/all.sh | 2 +- contrib/bc/tests/bc/timeconst.sh | 2 +- contrib/bc/tests/bcl.c | 2 +- contrib/bc/tests/dc/scripts/easter.sh | 2 +- contrib/bc/tests/error.sh | 2 +- contrib/bc/tests/errors.sh | 2 +- contrib/bc/tests/history.py | 6 +- contrib/bc/tests/history.sh | 2 +- contrib/bc/tests/other.sh | 6 +- contrib/bc/tests/read.sh | 2 +- contrib/bc/tests/script.sh | 2 +- contrib/bc/tests/scripts.sh | 2 +- contrib/bc/tests/stdin.sh | 2 +- contrib/bc/tests/test.sh | 2 +- 140 files changed, 4449 insertions(+), 4236 deletions(-) diff --git a/contrib/bc/LICENSE.md b/contrib/bc/LICENSE.md index 74441065df35..c8f6758e6d4b 100644 --- a/contrib/bc/LICENSE.md +++ b/contrib/bc/LICENSE.md @@ -1,6 +1,6 @@ # License -Copyright (c) 2018-2023 Gavin D. Howard +Copyright (c) 2018-2024 Gavin D. Howard Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -60,7 +60,7 @@ The files `src/rand.c` and `include/rand.h` are under the following copyrights and license: Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors
-Copyright (c) 2018-2023 Gavin D. Howard +Copyright (c) 2018-2024 Gavin D. Howard Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/contrib/bc/MEMORY_BUGS.md b/contrib/bc/MEMORY_BUGS.md index 12e0b854e9d8..2e41ad3d75c9 100644 --- a/contrib/bc/MEMORY_BUGS.md +++ b/contrib/bc/MEMORY_BUGS.md @@ -23,6 +23,13 @@ existed in. The first version without this bug is `6.0.2`. +* In versions `3.0.0` until `6.7.5` (inclusive) of `bc` and `dc`, there is a + possible out-of-bounds read when there is an error flushing `stdout` on exit + because such an error would cause `bc` and `dc` to attempt to use a `jmp_buf` + when none exists. + + The first version without this bug is `6.7.6`. + * In versions `5.0.0` until `6.0.4` (inclusive) of `bc`, there is an out-of-bounds access if a non-local (non-`auto`) variable is set to a string with `asciify()`, then the function is redefined with a use of the same diff --git a/contrib/bc/Makefile.in b/contrib/bc/Makefile.in index e1309cd6d6b3..4adb76ddaa17 100644 --- a/contrib/bc/Makefile.in +++ b/contrib/bc/Makefile.in @@ -1,7 +1,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2023 Gavin D. Howard and contributors. +# Copyright (c) 2018-2024 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md index 32e74de31231..95de7e5182c4 100644 --- a/contrib/bc/NEWS.md +++ b/contrib/bc/NEWS.md @@ -1,5 +1,12 @@ # News +## 6.7.6 + +This is a production release to fix one bug. + +The bug was that `bc` attempted to jump out when flushing `stdout` on exit, but +there is no jump buf at that point. + ## 6.7.5 This is a production release to fix one small bug. diff --git a/contrib/bc/NOTICE.md b/contrib/bc/NOTICE.md index c0d3ded5797a..35536b2c27d7 100644 --- a/contrib/bc/NOTICE.md +++ b/contrib/bc/NOTICE.md @@ -1,6 +1,6 @@ # Notice -Copyright 2018-2023 Gavin D. Howard and contributors. +Copyright 2018-2024 Gavin D. Howard and contributors. ## Contributors diff --git a/contrib/bc/README.md b/contrib/bc/README.md index 943ca89eee2c..696e6186b8bd 100644 --- a/contrib/bc/README.md +++ b/contrib/bc/README.md @@ -48,7 +48,7 @@ POSIX-compatible systems that are known to work: * FreeBSD * OpenBSD * NetBSD -* Mac OSX +* macOS * Solaris* (as long as the Solaris version supports POSIX 2008) * AIX * HP-UX* (except for history) @@ -347,6 +347,8 @@ that is because it is more robust. See the [benchmarks][19]. Below is a non-comprehensive list of extensions that this `bc` and `dc` have that all others do not. +* **The `!` operator has higher precedence than the `!` operator in other `bc` + implementations.** * An extended math library. (See [here][30] for more information.) * A command-line prompt. * Turning on and off digit clamping. (Digit clamping is about how to treat @@ -427,7 +429,7 @@ Other projects based on this bc are: * [FreeBSD `bc`][23]. While the `bc` in FreeBSD is kept up-to-date, it is better to [report bugs there][24], as well as [submit patches][25], and the maintainers of the package will contact me if necessary. -* [Mac OSX `bc`][35]. Any bugs in that `bc` should be reported to me, but do +* [macOS `bc`][35]. Any bugs in that `bc` should be reported to me, but do expect bugs because the version is old. * [Android Open Source `bc`][32]. Any bugs in that `bc` can be reported here. diff --git a/contrib/bc/compile_flags.txt b/contrib/bc/compile_flags.txt new file mode 100644 index 000000000000..7a08c87f3876 --- /dev/null +++ b/contrib/bc/compile_flags.txt @@ -0,0 +1,15 @@ +-Weverything +-pedantic +-Wno-unsafe-buffer-usage +-D_POSIX_C_SOURCE=200809L +-D_XOPEN_SOURCE=700 +-D_BSD_SOURCE +-D_GNU_SOURCE +-D_DEFAULT_SOURCE +-Iinclude/ +-DBC_DEBUG=1 +-DBC_ENABLED=1 +-DDC_ENABLED=1 +-DBC_ENABLE_EXTRA_MATH=1 +-DBC_ENABLE_HISTORY=1 +-DBC_ENABLE_NLS=1 diff --git a/contrib/bc/configure.sh b/contrib/bc/configure.sh index 9292f094bb17..43bb502ea817 100755 --- a/contrib/bc/configure.sh +++ b/contrib/bc/configure.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2023 Gavin D. Howard and contributors. +# Copyright (c) 2018-2024 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -127,7 +127,7 @@ usage() { printf ' If this option is given along with -e and -r, the last occurrence of\n' printf ' all of the three is used.\n' printf ' -k KARATSUBA_LEN, --karatsuba-len KARATSUBA_LEN\n' - printf ' Set the karatsuba length to KARATSUBA_LEN (default is 64).\n' + printf ' Set the karatsuba length to KARATSUBA_LEN (default is 32).\n' printf ' It is an error if KARATSUBA_LEN is not a number or is less than 16.\n' printf ' -l, --install-all-locales\n' printf ' Installs all locales, regardless of how many are on the system. This\n' @@ -163,7 +163,7 @@ usage() { printf ' Enable the use of libreadline/readline. This is meant for those users\n' printf ' that want vi-like or Emacs-like behavior in history. This option is\n' printf ' ignored if history is disabled. If this option is given along with -e\n' - printf ' and -r, the last occurrence of all of the three is used.\n' + printf ' and -i, the last occurrence of all of the three is used.\n' printf ' -s SETTING, --set-default-on SETTING\n' printf ' Set the default named by SETTING to on. See below for possible values\n' printf ' for SETTING. For multiple instances of the -s or -S for the the same\n' @@ -1671,10 +1671,10 @@ else CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700" fi -# Test Mac OSX. This is not in an if statement because regardless of whatever -# the user says, we need to know if we are on Mac OSX. If we are, we have to set +# Test macOS. This is not in an if statement because regardless of whatever the +# user says, we need to know if we are on macOS. If we are, we have to set # _DARWIN_C_SOURCE. -printf 'Testing for Mac OSX...\n' +printf 'Testing for macOS...\n' flags="-DBC_TEST_APPLE -DBC_ENABLE_AFL=0" "$CC" $CPPFLAGS $CFLAGS $flags "-I$scriptdir/include" -E "$scriptdir/src/vm.c" > /dev/null 2>&1 @@ -1682,15 +1682,15 @@ flags="-DBC_TEST_APPLE -DBC_ENABLE_AFL=0" err="$?" if [ "$err" -ne 0 ]; then - printf 'On Mac OSX. Using _DARWIN_C_SOURCE.\n\n' + printf 'On macOS. Using _DARWIN_C_SOURCE.\n\n' apple="-D_DARWIN_C_SOURCE" else - printf 'Not on Mac OSX.\n\n' + printf 'Not on macOS.\n\n' apple="" fi -# We can't use the linker's strip flag on Mac OSX. -if [ "$debug" -eq 0 ] && [ "$apple" == "" ] && [ "$strip_bin" -ne 0 ]; then +# We can't use the linker's strip flag on macOS. +if [ "$debug" -eq 0 ] && [ "$apple" = "" ] && [ "$strip_bin" -ne 0 ]; then LDFLAGS="-s $LDFLAGS" fi diff --git a/contrib/bc/gen/bc_help.txt b/contrib/bc/gen/bc_help.txt index c51ba186db15..489b54a185f1 100644 --- a/contrib/bc/gen/bc_help.txt +++ b/contrib/bc/gen/bc_help.txt @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/gen/dc_help.txt b/contrib/bc/gen/dc_help.txt index 7d9e7ec28d25..df4ede1583a2 100644 --- a/contrib/bc/gen/dc_help.txt +++ b/contrib/bc/gen/dc_help.txt @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/gen/lib.bc b/contrib/bc/gen/lib.bc index b12b23176790..0c9389b8510d 100644 --- a/contrib/bc/gen/lib.bc +++ b/contrib/bc/gen/lib.bc @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/gen/lib2.bc b/contrib/bc/gen/lib2.bc index df51d0c07a8d..d6d9f70fe063 100644 --- a/contrib/bc/gen/lib2.bc +++ b/contrib/bc/gen/lib2.bc @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/gen/strgen.c b/contrib/bc/gen/strgen.c index 2cb3ed9e8475..1394a05c4a76 100644 --- a/contrib/bc/gen/strgen.c +++ b/contrib/bc/gen/strgen.c @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -68,7 +68,7 @@ static const char* const bc_gen_ex_end = "{{ end }}"; // This is exactly what it looks like. It just slaps a simple license header on // the generated C source file. static const char* const bc_gen_header = - "// Copyright (c) 2018-2023 Gavin D. Howard and contributors.\n" + "// Copyright (c) 2018-2024 Gavin D. Howard and contributors.\n" "// Licensed under the 2-clause BSD license.\n" "// *** AUTOMATICALLY GENERATED FROM %s. DO NOT MODIFY. ***\n\n"; // clang-format on diff --git a/contrib/bc/gen/strgen.sh b/contrib/bc/gen/strgen.sh index 2b8927b5528e..8542bd40ee83 100755 --- a/contrib/bc/gen/strgen.sh +++ b/contrib/bc/gen/strgen.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2023 Gavin D. Howard and contributors. +# Copyright (c) 2018-2024 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -96,7 +96,7 @@ if [ -n "$remove_tabs" ]; then fi cat<data & ~(BC_LEX_CHAR_MSB(1)))) /// A macro to easily build a keyword entry. See bc_lex_kws in src/data.c. -#define BC_LEX_KW_ENTRY(a, b, c) \ - { \ - .data = ((b) & ~(BC_LEX_CHAR_MSB(1))) | BC_LEX_CHAR_MSB(c), .name = a \ - } +#define BC_LEX_KW_ENTRY(a, b, c) \ + { .data = ((b) & ~(BC_LEX_CHAR_MSB(1))) | BC_LEX_CHAR_MSB(c), .name = a } #if BC_ENABLE_EXTRA_MATH @@ -234,7 +233,7 @@ bc_lex_token(BcLex* l); * @param t The token to return operator data for. * @return The operator data for @a t. */ -#define BC_PARSE_OP_DATA(t) bc_parse_ops[((t) -BC_LEX_OP_INC)] +#define BC_PARSE_OP_DATA(t) bc_parse_ops[((t) - BC_LEX_OP_INC)] /** * Returns non-zero if operator @a op is left associative, zero otherwise. @@ -341,7 +340,7 @@ bc_lex_token(BcLex* l); * @param t The token to turn into an instruction. * @return The token as an instruction. */ -#define BC_PARSE_TOKEN_INST(t) ((uchar) ((t) -BC_LEX_NEG + BC_INST_NEG)) +#define BC_PARSE_TOKEN_INST(t) ((uchar) ((t) - BC_LEX_NEG + BC_INST_NEG)) /** * Returns true if the token is a bc keyword. @@ -372,10 +371,8 @@ typedef struct BcParseNext /// A macro to generate a BcParseNext literal from BcParseNext data. See /// src/data.c for examples. -#define BC_PARSE_NEXT(a, ...) \ - { \ - .len = (uchar) (a), BC_PARSE_NEXT_TOKENS(__VA_ARGS__) \ - } +#define BC_PARSE_NEXT(a, ...) \ + { .len = (uchar) (a), BC_PARSE_NEXT_TOKENS(__VA_ARGS__) } /// A status returned by @a bc_parse_expr_err(). It can either return success or /// an error indicating an empty expression. diff --git a/contrib/bc/include/bcl.h b/contrib/bc/include/bcl.h index d3a9f42cdcf8..8e762b694f4d 100644 --- a/contrib/bc/include/bcl.h +++ b/contrib/bc/include/bcl.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/include/dc.h b/contrib/bc/include/dc.h index 9a603c26d1a5..1328f1c63b38 100644 --- a/contrib/bc/include/dc.h +++ b/contrib/bc/include/dc.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -45,8 +45,9 @@ /** * The main function for dc. It just sets variables and passes its arguments * through to @a bc_vm_boot(). + * @return A status. */ -void +BcStatus dc_main(int argc, char* argv[]); // A reference to the dc help text. diff --git a/contrib/bc/include/file.h b/contrib/bc/include/file.h index 95cfa861a734..86f368db11c6 100644 --- a/contrib/bc/include/file.h +++ b/contrib/bc/include/file.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -54,6 +54,9 @@ typedef struct BcFile // with the existing code as possible. FILE* f; + // True if errors should be fatal, false otherwise. + bool errors_fatal; + } BcFile; #else // BC_ENABLE_LINE_LIB @@ -64,6 +67,9 @@ typedef struct BcFile // The actual file descriptor. int fd; + // True if errors should be fatal, false otherwise. + bool errors_fatal; + // The buffer for the file. char* buf; @@ -123,23 +129,25 @@ typedef enum BcFlushType /** * Initialize a file. - * @param f The file to initialize. - * @param file The stdio file. + * @param f The file to initialize. + * @param file The stdio file. + * @param errors_fatal True if errors should be fatal, false otherwise. */ void -bc_file_init(BcFile* f, FILE* file); +bc_file_init(BcFile* f, FILE* file, bool errors_fatal); #else // BC_ENABLE_LINE_LIB /** * Initialize a file. - * @param f The file to initialize. - * @param fd The file descriptor. - * @param buf The buffer for the file. - * @param cap The capacity of the buffer. + * @param f The file to initialize. + * @param fd The file descriptor. + * @param buf The buffer for the file. + * @param cap The capacity of the buffer. + * @param errors_fatal True if errors should be fatal, false otherwise. */ void -bc_file_init(BcFile* f, int fd, char* buf, size_t cap); +bc_file_init(BcFile* f, int fd, char* buf, size_t cap, bool errors_fatal); #endif // BC_ENABLE_LINE_LIB diff --git a/contrib/bc/include/history.h b/contrib/bc/include/history.h index 64402c4dffa1..460524bd7b87 100644 --- a/contrib/bc/include/history.h +++ b/contrib/bc/include/history.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/include/lang.h b/contrib/bc/include/lang.h index 97aeeaa98da8..6c8245139719 100644 --- a/contrib/bc/include/lang.h +++ b/contrib/bc/include/lang.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/include/lex.h b/contrib/bc/include/lex.h index ac9b7b6ea69c..d2be3c7526ef 100644 --- a/contrib/bc/include/lex.h +++ b/contrib/bc/include/lex.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/include/library.h b/contrib/bc/include/library.h index 1edd3757444c..9942705a5f36 100644 --- a/contrib/bc/include/library.h +++ b/contrib/bc/include/library.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/include/num.h b/contrib/bc/include/num.h index 6c9dee107f2f..6cead6eb3823 100644 --- a/contrib/bc/include/num.h +++ b/contrib/bc/include/num.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/include/opt.h b/contrib/bc/include/opt.h index 28d9d99a7856..e60328994d8c 100644 --- a/contrib/bc/include/opt.h +++ b/contrib/bc/include/opt.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/include/parse.h b/contrib/bc/include/parse.h index ece413e7bd74..7f0f8768b0db 100644 --- a/contrib/bc/include/parse.h +++ b/contrib/bc/include/parse.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/include/program.h b/contrib/bc/include/program.h index 1df753afad22..e16e5c079d7d 100644 --- a/contrib/bc/include/program.h +++ b/contrib/bc/include/program.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/include/rand.h b/contrib/bc/include/rand.h index e516295d7c5c..aee63b866cf6 100644 --- a/contrib/bc/include/rand.h +++ b/contrib/bc/include/rand.h @@ -13,7 +13,7 @@ * This code is under the following license: * * Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -241,10 +241,7 @@ typedef struct BcRandState * @param l The low 64 bits. * @return The constant built from @a h and @a l. */ -#define BC_RAND_CONSTANT(h, l) \ - { \ - .lo = (l), .hi = (h) \ - } +#define BC_RAND_CONSTANT(h, l) { .lo = (l), .hi = (h) } /** * Truncates a PCG state to the number of bits in a random integer. diff --git a/contrib/bc/include/read.h b/contrib/bc/include/read.h index 867dcd7433a3..62e6897635a2 100644 --- a/contrib/bc/include/read.h +++ b/contrib/bc/include/read.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/include/status.h b/contrib/bc/include/status.h index 242514edb476..f579df8c649b 100644 --- a/contrib/bc/include/status.h +++ b/contrib/bc/include/status.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -60,10 +60,10 @@ #endif // __FreeBSD__ #endif // BC_TEST_FREEBSD -// This is used by configure.sh to test for Mac OSX. +// This is used by configure.sh to test for macOS. #ifdef BC_TEST_APPLE #ifdef __APPLE__ -#error On Mac OSX without _DARWIN_C_SOURCE +#error On macOS without _DARWIN_C_SOURCE #endif // __APPLE__ #endif // BC_TEST_APPLE diff --git a/contrib/bc/include/vector.h b/contrib/bc/include/vector.h index b86be1424537..cad5fc2aa7c3 100644 --- a/contrib/bc/include/vector.h +++ b/contrib/bc/include/vector.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/include/version.h b/contrib/bc/include/version.h index e2576269345d..586691a6e7ef 100644 --- a/contrib/bc/include/version.h +++ b/contrib/bc/include/version.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -37,6 +37,6 @@ #define BC_VERSION_H /// The current version. -#define VERSION 6.7.5 +#define VERSION 6.7.6 #endif // BC_VERSION_H diff --git a/contrib/bc/include/vm.h b/contrib/bc/include/vm.h index c56cc8e7370a..052c1d14c237 100644 --- a/contrib/bc/include/vm.h +++ b/contrib/bc/include/vm.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2023 Gavin D. Howard and contributors. + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -493,7 +493,7 @@ #define BC_VM_SAFE_RESULT(r) ((r)->t >= BC_RESULT_TEMP) /// The invalid locale catalog return value. -#define BC_VM_INVALID_CATALOG ((nl_catd) -1) +#define BC_VM_INVALID_CATALOG ((nl_catd) - 1) /** * Returns true if the *unsigned* multiplication overflows. @@ -791,8 +791,9 @@ bc_vm_info(const char* const help); * The entrance point for bc/dc together. * @param argc The count of arguments. * @param argv The argument array. + * @return A status. */ -void +BcStatus bc_vm_boot(int argc, char* argv[]); /** @@ -1045,8 +1046,9 @@ bc_vm_fatalError(BcErr e); * A function to call at exit. * @param status The exit status. */ -int -bc_vm_atexit(int status); +BcStatus +bc_vm_atexit(BcStatus status); + #endif // BC_ENABLE_LIBRARY /// A reference to the copyright header. diff --git a/contrib/bc/locales/de_DE.ISO8859-1.msg b/contrib/bc/locales/de_DE.ISO8859-1.msg index 858a3946e8f8..9700ab070b2c 100644 --- a/contrib/bc/locales/de_DE.ISO8859-1.msg +++ b/contrib/bc/locales/de_DE.ISO8859-1.msg @@ -1,7 +1,7 @@ $ $ $ SPDX-License-Identifier: BSD-2-Clause $ $ -$ Copyright (c) 2018-2023 Gavin D. Howard and contributors. +$ Copyright (c) 2018-2024 Gavin D. Howard and contributors. $ $ $ Redistribution and use in source and binary forms, with or without $ modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/locales/de_DE.UTF-8.msg b/contrib/bc/locales/de_DE.UTF-8.msg index 25be4fd79cb9..7b918fc6d1cd 100644 --- a/contrib/bc/locales/de_DE.UTF-8.msg +++ b/contrib/bc/locales/de_DE.UTF-8.msg @@ -1,7 +1,7 @@ $ $ $ SPDX-License-Identifier: BSD-2-Clause $ $ -$ Copyright (c) 2018-2023 Gavin D. Howard and contributors. +$ Copyright (c) 2018-2024 Gavin D. Howard and contributors. $ $ $ Redistribution and use in source and binary forms, with or without $ modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/locales/en_US.msg b/contrib/bc/locales/en_US.msg index 5610496d6e71..4afcbcd1f813 100644 --- a/contrib/bc/locales/en_US.msg +++ b/contrib/bc/locales/en_US.msg @@ -1,7 +1,7 @@ $ $ $ SPDX-License-Identifier: BSD-2-Clause $ $ -$ Copyright (c) 2018-2023 Gavin D. Howard and contributors. +$ Copyright (c) 2018-2024 Gavin D. Howard and contributors. $ $ $ Redistribution and use in source and binary forms, with or without $ modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/locales/es_ES.ISO8859-1.msg b/contrib/bc/locales/es_ES.ISO8859-1.msg index 3bf70753559e..4d022d9bf664 100644 --- a/contrib/bc/locales/es_ES.ISO8859-1.msg +++ b/contrib/bc/locales/es_ES.ISO8859-1.msg @@ -1,7 +1,7 @@ $ $ $ SPDX-License-Identifier: BSD-2-Clause $ $ -$ Copyright (c) 2018-2023 Gavin D. Howard and contributors. +$ Copyright (c) 2018-2024 Gavin D. Howard and contributors. $ $ $ Redistribution and use in source and binary forms, with or without $ modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/locales/es_ES.UTF-8.msg b/contrib/bc/locales/es_ES.UTF-8.msg index 0a5cf26d1621..364cff6ee57f 100644 --- a/contrib/bc/locales/es_ES.UTF-8.msg +++ b/contrib/bc/locales/es_ES.UTF-8.msg @@ -1,7 +1,7 @@ $ $ $ SPDX-License-Identifier: BSD-2-Clause $ $ -$ Copyright (c) 2018-2023 Gavin D. Howard and contributors. +$ Copyright (c) 2018-2024 Gavin D. Howard and contributors. $ $ $ Redistribution and use in source and binary forms, with or without $ modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/locales/fr_FR.ISO8859-1.msg b/contrib/bc/locales/fr_FR.ISO8859-1.msg index f2e07e02b2dc..b4b39866c96e 100644 --- a/contrib/bc/locales/fr_FR.ISO8859-1.msg +++ b/contrib/bc/locales/fr_FR.ISO8859-1.msg @@ -1,7 +1,7 @@ $ $ $ SPDX-License-Identifier: BSD-2-Clause $ $ -$ Copyright (c) 2018-2023 Gavin D. Howard and contributors. +$ Copyright (c) 2018-2024 Gavin D. Howard and contributors. $ $ $ Redistribution and use in source and binary forms, with or without $ modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/locales/fr_FR.UTF-8.msg b/contrib/bc/locales/fr_FR.UTF-8.msg index 1e9e900746a5..c3387e31ae9f 100644 --- a/contrib/bc/locales/fr_FR.UTF-8.msg +++ b/contrib/bc/locales/fr_FR.UTF-8.msg @@ -1,7 +1,7 @@ $ $ $ SPDX-License-Identifier: BSD-2-Clause $ $ -$ Copyright (c) 2018-2023 Gavin D. Howard and contributors. +$ Copyright (c) 2018-2024 Gavin D. Howard and contributors. $ $ $ Redistribution and use in source and binary forms, with or without $ modification, are permitted provided that the following conditions are met: diff --git a/contrib/bc/locales/ja_JP.UTF-8.msg b/contrib/bc/locales/ja_JP.UTF-8.msg index d871e9bf6ad2..21640eb9f1cb 100644 --- a/contrib/bc/locales/ja_JP.UTF-8.msg +++ b/contrib/bc/locales/ja_JP.UTF-8.msg @@ -1,7 +1,7 @@ *** 23594 LINES SKIPPED *** From nobody Tue Jul 9 11:10:42 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJJFG27cCz5Q98T; Tue, 09 Jul 2024 11:10: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJJFG1h7mz44PB; Tue, 9 Jul 2024 11:10:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720523442; 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=KXotsmroC1FfEL0b+BYtrBxWaeVXdButso1jQeEPZac=; b=X7yZCSWFDl5iK4l8v5EW+bKX6UrCZkqDWVvqR8A/yJQ3nb1iowEzixvq4jcT5U2oB7fHSZ xpjmd7ZTdM5xNoTIX5zw17uwYvG8iSjb2UtwhEGrM3peL5v82V1dFqvsEUhpoeXclhTTvZ ILRkqLio46+FEX5FpZRNetTpLHGmg/uSVkM7Eu+g55/WjWF+Qj6Zuypsv6MYtmrLEvTmdo dcFknxMdMCgF6hECAMXX58bGRECA/XfyHBjb8xh06cC6fOgVv99IV8Ls/LH3SDPwKMd0Sj QjNfR9IYJYk43UKdQumnWksj17geOloLX8cDL0KSR/3A5F8SQquhxpZHcJM/gQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720523442; a=rsa-sha256; cv=none; b=CGZYHzFI3Z37bVmB2kGqWpnqj/IrF73VgyLPYhnHKjjQ+d5oUNQjohopqT3oIAIe7ShRn7 gi1cepnqxBl6/SnIiWcNmo4g4xfGDu7dyPAlZw3m0E9BnKvXN8oXCrtaKw+6cgztIzwZt0 vVjVRhhY6LK5hAk2rmYyJvvym+xxXlG+WSdW5wWD9jbqs0xYCGAqsVe8btS1SmDma6yEeT hrkLTN8iJc/mCyadnFvSLPuLHRvpwCFvB25LGCEJ4G1me4AMMmUoW+TdoybTBYBOYwwrCH RusnYt2RTa7BmRQ60D0L40XRHrsMG3UMSM/8CWoOYavCU2FqlV0zN4Yt3iLeIQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720523442; 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=KXotsmroC1FfEL0b+BYtrBxWaeVXdButso1jQeEPZac=; b=ZJAwtAqvybkyowOl63NzQv42lnyLKF/oDOjAdaNaTZ7o0zuJz3r/y0ZzClTs9UhTny/4BV 5cCo+1kNkibasRPbgXZj09y8ibaRXGZ2wC+cwgjPCXu3Ls6au/SUoG3gDOjH/cp9GC6G1i VCdQQ7Ae0cIGa7PpLXWeKwzjFjwhmCrN5KfHu1QIhXuOn7cwgrmRM/C2bGomCnhBrrtiLi B8EB1OEDBS6BSWsjo9HVgHI/xkxWZ17iMXjY+Hc8m1Tkyrk1XljmzB56GM9F8x7aRVZqIB ydFTzR+eML+0Syrq2qWoIIFC+XnhvKPeHLNlWCEy02Dykh7kR+fiDBo1l3FsTw== 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 4WJJFG1HQRzXVT; Tue, 9 Jul 2024 11:10:42 +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 469BAgMJ017001; Tue, 9 Jul 2024 11:10:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 469BAgxr016998; Tue, 9 Jul 2024 11:10:42 GMT (envelope-from git) Date: Tue, 9 Jul 2024 11:10:42 GMT Message-Id: <202407091110.469BAgxr016998@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Sumit Saxena Subject: git: e213cdb4a2e5 - main - bnxt_re/bnxt_en: man page support for bnxt_re driver List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ssaxena X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e213cdb4a2e55a2c332e0917515a99da75c942f8 Auto-Submitted: auto-generated The branch main has been updated by ssaxena: URL: https://cgit.FreeBSD.org/src/commit/?id=e213cdb4a2e55a2c332e0917515a99da75c942f8 commit e213cdb4a2e55a2c332e0917515a99da75c942f8 Author: Chandrakanth Patil AuthorDate: 2024-07-09 11:02:01 +0000 Commit: Sumit Saxena CommitDate: 2024-07-09 11:04:45 +0000 bnxt_re/bnxt_en: man page support for bnxt_re driver Added new man page support for bnxt_re driver. Updated existing bnxt ethernet driver man page with new controllers support. Reviewed by: markj Approved by: imp Differential revision: https://reviews.freebsd.org/D45203 --- share/man/man4/bnxt.4 | 8 ++++- share/man/man4/bnxt_re.4 | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 1 deletion(-) diff --git a/share/man/man4/bnxt.4 b/share/man/man4/bnxt.4 index f07c66fd4dda..0900a11cecea 100644 --- a/share/man/man4/bnxt.4 +++ b/share/man/man4/bnxt.4 @@ -48,7 +48,7 @@ if_bnxt_load="YES" The .Nm driver provides support for various NICs based on the Broadcom BCM57301/2/4, -and BCM57402/4/6 Ethernet controller chips. +BCM57402/4/6, and BCM57502/4/8 Ethernet controller chips. .Pp For more information on configuring this device, see .Xr ifconfig 8 . @@ -102,6 +102,12 @@ Broadcom BCM57416 NetXtreme-E Partition Broadcom BCM57417 NetXtreme-E Ethernet Partition .It Broadcom BCM57454 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet +.It +Broadcom BCM57502 NetXtreme-E 10Gb/25Gb/50Gb/100Gb/200Gb Ethernet +.It +Broadcom BCM57504 NetXtreme-E 10Gb/25Gb/50Gb/100Gb/200Gb Ethernet +.It +Broadcom BCM57508 NetXtreme-E 10Gb/25Gb/50Gb/100Gb/200Gb Ethernet .El .Sh SYSCTL VARIABLES These variables must be set before loading the driver, either via diff --git a/share/man/man4/bnxt_re.4 b/share/man/man4/bnxt_re.4 new file mode 100644 index 000000000000..e2bb87c320b1 --- /dev/null +++ b/share/man/man4/bnxt_re.4 @@ -0,0 +1,91 @@ +.\" Copyright (c) 2024 Broadcom, 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 SOFTWARE IS PROVIDED BY 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 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. +.\" +.Dd May 15, 2024 +.Dt BNXT_RE 4 +.Os +.Sh NAME +.Nm bnxt_re +.Nd "Broadcom NetXtreme-E RoCE driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place these lines in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "options COMPAT_LINUXKPI" +.Cd "device bnxt" +.Cd "device bnxt_re" +.Ed +.Pp +To load the driver as a module at run-time, +run this command as root: +.Bd -literal -offset indent +kldload bnxt_re +.Ed +.Pp +To load the driver as a +module at boot time, place this line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +bnxt_re_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for Remote Direct Memory Access (RDMA) over +Converged Ethernet (RoCE) for Broadcom NetXtreme-E PCI Express network +adapters. +.Sh HARDWARE +The +.Nm +driver provides support for NetXtreme-E BCM575xx 10/20/25/40/50/100/200Gb +network adapters, including: +.Pp +.Bl -bullet -compact +.It +Broadcom BCM57502 NetXtreme-E 10Gb/25Gb/50Gb/100Gb/200Gb Ethernet +.It +Broadcom BCM57504 NetXtreme-E 10Gb/25Gb/50Gb/100Gb/200Gb Ethernet +.It +Broadcom BCM57508 NetXtreme-E 10Gb/25Gb/50Gb/100Gb/200Gb Ethernet +.El +.Sh SUPPORT +For general information and support, +go to the Broadcom support website at: +.Pa http://www.broadcom.com/ . +.Pp +Report driver issues with supported adapters to +.Aq Mt freebsd.pdl@broadcom.com . +.Sh SEE ALSO +.Xr bnxt_re 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 15.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Broadcom . From nobody Tue Jul 9 11:10:43 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJJFH3Wxbz5Q8sN; Tue, 09 Jul 2024 11:10:43 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJJFH2Ls6z442d; Tue, 9 Jul 2024 11:10:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720523443; 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=PYk2MwPmLBET7P89LOOuG4fIIB+tZSudQZZIsELrpeo=; b=koi8PFmQnKwvJ7/nnIMvQt83NvbSAUoM2OCq+F5EQK9qRoEss1HGmBTTlZIqoSMCksL6lQ 6kIYD9GxO2Kd2hh/rSq9o0LisOGIjectUzL+Huzw01RXOsnCKqtBh+r6gBZoiUnSjZMIhl HCnC9l25uOWCPd83EX9RoUAWzSpBqx1w7ivWlFLMshcflWGL9rx1jMbDQN4/L8n3RDrhrM QUQMQcVbarJ/vh8lPUqFnbdxeH/lMfF25cW0zP+6aMfnnfgSdRHrlqQan/rEpzI0dh5uJP n24JbOyDohdxLvXZbxhlJke7ZAYQxb6cVpURFllD3X2g7M9YpOCYPB37sc4Ilg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720523443; a=rsa-sha256; cv=none; b=kyo7ycFt81Y/KGiN6sfZjRueoHGF603nw0ixAPotvs+4FL5p0tGxJGOYFlwhxv6wRYpXrd 9MaoKbAkhG3y4r2q+ifZT/yq5DeFalcJGCPZ2odYvwv1ntvntAP+ux+coslksTMGPHDo+K zKPWkX7KyaqxDHiCbwFSaeiLQa5FwnuUO32byXafWc2zto6LYBFSHT7FwYjIkXq/53Th3N RqZP1TuXot4zLyUoCAuQlQzGgxNmRYVqRKfn0Tq/0WoKWia/024tfp3kjZfFJa7u1v6b+I XsdfHCrGz0P5ptUSI1qc5eh8yS4RzcvjYT91EcnxpoH8ibpSNy71+gHaivEwWg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720523443; 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=PYk2MwPmLBET7P89LOOuG4fIIB+tZSudQZZIsELrpeo=; b=b/N+6Kg2GcnW1V63mOoQplEjYv0c7sxnzTypJT0Vee35fwveXJBvwxF51dHyOJt/Y4RTRB k+sprk1dXTG3vubJI6om0HLxd9ng8+1lWsjCyq/V8UekNsSPgevPqN4TztZlWF/WTALkpc ECdbrte0KWAV0voCosXcbiZrbDcUhODVx9k8M4IpK3v0BTPdgJyAnIYCNkvMktdLnpJFIr 057LAk8HBQ1Iu5YpUNjjHX4pWP6Lt+ZJ2+sObZOFy0gYebS+Fe1IJ3Oej4fF+uhQQAsb1D jGTKSbEaYSQp0ntXuGQr4s5BT6wYtZKtXCBg+Xuz75vEmyr/DYIGiylIBh0TvQ== 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 4WJJFH1yBczXkQ; Tue, 9 Jul 2024 11:10: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 469BAhH0017113; Tue, 9 Jul 2024 11:10:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 469BAh4W017067; Tue, 9 Jul 2024 11:10:43 GMT (envelope-from git) Date: Tue, 9 Jul 2024 11:10:43 GMT Message-Id: <202407091110.469BAh4W017067@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Sumit Saxena Subject: git: 9207f9d206a4 - main - bnxt_re: User library support for RoCE driver List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ssaxena X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9207f9d206a4017001f01ca27d3d25a26c268a95 Auto-Submitted: auto-generated The branch main has been updated by ssaxena: URL: https://cgit.FreeBSD.org/src/commit/?id=9207f9d206a4017001f01ca27d3d25a26c268a95 commit 9207f9d206a4017001f01ca27d3d25a26c268a95 Author: Chandrakanth patil AuthorDate: 2024-07-05 07:53:46 +0000 Commit: Sumit Saxena CommitDate: 2024-07-09 11:08:36 +0000 bnxt_re: User library support for RoCE driver This patch introduces userspace library support for the bnxt_re RoCE driver. The library can be linked with RDMA applications such as perftest and rping. The RoCE traffic has been tested with the rping and perftest utility. Reviewed by: imp, kib, sumit.saxena@broadcom.com Approved by: imp Differential revision: https://reviews.freebsd.org/D45729 --- contrib/ofed/libbnxtre/abi.h | 542 ++++++++ contrib/ofed/libbnxtre/db.c | 566 +++++++++ contrib/ofed/libbnxtre/list.h | 122 ++ contrib/ofed/libbnxtre/main.c | 383 ++++++ contrib/ofed/libbnxtre/main.h | 538 ++++++++ contrib/ofed/libbnxtre/memory.c | 96 ++ contrib/ofed/libbnxtre/memory.h | 166 +++ contrib/ofed/libbnxtre/verbs.c | 2557 ++++++++++++++++++++++++++++++++++++++ contrib/ofed/libbnxtre/verbs.h | 184 +++ contrib/ofed/libbnxtre/version.h | 45 + lib/ofed/libbnxtre/Makefile | 14 + 11 files changed, 5213 insertions(+) diff --git a/contrib/ofed/libbnxtre/abi.h b/contrib/ofed/libbnxtre/abi.h new file mode 100644 index 000000000000..390605edb40b --- /dev/null +++ b/contrib/ofed/libbnxtre/abi.h @@ -0,0 +1,542 @@ +/* + * Copyright (c) 2024, Broadcom. All rights reserved. The term + * Broadcom refers to Broadcom Limited and/or its subsidiaries. + * + * 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. + */ + +#ifndef __BNXT_RE_ABI_H__ +#define __BNXT_RE_ABI_H__ + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#define __aligned_u64 __attribute__((aligned(8))) u64 + +#define BNXT_RE_ABI_VERSION 6 +#define BNXT_RE_MAX_INLINE_SIZE 0x60 +#define BNXT_RE_MAX_INLINE_SIZE_VAR_WQE 0x1E0 +#define BNXT_RE_MAX_PUSH_SIZE_VAR_WQE 0xD0 +#define BNXT_RE_FULL_FLAG_DELTA 0x00 + +enum bnxt_re_wr_opcode { + BNXT_RE_WR_OPCD_SEND = 0x00, + BNXT_RE_WR_OPCD_SEND_IMM = 0x01, + BNXT_RE_WR_OPCD_SEND_INVAL = 0x02, + BNXT_RE_WR_OPCD_RDMA_WRITE = 0x04, + BNXT_RE_WR_OPCD_RDMA_WRITE_IMM = 0x05, + BNXT_RE_WR_OPCD_RDMA_READ = 0x06, + BNXT_RE_WR_OPCD_ATOMIC_CS = 0x08, + BNXT_RE_WR_OPCD_ATOMIC_FA = 0x0B, + BNXT_RE_WR_OPCD_LOC_INVAL = 0x0C, + BNXT_RE_WR_OPCD_BIND = 0x0E, + BNXT_RE_WR_OPCD_RECV = 0x80, + BNXT_RE_WR_OPCD_INVAL = 0xFF +}; + +enum bnxt_re_wr_flags { + BNXT_RE_WR_FLAGS_INLINE = 0x10, + BNXT_RE_WR_FLAGS_SE = 0x08, + BNXT_RE_WR_FLAGS_UC_FENCE = 0x04, + BNXT_RE_WR_FLAGS_RD_FENCE = 0x02, + BNXT_RE_WR_FLAGS_SIGNALED = 0x01 +}; + +#define BNXT_RE_MEMW_TYPE_2 0x02 +#define BNXT_RE_MEMW_TYPE_1 0x00 +enum bnxt_re_wr_bind_acc { + BNXT_RE_WR_BIND_ACC_LWR = 0x01, + BNXT_RE_WR_BIND_ACC_RRD = 0x02, + BNXT_RE_WR_BIND_ACC_RWR = 0x04, + BNXT_RE_WR_BIND_ACC_RAT = 0x08, + BNXT_RE_WR_BIND_ACC_MWB = 0x10, + BNXT_RE_WR_BIND_ACC_ZBVA = 0x01, + BNXT_RE_WR_BIND_ACC_SHIFT = 0x10 +}; + +enum bnxt_re_wc_type { + BNXT_RE_WC_TYPE_SEND = 0x00, + BNXT_RE_WC_TYPE_RECV_RC = 0x01, + BNXT_RE_WC_TYPE_RECV_UD = 0x02, + BNXT_RE_WC_TYPE_RECV_RAW = 0x03, + BNXT_RE_WC_TYPE_TERM = 0x0E, + BNXT_RE_WC_TYPE_COFF = 0x0F +}; + +#define BNXT_RE_WC_OPCD_RECV 0x80 +enum bnxt_re_req_wc_status { + BNXT_RE_REQ_ST_OK = 0x00, + BNXT_RE_REQ_ST_BAD_RESP = 0x01, + BNXT_RE_REQ_ST_LOC_LEN = 0x02, + BNXT_RE_REQ_ST_LOC_QP_OP = 0x03, + BNXT_RE_REQ_ST_PROT = 0x04, + BNXT_RE_REQ_ST_MEM_OP = 0x05, + BNXT_RE_REQ_ST_REM_INVAL = 0x06, + BNXT_RE_REQ_ST_REM_ACC = 0x07, + BNXT_RE_REQ_ST_REM_OP = 0x08, + BNXT_RE_REQ_ST_RNR_NAK_XCED = 0x09, + BNXT_RE_REQ_ST_TRNSP_XCED = 0x0A, + BNXT_RE_REQ_ST_WR_FLUSH = 0x0B +}; + +enum bnxt_re_rsp_wc_status { + BNXT_RE_RSP_ST_OK = 0x00, + BNXT_RE_RSP_ST_LOC_ACC = 0x01, + BNXT_RE_RSP_ST_LOC_LEN = 0x02, + BNXT_RE_RSP_ST_LOC_PROT = 0x03, + BNXT_RE_RSP_ST_LOC_QP_OP = 0x04, + BNXT_RE_RSP_ST_MEM_OP = 0x05, + BNXT_RE_RSP_ST_REM_INVAL = 0x06, + BNXT_RE_RSP_ST_WR_FLUSH = 0x07, + BNXT_RE_RSP_ST_HW_FLUSH = 0x08 +}; + +enum bnxt_re_hdr_offset { + BNXT_RE_HDR_WT_MASK = 0xFF, + BNXT_RE_HDR_FLAGS_MASK = 0xFF, + BNXT_RE_HDR_FLAGS_SHIFT = 0x08, + BNXT_RE_HDR_WS_MASK = 0xFF, + BNXT_RE_HDR_WS_SHIFT = 0x10 +}; + +enum bnxt_re_db_que_type { + BNXT_RE_QUE_TYPE_SQ = 0x00, + BNXT_RE_QUE_TYPE_RQ = 0x01, + BNXT_RE_QUE_TYPE_SRQ = 0x02, + BNXT_RE_QUE_TYPE_SRQ_ARM = 0x03, + BNXT_RE_QUE_TYPE_CQ = 0x04, + BNXT_RE_QUE_TYPE_CQ_ARMSE = 0x05, + BNXT_RE_QUE_TYPE_CQ_ARMALL = 0x06, + BNXT_RE_QUE_TYPE_CQ_ARMENA = 0x07, + BNXT_RE_QUE_TYPE_SRQ_ARMENA = 0x08, + BNXT_RE_QUE_TYPE_CQ_CUT_ACK = 0x09, + BNXT_RE_PUSH_TYPE_START = 0x0C, + BNXT_RE_PUSH_TYPE_END = 0x0D, + BNXT_RE_QUE_TYPE_NULL = 0x0F +}; + +enum bnxt_re_db_mask { + BNXT_RE_DB_INDX_MASK = 0xFFFFFFUL, + BNXT_RE_DB_PILO_MASK = 0x0FFUL, + BNXT_RE_DB_PILO_SHIFT = 0x18, + BNXT_RE_DB_QID_MASK = 0xFFFFFUL, + BNXT_RE_DB_PIHI_MASK = 0xF00UL, + BNXT_RE_DB_PIHI_SHIFT = 0x0C, /* Because mask is 0xF00 */ + BNXT_RE_DB_TYP_MASK = 0x0FUL, + BNXT_RE_DB_TYP_SHIFT = 0x1C, + BNXT_RE_DB_VALID_SHIFT = 0x1A, + BNXT_RE_DB_EPOCH_SHIFT = 0x18, + BNXT_RE_DB_TOGGLE_SHIFT = 0x19, + +}; + +enum bnxt_re_psns_mask { + BNXT_RE_PSNS_SPSN_MASK = 0xFFFFFF, + BNXT_RE_PSNS_OPCD_MASK = 0xFF, + BNXT_RE_PSNS_OPCD_SHIFT = 0x18, + BNXT_RE_PSNS_NPSN_MASK = 0xFFFFFF, + BNXT_RE_PSNS_FLAGS_MASK = 0xFF, + BNXT_RE_PSNS_FLAGS_SHIFT = 0x18 +}; + +enum bnxt_re_msns_mask { + BNXT_RE_SQ_MSN_SEARCH_START_PSN_MASK = 0xFFFFFFUL, + BNXT_RE_SQ_MSN_SEARCH_START_PSN_SHIFT = 0, + BNXT_RE_SQ_MSN_SEARCH_NEXT_PSN_MASK = 0xFFFFFF000000ULL, + BNXT_RE_SQ_MSN_SEARCH_NEXT_PSN_SHIFT = 0x18, + BNXT_RE_SQ_MSN_SEARCH_START_IDX_MASK = 0xFFFF000000000000ULL, + BNXT_RE_SQ_MSN_SEARCH_START_IDX_SHIFT = 0x30 +}; + +enum bnxt_re_bcqe_mask { + BNXT_RE_BCQE_PH_MASK = 0x01, + BNXT_RE_BCQE_TYPE_MASK = 0x0F, + BNXT_RE_BCQE_TYPE_SHIFT = 0x01, + BNXT_RE_BCQE_STATUS_MASK = 0xFF, + BNXT_RE_BCQE_STATUS_SHIFT = 0x08, + BNXT_RE_BCQE_FLAGS_MASK = 0xFFFFU, + BNXT_RE_BCQE_FLAGS_SHIFT = 0x10, + BNXT_RE_BCQE_RWRID_MASK = 0xFFFFFU, + BNXT_RE_BCQE_SRCQP_MASK = 0xFF, + BNXT_RE_BCQE_SRCQP_SHIFT = 0x18 +}; + +enum bnxt_re_rc_flags_mask { + BNXT_RE_RC_FLAGS_SRQ_RQ_MASK = 0x01, + BNXT_RE_RC_FLAGS_IMM_MASK = 0x02, + BNXT_RE_RC_FLAGS_IMM_SHIFT = 0x01, + BNXT_RE_RC_FLAGS_INV_MASK = 0x04, + BNXT_RE_RC_FLAGS_INV_SHIFT = 0x02, + BNXT_RE_RC_FLAGS_RDMA_MASK = 0x08, + BNXT_RE_RC_FLAGS_RDMA_SHIFT = 0x03 +}; + +enum bnxt_re_ud_flags_mask { + BNXT_RE_UD_FLAGS_SRQ_RQ_MASK = 0x01, + BNXT_RE_UD_FLAGS_SRQ_RQ_SFT = 0x00, + BNXT_RE_UD_FLAGS_IMM_MASK = 0x02, + BNXT_RE_UD_FLAGS_IMM_SFT = 0x01, + BNXT_RE_UD_FLAGS_IP_VER_MASK = 0x30, + BNXT_RE_UD_FLAGS_IP_VER_SFT = 0x4, + BNXT_RE_UD_FLAGS_META_MASK = 0x3C0, + BNXT_RE_UD_FLAGS_META_SFT = 0x6, + BNXT_RE_UD_FLAGS_EXT_META_MASK = 0xC00, + BNXT_RE_UD_FLAGS_EXT_META_SFT = 0x10, +}; + +enum bnxt_re_ud_cqe_mask { + BNXT_RE_UD_CQE_MAC_MASK = 0xFFFFFFFFFFFFULL, + BNXT_RE_UD_CQE_SRCQPLO_MASK = 0xFFFF, + BNXT_RE_UD_CQE_SRCQPLO_SHIFT = 0x30, + BNXT_RE_UD_CQE_LEN_MASK = 0x3FFFU +}; + +enum bnxt_re_shpg_offt { + BNXT_RE_SHPG_BEG_RESV_OFFT = 0x00, + BNXT_RE_SHPG_AVID_OFFT = 0x10, + BNXT_RE_SHPG_AVID_SIZE = 0x04, + BNXT_RE_SHPG_END_RESV_OFFT = 0xFF0 +}; + +enum bnxt_re_que_flags_mask { + BNXT_RE_FLAG_EPOCH_TAIL_SHIFT = 0x0UL, + BNXT_RE_FLAG_EPOCH_HEAD_SHIFT = 0x1UL, + BNXT_RE_FLAG_EPOCH_TAIL_MASK = 0x1UL, + BNXT_RE_FLAG_EPOCH_HEAD_MASK = 0x2UL, +}; + +enum bnxt_re_db_epoch_flag_shift { + BNXT_RE_DB_EPOCH_TAIL_SHIFT = BNXT_RE_DB_EPOCH_SHIFT, + BNXT_RE_DB_EPOCH_HEAD_SHIFT = (BNXT_RE_DB_EPOCH_SHIFT - 1) +}; + +enum bnxt_re_ppp_st_en_mask { + BNXT_RE_PPP_ENABLED_MASK = 0x1UL, + BNXT_RE_PPP_STATE_MASK = 0x2UL, +}; + +enum bnxt_re_ppp_st_shift { + BNXT_RE_PPP_ST_SHIFT = 0x1UL +}; + +struct bnxt_re_db_hdr { + __u64 typ_qid_indx; /* typ: 4, qid:20, indx:24 */ +}; + +#define BNXT_RE_CHIP_ID0_CHIP_NUM_SFT 0x00 +#define BNXT_RE_CHIP_ID0_CHIP_REV_SFT 0x10 +#define BNXT_RE_CHIP_ID0_CHIP_MET_SFT 0x18 + +enum { + BNXT_RE_COMP_MASK_UCNTX_WC_DPI_ENABLED = 0x01, + BNXT_RE_COMP_MASK_UCNTX_POW2_DISABLED = 0x02, + BNXT_RE_COMP_MASK_UCNTX_RSVD_WQE_DISABLED = 0x04, + BNXT_RE_COMP_MASK_UCNTX_MQP_EX_SUPPORTED = 0x8, + BNXT_RE_COMP_MASK_UCNTX_DBR_PACING_ENABLED = 0x10, + BNXT_RE_COMP_MASK_UCNTX_DBR_RECOVERY_ENABLED = 0x20, + BNXT_RE_COMP_MASK_UCNTX_HW_RETX_ENABLED = 0x40 +}; + +enum bnxt_re_req_to_drv { + BNXT_RE_COMP_MASK_REQ_UCNTX_POW2_SUPPORT = 0x01, + BNXT_RE_COMP_MASK_REQ_UCNTX_RSVD_WQE = 0x02 +}; + +#define BNXT_RE_WQE_MODES_WQE_MODE_MASK 0x01 +/* bit wise modes can be extended here. */ +enum bnxt_re_modes { + BNXT_RE_WQE_MODE_STATIC = 0x00, + BNXT_RE_WQE_MODE_VARIABLE = 0x01 + /* Other modes can be here */ +}; + +struct bnxt_re_cntx_req { + struct ibv_get_context cmd; + __aligned_u64 comp_mask; +}; + +struct bnxt_re_cntx_resp { + struct ibv_get_context_resp resp; + __u32 dev_id; + __u32 max_qp; /* To allocate qp-table */ + __u32 pg_size; + __u32 cqe_size; + __u32 max_cqd; + __u32 chip_id0; + __u32 chip_id1; + __u32 modes; + __aligned_u64 comp_mask; +} __attribute__((packed)); + +enum { + BNXT_RE_COMP_MASK_PD_HAS_WC_DPI = 0x01, + BNXT_RE_COMP_MASK_PD_HAS_DBR_BAR_ADDR = 0x02, +}; + +struct bnxt_re_pd_resp { + struct ibv_alloc_pd_resp resp; + __u32 pdid; + __u32 dpi; + __u64 dbr; + __u64 comp_mask; + __u32 wcdpi; + __u64 dbr_bar_map; +} __attribute__((packed)); + +struct bnxt_re_mr_resp { + struct ibv_reg_mr_resp resp; +} __attribute__((packed)); + +/* CQ */ +enum { + BNXT_RE_COMP_MASK_CQ_HAS_DB_INFO = 0x01, + BNXT_RE_COMP_MASK_CQ_HAS_WC_DPI = 0x02, + BNXT_RE_COMP_MASK_CQ_HAS_CQ_PAGE = 0x04 +}; + +enum { + BNXT_RE_COMP_MASK_CQ_REQ_HAS_CAP_MASK = 0x1 +}; + +enum { + BNXT_RE_COMP_MASK_CQ_REQ_CAP_DBR_RECOVERY = 0x1 +}; + +struct bnxt_re_cq_req { + struct ibv_create_cq cmd; + __u64 cq_va; + __u64 cq_handle; + __aligned_u64 comp_mask; + __u16 cq_capab; +} __attribute__((packed)); + +struct bnxt_re_cq_resp { + struct ibv_create_cq_resp resp; + __u32 cqid; + __u32 tail; + __u32 phase; + __u32 rsvd; + __aligned_u64 comp_mask; + __u32 dpi; + __u64 dbr; + __u32 wcdpi; + __u64 cq_page; +} __attribute__((packed)); + +struct bnxt_re_resize_cq_req { + struct ibv_resize_cq cmd; + __u64 cq_va; +} __attribute__((packed)); + +struct bnxt_re_bcqe { + __u32 flg_st_typ_ph; + __u32 qphi_rwrid; +} __attribute__((packed)); + +struct bnxt_re_req_cqe { + __u64 qp_handle; + __u32 con_indx; /* 16 bits valid. */ + __u32 rsvd1; + __u64 rsvd2; +} __attribute__((packed)); + +struct bnxt_re_rc_cqe { + __u32 length; + __u32 imm_key; + __u64 qp_handle; + __u64 mr_handle; +} __attribute__((packed)); + +struct bnxt_re_ud_cqe { + __u32 length; /* 14 bits */ + __u32 immd; + __u64 qp_handle; + __u64 qplo_mac; /* 16:48*/ +} __attribute__((packed)); + +struct bnxt_re_term_cqe { + __u64 qp_handle; + __u32 rq_sq_cidx; + __u32 rsvd; + __u64 rsvd1; +} __attribute__((packed)); + +struct bnxt_re_cutoff_cqe { + __u64 rsvd1; + __u64 rsvd2; + __u64 rsvd3; + __u8 cqe_type_toggle; + __u8 status; + __u16 rsvd4; + __u32 rsvd5; +} __attribute__((packed)); + +/* QP */ +struct bnxt_re_qp_req { + struct ibv_create_qp cmd; + __u64 qpsva; + __u64 qprva; + __u64 qp_handle; +} __attribute__((packed)); + +struct bnxt_re_qp_resp { + struct ibv_create_qp_resp resp; + __u32 qpid; +} __attribute__((packed)); + +enum bnxt_re_modify_ex_mask { + BNXT_RE_MQP_PPP_REQ_EN_MASK = 0x1UL, + BNXT_RE_MQP_PPP_REQ_EN = 0x1UL, + BNXT_RE_MQP_PATH_MTU_MASK = 0x2UL, + BNXT_RE_MQP_PPP_IDX_MASK = 0x7UL, + BNXT_RE_MQP_PPP_STATE = 0x10UL +}; + +/* Modify QP */ +struct bnxt_re_modify_ex_req { + struct ibv_modify_qp_ex cmd; + __aligned_u64 comp_mask; + __u32 dpi; + __u32 rsvd; +}; + +struct bnxt_re_modify_ex_resp { + struct ibv_modify_qp_resp_ex resp; + __aligned_u64 comp_mask; + __u32 ppp_st_idx; + __u32 path_mtu; +}; + +union lower_shdr { + __u64 qkey_len; + __u64 lkey_plkey; + __u64 rva; +}; + +struct bnxt_re_bsqe { + __u32 rsv_ws_fl_wt; + __u32 key_immd; + union lower_shdr lhdr; +} __attribute__((packed)); + +struct bnxt_re_psns_ext { + __u32 opc_spsn; + __u32 flg_npsn; + __u16 st_slot_idx; + __u16 rsvd0; + __u32 rsvd1; +} __attribute__((packed)); + +/* sq_msn_search (size:64b/8B) */ +struct bnxt_re_msns { + __u64 start_idx_next_psn_start_psn; +} __attribute__((packed)); + +struct bnxt_re_psns { + __u32 opc_spsn; + __u32 flg_npsn; +} __attribute__((packed)); + +struct bnxt_re_sge { + __u64 pa; + __u32 lkey; + __u32 length; +} __attribute__((packed)); + +struct bnxt_re_send { + __u32 dst_qp; + __u32 avid; + __u64 rsvd; +} __attribute__((packed)); + +struct bnxt_re_raw { + __u32 cfa_meta; + __u32 rsvd2; + __u64 rsvd3; +} __attribute__((packed)); + +struct bnxt_re_rdma { + __u64 rva; + __u32 rkey; + __u32 rsvd2; +} __attribute__((packed)); + +struct bnxt_re_atomic { + __u64 swp_dt; + __u64 cmp_dt; +} __attribute__((packed)); + +struct bnxt_re_inval { + __u64 rsvd[2]; +} __attribute__((packed)); + +struct bnxt_re_bind { + __u64 va; + __u64 len; /* only 40 bits are valid */ +} __attribute__((packed)); + +struct bnxt_re_brqe { + __u32 rsv_ws_fl_wt; + __u32 rsvd; + __u32 wrid; + __u32 rsvd1; +} __attribute__((packed)); + +struct bnxt_re_rqe { + __u64 rsvd[2]; +} __attribute__((packed)); + +/* SRQ */ +struct bnxt_re_srq_req { + struct ibv_create_srq cmd; + __u64 srqva; + __u64 srq_handle; +} __attribute__((packed)); + +struct bnxt_re_srq_resp { + struct ibv_create_srq_resp resp; + __u32 srqid; +} __attribute__((packed)); + +struct bnxt_re_srqe { + __u64 rsvd[2]; +} __attribute__((packed)); + +struct bnxt_re_push_wqe { + __u64 addr[32]; +} __attribute__((packed));; + +#endif diff --git a/contrib/ofed/libbnxtre/db.c b/contrib/ofed/libbnxtre/db.c new file mode 100644 index 000000000000..8751297c9218 --- /dev/null +++ b/contrib/ofed/libbnxtre/db.c @@ -0,0 +1,566 @@ +/* + * Copyright (c) 2024, Broadcom. All rights reserved. The term + * Broadcom refers to Broadcom Limited and/or its subsidiaries. + * + * 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. + * + * Description: Doorbell handling functions. + */ + +#include +#include + +#include "abi.h" +#include "main.h" + +#define BNXT_RE_DB_FIFO_ROOM_MASK_P5 0x1FFF8000 +#define BNXT_RE_MAX_FIFO_DEPTH_P5 0x2c00 + +#define BNXT_RE_DB_FIFO_ROOM_MASK_P7 0x3FFF8000 +#define BNXT_RE_MAX_FIFO_DEPTH_P7 0x8000 + +#define BNXT_RE_DB_FIFO_ROOM_SHIFT 15 +#define BNXT_RE_DB_THRESHOLD 20 + +#define BNXT_RE_DB_FIFO_ROOM_MASK(ctx) \ + (_is_chip_thor2((ctx)) ? \ + BNXT_RE_DB_FIFO_ROOM_MASK_P7 :\ + BNXT_RE_DB_FIFO_ROOM_MASK_P5) +#define BNXT_RE_MAX_FIFO_DEPTH(ctx) \ + (_is_chip_thor2((ctx)) ? \ + BNXT_RE_MAX_FIFO_DEPTH_P7 :\ + BNXT_RE_MAX_FIFO_DEPTH_P5) + +static uint32_t xorshift32(struct xorshift32_state *state) +{ + /* Algorithm "xor" from p. 4 of Marsaglia, "Xorshift RNGs" */ + uint32_t x = state->seed; + + x ^= x << 13; + x ^= x >> 17; + x ^= x << 5; + return state->seed = x; +} + +static uint16_t rnd(struct xorshift32_state *state, uint16_t range) +{ + /* range must be a power of 2 - 1 */ + return (xorshift32(state) & range); +} + +static int calculate_fifo_occupancy(struct bnxt_re_context *cntx) +{ + uint32_t *dbr_map = cntx->bar_map + 0x1a8; + uint32_t read_val, fifo_occup; + + read_val = *dbr_map; + fifo_occup = BNXT_RE_MAX_FIFO_DEPTH(cntx->cctx) - + ((read_val & BNXT_RE_DB_FIFO_ROOM_MASK(cntx->cctx)) >> + BNXT_RE_DB_FIFO_ROOM_SHIFT); + + return fifo_occup; +} + +static inline uint32_t find_min(uint32_t x, uint32_t y) +{ + return (y > x ? x : y); +} + +int bnxt_re_do_pacing(struct bnxt_re_context *cntx, struct xorshift32_state *state) +{ + /* First 4 bytes of shared page (pacing_info) contains the DBR + * pacing information. Second 4 bytes (pacing_th) contains + * the pacing threshold value to determine whether to + * add delay or not + */ + struct bnxt_re_pacing_data *pacing_data = + (struct bnxt_re_pacing_data *)cntx->dbr_page; + uint32_t wait_time = 1; + uint32_t fifo_occup; + + if (!pacing_data) + return 0; + /* If the device in error recovery state, return error to + * not to ring new doorbells in this state. + */ + if (pacing_data->dev_err_state) + return -EFAULT; + + if (rnd(state, BNXT_RE_MAX_DO_PACING) < pacing_data->do_pacing) { + while ((fifo_occup = calculate_fifo_occupancy(cntx)) + > pacing_data->pacing_th) { + struct bnxt_re_cq *cq; + uint32_t usec_wait; + + if (pacing_data->alarm_th && fifo_occup > pacing_data->alarm_th) { + cq = container_of(cntx->dbr_cq, struct bnxt_re_cq, ibvcq); + bnxt_re_poll_kernel_cq(cq); + } + usec_wait = rnd(state, wait_time - 1); + if (usec_wait) + bnxt_re_sub_sec_busy_wait(usec_wait * 1000); + /* wait time capped at 128 us */ + wait_time = find_min(wait_time * 2, 128); + } + } + return 0; +} + +static inline void bnxt_re_ring_db(struct bnxt_re_dpi *dpi, __u64 key, + uint64_t *db_key, uint8_t *lock) +{ + while (1) { + if (__sync_bool_compare_and_swap(lock, 0, 1)) { + *db_key = key; + bnxt_re_wm_barrier(); + iowrite64(dpi->dbpage, key); + bnxt_re_wm_barrier(); + *lock = 0; + break; + } + } +} + +static inline void bnxt_re_init_push_hdr(struct bnxt_re_db_hdr *hdr, + uint32_t indx, uint32_t qid, + uint32_t typ, uint32_t pidx) +{ + __u64 key_lo, key_hi; + + key_lo = (((pidx & BNXT_RE_DB_PILO_MASK) << BNXT_RE_DB_PILO_SHIFT) | + (indx & BNXT_RE_DB_INDX_MASK)); + key_hi = ((((pidx & BNXT_RE_DB_PIHI_MASK) << BNXT_RE_DB_PIHI_SHIFT) | + (qid & BNXT_RE_DB_QID_MASK)) | + ((typ & BNXT_RE_DB_TYP_MASK) << BNXT_RE_DB_TYP_SHIFT) | + (0x1UL << BNXT_RE_DB_VALID_SHIFT)); + hdr->typ_qid_indx = htole64((key_lo | (key_hi << 32))); +} + +static inline void bnxt_re_init_db_hdr(struct bnxt_re_db_hdr *hdr, + uint32_t indx, uint32_t toggle, + uint32_t qid, uint32_t typ) +{ + __u64 key_lo, key_hi; + + key_lo = htole32(indx | toggle); + key_hi = ((qid & BNXT_RE_DB_QID_MASK) | + ((typ & BNXT_RE_DB_TYP_MASK) << BNXT_RE_DB_TYP_SHIFT) | + (0x1UL << BNXT_RE_DB_VALID_SHIFT)); + hdr->typ_qid_indx = htole64((key_lo | (key_hi << 32))); +} + +static inline void __bnxt_re_ring_pend_db(__u64 *ucdb, __u64 key, + struct bnxt_re_qp *qp) +{ + struct bnxt_re_db_hdr hdr; + + bnxt_re_init_db_hdr(&hdr, + (*qp->jsqq->hwque->dbtail | + ((qp->jsqq->hwque->flags & + BNXT_RE_FLAG_EPOCH_TAIL_MASK) << + BNXT_RE_DB_EPOCH_TAIL_SHIFT)), 0, + qp->qpid, + BNXT_RE_QUE_TYPE_SQ); + + while (1) { + if (__sync_bool_compare_and_swap(&qp->sq_dbr_lock, 0, 1)) { + qp->sq_shadow_db_key = hdr.typ_qid_indx; + bnxt_re_wm_barrier(); + iowrite64(ucdb, key); + bnxt_re_wm_barrier(); + qp->sq_dbr_lock = 0; + break; + } + } +} + +void bnxt_re_ring_rq_db(struct bnxt_re_qp *qp) +{ + struct bnxt_re_db_hdr hdr; + + if (bnxt_re_do_pacing(qp->cntx, &qp->rand)) + return; + bnxt_re_init_db_hdr(&hdr, + (*qp->jrqq->hwque->dbtail | + ((qp->jrqq->hwque->flags & + BNXT_RE_FLAG_EPOCH_TAIL_MASK) << + BNXT_RE_DB_EPOCH_TAIL_SHIFT)), 0, + qp->qpid, + BNXT_RE_QUE_TYPE_RQ); + bnxt_re_ring_db(qp->udpi, hdr.typ_qid_indx, &qp->rq_shadow_db_key, + &qp->rq_dbr_lock); +} + +void bnxt_re_ring_sq_db(struct bnxt_re_qp *qp) +{ + struct bnxt_re_db_hdr hdr; + + if (bnxt_re_do_pacing(qp->cntx, &qp->rand)) + return; + bnxt_re_init_db_hdr(&hdr, + (*qp->jsqq->hwque->dbtail | + ((qp->jsqq->hwque->flags & + BNXT_RE_FLAG_EPOCH_TAIL_MASK) << + BNXT_RE_DB_EPOCH_TAIL_SHIFT)), 0, + qp->qpid, + BNXT_RE_QUE_TYPE_SQ); + bnxt_re_ring_db(qp->udpi, hdr.typ_qid_indx, &qp->sq_shadow_db_key, + &qp->sq_dbr_lock); +} + +void bnxt_re_ring_srq_db(struct bnxt_re_srq *srq) +{ + struct bnxt_re_db_hdr hdr; + + if (bnxt_re_do_pacing(srq->uctx, &srq->rand)) + return; + bnxt_re_init_db_hdr(&hdr, + (srq->srqq->tail | + ((srq->srqq->flags & + BNXT_RE_FLAG_EPOCH_TAIL_MASK) << + BNXT_RE_DB_EPOCH_TAIL_SHIFT)), 0, + srq->srqid, BNXT_RE_QUE_TYPE_SRQ); + bnxt_re_ring_db(srq->udpi, hdr.typ_qid_indx, &srq->shadow_db_key, + &srq->dbr_lock); +} + +void bnxt_re_ring_srq_arm(struct bnxt_re_srq *srq) +{ + struct bnxt_re_db_hdr hdr; + + if (bnxt_re_do_pacing(srq->uctx, &srq->rand)) + return; + bnxt_re_init_db_hdr(&hdr, srq->cap.srq_limit, 0, srq->srqid, + BNXT_RE_QUE_TYPE_SRQ_ARM); + bnxt_re_ring_db(srq->udpi, hdr.typ_qid_indx, &srq->shadow_db_key, + &srq->dbr_lock); +} + +void bnxt_re_ring_cq_db(struct bnxt_re_cq *cq) +{ + struct bnxt_re_db_hdr hdr; + + if (bnxt_re_do_pacing(cq->cntx, &cq->rand)) + return; + bnxt_re_init_db_hdr(&hdr, + (cq->cqq->head | + ((cq->cqq->flags & + BNXT_RE_FLAG_EPOCH_HEAD_MASK) << + BNXT_RE_DB_EPOCH_HEAD_SHIFT)), 0, + cq->cqid, + BNXT_RE_QUE_TYPE_CQ); + bnxt_re_ring_db(cq->udpi, hdr.typ_qid_indx, &cq->shadow_db_key, + &cq->dbr_lock); +} + +void bnxt_re_ring_cq_arm_db(struct bnxt_re_cq *cq, uint8_t aflag) +{ + uint32_t *cq_page = cq->cq_page; + struct bnxt_re_db_hdr hdr; + uint32_t toggle = 0; + + if (cq_page) + toggle = *cq_page; + + if (bnxt_re_do_pacing(cq->cntx, &cq->rand)) + return; + bnxt_re_init_db_hdr(&hdr, + (cq->cqq->head | + ((cq->cqq->flags & + BNXT_RE_FLAG_EPOCH_HEAD_MASK) << + BNXT_RE_DB_EPOCH_HEAD_SHIFT)), + toggle << BNXT_RE_DB_TOGGLE_SHIFT, + cq->cqid, aflag); + bnxt_re_ring_db(cq->udpi, hdr.typ_qid_indx, &cq->shadow_db_key, + &cq->dbr_lock); +} + +void bnxt_re_ring_pstart_db(struct bnxt_re_qp *qp, + struct bnxt_re_push_buffer *pbuf) +{ + __u64 key; + + if (bnxt_re_do_pacing(qp->cntx, &qp->rand)) + return; + key = ((((pbuf->wcdpi & BNXT_RE_DB_PIHI_MASK) << + BNXT_RE_DB_PIHI_SHIFT) | (pbuf->qpid & BNXT_RE_DB_QID_MASK)) | + ((BNXT_RE_PUSH_TYPE_START & BNXT_RE_DB_TYP_MASK) << + BNXT_RE_DB_TYP_SHIFT) | (0x1UL << BNXT_RE_DB_VALID_SHIFT)); + key <<= 32; + key |= ((((__u32)pbuf->wcdpi & BNXT_RE_DB_PILO_MASK) << + BNXT_RE_DB_PILO_SHIFT) | (pbuf->st_idx & + BNXT_RE_DB_INDX_MASK)); + bnxt_re_wm_barrier(); + iowrite64(pbuf->ucdb, key); +} + +void bnxt_re_ring_pend_db(struct bnxt_re_qp *qp, + struct bnxt_re_push_buffer *pbuf) +{ + __u64 key; + + if (bnxt_re_do_pacing(qp->cntx, &qp->rand)) + return; + key = ((((pbuf->wcdpi & BNXT_RE_DB_PIHI_MASK) << + BNXT_RE_DB_PIHI_SHIFT) | (pbuf->qpid & BNXT_RE_DB_QID_MASK)) | + ((BNXT_RE_PUSH_TYPE_END & BNXT_RE_DB_TYP_MASK) << + BNXT_RE_DB_TYP_SHIFT) | (0x1UL << BNXT_RE_DB_VALID_SHIFT)); + key <<= 32; + key |= ((((__u32)pbuf->wcdpi & BNXT_RE_DB_PILO_MASK) << + BNXT_RE_DB_PILO_SHIFT) | (pbuf->tail & + BNXT_RE_DB_INDX_MASK)); + __bnxt_re_ring_pend_db(pbuf->ucdb, key, qp); +} + +void bnxt_re_fill_ppp(struct bnxt_re_push_buffer *pbuf, + struct bnxt_re_qp *qp, uint8_t len, uint32_t idx) +{ + struct bnxt_re_db_ppp_hdr phdr = {}; + __u64 *dst, *src; + __u8 plen; + int indx; + + src = (__u64 *)&phdr; + plen = len + sizeof(phdr) + bnxt_re_get_sqe_hdr_sz(); + + bnxt_re_init_db_hdr(&phdr.db_hdr, + (*qp->jsqq->hwque->dbtail | + ((qp->jsqq->hwque->flags & + BNXT_RE_FLAG_EPOCH_TAIL_MASK) << + BNXT_RE_DB_EPOCH_TAIL_SHIFT)), 0, + qp->qpid, + BNXT_RE_QUE_TYPE_SQ); + + phdr.rsv_psz_pidx = ((pbuf->st_idx & BNXT_RE_DB_INDX_MASK) | + (((plen % 8 ? (plen / 8) + 1 : + plen / 8) & BNXT_RE_PUSH_SIZE_MASK) << + BNXT_RE_PUSH_SIZE_SHIFT)); + + bnxt_re_wm_barrier(); + for (indx = 0; indx < 2; indx++) { + dst = (__u64 *)(pbuf->pbuf + indx); + iowrite64(dst, *src); + src++; + } + bnxt_re_copy_data_to_pb(pbuf, 1, idx); + mmio_flush_writes(); +} + +void bnxt_re_fill_push_wcb(struct bnxt_re_qp *qp, + struct bnxt_re_push_buffer *pbuf, uint32_t idx) +{ + bnxt_re_ring_pstart_db(qp, pbuf); + mmio_wc_start(); + bnxt_re_copy_data_to_pb(pbuf, 0, idx); + /* Flush WQE write before push end db. */ + mmio_flush_writes(); + bnxt_re_ring_pend_db(qp, pbuf); +} + +int bnxt_re_init_pbuf_list(struct bnxt_re_context *ucntx) +{ + struct bnxt_re_push_buffer *pbuf; + int indx, wqesz; + int size, offt; + __u64 wcpage; + __u64 dbpage; + void *base; + + size = (sizeof(*ucntx->pbrec) + + 16 * (sizeof(*ucntx->pbrec->pbuf) + + sizeof(struct bnxt_re_push_wqe))); + ucntx->pbrec = calloc(1, size); + if (!ucntx->pbrec) + goto out; + + offt = sizeof(*ucntx->pbrec); + base = ucntx->pbrec; + ucntx->pbrec->pbuf = (base + offt); *** 4326 LINES SKIPPED *** From nobody Tue Jul 9 13:09:42 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJLtb1l5Tz5QMQt; Tue, 09 Jul 2024 13:09:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJLtb1CSpz4G2j; Tue, 9 Jul 2024 13:09:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720530583; 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: in-reply-to:in-reply-to:references:references; bh=u7bVwbhVbEr293rwMgokrE0CgyZjjH1bFju8+Afqn4o=; b=ICBUG1IlfVE4yUyl2HzMPG7pOLEM1WvT32YfWwB3+pl6NIYv+FF7DznLNf0fD9/2wSS2zw 74f0YRz3iCCZ2dbySFZAljND09VKtNhADT63vbF0XIGtrwRYNGQ6LG+thkXGLr50yDpZIg +pkTpTWzVeauG4pHhymz5M6lukzk2l14CfcW0voVzhvENWRj0xhJQtKHOsVbQMUo1OleHX 4b8zRFlenOu7J5QLxqPl4UluHmO6EG1mg1jhFr3Mqd8u21IT4XaHRkFYPlJMVcBQMELTpQ YE1sQ2hXvZP49PzHySu8EdFwqynFVAP8fhyMlQFML1Xy9rj/YMvZS2Tw2jOOnw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720530583; a=rsa-sha256; cv=none; b=G9CSxu789D2wuWFIrmx5BKvsPvYwqUqUJvzgpRkLrP9DKkBusIgUPm9YnHoivOw+Y6rVy0 O2ihASc2BRLZ9hSRyyG6oQlIZDZPC7v7aMU55zfw/DrxPdnnLfz41FKE+MOx3tfUZ2NVuY iWjhs1x7TtFOmwcPFlH43sluU9Yxf9S3tCGaIYquJbJTChmiwvC2wTD9YBy80EjeZ1gcmW i/P5uRCXf4dMaHp8d7pwEhETFHCC9ayMplAFYwkdXoR6DCtkqfB6Hk5QiZjap+GrkgjfdX v+UaSkRfEpGeIvDtsxhMFx7NRo8Q1M1OQk4+ojSIlKlOqBMeUpUgLp/7a8GZCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720530583; 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: in-reply-to:in-reply-to:references:references; bh=u7bVwbhVbEr293rwMgokrE0CgyZjjH1bFju8+Afqn4o=; b=HL47lin6Ds9OSBjBIrKQ+gu5+eu1Ebrg7blQ5ctrNywBwNqd3RmU6yEd1eX7ZlafT7CHka 4pZhcXiDhnOIOOUl6Dvw6BvNe5i6F8ZUSqH4ANPSQjIUsH/n8zYyLC+NGX4W9PA9rGVx8o GJgAL7Z635t3depMKMgx+hByV9s8obJIGzYAsSZhHnwK3Nf53/0y0nyJr0jRQA0lD2REEF AYwA5nSzqOo7koMt7tdoy/FtBGRkxdL6FPnvsNP/+S5jgW9am0FsBR0nTCvWW5IF99yhnr 0bkF9Ou1vbqsDg1Dj+m3uL40DFfZULR+otC41Pcv6hv+jpZS/UhRY6K/Bu8qkA== Received: from [IPV6:2601:5c0:4200:b830:8032:a6a1:7c58:76b9] (unknown [IPv6:2601:5c0:4200:b830:8032:a6a1:7c58:76b9]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4WJLtZ6PsVz1K1L; Tue, 9 Jul 2024 13:09:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <8b3bd285-ce3e-4958-9bd4-ac486eda5ebb@FreeBSD.org> Date: Tue, 9 Jul 2024 09:09:42 -0400 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: 4122295afcbf - main - cdefs(9): Start to document what sys/cdefs.h does Content-Language: en-US To: Warner Losh , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202407082254.468MsOMU064769@gitrepo.freebsd.org> From: John Baldwin In-Reply-To: <202407082254.468MsOMU064769@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 7/8/24 18:54, Warner Losh wrote: > The branch main has been updated by imp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=4122295afcbf4b7ad0623bbf35f36dc3278ac028 > > commit 4122295afcbf4b7ad0623bbf35f36dc3278ac028 > Author: Warner Losh > AuthorDate: 2024-07-02 22:45:49 +0000 > Commit: Warner Losh > CommitDate: 2024-07-08 22:54:02 +0000 > > cdefs(9): Start to document what sys/cdefs.h does > > --- > share/man/man9/Makefile | 1 + > share/man/man9/cdefs.9 | 405 ++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 406 insertions(+) > > diff --git a/share/man/man9/cdefs.9 b/share/man/man9/cdefs.9 > new file mode 100644 > index 000000000000..a065e0bd7d1d > --- /dev/null > +++ b/share/man/man9/cdefs.9 > @@ -0,0 +1,405 @@ > +.Sh Supported Compilers > +.Bl -tag -offset 2n -width 0 > +.It Compilers supported for building programs on Fx : > +.Bl -column -offset 0n indent-two > +.It Sy Compiler Ta Sy Versions > +.It gcc Ta 9, 10, 11, 12, 13, 14 > +.It clang Ta 10, 11, 12, 13, 14, 15, 16, 17, 18 > +.It TinyC (tcc) Ta 0.9 > +.It pcc Ta 1.1 > +.El > +.Pp > +Due to testing constraints, tcc and pcc may not always work. > +.It Compilers supported for building Fx itself: > +.Bl -column -offset 0n indent-two > +.It Sy Compiler Ta Sy Versions > +.It gcc Ta 12, 13 > +.It clang Ta 16, 17, 19 s/19/18/? -- John Baldwin From nobody Tue Jul 9 14:33:02 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJNkk6ppjz5QVxG; Tue, 09 Jul 2024 14:33:02 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJNkk5vp0z4PGJ; Tue, 9 Jul 2024 14:33:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720535582; 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=tUqa9h0WZSJMEdxPmyaxKoPM9B3SU0KImnlHOe0fL4I=; b=q7RMJSDVx+kHgUvHjh9I/Ldu6HHcAVwcsb+eDr/yeqXkTbP/xU05d/YC77AB62qfIkapUy MskkQzRY1pC/7RZZbHbF6vWEHibEjtwrLeSuCAN79U4uORlNOKkca1bzK4Yn0qqfLTRZHm rOBK6xgyRvl5hyObXHfGIBgQi6iPzjki2Jt/iIdRel+F+S1jmdoHevM8AJzT9492YJ4ArY 9e6TyXkkTDx9bTa1UVkLrdnJ5tEKgkOtKofveuSuxKUkvd6R16vIhKOplu6idXUEANWC8S mCTNQ8tKT+KZ8i/qWsLnHK0bqYPiYoDXUdBvNEtYvNrLUMCzc5V61vP+vXgn4A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720535582; a=rsa-sha256; cv=none; b=BtbevC4mAEp/WpjHNiSKnfi4TWXQeW72Hugd3w+VIt+7VlNJFJlYT7mR/eCp/oCt4p9C5i GeuMvjomI7VRJUEs2o+XGvgKbJFGUZxNgaIUKw8zgWxgjpkPiSSfS3W4noTplVapw1b6+b fCgd4sa7zWeebcEe1S53hd4I8MYe1M8K+Vn2F6rTScrZPfMN8ztYKKph8DE2GfcvQSNNUL 62KRO47W4E8YsGF/ToMtAarVhweMnr+iAIFdj0GbHyIFXEW7sjCcQ+1grDw/UreWe1C+jT rCEtaRb52hNkXfrrFJuYv4Uac+parP6pN5ISDSCtt9VHv5srpiFL4lWvbfgdEA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720535582; 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=tUqa9h0WZSJMEdxPmyaxKoPM9B3SU0KImnlHOe0fL4I=; b=yju6F5dXsqzjJjACVJvwZh26GQw46wsgz6IEakZmeLAN0jmWMnjI/DlkhMonJyqmWgPZVa OrVXDwbJIfxncfDcaBCZ4/P8dUBhW0FDabYTJ/CvwE+dbvADAorQaovjQZSvm4FAJI2TrN LI/YnY7mDLwb2M5KacS5wQqV0x4/ci9vKeMmO0/rEJWknsqAdDyc0VBhifB2NNRnpkgBbH Se8UO9bTXw1EypWs08Gtpud9+pwPD+FlBN98I+YQeR0jOL1qfavx+AjL0rWkorEm2jWY19 al82AhennZkPt/5J2Zxfm5PoXAd7D7Q3EiHBSqGK012kzbc5yQgWQ1AaP8OXUw== 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 4WJNkk5WJ2zf0n; Tue, 9 Jul 2024 14:33: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 469EX2tZ063431; Tue, 9 Jul 2024 14:33:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 469EX2XU063428; Tue, 9 Jul 2024 14:33:02 GMT (envelope-from git) Date: Tue, 9 Jul 2024 14:33:02 GMT Message-Id: <202407091433.469EX2XU063428@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5dc4682c3269 - main - if_urndis: Organize buffer layouts more naturally List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5dc4682c32691b9d0a20abdc5479d6ce2b36915e Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5dc4682c32691b9d0a20abdc5479d6ce2b36915e commit 5dc4682c32691b9d0a20abdc5479d6ce2b36915e Author: Mark Johnston AuthorDate: 2024-07-09 14:10:45 +0000 Commit: Mark Johnston CommitDate: 2024-07-09 14:26:16 +0000 if_urndis: Organize buffer layouts more naturally - Group the request header and I/O buffer in one structure, rather than assuming that both request structures have the same size. - Pass a pointer to the whole structure to urndis_ctrl_query() and urndis_ctrl_set() rather than just the header. Otherwise, on CHERI platforms, these functions violate subobject bounds since they modify the buffer following the header. While here, there is no apparent reason for the request structure used in urndis_attach() to be allocated statically. Change it so that it's allocated on the stack. No functional change intended. Reviewed by: jhb MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D45866 --- sys/dev/usb/net/if_urndis.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sys/dev/usb/net/if_urndis.c b/sys/dev/usb/net/if_urndis.c index 824609aa869f..0a7cb3fed953 100644 --- a/sys/dev/usb/net/if_urndis.c +++ b/sys/dev/usb/net/if_urndis.c @@ -214,15 +214,15 @@ urndis_attach_post(struct usb_ether *ue) static int urndis_attach(device_t dev) { - static struct { - union { + union { + struct { struct rndis_query_req query; + uint8_t addr[ETHER_ADDR_LEN]; + } eaddr; + struct { struct rndis_set_req set; - } hdr; - union { - uint8_t eaddr[ETHER_ADDR_LEN]; uint32_t filter; - } ibuf; + } filter; } msg; struct urndis_softc *sc = device_get_softc(dev); struct usb_ether *ue = &sc->sc_ue; @@ -278,10 +278,10 @@ urndis_attach(device_t dev) } /* Determine MAC address */ - memset(msg.ibuf.eaddr, 0, sizeof(msg.ibuf.eaddr)); + memset(msg.eaddr.addr, 0, sizeof(msg.eaddr.addr)); URNDIS_LOCK(sc); error = urndis_ctrl_query(sc, OID_802_3_PERMANENT_ADDRESS, - &msg.hdr.query, sizeof(msg.hdr.query) + sizeof(msg.ibuf.eaddr), + (struct rndis_query_req *)&msg.eaddr, sizeof(msg.eaddr), &buf, &bufsz); URNDIS_UNLOCK(sc); if (error != (int)RNDIS_STATUS_SUCCESS) { @@ -297,10 +297,10 @@ urndis_attach(device_t dev) /* Initialize packet filter */ sc->sc_filter = NDIS_PACKET_TYPE_BROADCAST | NDIS_PACKET_TYPE_ALL_MULTICAST; - msg.ibuf.filter = htole32(sc->sc_filter); + msg.filter.filter = htole32(sc->sc_filter); URNDIS_LOCK(sc); error = urndis_ctrl_set(sc, OID_GEN_CURRENT_PACKET_FILTER, - &msg.hdr.set, sizeof(msg.hdr.set) + sizeof(msg.ibuf.filter)); + (struct rndis_set_req *)&msg.filter, sizeof(msg.filter)); URNDIS_UNLOCK(sc); if (error != (int)RNDIS_STATUS_SUCCESS) { device_printf(dev, "Unable to set data filters\n"); @@ -641,7 +641,7 @@ urndis_ctrl_handle_reset(struct urndis_softc *sc, msg_filter.filter = htole32(sc->sc_filter); rval = urndis_ctrl_set(sc, OID_GEN_CURRENT_PACKET_FILTER, - &msg_filter.hdr, sizeof(msg_filter)); + (struct rndis_set_req *)&msg_filter, sizeof(msg_filter)); if (rval != RNDIS_STATUS_SUCCESS) { DPRINTF("unable to reset data filters\n"); From nobody Tue Jul 9 14:34:50 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJNmp5dXXz5QVkM; Tue, 09 Jul 2024 14:34: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJNmp59XZz4PW7; Tue, 9 Jul 2024 14:34:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720535690; 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=Q0pHLloxtyUXTPnxB+3XyjUrOGfR9awe7L6JvQrs8bg=; b=rHkKwJR6W8hXPurErKtkEZdlAY5afakvtfVFlErfFBAObRcQn+j8yChghV9AQCQl2Msu83 qh3HxGzPMprXMYxFSpUoNXcFT+s7CPM5k7Nmdgjg6pt3u/HKpQsR7wyN7glqcVhO50CVv3 lh1mTBhfiOWo/7EM/BCNAXqWLRaguQHpO0rIQzXxA3E4VE2ulhQIzahT/ga2bKjizu+fVk WiFDjzmXwkIlaPlqTgvBu7ELTgKmNH6ngKFot2KGa1p1OlYDJT0vVCC4XlLMeJLPQevIQ7 LfBRl2euvZZfcL2a1NNGt/L8dtvgbieZQO9BzSGucpA/OQSbB4M5HRVEwXAOGw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720535690; a=rsa-sha256; cv=none; b=nGBGfY8R0dT7dJaODWL8wzF7Vz3wD24Pa0VPRHuHVKgYoB7uWqC3BxkIqJ59G9TfMrgdDN CyxJza5+4vd7nzl6W5DW5QOd6SA3F01eOW1vHX/JY19Zr0291/GmeSXJujgp59/pQ9dOtE BLCESIbYbNMHvQCACMqXKBd+shLhaQh5Z7DS2T5zZqZd024wZJ2HRfotjYxHilFtpK9waL uq+0PGEW+Dpuhi3G+2Di3Xuhgb8ixX/aMuUCsltJpLUX+lrlO6yyZ0z8Q2qx6Yd64X9XGZ cNRHLRFJvC508FkFKSO2qvzANIlEJJ57aUiTrvG9T3aXH617XtIWxNIqz764Xg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720535690; 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=Q0pHLloxtyUXTPnxB+3XyjUrOGfR9awe7L6JvQrs8bg=; b=vct0ULOWDyg/1fTM/kyyicFaxTdrIycHcAWvtCJ9rpIzfFuE+WtGbpIZj+9Bb7JWrIHyP8 zMtipuoUyLfwrnBoGkB665GhsX7lT7qwkMwQ97OkA3oRVdv74WYyqCo2vI2CwBAeGrs8fp RhDYC+sPD3cuYeNV90HgbCl+WTeu7IraVbCWtTZVbGyK4y1aqzmheHj5hJSiwvRBaARuS0 xbSSTHDJ9M7YSVaH1zK0APlAKYqiuEuurjaSUpGPCZ7eewal8IX9wove688nvuEl8uTsoZ YBaHhIBce1mqPBcGAwWssj3WkWNid8ieixQ8m9FPkbsz6/9Sj417anRsEE95Eg== 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 4WJNmp4lvkzdcj; Tue, 9 Jul 2024 14:34: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 469EYojS063884; Tue, 9 Jul 2024 14:34:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 469EYo3u063881; Tue, 9 Jul 2024 14:34:50 GMT (envelope-from git) Date: Tue, 9 Jul 2024 14:34:50 GMT Message-Id: <202407091434.469EYo3u063881@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 30f30ccae71c - main - socket: Simplify synchronization in soreceive_stream() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 30f30ccae71ce6b3bbe7b2719a3d588cb46f97ba Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=30f30ccae71ce6b3bbe7b2719a3d588cb46f97ba commit 30f30ccae71ce6b3bbe7b2719a3d588cb46f97ba Author: Mark Johnston AuthorDate: 2024-07-09 14:33:53 +0000 Commit: Mark Johnston CommitDate: 2024-07-09 14:33:53 +0000 socket: Simplify synchronization in soreceive_stream() Now that the socket recv I/O lock is required in order to enable receive-side KTLS, we can move a check from out of the socket buffer lock, which in turn will simplify some further refactoring. Add a __predict_false annotation while here since we already perform a lockless check before acquiring any locks. Reviewed by: gallatin, jhb MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45922 --- sys/kern/uipc_socket.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index f0d22b3887a4..0350a5eb4d87 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -2609,17 +2609,15 @@ soreceive_stream(struct socket *so, struct sockaddr **psa, struct uio *uio, error = SOCK_IO_RECV_LOCK(so, SBLOCKWAIT(flags)); if (error) return (error); - SOCKBUF_LOCK(sb); - #ifdef KERN_TLS - if (sb->sb_tls_info != NULL) { - SOCKBUF_UNLOCK(sb); + if (__predict_false(sb->sb_tls_info != NULL)) { SOCK_IO_RECV_UNLOCK(so); return (soreceive_generic(so, psa, uio, mp0, controlp, flagsp)); } #endif + SOCKBUF_LOCK(sb); /* Easy one, no space to copyout anything. */ if (uio->uio_resid == 0) { error = EINVAL; From nobody Tue Jul 9 18:45:16 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJVKm2ryTz5Qssg; Tue, 09 Jul 2024 18:45: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJVKm22Ftz4klM; Tue, 9 Jul 2024 18:45:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720550716; 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=nv8RjBoKswA7henunAwXOK54s0op8Vxa98USsDESIAc=; b=Mb1JEobjryCRmK8iG5j/yAUBJli+wRMOJt0dJffaV9shDYiCF2luQJLCeAFmn2KO0v0l/3 XgNfQYTFRWdD8uRU5MQ5TtpwdRG1zlo2up/uNsYz6TujHbTKeXCt7f5x/xj6Xg4wX7CQhh ys8phsmvXUE3qvIRduWSR3U8KDzICk/W81CkeeChVAvu4PpPtD4FIPZcWi92fEVZ7WZ24v pejI/WOUSjAJlkGosqnBvGXVgAUQQZbI97vX2coK0ao4zWB4mtwBd5yXyo6im+fhaDcvte wGLdwlVTRQS7lmqbXIRTH53iJ+FR9yfD1DeTQy82CcQLd+72tuGPFdIhZyefNw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720550716; a=rsa-sha256; cv=none; b=IcdJhyN7FVScAuy73Iy4ddK4FUXXLS7AgTZtq5DfEn1ZWQSMrwKrbhisbx5hx6Xf6Z1isb Kfse/vQyfYkm8pUZIwUyhyEKYO70AM+S1H43svS5cN9fwRYIgllAuMgctvZ2LUZlHHvftb +oG415xMJ1hJfw8j66APKePalo566tNtYRbu17ojkHJm5spNtAvjwNDll75xaCjaFv5Y0d VbPur4zdSQW6H3o/pKvoi5xD09GPeLIEWK8ZAxtwEqBoDxTREJJlszWYJYXzRe8o549OX/ nrr6FzLJ6cOb1xhXOrTrrSmPT6vhU+s7Vp6f8lG2yjiWpUry+WrY2QyKyi7lGA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720550716; 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=nv8RjBoKswA7henunAwXOK54s0op8Vxa98USsDESIAc=; b=pvIL7YYc96xeL+xKS6ecPHeE3a0Qo1DTMvoSW5iQSAzw3zvffKRNbttTCmETHrMkdS3RxY Jq/L5zWAvSCy841XIZ2NFOLpPVcUkZDhSzJNVhUCcBsa9itTQ88wH/af5ngCZ04waOHtDA 903XAo8WDFstyJy0i1RtZcEzxCPLpljx6t8alKGKDhLoo8C9bl+45x30xVDiJNBgZemWOD PKiva6UqAOZmKUJjbnNe64DDcO1ABFP5U6ZaAbLXqtJNN1uhvNp328MtsDCd+tKffJgj9s jp+v7LafQD4Mqg4eH88je3DIbWkih8k9QFcXfGXTa1wUY43NiYaNJQ4XEvNGpg== 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 4WJVKm1Wcpzlk4; Tue, 9 Jul 2024 18:45: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 469IjG27087497; Tue, 9 Jul 2024 18:45:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 469IjG0D087494; Tue, 9 Jul 2024 18:45:16 GMT (envelope-from git) Date: Tue, 9 Jul 2024 18:45:16 GMT Message-Id: <202407091845.469IjG0D087494@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Libby Subject: git: 2207aaba8977 - main - kern_exec.c: quiet gcc -Wmaybe-uninitialized List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rlibby X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2207aaba8977a91f5e076beeeba2e4a47f4f7379 Auto-Submitted: auto-generated The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=2207aaba8977a91f5e076beeeba2e4a47f4f7379 commit 2207aaba8977a91f5e076beeeba2e4a47f4f7379 Author: Ryan Libby AuthorDate: 2024-07-09 17:57:33 +0000 Commit: Ryan Libby CommitDate: 2024-07-09 17:57:33 +0000 kern_exec.c: quiet gcc -Wmaybe-uninitialized Reported by: GCC -Wmaybe-uninitialized Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D45916 --- sys/kern/kern_exec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 6727872b5b10..63f007624e36 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1952,6 +1952,7 @@ compress_chunk(struct coredump_params *cp, char *base, char *buf, size_t len) size_t chunk_len; int error; + error = 0; while (len > 0) { chunk_len = MIN(len, CORE_BUF_SIZE); @@ -1997,6 +1998,7 @@ core_output(char *base, size_t len, off_t offset, struct coredump_params *cp, if (cp->comp != NULL) return (compress_chunk(cp, base, tmpbuf, len)); + error = 0; map = &cp->td->td_proc->p_vmspace->vm_map; for (; len > 0; base += runlen, offset += runlen, len -= runlen) { /* From nobody Tue Jul 9 18:45:17 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJVKn3Cb9z5QtF5; Tue, 09 Jul 2024 18:45:17 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJVKn2VR3z4kj0; Tue, 9 Jul 2024 18:45:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720550717; 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=PJCaPDAKvPQbXP5oqpdr27NA8V+8cn++mqcNN8C12Ig=; b=WNb8zIFA6BD1OgAsNj2Pq8ufx7H1uQ3ogyjdLjAujUnOzKoVyaelnysxHjsWC+dYGyAcYX unvgWWl0pfl2N3PBgKKdPj8xiYvZFeioqO00MgmTz8T4GfTqR3dMN3ys59onJl1sapBeGn Yp0GPXu7yFPPndYkxWX4u//MfDPO0xRukb5Ji16LoY0sTj5/ro9CdhqQAbxQNdB4ugmZW0 ztYHBnAWy89OetPUISfTNzxSh9tRfN24XHkDzYNiciOF1xfFU8DHMj0XYduWXMCi5+od/w j8fPVodHMRNX8QaP/m12bXFP19k4tWXDAFkiGjxc13Lj9fYvUjtJeZIG8SKMgg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720550717; a=rsa-sha256; cv=none; b=wfmeV2MRw/oKGp2XlrL6n3sohuLybtx542mS3CXoJaP2dL6emO0jIoJtWJY96aDfQvt8GG DGuZZkNOIVwK53EvxwODp50cPTaCZggQ3ACxVZSxrvkEITCM+Miq+mnTnTtvU1qUPmH9Pb usS9OIZfGw1p3HYdgpUxNrOu5AxXkh3s7pqWIvuV3sMGdGsrVVygATcVJz6R+3y1q3nNo+ OFCGcW+2eMoYY4ugrR8ec3FQBaQO3p4sTicmbVjq551zTHn1ZiMqYwV+HzhNhv6hBaIboZ 0FaToaZJUSTiKCKZSfErAPHlPVtkPG9btTxnwe+XyzkIR12VOn3rmjkg4qWN5w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720550717; 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=PJCaPDAKvPQbXP5oqpdr27NA8V+8cn++mqcNN8C12Ig=; b=q3t+OFzwn/r/n+H/kiWw6xGxJT+FZgMjw2KvGlCmapewqotVhznuLvpRYIXdWe93mCdj5l Fz0tBjghU768lOxTLpf1qVcOC+1Hla6mRn5M4DOdwyHKMGNUQB/KNH6LFmyiCSIDBVb2Ch +GJYTN0ap2R7zf1sHaa3A22QYC+mJXWNotg+vX5/FNPC9a890XIcnKhge0umvpXx7lcgmL hgeSfc/ni+/GvhoeRnsXALSAVZ2L5fJtPQT+Zv9m28/JXHm3QKbcmV6hPWmFgrk4mQ2gK4 GwaKiaSBAFHkqv4mrBHbV6BhBNs02vL/93dqw10Ni7QAztRlAw1lBqjSrchNcg== 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 4WJVKn25rlzlk5; Tue, 9 Jul 2024 18:45: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 469IjHKF087536; Tue, 9 Jul 2024 18:45:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 469IjHgB087533; Tue, 9 Jul 2024 18:45:17 GMT (envelope-from git) Date: Tue, 9 Jul 2024 18:45:17 GMT Message-Id: <202407091845.469IjHgB087533@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Libby Subject: git: ff1c63671b73 - main - kdb_sysctl_trap: suppress gcc -Warray-bounds List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rlibby X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ff1c63671b7372ef7d52da11d02e082876c22654 Auto-Submitted: auto-generated The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=ff1c63671b7372ef7d52da11d02e082876c22654 commit ff1c63671b7372ef7d52da11d02e082876c22654 Author: Ryan Libby AuthorDate: 2024-07-09 17:58:21 +0000 Commit: Ryan Libby CommitDate: 2024-07-09 17:58:21 +0000 kdb_sysctl_trap: suppress gcc -Warray-bounds gcc diagnosed a dereference of 0x10 with -Warray-bounds, which is entirely sensible, except that this is a deliberate trap. Throw gcc off with a volatile pointer. Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D45917 --- sys/kern/subr_kdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/subr_kdb.c b/sys/kern/subr_kdb.c index a7fc2284cbcf..56264a96c9fa 100644 --- a/sys/kern/subr_kdb.c +++ b/sys/kern/subr_kdb.c @@ -238,7 +238,7 @@ static int kdb_sysctl_trap(SYSCTL_HANDLER_ARGS) { int error, i; - int *addr = (int *)0x10; + int *volatile addr = (int *)0x10; error = sysctl_wire_old_buffer(req, sizeof(int)); if (error == 0) { From nobody Tue Jul 9 18:45:18 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJVKp52ZJz5Qt8q; Tue, 09 Jul 2024 18:45: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJVKp3VdRz4kfr; Tue, 9 Jul 2024 18:45:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720550718; 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=p/H/+QaKuOkmAN+bA3SExDfPBC21ufaeUiLM/fTQVTQ=; b=FJXE4i+iSN2Zi04UURinGQ/BcHKK+6IWFwNqwzjcssr0Kl2jKMu0MyW/T9s6xwXPL88WXz 5Ww3/ehnkz1pJJmUNYALbXqF5GHZ4NgDreGLuvYRUNlr8rhVY+AdpeuOrdaEnVDL7tEY0z NgOCpSOjeBE5Rdd6sm1MP/osLeCkgbutSW83dRj/rjT6emuqEsRCE3A2RQ3jCLgaZ/nDCj NypIYEkSEOBdhiLNAq69fKgJUDCWNRNvm2W5RYmgQSzU+hzOHguJ7gfmh7Gy8NsTQ68noR ng2+t6ai4++JWy7zZdLj6AtoUdFNbsViyGf0fYcIFVsoA+qqA5Wr80Oe8DUA8g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720550718; a=rsa-sha256; cv=none; b=dnbsnFww6d6tgvlbfgtlxvLg+tLVYJpYBA9cYs45KIfkJpreeF5LUatjNJ/a4aysNZOGmN 66TinqGBYBLtCdNi9FO+TdnaPhIgHxHeorFpv8bSyZM6ZMcuw+/PB27gs/aVB3m24O+rYs uphN6kALe5B3+caQbvr9gjyEMIzkqNNP1jV0GESnlgWJWZnR7q1FipE0SUJ5VMob0rW2Mg aU53YZEhDAhP1hZu5hxupzugwvba5jtPICv4geszE27oz2kBH2wsQRcxx5NqjdsOVjnI4C QqgPkXJsVC8OU1BIM1R01yDcCNHBStcCHziMtOxsys9Uzi9iC/hFnVC23e6pLw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720550718; 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=p/H/+QaKuOkmAN+bA3SExDfPBC21ufaeUiLM/fTQVTQ=; b=CYXqXHoQjiPp8hhstrN2Yce9EJs6jrYGih8PlG7ZSPM7Inv2WzDnKGLICoRlhdCj2isOvj xPlQw0gIPacHOgi1Hp4OB4sO5I9uFOHTRhqWPcm00O6iobyBRD1yeAskn8JzHKY3+oDAAE sjP+HGBPyVWWZRjJ3z0BsXaYdSpddEcbyXy9B/TziSJ303M1VPo/TDI4d46A0HTvZLpnjI h50TZbNQ0ui77SBPfHwoLlwJJwTv2TRZbVqAi5TX9bLmhBM0tqmaZwM5bx5lE6np68OI+P 924fyDs+Qjwp0npMHr7yedPUh4KIwEqgciAtmimtVGpx9Cf0VHo1QMHNfVsw/w== 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 4WJVKp35Lxzlly; Tue, 9 Jul 2024 18:45: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 469IjII8087578; Tue, 9 Jul 2024 18:45:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 469IjIso087575; Tue, 9 Jul 2024 18:45:18 GMT (envelope-from git) Date: Tue, 9 Jul 2024 18:45:18 GMT Message-Id: <202407091845.469IjIso087575@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Libby Subject: git: f0a7df4a6cc9 - main - ddb: make db_error reliably no-return List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rlibby X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0a7df4a6cc9a795680d580fcabd993379e22ae5 Auto-Submitted: auto-generated The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=f0a7df4a6cc9a795680d580fcabd993379e22ae5 commit f0a7df4a6cc9a795680d580fcabd993379e22ae5 Author: Ryan Libby AuthorDate: 2024-07-09 17:59:27 +0000 Commit: Ryan Libby CommitDate: 2024-07-09 17:59:27 +0000 ddb: make db_error reliably no-return Most code assumes db_error does not return, but according to kdb_reenter_silent, there may be cases where it could. Instead, panic if kdb_reenter_silent returns and mark the routine as __dead2. This addresses gcc warnings. Reported by: GCC -Wmaybe-uninitialized Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D45918 --- sys/ddb/db_command.c | 1 + sys/ddb/ddb.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index f621bd614ca2..1043f7091085 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -580,6 +580,7 @@ db_error(const char *s) db_printf("%s", s); db_flush_lex(); kdb_reenter_silent(); + panic("%s: did not reenter debugger", __func__); } static void diff --git a/sys/ddb/ddb.h b/sys/ddb/ddb.h index ab7dab1daa45..8088226c6939 100644 --- a/sys/ddb/ddb.h +++ b/sys/ddb/ddb.h @@ -233,7 +233,7 @@ void db_check_interrupt(void); void db_clear_watchpoints(void); db_addr_t db_disasm(db_addr_t loc, bool altfmt); /* instruction disassembler */ -void db_error(const char *s); +void db_error(const char *s) __dead2; int db_expression(db_expr_t *valuep); int db_getc(void); int db_get_variable(db_expr_t *valuep); From nobody Tue Jul 9 18:45:19 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJVKq6NZ9z5QsnS; Tue, 09 Jul 2024 18:45: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJVKq4JcPz4knZ; Tue, 9 Jul 2024 18:45:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720550719; 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=K/leKwRx2GXR2vu/0ozwdyWMZV45y4/wCzh63Q84h7o=; b=FPgEgnF8BXfFtXFXc359Z0u2btf8wbDcF8LVud4n4XHOjU7873Q64kmhLQLj891dyu+pa9 YzrNOPHlB6NTkF6aItRuWSKZmbH4fDJCyEPsnmcZybm6bR8TxbSyqyFVgIAfXfKdf4tZ80 wTrIQXQNbVgvH21TCAVMUG6tbBj/tIMRCyoqOOry0/syt4kkGvrzb6J354tfrgunXevDO4 HbRAcoLr0FUyZMFyE4qBY7zBEbMTMrIQbA7zvv43InpQlO9hVrr8aZcWXKv6seAdDm+iN2 HUvOXLYOyfGBDajYo0osOLEhuAnhTiuPffksHBn8fUuswjuHtyCntWiIt2S8Ng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720550719; a=rsa-sha256; cv=none; b=qQ9M/YxwD8bpwdL+QJVss1xOz6ymsOn/+i5H1rjNdew0nlYBsCsyKp9VSKpNSriLDuMQnb EkQ+gR1lmhDPRjiAABxQB+T8eAJDeV0xoxYzT2TOlJaOwd+VaVMNsS649xwXmxdRjmHZiE rVx9TDOkt+UdeMMAAzeUFyKBuFRiZMRCsmZDy1G8DHs0uonQQUQ6iZyKGoxjAkQcyf9nVP UBrsmNhNvAr2KpopKjXNQu4MRJFLD2SaOdHJ2D9wxeWdL5ewzMpLdidoozAjyN2NKAx9LP erKxZtTTmx/Up5K2Pf+CZnzTslRUJy5nZ1mDf0/H8dBAIWJmFBIQh8G36ByT6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720550719; 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=K/leKwRx2GXR2vu/0ozwdyWMZV45y4/wCzh63Q84h7o=; b=e4+d2oC51icRNLcCEILW0xgWzVptrmiuTxw9Lo94NUVrPosbuHgSG6eLha3ToCVD1t12T2 02/Z2fM92/N0XEdifiYbmWbjT6w3Iu66NLJPfZOg9zqxKO6IIt17vxzXWmkbehEuJkgL1q RVJ+CntQLPvvCVzkxJ7bxxu0VttAwhlQhlIDWXl8tyWkoZsqx/sbIoMTws5LrLthhnoYoB 85X0ySRXONSynwE0X5Cn/HcadBkAjK34/IAF5Z6suG4vJMW+glK6krY6yWtkjJUoMIs13Y sZRGdboIf0fiKD1E67BSDPNheUs+2E5BEviQ/fdOV2uqguh/S46DCGsePQ5nfg== 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 4WJVKq3vggzmFD; Tue, 9 Jul 2024 18:45: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 469IjJxf087621; Tue, 9 Jul 2024 18:45:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 469IjJgi087618; Tue, 9 Jul 2024 18:45:19 GMT (envelope-from git) Date: Tue, 9 Jul 2024 18:45:19 GMT Message-Id: <202407091845.469IjJgi087618@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Libby Subject: git: 6bd85498ec2d - main - bthidd: declare appropriate size bitstring List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rlibby X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6bd85498ec2df62aeb8cf9c476daac8a4d9a7a4b Auto-Submitted: auto-generated The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=6bd85498ec2df62aeb8cf9c476daac8a4d9a7a4b commit 6bd85498ec2df62aeb8cf9c476daac8a4d9a7a4b Author: Ryan Libby AuthorDate: 2024-07-09 18:00:33 +0000 Commit: Ryan Libby CommitDate: 2024-07-09 18:00:33 +0000 bthidd: declare appropriate size bitstring The bitstring declared on the stack was much too large, and gcc noticed that we weren't memset()ing all of it. This one was harmless. Reported by: GCC -Wmemset-elt-size Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D45900 --- usr.sbin/bluetooth/bthidd/kbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bluetooth/bthidd/kbd.c b/usr.sbin/bluetooth/bthidd/kbd.c index a807a9b27dec..51c12d111c37 100644 --- a/usr.sbin/bluetooth/bthidd/kbd.c +++ b/usr.sbin/bluetooth/bthidd/kbd.c @@ -339,7 +339,7 @@ kbd_maxkey(void) int32_t kbd_process_keys(bthid_session_p s) { - bitstr_t diff[bitstr_size(xsize)]; + bitstr_t bit_decl(diff, xsize); int32_t f1, f2, i; assert(s != NULL); From nobody Tue Jul 9 18:45:20 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJVKs1BJrz5QtCJ; Tue, 09 Jul 2024 18:45: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJVKr5DXJz4kjc; Tue, 9 Jul 2024 18:45:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720550720; 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=mcLA2v6pIZ5jX1tFtSYW5eY3t68sQCUMQkfjwaYTTPE=; b=Xm3lYVm4GKR8EnGpSg50+p3F7sQncyqRrwZw8DSA2CqE5fUpmdd2CHrqMdipOPDgAd13p9 LO6gNhSCcX+HOo5xd8yC3G5uwrfvaFBNnywSKx1Rc6bO+Sj8SBGtQzSmectglfr4Gjs4Sx OFnPIa4mt1Ylg6gSsdMAT6m2nHuFXQWdtuEm8jjha1rrXogiwewuNjnU7cK+MUwI1lbleP azbCAX5FF02wMDOtE98RiY95cVN1UWQ6WArq1oLMOKxRbiJDdmRoO3BKCs0zIjmzWbxdzm /y5y8eIWj0AL+LX6ON90Yo+BXai7zLjidQ8aU6wuySu7GMBfF1it9WCKp31OKA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720550720; a=rsa-sha256; cv=none; b=lPLs95Uthsh12gHKz0Mc/NoJuvRl6SpsWi3/aFXVCGPzekTUo4OfnIa6EnpI+G2AcqJ6MO IuFkSPO1J8WXflZVB1VLoWvSXNEf+zgkPuE480u6QGXwlMAaq+0WnpS/mO32DMtZvypqM5 br6s/iskfYn2mLt4uOteC1LuWHlwfr28wFmgLYz2rikLvqh3yeKRg+rJ9Y631InY11Fd2D 6CIPQa3oU0BJbzKvt3Q+7v+ijcRrcZP9J2yabemEqk1vEDsCI6U02kDQFmQnxuTRqr3p19 nyMAGD54Zn7zsEQjScVlRBGixnooozAXaok3wjirv3e6jxb7FXiizS6LJAW6bg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720550720; 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=mcLA2v6pIZ5jX1tFtSYW5eY3t68sQCUMQkfjwaYTTPE=; b=BNWrIMcCQMu2nqdV+qSYt70Kjcdwln+HDyzGzQmPGbKrKwTC8ayTqZdOA8pj3uA6RnjOHD a+/62QIXizeHGG2d+eKbdsbnxrx7DaUU7eEm2YWtDjHUJWRN10zbVO36VE4SEwFz4g2j7E GwX37wVJFN84+UdMfyibNhsRDT3Q+mvigtBW51R8jXHUBJqdquzICOqji5gHpdBBfAr7hP 24hyDWFMiyrSkMnzD+tvNvuCHm5/tWVVi/CHwJGzKDG4cnhV+yGduz0UxJC8Mi06p6cGU6 s+gInlR/T0FZXG6Jo4eD8QruuDBHnlZzJUV7Ic2DvyX0aPvc0xG6jH57w3XrGA== 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 4WJVKr4r4Hzlxv; Tue, 9 Jul 2024 18:45:20 +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 469IjKfa087661; Tue, 9 Jul 2024 18:45:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 469IjKxT087658; Tue, 9 Jul 2024 18:45:20 GMT (envelope-from git) Date: Tue, 9 Jul 2024 18:45:20 GMT Message-Id: <202407091845.469IjKxT087658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Libby Subject: git: 430be7e1ee71 - main - sx: avoid gcc -Wunused-value List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rlibby X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 430be7e1ee71902acb872544c928c19dd23c87ae Auto-Submitted: auto-generated The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=430be7e1ee71902acb872544c928c19dd23c87ae commit 430be7e1ee71902acb872544c928c19dd23c87ae Author: Ryan Libby AuthorDate: 2024-07-09 18:43:57 +0000 Commit: Ryan Libby CommitDate: 2024-07-09 18:43:57 +0000 sx: avoid gcc -Wunused-value Also fixup whitespace while touching these lines. Reported by: GCC -Wunused-value Discussed with: imp Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D45875 --- sys/sys/sx.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/sys/sx.h b/sys/sys/sx.h index 798e85ed67dc..deb277decc75 100644 --- a/sys/sys/sx.h +++ b/sys/sys/sx.h @@ -301,12 +301,12 @@ __sx_xunlock(struct sx *sx, struct thread *td, const char *file, int line) #ifdef _STANDALONE /* since we have no threads in the boot loader, trivially implement no-op version */ -#define sx_xlock(s) (1) -#define sx_try_xlock(s) (1) -#define sx_xunlock(s) (1) -#define SX_DUPOK 0 -#define SX_NEW 0 -#define SX_NOWITNESS 0 +#define sx_xlock(s) do {} while (0) +#define sx_try_xlock(s) (1) +#define sx_xunlock(s) do {} while (0) +#define SX_DUPOK 0 +#define SX_NEW 0 +#define SX_NOWITNESS 0 static __inline void sx_init_flags(struct sx *sx, const char *description, int opts) From nobody Tue Jul 9 18:48:22 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJVPM0dYLz5QtFk; Tue, 09 Jul 2024 18:48: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJVPL70tVz4m1s; Tue, 9 Jul 2024 18:48:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720550903; 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=aW2p79tD6HioZB7G8NfcGF4XZ9Peu9/AD7aiADkz6yE=; b=x8G5k0uqUWTpEgRE4tZmwrZDsW2sLLZka/RXjVnftDbv4Zj+CH1e13n1At9WzzfYg+VYmi bT569InNE1W8a2MT1sm/p2dPOYjb05XfBbjpvhROMBMmyu2iLdqBz5v08ltMnTztUBzZ+H bx5HPmsnc5+jsPrUrVTKN6CVEbR5zkkxx/fQIXpqe4Xyh1DDNZSGsMDCqQrUsS5kpbUtEg AofH+bR8VC15jPuB0cl5hAcVnu4cNPfUkMPN6zOWmrZAxODKP/iHaYikSGJAVzoyO30DXx lZYio8dD5aVkdBwkvMkRl3y8wVFUHUvhksZYR22WqdritplE0zGGpHemblTXaw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720550903; a=rsa-sha256; cv=none; b=DKclJp9dxaIRRsckZH3SbPlqJIqQGkDbOXfJk8aUtlHS+IraHqKxrpXI3ix0TzCfmyYw6Y 38Fa9Wsf/NugypgucbTzxXggMFIOjKrTz9WoWRUsU2w0k1H9IDIADco0wgf73rwSHGslAw 8pfBsh3lQvwEbqs7SLxwdaWPkU1nxIO3Qt4dW0wMqffs4zYy9US0ArCsVkIHQuL3d9Njx+ Vm4VmgH/n5tkr2d3r/LK8oOLQwRU2gJJs2mSEI7YfIxBKDM9TVW+FdVrfDPfPMgFqMdZwn JgXgBUXevCHyxfADaxznCe/n2UTvNR4P172Fommp+wpDOp5fOfNZDVltErfK4g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720550903; 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=aW2p79tD6HioZB7G8NfcGF4XZ9Peu9/AD7aiADkz6yE=; b=xRePBO5a/rvGQiS/wP3Ja+7tilkm3qjOq5U0MRjg57+LGznDi2iRqoDlTDJ7PE7ImPU22V DAXEziRGG3cP4mUzO23aB5R8BmNU1KMT13KXNpwxqbdXwA2j/KfiUfXIX0CVCCJDWDeJ1y b648MMUMEYRdsp93jDHRZi+Fyt8DfomWUSr7+egGmytom4gjag/YddL3TbOOqdRHtxVmPW RkHRnFqnohifU7Mz6yYYbDz4mGOMQYVh/l9MBl2S05anbEjVjSQFRU/oBQHk39ceH00bEV GMBLD/+K3DMbuUhLmrDtKiI6DO1dA0IIBk5riXpC2YJcQVYjlIQ2uFOQlDlwPg== 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 4WJVPL6cHhzlXb; Tue, 9 Jul 2024 18:48:22 +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 469ImMkS088265; Tue, 9 Jul 2024 18:48:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 469ImM2n088262; Tue, 9 Jul 2024 18:48:22 GMT (envelope-from git) Date: Tue, 9 Jul 2024 18:48:22 GMT Message-Id: <202407091848.469ImM2n088262@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: ae4c7e6aa036 - main - riscv: fix pv_chunk check in pmap_pv_demote_l2() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ae4c7e6aa0361f67abeeadb7b60ee22815895be7 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=ae4c7e6aa0361f67abeeadb7b60ee22815895be7 commit ae4c7e6aa0361f67abeeadb7b60ee22815895be7 Author: Wuyang Chung AuthorDate: 2024-07-07 15:07:42 +0000 Commit: Mitchell Horne CommitDate: 2024-07-09 18:46:16 +0000 riscv: fix pv_chunk check in pmap_pv_demote_l2() It is the full chunk that should be placed at the tail of the list, not the free chunk. Reviewed by: mhorne, jhb MFC after: 1 week3 days Fixes: 4d90a5afc51b ("sys: Consolidate common implementation details...") Pull Request: https://github.com/freebsd/freebsd-src/pull/1321 --- sys/riscv/riscv/pmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 8fb017f66951..bcf2ada887fb 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -2242,7 +2242,7 @@ pmap_pv_demote_l2(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list); } out: - if (pc_is_free(pc)) { + if (pc_is_full(pc)) { TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list); } From nobody Tue Jul 9 18:48:23 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJVPN2JQCz5Qt5K; Tue, 09 Jul 2024 18:48:24 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJVPN0vXlz4m1v; Tue, 9 Jul 2024 18:48:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720550904; 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=W83/udct03V7yPMczfOGVM4PqQ9UbNopr4vc7hGn94Q=; b=Ue2+9gmJDFZ+0ar27+AWySD5NpTmY2pMsCrKqeaDHT1CAHNX/p2mtqO2yZFAZmLBwLg2XF TGOmEfblgvS+6/jJqFLBwOip8SMXFsUBiZZm4o0owzImFKZz4tazHJNGQi9WciJU+bm5Qi Ocr3/8XT+BVWtScIHK37tnutXpV77zA7mnIalZUjENe14R6tgOJgdHjXHf7Ms4wfk2h6z8 41TQkWEnqmJZuqSvDc6KVCN8qnKUp+UUZpQWl2g1npd2qfTQu4R1UFa9ikg/OIbWWJdPT2 1zw3HIJBinbYBYzge3Hr0Ou2sCQ/B+6kbrVP+8O5IyEUZMHXyqfhi2CW3Ob13A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720550904; a=rsa-sha256; cv=none; b=I6dpAMgZP6sKPfKdxQv0XrQT1rr/8BfFxPgMWq+qIi14EyUeQm70CuqV3gsC23F4SF2pS7 D9vtHgBG2HRvs7iCv2K6bnNIfRYmhb8xX9yYHc0iXkQVZD6FA7SvOht76as74lEqeSJdFD DaLJJSuHQQK1PktwneF2eqOrO0mncyIZShFyTYm5rT6ZGjrUf1yQf1O3F1OFVJx0onhX3L v5eav7132M1MQyj16YdKmYCBl1mpJzTE5NXTMwMIPVLIKGRAsUZg9o0S+DbMPZPT8cxjKq OEGZErmfBw2P+DdPos2O+bDdcccJWxiYMH4F8nrRASG8GmKQnOctAO5OBegtNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720550904; 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=W83/udct03V7yPMczfOGVM4PqQ9UbNopr4vc7hGn94Q=; b=l6byXCYJbnRhzGDPdWdM+c6y9BDVqIyIVqsByW1Lb+JZ3gQtAZugNlqt/W36iqBxpqQFXF F2R7FhIW/ZmnXUdpg+lzdbMt+wtWm/baEy2yUMBaLY2YAEmpRcrdHGwySqDR1G2dXWjFmR aOfWup7MPe1wFjV5UH25Z0017aW+ZsMVqPdvxAHCDh0Un57s4Cbs/DfQNNYTA/rzV+Wnyz NwJAC07ghAQ30qpNl4fd2bBmngYjjx91v78uLlrIxL6BrJVR6ggZ/FjY4DINFj0FZmAO0Q +txwmAlzFFtALY61uUpI/9L4pJKcrFznhoSsQJNd4ORhhkyv+hIY9WeXFfXfAw== 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 4WJVPN0VzbzmFF; Tue, 9 Jul 2024 18:48: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 469ImNEe088316; Tue, 9 Jul 2024 18:48:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 469ImNHX088313; Tue, 9 Jul 2024 18:48:23 GMT (envelope-from git) Date: Tue, 9 Jul 2024 18:48:23 GMT Message-Id: <202407091848.469ImNHX088313@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: e7f849e25bbc - main - amd64: use pc_is_full() helper function List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e7f849e25bbca9a74c9d3a5b633f9cd01ba95a55 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=e7f849e25bbca9a74c9d3a5b633f9cd01ba95a55 commit e7f849e25bbca9a74c9d3a5b633f9cd01ba95a55 Author: Mitchell Horne AuthorDate: 2024-07-09 18:43:33 +0000 Commit: Mitchell Horne CommitDate: 2024-07-09 18:46:16 +0000 amd64: use pc_is_full() helper function This seems to have been missed in a few places. No functional change intended. Reviewed by: kib MFC after: 1 week Fixes: 4d90a5afc51b ("sys: Consolidate common implementation details...") Differential Revision: https://reviews.freebsd.org/D45920 --- sys/amd64/amd64/pmap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 2bcf671be243..9f85e903cd74 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -5595,8 +5595,7 @@ retry: pv = &pc->pc_pventry[field * 64 + bit]; pc->pc_map[field] &= ~(1ul << bit); /* If this was the last item, move it to tail */ - if (pc->pc_map[0] == 0 && pc->pc_map[1] == 0 && - pc->pc_map[2] == 0) { + if (pc_is_full(pc)) { TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list); @@ -5807,8 +5806,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, va_last = va + NBPDR - PAGE_SIZE; for (;;) { pc = TAILQ_FIRST(&pmap->pm_pvchunk); - KASSERT(pc->pc_map[0] != 0 || pc->pc_map[1] != 0 || - pc->pc_map[2] != 0, ("pmap_pv_demote_pde: missing spare")); + KASSERT(!pc_is_full(pc), ("pmap_pv_demote_pde: missing spare")); for (field = 0; field < _NPCM; field++) { while (pc->pc_map[field]) { bit = bsfq(pc->pc_map[field]); @@ -5829,7 +5827,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list); } out: - if (pc->pc_map[0] == 0 && pc->pc_map[1] == 0 && pc->pc_map[2] == 0) { + if (pc_is_full(pc)) { TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list); } From nobody Tue Jul 9 19:28:10 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJWHG5R9Bz5QxJ1; Tue, 09 Jul 2024 19:28:10 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJWHG4k9Dz4q5b; Tue, 9 Jul 2024 19:28:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720553290; 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=Ek63/277eMcMD8UAYZ0/Lio8JHFxfQLXjKDBenpIosY=; b=lnsCMB+Udf2owCVBS/SJ6se3E1J4Ntx76qdlsoKEgvg0Zg7jtvdeXAP1G8F//Z48gG5Q+g 3ksgw8Bb4nSu7Q+90XR6zRJlCcJF3R10HuLFvsrwdVMClUiqvKVRSyS/gaEGwkxzavd9mR 9Q6p0nrzQUSPLZ0WyYUlU3QZ64pPUV6tbABexyCaX/wh+UqO+vLGGzg5krW5NCw9MKGYxK PyE6m2EKRzDLxIpYACbsws5qydvriHgYrMFpgQO9+JA6jo6h+iWynZfW/yYrnPPSw/Z1j6 mYa7ViO8SApskWjPbB1Ngwkoiad/ZHknD1Whw+RfET8gF7Wb2C0XTryAlA/RCw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720553290; a=rsa-sha256; cv=none; b=NhII/6EglZnNsutKzQOMJtK+nf5KrAtk+xJglGXJcOc3wgxNdaJx7XyGfuL0sjie23+qH9 UPnikMHPbAD4UVWdI2NInfbgqN1uSDnphyUYhtmkxFfY3/uIuf6xSKbFhCRZ21jU6UdRHV xHs5+/8SZGckwgwxavXW5ZX1wm2/8eXso/kyC1MhLVBA6mGlPYeiwG9IbRRrFVwAoz4v5F fGCpvfS11aIiJKpFwdsCO/tzBVlpP94hyaSDzWq2Hs+mdDqhJ9cA1EQOZkPRl9WoQvRpjQ iSC46Nffdwfisxx0esnJ+xe3iQqFlI208D9cN0mY+VM1H7RMgaLChWZ0WhbCng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720553290; 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=Ek63/277eMcMD8UAYZ0/Lio8JHFxfQLXjKDBenpIosY=; b=hvf2lIaQNL4Ri2COtuGYZvvfFfTWGKINlTyLMVYtgw7CRJJLJlbInpnMcQJunBRE0tTvNa l1r8SKWwQwWgwKbmoHQMCeyyuvhweesjG57a8qP85v2WVVSge+JuLNe8BXtrqTx5O3yMXi eBQaYpfawidv1QGILDU/A5HgH9ySQh7ogeJLJGcQflYkiN2U/ss4HZwM4w+Of44N2elgiA ssBZMurRffDUot2wDuh2twOEfMmxsrNzierQOGx1zsXLLgif+J7d2svNZ/deXT/EnOSr3w YB/GlhrlyXOZCFEjAP5OhUEFnL3Utnpg6oYNr/CJDXxnuy1f2753QR1D3AyE0A== 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 4WJWHG4KSpzmgG; Tue, 9 Jul 2024 19:28:10 +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 469JSAjO056776; Tue, 9 Jul 2024 19:28:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 469JSAaE056773; Tue, 9 Jul 2024 19:28:10 GMT (envelope-from git) Date: Tue, 9 Jul 2024 19:28:10 GMT Message-Id: <202407091928.469JSAaE056773@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 3114d55866b8 - main - sound: drop midistat lock in error path List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3114d55866b86ca1132923211936aa23881b0057 Auto-Submitted: auto-generated The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=3114d55866b86ca1132923211936aa23881b0057 commit 3114d55866b86ca1132923211936aa23881b0057 Author: Robert Wing AuthorDate: 2024-07-09 19:20:59 +0000 Commit: Robert Wing CommitDate: 2024-07-09 19:20:59 +0000 sound: drop midistat lock in error path Fixes: fc76e24e583d45a3a59fd7ad4e603c0679eaf572 Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D45939 --- sys/dev/sound/midi/sequencer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/sound/midi/sequencer.c b/sys/dev/sound/midi/sequencer.c index 6b3a2711e951..29e01fcaba2f 100644 --- a/sys/dev/sound/midi/sequencer.c +++ b/sys/dev/sound/midi/sequencer.c @@ -750,6 +750,7 @@ mseq_open(struct cdev *i_dev, int flags, int mode, struct thread *td) mtx_lock(&scp->seq_lock); if (scp->busy) { mtx_unlock(&scp->seq_lock); + midistat_unlock(); SEQ_DEBUG(2, printf("seq_open: unit %d is busy.\n", scp->unit)); return EBUSY; } From nobody Tue Jul 9 19:46:18 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJWhB4vR5z5QyGM; Tue, 09 Jul 2024 19:46: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJWhB42rYz4sLy; Tue, 9 Jul 2024 19:46:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720554378; 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=X5WCn89N2O2hKApuQLAwwkR44AzTGfK0Clk5/X+iuFU=; b=x+RhTd250hHait3++DETaUBZStVbwVbnSxGgfmpLVB6pM1nbXPiG3hqKgGNe8b0YQUXXmd lFiPvYd9ijcBntSs1MaCV+9RzeCPLwP4g8YlEQhvRCejNo2SDJmutP6/kXbYr/yaWzS+e6 00/ledI3K0CYEKyanX+9yDpWovs5xqd0Qly4dGg8BY4/soOGo5HLzoi76+/qe7n4Mh+qh5 z14iaGIHXEzR2zme06FgKHrT8bnaJZ/rQrjRN8QOliqq+1yKewqi7X8i6gehCW/IzCV8UZ SGC2hn39Hb4u6KSV9EG5lMW/95sGKVEKiwnPdKbm/lmPHFukQ51aySEtO5oMrA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720554378; a=rsa-sha256; cv=none; b=num/RQIReC0ufrmR2v612f8KP2DyQSHLu9BDjx+PXSYWyTlhyX5YVnHtgMkUansu+Jq8om 8lCbIiuzYq72qH3kuwAfGWQHSNhYRBkdsis12GfPBUoqCSJTFCJU0VwfmgYc8iEAGX4CgT fNXNPxR/W7pIUJWEXJvT+2xX7hpnrpVDQJJZYsrwvcmLiR00Kj7zSt6ES7ezFrwD16TSON 4riHBYCrMj5HlKEF8ButdIh/CWermM1tgy7LqpTW3HlqbSntrBTV/96UnKjY152/xHFZgw tR9tgZMdVYJKJ2XeOGmEqbp22f+rkkQQ8MKjUZi58dDoxQ+B8aePlcoNqGnfZw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720554378; 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=X5WCn89N2O2hKApuQLAwwkR44AzTGfK0Clk5/X+iuFU=; b=oluIsYt2iH23TnO7n8tbbhA2yT4Hf1ure5tbpx5tif3LTG5IAmh5oBXMDNH+HqRJFZuVgo Kc5Ecq1hcpXeRmIOAkKb/mo/WP0Lr7NgSASO9oie/uaagTYiqSEdPL08YvC3VoAqbtmd1u 7E32XCL158z2nigDssJkl2JmfHrsp4ErOQeHhHZddd9l1JFv0k8ZLzjGcVliDXkytmat3d F1ANe9uPXfjJrXrE+SBwj9quB1oRSFY/my/0aXClrQIn2+Z++P5A6nSxoHUOsTRZnfuM6T HRCMNKurBoeN5gNLouzKhQeaRqR6N47G3KW86VESl1kCYJn/dOhynXs6JxehmQ== 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 4WJWhB3fB8znBx; Tue, 9 Jul 2024 19:46: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 469JkIdn089822; Tue, 9 Jul 2024 19:46:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 469JkIhP089819; Tue, 9 Jul 2024 19:46:18 GMT (envelope-from git) Date: Tue, 9 Jul 2024 19:46:18 GMT Message-Id: <202407091946.469JkIhP089819@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 77439cd18f34 - main - nfsd: Add option to disable going into daemon mode List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 77439cd18f342fa4f206d4fb35d40c1d02e1bf8c Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=77439cd18f342fa4f206d4fb35d40c1d02e1bf8c commit 77439cd18f342fa4f206d4fb35d40c1d02e1bf8c Author: Joyu Liao AuthorDate: 2024-07-09 19:44:38 +0000 Commit: Rick Macklem CommitDate: 2024-07-09 19:44:38 +0000 nfsd: Add option to disable going into daemon mode In our products, we need those options to support our features. Add daemon mode option for mountd, nfsd. Add skip local host binding option for rpcd. Add skip local host binding option for mountd. Reviewed by: rmacklem Differential Revision: https://reviews.freebsd.org/D45118 --- usr.sbin/nfsd/nfsd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/usr.sbin/nfsd/nfsd.c b/usr.sbin/nfsd/nfsd.c index 563a36983547..b6c60ce72834 100644 --- a/usr.sbin/nfsd/nfsd.c +++ b/usr.sbin/nfsd/nfsd.c @@ -68,6 +68,7 @@ #include static int debug = 0; +static int nofork = 0; #define NFSD_STABLERESTART "/var/db/nfs-stablerestart" #define NFSD_STABLEBACKUP "/var/db/nfs-stablerestart.bak" @@ -170,10 +171,10 @@ main(int argc, char **argv) nfsdcnt = DEFNFSDCNT; unregister = reregister = tcpflag = maxsock = 0; bindanyflag = udpflag = connect_type_cnt = bindhostc = 0; - getopt_shortopts = "ah:n:rdtuep:m:V:"; + getopt_shortopts = "ah:n:rdtuep:m:V:N"; getopt_usage = "usage:\n" - " nfsd [-ardtue] [-h bindip]\n" + " nfsd [-ardtueN] [-h bindip]\n" " [-n numservers] [--minthreads #] [--maxthreads #]\n" " [-p/--pnfs dsserver0:/dsserver0-mounted-on-dir,...," "dsserverN:/dsserverN-mounted-on-dir] [-m mirrorlevel]\n" @@ -230,6 +231,9 @@ main(int argc, char **argv) NFSDEV_MAXMIRRORS); nfsdargs.mirrorcnt = i; break; + case 'N': + nofork = 1; + break; case 0: lopt = longopts[longindex].name; if (!strcmp(lopt, "minthreads")) { @@ -411,7 +415,7 @@ main(int argc, char **argv) } exit (0); } - if (debug == 0) { + if (debug == 0 && nofork == 0) { daemon(0, 0); (void)signal(SIGHUP, SIG_IGN); (void)signal(SIGINT, SIG_IGN); From nobody Tue Jul 9 19:52:00 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJWpm5pMXz5Qyss; Tue, 09 Jul 2024 19:52: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJWpm5KSgz4swt; Tue, 9 Jul 2024 19:52:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720554720; 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=uMUUDDqR6KlEgFWIe2NaxkTypBd3gZdCs7RAeG5jrqA=; b=r9bZkI5+JVCUZTsGNSZiv9JHhlUP1Iehpwm43BfTJga4B7cPft+brQOBenUupruDj5HcOS PMSibU9d5VnsVVYUdJpjJUWLIZ6nO4G01yxHQ0MMh7hIoQhQMIqD4M109NJ1cz+Q6fbmnP jB0Ue2/cQwz/95LFlXAO9xFwj994hYPo5ekUbLsq+50l6W70CnRftxSUEebXt/ueyZ4iLx xdhICwLLG+opXcXrNbSxsr3GVZZvh7tRyV+E0JCCH8gzuHOLNoTQO9phLGwcJMsqCQb1Fq s5Tk98MRv4fgl8Ky7lMz18BAZf1wNw0t1rSWsleNj4YyD6YzoMCeIZTVJM1eVw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720554720; a=rsa-sha256; cv=none; b=d77Yo+6hzW9V0+kPDl0KO0Bsxk1da7jUaHOFa8JTe9HTc/qRuCavZMUUiYKZSFaob3n8zh /YBxzCWWW+DLbW+PwV/jfE046pLdw9NGPeEVGCIJQt+t0ehpJWTmmBBXp/0P8rQLLQEHHv l4geNfeOxomNjz9o3FLqyq3q7A+XRsiM9Eb/ogblcqae577u91DVv4LiHW4qxA1y6PvZLf N7N3qFtllbS9cUguQmjqGoGN7eHPGhyS56luaLN3z3xDGq4epaYuzn4Hk2g+7o/Z77+n/z 9bK7hb58xVNxyqXvk+lWGJBV90W8uUvA+Ul98pA/sdlb2LQBbTfuI4L3e8OQbg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720554720; 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=uMUUDDqR6KlEgFWIe2NaxkTypBd3gZdCs7RAeG5jrqA=; b=VWmXykniC1duETfQ6Uyw/pTnKwHP2eWf7jIAl2L4E2ypx7OXDm+JbYtK1PZd+XjHNy60GO y2ffbb17XEhxIKMvOiw2xl6PEmBaTv+G0FPFuggj4W7PWH1iKVD7xrEgF4XsDO8/4Oxy/G GXmlEJi4h1Fu/IzwABgx33KGjpnHdRkB0TkyBJ0V/xduV3MCcrIJ5uYSx5FMbR1mlZnzvJ 5of9v5/h7paxlvgWdei+EwStvqfdx9gtAyamxcjQGWIYzoxdT9ydqSShBpX15fy1Ry/4Gb QpFnuUFUlCGZyU/TyL4T/nLgY8Ddhb5Ti8zdvUmVUAaAsZm13Sifmw3/aNSwWQ== 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 4WJWpm4x1wznqn; Tue, 9 Jul 2024 19:52: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 469Jq0BX006670; Tue, 9 Jul 2024 19:52:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 469Jq0l7006667; Tue, 9 Jul 2024 19:52:00 GMT (envelope-from git) Date: Tue, 9 Jul 2024 19:52:00 GMT Message-Id: <202407091952.469Jq0l7006667@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: f7dc514c01d0 - main - nfsd.8: Update the man page for -N List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f7dc514c01d0a3a08e329744eb15c4af495f5fea Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=f7dc514c01d0a3a08e329744eb15c4af495f5fea commit f7dc514c01d0a3a08e329744eb15c4af495f5fea Author: Joyu Liao AuthorDate: 2024-07-09 19:50:26 +0000 Commit: Rick Macklem CommitDate: 2024-07-09 19:50:26 +0000 nfsd.8: Update the man page for -N Commit 77439cd18f23 added a new command line option "-N". This patch updates the man page for this. This is a content change. Reviewed by: Alexander Ziaee (manpages) Differential Revision: https://reviews.freebsd.org/D45118 --- usr.sbin/nfsd/nfsd.8 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/usr.sbin/nfsd/nfsd.8 b/usr.sbin/nfsd/nfsd.8 index 9051df4bcb31..10aba5c8d845 100644 --- a/usr.sbin/nfsd/nfsd.8 +++ b/usr.sbin/nfsd/nfsd.8 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 16, 2024 +.Dd July 5, 2024 .Dt NFSD 8 .Os .Sh NAME @@ -34,7 +34,7 @@ NFS server .Sh SYNOPSIS .Nm -.Op Fl ardute +.Op Fl arduteN .Op Fl n Ar num_servers .Op Fl h Ar bindip .Op Fl p Ar pnfs_setup @@ -216,6 +216,10 @@ Serve TCP NFS clients. Serve UDP NFS clients. .It Fl e Ignored; included for backward compatibility. +.It Fl N +Cause +.Nm +to execute in the foreground instead of in daemon mode. .El .Pp For example, From nobody Tue Jul 9 20:07:30 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJX8f6TL3z5R1Cd; Tue, 09 Jul 2024 20:07:30 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJX8f5g9Rz4vvF; Tue, 9 Jul 2024 20:07:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720555650; 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=oLDSL38KPjE4uyORgO2IEkYh2GPSxdKJLcn+2PhnGW0=; b=PF9mvci/xxbA7QmkAPChrsWjeTOtP0smQyIdoIPWUChjJVe5+0sLGX1oSXPUlq8gpa65ch fMeziwzVfppaTU310gPfQr3OqdRySbVeft1bL9q/Ek8UTWG7KXOQQr1LZokkU0uoPAfiIo uXrluPjZBw1x3ARQap82RDnLKpM6RlTzIrLgI3U8sHJALQFqycIZGyJWtMD5EJ4NMeXKj5 LFJNZq/y2xaiT0GsfkUmzmLVn1qxFk4yrQKvzOykxvZSbV4s3nOnx6GTjZyNb7kAHZC2Hu xTHhfRl2xdrbebgY4bZ+D0wEMmA0OUIUOsh7xlygqVhdnbndwYeGNOSTxuyFZA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720555650; a=rsa-sha256; cv=none; b=mhr/ed/3yr4Rh92C4sQv33p9EhiNIionFzJrR8Ut46sHMby7v+x/Ge7lPTaTmDPBbdtYek UpD7pHRFy2jRcKUDfo6L+DKK9p0rBw5Vug4GscsJ96zXbXEPzI66xTO8cQkBCA9yJVl4of ZWOE+RSIG5ZA3wqW9RxnsnDUyDPO54/Zgh9ZRiLV3ZyYKJHPZHinoGGEWBib0ccJejxtic M88SxhHGMSjXf5rA2dTYAK8ZmYpa5yq77ckhHnaSC8rjU4NBsNl/VC7fPX2xo8PTWMk/aV SO4g9ie/nkgapHFGhmNah0QdxgKP4LNvtfnpB8h/UdRuLW86B7R7bE7k0a2kMw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720555650; 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=oLDSL38KPjE4uyORgO2IEkYh2GPSxdKJLcn+2PhnGW0=; b=grynlLbhCMF9Bw40igQPquLNgx8tUPzr6Rno8V0U6AkRJpEmIwte4juP6rGuiMe/6e+4YK Oxupj0/unOWeQQVACKlYkwl3cO3icEOXHS3IpWnNumXAGMLnv6ZmS3JZuMCLvnL/xLPZIT 0rLOE/O2Yy41KxIysH3Yw4TzPRPmEt0KLkC+lQZTTSKgUU6P8dQwBffuOn+GBXH26D9OP2 DOB6Yj0ycovugM8WRrxgihx+fON/R5Qat+vdri8ybNQy2MSERB97E9HQMMA0SNSGc1i2Oe 8OpdC/sdepiCjmKCgX1Pbjw9SqrWitY/g50XAGRRwh2Y8yhjOiyB+jIGz/544Q== 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 4WJX8f4xT2znW6; Tue, 9 Jul 2024 20:07:30 +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 469K7UFt025247; Tue, 9 Jul 2024 20:07:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 469K7UqU025244; Tue, 9 Jul 2024 20:07:30 GMT (envelope-from git) Date: Tue, 9 Jul 2024 20:07:30 GMT Message-Id: <202407092007.469K7UqU025244@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 5f75cd390a67 - main - if_pfsync: lock buckets during pfsync_drop() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5f75cd390a67cbec06993c4c66f784f0f777c854 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5f75cd390a67cbec06993c4c66f784f0f777c854 commit 5f75cd390a67cbec06993c4c66f784f0f777c854 Author: Kristof Provost AuthorDate: 2024-07-07 14:42:48 +0000 Commit: Kristof Provost CommitDate: 2024-07-09 20:07:13 +0000 if_pfsync: lock buckets during pfsync_drop() We failed to lock buckets while dropping messages, which could potentially lead to crashes, and is the likely cause of panics like: > pfsync_drop: st->sync_state == q > # pfsync_drop > # pfsync_q_ins > # pfsync_insert_state > # pf_state_insert > ... Handle this by only handling the currently relevant (and this locked) bucket. This ensures that the bucket is locked while we manipulate it. While here also log slightly more information in the KASSERT(). MFC after: 2 weeks Sponsored by: Orange Business Services --- sys/netpfil/pf/if_pfsync.c | 70 ++++++++++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 080938700e1d..67011d16c788 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -345,7 +345,8 @@ static void pfsync_defer_tmo(void *); static void pfsync_request_update(u_int32_t, u_int64_t); static bool pfsync_update_state_req(struct pf_kstate *); -static void pfsync_drop(struct pfsync_softc *); +static void pfsync_drop_all(struct pfsync_softc *); +static void pfsync_drop(struct pfsync_softc *, int); static void pfsync_sendout(int, int); static void pfsync_send_plus(void *, size_t); @@ -485,7 +486,7 @@ pfsync_clone_destroy(struct ifnet *ifp) bpfdetach(ifp); if_detach(ifp); - pfsync_drop(sc); + pfsync_drop_all(sc); if_free(ifp); pfsync_multicast_cleanup(sc); @@ -1736,40 +1737,54 @@ pfsync_out_del_c(struct pf_kstate *st, void *buf) } static void -pfsync_drop(struct pfsync_softc *sc) +pfsync_drop_all(struct pfsync_softc *sc) { - struct pf_kstate *st, *next; - struct pfsync_upd_req_item *ur; struct pfsync_bucket *b; int c; - enum pfsync_q_id q; for (c = 0; c < pfsync_buckets; c++) { b = &sc->sc_buckets[c]; - for (q = 0; q < PFSYNC_Q_COUNT; q++) { - if (TAILQ_EMPTY(&b->b_qs[q])) - continue; - TAILQ_FOREACH_SAFE(st, &b->b_qs[q], sync_list, next) { - KASSERT(st->sync_state == pfsync_qid_sstate[q], - ("%s: st->sync_state == q", - __func__)); - st->sync_state = PFSYNC_S_NONE; - pf_release_state(st); - } - TAILQ_INIT(&b->b_qs[q]); - } + PFSYNC_BUCKET_LOCK(b); + pfsync_drop(sc, c); + PFSYNC_BUCKET_UNLOCK(b); + } +} - while ((ur = TAILQ_FIRST(&b->b_upd_req_list)) != NULL) { - TAILQ_REMOVE(&b->b_upd_req_list, ur, ur_entry); - free(ur, M_PFSYNC); +static void +pfsync_drop(struct pfsync_softc *sc, int c) +{ + struct pf_kstate *st, *next; + struct pfsync_upd_req_item *ur; + struct pfsync_bucket *b; + enum pfsync_q_id q; + + b = &sc->sc_buckets[c]; + PFSYNC_BUCKET_LOCK_ASSERT(b); + + for (q = 0; q < PFSYNC_Q_COUNT; q++) { + if (TAILQ_EMPTY(&b->b_qs[q])) + continue; + + TAILQ_FOREACH_SAFE(st, &b->b_qs[q], sync_list, next) { + KASSERT(st->sync_state == pfsync_qid_sstate[q], + ("%s: st->sync_state %d == q %d", + __func__, st->sync_state, q)); + st->sync_state = PFSYNC_S_NONE; + pf_release_state(st); } + TAILQ_INIT(&b->b_qs[q]); + } - b->b_len = PFSYNC_MINPKT; - free(b->b_plus, M_PFSYNC); - b->b_plus = NULL; - b->b_pluslen = 0; + while ((ur = TAILQ_FIRST(&b->b_upd_req_list)) != NULL) { + TAILQ_REMOVE(&b->b_upd_req_list, ur, ur_entry); + free(ur, M_PFSYNC); } + + b->b_len = PFSYNC_MINPKT; + free(b->b_plus, M_PFSYNC); + b->b_plus = NULL; + b->b_pluslen = 0; } static void @@ -1793,7 +1808,7 @@ pfsync_sendout(int schedswi, int c) PFSYNC_BUCKET_LOCK_ASSERT(b); if (!bpf_peers_present(ifp->if_bpf) && sc->sc_sync_if == NULL) { - pfsync_drop(sc); + pfsync_drop(sc, c); return; } @@ -1841,6 +1856,7 @@ pfsync_sendout(int schedswi, int c) #endif default: m_freem(m); + pfsync_drop(sc, c); return; } m->m_len = m->m_pkthdr.len = len; @@ -2401,8 +2417,8 @@ pfsync_q_ins(struct pf_kstate *st, int sync_state, bool ref) } b->b_len += nlen; - TAILQ_INSERT_TAIL(&b->b_qs[q], st, sync_list); st->sync_state = pfsync_qid_sstate[q]; + TAILQ_INSERT_TAIL(&b->b_qs[q], st, sync_list); if (ref) pf_ref_state(st); } From nobody Wed Jul 10 06:06:02 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJnRG2tGYz5QF90; Wed, 10 Jul 2024 06:06:02 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJnRG2FpZz4cPD; Wed, 10 Jul 2024 06:06:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720591562; 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=oibtB/hHN5LGZZTG1AQvGRr74/67qHvgdRkbCwy/Q/8=; b=XoAfA8ApOXB97S72MTEUN53kRgtul3MlhxP40VLWYefhHADRbVt6oOXMkvpfd3++nZM9VE rnSDDHnshHDdLvj4cTdplNCJX2RzEWPqtb32ZqdPI7QOEcgAxpMVD7C9Utc/SZSGSK5V4L L4JpLPnvW/vs9tLw4HI4vm7VKV9mKOxl+Jzu1FRtGnnOal0O73bR/F1Baz4+HYuURcyyJ5 m6MsqX+OUqr7q3c7rcfCgeUlflcxxLR0+jaxgo5XGoHCTq6dBs/DVM6nW4aM6bMMFlJeEE 4JZRwup65AAO/r0EH4WZrJzGVtkOLy1+xRB0qr3ruchygFTdKk7TqDz/mR9rMg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720591562; a=rsa-sha256; cv=none; b=Q4BIDqYMGiQ5GaGPZMRk5sCJB2DL3ZT8vknYRHTcT+33ys1qQeIFGZn9LS6RDo2ZNWdMNO WVXyT5wVCgq1xjx33x13i/aUi7UKppcfNU3zvDRxXa++yZdJJtEXcZvbVc2dc/PnKFbN98 b13KTi2VOnZcKB9yeB+0bwSXg3t3JEcRbSO8RPrNBrIhWB8GAkubveOBFUPFAY9h+YwkQK jhgpycU5RIKKP1jysEUabGnON1QwfhS5OuL64UZ82LEzVUEqQ6dnO6BpX6siIdw1IMa8Cd m/j+aBgqMf46ZpuVLeFv/i639ZQDThTXLxz/Bmx07RzIjsp27M17MkVi+dLM0A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720591562; 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=oibtB/hHN5LGZZTG1AQvGRr74/67qHvgdRkbCwy/Q/8=; b=yCFOSE71GejcBSmOq1nX7zpSOwlDEaWVGI7t9Ni8gEb+eOfusdhJKz7UtMdA6tdrsxkyVl kdZCIe83ifECpYQRzuH7SCkMPiJN29r9DNIf8TCbHlrpGNR5hVoTq886xcJGhSZBOO10oA nZFdCFX/S0lkafNHsCQR2Yquf1XfFLTGgPRc9tVPhk5ZdQatt+bSog4CAuekndvAKgurt2 ETBNamCS9zy8hix/2mflACTjjGAm5yTInbHtFxeOrBzU2qwK/3VpBoSNOq6aVMhsh1Xd7G 64cDMY6j7B4wZJZvoT43DVYjhvQplE1GFoJ2gTaA1cmdCyg/MD7cLrC41RE4ZQ== 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 4WJnRG1sB2z15bL; Wed, 10 Jul 2024 06:06: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 46A662N5046469; Wed, 10 Jul 2024 06:06:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46A662HP046466; Wed, 10 Jul 2024 06:06:02 GMT (envelope-from git) Date: Wed, 10 Jul 2024 06:06:02 GMT Message-Id: <202407100606.46A662HP046466@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 13d00a43cba4 - main - conf: Add usbhid and hidbus to GENERIC* kernel configs List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 13d00a43cba4c35fcc9e0ab567baf530126a6348 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=13d00a43cba4c35fcc9e0ab567baf530126a6348 commit 13d00a43cba4c35fcc9e0ab567baf530126a6348 Author: Emmanuel Vadot AuthorDate: 2024-06-20 07:30:07 +0000 Commit: Emmanuel Vadot CommitDate: 2024-07-10 06:05:25 +0000 conf: Add usbhid and hidbus to GENERIC* kernel configs Include the new unified HID stack by default in generic. This will allow us to migrate to the multi-stack hkbd and hms instead of relying on the older ukbd and ums which only work with USB. To test those drivers just add hw.usb.usbhid.enable=1 in loader.conf Differential Revision: https://reviews.freebsd.org/D45658 Reviewed by: emaste, imp, wulf (all older version) Sponsored by: Beckhoff Automation GmbH & Co. KG --- sys/amd64/conf/GENERIC | 5 ++++- sys/arm/conf/GENERIC | 4 ++++ sys/arm/conf/RPI-B | 1 + sys/arm/conf/TEGRA124 | 4 ++++ sys/arm64/conf/std.dev | 5 ++++- sys/i386/conf/GENERIC | 5 ++++- sys/powerpc/conf/GENERIC | 8 ++++++-- sys/powerpc/conf/GENERIC64 | 8 ++++++-- sys/powerpc/conf/GENERIC64LE | 8 ++++++-- sys/powerpc/conf/MPC85XX | 4 ++++ sys/powerpc/conf/MPC85XXSPE | 4 ++++ sys/powerpc/conf/QORIQ64 | 4 ++++ sys/riscv/conf/GENERIC | 3 +++ 13 files changed, 54 insertions(+), 9 deletions(-) diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index 4a84e8e56596..49fe8fde0e81 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -324,7 +324,9 @@ device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) device xhci # XHCI PCI->USB interface (USB 3.0) device usb # USB Bus (required) -device ukbd # Keyboard +device usbhid # USB HID Transport +device hkbd # HID Keyboard +device ukbd # USB Keyboard device umass # Disks/Mass storage - Requires scbus and da # Sound support @@ -375,6 +377,7 @@ device uinput # install /dev/uinput cdev # HID support options HID_DEBUG # enable debug msgs device hid # Generic HID support +device hidbus # Generic HID Bus options IICHID_SAMPLING # Workaround missing GPIO INTR support # EFI devices diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC index 16830340df4f..b5321daa235a 100644 --- a/sys/arm/conf/GENERIC +++ b/sys/arm/conf/GENERIC @@ -191,7 +191,9 @@ device musb device axe # USB-Ethernet device umass # Disks/Mass storage - Requires scbus and da +device usbhid # USB HID Transport device uhid # "Human Interface Devices" +device hkbd # Allow keyboard like HIDs to control console device ukbd # Allow keyboard like HIDs to control console # Device mode support @@ -225,6 +227,7 @@ device sound # Framebuffer support device vt device kbdmux +device hms device ums device videomode device vchiq @@ -262,6 +265,7 @@ device aw_thermal # Allwinner Thermal Sensor Controller # HID support device hid # Generic HID support +device hidbus # Generic HID Bus # Flattened Device Tree options FDT # Configure using FDT/DTB data diff --git a/sys/arm/conf/RPI-B b/sys/arm/conf/RPI-B index 844b31686d5a..d0a3ee13c367 100644 --- a/sys/arm/conf/RPI-B +++ b/sys/arm/conf/RPI-B @@ -57,6 +57,7 @@ device usb_template # Control of the gadget # Comment following lines for boot console on serial port device vt device kbdmux +device hkbd device ukbd device sdhci diff --git a/sys/arm/conf/TEGRA124 b/sys/arm/conf/TEGRA124 index 223dd925e56b..6a39abf6cee4 100644 --- a/sys/arm/conf/TEGRA124 +++ b/sys/arm/conf/TEGRA124 @@ -85,6 +85,7 @@ device ehci # EHCI USB interface device xhci # XHCI USB interface device tegra124_xusb_fw # Tegra XUSB firmware device usb # USB Bus (required) +device usbhid # USB HID Transport device umass # Disks/Mass storage - Requires scbus and da device uhid # "Human Interface Devices" #device u3g # USB modems @@ -129,6 +130,9 @@ device drm2 # HID support device hid # Generic HID support +device hidbus # Generic HID Bus +device hkbd # Allow keyboard like HIDs to control console +device hms # HID mouse # Flattened Device Tree options FDT # Configure using FDT/DTB data diff --git a/sys/arm64/conf/std.dev b/sys/arm64/conf/std.dev index eefff7e3a6e0..42c9fcf03b05 100644 --- a/sys/arm64/conf/std.dev +++ b/sys/arm64/conf/std.dev @@ -99,7 +99,9 @@ device uhci # UHCI USB interface device ehci # EHCI USB interface (USB 2.0) device xhci # XHCI USB interface (USB 3.0) device usb # USB Bus (required) -device ukbd # Keyboard +device usbhid # USB HID Transport +device hkbd # HID Keyboard +device ukbd # USB Keyboard device umass # Disks/Mass storage - Requires scbus and da # Sound support @@ -112,6 +114,7 @@ device mmcsd # mmc/sd flash cards # HID support options HID_DEBUG # enable debug msgs device hid # Generic HID support +device hidbus # Generic HID Bus # Firmware device mmio_sram # Generic on-chip SRAM diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC index b32986e13769..e7851f7eb92c 100644 --- a/sys/i386/conf/GENERIC +++ b/sys/i386/conf/GENERIC @@ -289,7 +289,9 @@ device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface (USB 2.0) device xhci # XHCI PCI->USB interface (USB 3.0) device usb # USB Bus (required) -device ukbd # Keyboard +device usbhid # USB HID Transport +device hkbd # HID Keyboard +device ukbd # USB Keyboard device umass # Disks/Mass storage - Requires scbus and da # Sound support @@ -336,4 +338,5 @@ device uinput # install /dev/uinput cdev # HID support options HID_DEBUG # enable debug msgs device hid # Generic HID support +device hidbus # Generic HID Bus options IICHID_SAMPLING # Workaround missing GPIO INTR support diff --git a/sys/powerpc/conf/GENERIC b/sys/powerpc/conf/GENERIC index dedaa931f4ef..7c7d2809d784 100644 --- a/sys/powerpc/conf/GENERIC +++ b/sys/powerpc/conf/GENERIC @@ -174,12 +174,15 @@ device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface device usb # USB Bus (required) +device usbhid # USB HID Transport device uhid # "Human Interface Devices" -device ukbd # Keyboard +device hkbd # HID Keyboard +device ukbd # USB Keyboard options KBD_INSTALL_CDEV # install a CDEV entry in /dev device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da0 -device ums # Mouse +device hms # HID Mouse +device ums # USB Mouse device atp # Apple USB touchpad device urio # Diamond Rio 500 MP3 player # USB Ethernet @@ -235,3 +238,4 @@ device virtio_balloon # VirtIO Memory Balloon device # HID support options HID_DEBUG # enable debug msgs device hid # Generic HID support +device hidbus # Generic HID Bus diff --git a/sys/powerpc/conf/GENERIC64 b/sys/powerpc/conf/GENERIC64 index 79f484e02dbc..9a363a5471a1 100644 --- a/sys/powerpc/conf/GENERIC64 +++ b/sys/powerpc/conf/GENERIC64 @@ -214,11 +214,14 @@ device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface device xhci # XHCI PCI->USB interface device usb # USB Bus (required) +device usbhid # USB HID Transport device uhid # "Human Interface Devices" -device ukbd # Keyboard +device hkbd # HID Keyboard +device ukbd # USB Keyboard options KBD_INSTALL_CDEV # install a CDEV entry in /dev device umass # Disks/Mass storage - Requires scbus and da0 -device ums # Mouse +device hms # HID Mouse +device ums # USB Mouse # USB Ethernet device aue # ADMtek USB Ethernet device axe # ASIX Electronics USB Ethernet @@ -288,3 +291,4 @@ device virtio_balloon # VirtIO Memory Balloon device # HID support options HID_DEBUG # enable debug msgs device hid # Generic HID support +device hidbus # Generic HID Bus diff --git a/sys/powerpc/conf/GENERIC64LE b/sys/powerpc/conf/GENERIC64LE index 61f67b7246c6..6aeb188d7501 100644 --- a/sys/powerpc/conf/GENERIC64LE +++ b/sys/powerpc/conf/GENERIC64LE @@ -210,11 +210,14 @@ device ohci # OHCI PCI->USB interface device ehci # EHCI PCI->USB interface device xhci # XHCI PCI->USB interface device usb # USB Bus (required) +device usbhid # USB HID Transport device uhid # "Human Interface Devices" -device ukbd # Keyboard +device hkbd # HID Keyboard +device ukbd # USB Keyboard options KBD_INSTALL_CDEV # install a CDEV entry in /dev device umass # Disks/Mass storage - Requires scbus and da0 -device ums # Mouse +device hms # HID Mouse +device ums # USB Mouse # USB Ethernet device aue # ADMtek USB Ethernet device axe # ASIX Electronics USB Ethernet @@ -269,3 +272,4 @@ device virtio_balloon # VirtIO Memory Balloon device # HID support options HID_DEBUG # enable debug msgs device hid # Generic HID support +device hidbus # Generic HID Bus diff --git a/sys/powerpc/conf/MPC85XX b/sys/powerpc/conf/MPC85XX index c31f892a4208..3c79eeebcf61 100644 --- a/sys/powerpc/conf/MPC85XX +++ b/sys/powerpc/conf/MPC85XX @@ -109,10 +109,13 @@ device uart options USB_DEBUG # enable debug msgs #device uhci device ehci +device hkbd device ukbd +device hms device ums device umass device usb +device usbhid device vlan # P1022 DIU @@ -124,3 +127,4 @@ device fbd # HID support options HID_DEBUG # enable debug msgs device hid # Generic HID support +device hidbus # Generic HID bus diff --git a/sys/powerpc/conf/MPC85XXSPE b/sys/powerpc/conf/MPC85XXSPE index 8ebc4a41bcb2..99a583d109f4 100644 --- a/sys/powerpc/conf/MPC85XXSPE +++ b/sys/powerpc/conf/MPC85XXSPE @@ -116,10 +116,13 @@ device uart options USB_DEBUG # enable debug msgs #device uhci device ehci +device hkbd device ukbd +device hms device ums device umass device usb +device usbhid device vlan # VirtIO support @@ -139,3 +142,4 @@ device fbd # HID support options HID_DEBUG # enable debug msgs device hid # Generic HID support +device hidbus # Generic HID bus diff --git a/sys/powerpc/conf/QORIQ64 b/sys/powerpc/conf/QORIQ64 index 369e83179c59..9b3205d33a7b 100644 --- a/sys/powerpc/conf/QORIQ64 +++ b/sys/powerpc/conf/QORIQ64 @@ -112,15 +112,19 @@ options USB_DEBUG # enable debug msgs device ehci device umass device usb +device usbhid device vlan # Desktop related device vt device fbd options KBD_INSTALL_CDEV +device hkbd device ukbd +device hms device ums # HID support options HID_DEBUG # enable debug msgs device hid # Generic HID support +device hidbus # Generic HID bus diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index ce9038cee4a9..4e01c39bc008 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -119,12 +119,15 @@ device uhci # UHCI USB interface device ehci # EHCI USB interface (USB 2.0) device xhci # XHCI USB interface (USB 3.0) device usb # USB Bus (required) +device usbhid # USB HID Transport +device hkbd # Keyboard device ukbd # Keyboard device umass # Disks/Mass storage - Requires scbus and da # HID support options HID_DEBUG # enable debug msgs device hid # Generic HID support +device hidbus # Generic HID Bus # Serial (COM) ports device uart # Generic UART driver From nobody Wed Jul 10 06:11:44 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJnYr2wNhz5QFvd; Wed, 10 Jul 2024 06:11: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJnYr2VYBz4d5m; Wed, 10 Jul 2024 06:11:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720591904; 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=zGQbu+2vbRjBceymfMuF8FRsWZnSt/Qqp+qDWMSvzx8=; b=ekkJrNBAriHjCjH5d2IWWkNYZCT61GxnePm4anf1dzJLG39ialmCIe4kQMd8C4CxEt/WCa 1CahCM6dwhJBYZtLdG69LNvUDwg0R4ma02JSrKkhR1MzwqbNOr4vhgRn3a8S+0JzknGnU8 ifr/ygDAJ01VZzNVbIVbxV757hyyTCwYJh/T58Tt8K1ev2Y8lKd3J9V2/9f/3MJ1VoodqX 6CjDy6FBrAt0Xd18uIigx93JWUcThKD4vfZC+A8CdHLBCgzbt7v6FYpPDAQ8hx3luvsnJ8 19my05pzfB2Es95Z1IZjz28VdOKSCym6Rs9F3C5nzIpB93buQmGOFXlQuOr9ww== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720591904; a=rsa-sha256; cv=none; b=pc23vdzW9w+hkyWoXT7Q+FiPIX0G+Tj+mnqLwIcv6ZnzS+91pTmmuigdWHSPjNfH7K6Fmj cxn2W6jja7IBeARzmbne1szTslTsS/+uKRl3VlaHaPKx6xhIpBRh9Rl7nWvlD+CRkAj883 p4fnj3Ukmj2I3eK0By39GLxQD85SzC+PNrwymUw2jPwgg7IKCIX1/jcYoxjtDkT9u1eTpY R5W8oU0zF9MU/I7l9NfhZQ/m+8jX6ZIUbJKF4gvdg9lP0m7t9qTBuxevmqVmxaCThOpwhD ur6CaRCxY8GAy1Ey2/fk/ETZVcJh5I2gpRVu6iqM/JeFJhooCYJvesZCA7y+dQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720591904; 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=zGQbu+2vbRjBceymfMuF8FRsWZnSt/Qqp+qDWMSvzx8=; b=IFo3n+aZfyorFUWnsYvcmVOxPdAr5Xrzl6RVmUe56hoI1zl442ZOuAai3iRYdKGFuANdah F4AtxzSvAJyJeHrFOSHnE6+GyTqByrUGpyjm29HGipNom2R53aHuUtn/ipvITVUNliPqmB sPkwFC8Ni+0yIOr81J36MjlW8XQ6tfLim+K1RJPVQyK7WMlLyu4RNLm6jVADVWlo6+n4Xe +m2fQQROUT5gxPCPwWsv0exOzl+iMh/g86osQ8Wq9vvwIGE58W72vwZUR+elt0GTzLexXm 8HItd72XXvBZpZRhesj7A/lqbpL2CsdZR+DQ3f1cimyjhF7Kk/iXfIkueGjeyg== 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 4WJnYr23zYz15qd; Wed, 10 Jul 2024 06:11: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 46A6Bi0H057132; Wed, 10 Jul 2024 06:11:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46A6BiL6057129; Wed, 10 Jul 2024 06:11:44 GMT (envelope-from git) Date: Wed, 10 Jul 2024 06:11:44 GMT Message-Id: <202407100611.46A6BiL6057129@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 887062c1da4a - main - stand: Fix logo alpha List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 887062c1da4a4c04a2b3987ec9a4e2a5902122d5 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=887062c1da4a4c04a2b3987ec9a4e2a5902122d5 commit 887062c1da4a4c04a2b3987ec9a4e2a5902122d5 Author: Emmanuel Vadot AuthorDate: 2024-07-09 12:53:08 +0000 Commit: Emmanuel Vadot CommitDate: 2024-07-10 06:11:30 +0000 stand: Fix logo alpha The alpha wasn't done properly and some white stripes could be seen. Differential Revision: https://reviews.freebsd.org/D45933 Reviewed by: imp. tsoome Sponsored by: Beckhoff Automation GmbH & Co. KG --- stand/images/freebsd-logo-rev.png | Bin 43898 -> 39052 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/stand/images/freebsd-logo-rev.png b/stand/images/freebsd-logo-rev.png index 5279b718218c..6e2088df4654 100644 Binary files a/stand/images/freebsd-logo-rev.png and b/stand/images/freebsd-logo-rev.png differ From nobody Wed Jul 10 06:27:20 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJnvx5qnqz5QHG2; Wed, 10 Jul 2024 06:27:25 +0000 (UTC) (envelope-from cvs-src@yandex.ru) Received: from forward500b.mail.yandex.net (forward500b.mail.yandex.net [178.154.239.144]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4WJnvx0mMrz4f9R; Wed, 10 Jul 2024 06:27:25 +0000 (UTC) (envelope-from cvs-src@yandex.ru) Authentication-Results: mx1.freebsd.org; none Received: from mail-nwsmtp-mxback-production-main-561.myt.yp-c.yandex.net (mail-nwsmtp-mxback-production-main-561.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:290d:0:640:1b70:0]) by forward500b.mail.yandex.net (Yandex) with ESMTPS id C2FB4610F1; Wed, 10 Jul 2024 09:27:20 +0300 (MSK) Received: from mail.yandex.ru (2a02:6b8:c12:3b1a:0:640:6a6:0 [2a02:6b8:c12:3b1a:0:640:6a6:0]) by mail-nwsmtp-mxback-production-main-561.myt.yp-c.yandex.net (mxback/Yandex) with HTTPS id IRXqVo2XFqM0-H0a0CoHL; Wed, 10 Jul 2024 09:27:20 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1720592840; bh=FnZ1u3948lE/6xVr4H7AoTfMlPoICiHusXlwVvdIcA4=; h=Message-Id:References:Date:Subject:In-Reply-To:To:From; b=f/re+QWA8eUY8hl/T+/H4kANC9zzhFOXfbGQeahxG+Q6eYEF0WKpUNIMqX+K4Dq5E AdLFuIk8STMOeTPxRjjK4+2uY/85UcUckpCZWBrwXxFE8oorKF5nOQj5i4/1AD4TJ3 X9TxqNJYtxWawe6m4kCKxrXfV6eGDVSCqv7ORLm0= Received: by prvcgftslwhsg7ig.myt.yp-c.yandex.net with HTTP; Wed, 10 Jul 2024 09:27:20 +0300 From: Ruslan Makhmatkhanov Envelope-From: cvs-src@yandex.ru To: Emmanuel Vadot , "src-committers@FreeBSD.org" , "dev-commits-src-all@FreeBSD.org" , "dev-commits-src-main@FreeBSD.org" In-Reply-To: <202407100611.46A6BiL6057129@gitrepo.freebsd.org> References: <202407100611.46A6BiL6057129@gitrepo.freebsd.org> Subject: Re: git: 887062c1da4a - main - stand: Fix logo alpha List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Wed, 10 Jul 2024 09:27:20 +0300 Message-Id: <43531720592743@mail.yandex.ru> Content-Transfer-Encoding: base64 Content-Type: text/html; charset=utf-8 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:200350, ipnet:178.154.224.0/19, country:RU] X-Rspamd-Queue-Id: 4WJnvx0mMrz4f9R PGRpdj7CoDwvZGl2PjxkaXY+wqA8L2Rpdj48ZGl2PjEwLjA3LjIwMjQsIDA5OjExLCAiRW1tYW51 ZWwgVmFkb3QiICZsdDttYW51QGZyZWVic2Qub3JnJmd0Ozo8L2Rpdj48YmxvY2txdW90ZT48cD5U aGUgYnJhbmNoIG1haW4gaGFzIGJlZW4gdXBkYXRlZCBieSBtYW51OjxiciAvPjxiciAvPlVSTDog PGEgaHJlZj0iaHR0cHM6Ly9jZ2l0LmZyZWVic2Qub3JnL3NyYy9jb21taXQvP2lkPTg4NzA2MmMx ZGE0YTRjMDRhMmIzOTg3ZWM5YTRlMmE1OTAyMTIyZDUiIHJlbD0ibm9vcGVuZXIgbm9yZWZlcnJl ciI+aHR0cHM6Ly9jZ2l0LkZyZWVCU0Qub3JnL3NyYy9jb21taXQvP2lkPTg4NzA2MmMxZGE0YTRj MDRhMmIzOTg3ZWM5YTRlMmE1OTAyMTIyZDU8L2E+PGJyIC8+PGJyIC8+Y29tbWl0IDg4NzA2MmMx ZGE0YTRjMDRhMmIzOTg3ZWM5YTRlMmE1OTAyMTIyZDU8YnIgLz5BdXRob3I6IEVtbWFudWVsIFZh ZG90ICZsdDs8YSBocmVmPSJtYWlsdG86bWFudUBGcmVlQlNELm9yZyIgcmVsPSJub29wZW5lciBu b3JlZmVycmVyIj5tYW51QEZyZWVCU0Qub3JnPC9hPiZndDs8YnIgLz5BdXRob3JEYXRlOiAyMDI0 LTA3LTA5IDEyOjUzOjA4ICswMDAwPGJyIC8+Q29tbWl0OiBFbW1hbnVlbCBWYWRvdCAmbHQ7PGEg aHJlZj0ibWFpbHRvOm1hbnVARnJlZUJTRC5vcmciIHJlbD0ibm9vcGVuZXIgbm9yZWZlcnJlciI+ bWFudUBGcmVlQlNELm9yZzwvYT4mZ3Q7PGJyIC8+Q29tbWl0RGF0ZTogMjAyNC0wNy0xMCAwNjox MTozMCArMDAwMDxiciAvPjxiciAvPsKgwqDCoMKgc3RhbmQ6IEZpeCBsb2dvIGFscGhhPGJyIC8+ wqDCoMKgwqA8YnIgLz7CoMKgwqDCoFRoZSBhbHBoYSB3YXNuJ3QgZG9uZSBwcm9wZXJseSBhbmQg c29tZSB3aGl0ZSBzdHJpcGVzIGNvdWxkIGJlIHNlZW4uPGJyIC8+wqDCoMKgwqA8L3A+PC9ibG9j a3F1b3RlPjxkaXY+PGRpdj5JJ2QgZ2l2ZSBhbnl0aGluZyB0byBzZWUgV2hpdGUgU3RyaXBlcyBh Z2Fpbi4gU29ycnk8L2Rpdj48L2Rpdj48ZGl2PsKgPC9kaXY+PGRpdj4tLcKgPC9kaXY+PGRpdj5S ZWdhcmRzLDwvZGl2PjxkaXY+UnVzbGFuPC9kaXY+PGRpdj7CoDwvZGl2Pg== From nobody Wed Jul 10 06:50:48 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJpRj3kclz5QK39; Wed, 10 Jul 2024 06:51:29 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4WJpRh3T62z4gr3; Wed, 10 Jul 2024 06:51:28 +0000 (UTC) (envelope-from manu@bidouilliste.com) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1720594285; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gGwh9bBp4MTLBFgXcx6s5YDfKgJMTL5uPvxhcJmT8Ag=; b=LkjsfsXpqyRGhnKsCNE5z8s32kRyUkNwQxiJmBkIR9JRFgv+Ub/gm437ZfEzUEZVu+IXN2 +wh0dgaNGtQ9UZzbIpDGXJpsTUudvIHjOl7o7Wjh1CJbokfdliDcDDW2aMf1B5R8a17NL7 DhH0jr8UZgrmVHHa6oIOvXCxCufDdq8= Received: from skull.home.blih.net (lfbn-lyo-1-2174-135.w90-66.abo.wanadoo.fr [90.66.97.135]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 80ca8078 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 10 Jul 2024 06:51:22 +0000 (UTC) Date: Wed, 10 Jul 2024 08:50:48 +0200 From: Emmanuel Vadot To: Ruslan Makhmatkhanov Cc: Emmanuel Vadot , "src-committers@FreeBSD.org" , "dev-commits-src-all@FreeBSD.org" , "dev-commits-src-main@FreeBSD.org" Subject: Re: git: 887062c1da4a - main - stand: Fix logo alpha Message-Id: <20240710085048.f2d3bbee8b5efde4b0b3e2e8@bidouilliste.com> In-Reply-To: <43531720592743@mail.yandex.ru> References: <202407100611.46A6BiL6057129@gitrepo.freebsd.org> <43531720592743@mail.yandex.ru> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd15.0) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:12876, ipnet:212.83.128.0/19, country:FR] X-Rspamd-Queue-Id: 4WJpRh3T62z4gr3 On Wed, 10 Jul 2024 09:27:20 +0300 Ruslan Makhmatkhanov wrote: > =A0 > =A0 > 10.07.2024, 09:11, "Emmanuel Vadot" : > =20 > The branch main has been updated by manu: > =20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D887062c1da4a4c04a2b3987e= c9a4e2a5902122d5 > =20 > commit 887062c1da4a4c04a2b3987ec9a4e2a5902122d5 > Author: Emmanuel Vadot > AuthorDate: 2024-07-09 12:53:08 +0000 > Commit: Emmanuel Vadot > CommitDate: 2024-07-10 06:11:30 +0000 > =20 > =A0=A0=A0=A0stand: Fix logo alpha > =A0=A0=A0=A0 > =A0=A0=A0=A0The alpha wasn't done properly and some white stripes could= be seen. > =A0=A0=A0=A0 > I'd give anything to see White Stripes again. Sorry Is this a joke about the band or is it really about this commit ? > --=A0 > Regards, > Ruslan > =A0 --=20 Emmanuel Vadot From nobody Wed Jul 10 06:56:10 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJpY64zSnz5QKNv; Wed, 10 Jul 2024 06:56:10 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJpY64QsHz4hCG; Wed, 10 Jul 2024 06:56:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720594570; 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=XqOsDtYxudtXgsBwOcVBb4YLq2HHtaPZhOU8Oo7vDgY=; b=lfLsPbyDVlyzPdkMl/6tt9bb7UYFDVeQGhYS+U4QDDdbyfUBmzxjnMXYIdHMBZlk+iyAGZ nhy34DIZ1ohf/2CbB/baB2OcUNY6uDYgjtZp3ag2t9zUYy9ivDubOtGliW/8DmxFYzw9Dk zrRcE0GLDbBrzZYFVtiQrIcBRT4zpvX3I5w8BmQAH2+92Jxg1XyHsH4EcSDxzahXgtftVa fLEn7U3znGkrAs5FGvNWVFuM0+/kLXCEW4ocs3ky8ubYxLPJYyMR5Y9iuUbOBgFHRaPNMN kct17BalP1TSN86l1N+G06YFz2gp9oWuZDcOL6F7HX2pnInPEAZ5gjfqiGV5kQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720594570; a=rsa-sha256; cv=none; b=TCjNyMpTOygt3qLO6ZUXdGsnhEGIlVP3d4+y16mcYRSYfOrE9Kp7+7/KaFALK9cgt7t2Ca ZHF4Ny9iWnvmDVe9meGMairTvre/2xiTjG9DI39fhqseV/GIAaAJBIvnGHR0nBVQm4hCk/ Vmu0FEaHtBN8zKJoS9nTwfAG+4CRQPEHTA0NRosPj3igoru4f+na8puB7XeHscoLqgeUlv DGnVgg7K4SxRUEhFM0xtZAZva5Y9Z1nKUVLef3b+w/9XFdYZyjC0nJ2FnfOKJS5EJ1VW8f aj43Z9ecVM0vlTxporQ7EEceyG9d6SlxNLW1lCvhaaZ81sC7KXc+Z6NP6Y6nBQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720594570; 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=XqOsDtYxudtXgsBwOcVBb4YLq2HHtaPZhOU8Oo7vDgY=; b=eEH9EEQxaiyhfTVhOuBgh85w8rqxDb+o11Rmzu/EKstyd/oFHEn2407m6aUQ95wWQZb0hO Ajq3KcjpzMMlENKGM61H/OMeAfg+56s8mtonVtKdFxvjkBGMxARd0dLjzJp7uG+vvjBy4a LfNWXWfQYMS5VJUblXN8UmrBsxU7Ohxp7Oa34qHLebk54kEUFOxsnJI32KdScZkYe+h/4g DfISFicrFgT9NwgIEcQWhdYvFRVTrOlPPYssUY8cw8YCdjEiTXAl+w1vLBhFquf+TAAY4D e9NhLoxxiNoBt5sJxzhanHqbAzoIzgKIMgjSoAyespmr27nZSLPLS6DhQCkwRw== 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 4WJpY6421wz16Pm; Wed, 10 Jul 2024 06:56:10 +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 46A6uAol030374; Wed, 10 Jul 2024 06:56:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46A6uA6O030371; Wed, 10 Jul 2024 06:56:10 GMT (envelope-from git) Date: Wed, 10 Jul 2024 06:56:10 GMT Message-Id: <202407100656.46A6uA6O030371@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 5ed91e788f0b - main - conf: hidmap is always needed for hms List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5ed91e788f0b97c9e6c544671ffef71fad7cad27 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=5ed91e788f0b97c9e6c544671ffef71fad7cad27 commit 5ed91e788f0b97c9e6c544671ffef71fad7cad27 Author: Emmanuel Vadot AuthorDate: 2024-07-10 06:55:24 +0000 Commit: Emmanuel Vadot CommitDate: 2024-07-10 06:55:24 +0000 conf: hidmap is always needed for hms So bring it in when hms is in the kernel config Fixes: 13d00a43cba4 ("conf: Add usbhid and hidbus to GENERIC* kernel configs") Sponsored by: Beckhoff Automation GmbH & Co. KG --- sys/conf/files | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/files b/sys/conf/files index 968894ea948b..609ac407d400 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1760,7 +1760,7 @@ dev/hid/hgame.c optional hgame dev/hid/hid.c optional hid dev/hid/hid_if.m optional hid dev/hid/hidbus.c optional hidbus -dev/hid/hidmap.c optional hidmap +dev/hid/hidmap.c optional hidmap | hms dev/hid/hidquirk.c optional hid dev/hid/hidraw.c optional hidraw dev/hid/hkbd.c optional hkbd From nobody Wed Jul 10 06:57:18 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJpZW6t5yz5QKjJ; Wed, 10 Jul 2024 06:57:23 +0000 (UTC) (envelope-from cvs-src@yandex.ru) Received: from forward500a.mail.yandex.net (forward500a.mail.yandex.net [178.154.239.80]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4WJpZV6Ltpz4hV1; Wed, 10 Jul 2024 06:57:22 +0000 (UTC) (envelope-from cvs-src@yandex.ru) Authentication-Results: mx1.freebsd.org; none Received: from mail-nwsmtp-mxback-production-main-699.myt.yp-c.yandex.net (mail-nwsmtp-mxback-production-main-699.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:1106:0:640:b744:0]) by forward500a.mail.yandex.net (Yandex) with ESMTPS id 9FE4B61113; Wed, 10 Jul 2024 09:57:19 +0300 (MSK) Received: from mail.yandex.ru (2a02:6b8:c12:5502:0:640:e11:0 [2a02:6b8:c12:5502:0:640:e11:0]) by mail-nwsmtp-mxback-production-main-699.myt.yp-c.yandex.net (mxback/Yandex) with HTTPS id HvXQRH3O7Cg0-1NERPfQf; Wed, 10 Jul 2024 09:57:19 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1720594639; bh=g8Do6N5i48vC5yn+j7NYoCuBN+6mbaP7nLgnCz8dnh8=; h=References:Date:Message-Id:Cc:Subject:To:From:In-Reply-To; b=QvyQ/syG6szYYZoso0W+XKx3+0J/PPmzFj1uhvqr92beImV8kj+T1EFjRc6+f/z6b ne9VxgBHqdyhXfNkICqmGwFekiDzbhU6DxIP9NlJ8v9YVY+cC8Gn21fHxAJGWFXkqQ 2/XilCn4A6qRh2zyp6ePgwW+JBl+bvZkG3EOZhb4= Received: by cml2zkrna6iw5oui.myt.yp-c.yandex.net with HTTP; Wed, 10 Jul 2024 09:57:18 +0300 From: Ruslan Makhmatkhanov Envelope-From: cvs-src@yandex.ru To: Emmanuel Vadot Cc: Emmanuel Vadot , "src-committers@FreeBSD.org" , "dev-commits-src-all@FreeBSD.org" , "dev-commits-src-main@FreeBSD.org" In-Reply-To: <20240710085048.f2d3bbee8b5efde4b0b3e2e8@bidouilliste.com> References: <202407100611.46A6BiL6057129@gitrepo.freebsd.org> <43531720592743@mail.yandex.ru> <20240710085048.f2d3bbee8b5efde4b0b3e2e8@bidouilliste.com> Subject: Re: git: 887062c1da4a - main - stand: Fix logo alpha List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Wed, 10 Jul 2024 09:57:18 +0300 Message-Id: <54631720594583@mail.yandex.ru> Content-Transfer-Encoding: base64 Content-Type: text/html; charset=utf-8 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:200350, ipnet:178.154.224.0/19, country:RU] X-Rspamd-Queue-Id: 4WJpZV6Ltpz4hV1 PGRpdj7CoDwvZGl2PjxkaXY+wqA8L2Rpdj48ZGl2PjEwLjA3LjIwMjQsIDA5OjUxLCAiRW1tYW51 ZWwgVmFkb3QiICZsdDttYW51QGJpZG91aWxsaXN0ZS5jb20mZ3Q7OjwvZGl2PjxibG9ja3F1b3Rl PjxwPk9uIFdlZCwgMTAgSnVsIDIwMjQgMDk6Mjc6MjAgKzAzMDA8YnIgLz5SdXNsYW4gTWFraG1h dGtoYW5vdiAmbHQ7PGEgaHJlZj0ibWFpbHRvOnJtQGZyZWVic2Qub3JnIiByZWw9Im5vb3BlbmVy IG5vcmVmZXJyZXIiPnJtQGZyZWVic2Qub3JnPC9hPiZndDsgd3JvdGU6PGJyIC8+wqA8L3A+PGJs b2NrcXVvdGU+wqDCoDxiciAvPsKgwqA8YnIgLz7CoDEwLjA3LjIwMjQsIDA5OjExLCAiRW1tYW51 ZWwgVmFkb3QiICZsdDs8YSBocmVmPSJtYWlsdG86bWFudUBmcmVlYnNkLm9yZyIgcmVsPSJub29w ZW5lciBub3JlZmVycmVyIj5tYW51QGZyZWVic2Qub3JnPC9hPiZndDs6PGJyIC8+wqDCoMKgPGJy IC8+wqDCoMKgVGhlIGJyYW5jaCBtYWluIGhhcyBiZWVuIHVwZGF0ZWQgYnkgbWFudTo8YnIgLz7C oMKgwqA8YnIgLz7CoMKgwqBVUkw6IDxhIGhyZWY9Imh0dHBzOi8vY2dpdC5mcmVlYnNkLm9yZy9z cmMvY29tbWl0Lz9pZD04ODcwNjJjMWRhNGE0YzA0YTJiMzk4N2VjOWE0ZTJhNTkwMjEyMmQ1IiBy ZWw9Im5vb3BlbmVyIG5vcmVmZXJyZXIiPmh0dHBzOi8vY2dpdC5GcmVlQlNELm9yZy9zcmMvY29t bWl0Lz9pZD04ODcwNjJjMWRhNGE0YzA0YTJiMzk4N2VjOWE0ZTJhNTkwMjEyMmQ1PC9hPjxiciAv PsKgwqDCoDxiciAvPsKgwqDCoGNvbW1pdCA4ODcwNjJjMWRhNGE0YzA0YTJiMzk4N2VjOWE0ZTJh NTkwMjEyMmQ1PGJyIC8+wqDCoMKgQXV0aG9yOiBFbW1hbnVlbCBWYWRvdCAmbHQ7PGEgaHJlZj0i bWFpbHRvOm1hbnVARnJlZUJTRC5vcmciIHJlbD0ibm9vcGVuZXIgbm9yZWZlcnJlciI+bWFudUBG cmVlQlNELm9yZzwvYT4mZ3Q7PGJyIC8+wqDCoMKgQXV0aG9yRGF0ZTogMjAyNC0wNy0wOSAxMjo1 MzowOCArMDAwMDxiciAvPsKgwqDCoENvbW1pdDogRW1tYW51ZWwgVmFkb3QgJmx0OzxhIGhyZWY9 Im1haWx0bzptYW51QEZyZWVCU0Qub3JnIiByZWw9Im5vb3BlbmVyIG5vcmVmZXJyZXIiPm1hbnVA RnJlZUJTRC5vcmc8L2E+Jmd0OzxiciAvPsKgwqDCoENvbW1pdERhdGU6IDIwMjQtMDctMTAgMDY6 MTE6MzAgKzAwMDA8YnIgLz7CoMKgwqA8YnIgLz7CoMKgwqDCoMKgwqDCoHN0YW5kOiBGaXggbG9n byBhbHBoYTxiciAvPsKgwqDCoMKgwqDCoMKgPGJyIC8+wqDCoMKgwqDCoMKgwqBUaGUgYWxwaGEg d2Fzbid0IGRvbmUgcHJvcGVybHkgYW5kIHNvbWUgd2hpdGUgc3RyaXBlcyBjb3VsZCBiZSBzZWVu LjxiciAvPsKgwqDCoMKgwqDCoMKgPGJyIC8+wqBJJ2QgZ2l2ZSBhbnl0aGluZyB0byBzZWUgV2hp dGUgU3RyaXBlcyBhZ2Fpbi4gU29ycnk8L2Jsb2NrcXVvdGU+PHA+PGJyIC8+wqBJcyB0aGlzIGEg am9rZSBhYm91dCB0aGUgYmFuZCBvciBpcyBpdCByZWFsbHkgYWJvdXQgdGhpcyBjb21taXQgPzwv cD48L2Jsb2NrcXVvdGU+PGRpdj7CoDwvZGl2PjxwPkFib3V0IHRoZSBiYW5kLCBmb3Igc3VyZS4g QW5kIEkgYXBvbG9naXplZCBpbiBhZHZhbmNlKTwvcD48ZGl2Pi0twqA8L2Rpdj48ZGl2PlJlZ2Fy ZHMsPC9kaXY+PGRpdj5SdXNsYW48L2Rpdj48ZGl2PsKgPC9kaXY+ From nobody Wed Jul 10 06:58:44 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJpch592Wz5QKwJ; Wed, 10 Jul 2024 06:59:16 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4WJpch0lQqz4hjf; Wed, 10 Jul 2024 06:59:16 +0000 (UTC) (envelope-from manu@bidouilliste.com) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1720594754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VwvbFwDoqMs0/aHCPRQ34GRJjPKSCALyNO3V8ay9U/Y=; b=tarz5XthyVFeqyxOH37gHWNLqorhp6lsiwlhoXnIuRIMo7W63YO3hdaMBr4GUqtwbLF3WO Fzbfl01p2/il0nFW6teZ67DcE+q31FUfh4avsOh3RdkiIG28TezdgKifkrO11yxfo24dCf U5CC4+NOVBmqmnWAm18wwKHFlyURz1c= Received: from skull.home.blih.net (lfbn-lyo-1-2174-135.w90-66.abo.wanadoo.fr [90.66.97.135]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 58dc84fb (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 10 Jul 2024 06:59:14 +0000 (UTC) Date: Wed, 10 Jul 2024 08:58:44 +0200 From: Emmanuel Vadot To: Ruslan Makhmatkhanov Cc: Emmanuel Vadot , "src-committers@FreeBSD.org" , "dev-commits-src-all@FreeBSD.org" , "dev-commits-src-main@FreeBSD.org" Subject: Re: git: 887062c1da4a - main - stand: Fix logo alpha Message-Id: <20240710085844.583d1c8ee9fe44eab57dba57@bidouilliste.com> In-Reply-To: <54631720594583@mail.yandex.ru> References: <202407100611.46A6BiL6057129@gitrepo.freebsd.org> <43531720592743@mail.yandex.ru> <20240710085048.f2d3bbee8b5efde4b0b3e2e8@bidouilliste.com> <54631720594583@mail.yandex.ru> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd15.0) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:12876, ipnet:212.83.128.0/19, country:FR] X-Rspamd-Queue-Id: 4WJpch0lQqz4hjf On Wed, 10 Jul 2024 09:57:18 +0300 Ruslan Makhmatkhanov wrote: > =A0 > =A0 > 10.07.2024, 09:51, "Emmanuel Vadot" : > =20 > On Wed, 10 Jul 2024 09:27:20 +0300 > Ruslan Makhmatkhanov wrote: > =A0=A0=A0 > =A0=A0 > =A010.07.2024, 09:11, "Emmanuel Vadot" : > =A0=A0=A0 > =A0=A0=A0The branch main has been updated by manu: > =A0=A0=A0 > =A0=A0=A0URL: https://cgit.FreeBSD.org/src/commit/?id=3D887062c1da4a4= c04a2b3987ec9a4e2a5902122d5 > =A0=A0=A0 > =A0=A0=A0commit 887062c1da4a4c04a2b3987ec9a4e2a5902122d5 > =A0=A0=A0Author: Emmanuel Vadot > =A0=A0=A0AuthorDate: 2024-07-09 12:53:08 +0000 > =A0=A0=A0Commit: Emmanuel Vadot > =A0=A0=A0CommitDate: 2024-07-10 06:11:30 +0000 > =A0=A0=A0 > =A0=A0=A0=A0=A0=A0=A0stand: Fix logo alpha > =A0=A0=A0=A0=A0=A0=A0 > =A0=A0=A0=A0=A0=A0=A0The alpha wasn't done properly and some white st= ripes could be seen. > =A0=A0=A0=A0=A0=A0=A0 > =A0I'd give anything to see White Stripes again. Sorry > =20 > =20 > =A0Is this a joke about the band or is it really about this commit ? > =A0 >=20 > About the band, for sure. And I apologized in advance) No worries, I though so but wanted to be sure :) > --=A0 > Regards, > Ruslan > =A0 --=20 Emmanuel Vadot From nobody Wed Jul 10 08:13:14 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJrG31WLnz5QS3R; Wed, 10 Jul 2024 08:13: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJrG30dntz4ntj; Wed, 10 Jul 2024 08:13:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720599195; 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=AXO9IfKMUqMBdpLHo8h34ccNPUc2iRV7cIYfQYedifw=; b=TKF/9w7BDK5eusscsJapnsonkIQTEppmJnaCQ7PopF7VHl1llwRcipppZmnriYsVTI6zrW olNF5kVeaTagJsjPV0laleYpDP+xEcTpB36N/vWy1L3Z4CONtY+28iv6cKqK0vsDxZ+hj1 z0O1zhATwg8NrcbVc2x+kHNbjsOruMLOjIAVJ0akhXhPHW5v1QofFiz1hRv7YxOphtcNlj f3MSMT4gkDB6RwqJ4iDfbT0/t5FZCjTeZPR4owE7ica4P4Xr4uGUBSM6i4HhxTuDmR85ng iPjUUrxwSdIdiaCXNFQJiP/Eva2dNgUp7v3ccS+d+pLZ4EKXcf08eApZ1rWhvA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720599195; a=rsa-sha256; cv=none; b=RUfr31qQjtQjCSTYfekQ5L/8R/34zKqM3X5ntnpZuQjViv1hQx42DmxjCc7c/LIDUIcASV HvezXWBYLz9O0IN8hp996bXd1BtDmiX6uAm+KxhPjcNTAgN2XeYTc5J0ddwaG/XP2fi25h Al8D/AQElSFQLOwHnn+fRvc9rN537+fFmoeyincxNrZoEitHyfAhPQjvSUeuIIbGd6zjaB ziscDmHXda8jHC2xUIzMghJhz4pg7jUC4uk3mno6+vGJTFAm3+JaP70MIu0V/FjE8ElR8i 36gVdkcwl+plNdK6gO0sxIlV4X9VHNpFvrcPV/be/inYM4cSl6JMihfr12LApw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720599195; 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=AXO9IfKMUqMBdpLHo8h34ccNPUc2iRV7cIYfQYedifw=; b=Gw8/hT7h31ADX1EBI3VLyFjS0Yz1a6kiKr4tEWHRCI2/NvmijkNhc19ewcFUiR7QaR1tU4 We9fuiWGVRORAr72kCIsnFTAGabH3fIGrnk6PqfonhPrUY/5ksDt6yddajhJSrLz5ssFVI E+CffKzLWJWfT0NON+oDiLoJmAEfnT/Aul+/TjdTw2tZoXpYNqHV7TVH2jBffK5/grW7cN pYoFx4Wbyq/gUYnGZg/Khjra2Ae6O5/n4dpk8l9w7hpQUhNf/0E4LGL1vAsPHLCcmcOoHI Qvx6rCGFP+Pm6hUwFWXp0VxAPDR2pzwgrKajcr5W3/5bBTysfDP+IVuIhbJrVg== 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 4WJrG30BxDz18n4; Wed, 10 Jul 2024 08:13: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 46A8DERl066266; Wed, 10 Jul 2024 08:13:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46A8DEKH066263; Wed, 10 Jul 2024 08:13:14 GMT (envelope-from git) Date: Wed, 10 Jul 2024 08:13:14 GMT Message-Id: <202407100813.46A8DEKH066263@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 43a62df0b464 - main - conf: powerpc: Add evdev to some kernel configs List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 43a62df0b464e60895084c7f9d9eddf70906fda3 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=43a62df0b464e60895084c7f9d9eddf70906fda3 commit 43a62df0b464e60895084c7f9d9eddf70906fda3 Author: Emmanuel Vadot AuthorDate: 2024-07-10 08:12:48 +0000 Commit: Emmanuel Vadot CommitDate: 2024-07-10 08:13:18 +0000 conf: powerpc: Add evdev to some kernel configs Fixes: 13d00a43cba4 ("conf: Add usbhid and hidbus to GENERIC* kernel configs") Sponsored by: Beckhoff Automation GmbH & Co. KG --- sys/powerpc/conf/MPC85XX | 5 +++++ sys/powerpc/conf/MPC85XXSPE | 5 +++++ sys/powerpc/conf/QORIQ64 | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/sys/powerpc/conf/MPC85XX b/sys/powerpc/conf/MPC85XX index 3c79eeebcf61..674e8cb23d4e 100644 --- a/sys/powerpc/conf/MPC85XX +++ b/sys/powerpc/conf/MPC85XX @@ -124,6 +124,11 @@ device videomode device vt device fbd +# evdev interface +options EVDEV_SUPPORT # evdev support in legacy drivers +device evdev # input event device support +device uinput # install /dev/uinput cdev + # HID support options HID_DEBUG # enable debug msgs device hid # Generic HID support diff --git a/sys/powerpc/conf/MPC85XXSPE b/sys/powerpc/conf/MPC85XXSPE index 99a583d109f4..207533c32559 100644 --- a/sys/powerpc/conf/MPC85XXSPE +++ b/sys/powerpc/conf/MPC85XXSPE @@ -139,6 +139,11 @@ device videomode device vt device fbd +# evdev interface +options EVDEV_SUPPORT # evdev support in legacy drivers +device evdev # input event device support +device uinput # install /dev/uinput cdev + # HID support options HID_DEBUG # enable debug msgs device hid # Generic HID support diff --git a/sys/powerpc/conf/QORIQ64 b/sys/powerpc/conf/QORIQ64 index 9b3205d33a7b..e72d967dd895 100644 --- a/sys/powerpc/conf/QORIQ64 +++ b/sys/powerpc/conf/QORIQ64 @@ -124,6 +124,11 @@ device ukbd device hms device ums +# evdev interface +options EVDEV_SUPPORT # evdev support in legacy drivers +device evdev # input event device support +device uinput # install /dev/uinput cdev + # HID support options HID_DEBUG # enable debug msgs device hid # Generic HID support From nobody Wed Jul 10 09:40:05 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJtBF4fj1z5QZjL; Wed, 10 Jul 2024 09:40:05 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJtBF43JBz3yfN; Wed, 10 Jul 2024 09:40:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720604405; 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=0zSdWCziVnkERzwmwkqTdRnf4NqYrnTnpn0hJ0ZCT/M=; b=SfzNoFK1vKJJM5vupefUSubsU/qAGNFNWaZicCloyP5mtypWVRE3LHHbzYI/3ItqjC8QGF LfpTJJUeeLeafZm2IHweVwMZZRErOG0pMUgwVbrAsuGbqSarXy8DX2dl/EnONKHPvw4WI3 efJv5WCd0nItvRfwhE1xMaQ3eL68WNYWXx6v/XIAUQNTMR3aPmMoxrcTsHXmuPdYbB29A5 anl8gDC2NOSR/+p8S7YwvpLugDBbg6TcBxQpSoAJusV00srQaVJ53rkk2xy9nN7x76xilz 2uKKAGHyZXbt1Pfty8lF9Mtg30UU2Bs12WVbr4M2rB2O7D79pQGSqOVg7/9NqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720604405; a=rsa-sha256; cv=none; b=MX617+oymsP4oseEUA6jtUB8MGTfwyZ32TiuEWDbl3O/EIYzar3Y97SinQbsC/f0UQrFce ff1wi0SqZEDw/eWdqfk2XJ3ekkItGEQdIoBgaZYSXUSUYUqEHO0eHFCD76d6gIrF4bqv2z 5N6QWkokge2Iy/Gzj6phX08QQuRc9xI4npc+9kR7Hk7oip6ByrirDOtC+VuiDFbGHdENqM 6dXf1o26KqEe+BuZCvhFHSuL+zxmBJSAR1MLNPxOEAPezKKlsjJv0KUWrxBb1nFbDNVcsI NH/cunfbg3/noY9eaGaLldk8z/xtG0Uu49y+XR747LBdurksOIhXZs5OTk83bA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720604405; 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=0zSdWCziVnkERzwmwkqTdRnf4NqYrnTnpn0hJ0ZCT/M=; b=F10t9/lPkgM5+wlsPsm5Y5MiT7ufkKExMxM9Pxye8LehFGVLY6AfqCNoNG0t3tig1Djuxb K6TKZ9cDxoyk8n8RWzE5UAdo3SH3CBuQvJ5hmXzM50Hp+QPq+l/UtqbOnb/SxyZdHnViZf dkU76JdOg6muEkXwmh2qB0ZULGnGSEUISVO5mjNAHeVg1IHCtMqOaT7sCGSYVkkje/IZj6 ZGI90sihhPg/+1bcUzs3E0f80bO6h+uzR76KHxohV79HCXfLlkMmmiwNA088lH7zCuTHvc RXogdnyY1LYvZ2nzWsL7L0iRUv9ba4EdhUR/wyJSf/qSa1+Hd8A0rq0LOi+gew== 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 4WJtBF3XjKz1BWK; Wed, 10 Jul 2024 09:40:05 +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 46A9e5ZE005552; Wed, 10 Jul 2024 09:40:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46A9e5fI005546; Wed, 10 Jul 2024 09:40:05 GMT (envelope-from git) Date: Wed, 10 Jul 2024 09:40:05 GMT Message-Id: <202407100940.46A9e5fI005546@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: a9639adaedb4 - main - pf: fix sctp deadlock List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a9639adaedb4d67340c4ae386fe8fcd18e4a8a21 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a9639adaedb4d67340c4ae386fe8fcd18e4a8a21 commit a9639adaedb4d67340c4ae386fe8fcd18e4a8a21 Author: Kristof Provost AuthorDate: 2024-07-09 18:49:49 +0000 Commit: Kristof Provost CommitDate: 2024-07-10 09:39:34 +0000 pf: fix sctp deadlock It is possible for pf_test_state_sctp() to find a state and still return PF_DROP (or not PF_PASS, to be exact). In that case we would run pf_test_rule() unconditionally, but this would overwrite the (locked!) state pointer pf_test_state_sctp() gave us. As a result we will later deadlock, trying the lock the already locked state. Do what we do for UDP and TCP, and explicitly check s for NULL before we run pf_test_rule(). MFC after: 1 week Sponsored by: Orange Business Services --- sys/netpfil/pf/pf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 21647bd733f8..764d2fa54179 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -8269,7 +8269,7 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, V_pfsync_update_state_ptr(s); r = s->rule.ptr; a = s->anchor.ptr; - } else { + } else if (s == NULL) { action = pf_test_rule(&r, &s, kif, m, off, &pd, &a, &ruleset, inp); } @@ -8895,7 +8895,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb V_pfsync_update_state_ptr(s); r = s->rule.ptr; a = s->anchor.ptr; - } else { + } else if (s == NULL) { action = pf_test_rule(&r, &s, kif, m, off, &pd, &a, &ruleset, inp); } From nobody Wed Jul 10 09:55:21 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJtWs3Wz4z5QcGP; Wed, 10 Jul 2024 09:55: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJtWs2zVrz41f0; Wed, 10 Jul 2024 09:55:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720605321; 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=KlDsnOdkgsS+KUXT1MXnPCZLHuj2HPxYVigOxMF3/z4=; b=Dg5m3AenBtdNeVfBB7jy0aV3IMn85cS4DpWNit+kxdNt2vRzu71OLKFa3sdBnTw8xVyZKj SE3vM4CBr7jH5VgxHVe06IJBKWBEJS17iRBHEm8dJe+ZcWdbzCfVyfJ2057d4g96yIFAsE dw8/N5Vhc0G6XiAkX9R3AT7Mpo9uljsnRUBYSgSdnumBdZDYMTASM5Tu18R216Kpdh5ss4 QS03KlpPjTWLrAUWYS58midUupWYvWbexSftuLpVwg9R4lRFh5LWdh8QTHL6H19HOBV76H Z5wlbn4Z8cKzUi8pWjA8zNFzFRK8QLeVBwUuXP1ayFqbrlhw8PjknRnuardO4w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720605321; a=rsa-sha256; cv=none; b=qFafx2Uwp1VK81VJlnPfR1YWkF9SQayJe9JkUiS5hCTRfOoFSOicmBRk3ipDMlOo4t3OTq 2I+5gzFMLozxuaa/vQSVtKRXMvk3aVud8rb2NF8/t2N9aFrNm59m6Dp+r46rHnSrgaFJU2 yl3RqYTkIgxtAM0fXMWSc/NKeZbc7mro8g/X9XSIZ28FSQ27epMevo1rFlURX+xceLHtfp CnJ6m2PZy601xWpMOtNFpqSEkLPPZhGuC65q7Lanyy2fnTmhWic/p9lGFyjS5VpglYREpF cICPzFIXrLO1aBDN1T6LbtaHkoPgF8z9SoPKxBG5JkNqiDpjVygqS4IzPm8W+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720605321; 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=KlDsnOdkgsS+KUXT1MXnPCZLHuj2HPxYVigOxMF3/z4=; b=jqnPuQtGpEr1MKpCnMAU7znoXOPvnHVjtkFOuRR2rmJn1O/vNcpH8rKgBimkP+F/9+BIo+ rimwgHXrI2RTTtholmrsAR3Lh12rfrqhAC/D/zk8xIBGWjOll4DMN/oJL/OUri5XF/99GW GXtjI23uOBGkMn1bwnZlME2q+6m+bK1ck3dBexNfJouXkLkJe9Mo2IgHSRLRUiUTb9ZqHW M9J8IqAbgjxguntdZaP+9rsfq9JK8T5ugpLMn1KjinP4ISVcNYPLBY5aQ1XqTe1FzUjnf/ BkNr9+ywt1O2Tzm5Lb3XsBZreBBWsTRMBtVmoMmobjLLyhZE4CR6K3UjEHbKEw== 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 4WJtWs2bRrz1CCs; Wed, 10 Jul 2024 09:55: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 46A9tLoa036347; Wed, 10 Jul 2024 09:55:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46A9tLYA036344; Wed, 10 Jul 2024 09:55:21 GMT (envelope-from git) Date: Wed, 10 Jul 2024 09:55:21 GMT Message-Id: <202407100955.46A9tLYA036344@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: b1e0f0ff9d35 - main - pf: fix state locking issue when dumping by id List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b1e0f0ff9d35913f6c1dbedcf3a7f5d63eed682c Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b1e0f0ff9d35913f6c1dbedcf3a7f5d63eed682c commit b1e0f0ff9d35913f6c1dbedcf3a7f5d63eed682c Author: Kristof Provost AuthorDate: 2024-07-09 18:41:52 +0000 Commit: Kristof Provost CommitDate: 2024-07-10 09:55:06 +0000 pf: fix state locking issue when dumping by id We forgot to unlock the state after dumping it. Do so now. Sponsored by: Orange Business Services --- sys/netpfil/pf/pf_nl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c index 615a9229b3f3..401baddde948 100644 --- a/sys/netpfil/pf/pf_nl.c +++ b/sys/netpfil/pf/pf_nl.c @@ -148,6 +148,8 @@ dump_state(struct nlpcb *nlp, const struct nlmsghdr *hdr, struct pf_kstate *s, int af; struct pf_state_key *key; + PF_STATE_LOCK_ASSERT(s); + if (!nlmsg_reply(nw, hdr, sizeof(struct genlmsghdr))) goto enomem; @@ -282,10 +284,16 @@ static int handle_getstate(struct nlpcb *nlp, struct nl_parsed_state *attrs, struct nlmsghdr *hdr, struct nl_pstate *npt) { - struct pf_kstate *s = pf_find_state_byid(attrs->id, attrs->creatorid); + struct pf_kstate *s; + int ret; + + s = pf_find_state_byid(attrs->id, attrs->creatorid); if (s == NULL) return (ENOENT); - return (dump_state(nlp, hdr, s, npt)); + ret = dump_state(nlp, hdr, s, npt); + PF_STATE_UNLOCK(s); + + return (ret); } static int From nobody Wed Jul 10 14:47:27 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WK10v5rfLz5QbdF; Wed, 10 Jul 2024 14:47:27 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WK10v58nLz4RJV; Wed, 10 Jul 2024 14:47:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720622847; 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=wW5YD9X3NvHbyFdWpvwj84eWQodfDq227mFhpYFNeSU=; b=mb6A91nC/vCXsz+65leOTFql8aB6YioKVjzfIpxaUAtq1RpYFsAm7sT/JTa8TRfpEW7dYf ixTHTobWoUliXlEHa41uD4xHrStgp70sPb2a3nJJYgX2PP1LdggTSTyQeY8OGu3zByKFni ar9oSBHcPyCFYg23oUsfydTQLbFoCrD4Q/jbjo11RemwrHGA0YxpfSqfVamQCU+k0BS43s Dewvjs48BCCe40zDqOcCLX3D4obkmZssBVyJst6ev870HcFcNZnDuHydyeo5I9+844dF0p tQTUTEIUKHZK274cSsUSOI4ExXwd04sspzyB28N+JVw7+qij7dGpcA3zi3tUiA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720622847; a=rsa-sha256; cv=none; b=wN6RywvW4s1C3qQYcut+jhydwtIaVE1Kc3XRymJR1SnPRf/sNlDtAYHq3XmcMFchPdZ31b DF+ehM1AKve4jdzq65D3W2ZqdVuDJ5luaL4kBa7Xt9xnVppq/PA00vbvPVIl1Vi05JCWvQ kjjyX09BLTm8sD5ycd35WIJL17rWeY9RYLMquoPWzdu5pfhl5AT44o6g+zk2wl2NGDp6PO oCxDQnayrVSRrL3JXghD2y0e56IOaiWjouWIRzQt0FgjSZ9SQTX+nGyAII49ev/vrwhWy6 uvWL6GZepxyA7Z7Th2qqk0Rq9kzGa/+RUzDY+n70TTB6TEWsErRYXgXvETvD+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720622847; 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=wW5YD9X3NvHbyFdWpvwj84eWQodfDq227mFhpYFNeSU=; b=UFYGIWqRodPM6B+1R6oEs6TfOjzTWQQjRMXFyUl32Fg/BelLQwAKjuGmspr27qktpWLufT /uUCbpEP4Ztp0OnKDXzRLeYdAKEPB2ucS1WeP+TXQhFQFMa6elQsqbhpTcOgVA1ZdpN93S OwmZ7q1mKsxxVs2Aia23Yy9vY8YQnFw3R5V1EGsOVBJr+yAHOaYkDga/fCU5nCWpmsyduo J3NJQW/jDYT+dENEqAS1nYW4dmsgFkczcA2xwMcl41sW+Ha4TAfYuYreyJH6eFhIICCxru nNlBhZKDCrNcDfrF7NoA8SoUvLFPp/c3BIVIlEhoEsxMywh/8/cX1m229tLKBg== 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 4WK10v4ck4zM8m; Wed, 10 Jul 2024 14:47:27 +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 46AElR78029056; Wed, 10 Jul 2024 14:47:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46AElRdQ029053; Wed, 10 Jul 2024 14:47:27 GMT (envelope-from git) Date: Wed, 10 Jul 2024 14:47:27 GMT Message-Id: <202407101447.46AElRdQ029053@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 187d696a0aa0 - main - bsd.progs.mk: Create directories first List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 187d696a0aa0fba9e9a7b6b20c72799cf8a2e0cf Auto-Submitted: auto-generated The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=187d696a0aa0fba9e9a7b6b20c72799cf8a2e0cf commit 187d696a0aa0fba9e9a7b6b20c72799cf8a2e0cf Author: Colin Percival AuthorDate: 2024-07-08 16:30:28 +0000 Commit: Colin Percival CommitDate: 2024-07-10 14:47:18 +0000 bsd.progs.mk: Create directories first Order installdirs before the $p.install targets; this is necessary when a user of also creates the directory into which the binaries are installed. In particular, without this patch running `make installworld -jN` can break when installing tests since the /usr/tests/foo/bar directories are created during installworld; this has been causing the stable/14 weekly snapshot builds to intermittently fail for months. MFC after: 5 minutes Sponsored by: Amazon Differential Revision: https://reviews.freebsd.org/D45923 --- share/mk/bsd.progs.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/share/mk/bsd.progs.mk b/share/mk/bsd.progs.mk index 1551516dd6ea..44191d1c56df 100644 --- a/share/mk/bsd.progs.mk +++ b/share/mk/bsd.progs.mk @@ -155,6 +155,7 @@ $p.$t: .PHONY .MAKE ${_PROGS_COMMON_OBJS} NO_SUBDIR=1 ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS=t \ ${_PROG_MK.${t}} PROG=$p ${x.$p} ${@:E}) .endfor +.ORDER installdirs $p.install .endfor # Depend main pseudo targets on all PROG.pseudo targets too. From nobody Wed Jul 10 15:10:43 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WK1Wl3Q7Cz5QdVv; Wed, 10 Jul 2024 15:10:43 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WK1Wl2vW0z4TBJ; Wed, 10 Jul 2024 15:10:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720624243; 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=Ggka3L8lm36SY+qzXrPXInE57x6HgsbH96hzLZZ82qs=; b=ht38Hrq1yCOupG1jJq2Jafh7cc3izJJRHloLpOhkilwW0cHccosJz1K3w5MLo4ScpfN8hm eGZj61MVltLstw17oT+FgdmXLUzBQXrkBnWsM4VS+B6lJ73kZl1jqmpYsIceRvi6YXoXOX XWrecYqCy7S8BLoYfpZx/6kVKrnfZ8ResD82hVsWH9Dy+KhYFGVEC5h5TNiX/YIoPj9UrN 7sEzbcSON+1tyK281v760OrsHenFVY3itlysedXB/OAAohPY1xL8fTzRHoyEocB0ZGTcKD vakZeVbIcmUhLdLdwSdaY3Lo8JKon6eC/zJMZiuLhY1LPzTEFXNwCge66yP9wA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720624243; a=rsa-sha256; cv=none; b=NmGhn38MbV84kreUw0rKVBhQDifEPwRApqTP+fq1gtXYcorJcoDiAPm2ZyqBWe/vhG8gCp z0/nLXIBg55L9UUMigoHMOAOXxj9M4nA2EMLEEVGN8f0xzB8eCgtdff31ClYxVmNNeEQqn V6hqAglAXrTY3L4QiFCH7zvg6ebGAjORdyh0xa9EpFUyJWvHqiZ4FnLu9Jc7xlL8MBEeGJ QyaOGfccVUaxTen8UKby1mW/dcbzySlB/X4DTDC//RtTGFcnwN5J7HVQb66kjSmbTjQZUt QyJ2moWgwuLBPHn9DNGqU7w2glOuaKja54aa293sZ36Uv+E+dFoDjgODvU5QdQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720624243; 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=Ggka3L8lm36SY+qzXrPXInE57x6HgsbH96hzLZZ82qs=; b=vCLKRvN8oFCod60zahny2YPrACWUDvuiD3jgkSHca6hWJv/winSsGrU2Qhb5xnHYlYUE8r EUpsOMWl847YwLa8Bf5PdwBoWOc4afHdYKlqxW1mnfnjmFpSbybjk+xgf6bsJxStPnsriU 3p2YDIRuo/eVQrY1k7/ISUlMEx1kwJNrzYWDw8+ss/v8y6vQjDo5Ec+K3FZI5Mw6dbX5cJ MxflBBup9TnYM5LLTca1XbfBxW4Gg9olN8BJ3YTEb1JKSbM3Vj7YmuKVQgtqSmU8bn9Dny DXVIcJsyygdVNiydrwB6rcCjmH49/cE45/+M3EW2icSwbkskZlrH88Q9IgvN2g== 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 4WK1Wl2W3RzMwH; Wed, 10 Jul 2024 15:10: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 46AFAhxB073704; Wed, 10 Jul 2024 15:10:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46AFAh75073701; Wed, 10 Jul 2024 15:10:43 GMT (envelope-from git) Date: Wed, 10 Jul 2024 15:10:43 GMT Message-Id: <202407101510.46AFAh75073701@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 19597c02338a - main - Fix typo in previous commit List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 19597c02338a01bf1ab3b25409528a1765b13a74 Auto-Submitted: auto-generated The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=19597c02338a01bf1ab3b25409528a1765b13a74 commit 19597c02338a01bf1ab3b25409528a1765b13a74 Author: Colin Percival AuthorDate: 2024-07-10 15:08:20 +0000 Commit: Colin Percival CommitDate: 2024-07-10 15:08:20 +0000 Fix typo in previous commit I fixed this when I tested the patch, but apparently forgot to commit the typo fix into my local git tree. ".ORDER" -> ".ORDER:". MFC after: 5 minutes Fixes: 187d696a0aa0 "bsd.progs.mk: Create directories first" Sponsored by: Amazon --- share/mk/bsd.progs.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/bsd.progs.mk b/share/mk/bsd.progs.mk index 44191d1c56df..ee6b13057574 100644 --- a/share/mk/bsd.progs.mk +++ b/share/mk/bsd.progs.mk @@ -155,7 +155,7 @@ $p.$t: .PHONY .MAKE ${_PROGS_COMMON_OBJS} NO_SUBDIR=1 ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS=t \ ${_PROG_MK.${t}} PROG=$p ${x.$p} ${@:E}) .endfor -.ORDER installdirs $p.install +.ORDER: installdirs $p.install .endfor # Depend main pseudo targets on all PROG.pseudo targets too. From nobody Wed Jul 10 17:09:48 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WK49857WCz5QpYh; Wed, 10 Jul 2024 17:09: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WK4984TRjz4nhn; Wed, 10 Jul 2024 17:09:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720631388; 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=rL31fnUzq6BMJ/kRRMGxb7z4O2IXW5NabLZGFwYFPDI=; b=mhg+312MtjouLXoynHQ481DT6Euh7OB0/cyRX1jQ9L218vpmN/aijRBl1pLgjZNsIwvnFc w1rnubF8MeGk5WXGK6lxZ1YszDnwpJgn1HeK+lo01S38jzGjSORNmVBlviDlueYKq6v/z5 wZIMcDmZ8PJFX2Dj7GPIJ6WpcXwZbNqcyO2PS+hHBUapW1D9GJHP451LH4dq1jnmbVQ4uj n/r/ROBL4U+TaLmohjWLVQTLKKWBWMzTtm2fuAjh9YwVVDjUYUHsEv9cg6FToce6h8Tn4m SJamFhexDfWsy0LhjRHkrpYP+ckpGzsQB1ECW9w4Y/4JJBLtxUTgJmm6P2jJ7Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720631388; a=rsa-sha256; cv=none; b=f7rDYKVbSERIJSaSObbQ+TaUGyCdBydvmFfW4F9Oj0bGBAlJW5jgujKcFD2UpNWiQ7H3tT XTuPLn+yi7crfqKTqSb9AYOhdZLaoK7ValqIkIxjyCIr83Pw5lpHX4QDneCNieLKCeW8Km iGD0yaz8Ha8CGnToNtHDSluzVSfvbL1LP03OgRzzjv9UycTmJY/u1vkQ4kLofsH0caimDO FqAy+MG0aS6wOWi43KqGE5hz/KeQPlURo2sAv17sl/1ZheQXwThQAKWWsrFwI5kuPt3bJ6 RHPN/w4X22G8VrgarQ8h+Wne197pCv8AoVzd9HrbLScpkv7KOM4csjPk+WzJAA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720631388; 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=rL31fnUzq6BMJ/kRRMGxb7z4O2IXW5NabLZGFwYFPDI=; b=sjfOvekSycn0oolY4MNsQQcaIISDNYGILx/o7ulp1Pzq84FKVLB0eA/gsvE38WVhZbybFI g9GJu7axEl4W/JH/ZdNEfpY1ZCRgjxjMlu3kgHHvn5Ps+o3qiAxvMm76e1xl1ebFXULrzj +wFYajxd6P6Q8EiGWrBh117sB3YBEo80XzN5gfZ+q9eNNel1lFqtywoMrM8Bxq8MgPxbWx Sp08KCadpGCR2PdY7J+8zWy8at+sqeE4q3N6jpgzu0FGiWWQe+7k+kev6oxQahlovNSqi5 c9CMhn/QVNVtYTGHwZIMQdnYq3Mc4sA0Ndmfl/XQSguPtm8hOp5jonXqHYWNqg== 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 4WK4983llszQ1s; Wed, 10 Jul 2024 17:09: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 46AH9mVg070206; Wed, 10 Jul 2024 17:09:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46AH9mnC070203; Wed, 10 Jul 2024 17:09:48 GMT (envelope-from git) Date: Wed, 10 Jul 2024 17:09:48 GMT Message-Id: <202407101709.46AH9mnC070203@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 7339a7bd9739 - main - plic: add thead,c900-plic compatible List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7339a7bd9739f0386344c9bb560894cca84348a4 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=7339a7bd9739f0386344c9bb560894cca84348a4 commit 7339a7bd9739f0386344c9bb560894cca84348a4 Author: Mitchell Horne AuthorDate: 2024-07-10 16:57:15 +0000 Commit: Mitchell Horne CommitDate: 2024-07-10 17:09:14 +0000 plic: add thead,c900-plic compatible This allows attachment on Allwinner D1, and others. MFC after: 3 days Sponsored by: The FreeBSD Foundation --- sys/riscv/riscv/plic.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/riscv/riscv/plic.c b/sys/riscv/riscv/plic.c index 406aff5bbff0..5280ec0bb333 100644 --- a/sys/riscv/riscv/plic.c +++ b/sys/riscv/riscv/plic.c @@ -99,6 +99,13 @@ struct plic_softc { int ndev; }; +static struct ofw_compat_data compat_data[] = { + { "riscv,plic0", 1 }, + { "sifive,plic-1.0.0", 1 }, + { "thead,c900-plic", 1 }, + { NULL, 0 } +}; + #define RD4(sc, reg) \ bus_read_4(sc->mem_res, (reg)) #define WR4(sc, reg, val) \ @@ -230,8 +237,7 @@ plic_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "riscv,plic0") && - !ofw_bus_is_compatible(dev, "sifive,plic-1.0.0")) + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); device_set_desc(dev, "RISC-V PLIC"); From nobody Wed Jul 10 18:19:06 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WK5j73w4Nz5QvcC; Wed, 10 Jul 2024 18:19:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WK5j73Ntrz4v1h; Wed, 10 Jul 2024 18:19:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720635547; 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: in-reply-to:in-reply-to:references:references; bh=6LMnNtaiU5Exj/q/9u3iPQjsNWIAbP6Rp7dbE/fciOs=; b=W9z++MNv7Q4Uo0Q+2s38VRdod2ij/b+TLUiPZEZj33HXoXONFcVd4jam0V4YGmmEQ5cN8L A6FQ2yW4OahvVOd+nWfxT4wqXbq1hl9APRtHICXSvMxO4ZASzMi0BP5RUU0c/ZZcbg+Fec xNbA1FWFFWV0vENsP3D9ffX1NeAmwEB3QzoO1ohJovMftk+8PlUF3iGZei83qm6fhzw9hK tdSiC/3JBGTpugJKjP3G6030L4yKyD6v2a5wtc/QUnPikbG9ClE2uyYdGJ6q6ZucPws12E gHJw1Wtn+JXGivsH5jvhInWt7Ma623x6zhTf8ZQFMHvvVexTVaQ6SYMREpsXvg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720635547; a=rsa-sha256; cv=none; b=e85lZGhDWslLbrkqHFK2rk3Y3t9q/9xVkbZgSu7j2/Qjvi2CKISwBi5RlLEPHpIxN+G1OO CZcqkyfCjxjnV6qUG0WtsIOCA6uoBtS3ZPm7H9zvbzGzTPBUU76MKWZMZQVwIfKDK3fshb N5Ytn4XrLDEX5Ca/Vgl/Vd5/balE+pW/3Mr8ps8bzHUYBevhB58UmlXJxQgx8wKqkDjfxP i0QozDDfkaTzWsTyMS5ESD1mD0fLgaAT2Rp8oSWqyj9CtutWq94raYdBeL073e1Y2IF3xM WHsxRk7wRNmflSv6smC0yUnRhSUD1I4G74Ji/ShMHEyF5hBskUQWmfwqzyNLiw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720635547; 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: in-reply-to:in-reply-to:references:references; bh=6LMnNtaiU5Exj/q/9u3iPQjsNWIAbP6Rp7dbE/fciOs=; b=A/8OkByuT5TZIWgTUVXBJeo9Px/1DdVhS4bZW0l1YdWjAV38nQuaF8aGGPLzgj31CJy0Yv P6tJWOzTih8XmrjT2xHb8XZm3scUWbMze9fmGdCVJocD445RXKUu4Ql73C9gn8HeSz5i1D X3QJllqMVx0LaqCfZHcecktSJWPsqzHQG37f+jq6XO4sXXWWQY3/VMHXVkUSmEDw5Hcyo7 P1wKu2fVJNkKtvtRtALpOlLaiRPzUE9Iy8Pm8KhHjBTU6OGhbPCyUU1Ek0PUrnZF2XwS0Q g5O3Q57u0wb0Is5o7J0IcBszi7YLzqKOM9QPdSTvBfArlat5mhHbLg08M9hhHQ== Received: from [IPV6:2601:5c0:4200:b830:a52b:58f5:f939:83f7] (unknown [IPv6:2601:5c0:4200:b830:a52b:58f5:f939:83f7]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4WK5j71T93zfYn; Wed, 10 Jul 2024 18:19:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Wed, 10 Jul 2024 14:19:06 -0400 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: 6677621bad00 - main - cdefs.h: Fallback to printf0 for __printf0like Content-Language: en-US From: John Baldwin To: Warner Losh , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202407061944.466JiiQ3026410@gitrepo.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 7/6/24 17:56, John Baldwin wrote: > On 7/6/24 15:44, Warner Losh wrote: >> The branch main has been updated by imp: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=6677621bad00191dfec1b0a20ae1618b92745d9b >> >> commit 6677621bad00191dfec1b0a20ae1618b92745d9b >> Author: Warner Losh >> AuthorDate: 2024-07-06 19:42:37 +0000 >> Commit: Warner Losh >> CommitDate: 2024-07-06 19:45:03 +0000 >> >> cdefs.h: Fallback to printf0 for __printf0like >> >> For some reason, my tests were fine with this like it was, but CI for >> gcc12 and gcc13 is complaining. Revert to the old form until that can be >> worked out why the mismatch. >> >> Fixes: 0b82dac337e7 >> Sponsored by: Netflix >> --- >> sys/sys/cdefs.h | 7 +++++-- >> 1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h >> index 6b861b1903f6..a56839d57c7a 100644 >> --- a/sys/sys/cdefs.h >> +++ b/sys/sys/cdefs.h >> @@ -356,9 +356,12 @@ >> * Clang has always had printf and printf0 as aliases. gcc 11.0 now follows >> * clang. So now this is an alias for __printflike, or nothing. In the future >> * _Nullable or _Nonnull will replace this. >> + * XXX Except that doesn't work, so for now revert to printf0 for clang and >> + * the FreeBSD gcc until I can work this out. >> */ >> -#if defined(__clang__) || __GNUC_PREREQ__(11, 0) >> -#define __printf0like(fmtarg, firstvararg) __printflike(fmtarg, firstvararg) >> +#if defined(__clang__) || (defined(__GNUC__) && defined (__FreeBSD_cc_version)) >> +#define __printf0like(fmtarg, firstvararg) \ >> + __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) >> #else >> #define __printf0like(fmtarg, firstvararg) >> #endif > > It's because my patch for devel/freebsd-gcc{12,13} is kind of wrong. I had a mismerge > when updating the printf0 patch from gcc9 to gcc12 that ended up re-adding the > warn on NULL. I need to update the ports to remove that part of the patch. I will > probably leave printf0 working for now in the ports just as an alias for regular > printf to give us some transition time. FYI, I have merged this fix to the ports, but not sure how we want to manage doing the patch to cdefs.h. I kind of think we should apply the change to cdefs.h in main in another week or so. I'm less certain of what to do for stable branches. -- John Baldwin From nobody Wed Jul 10 19:40:50 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WK7WQ3K1tz5R2ZR; Wed, 10 Jul 2024 19:40: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WK7WQ2qC6z42ST; Wed, 10 Jul 2024 19:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720640450; 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=qgH+kmH8iQQwc5aaldvdkmpPALiSTw52H9Kc2GieyKI=; b=ZPGJnNHOoQw1Dklf1NR4/mIfc71yIqUH0Amo7LTQBS3+WEdI1DnDjJh5adssz6q7fClBXI 1mNA7pL6p2JVBzhqiTNgh+MnxBLFY0sPmqZ0zM5+QWNTCzKzll0EwlhhmKlHOS2oIbDBTV 91rSud/U895o4L53zqINowS+MaBBNaiDmw1tvBkN6KSliu73wR2W6aAD807gzhv7W3h6Zd kTN9RFeMoRGm56IbAkEeD5l2Q1Okl9YCHgWEd4eh21obJ1imsdlmuYxqGh8h9OVER/vzGp uO8HjoTdKFTIDhJ3eHjl83Rylv2H9stlPNvbQ3MLuXJdjZLK+h+KlF/RgVE+pA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720640450; a=rsa-sha256; cv=none; b=aE7ctpUjgWg6fMQYshmTPB43KyT/gQglsTNmnhlofyW7C9uqnlCwwGdxXu5DP4lj2TADSt Kra2UnOu3rBgJvhCIAzgZCHiVmkTImOrmt8VxzCPZEmoY3Mg8TJxibFE52o9IT9pTJliiu NeLl+nEUo24+o/Nqg/6v8aqaHfYITXYuLElLVdX8emDya8ix2cf3vxadlM0R3zXEh7DY2i 8c8vV/sOx9BUlgCFiHo9k+QwRiRZ9B62wf9vG9JWbBKcnIU2/FTCZPg3o2KBnAsmW3Ez2W 17px30UqRGoOQurCTk8/UQRaDDpM+UPsZmBwz9zO8QxhroBg71hyjEwdTkbWaQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720640450; 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=qgH+kmH8iQQwc5aaldvdkmpPALiSTw52H9Kc2GieyKI=; b=buKr5yc8zLpNCp1LyQTUkOSbeE1PtLFpKEkGi2fV9N4q7X/szS1/fjwioJW0IwKPCjOw8y safUOjWz6cy3XQb5No6NKNFKkWgn2/rNYCHVHeAioM4Fa1lXDknm9GzcB6blh0BMd17V+7 LoNLvSEiitjUPjxZeaANIbp9m6+z6yJkKPj4WykRTtObgyUVZAe6gRfeZ7w8Ghc2Af+Eax o9mviwAF2jGyxSRPYzetAPEXUJBF7uXfvlrU/6dS+P9AyFKlpONffXL2KlfUdZlMGOd6JP uQP5nIE8NcKa7BaYs5KUIiYLb9nqH+6dTFJA2EHfXARsx9lRiSPHdtrwmSevzA== 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 4WK7WQ2QKFzVvR; Wed, 10 Jul 2024 19:40: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 46AJeo7Z033925; Wed, 10 Jul 2024 19:40:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46AJeogj033922; Wed, 10 Jul 2024 19:40:50 GMT (envelope-from git) Date: Wed, 10 Jul 2024 19:40:50 GMT Message-Id: <202407101940.46AJeogj033922@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: dc20d49aa939 - main - cxgbe(4): Do not report link state change during interface detach. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc20d49aa939caea365cbdf0341b00de69253be4 Auto-Submitted: auto-generated The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=dc20d49aa939caea365cbdf0341b00de69253be4 commit dc20d49aa939caea365cbdf0341b00de69253be4 Author: Navdeep Parhar AuthorDate: 2024-07-03 19:01:33 +0000 Commit: Navdeep Parhar CommitDate: 2024-07-10 19:05:48 +0000 cxgbe(4): Do not report link state change during interface detach. This fixes a panic when multiple VIs are configured on an interface and only the non-primary VI is up at the time of driver detach. The problem was that the driver would queue a link state change notification for an interface about to be freed. To reproduce the panic, add "hw.cxgbe.num_vis=2" to loader.conf and # kldload if_cxgbe # ifconfig vcc0 up # devctl detach t6nex0 trap 0x9, rip = 0xffffffff8107db70, rsp = 0xfffffe0055263d60, rbp = 0xfffffe0055263dd0 taskqueue_run_locked() at taskqueue_run_locked+0x2a0/frame 0xfffffe0055263dd0 taskqueue_run() at taskqueue_run+0x72/frame 0xfffffe0055263df0 taskqueue_swi_run() at taskqueue_swi_run+0x18/frame 0xfffffe0055263e10 intr_event_execute_handlers() at intr_event_execute_handlers+0x249/frame 0xfffffe0055263e50 ithread_execute_handlers() at ithread_execute_handlers+0x9e/frame 0xfffffe0055263e70 Reviewed by: jhb MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D45864 --- sys/dev/cxgbe/t4_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index c142fa93166d..99400dc9aadb 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -12112,7 +12112,7 @@ t4_os_link_changed(struct port_info *pi) for_each_vi(pi, v, vi) { ifp = vi->ifp; - if (ifp == NULL) + if (ifp == NULL || IS_DETACHING(vi)) continue; if (lc->link_ok) { From nobody Wed Jul 10 21:28:33 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WK9vj6C45z5RBdx; Wed, 10 Jul 2024 21:28: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WK9vj5gpYz4GWW; Wed, 10 Jul 2024 21:28:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720646913; 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=UuYJ1NlanpcM8ZJx259E0k6YwxfgdB/M5VJ38wMwG7E=; b=XDFhMKuuWU1+Hfu0Qcp5A2/Jy47GH5q2m5D0QUespMEipAA2lWB1vnQYtZQj4j6TxlGc8q 1Yys2H2UEZEBywnUJqqM3KRAGdctcUi55j0tgF3ZC1RqjroU/cutmnmPwzVK+lqUTWnSJL wYbnAVjkZFwrGH4x1jD9MANjBM7V2uylf+U4iIhT783kVTvAz8kc74QNX1/jJ4ih4zr3Ms cKWAtkp/uBYEYWHNhUAn5/ZD9srVKzS13O8IV12ZXoX2O1cYZs4G9mhfSUGtaGoG3/YE6g 3Fgveatf7czY27fEyySEftPCNZFnAg6738Jb/uWp0EfW2CDSjrpmCoyjqLiJUw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720646913; a=rsa-sha256; cv=none; b=N7H1lhUCHoEtf6Ck8tC6TdqDreRM8/YuO/14S9F25s14TFAwSVGOGmwmcfZLcn69cp/rS+ a98/OUgjEjdQsXaP7g9KZQPHg5073cSVcfqTt+LaGHOkMo2/ojn/mV+/0G1PLyqS71Tmas s91OlWRV/ccKA2iNaJK2rQ/3dUqa33A101yiQ4zZVf8FA5TvnNki/yBgTpE3qwyOpy8wXv keWuwbIvKQnb7cOHh9tCgsd1D53wo0QUxpF8XVRmZ9TxA7folVmKhXWBgtIhSPPbchYVFC y0391ycKmLqohY1/bPVfAO6wlr5gltX0liCyvzUv4ytLZdd3bhyBUKGMe/wdQQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720646913; 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=UuYJ1NlanpcM8ZJx259E0k6YwxfgdB/M5VJ38wMwG7E=; b=giwBtkqO8FpwzcqeXxxFTEY6iO8oM9pZ/kHcX1aHUcfeSMBxiWG0sN/WAPsIwVvQKdwA9e mQ3V0PNxG81lweZ5bqvv4y5rsb5eBdei7Bh6t2iRrQts93i8xMO2StRL3TQg/fYz7s+wsR ch+evV4GTCIMC0LxTbjdjWTmKtJUQ48P+5dU+PGkFT3Tm9tKKT8iVD3jZzoKL13mnljwhA 0U6oucWGxVSVdDv0/Rm1E6m1f14Y9fsIuYCOUHT/hQy+HuCF4w+4yxndIo5NXHH5ctL8O+ 9yUlgIqgVwtPRu3Ma+z6i0uOte97vKJm6hDuE9MniSurfYTrNKR585xIrXJH+g== 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 4WK9vj4bTjzZ4N; Wed, 10 Jul 2024 21:28: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 46ALSXsT012435; Wed, 10 Jul 2024 21:28:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46ALSXaO012432; Wed, 10 Jul 2024 21:28:33 GMT (envelope-from git) Date: Wed, 10 Jul 2024 21:28:33 GMT Message-Id: <202407102128.46ALSXaO012432@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f6372351da07 - main - libdtrace: Use designated initializers for modules ops tables List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6372351da07ae101d5a22a2bb2bdb2753da2b40 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f6372351da07ae101d5a22a2bb2bdb2753da2b40 commit f6372351da07ae101d5a22a2bb2bdb2753da2b40 Author: Mark Johnston AuthorDate: 2024-07-10 21:17:38 +0000 Commit: Mark Johnston CommitDate: 2024-07-10 21:17:38 +0000 libdtrace: Use designated initializers for modules ops tables No functional change intended. MFC after: 1 week Sponsored by: Innovate UK --- .../contrib/opensolaris/lib/libdtrace/common/dt_module.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c index 281c787de533..6fb9b0f84769 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c @@ -452,17 +452,17 @@ dt_module_symaddr64(dt_module_t *dmp, GElf_Addr addr, } static const dt_modops_t dt_modops_32 = { - dt_module_syminit32, - dt_module_symsort32, - dt_module_symname32, - dt_module_symaddr32 + .do_syminit = dt_module_syminit32, + .do_symsort = dt_module_symsort32, + .do_symname = dt_module_symname32, + .do_symaddr = dt_module_symaddr32 }; static const dt_modops_t dt_modops_64 = { - dt_module_syminit64, - dt_module_symsort64, - dt_module_symname64, - dt_module_symaddr64 + .do_syminit = dt_module_syminit64, + .do_symsort = dt_module_symsort64, + .do_symname = dt_module_symname64, + .do_symaddr = dt_module_symaddr64 }; dt_module_t * From nobody Wed Jul 10 21:28:34 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WK9vl0fpHz5RBky; Wed, 10 Jul 2024 21:28:35 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WK9vk5x6Vz4GYb; Wed, 10 Jul 2024 21:28:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720646914; 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=vA45Iao6f0qSeevkKSwVI3MN7U4nKYxBa2sFvanMl28=; b=kXWWu90Ig16BxsUBJe1iK1Fk9d5pnzX86edbENCIe2XFD6xauD1RPxcmpljG16wNhS6/8a t3s2zm5KTVm84HYZvm0acdBnfWvVPmbDQzgywNHDDnUsGGEMzfwoiXdQfWwDLwwQq3wnNm MgQdz9+dC7DwMw2E4mUugKosvpAaRM+wSdXBu2KUa7uuQ6jZCheX0EOVmuOh5n+GUJqmAO LNmG4pF2U2AbXCZD0o5GTYoLyevebm+5S92h8XzlGXZHILmDXEByEK43ryFZFtMhBy4630 TodE+aOPx+Kv8fr1wXCsmyI4Pz/gJfOEHqMT3hiizX+a7Kg9t70M7Kt1FVasaA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720646914; a=rsa-sha256; cv=none; b=CxLyHYj5LzNJ84j1QGNBVpXKTjMyVqOIkGv+vUWqxcsplNPexv3w0IFHJcA47pAT46Uk/g GJq1ec9T108hNe0wgQnBhj0Ra8qCkDcQeeJqLISkMBbxZIFx5Z96RnZKFsz160GPDCgRkg EbMudPKe02JMrEvXaRZUHzA7BC6WcSZbT3yt/IqpGirnEsTxJ/xmLa+GxFCKyKvGGz6mE9 UHU2/eWtiuCUp+wDsqgQ+FUNQpdNDbr3dEU8n/7GqrtwTkQ8ja8l/1/GB8G+47007YcYC+ tx7vF30Z2iUu3TTF6IIwAd+sOkZAjwmegWxoIOOi8iZ0JwpOh1fHK4YK+WeZ4A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720646914; 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=vA45Iao6f0qSeevkKSwVI3MN7U4nKYxBa2sFvanMl28=; b=ed2aduhkET5enwJq8pVloMzuA1xfG99bQdX4xYnk/w8RlshUVTFS50cE9acNIXNRIv+hCN bi++ZB6WIZ0OBB06X3oYoAPBBTZJod/yRKE+z9Ok9h7vYJyEqOGz3Fa/QzgIqYTsXkt2FM p5gHLLxur8mqpy7I2p1B8S6EIJ6lbCpnEWfm28OFYKtecHvkj3+UoMFWcdNsQuwXXOmFIr 6l8JSnQg/Jj7JD/Jl92WVIEZ5jq5X3zDNzheezb6q0snAXtzOpaXcSTr4X2IHFasKBqhFw YOMWsiPCLERvCmXFxNg8gd2QA5LChVu9VPVNo8lrjVTknh71mneeAXEbwl6btA== 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 4WK9vk5M8NzYR1; Wed, 10 Jul 2024 21:28:34 +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 46ALSYdC012490; Wed, 10 Jul 2024 21:28:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46ALSY0N012487; Wed, 10 Jul 2024 21:28:34 GMT (envelope-from git) Date: Wed, 10 Jul 2024 21:28:34 GMT Message-Id: <202407102128.46ALSY0N012487@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 7bbcbd43c53b - main - libdtrace: Compute the relocation offset for all non-ET_REL objects List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7bbcbd43c53b49360969ca82b152fd6d971e9055 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7bbcbd43c53b49360969ca82b152fd6d971e9055 commit 7bbcbd43c53b49360969ca82b152fd6d971e9055 Author: Mark Johnston AuthorDate: 2024-07-10 21:21:54 +0000 Commit: Mark Johnston CommitDate: 2024-07-10 21:21:54 +0000 libdtrace: Compute the relocation offset for all non-ET_REL objects The use of an ifdef here most likely carries over from when the dtrace port only worked on x86 platforms. MFC after: 2 weeks Sponsored by: Innovate UK --- .../opensolaris/lib/libdtrace/common/dt_module.c | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c index 6fb9b0f84769..2a0386c33124 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c @@ -1251,19 +1251,21 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat) * [Text][R/O data][R/W data][Dynamic][BSS][Non loadable] */ dmp->dm_text_size = dmp->dm_data_va - dmp->dm_text_va; -#if defined(__i386__) - /* - * Find the first load section and figure out the relocation - * offset for the symbols. The kernel module will not need - * relocation, but the kernel linker modules will. - */ - for (i = 0; gelf_getphdr(dmp->dm_elf, i, &ph) != NULL; i++) { - if (ph.p_type == PT_LOAD) { - dmp->dm_reloc_offset = k_stat->address - ph.p_vaddr; - break; + + if (!is_elf_obj) { + /* + * Find the first load section and figure out the relocation + * offset for the symbols. The kernel module will not need + * relocation, but the kernel linker modules will. + */ + for (i = 0; gelf_getphdr(dmp->dm_elf, i, &ph) != NULL; i++) { + if (ph.p_type == PT_LOAD) { + dmp->dm_reloc_offset = + k_stat->address - ph.p_vaddr; + break; + } } } -#endif if (dmp->dm_info.objfs_info_primary) dmp->dm_flags |= DT_DM_PRIMARY; From nobody Thu Jul 11 06:19:59 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKPhw0qDsz5QN5q; Thu, 11 Jul 2024 06:20: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKPhv5VR5z47dk; Thu, 11 Jul 2024 06:19:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720678799; 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=jNBSXoHIGGZzwIbbboVzUMqzXI5asLGPMFp9gHJzy18=; b=t80obvU/aQQwijhKshewnJd3FFTiKRcBKXCa0+ikdmXUqb9KrYPiuJyxlXNLOzgTferft2 27+W9Jqzjk87+MXyGpnOIozpBMHtBioUR8qsE2eq97pKFHCbP2DkJCN4KWTkiyalo2ZvSa RSAo1ssPfC1u64zXerJLEJRDEK8nxUAX8/q88gD+C/JPB5g3ZOrDbMmZL7tnFfxMqeO4ix aFV5PLsCEvX8lZzX4SNirIiFfkcbG5rwsmGUmTfi66rxWr557A5uAqFgE3Fy6VSFDHcwwP tTJMgFl8KDqrnNnWhz0FflkeEUcpxTvH/t1ZIdO5nfnyTBljMBwiZ3e1c5IK3w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720678799; a=rsa-sha256; cv=none; b=ldrRZA/gJQl9EXvfohX530mVNj+NBPKEHiac5VRdnsP4SRnhEBq4LV47ON0gjCcOy5efba Hxfy13KxHxX4g3rau1/1eSHVMYDIrU8qVBDZ4tb7DgRaIXbyucQ1niWAV7Kucup6GJe7gv yDaGCTGAXbnv95HwZF58HVyrPnfl8yPIBKtJvNHbIntWqHLJJX2/BD2oVD99QRjwdag5Is IAjje7qjGqXLxGoLx5AwriSEZBAYhW+LlVU8TV4kDn78UC9sK1myqbs9yRmsKE8SCZ/tVz jvEog3S8Z4IEz+RbRiJO/GaRAWr+yg5hHPdnCRkDC2Gjgya/OZGW06pfHSTn9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720678799; 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=jNBSXoHIGGZzwIbbboVzUMqzXI5asLGPMFp9gHJzy18=; b=Y1eggoCR4BPkfIMyLIBR9LSJQqn0I6J26ErInnumYfzuTQzHOtz+RF4I/0jPiW/SYHOPoj EdIUpQRZLuWsDXwbuWTzRQeL9Hful30qNNzxkMFm48ou6vsZ1fU+l++nrE0KjMX+U/CN6R 2sG2eUYgDGkVPl0m9RlWVB8AOCJ6amhHFxwCp3LZ9xDhHsnAdgmL/DEbXWKLGEbxGU7ePS YDQB+iHZcL6C2KI32lOFB+V2cuviSnXCJxsXHSI6vXlMIlwxqYX+zzFQbFVFOnxqvt54Dk 1UKSSPklhp2sWtmY8FUlJQNgXmeWEOvlWAoONcgg+hjsnr1Ck/xPN3ECkhTB+A== 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 4WKPhv4TMqzq5q; Thu, 11 Jul 2024 06:19: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 46B6JxOt014119; Thu, 11 Jul 2024 06:19:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46B6JxgU014116; Thu, 11 Jul 2024 06:19:59 GMT (envelope-from git) Date: Thu, 11 Jul 2024 06:19:59 GMT Message-Id: <202407110619.46B6JxgU014116@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: d4ca00154434 - main - Import bsddialog 1.0.4 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: d4ca001544347e217e2ab023cca88b30637def98 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d4ca001544347e217e2ab023cca88b30637def98 commit d4ca001544347e217e2ab023cca88b30637def98 Merge: 7bbcbd43c53b 7f3a903b679f Author: Kyle Evans AuthorDate: 2024-07-11 06:17:23 +0000 Commit: Kyle Evans CommitDate: 2024-07-11 06:17:23 +0000 Import bsddialog 1.0.4 This fixes a future conflict with _FORTIFY_SOURCE, where includes and causes a conflict with `MAX_INPUT` defined in the enum here. Sponsored by: Klara, Inc. Sponsored by: Stormshield contrib/bsddialog/CHANGELOG | 7 +++++++ contrib/bsddialog/Makefile | 2 +- contrib/bsddialog/README.md | 2 +- contrib/bsddialog/lib/bsddialog.h | 2 +- contrib/bsddialog/utility/util_cli.c | 6 +++--- 5 files changed, 13 insertions(+), 6 deletions(-) diff --cc contrib/bsddialog/Makefile index f1b2da675f9e,000000000000..a6af8813a48e mode 100644,000000..100644 --- a/contrib/bsddialog/Makefile +++ b/contrib/bsddialog/Makefile @@@ -1,38 -1,0 +1,38 @@@ +# PUBLIC DOMAIN - NO WARRANTY, see: +# +# +# Written in 2023 by Alfonso Sabato Siciliano + +OUTPUT = bsddialog - export VERSION=1.0.3 ++export VERSION=1.0.4 +.CURDIR ?= ${CURDIR} +LIBPATH = ${.CURDIR}/lib +LIBBSDDIALOG = ${LIBPATH}/libbsddialog.so +UTILITYPATH = ${.CURDIR}/utility + +RM= rm -f +LN = ln -s -f + +### command-line options ### +# FreeBSD port Makefile: 'MAKE_ARGS = -DNORPATH' +NORPATH ?= +export DISABLERPATH=${NORPATH} +# Debug: `make -DDEBUG` or `gmake DEBUG=1` +DEBUG ?= +export ENABLEDEBUG=${DEBUG} +################### + +all : ${OUTPUT} + +${OUTPUT}: ${LIBBSDDIALOG} + ${MAKE} -C ${UTILITYPATH} LIBPATH=${LIBPATH} + ${LN} ${UTILITYPATH}/${OUTPUT} ${.CURDIR}/${OUTPUT} + +${LIBBSDDIALOG}: + ${MAKE} -C ${LIBPATH} + +clean: + ${MAKE} -C ${LIBPATH} clean + ${MAKE} -C ${UTILITYPATH} clean + ${RM} ${OUTPUT} *.core + diff --cc contrib/bsddialog/README.md index f984b488b232,000000000000..7b9b6cf8e84d mode 100644,000000..100644 --- a/contrib/bsddialog/README.md +++ b/contrib/bsddialog/README.md @@@ -1,142 -1,0 +1,142 @@@ - # BSDDialog 1.0.3 ++# BSDDialog 1.0.4 + +This project provides **bsddialog** and **libbsddialog**, an utility +and a library to build scripts and tools with TUI dialogs and widgets. + + +## Demo + +[Screenshots](https://www.flickr.com/photos/alfonsosiciliano/albums/72157720215006074). + + +## Getting Started + +FreeBSD and Linux: + +``` +% git clone https://gitlab.com/alfix/bsddialog.git +% cd bsddialog +% make +% ./bsddialog --msgbox "Hello World!" 8 20 +``` + +Output: + +![screenshot](screenshot.png) + + +## Utility + +**Dialogs:** + +--calendar, --checklist, --datebox, --form, --gauge, --infobox, --inputbox, +--menu, --mixedform, --mixedgauge, --msgbox, --passwordbox, --passwordform, +--pause, --radiolist, --rangebox, --textbox, --timebox, --treeview, --yesno. + +**Manual** + + - [bsddialog(1)](https://alfonsosiciliano.gitlab.io/posts/2022-01-26-manual-bsddialog.html) + + +**Examples**: + +``` +% ./bsddialog --backtitle "TITLE" --title msgbox --msgbox "Hello World!" 5 30 +% ./bsddialog --theme blackwhite --title msgbox --msgbox "Hello World!" 5 30 +% ./bsddialog --begin-y 2 --default-no --title yesno --yesno "Hello World!" 5 30 +% ./bsddialog --ascii-lines --pause "Hello World!" 8 50 10 +% ./bsddialog --checklist "Space to select" 0 0 0 Name1 Desc1 off Name2 Desc2 on +% ./bsddialog --title yesno --hline "bsddialog" --yesno "Hello World!" 5 25 +% ./bsddialog --extra-button --help-button --yesno "Hello World!" 0 0 +``` + +and [Examples](https://gitlab.com/alfix/bsddialog/-/tree/main/examples_utility) +in the _Public Domain_ to build new projects: +``` +% sh ./examples_utility/calendar.sh +% sh ./examples_utility/checklist.sh +% sh ./examples_utility/datebox.sh +% sh ./examples_utility/form.sh +% sh ./examples_utility/gauge.sh +% sh ./examples_utility/infobox.sh +% sh ./examples_utility/inputbox.sh +% sh ./examples_utility/menu.sh +% sh ./examples_utility/mixedform.sh +% sh ./examples_utility/mixedgauge.sh +% sh ./examples_utility/msgbox.sh +% sh ./examples_utility/passwordbox.sh +% sh ./examples_utility/passwordform.sh +% sh ./examples_utility/pause.sh +% sh ./examples_utility/radiolist.sh +% sh ./examples_utility/rangebox.sh +% sh ./examples_utility/timebox.sh +% sh ./examples_utility/yesno.sh +``` + +## Library + +**API** + + - [bsddialog.h](https://gitlab.com/alfix/bsddialog/-/blob/main/lib/bsddialog.h) + - [bsddialog\_theme.h](https://gitlab.com/alfix/bsddialog/-/blob/main/lib/bsddialog_theme.h) + + +**Manual** + + - [bsddialog(3)](https://alfonsosiciliano.gitlab.io/posts/2022-01-15-manual-libbsddialog.html) + + +**Examples**: + +[Examples](https://gitlab.com/alfix/bsddialog/-/tree/main/examples_library) +in the _Public Domain_ to build new projects: +``` +% cd examples_library +% sh compile +% ./calendar +% ./checklist +% ./datebox +% ./form +% ./gauge +% ./infobox +% ./menu +% ./mixedgauge +% ./mixedlist +% ./msgbox +% ./pause +% ./radiolist +% ./rangebox +% ./theme +% ./timebox +% ./yesno +``` + + +## TODO and Ideas + + - menubar feature. + - key callback. + - Right-To-Left text. + - some terminal does not hide the cursor, move it bottom-right before to getch. + - refactor backtitle: add WINDOW \*dialog.backtitle for multiline and fix expanding screen. + - refactor bottomdesc: add WINDOW \*dialog.bottomdesc to fix expandig screen. + - accessibility https://wiki.freebsd.org/Accessibility/Wishlist/Base. + - add bool conf.menu.depthlines. + - implement custom getopt\_long(). + - refactor/redesign gauge(). + - improve grey lines expanding terminal (maybe redrawwin() in hide\_dialog()). + - more restrictive strtol() and strtoul(). + - implement global buttons handler. + - doc: external tutorial, theming guide. + - implement menutype.min\_on. + - improve refresh at startup, avoid dialog refresh before drawing text. + - add debug API: bsddialog\_debug(y,x,refresh,"fmt",...). + - add mouse support. + - use alarm(2) for bsddialog\_pause. + - delete form fieldlen constraint, hide or truncate long field in little screens. + - improve --inputbox autosizing, consider also input length. + - fix --form "" 0 0 0 Label 1 0 Init 1 12 0 0 (with 0 editable field). + - fix --mixedform "" 0 0 0 Label 1 0 Init 1 12 0 0 2 (with 0 editable field). + - add *text* customization to --hmsg *help-message* + - check --passwordform *fieldlen* like --form and --mixedform. + From nobody Thu Jul 11 06:50:40 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKQNJ3Xvkz5QQtP; Thu, 11 Jul 2024 06:50: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKQNJ2zBCz4C9q; Thu, 11 Jul 2024 06:50:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720680640; 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=6nzMlbqam0+0U+yrhfBbcpEj4GwvVRUAWaIfd6EQq60=; b=AOl654BUHgT2xlW6TetcDgIDAYl1xamKrXoXRrypDh8us2CdBLb4/RQxGHVJZKIsvYPCvN 1xAeSVh3M/dp216zhXqOWNhJkEI5RaXhxpAF3p80+1u3IYc91ecxRmJPKX9WYOTmoxtoSF +D2AM41S8s9aVWIw7zUGGeVqphti4rx0Tl3ChXn47OexfQ4P3gZEP5NAUWAZhfxgY2/G/x 6+27XXTyfh50+/hMAktw7XNjTeo66yy9LTtngNbtJSsY5pjXVmGAo7+W7ztB+1h+cP0SeB gH2LdwVxB4ChXHoj2Gsh9jpzd6tMfNeovvUUXmFd7HBwN4KwHGkLsbkz/7eYSQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720680640; a=rsa-sha256; cv=none; b=EYFdyxvI5KGX7wIR9XUckIoCYRmFXPSisLZODQs2e/LNLMBSpshCKRUzaS2TKK92WDr8XY YHuZ5fX67Si87vKrE++Q9Ue3nSAP9PWYcvofo3y0inQMw3cgieahWOKi9J9L9OWDHQIGrH f4Wn37YkaPdDomBmqXsgvzX5y7OCNK0fC74b6vlDlSL39iI2r9Lhwk35ZxujNmDe5MfDBC TkfQAO4t2WVQ8GhL3lV7HrOYCHKJ2oOrATMbAdSxw/Ga1lW27rejyeKS7B2FizxtznTFi6 DelgxSNOo6+X56LQEQhMSTxn5wdbLv3R887FPTDsD7HisulnU6hnd5mtaawcow== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720680640; 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=6nzMlbqam0+0U+yrhfBbcpEj4GwvVRUAWaIfd6EQq60=; b=tMsmIgSV7Q6L1lHhG3ZK7hq0no6GaKOWmQTEgh29EunROqW7QIKPY8QhUvMFjGpI2FiovQ lnMCht7X/g+29b7AOgqdKaqpsJTF01YXiB1CE51MmB8OK0EnT2meRzVPJ/Zyc5Mlr/+RY4 n0eLA9X4tERwmLqk8arJcRa7Wg1YUwzmAmoxX512+VgIhwlQHw/oIMferssJ0+EdLVRyon v93Nxg+jjVhFHTXiaWKe3avlDTOBc5D76uHXWF7XyUPuBvijrXInTF97yzguOwIjsNj62s WdR/XOp2PZr/1xcrR4pSQy26wlGLNDUQMcCpU9wTtWnp64bV6amHkh5slhl2+g== 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 4WKQNJ2114zqVT; Thu, 11 Jul 2024 06:50: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 46B6oeMa073345; Thu, 11 Jul 2024 06:50:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46B6oexO073342; Thu, 11 Jul 2024 06:50:40 GMT (envelope-from git) Date: Thu, 11 Jul 2024 06:50:40 GMT Message-Id: <202407110650.46B6oexO073342@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: b93028d8cd3a - main - vt: Add vd_bitblt_argb List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b93028d8cd3aafc883b5f0ecec65a8a2a30af7f3 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=b93028d8cd3aafc883b5f0ecec65a8a2a30af7f3 commit b93028d8cd3aafc883b5f0ecec65a8a2a30af7f3 Author: Emmanuel Vadot AuthorDate: 2024-07-09 12:35:12 +0000 Commit: Emmanuel Vadot CommitDate: 2024-07-11 06:47:17 +0000 vt: Add vd_bitblt_argb This blit an ARGB image on the dedicated vd. This also adds vt_fb_bitblt_argb which will works for most of the vt backends Differential Revision: https://reviews.freebsd.org/D45929 Reviewed by: tsoome Sponsored by: Beckhoff Automation GmbH & Co. KG --- sys/dev/virtio/gpu/virtio_gpu.c | 12 ++++++++++ sys/dev/vt/hw/efifb/efifb.c | 1 + sys/dev/vt/hw/fb/vt_early_fb.c | 1 + sys/dev/vt/hw/fb/vt_fb.c | 47 +++++++++++++++++++++++++++++++++++++++ sys/dev/vt/hw/fb/vt_fb.h | 1 + sys/dev/vt/hw/ofwfb/ofwfb.c | 12 ++++++++++ sys/dev/vt/hw/simplefb/simplefb.c | 12 ++++++++++ sys/dev/vt/hw/vbefb/vbefb.c | 1 + sys/dev/vt/hw/vga/vt_vga.c | 12 ++++++++++ sys/dev/vt/vt.h | 5 +++++ 10 files changed, 104 insertions(+) diff --git a/sys/dev/virtio/gpu/virtio_gpu.c b/sys/dev/virtio/gpu/virtio_gpu.c index f18eef985cc6..eac5b5db21b9 100644 --- a/sys/dev/virtio/gpu/virtio_gpu.c +++ b/sys/dev/virtio/gpu/virtio_gpu.c @@ -102,6 +102,7 @@ static vd_bitblt_text_t vtgpu_fb_bitblt_text; static vd_bitblt_bmp_t vtgpu_fb_bitblt_bitmap; static vd_drawrect_t vtgpu_fb_drawrect; static vd_setpixel_t vtgpu_fb_setpixel; +static vd_bitblt_argb_t vtgpu_fb_bitblt_argb; static struct vt_driver vtgpu_fb_driver = { .vd_name = "virtio_gpu", @@ -111,6 +112,7 @@ static struct vt_driver vtgpu_fb_driver = { .vd_bitblt_text = vtgpu_fb_bitblt_text, .vd_invalidate_text = vt_fb_invalidate_text, .vd_bitblt_bmp = vtgpu_fb_bitblt_bitmap, + .vd_bitblt_argb = vtgpu_fb_bitblt_argb, .vd_drawrect = vtgpu_fb_drawrect, .vd_setpixel = vtgpu_fb_setpixel, .vd_postswitch = vt_fb_postswitch, @@ -180,6 +182,16 @@ vtgpu_fb_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw, vtgpu_resource_flush(sc, x, y, width, height); } +static int +vtgpu_fb_bitblt_argb(struct vt_device *vd, const struct vt_window *vw, + const uint8_t *argb, + unsigned int width, unsigned int height, + unsigned int x, unsigned int y) +{ + + return (EOPNOTSUPP); +} + static void vtgpu_fb_drawrect(struct vt_device *vd, int x1, int y1, int x2, int y2, int fill, term_color_t color) diff --git a/sys/dev/vt/hw/efifb/efifb.c b/sys/dev/vt/hw/efifb/efifb.c index 805b36d499ae..cac6f93b7af1 100644 --- a/sys/dev/vt/hw/efifb/efifb.c +++ b/sys/dev/vt/hw/efifb/efifb.c @@ -58,6 +58,7 @@ static struct vt_driver vt_efifb_driver = { .vd_bitblt_text = vt_fb_bitblt_text, .vd_invalidate_text = vt_fb_invalidate_text, .vd_bitblt_bmp = vt_fb_bitblt_bitmap, + .vd_bitblt_argb = vt_fb_bitblt_argb, .vd_drawrect = vt_fb_drawrect, .vd_setpixel = vt_fb_setpixel, .vd_fb_ioctl = vt_fb_ioctl, diff --git a/sys/dev/vt/hw/fb/vt_early_fb.c b/sys/dev/vt/hw/fb/vt_early_fb.c index 52241038ce35..9d66f5cd1398 100644 --- a/sys/dev/vt/hw/fb/vt_early_fb.c +++ b/sys/dev/vt/hw/fb/vt_early_fb.c @@ -58,6 +58,7 @@ static struct vt_driver vt_fb_early_driver = { .vd_bitblt_text = vt_fb_bitblt_text, .vd_invalidate_text = vt_fb_invalidate_text, .vd_bitblt_bmp = vt_fb_bitblt_bitmap, + .vd_bitblt_argb = vt_fb_bitblt_argb, .vd_drawrect = vt_fb_drawrect, .vd_setpixel = vt_fb_setpixel, .vd_priority = VD_PRIORITY_GENERIC, diff --git a/sys/dev/vt/hw/fb/vt_fb.c b/sys/dev/vt/hw/fb/vt_fb.c index c1eeb5e69e08..5031ab946203 100644 --- a/sys/dev/vt/hw/fb/vt_fb.c +++ b/sys/dev/vt/hw/fb/vt_fb.c @@ -49,6 +49,7 @@ static struct vt_driver vt_fb_driver = { .vd_bitblt_text = vt_fb_bitblt_text, .vd_invalidate_text = vt_fb_invalidate_text, .vd_bitblt_bmp = vt_fb_bitblt_bitmap, + .vd_bitblt_argb = vt_fb_bitblt_argb, .vd_drawrect = vt_fb_drawrect, .vd_setpixel = vt_fb_setpixel, .vd_postswitch = vt_fb_postswitch, @@ -332,6 +333,52 @@ vt_fb_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw, } } +int +vt_fb_bitblt_argb(struct vt_device *vd, const struct vt_window *vw, + const uint8_t *argb, + unsigned int width, unsigned int height, + unsigned int x, unsigned int y) +{ + struct fb_info *info; + uint32_t o, cc; + int bpp, xi, yi; + + info = vd->vd_softc; + bpp = FBTYPE_GET_BYTESPP(info); + if (bpp != 4) + return (EOPNOTSUPP); + + if (info->fb_flags & FB_FLAG_NOWRITE) + return (0); + + KASSERT((info->fb_vbase != 0), ("Unmapped framebuffer")); + + /* Bound by right and bottom edges. */ + if (y + height > vw->vw_draw_area.tr_end.tp_row) { + if (y >= vw->vw_draw_area.tr_end.tp_row) + return (EINVAL); + height = vw->vw_draw_area.tr_end.tp_row - y; + } + if (x + width > vw->vw_draw_area.tr_end.tp_col) { + if (x >= vw->vw_draw_area.tr_end.tp_col) + return (EINVAL); + width = vw->vw_draw_area.tr_end.tp_col - x; + } + for (yi = 0; yi < height; yi++) { + for (xi = 0; xi < (width * 4); xi += 4) { + o = (y + yi) * info->fb_stride + (x + (xi / 4)) * bpp; + o += vd->vd_transpose; + cc = (argb[yi * width * 4 + xi] << 16) | + (argb[yi * width * 4 + xi + 1] << 8) | + (argb[yi * width * 4 + xi + 2]) | + (argb[yi * width * 4 + xi + 3] << 24); + vt_fb_mem_wr4(info, o, cc); + } + } + + return (0); +} + void vt_fb_bitblt_text(struct vt_device *vd, const struct vt_window *vw, const term_rect_t *area) diff --git a/sys/dev/vt/hw/fb/vt_fb.h b/sys/dev/vt/hw/fb/vt_fb.h index 54f7ba667eb1..fc3db42b2a15 100644 --- a/sys/dev/vt/hw/fb/vt_fb.h +++ b/sys/dev/vt/hw/fb/vt_fb.h @@ -42,6 +42,7 @@ vd_blank_t vt_fb_blank; vd_bitblt_text_t vt_fb_bitblt_text; vd_invalidate_text_t vt_fb_invalidate_text; vd_bitblt_bmp_t vt_fb_bitblt_bitmap; +vd_bitblt_argb_t vt_fb_bitblt_argb; vd_drawrect_t vt_fb_drawrect; vd_setpixel_t vt_fb_setpixel; vd_postswitch_t vt_fb_postswitch; diff --git a/sys/dev/vt/hw/ofwfb/ofwfb.c b/sys/dev/vt/hw/ofwfb/ofwfb.c index 6469240ed303..f5653b5f3ff2 100644 --- a/sys/dev/vt/hw/ofwfb/ofwfb.c +++ b/sys/dev/vt/hw/ofwfb/ofwfb.c @@ -66,6 +66,7 @@ static vd_probe_t ofwfb_probe; static vd_init_t ofwfb_init; static vd_bitblt_text_t ofwfb_bitblt_text; static vd_bitblt_bmp_t ofwfb_bitblt_bitmap; +static vd_bitblt_argb_t ofwfb_bitblt_argb; static const struct vt_driver vt_ofwfb_driver = { .vd_name = "ofwfb", @@ -74,6 +75,7 @@ static const struct vt_driver vt_ofwfb_driver = { .vd_blank = vt_fb_blank, .vd_bitblt_text = ofwfb_bitblt_text, .vd_bitblt_bmp = ofwfb_bitblt_bitmap, + .vd_bitblt_argb = ofwfb_bitblt_argb, .vd_fb_ioctl = vt_fb_ioctl, .vd_fb_mmap = vt_fb_mmap, .vd_priority = VD_PRIORITY_GENERIC+1, @@ -242,6 +244,16 @@ ofwfb_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw, } } +static int +ofwfb_bitblt_argb(struct vt_device *vd, const struct vt_window *vw, + const uint8_t *argb, + unsigned int width, unsigned int height, + unsigned int x, unsigned int y) +{ + + return (EOPNOTSUPP); +} + void ofwfb_bitblt_text(struct vt_device *vd, const struct vt_window *vw, const term_rect_t *area) diff --git a/sys/dev/vt/hw/simplefb/simplefb.c b/sys/dev/vt/hw/simplefb/simplefb.c index c7381b102d3e..6983b41b3888 100644 --- a/sys/dev/vt/hw/simplefb/simplefb.c +++ b/sys/dev/vt/hw/simplefb/simplefb.c @@ -49,6 +49,7 @@ static vd_init_t vt_simplefb_init; static vd_fini_t vt_simplefb_fini; static vd_probe_t vt_simplefb_probe; +static vd_bitblt_argb_t vt_simplefb_bitblt_argb; static struct vt_driver vt_simplefb_driver = { .vd_name = "simplefb", @@ -59,6 +60,7 @@ static struct vt_driver vt_simplefb_driver = { .vd_bitblt_text = vt_fb_bitblt_text, .vd_invalidate_text = vt_fb_invalidate_text, .vd_bitblt_bmp = vt_fb_bitblt_bitmap, + .vd_bitblt_argb = vt_simplefb_bitblt_argb, .vd_drawrect = vt_fb_drawrect, .vd_setpixel = vt_fb_setpixel, .vd_fb_ioctl = vt_fb_ioctl, @@ -221,3 +223,13 @@ vt_simplefb_fini(struct vt_device *vd, void *softc) vt_fb_fini(vd, softc); pmap_unmapdev((void *)sc->fb_vbase, sc->fb_size); } + +static int +vt_simplefb_bitblt_argb(struct vt_device *vd, const struct vt_window *vw, + const uint8_t *argb, + unsigned int width, unsigned int height, + unsigned int x, unsigned int y) +{ + + return (EOPNOTSUPP); +} diff --git a/sys/dev/vt/hw/vbefb/vbefb.c b/sys/dev/vt/hw/vbefb/vbefb.c index bb4d88dd2ecf..2d6ada6002d0 100644 --- a/sys/dev/vt/hw/vbefb/vbefb.c +++ b/sys/dev/vt/hw/vbefb/vbefb.c @@ -58,6 +58,7 @@ static struct vt_driver vt_vbefb_driver = { .vd_bitblt_text = vt_fb_bitblt_text, .vd_invalidate_text = vt_fb_invalidate_text, .vd_bitblt_bmp = vt_fb_bitblt_bitmap, + .vd_bitblt_argb = vt_fb_bitblt_argb, .vd_drawrect = vt_fb_drawrect, .vd_setpixel = vt_fb_setpixel, .vd_fb_ioctl = vt_fb_ioctl, diff --git a/sys/dev/vt/hw/vga/vt_vga.c b/sys/dev/vt/hw/vga/vt_vga.c index e2ae20894fc5..64039575c0ad 100644 --- a/sys/dev/vt/hw/vga/vt_vga.c +++ b/sys/dev/vt/hw/vga/vt_vga.c @@ -96,6 +96,7 @@ static vd_blank_t vga_blank; static vd_bitblt_text_t vga_bitblt_text; static vd_invalidate_text_t vga_invalidate_text; static vd_bitblt_bmp_t vga_bitblt_bitmap; +static vd_bitblt_argb_t vga_bitblt_argb; static vd_drawrect_t vga_drawrect; static vd_setpixel_t vga_setpixel; static vd_postswitch_t vga_postswitch; @@ -108,6 +109,7 @@ static const struct vt_driver vt_vga_driver = { .vd_bitblt_text = vga_bitblt_text, .vd_invalidate_text = vga_invalidate_text, .vd_bitblt_bmp = vga_bitblt_bitmap, + .vd_bitblt_argb = vga_bitblt_argb, .vd_drawrect = vga_drawrect, .vd_setpixel = vga_setpixel, .vd_postswitch = vga_postswitch, @@ -998,6 +1000,16 @@ vga_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw, } } +static int +vga_bitblt_argb(struct vt_device *vd, const struct vt_window *vw, + const uint8_t *argb, + unsigned int width, unsigned int height, + unsigned int x, unsigned int y) +{ + + return (EOPNOTSUPP); +} + static void vga_initialize_graphics(struct vt_device *vd) { diff --git a/sys/dev/vt/vt.h b/sys/dev/vt/vt.h index 56a28c0420c7..8e35a81bc101 100644 --- a/sys/dev/vt/vt.h +++ b/sys/dev/vt/vt.h @@ -345,6 +345,10 @@ typedef void vd_bitblt_bmp_t(struct vt_device *vd, const struct vt_window *vw, const uint8_t *pattern, const uint8_t *mask, unsigned int width, unsigned int height, unsigned int x, unsigned int y, term_color_t fg, term_color_t bg); +typedef int vd_bitblt_argb_t(struct vt_device *vd, const struct vt_window *vw, + const uint8_t *argb, + unsigned int width, unsigned int height, + unsigned int x, unsigned int y); typedef int vd_fb_ioctl_t(struct vt_device *, u_long, caddr_t, struct thread *); typedef int vd_fb_mmap_t(struct vt_device *, vm_ooffset_t, vm_paddr_t *, int, vm_memattr_t *); @@ -368,6 +372,7 @@ struct vt_driver { vd_bitblt_text_t *vd_bitblt_text; vd_invalidate_text_t *vd_invalidate_text; vd_bitblt_bmp_t *vd_bitblt_bmp; + vd_bitblt_argb_t *vd_bitblt_argb; /* Framebuffer ioctls, if present. */ vd_fb_ioctl_t *vd_fb_ioctl; From nobody Thu Jul 11 06:50:41 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKQNK5gPLz5QQtR; Thu, 11 Jul 2024 06:50: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKQNK34hHz4C9D; Thu, 11 Jul 2024 06:50:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720680641; 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=ECvzpFO8GGBtCyOPUXMMGFHekxtez4O7tF8lXxdaYr4=; b=ntmkB6P4MbxW6cbuCqYiz7OxioxHnOYIt59qqoqLr9VrHIKVqEmoUeoK04s1kfWi/JmHWz H1vSFeMqXWQzC8wLSDL4PxNxgi9vtU7WuhIHWBGOhSg8Ilr56BsmCTFULRRI90AHltiFHN zRedZoB7dl3BYEIVrl/y60x1WXEYELjQaeYPRjk0u7DfTW8WDVbsJ3MbSUbOLm4symhCpg k/r4lVXvkFFfl6JdMRn+2Ck161fMm0FIYZyGi84LxbDXoJaqUws/a/TWLh9P0O5dPCPY+Z gOlUB9RfedRRKWFFqIW+n/0LnwK3tv4BRYuAsAzz6cVVd0320XwOgLvY9rUyfA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720680641; a=rsa-sha256; cv=none; b=uz00g9oweAJWxS/UTQ9YTAXrYH3ZiXsZSl+DQx4V9UuIGpxFpI7lg8fh8+R4ZCi5L2zO34 zJDLIuW5hzXxJLwVOv5DZNiXqw73qUAXZbgSrt4uM3i0oYhZ1gNjAk1OyUOMlG/FxY5u7X 7E+1PZnx77khmByvpGSMidGMSW0XfDfEQMe4Hb8tNqt/MF+4s4P6KR+mBO0OX/D7HuEzpw IT6kTpeHORSai3Vjw4RYi77M5cu/Qzxq+EbV1k1vC1bY6mI6SWIq5KW0dDE5lj8Hl5uJGq N8k5TFliFnTLJ/RTciUtrhAH0IbO2pWXa2rSary78UN21a2SppjWhvrki7rs4w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720680641; 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=ECvzpFO8GGBtCyOPUXMMGFHekxtez4O7tF8lXxdaYr4=; b=ohDfHEuwxufyQ4741c0kD7qH/MaiZHBi7GLLJQGn7+i9F55j1RbpBY5yxkohJSSi5GnanI WyPZYwbv20tPt5YIG5Ub+OQ8BauNXCfPz2Z9pT3TPEIZokHFKNyfibw4SewaQYofXiCpvq zZ1xELIg4GvCyC7JTxpEGjHXnE8UEUXsuSk8RJoSbCx7oLfdOySFqoM8npXH0T89NTBECr Ft08LvyWH5Y+v0jqlUyo9Ad+gNF9bpbfG7hHDU0EJcs8ZMAdLz85x45pyOL6lMT2Ba5gyG zpTeDbIvM7buweLD6PN46HS+Piu/G2nXaDSICBPAPkIxWtjYVUSl5qR/+q/dOg== 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 4WKQNK2hp4zqwP; Thu, 11 Jul 2024 06:50: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 46B6of17073384; Thu, 11 Jul 2024 06:50:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46B6off0073381; Thu, 11 Jul 2024 06:50:41 GMT (envelope-from git) Date: Thu, 11 Jul 2024 06:50:41 GMT Message-Id: <202407110650.46B6off0073381@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 966e53a4e563 - main - linker: Add MODINFOMD_SPLASH type List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 966e53a4e563da36d62edf57c2b0007921fec8dd Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=966e53a4e563da36d62edf57c2b0007921fec8dd commit 966e53a4e563da36d62edf57c2b0007921fec8dd Author: Emmanuel Vadot AuthorDate: 2024-07-09 12:37:08 +0000 Commit: Emmanuel Vadot CommitDate: 2024-07-11 06:47:21 +0000 linker: Add MODINFOMD_SPLASH type This mod type and structure holds the splash screen data and metadata. Differential Revision: https://reviews.freebsd.org/D45930 Reviewed by: tsoome Sponsored by: Beckhoff Automation GmbH & Co. KG --- sys/kern/subr_module.c | 9 +++++++++ sys/sys/linker.h | 1 + sys/sys/splash.h | 17 +++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/sys/kern/subr_module.c b/sys/kern/subr_module.c index 829655ed4fb0..7f56ed72e1ac 100644 --- a/sys/kern/subr_module.c +++ b/sys/kern/subr_module.c @@ -293,6 +293,7 @@ preload_bootstrap_relocate(vm_offset_t offset) switch (hdr[0]) { case MODINFO_ADDR: case MODINFO_METADATA|MODINFOMD_FONT: + case MODINFO_METADATA|MODINFOMD_SPLASH: case MODINFO_METADATA|MODINFOMD_SSYM: case MODINFO_METADATA|MODINFOMD_ESYM: ptr = (vm_offset_t *)(curp + (sizeof(uint32_t) * 2)); @@ -423,6 +424,11 @@ preload_modinfo_type(struct sbuf *sbp, int type) case MODINFOMD_FONT: sbuf_cat(sbp, "MODINFOMD_FONT"); break; +#endif +#ifdef MODINFOMD_SPLASH + case MODINFOMD_SPLASH: + sbuf_cat(sbp, "MODINFOMD_SPLASH"); + break; #endif default: sbuf_cat(sbp, "unrecognized metadata type"); @@ -475,6 +481,9 @@ preload_modinfo_value(struct sbuf *sbp, uint32_t *bptr, int type, int len) #endif #ifdef MODINFOMD_FONT case MODINFO_METADATA | MODINFOMD_FONT: +#endif +#ifdef MODINFOMD_SPLASH + case MODINFO_METADATA | MODINFOMD_SPLASH: #endif sbuf_print_vmoffset(sbp, *(vm_offset_t *)bptr); break; diff --git a/sys/sys/linker.h b/sys/sys/linker.h index 06e950f7affe..a316aa26d0eb 100644 --- a/sys/sys/linker.h +++ b/sys/sys/linker.h @@ -248,6 +248,7 @@ void linker_kldload_unbusy(int flags); #define MODINFOMD_FW_HANDLE 0x000c /* Firmware dependent handle */ #define MODINFOMD_KEYBUF 0x000d /* Crypto key intake buffer */ #define MODINFOMD_FONT 0x000e /* Console font */ +#define MODINFOMD_SPLASH 0x000f /* Console splash screen */ #define MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */ #define MODINFOMD_DEPLIST (0x4001 | MODINFOMD_NOCOPY) /* depends on */ diff --git a/sys/sys/splash.h b/sys/sys/splash.h new file mode 100644 index 000000000000..ec1e140b88bd --- /dev/null +++ b/sys/sys/splash.h @@ -0,0 +1,17 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024 Beckhoff Automation GmbH & Co. KG + * + */ + +#ifndef _SYS_SPLASH_H_ +#define _SYS_SPLASH_H_ + +struct splash_info { + uint32_t si_width; + uint32_t si_height; + uint32_t si_depth; +}; + +#endif /* _SYS_SPLASH_H_ */ From nobody Thu Jul 11 06:50:42 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKQNM1MH1z5QQlZ; Thu, 11 Jul 2024 06:50:43 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKQNL4zbxz4CBG; Thu, 11 Jul 2024 06:50:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720680642; 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=n09DsVVErajwnIarVrjig7Y9ind8h/1PteitmmjoReA=; b=CIqPk5pML0oFj/QsqVWPIwSmWchDoHMLZwJzsgZbf8OfWDSVGq1FRUDcfWYkkHS0SwTILB 8l4Xxz50TMu5KaZhquP6mQUeI/mxghn/GyLbEqeIBG+mysFZlQy3ZGrZAfyghlI3LsMpB9 d4HRnsSIDmop/Gs/sQv0pRLVGS/G56nZfCD5o5Xu4rM5+RE0KYWCFvNTF4FFDSdwVPkwC9 Fv8D25yscS2WrK2+o+pLoaAnnIhiqoUtR6qlRllpKXGgb14or9o6myWxOt7Xt8I7mEVM0u jKtrSOh/nfCNwpI9o9/NF0G9M9kTWEcnIbk4BndFyl7UqbqTbCcBbmhSJvEDRQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720680642; a=rsa-sha256; cv=none; b=QfNA+p0o8TWfnDY0nTcO3+firD5Nnx07NU/zI24eIKOe5lgis4q95cH4n7RLmJaAKSkt5E W2nGkt4MpBWiu4vnpU7eWZ9rdLMpBM8SiBcogB9/K7ml3ggJVYlEBuBky40mhxd67B4S20 /f5ieNggfofU1uvUgjvJ5mDtov8u2zaPJ/2xDasdaVa8zsHd3NY1/o86TQsiL/+ZoU0Aif 8RoI/yaytKft7RF8mj7KosXqeQabHXVMIj5WKVREarLohas0gKa+bgVGTFjC3jtZkcmN9n Or/E4LoXrzlAI5dx3+ZdG8f/yRXfsZqF34TWz9FZpo406DtV/XkDar8QTpKCNA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720680642; 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=n09DsVVErajwnIarVrjig7Y9ind8h/1PteitmmjoReA=; b=Jf7ZYzuxgh3JOpYw0l7fBInEHp8L26bJMfKU7nCAI6soqf/ghyKQSrf2T2UM1xhUKmf594 zhmyR4laF5VKUR7GMXeBZCcNU5Dexs5/+D+hqDcX8Z9fnrvqgM6tpYx8LkwkjDLo2hsK0z LqtRy62Kw904ZY+pgd8rQ8Kx72AzbwdSEfH2aSMo3fgT5yoI1jc/hNHUruJMnKFNdwSxst BtyucLsIZfcASuhtTa3zXFvj/AGwUOQtmokmKxSI8L2L1v3xz0WS1PKB0Muds9u+Xe3ePm P6Bhrc4A0jn6aGsKawJUOUI05ZBN5RWFUOaD5Rva0pprhk3DAU1g2tr8Z2q5Kw== 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 4WKQNL40wGzqH6; Thu, 11 Jul 2024 06:50:42 +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 46B6og69073556; Thu, 11 Jul 2024 06:50:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46B6ogKU073553; Thu, 11 Jul 2024 06:50:42 GMT (envelope-from git) Date: Thu, 11 Jul 2024 06:50:42 GMT Message-Id: <202407110650.46B6ogKU073553@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: f6e8b0e85081 - main - vt: splash: Use splash screen passed from loader List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6e8b0e85081681100bf9cd74423be02233204bc Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=f6e8b0e85081681100bf9cd74423be02233204bc commit f6e8b0e85081681100bf9cd74423be02233204bc Author: Emmanuel Vadot AuthorDate: 2024-07-09 12:38:41 +0000 Commit: Emmanuel Vadot CommitDate: 2024-07-11 06:47:25 +0000 vt: splash: Use splash screen passed from loader If loader(8) gives use a splash screen to use using the MODINFOMD_SPLASH type, use it if RB_MUTE is set to "YES". By design only argb data will be displayed. Differential Revision: https://reviews.freebsd.org/D45931 Reviewed by: imp, tsoome Sponsored by: Beckhoff Automation GmbH & Co. KG --- sys/dev/vt/vt_core.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 92c83aee5967..df97d21745f0 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -1657,18 +1658,33 @@ vtterm_done(struct terminal *tm) static void vtterm_splash(struct vt_device *vd) { + caddr_t kmdp; + struct splash_info *si; + uintptr_t image; vt_axis_t top, left; - /* Display a nice boot splash. */ + kmdp = preload_search_by_type("elf kernel"); + if (kmdp == NULL) + kmdp = preload_search_by_type("elf64 kernel"); + si = MD_FETCH(kmdp, MODINFOMD_SPLASH, struct splash_info *); if (!(vd->vd_flags & VDF_TEXTMODE) && (boothowto & RB_MUTE)) { - top = (vd->vd_height - vt_logo_height) / 2; - left = (vd->vd_width - vt_logo_width) / 2; - switch (vt_logo_depth) { - case 1: - /* XXX: Unhardcode colors! */ + if (si == NULL) { + top = (vd->vd_height - vt_logo_height) / 2; + left = (vd->vd_width - vt_logo_width) / 2; vd->vd_driver->vd_bitblt_bmp(vd, vd->vd_curwindow, vt_logo_image, NULL, vt_logo_width, vt_logo_height, left, top, TC_WHITE, TC_BLACK); + } else { + if (si->si_depth != 4) + return; + printf("SPLASH: width: %d height: %d depth: %d\n", si->si_width, si->si_height, si->si_depth); + image = (uintptr_t)si + sizeof(struct splash_info); + image = roundup2(image, 8); + top = (vd->vd_height - si->si_height) / 2; + left = (vd->vd_width - si->si_width) / 2; + vd->vd_driver->vd_bitblt_argb(vd, vd->vd_curwindow, + (unsigned char *)image, si->si_width, si->si_height, + left, top); } vd->vd_flags |= VDF_SPLASH; } From nobody Thu Jul 11 06:50:43 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKQNM6jG4z5QQtS; Thu, 11 Jul 2024 06:50:43 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKQNM68P8z4CMY; Thu, 11 Jul 2024 06:50:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720680643; 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=WCiH0voPQ6DXaQYq0HLcnGdcBmz1UU1jjqu602qHbQ4=; b=pn9IR+lJ6+8pu4e/4rtSptNhnp877iLvoHGnVoFbKnT4NYe6ghE1c4NjtC2cS8jItgNlEX zWYvZH78SUiVnOvN6GcK3MJx6IEzzOj5wCtZyLwmhXv68lcrWW6DllD0zkCzLWVRcqEsXT SI+84nUXd+CY4y9SOlgEs7R0rg3AQ5dqM6IJWXsTNI/ZGZL43+Hp2BDsNelnNarV7lyoN5 S4qchD6rKLIwDwfdoZFxy0SBxv8w6GrUOdTl6OtKGE6XoEru/BldtKTImaKkSyc7mYT1Va fSKSKUNgaUlkNxEsCxW5Mh1MudETEE7LqX17pcbKropyC2SjMa0omhWPlZ1n0w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720680643; a=rsa-sha256; cv=none; b=CWVnu10CWCcefGHBBCXnLJaAy6T+nME8bQDcQLTweXxCaQ0tKCOrVEx7zM55zIAXiIIlKs vaS6KHjak+I3am5rlb2G9E3fiJ8ss6rpzR4qNOfDEhDw/ypT1CJnBmhGGFAu4gp2BHSskw QqCTu2afvxx/n8SlMyNJXqje07Ypg/zJJXz2M89WZ+JZMthbQRFYWxfA7VTArT3Z4JKvfg rskW8t/7oXFCifLipjy+EV/Yuk/mpKTkpY+Lh2ecN/1XGNRmyyvRACjwCS2K6M6XWhBDtN lojIELxKEvXWctQ2lIKD2l78q21O8kV9Ayrv5O7uR9EEYmPsGJ2X1DKa69CodQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720680643; 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=WCiH0voPQ6DXaQYq0HLcnGdcBmz1UU1jjqu602qHbQ4=; b=D5m2r01kKY5DquWgnDcWfSSkFYFYhWK0CtDczKXdinXjxG8LzrbPXBc/e9wldUJR3s9XBa 9OJRMb/znFb1Rx3dPvNh/i/3+mu6GzN3dX/VYcs1iTMZrr7jBpCCirJ9IHuCThNYtPuHGh 97lvs1Y5pyy0gvjdd/y7DlNKL5x+DXPoSLBZpnyxPWL8LIVYf6sGmREWJEaBV6ClhJw86+ afvCimuOKiRb7BySh7VglXunLAwrKiAYVBc2cwwjr9aML1lU61/pkUwmWdXG5zPsE1O64N EB7V0pgQjLZagyIi2IVLyVDGtoVPdroG33DISFX+sewaBXSif/J0zXjDLdyDRQ== 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 4WKQNM56CbzqwR; Thu, 11 Jul 2024 06:50: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 46B6ohJk073636; Thu, 11 Jul 2024 06:50:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46B6ohc4073633; Thu, 11 Jul 2024 06:50:43 GMT (envelope-from git) Date: Thu, 11 Jul 2024 06:50:43 GMT Message-Id: <202407110650.46B6ohc4073633@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 00460cc8c5ad - main - loader: Load a splash screen if "splash" variable is defined List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 00460cc8c5ad02b628e81eec9e493a1df8393d36 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=00460cc8c5ad02b628e81eec9e493a1df8393d36 commit 00460cc8c5ad02b628e81eec9e493a1df8393d36 Author: Emmanuel Vadot AuthorDate: 2024-07-09 12:41:11 +0000 Commit: Emmanuel Vadot CommitDate: 2024-07-11 06:47:30 +0000 loader: Load a splash screen if "splash" variable is defined Load a splash screen that vt(4) can use if the "splash" env variable is defined. For now only png is supported and decoding is done in loader and not in kernel compared to splash screen support in sc(4). For using this add: boot_mute="YES" splash="/boot/images/freebsd-logo-rev.png" in loader.conf Differential Revision: https://reviews.freebsd.org/D45932 Reviewed by: imp, tsoome Sponsored by: Beckhoff Automation GmbH & Co. KG --- stand/common/bootstrap.h | 1 + stand/common/gfx_fb.c | 48 +++++++++++++++++++++++++++++++++++++++++++++ stand/efi/loader/bootinfo.c | 5 +++++ 3 files changed, 54 insertions(+) diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h index 79ce0b023b7a..09c4832f5855 100644 --- a/stand/common/bootstrap.h +++ b/stand/common/bootstrap.h @@ -282,6 +282,7 @@ int tslog_init(void); int tslog_publish(void); vm_offset_t build_font_module(vm_offset_t); +vm_offset_t build_splash_module(vm_offset_t); /* MI module loaders */ #ifdef __elfN diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 0a88a166089b..9942c629d124 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -87,6 +87,7 @@ #include #include #include +#include #include #include #include @@ -3007,3 +3008,50 @@ build_font_module(vm_offset_t addr) file_addmetadata(fp, MODINFOMD_FONT, sizeof(fontp), &fontp); return (addr); } + +vm_offset_t +build_splash_module(vm_offset_t addr) +{ + struct preloaded_file *fp; + struct splash_info si; + const char *splash; + png_t png; + uint64_t splashp; + int error; + + /* We can't load first */ + if ((file_findfile(NULL, NULL)) == NULL) { + printf("Can not load splash module: %s\n", + "the kernel is not loaded"); + return (addr); + } + + fp = file_findfile(NULL, "elf kernel"); + if (fp == NULL) + fp = file_findfile(NULL, "elf64 kernel"); + if (fp == NULL) + panic("can't find kernel file"); + + splash = getenv("splash"); + if (splash == NULL) + return (addr); + + /* Parse png */ + if ((error = png_open(&png, splash)) != PNG_NO_ERROR) { + return (addr); + } + + si.si_width = png.width; + si.si_height = png.height; + si.si_depth = png.bpp; + splashp = addr; + addr += archsw.arch_copyin(&si, addr, sizeof (struct splash_info)); + addr = roundup2(addr, 8); + + /* Copy the bitmap. */ + addr += archsw.arch_copyin(png.image, addr, png.png_datalen); + + printf("Loading splash ok\n"); + file_addmetadata(fp, MODINFOMD_SPLASH, sizeof(splashp), &splashp); + return (addr); +} diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c index b55c2184d9fe..0a53422142e2 100644 --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -390,6 +390,11 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs) /* Pad to a page boundary. */ addr = roundup(addr, PAGE_SIZE); + + addr = build_splash_module(addr); + + /* Pad to a page boundary. */ + addr = roundup(addr, PAGE_SIZE); #endif /* Copy our environment. */ From nobody Thu Jul 11 06:50:44 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKQNP33S7z5QQp9; Thu, 11 Jul 2024 06:50: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKQNN6vzmz4CQm; Thu, 11 Jul 2024 06:50:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720680645; 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=BziuGgZyos9vrw1AqDOeFu88mP6F+ELFolvOSfExXvM=; b=hYlcuG1rm9fgUeU5o5OH3lPjdtX/qQeqZHxFssynZ6FmyIxJta/N2jCnVyERbCoBCEjq9b 6WtNHA2bS7DW8C+mvBPPlLvF8i+rzTfotzEXyrmxe69amiFzLMIJzmAtDMzZsiuyNUZCHZ Ql86Qe4pnEgf/HxACQQRbbBTjw9vXkjDrovNOnr4R2xIzL+LAsvewE3D+p8xS3AIooylNL ln3yxwTElfOZZuYeKfVH8ie8ucs6lmXxHKIJHXK5HcRdzfY7nb61JU39OpKRJzPwZNst/n smoHdWyFcnpiL+G1nhSJjDWf9lHDdqGyL+IvAF0anu1cNv81CoXayCoT2HYiOQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720680645; a=rsa-sha256; cv=none; b=pbMd1w+XW90z/bssORpvtyRrd+ICIkYQT4UjY69UvnjNYUFSTNCqN2gPFOhuVqF00TnY3l v1bwLMXnT0iiEQXXQz5QS9wyLyI7uovM5AtnSbW3rZmporfC5BwAq6K6rOjHMr1AUSgNha E2JY7fgHcMYNOnektHakqXaHuQYvyurrrUwlRo0hWY+W2HFGNUTGMge0USKWEF61rUMZ/o Hav4Pr4JnHvWa3wg+0YphqMeZWUDiztW1m5wuXrXfSMeqDt8HCkTfHoSwK1t6RW9C83Goj ucmuOLMRNwI8jUd8GRtxpuk3GZKFQ4R3/g8CjbgRWZgDGTrkxgEy/WAG0SdYng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720680645; 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=BziuGgZyos9vrw1AqDOeFu88mP6F+ELFolvOSfExXvM=; b=qNuvziF70DLPKYiAfA5CDzv1Jfdur5YrBPU9J1gn8oLsAhiJqipG5LoFIOOvQ0aOSTM4tO 94CsFSLZiCI2LMWMZ5Z/gTho6HCl3PPbZ+rNsBsGQJa/g2J1dhNgBlbfyzlFKtnDxoWl6Y FaR1L06yzK0+tErl2BwjP6dDHPzyy46CigHzeolb1JswT9GwsadaqTYvGkkmQ9dxgq6hO9 NhtxFW7l5uZMqQkHioc6MjIrahWptb/AtAhXDzrWTuX1x/Pw1dOoZMoEWhgomt1mkzI5kI StN9JfhGctcHrkRoVhIlQ8zrfv/s+mUAYBGL6Utf8/jn/lA6hW6Ee7Xv2kwE3g== 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 4WKQNN68j1zqkR; Thu, 11 Jul 2024 06:50: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 46B6oiRV073690; Thu, 11 Jul 2024 06:50:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46B6oiBh073687; Thu, 11 Jul 2024 06:50:44 GMT (envelope-from git) Date: Thu, 11 Jul 2024 06:50:44 GMT Message-Id: <202407110650.46B6oiBh073687@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 7504e0e3e517 - main - splash(4): Document how to use splash screen with vt(4) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7504e0e3e517fe9f0c775b802f0eb30481b4c01d Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=7504e0e3e517fe9f0c775b802f0eb30481b4c01d commit 7504e0e3e517fe9f0c775b802f0eb30481b4c01d Author: Emmanuel Vadot AuthorDate: 2024-07-09 14:43:36 +0000 Commit: Emmanuel Vadot CommitDate: 2024-07-11 06:47:34 +0000 splash(4): Document how to use splash screen with vt(4) Differential Revision: https://reviews.freebsd.org/D45935 Sponsored by: Beckhoff Automation GmbH & Co. KG --- share/man/man4/splash.4 | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/share/man/man4/splash.4 b/share/man/man4/splash.4 index b6d93287286c..736703317a7f 100644 --- a/share/man/man4/splash.4 +++ b/share/man/man4/splash.4 @@ -24,7 +24,7 @@ .\" (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 December 31, 2015 +.Dd July 09, 2024 .Dt SPLASH 4 .Os .Sh NAME @@ -203,7 +203,9 @@ have the following line in the kernel configuration file. .Pp .Dl device splash .Pp -Next, edit +Next for +.Xr syscons 4 +, edit .Pa /boot/loader.conf (see .Xr loader.conf 5 ) @@ -240,6 +242,17 @@ splash_txt_load="YES" bitmap_load="YES" bitmap_name="/boot/splash.bin" .Ed +.Pp +For +.Xr vt 4 +, edit +.Pa /boot/loader.conf +(see +.Xr loader.conf 5 ) +and include the following lines: +.Bd -literal -offset indent +splash="/boot/images/freebsd-logo-rev.png" +boot_mute="YES" .\".Sh DIAGNOSTICS .Sh SEE ALSO .Xr vidcontrol 1 , @@ -291,7 +304,7 @@ and modules were written by .An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . .Sh CAVEATS -Both the splash screen and the screen saver work with +The screen saver work with .Xr syscons 4 only. .Sh BUGS From nobody Thu Jul 11 07:36:45 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKRPT6fxGz5QVkj; Thu, 11 Jul 2024 07:36: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKRPT65XDz4HvK; Thu, 11 Jul 2024 07:36:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720683405; 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=7VHMg5vlZYUCqa6xYg6hbKdyDNCRL16D6jWCl0gp5aM=; b=Tuxpwg5rNas+XZ74zM6++68QFrRFFazmJkGstRyAbLLd58v4Hya87FvRvJac5Aa6Ds/qWb M3+7Z9h8450/6aC072In/R/o3q6P2HPtdB3JINqEnZc4ErUn3jcKt0xT2WIz6FJsg+0W4z +nzmIyA5uV26WLJ0UQE7SCaVv9HWMDIaZFGC+KIuMBwieSwX0/5vY3I5/kVRHx6fGCumtN SlNxof71SlK8YjxfUZVvPjqU1M6w6ydUy55xTy1/dSWIB8ujMgBazP4RiAaJf4mz51Mk+u WzmbZz8VP5QmXgwm0Li34TR2UwlYYA5XUHGHPIne/aTemoUhXoeugd2yH01B8Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720683405; a=rsa-sha256; cv=none; b=LV+uCTr7ornhmOzFDO9jHHt7WYB9jMM1LSg77f1JlEWpcVa9IbLNP9XpP0s51GhasJBbGa CU3g3rcmXUwwgSjEZopnPv9kzjGQSUYNPBTmns7dt+CQP7epofImrEuKbix2mm5mi/zxmz 9HqCUbZ/1tofKaRWPsIGIWKUGPD2APpQ0jHJBar9dMsVoOBcCSR8GrghcWWivCwzckL8fi TRZvVOWkK/33MijaP4lLgOTgJ/5K6LivDZYz5kLEPSZtIZzTjItWZvH0p/bnWwafCK9MMe 2BHLXXMVJuWQ+VoT6Fkfxga0MUzHfBNtqjdsRFm9pnqbDn0BDjx/KeESmwdS/Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720683405; 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=7VHMg5vlZYUCqa6xYg6hbKdyDNCRL16D6jWCl0gp5aM=; b=uxAJidSR3Y/1GlPe7K+8sBLclkN0zLI8s16sKJWSPNURIOT7PibMwjFQmJiSqnVeTedu9K VKWcF881gpEZ8Gs58p/XMe0lEpFOMqSXnBd3xdCdFojPp7KfNUnGA7PUFqVb7a4ZPDH5EM zDz00GlPfF9+9bccZ/0h1nNWINJ2d4HibjgmJHnNiT6SD0AQlnZDhNoVzZQcKKMorwtdwd sC9Nh63ix+OXrPqaTGlxITC2A0gkx0AovRZnCbM+lcPnyEu0y0q/wSLu6HnnWHTXoV9gEK PZ2S3DR1A2y+oX39ZOGL3iULACD39gLMexCNFlm6JX+7bKKkV5SLF3ci5Ccv+g== 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 4WKRPT5hQ2zrs7; Thu, 11 Jul 2024 07:36: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 46B7ajVx050066; Thu, 11 Jul 2024 07:36:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46B7ajBG050063; Thu, 11 Jul 2024 07:36:45 GMT (envelope-from git) Date: Thu, 11 Jul 2024 07:36:45 GMT Message-Id: <202407110736.46B7ajBG050063@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: e4fc2fd62a5e - main - splash: Add sys/types.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e4fc2fd62a5e4afebfc466868eb3b17f9ba0ad57 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=e4fc2fd62a5e4afebfc466868eb3b17f9ba0ad57 commit e4fc2fd62a5e4afebfc466868eb3b17f9ba0ad57 Author: Emmanuel Vadot AuthorDate: 2024-07-11 07:36:05 +0000 Commit: Emmanuel Vadot CommitDate: 2024-07-11 07:36:05 +0000 splash: Add sys/types.h To fix make test-includes Fixes: 966e53a4e563 ("linker: Add MODINFOMD_SPLASH type") Sponsored by: Beckhoff Automation GmbH & Co. KG --- sys/sys/splash.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/sys/splash.h b/sys/sys/splash.h index ec1e140b88bd..0bbc5a2bd574 100644 --- a/sys/sys/splash.h +++ b/sys/sys/splash.h @@ -8,6 +8,8 @@ #ifndef _SYS_SPLASH_H_ #define _SYS_SPLASH_H_ +#include + struct splash_info { uint32_t si_width; uint32_t si_height; From nobody Thu Jul 11 09:56:25 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKVVd5YX2z5QFjF; Thu, 11 Jul 2024 09:56: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKVVd4s50z4SFY; Thu, 11 Jul 2024 09:56:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720691785; 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=xF3aCjDJd462PLsejw8V73EGmElJ0gp3BdBxECz2IGU=; b=HKOsQq4Uvzm371s04N6Il2AH5TrfxJFDffRBM6B5rXT1I869IbO3t+IWF0ecf9R1lCOVai dmfHZgpDUCoAzAKmFC6cGw3BJRUgYSCRWEQTCYo+5uD+KEpFE2PcbJIw0EDjEcqNhXjXUH 54zE7kewj5pwaGF/mQZnZUhORbHzqZPL4NKy/9qQFMZGUn1VMz0ZtOSZn5Lbt7B1DYbCFx lWCdtIIdmHYdAz9QVcxmDiBBJ5Twt3wN7WbRPMLGkpFDXs0cG0znbqU19Vr8LHfTIYuXR9 /4pzBG13inrOpdgUTcQ634FlvBb5RV9Gsap0MY/ApwDlWKTa2+oCYMMnkGxxWw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720691785; a=rsa-sha256; cv=none; b=EDOZyEbHEB//gXr92i1UdiiZBmgFM3buxNo/FjAzvzW/HHG7Nofe7MNfiEDPzn1D2hoUuW cD8r3flVlT9mVXDZ4eBpQzs1kllu2BTTsMopcOg90dKPXOxt4N77gQpKIN0yk1V/XXEp1n pT/PEK2EO85TvAAfOc0DaJ8JhcrTXrjD92y1aCUIedopgJ9RpdGBTsjDO+jepW9CtR2FiU bkCDJaP9WWBMS0CX9m9aEv51dBWrbeax2lzOpOaVrYNmOH1nm2kGbGL8e9qRUwYOJ8dkvx EFDqr/tJPKRiJKU3Fc1idkm+KOvpX0z5o/aNdiftO2z87xUVRdNbPJoS/YZcIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720691785; 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=xF3aCjDJd462PLsejw8V73EGmElJ0gp3BdBxECz2IGU=; b=P0Pgs1UG/xrh7E0u04N1/7KoHJ+MlpfhF3/2qEVwg25w3lrixkPb1KWeCM5x98Sqv75J9n GjtqohTz+itFjYQZciKPieBHVnQ+r5pCCX945RUQJptpTZ/5+LB5YM6F3kNoj3qFyovEYq khpfpSGP51lg+IJ1koHEwI05E4wtGR9qPskVy8w/G0zqGW+N28MNH7zvq/00SW5urZSh6b uQBzCAahnxCusTjQoFieom4HYDK2lSrfx7le4sbPUcdw5RC+crEgg1qvWzzGqmo5vPyF8R tsN3jMATnFbdqeEh1KMF+CNZI9dGd63zbEh25WHUucLeaxgztiuJmESsLrQIAw== 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 4WKVVd4MpKzwK3; Thu, 11 Jul 2024 09:56: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 46B9uPgP086670; Thu, 11 Jul 2024 09:56:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46B9uP4t086667; Thu, 11 Jul 2024 09:56:25 GMT (envelope-from git) Date: Thu, 11 Jul 2024 09:56:25 GMT Message-Id: <202407110956.46B9uP4t086667@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: af84665261ff - main - tcp: whitespace cleanup of enum tcp_log_events List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: af84665261ff0aa4c930456f79ba89a73613a63f Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=af84665261ff0aa4c930456f79ba89a73613a63f commit af84665261ff0aa4c930456f79ba89a73613a63f Author: Michael Tuexen AuthorDate: 2024-07-11 09:38:11 +0000 Commit: Michael Tuexen CommitDate: 2024-07-11 09:38:11 +0000 tcp: whitespace cleanup of enum tcp_log_events No functional change intended. MFC after: 1 week Sponsored by: Netflix, Inc. --- sys/netinet/tcp_log_buf.h | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/sys/netinet/tcp_log_buf.h b/sys/netinet/tcp_log_buf.h index 38f66e69b093..082c2ca0f057 100644 --- a/sys/netinet/tcp_log_buf.h +++ b/sys/netinet/tcp_log_buf.h @@ -219,18 +219,18 @@ enum tcp_log_events { BBR_LOG_BBRRTT, /* BBR RTT is updated 20 */ BBR_LOG_JUSTRET, /* We just returned out of output 21 */ BBR_LOG_STATE, /* A BBR state change occurred 22 */ - BBR_LOG_PKT_EPOCH, /* A BBR packet epoch occurred 23 */ - BBR_LOG_PERSIST, /* BBR changed to/from a persists 24 */ - TCP_LOG_FLOWEND, /* End of a flow 25 */ - BBR_LOG_RTO, /* BBR's timeout includes BBR info 26 */ - BBR_LOG_DOSEG_DONE, /* hpts do_segment completes 27 */ - BBR_LOG_EXIT_GAIN, /* hpts do_segment completes 28 */ - BBR_LOG_THRESH_CALC, /* Doing threshold calculation 29 */ + BBR_LOG_PKT_EPOCH, /* A BBR packet epoch occurred 23 */ + BBR_LOG_PERSIST, /* BBR changed to/from a persists 24 */ + TCP_LOG_FLOWEND, /* End of a flow 25 */ + BBR_LOG_RTO, /* BBR's timeout includes BBR info 26 */ + BBR_LOG_DOSEG_DONE, /* hpts do_segment completes 27 */ + BBR_LOG_EXIT_GAIN, /* hpts do_segment completes 28 */ + BBR_LOG_THRESH_CALC, /* Doing threshold calculation 29 */ TCP_LOG_MAPCHG, /* Map Changes to the sendmap 30 */ - TCP_LOG_USERSEND, /* User level sends data 31 */ + TCP_LOG_USERSEND, /* User level sends data 31 */ BBR_RSM_CLEARED, /* RSM cleared of ACK flags 32 */ - BBR_LOG_STATE_TARGET, /* Log of target at state 33 */ - BBR_LOG_TIME_EPOCH, /* A timed based Epoch occurred 34 */ + BBR_LOG_STATE_TARGET, /* Log of target at state 33 */ + BBR_LOG_TIME_EPOCH, /* A timed based Epoch occurred 34 */ BBR_LOG_TO_PROCESS, /* A to was processed 35 */ BBR_LOG_BBRTSO, /* TSO update 36 */ BBR_LOG_HPTSDIAG, /* Hpts diag insert 37 */ @@ -257,18 +257,18 @@ enum tcp_log_events { TCP_TIMELY_WORK, /* Logs regarding Timely CC tweaks 58 */ TCP_LOG_USER_EVENT, /* User space event data 59 */ TCP_LOG_SENDFILE, /* sendfile() logging for TCP connections 60 */ - TCP_LOG_REQ_T, /* logging of request tracking 61 */ - TCP_LOG_ACCOUNTING, /* Log of TCP Accounting data 62 */ - TCP_LOG_FSB, /* FSB information 63 */ + TCP_LOG_REQ_T, /* logging of request tracking 61 */ + TCP_LOG_ACCOUNTING, /* Log of TCP Accounting data 62 */ + TCP_LOG_FSB, /* FSB information 63 */ RACK_DSACK_HANDLING, /* Handling of DSACK in rack for reordering window 64 */ - TCP_HYSTART, /* TCP Hystart logging 65 */ - TCP_CHG_QUERY, /* Change query during fnc_init() 66 */ - TCP_RACK_LOG_COLLAPSE, /* Window collapse by peer 67 */ - TCP_RACK_TP_TRIGGERED, /* A rack tracepoint is triggered 68 */ - TCP_HYBRID_PACING_LOG, /* Hybrid pacing log 69 */ + TCP_HYSTART, /* TCP Hystart logging 65 */ + TCP_CHG_QUERY, /* Change query during fnc_init() 66 */ + TCP_RACK_LOG_COLLAPSE, /* Window collapse by peer 67 */ + TCP_RACK_TP_TRIGGERED, /* A rack tracepoint is triggered 68 */ + TCP_HYBRID_PACING_LOG, /* Hybrid pacing log 69 */ TCP_LOG_PRU, /* TCP protocol user request 70 */ - TCP_POLICER_DET, /* TCP Policer detectionn 71 */ - TCP_PCM_MEASURE, /* TCP Path Capacity Measurement 72 */ + TCP_POLICER_DET, /* TCP Policer detectionn 71 */ + TCP_PCM_MEASURE, /* TCP Path Capacity Measurement 72 */ TCP_LOG_END /* End (keep at end) 72 */ }; From nobody Thu Jul 11 11:07:56 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKX586rGMz5QPRq; Thu, 11 Jul 2024 11:07: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKX586Jnwz4YLL; Thu, 11 Jul 2024 11:07:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720696076; 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=CZ/KRuR97uxWpBhkSpvPQNRdlb7wsKkUS9vux59gQuw=; b=NALTqJuu27Y/VcVg1Prp8nZp6JVoUqBw2wbBgbRwnlmIWkbTFecc3ZF7xfwsP9fI5nVrtQ VJxOv37Qk2p4McGwWma1QtooHMWzDwWMLHSNNzSWBKMKWOm0HmrBhOEBqebVx3mmq+wahZ FecolgGLo4ghU4zMR/EW3G6dlnpo0E8tvXkwm8AnzE2Fz2b3Ah8mZmWyP++R69dh1RBeni mWSQt96HdieOGHFn9UvPfPw0vmAqsbG9D3eweZ69aO/XsAQ/nOonMEPLVAbMR/vw/7SbvC PwXlMh0KFQZVIBjLpeLC8eeJYSR18cSrf1Wkhlx4Ya85uPv/bFJTDZRBz8dzXg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720696076; a=rsa-sha256; cv=none; b=Y1GWylrkIhs34Iu2Xs3FNT0hMBfaBYqgsFQhri0mDj7cy0MdwZduQbDpYQAM6xeg5gaXAN AsGo9ICKn5frO3S1CPBQopkr+IyECetaEc/NhjtwmAtepPcadBdQfowceqbbVAx6Rjyact VzW3MXc1Sr67/yeOo8Kpthm31+ReGua9F0tZRHRNCCgQ9Gr23JZtWaBuqP7XDhDCTJDoF5 RhU23355V3z0MM7pfcUd9P2Dju54s+R1997093p+nEmkJ+o8vSn8+elYZ1YVbYqAvMhy+C n6o61gl+BcfXDJPhekJZ037aRa0/1BvgsTll4KpcvNaGHlWo0OYIcxHxOHOGKg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720696076; 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=CZ/KRuR97uxWpBhkSpvPQNRdlb7wsKkUS9vux59gQuw=; b=ZjS44lU/bYVftVZS9ff/tPYGLsyvZUXQxZSxgUTdyTnINWFDj1XG0+AJTwo8EPLS7ajlJ9 dd4yg25RBXk6r72bJczU4mkUnkzXzoQoyIp+mLLHfqYsHZYoBrbQ0KUf7KnYfBpXNKlvJu bi7ygdQickgf7jwurCYplLwBluanqN/8C2zOAjdhu0igL2A7R85uzvpfmQSQhrXz8SyYZn hLcVBTZNis+zGs8Vrk2vC6DPg6JF1XVj7V4KCfvMxe4LljdHVTdZbm43e64l6sClmbCa1w oKphi2bYA7OHIOba/XoYOMIigCYE7aLZ1ymsg92itmgS5yMeTfhmWZkLOEvFgQ== 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 4WKX585vxmzxsg; Thu, 11 Jul 2024 11:07: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 46BB7uAf007080; Thu, 11 Jul 2024 11:07:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46BB7uSb007077; Thu, 11 Jul 2024 11:07:56 GMT (envelope-from git) Date: Thu, 11 Jul 2024 11:07:56 GMT Message-Id: <202407111107.46BB7uSb007077@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 87ee63bac69d - main - locks: add a runtime check for missing turnstile List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 87ee63bac69dc49291f55590b8baa57cad6c7d85 Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=87ee63bac69dc49291f55590b8baa57cad6c7d85 commit 87ee63bac69dc49291f55590b8baa57cad6c7d85 Author: Mateusz Guzik AuthorDate: 2024-07-11 00:17:27 +0000 Commit: Mateusz Guzik CommitDate: 2024-07-11 11:06:52 +0000 locks: add a runtime check for missing turnstile There are sometimes bugs which result in the unlock fast path failing, which in turns causes a not-helpful crash report when dereferencing a NULL turnstile. Help debugging such cases by pointing out what happened along with some debug. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/kern/kern_mutex.c | 4 +++- sys/kern/kern_rwlock.c | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index 90361b23c09a..0fa624cc4bb1 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -1053,7 +1053,9 @@ __mtx_unlock_sleep(volatile uintptr_t *c, uintptr_t v) turnstile_chain_lock(&m->lock_object); _mtx_release_lock_quick(m); ts = turnstile_lookup(&m->lock_object); - MPASS(ts != NULL); + if (__predict_false(ts == NULL)) { + panic("got NULL turnstile on mutex %p v %zx", m, v); + } if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p contested", m); turnstile_broadcast(ts, TS_EXCLUSIVE_QUEUE); diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index f53c69b5e6ec..31ff8a7213fd 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -770,11 +770,12 @@ __rw_runlock_hard(struct rwlock *rw, struct thread *td, uintptr_t v LOCK_FILE_LINE_ARG_DEF) { struct turnstile *ts; - uintptr_t setv, queue; + uintptr_t setv, passedv, queue; if (SCHEDULER_STOPPED()) return; + passedv = v; if (__rw_runlock_try(rw, td, &v)) goto out_lockstat; @@ -827,7 +828,10 @@ __rw_runlock_hard(struct rwlock *rw, struct thread *td, uintptr_t v * release the lock. */ ts = turnstile_lookup(&rw->lock_object); - MPASS(ts != NULL); + if (__predict_false(ts == NULL)) { + panic("got NULL turnstile on rwlock %p passedv %zx v %zx", + rw, passedv, v); + } turnstile_broadcast(ts, queue); turnstile_unpend(ts); td->td_rw_rlocks--; @@ -1206,7 +1210,7 @@ __rw_wunlock_hard(volatile uintptr_t *c, uintptr_t v LOCK_FILE_LINE_ARG_DEF) { struct rwlock *rw; struct turnstile *ts; - uintptr_t tid, setv; + uintptr_t tid, setv, passedv; int queue; tid = (uintptr_t)curthread; @@ -1254,6 +1258,7 @@ __rw_wunlock_hard(volatile uintptr_t *c, uintptr_t v LOCK_FILE_LINE_ARG_DEF) * of waiters or doing some complicated lock handoff gymnastics. */ setv = RW_UNLOCKED; + passedv = v; v = RW_READ_VALUE(rw); queue = TS_SHARED_QUEUE; if (v & RW_LOCK_WRITE_WAITERS) { @@ -1268,7 +1273,10 @@ __rw_wunlock_hard(volatile uintptr_t *c, uintptr_t v LOCK_FILE_LINE_ARG_DEF) queue == TS_SHARED_QUEUE ? "read" : "write"); ts = turnstile_lookup(&rw->lock_object); - MPASS(ts != NULL); + if (__predict_false(ts == NULL)) { + panic("got NULL turnstile on rwlock %p passedv %zx v %zx", rw, + passedv, v); + } turnstile_broadcast(ts, queue); turnstile_unpend(ts); turnstile_chain_unlock(&rw->lock_object); From nobody Thu Jul 11 19:31:07 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKlFl4rJ1z5RHYr; Thu, 11 Jul 2024 19:31:07 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKlFl4RGqz4D2x; Thu, 11 Jul 2024 19:31:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720726267; 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=XZN4uy5P3tp0ZUmZ7bKwdbVZRwiDXyootvaix713huo=; b=uGnAlyMWdfv3KlLAhHVTgFA5OnSwJiX7cH479Cn3yl5n6SeO/V3IxaTMBXJZaOGaDzkwzy 7aMA7X+M32bqNryJt0wIizLnedfoBOpd/OiLZCrrbCMyxe/YxOIFP9Qb/zJfyCvCdFGrie JxBmME8VcpY6xngmAWjdRFT64Lu9J7Kl24Q4ACOyDTQg549yHAlFA9IhR3WWMFJ8atDP+i Bq7n3/9gFz5J9DRsIprNJlMZL4Fct+NRiz0zdBcxCAQHOV1DPWCQJ/LHplVkG8+LK1GnTB KFFm0yYP9wbTtmcDAoO7C2rpMI+ghM5vMMmFIl8WE+js8Qrq7QSz0OmSsnV63A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720726267; a=rsa-sha256; cv=none; b=tz/ryDlqDSkYHlJsMeDnkyAzybT9VOvrTUfoaDq1by53vGq28S/XTMOyIB6nc8fHGuBuGx cI3eRaABnIx98EuP5e6lEoxGZZvHhK86zl+gLqILSVPV31unTDxFw/L1ZBmPzUNDaVco3B wJzBQ/gdNTiKK81rNtzg2FSxzPGkKWsmsEuk1zpTTiwNzp7ms4OUAujWBKzLrmbAOVdm7k QSyOKnw67GYa6zWtoIx4Bu6tRQO92WZzp6fNzOIoQi3Kso4NuHrH3XoXTZpLrdnVAdsGea w+/6oo48UZokIjev905ovYbWStU/Vy2Nv16DpcTyUxQmqLcbEN2KHa1lb2LqXg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720726267; 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=XZN4uy5P3tp0ZUmZ7bKwdbVZRwiDXyootvaix713huo=; b=A7qZuLPGmseejoodkDHb4VhmwNlvd96PGzY/RMGKx17hftRXIavywD3rADFVVkHD9g2whz U0ODVXXfB8c2K/dph4lRHUQCMB2lbo7nH81ehLikgpuyDXTkGKUIQ+SLjLmJQEBi+SY9pC wg53P5oRL/HDPt/2YsnFMRMCeE719+gd2tOG5BM+g7PVMctvFrRQwqLHmL5sjaAcXfeW23 Yx22dJ81juY4xQI6i1UN6wEOh7JpgehHhAgtkjS9saeG53eP53yUPpaPTHPahzlUFU09Go 5H5PA5VFUV6LWKATuTK6ye9FB6UgKEnPtvEBE83M2GUP9j4Oc24txPbWwNX59A== 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 4WKlFl436Pz1Byf; Thu, 11 Jul 2024 19:31:07 +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 46BJV71m070147; Thu, 11 Jul 2024 19:31:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46BJV7ac070144; Thu, 11 Jul 2024 19:31:07 GMT (envelope-from git) Date: Thu, 11 Jul 2024 19:31:07 GMT Message-Id: <202407111931.46BJV7ac070144@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a161269b2451 - main - buf_ring: Make buf_ring.h amenable to userspace compilation List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a161269b2451140a45de2d0cae0dad84f9e7b439 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a161269b2451140a45de2d0cae0dad84f9e7b439 commit a161269b2451140a45de2d0cae0dad84f9e7b439 Author: Mark Johnston AuthorDate: 2024-07-11 18:55:11 +0000 Commit: Mark Johnston CommitDate: 2024-07-11 18:55:44 +0000 buf_ring: Make buf_ring.h amenable to userspace compilation This will be useful for adding test cases. Reviewed by: andrew MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45869 --- sys/sys/buf_ring.h | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/sys/sys/buf_ring.h b/sys/sys/buf_ring.h index 32c9f5b15f22..cb18175c3a75 100644 --- a/sys/sys/buf_ring.h +++ b/sys/sys/buf_ring.h @@ -30,11 +30,18 @@ #ifndef _SYS_BUF_RING_H_ #define _SYS_BUF_RING_H_ +#include +#include +#include #include #ifdef DEBUG_BUFRING +#ifdef _KERNEL #include #include +#else +#error "DEBUG_BUFRING is only supported in kernel" +#endif #endif struct buf_ring { @@ -361,8 +368,36 @@ buf_ring_count(struct buf_ring *br) & br->br_prod_mask); } +#ifdef _KERNEL struct buf_ring *buf_ring_alloc(int count, struct malloc_type *type, int flags, struct mtx *); void buf_ring_free(struct buf_ring *br, struct malloc_type *type); +#else -#endif +#include + +static inline struct buf_ring * +buf_ring_alloc(int count) +{ + struct buf_ring *br; + + KASSERT(powerof2(count), ("buf ring must be size power of 2")); + + br = calloc(1, sizeof(struct buf_ring) + count * sizeof(void *)); + if (br == NULL) + return (NULL); + br->br_prod_size = br->br_cons_size = count; + br->br_prod_mask = br->br_cons_mask = count - 1; + br->br_prod_head = br->br_cons_head = 0; + br->br_prod_tail = br->br_cons_tail = 0; + return (br); +} + +static inline void +buf_ring_free(struct buf_ring *br) +{ + free(br); +} + +#endif /* !_KERNEL */ +#endif /* _SYS_BUF_RING_H_ */ From nobody Thu Jul 11 19:31:08 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKlFm6CVmz5RHYs; Thu, 11 Jul 2024 19:31: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKlFm5Qv8z4Cxc; Thu, 11 Jul 2024 19:31:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720726268; 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=XPvqtRk/TmOtJUQNJrY3oP57LUb9Xdmq7wpQjIDTKBg=; b=vCqfVS0MMkQQ5gBb2JJb2QwWtPj0+X6m00opPcYgyHAyp8EzdyhFhr+r+RoAJxxtLPfRKD HF3EG4oS9ain8MmONqmTZdO5d5DaloCm114lZQUw854wY1c1TfIh9BlyLGViaPDmKL/iYZ LvhdceTHGJXKFGu5xhf8e14TCVn+hTZdJ2TwTpTNXUPf9siu2VOmq3wXrqjnp/ZMZd7ri/ WiAvvKRVmA1PRuYOmj5XKwXvLKe/ux0h2eM5ycY2f461Tuk8NholXTvIxNX8+UT6uHWZUF oNi1UXvoObrz5ZAqLc0+qyhwR9qno5yB8tQsLgAULaIBPi+OJbgJezQ4fG8kFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720726268; a=rsa-sha256; cv=none; b=MPntAi4H1Bw7+7Bv2XUTmMSYzdhMdzw67oiylROHSbidtdvZVybl985Pt+UQ8d6flQ0+eQ KiJbmjWMQvBeRUbBJNltZxm0Y2y8ByCg67crE1nJsLfAwjCQEHjRFCxYsX0Z2MK0kDi4mo u4wpB8ujjotjvMCDezmPqFdM0cDEpVxZC0DA+/h/fF3xa/iBzWcQ6yoEpik4wNYObT5JwC 1f2fp/+/O3KEwu7JNwWeJuOG6J+/4oiheEfyovujb/qcMzqDVmjcD5pIZhlKWruI7ZPD5u IXAOyPqGY32NGSKWsRMMpX6nMcqq/qcKYYnGU0FInWgXiEgHqSwu7NoAcuvWTA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720726268; 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=XPvqtRk/TmOtJUQNJrY3oP57LUb9Xdmq7wpQjIDTKBg=; b=GVnnsZU7FxVJSO+9v8qKbp2uIooHy9Oxhi+wOBN4+vlqBVyrxTtLm77qDKgT7AMMDy5O0u +opAZMNZC8Vt8WL6BENirOUkWhv4C7T0Btzyh9Au066mo6RdbDUehRXCDHfg7oZ2u2vtbt kdoX39xrZ5C+pwTIdO3gruoQSw16FfCwLKTtLbGtQHny9vJgQGofD6lNQYjWqAswCFTui0 WMjMyEZCWgimlxxz0DuoUGPvm0cPWc6Pb/YFRY8eYFSRI+fLicq/+wZkI/VQTN1gB1k5AF PMS84Gb8RxssSHMeJhzb2xPJcMypcKdnMHihJwLmsfCQUIuw0aUg8txVndz60Q== 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 4WKlFm52W8z1Byg; Thu, 11 Jul 2024 19:31: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 46BJV8dt070195; Thu, 11 Jul 2024 19:31:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46BJV8bw070192; Thu, 11 Jul 2024 19:31:08 GMT (envelope-from git) Date: Thu, 11 Jul 2024 19:31:08 GMT Message-Id: <202407111931.46BJV8bw070192@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: d68d12481778 - main - arm: Add evdev to the TEGRA124 config List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d68d124817780db5f98f65ae02a7ce286cd426eb Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d68d124817780db5f98f65ae02a7ce286cd426eb commit d68d124817780db5f98f65ae02a7ce286cd426eb Author: Mark Johnston AuthorDate: 2024-07-11 19:19:42 +0000 Commit: Mark Johnston CommitDate: 2024-07-11 19:19:42 +0000 arm: Add evdev to the TEGRA124 config This is required for the kernel to link after commit 13d00a43cba4. Fixes: 13d00a43cba4 ("conf: Add usbhid and hidbus to GENERIC* kernel configs") --- sys/arm/conf/TEGRA124 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/arm/conf/TEGRA124 b/sys/arm/conf/TEGRA124 index 6a39abf6cee4..058a85955a04 100644 --- a/sys/arm/conf/TEGRA124 +++ b/sys/arm/conf/TEGRA124 @@ -128,6 +128,11 @@ device drm2 #device sound #device snd_hda +# evdev interface +options EVDEV_SUPPORT # evdev support in legacy drivers +device evdev # input event device support +device uinput # install /dev/uinput cdev + # HID support device hid # Generic HID support device hidbus # Generic HID Bus From nobody Thu Jul 11 19:40:29 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKlSZ0Nd8z5RJFx; Thu, 11 Jul 2024 19:40:30 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKlSY71gLz4F94; Thu, 11 Jul 2024 19:40:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720726830; 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=PpbgDKPuLizS8rBrjY+XjuOg8gInJP/lam7DMP8xlGU=; b=tdezjX2O7NfTd6pqBB77mwWqc4Wx04hRqiUma7NUVYAkCfmpcnZm4/+kWK+vWlZs8TFWuh CyeJ0Q8jaTYeAzGaiJyoO6vdPcbAtQ9OX5LHjvvV9eflvChdxks3fvWu4LNBpLIrzTZYik M6zqQ/LyjsYiCufSKyXFWswK2qCVboGY7ZG3o9fe5ywJ1SFljy9DtlGP7PKA6Z8XtQdjr+ SckKLM+GAldvP8jZHQg6fJ1bRTq9+6MOUowSRUA5mn6UMmf7ApbRPqL7qKBrrDbm3dbbOH F452md0a90LSYE9+BM0jwk5kxhAww47ObnNlhJ3mNFTInPvHhjmpe1s9z3Uu1Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720726830; a=rsa-sha256; cv=none; b=ZC2a5ICd5A9XrdC9W50r9fGSm3gZEAjJUlMXq4SUump8RDubMMhB0zs8W2f9Nz4H49O7Et T0VJYzeJJ+UA5HXVJKG5KCPlPIeZzLlGzFQlXjGeKnWWt8q2sk0SbG/uMGpQe/eGljhPNZ o8IHsPQgqsGEawqJsvYnUtQe4q34v5j3PWh8hF8ndFvXck/RCmOCEq4NcblgYHrMRzjSGy KTQp0kO0JlTwr5nd3tbT9sN2CybJhLQeROMD7FV8MeDcDBKxMBstpWk9Q0MmjoMvOSP7mq 3wDDCWLXjKkCikevOjybcgnORlnACFnURrrqsPZWWBaVaEob3C/HC4uCooNUxA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720726830; 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=PpbgDKPuLizS8rBrjY+XjuOg8gInJP/lam7DMP8xlGU=; b=GJ29XahcIdKY8c427MTqiZ6Z2YYDOMFS+Nvo+gyr5pOptKZBT06QyqEkV5gIY+Bhj7ZBba Z7TzQyzRh45KiDQTfPLjBrvzyQeVGrogAKjJ6TcuFG/S6OBnsB4tToMQGfdp60Cyr7OSJO imsnK8lge0Ur2NqkTlUk67ECiT4fREJwOkT3C50uCiLoPhCB7CpCWYE3taL2YoCI4mRghE ++elw1G3LQxC/WeGtP/gck7OHfpk7ganf9GQR8Zc4zxMbUd5qUpZNjun2EIPoJrW0fH5Cv L4CVUOhZCcphhTC9GwAmAwz/6Nr+OXwwqfMV1cdaBAYi45jK6lwkKLhyL3KlMA== 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 4WKlSY6VRkz1C7b; Thu, 11 Jul 2024 19:40: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 46BJeTCd081072; Thu, 11 Jul 2024 19:40:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46BJeT0u081069; Thu, 11 Jul 2024 19:40:29 GMT (envelope-from git) Date: Thu, 11 Jul 2024 19:40:29 GMT Message-Id: <202407111940.46BJeT0u081069@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 7c2901b08b4e - main - mountd: Add options to disable daemon mode and setting localhost List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7c2901b08b4e68c3fb0587003cf7e46335e24baa Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=7c2901b08b4e68c3fb0587003cf7e46335e24baa commit 7c2901b08b4e68c3fb0587003cf7e46335e24baa Author: Joyu Liao AuthorDate: 2024-07-11 19:38:04 +0000 Commit: Rick Macklem CommitDate: 2024-07-11 19:38:04 +0000 mountd: Add options to disable daemon mode and setting localhost In our products, we need those options to support our features. Add daemon mode option for mountd, nfsd. Add skip local host binding option for rpcd. Add skip local host binding option for mountd. Reviewed by: rmacklem Differential Revision: https://reviews.freebsd.org/D45118 --- usr.sbin/mountd/mountd.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index 14693a922186..00293909614e 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -287,6 +287,8 @@ static int *sock_fd; static int sock_fdcnt; static int sock_fdpos; static int suspend_nfsd = 0; +static int nofork = 0; +static int skiplocalhost = 0; static int opt_flags; static int have_v6 = 1; @@ -436,7 +438,7 @@ main(int argc, char **argv) else close(s); - while ((c = getopt(argc, argv, "2Adeh:lnp:RrS")) != -1) + while ((c = getopt(argc, argv, "2Adeh:lNnp:RrSs")) != -1) switch (c) { case '2': force_v2 = 1; @@ -495,6 +497,12 @@ main(int argc, char **argv) case 'S': suspend_nfsd = 1; break; + case 'N': + nofork = 1; + break; + case 's': + skiplocalhost = 1; + break; default: usage(); } @@ -514,6 +522,9 @@ main(int argc, char **argv) } } + if (nhosts == 0 && skiplocalhost != 0) + warnx("-s without -h, ignored"); + if (modfind("nfsd") < 0) { /* Not present in kernel, try loading it */ if (kldload("nfsd") < 0 || modfind("nfsd") < 0) @@ -535,7 +546,7 @@ main(int argc, char **argv) get_mountlist(); if (debug) warnx("here we go"); - if (debug == 0) { + if (debug == 0 && nofork == 0) { daemon(0, 0); signal(SIGINT, SIG_IGN); signal(SIGQUIT, SIG_IGN); @@ -571,7 +582,7 @@ main(int argc, char **argv) out_of_mem(); hosts[0] = "*"; nhosts = 1; - } else { + } else if (skiplocalhost == 0) { hosts_bak = hosts; if (have_v6) { hosts_bak = realloc(hosts, (nhosts + 2) * @@ -1111,8 +1122,8 @@ static void usage(void) { fprintf(stderr, - "usage: mountd [-2] [-d] [-e] [-l] [-n] [-p ] [-r] " - "[-S] [-h ] [export_file ...]\n"); + "usage: mountd [-2] [-d] [-e] [-l] [-N] [-n] [-p ] [-r] [-S] " + "[-s] [-h ] [export_file ...]\n"); exit(1); } From nobody Thu Jul 11 19:49:02 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKlfQ6rsqz5RJmM; Thu, 11 Jul 2024 19:49:02 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKlfQ6KlSz4G11; Thu, 11 Jul 2024 19:49:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720727342; 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=hwsnRwJ+LuEJYn/7sGVyKKjUeKw+gDUsK8dpCsN+QYw=; b=sAeG7sqGp8ESUXM4BgPIYFtF0Cn6Yt7zhwt/yY5oPQOVU6z76/EzSZ30aA1s4rFpOdQg/q t4mCv8thgmmiFQ0kfIGSzBoIYT83Md3zI19ZVR4YFU+Tgyp3ozjGh4/JYiUbYE1h+XSbAB Mmto8lJs9otwPUCPVunqvnK0tjsGDlUks9ZHjuCB7wwE/XZawsoPmlHd9VO6n3feuwz5lq 8W7oIFBjj8JWIFIGyZ3UGib4AiUmkkIW5E/3XcGKkS6qcY01MyxelLi++WHFjvgaAvqqx0 LSvxuzUKVozgmV7QYnJIwBEUsNr+dOukRGudbBKZRWHYd3UOKyICIfaJderjQA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720727342; a=rsa-sha256; cv=none; b=qztQAQzeSwShcnK/3IXbJVgiPPMmZRRm6KrJ3gzhR2hFmeeUbkyuWrzkNhzcjLR+4rRe0E 0DTvVxw6Ih/Om/Ae/uhc9XqktpjHilTQZeWO/cr3hap+bh4oXwMsokUEfhKnxD3fTmJ2Y3 KsezEecdkENJov8QCzUuoII/Xa79nDWAsZlw6mHu1WkBUvSN0HnfeTQipbnuSHxmqZKWbH ujSrNge4epr6shW39C36ydlb3TDVE9NzO/bK/+vVkUVFFF6dRUAA7gkdqL7GIQ2YcOKjfG 2ia2aUVIrgt7dwgHuBQ3t+nYtHj9RBhULtGo4WHSv6A1FtF55CwbbITP5D6arw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720727342; 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=hwsnRwJ+LuEJYn/7sGVyKKjUeKw+gDUsK8dpCsN+QYw=; b=jWheWy/Vzv5og6+PnKa5R6DLWnB1qx/em9VNgxpYHYOijdJLAuDoOoRdgDfJEyzpqhzl+R VvCYR4JcaIPpGZuYOsuySIRFRvVLadDrXTu2Xdd9QQjfdcDnILrs/rfJ9HFPO+HDczNKQb PxhXsopn50Y8K674lafwd37kf52CY/K2eeMAmla1XJewboU0P9/TOd/2Ddpqf4OGlk/oZj W86LZf6p3eM9AKzlIcRuN7oIWFAfXSkuCdJhpDctQ8BZxH8+OzLvvlIzMkOzujzVQPrufS 2Gm9tivRQLcQR5HerZu1LJrM2GFWUxZN0+F6CTkvUKRRdP9n1SqvMjC2Uzekhg== 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 4WKlfQ5xrHz1CN1; Thu, 11 Jul 2024 19:49: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 46BJn2T9089838; Thu, 11 Jul 2024 19:49:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46BJn2D4089835; Thu, 11 Jul 2024 19:49:02 GMT (envelope-from git) Date: Thu, 11 Jul 2024 19:49:02 GMT Message-Id: <202407111949.46BJn2D4089835@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 8cd71a0e01d6 - main - libfetch: parse IPv4address in IPv6address properly List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8cd71a0e01d60cc4eb0cdef3c62556a516976b77 Auto-Submitted: auto-generated The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=8cd71a0e01d60cc4eb0cdef3c62556a516976b77 commit 8cd71a0e01d60cc4eb0cdef3c62556a516976b77 Author: Ka Ho Ng AuthorDate: 2024-07-11 19:48:28 +0000 Commit: Ka Ho Ng CommitDate: 2024-07-11 19:48:28 +0000 libfetch: parse IPv4address in IPv6address properly This fix parsing problems of IPv6 addresses which contains IPv4 addresses. One example is ::192.168.0.1. Documents are in below: https://datatracker.ietf.org/doc/html/rfc2373#page-22 Sponsored by: Juniper Networks, Inc. MFC after: 1 week Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D45896 --- lib/libfetch/fetch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libfetch/fetch.c b/lib/libfetch/fetch.c index df97bf486f9b..12cbd0fb746f 100644 --- a/lib/libfetch/fetch.c +++ b/lib/libfetch/fetch.c @@ -399,7 +399,7 @@ fetchParseURL(const char *URL) /* hostname */ if (*p == '[') { - q = p + 1 + strspn(p + 1, ":0123456789ABCDEFabcdef"); + q = p + 1 + strspn(p + 1, ":0123456789ABCDEFabcdef."); if (*q++ != ']') goto ouch; } else { From nobody Thu Jul 11 19:52:16 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKlk84Ytqz5RKMb; Thu, 11 Jul 2024 19:52: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKlk8448jz4Gnq; Thu, 11 Jul 2024 19:52:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720727536; 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=PbXJYapb1tQbpkrttpfkN+f6HXwn/7VnCdQl/G8I7C0=; b=khQ5ZUnyAATmqGrPONNKyTpk6XZfmIC/6hCYUHLpiwslg5KGMb+V4efQhjQewUWTTcIDQL 6exppb6vm20Dh8ppl3NRQPAzwyvHr8ch4sBV47x0SCQrUN/NPVoQ4sif/cv/bntPQ93LHg kdfGR1sGN7V5N5pN1/+ZzlIphM2+vKzTvgmm5ilk2aNBJQeQnrQCFKRlbwv4bnj4vRQsPb 6aR/nvmPMRM480jEXzjb9qMZldjtL1eJEC+P9Jk7HEPRRfiKrRC+JEs7qp8PS2jbWg5td1 fbW/ubQFszDHSjGQvworrFicrGt2HFsu147lp/P4BI1njM/uT/xIfdu6jCZZYQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720727536; a=rsa-sha256; cv=none; b=iFq8ZgwV5lGwsDG53/i4g21vwTPb2OTKe017iYKOW3zNFYf2LLhJph4xTM0q29m9YDRVXg R202YBONgLogFT3/pQt/XVAR+oQSADg7MqhrzEtyST2zL7KLuSt1RwLzeyUjdfXdwL7n2j iki5gTzK8y6pJER1DOwWvR+PYtj90b/SmsrUXfkkek3ScRay07qgi8y7CzkZaIc1+FkeGW 0GOVFG72ig6vtc1t5HaAchmd0OTP9zst2mTiNwwyug5BPLEHcMKH5bAf0xlZ/7d7UGFfLE RQPEp6vG6p+cPrwQMtu/1e8+J63g4TbzPa0qp1dT9iZPB0o7bzZnNGB9/CPPRw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720727536; 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=PbXJYapb1tQbpkrttpfkN+f6HXwn/7VnCdQl/G8I7C0=; b=V+2OXv5Jd/MyPZYbakfPVGjU4uily/kLBXDQeFoPdf/qWHRAxi29u5dh/VeZXCztpcP5Vx aNECCZ7r9n+dBlapY8h8AdminaqbSOxJMsc/oZj9Kbv9Uj9x0YKoOUL+4r/6aC52Iqy22U q99LL7uoGmTsTqzH0wFrz4Y4AcBjhl4KvOzrgH+RvyAVE/gTs1676pEBUfD9tuklmUjgBT D5c+VErJjOiOIo54mtJ/moYcSxUDsv0lTbD0NbL6NeewymwFeIOjz/41iGx/rE2Ei64Z6A F5cUlTmRUQjEpL2cVX0ZEU/ythq3vYXqc4/KRSx1gzeETZP0WBF7vkMRCDj/Vw== 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 4WKlk83fSkzDkb; Thu, 11 Jul 2024 19:52: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 46BJqGNM005853; Thu, 11 Jul 2024 19:52:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46BJqGEt005850; Thu, 11 Jul 2024 19:52:16 GMT (envelope-from git) Date: Thu, 11 Jul 2024 19:52:16 GMT Message-Id: <202407111952.46BJqGEt005850@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 2e5c9eaf5728 - main - mountd.8: Update the man page for -N and -s List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2e5c9eaf5728dd96ce456f6fab18c50c0dfb5f5c Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=2e5c9eaf5728dd96ce456f6fab18c50c0dfb5f5c commit 2e5c9eaf5728dd96ce456f6fab18c50c0dfb5f5c Author: Joyu Liao AuthorDate: 2024-07-11 19:48:31 +0000 Commit: Rick Macklem CommitDate: 2024-07-11 19:50:46 +0000 mountd.8: Update the man page for -N and -s Commit 7c2901b08b4e added new command line options "-N" and "-s". This patch updates the man page for this. This is a content change. Reviewed by: Alexander Ziaee (manpages) Differential Revision: https://reviews.freebsd.org/D45118 --- usr.sbin/mountd/mountd.8 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/usr.sbin/mountd/mountd.8 b/usr.sbin/mountd/mountd.8 index 6528aa3c94a1..5c5717063f15 100644 --- a/usr.sbin/mountd/mountd.8 +++ b/usr.sbin/mountd/mountd.8 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 8, 2024 +.Dd July 5, 2024 .Dt MOUNTD 8 .Os .Sh NAME @@ -35,7 +35,7 @@ mount requests .Sh SYNOPSIS .Nm -.Op Fl 2AdelnRrS +.Op Fl 2AdelNnRrSs .Op Fl h Ar bindip .Op Fl p Ar port .Op Ar exportsfile ... @@ -98,6 +98,10 @@ to the list. Cause all succeeded .Nm requests to be logged. +.It Fl N +Cause +.Nm +to execute in the foreground instead of in daemon mode. .It Fl n Allow non-root mount requests to be served. This should only be specified if there are clients such as PC's, @@ -158,6 +162,13 @@ crashes while an exports load is in progress, .Nm must be restarted to get the nfsd threads running again, if this option is used. +.It Fl s +Cause +.Nm +to skip automatic binding to localhost for IPv4 and IPv6. +This option is meaningless unless +.Fl h +has also been used. .El .Pp When From nobody Thu Jul 11 20:05:19 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKm1D0Sk1z5RLHn; Thu, 11 Jul 2024 20:05: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKm1C6v3Qz4HSd; Thu, 11 Jul 2024 20:05:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720728320; 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=Cr4HPpUJOhDnomRT31CGemhimwTXkGHRvdGiqCI5ILI=; b=m82U7t15kY6mUio2AApgSkrnjqaNM6KNHV23dBD8NBCENiF+8Z/aadDekQc2xiKkMpf7wE sl4t14PgYIF34+qGXbnwzZnzTpHPxCda+bc1Ms0i65UaqfXdjGPKcB2Rcv1HnmPLt3a4AM lekqwSOQnwIfPU4rgbaHRcdJ3geqBtJ59oTK/6VYj1x0guFHiJANC/p/BrZUG3y3sBqTGe W7WLV7ZAZppQWFHNecjpUpZFUaGDCwAshRHUv3x4buz/sWsnactKV6vTzCIjh11zA1EIPc O0oM5wzV/A+HixrL+B/kzJDeWzAJ6ncn7nAucHw000W4JFalVWNu4O5W2K3ovw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720728320; a=rsa-sha256; cv=none; b=oa2ZadgVkZ3dFZTwGKkeLvMcZoWshDTtPSthN5Z1AeNP05ksjZJFf9AheFWjjOYV0hoZsT ngXR5016ctRVHrzpjDDn9Fk9bQmi32isdUaq/51I600XzA4Sf3P08TrMnkOGA9ZtlUfovD H9n+svjdKpVVm+pwnaWPAvlyq6Iii7pKVy7JGM8pHUEQVi7IGTfE8JOLwEyUkHIJeNzDkR lUqAUqXY9gTunKCSn9DK4VW24GbaqUTnJa5dj9XtsX1r3TWX1jtJHAdfizCaQCak1iFIEF TFkMLwTURn1ZXxvFBMxztKfyAvPBQZzHgkreF2CMiQSl6wzIVRuB9F83rcLyLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720728320; 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=Cr4HPpUJOhDnomRT31CGemhimwTXkGHRvdGiqCI5ILI=; b=X2AUpvuQSXjTEz0+tl/9giLM+R7O95rogJoHcJQklJ4/nyTe+cd5cN9/sjwNf+i47BWXH0 N4kY5Wsfkf1EnUpY+Yu61UhLoYnLVOfU9dRe6kVfosPwcfpaXTN/d8j9WViN0ehwkmVkUi f1FqITR6o6FW5EVITXz21H/8f5UwIYvfsB5ZQ7PAMASglX2MTj4YjQqSglyEiKDhYsa0V/ 7mnBJo69RdxXhDPdc9E3q0xnrmAPel2dEpo7tdLMEmASPPYe+hdQ4Hn1boICDaRNiHxAIw 8IWrygpyzEqOpb/8/QwT/DEvSxBAkCFtZVreXejtGBAQHWB/joWr5GZIqovc/A== 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 4WKm1C6PFszF4p; Thu, 11 Jul 2024 20:05: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 46BK5JGq023782; Thu, 11 Jul 2024 20:05:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46BK5JA7023779; Thu, 11 Jul 2024 20:05:19 GMT (envelope-from git) Date: Thu, 11 Jul 2024 20:05:19 GMT Message-Id: <202407112005.46BK5JA7023779@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: bae19029ad2a - main - rpcbind.8: Fix missing option entry in commit df3f247e4696 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bae19029ad2a187f6daca727ba5343f319048917 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=bae19029ad2a187f6daca727ba5343f319048917 commit bae19029ad2a187f6daca727ba5343f319048917 Author: Rick Macklem AuthorDate: 2024-07-11 20:03:42 +0000 Commit: Rick Macklem CommitDate: 2024-07-11 20:03:42 +0000 rpcbind.8: Fix missing option entry in commit df3f247e4696 Commit df3f247e4696 added descriptions for the new command line option "-I". However, it failed to update the .Op line. This is a content change. Reviewed by: Alexander Ziaee (manpages) Differential Revision: https://reviews.freebsd.org/D45118 --- usr.sbin/rpcbind/rpcbind.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/rpcbind/rpcbind.8 b/usr.sbin/rpcbind/rpcbind.8 index 1dd145f945f4..36c7a8da9984 100644 --- a/usr.sbin/rpcbind/rpcbind.8 +++ b/usr.sbin/rpcbind/rpcbind.8 @@ -1,6 +1,6 @@ .\" Copyright 1989 AT&T .\" Copyright 1991 Sun Microsystems, Inc. -.Dd July 5, 2024 +.Dd July 11, 2024 .Dt RPCBIND 8 .Os .Sh NAME @@ -8,7 +8,7 @@ .Nd universal addresses to RPC program number mapper .Sh SYNOPSIS .Nm -.Op Fl 6adiLlNswW +.Op Fl 6adIiLlNswW .Op Fl h Ar bindip .Sh DESCRIPTION The From nobody Thu Jul 11 21:20:44 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKnhJ2KsCz5Pymb; Thu, 11 Jul 2024 21:20:48 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKnhJ0HZYz4NW0; Thu, 11 Jul 2024 21:20:48 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Authentication-Results: mx1.freebsd.org; none Received: from shw-obgw-4003a.ext.cloudfilter.net ([10.228.9.183]) by cmsmtp with ESMTPS id RydoskQ69MArNS1Dbs3mfA; Thu, 11 Jul 2024 21:20:47 +0000 Received: from spqr.komquats.com ([70.66.152.170]) by cmsmtp with ESMTPSA id S1DZsMUInE0IVS1DasJLrc; Thu, 11 Jul 2024 21:20:47 +0000 X-Auth-User: cschuber X-Authority-Analysis: v=2.4 cv=cI9DsUeN c=1 sm=1 tr=0 ts=66904caf a=y8EK/9tc/U6QY+pUhnbtgQ==:117 a=y8EK/9tc/U6QY+pUhnbtgQ==:17 a=kj9zAlcOel0A:10 a=4kmOji7k6h8A:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=BwQyTw09W3WSPYQTmx8A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTP id A1CBD3EB; Thu, 11 Jul 2024 14:20:44 -0700 (PDT) Received: by slippy.cwsent.com (Postfix, from userid 1000) id 830AB10D; Thu, 11 Jul 2024 14:20:44 -0700 (PDT) X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.8+dev Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Emmanuel Vadot cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: b93028d8cd3a - main - vt: Add vd_bitblt_argb In-reply-to: <202407110650.46B6oexO073342@gitrepo.freebsd.org> References: <202407110650.46B6oexO073342@gitrepo.freebsd.org> Comments: In-reply-to Emmanuel Vadot message dated "Thu, 11 Jul 2024 06:50:40 +0000." List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 11 Jul 2024 14:20:44 -0700 Message-Id: <20240711212044.830AB10D@slippy.cwsent.com> X-CMAE-Envelope: MS4xfOnv037amWmvsFPkl7VE1QVPXx7IW5cQo1ZoL6pX5X4mXYP/GorWMBVr0ZHxwD+eBCYf0QNY9HgZ6p4JK4YhwIrl4tO+awtk90ALcwvP+6UVBLyoEXun mldq9DEUcEZO74hsVSYM9YQAEI3EwuoemVbLhdgb7GG4pYtc4EOSoGCsQ+7PeHP6+cTsRN+cg85I4q1ZZISR7SwgerfbencNTsjJ6lexn3q8Ic2DYJh9qUHn 7wDXvmEz8XiOR8btiiQxbU1OmRQG+S33Tq0AIKrbEFFlzy5AfRLCJcxwDhhYvGxLKGo3/rNIHIYhsgmXT3UuMVDWUNnnfIxxuwKb5+4eglU= X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US] X-Rspamd-Queue-Id: 4WKnhJ0HZYz4NW0 In message <202407110650.46B6oexO073342@gitrepo.freebsd.org>, Emmanuel Vadot wr ites: > The branch main has been updated by manu: > > URL: https://cgit.FreeBSD.org/src/commit/?id=b93028d8cd3aafc883b5f0ecec65a8a2 > a30af7f3 > > commit b93028d8cd3aafc883b5f0ecec65a8a2a30af7f3 > Author: Emmanuel Vadot > AuthorDate: 2024-07-09 12:35:12 +0000 > Commit: Emmanuel Vadot > CommitDate: 2024-07-11 06:47:17 +0000 > > vt: Add vd_bitblt_argb > > This blit an ARGB image on the dedicated vd. > This also adds vt_fb_bitblt_argb which will works for most of the vt back > ends > > Differential Revision: https://reviews.freebsd.org/D45929 > Reviewed by: tsoome > Sponsored by: Beckhoff Automation GmbH & Co. KG > --- > sys/dev/virtio/gpu/virtio_gpu.c | 12 ++++++++++ > sys/dev/vt/hw/efifb/efifb.c | 1 + > sys/dev/vt/hw/fb/vt_early_fb.c | 1 + > sys/dev/vt/hw/fb/vt_fb.c | 47 +++++++++++++++++++++++++++++++++++++ > ++ > sys/dev/vt/hw/fb/vt_fb.h | 1 + > sys/dev/vt/hw/ofwfb/ofwfb.c | 12 ++++++++++ > sys/dev/vt/hw/simplefb/simplefb.c | 12 ++++++++++ > sys/dev/vt/hw/vbefb/vbefb.c | 1 + > sys/dev/vt/hw/vga/vt_vga.c | 12 ++++++++++ > sys/dev/vt/vt.h | 5 +++++ > 10 files changed, 104 insertions(+) > Following this commit [though it could be one of the subsequent vt(4) commits] I can no longer ctrl-alt-f1 from ttyv8 to ttyv0, or any other text tty on the console, with the following displayed in dmesg: Timeout initializing vt_vga Timeout initializing vt_vga ctrl-alt-f9 restores the graphical screen (X). But the text virtual consoles are no longer available. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org e^(i*pi)+1=0 From nobody Thu Jul 11 21:55:07 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKpRz4Hzrz5Q335; Thu, 11 Jul 2024 21:55:11 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKpRz0PJBz4RHT; Thu, 11 Jul 2024 21:55:11 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=quarantine) header.from=cschubert.com; spf=pass (mx1.freebsd.org: domain of cy.schubert@cschubert.com designates 3.97.99.33 as permitted sender) smtp.mailfrom=cy.schubert@cschubert.com Received: from shw-obgw-4001a.ext.cloudfilter.net ([10.228.9.142]) by cmsmtp with ESMTPS id S065skWLDMArNS1kss3sA8; Thu, 11 Jul 2024 21:55:10 +0000 Received: from spqr.komquats.com ([70.66.152.170]) by cmsmtp with ESMTPSA id S1kqsDg3oGvSVS1krsnL9D; Thu, 11 Jul 2024 21:55:10 +0000 X-Auth-User: cschuber X-Authority-Analysis: v=2.4 cv=FpSm/Hrq c=1 sm=1 tr=0 ts=669054be a=y8EK/9tc/U6QY+pUhnbtgQ==:117 a=y8EK/9tc/U6QY+pUhnbtgQ==:17 a=kj9zAlcOel0A:10 a=4kmOji7k6h8A:10 a=VxmjJ2MpAAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=YQB-KFQYTfwNR1vTm94A:9 a=CjuIK1q_8ugA:10 a=2xPSKAbegD4A:10 a=7gXAzLPJhVmCkEl4_tsf:22 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTP id 1271345F; Thu, 11 Jul 2024 14:55:08 -0700 (PDT) Received: by slippy.cwsent.com (Postfix, from userid 1000) id C98E52B; Thu, 11 Jul 2024 14:55:07 -0700 (PDT) X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.8+dev Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Emmanuel Vadot cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: b93028d8cd3a - main - vt: Add vd_bitblt_argb In-reply-to: <20240711212044.830AB10D@slippy.cwsent.com> References: <202407110650.46B6oexO073342@gitrepo.freebsd.org> <20240711212044.830AB10D@slippy.cwsent.com> Comments: In-reply-to Cy Schubert message dated "Thu, 11 Jul 2024 14:20:44 -0700." List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 11 Jul 2024 14:55:07 -0700 Message-Id: <20240711215507.C98E52B@slippy.cwsent.com> X-CMAE-Envelope: MS4xfFig2hs6t6i5ROCjL7EF3l0Jfy1JEPIXrX0i4PhN4Ax7CVQWqh/OlQM6Qjbyk0PIHQmvz6H4LUTcEwFLEw6mfgIeO6uSiWXvVnNyINdutwDfSBXzJf4E I+iddu/jYGhJTtd04mJgfIdrjsRDFi5o9Q0M32ZslenYAv7RkTWL1kvMTNfgV80kCvPB3R8rhNPhBAIP3BZ7qVxLnHJec7y/mqKgswJ8GE9WgRQEiYG2P27J I30tQI5p7khte9gB1S04OClZvZWP4N/SkTzXw6yn6lnmX3nBmVkePBNx2vKcWoSb0hCopRJgdLiPt4fVK3PezrPueeXBrY5hWn6ZJoPQeXo= X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.60 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.997]; DMARC_POLICY_ALLOW(-0.50)[cschubert.com,quarantine]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:3.97.99.32/31]; RWL_MAILSPIKE_VERYGOOD(-0.20)[3.97.99.33:from]; RCVD_IN_DNSWL_LOW(-0.10)[3.97.99.33:from]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; REPLYTO_EQ_FROM(0.00)[]; R_DKIM_NA(0.00)[]; MLMMJ_DEST(0.00)[dev-commits-src-main@freebsd.org,dev-commits-src-all@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_THREE(0.00)[4] X-Rspamd-Queue-Id: 4WKpRz0PJBz4RHT In message <20240711212044.830AB10D@slippy.cwsent.com>, Cy Schubert writes: > In message <202407110650.46B6oexO073342@gitrepo.freebsd.org>, Emmanuel > Vadot wr > ites: > > The branch main has been updated by manu: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=b93028d8cd3aafc883b5f0ecec65a8 > a2 > > a30af7f3 > > > > commit b93028d8cd3aafc883b5f0ecec65a8a2a30af7f3 > > Author: Emmanuel Vadot > > AuthorDate: 2024-07-09 12:35:12 +0000 > > Commit: Emmanuel Vadot > > CommitDate: 2024-07-11 06:47:17 +0000 > > > > vt: Add vd_bitblt_argb > > > > This blit an ARGB image on the dedicated vd. > > This also adds vt_fb_bitblt_argb which will works for most of the vt ba > ck > > ends > > > > Differential Revision: https://reviews.freebsd.org/D45929 > > Reviewed by: tsoome > > Sponsored by: Beckhoff Automation GmbH & Co. KG > > --- > > sys/dev/virtio/gpu/virtio_gpu.c | 12 ++++++++++ > > sys/dev/vt/hw/efifb/efifb.c | 1 + > > sys/dev/vt/hw/fb/vt_early_fb.c | 1 + > > sys/dev/vt/hw/fb/vt_fb.c | 47 +++++++++++++++++++++++++++++++++++ > ++ > > ++ > > sys/dev/vt/hw/fb/vt_fb.h | 1 + > > sys/dev/vt/hw/ofwfb/ofwfb.c | 12 ++++++++++ > > sys/dev/vt/hw/simplefb/simplefb.c | 12 ++++++++++ > > sys/dev/vt/hw/vbefb/vbefb.c | 1 + > > sys/dev/vt/hw/vga/vt_vga.c | 12 ++++++++++ > > sys/dev/vt/vt.h | 5 +++++ > > 10 files changed, 104 insertions(+) > > > > Following this commit [though it could be one of the subsequent vt(4) > commits] I can no longer ctrl-alt-f1 from ttyv8 to ttyv0, or any other text > tty on the console, with the following displayed in dmesg: > > Timeout initializing vt_vga > Timeout initializing vt_vga > > ctrl-alt-f9 restores the graphical screen (X). But the text virtual > consoles are no longer available. I missed copying one message from the message buffer. The messages are: Timeout initializing vt_vga Timeout initializing vt_vga drmn0: [drm] User-defined mode not supported: "640x480": 60 23875 640 656 720 800 480 481 484 497 0x20 0x6 -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org e^(i*pi)+1=0 From nobody Thu Jul 11 22:24:34 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKq5y0STBz5Q60b; Thu, 11 Jul 2024 22:24:38 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKq5x1fLsz4TWG; Thu, 11 Jul 2024 22:24:37 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=quarantine) header.from=cschubert.com; spf=pass (mx1.freebsd.org: domain of cy.schubert@cschubert.com designates 3.97.99.33 as permitted sender) smtp.mailfrom=cy.schubert@cschubert.com Received: from shw-obgw-4003a.ext.cloudfilter.net ([10.228.9.183]) by cmsmtp with ESMTPS id Rw28skEINMArNS2DMs3xRQ; Thu, 11 Jul 2024 22:24:36 +0000 Received: from spqr.komquats.com ([70.66.152.170]) by cmsmtp with ESMTPSA id S2DKsMhsKE0IVS2DLsJSlD; Thu, 11 Jul 2024 22:24:36 +0000 X-Auth-User: cschuber X-Authority-Analysis: v=2.4 cv=cI9DsUeN c=1 sm=1 tr=0 ts=66905ba4 a=y8EK/9tc/U6QY+pUhnbtgQ==:117 a=y8EK/9tc/U6QY+pUhnbtgQ==:17 a=kj9zAlcOel0A:10 a=4kmOji7k6h8A:10 a=VxmjJ2MpAAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=c120_vcvEumi9XewW2kA:9 a=CjuIK1q_8ugA:10 a=FnQnUahv8mkA:10 a=2xPSKAbegD4A:10 a=7gXAzLPJhVmCkEl4_tsf:22 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTP id 653AE68; Thu, 11 Jul 2024 15:24:34 -0700 (PDT) Received: by slippy.cwsent.com (Postfix, from userid 1000) id 34356189; Thu, 11 Jul 2024 15:24:34 -0700 (PDT) X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.8+dev Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Emmanuel Vadot cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: b93028d8cd3a - main - vt: Add vd_bitblt_argb In-reply-to: <20240711215507.C98E52B@slippy.cwsent.com> References: <202407110650.46B6oexO073342@gitrepo.freebsd.org> <20240711212044.830AB10D@slippy.cwsent.com> <20240711215507.C98E52B@slippy.cwsent.com> Comments: In-reply-to Cy Schubert message dated "Thu, 11 Jul 2024 14:55:07 -0700." List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 11 Jul 2024 15:24:34 -0700 Message-Id: <20240711222434.34356189@slippy.cwsent.com> X-CMAE-Envelope: MS4xfIm2zElS+XDdn3FAzAxzHjGLvavrHIcgslggmSnXo8Im9eUXDqozO8Cbn2K6SVvlWw+qQ/2Pnl/L++07T0IYgQffv76AeVr36ComhFoHKcJqn9mIkAs4 MexRN/GcMTeJXORB+PiRCHUvccFiAfkLi9944nJG+Pn540mOshJdpYhgbp3sX4e7mk27Xj3W/49It52V1cpRUv2KayEzNNIWsEsSlF34DbKlV+dKB8vyrPNG BcV4fY/DE+grcLnSIHKB6l6LkwR0HYIzxYr8AsrOhkH2SIUQOKcHE/E+ygSnhEf4WW2+1W3jtkMA/j+VncUSrLYDqioRal7xy3jtG0UdKiA= X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.60 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.996]; DMARC_POLICY_ALLOW(-0.50)[cschubert.com,quarantine]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:3.97.99.32/31:c]; RWL_MAILSPIKE_VERYGOOD(-0.20)[3.97.99.33:from]; MIME_GOOD(-0.10)[text/plain]; RCVD_IN_DNSWL_LOW(-0.10)[3.97.99.33:from]; ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; MLMMJ_DEST(0.00)[dev-commits-src-main@freebsd.org,dev-commits-src-all@freebsd.org]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; REPLYTO_EQ_FROM(0.00)[] X-Rspamd-Queue-Id: 4WKq5x1fLsz4TWG In message <20240711215507.C98E52B@slippy.cwsent.com>, Cy Schubert writes: > In message <20240711212044.830AB10D@slippy.cwsent.com>, Cy Schubert writes: > > In message <202407110650.46B6oexO073342@gitrepo.freebsd.org>, Emmanuel > > Vadot wr > > ites: > > > The branch main has been updated by manu: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=b93028d8cd3aafc883b5f0ecec65 > a8 > > a2 > > > a30af7f3 > > > > > > commit b93028d8cd3aafc883b5f0ecec65a8a2a30af7f3 > > > Author: Emmanuel Vadot > > > AuthorDate: 2024-07-09 12:35:12 +0000 > > > Commit: Emmanuel Vadot > > > CommitDate: 2024-07-11 06:47:17 +0000 > > > > > > vt: Add vd_bitblt_argb > > > > > > This blit an ARGB image on the dedicated vd. > > > This also adds vt_fb_bitblt_argb which will works for most of the vt > ba > > ck > > > ends > > > > > > Differential Revision: https://reviews.freebsd.org/D45929 > > > Reviewed by: tsoome > > > Sponsored by: Beckhoff Automation GmbH & Co. KG > > > --- > > > sys/dev/virtio/gpu/virtio_gpu.c | 12 ++++++++++ > > > sys/dev/vt/hw/efifb/efifb.c | 1 + > > > sys/dev/vt/hw/fb/vt_early_fb.c | 1 + > > > sys/dev/vt/hw/fb/vt_fb.c | 47 +++++++++++++++++++++++++++++++++ > ++ > > ++ > > > ++ > > > sys/dev/vt/hw/fb/vt_fb.h | 1 + > > > sys/dev/vt/hw/ofwfb/ofwfb.c | 12 ++++++++++ > > > sys/dev/vt/hw/simplefb/simplefb.c | 12 ++++++++++ > > > sys/dev/vt/hw/vbefb/vbefb.c | 1 + > > > sys/dev/vt/hw/vga/vt_vga.c | 12 ++++++++++ > > > sys/dev/vt/vt.h | 5 +++++ > > > 10 files changed, 104 insertions(+) > > > > > > > Following this commit [though it could be one of the subsequent vt(4) > > commits] I can no longer ctrl-alt-f1 from ttyv8 to ttyv0, or any other text > > > tty on the console, with the following displayed in dmesg: > > > > Timeout initializing vt_vga > > Timeout initializing vt_vga > > > > ctrl-alt-f9 restores the graphical screen (X). But the text virtual > > consoles are no longer available. > > I missed copying one message from the message buffer. The messages are: > > Timeout initializing vt_vga > Timeout initializing vt_vga > drmn0: [drm] User-defined mode not supported: "640x480": 60 23875 640 656 > 720 800 480 481 484 497 0x20 0x6 Rebuilding and reinstalling drm-61-kmod resolved the problem. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org e^(i*pi)+1=0 From nobody Fri Jul 12 11:24:51 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QC6PLSz5QBbp; Fri, 12 Jul 2024 11:24: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QC4k6zz4hq7; Fri, 12 Jul 2024 11:24:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783491; 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=vD/ZvOWjAcX1O1aZd3G/UI55rtIqs5C+IcmMGhifC/4=; b=VBVOii6Vzct+Ifym5l4baE1Q0XIM5zlBKwOgnQ8SN/1op9mWX//lJ+Ob901qGL460hHW+j M33x8Tuzi7z2C3SNs0C7lC6xRaQTAUbV/jaiqmj5AUFwvpWnlBSoWVwqfX4dhc3AcQ0R3X VN3q3T7cBK7b6vDhmLodO7/gipTztCK7cXxVB3uHp9ZRXg2QUarWSdpiwIH2qtPZK2YTkP sT4UxyvsR1G/ASElD7Zj0jrJ2XsHXFEvNIqnnWpWcCRplugJikkp9tchmwyCWMf5VjsKZj +R2jrzRXeP9Zyjq2wQfOE4hppv3rGmY98P/TIT/V/Rk9rpCzx/mkIkw5MPOtuA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783491; a=rsa-sha256; cv=none; b=bP2ujUYqxpAbfPTNqqgaNYFnoGnrmJHFKJJD4ILv7iwQgD6g8wVqjiepaWcwyj4AyfvqHs Be0JpQtF1P9QMmpFiAjQ+lnPjK6mtLJjD3E/aivngSkm2uk2pSoTHmTFKCVuYxk8jtU8Gd WSnT7PgBZ6oLt7wrmx3vPS4rYO7t1LT2b9rbHM3HzjlrTd+f3ZesxP5V2uAifUE6bWplWY WL8ePnUrVwKfhAh6XRDmkFMS8qYrVI96pjd/PhMbxqDrp2L0rFIFpRH59hCNvBmlX1n6Kn ADjcIX3QLIe9+dpTyxYOnvDG3Ap8d4acZ5QmviVmKdpyZoXqJjvmxmTKLEYvfA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783491; 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=vD/ZvOWjAcX1O1aZd3G/UI55rtIqs5C+IcmMGhifC/4=; b=p7G8+dHS46TVe4TCdXDGKEkeZvrJBQtuoNMrcfYXbu/rePxb4jHeNr8i3vi7M1hUNOhVcH BZfvmnHQ9lvQYbb5X4cc8eeqtd0KYC1d/VfaUyj8o0m4KIq+IKcyywPysBPIDQSxGoCMIC 0Tya7hKo6QiO8dXtBhwsM0WSYibYWIvUG3rB32Q/dISFX/4TfJvgGLSoBi1ItJ6SyfcPTY jTjBMWvhbazDnF5pkw5geC5xl14sWMgNd4sRbtdb/eUzdn9bu2dv1yf8ysUta1IdfH5btk 3xWP2NDU1KKQ+C3yQigd3UdsFI4ycckvMByQb4RrO+z/cLgalzgeboy4q8DpAg== 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 4WL8QC4KqXzhSX; Fri, 12 Jul 2024 11:24: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 46CBOpJc092359; Fri, 12 Jul 2024 11:24:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBOpYj092356; Fri, 12 Jul 2024 11:24:51 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:24:51 GMT Message-Id: <202407121124.46CBOpYj092356@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 7539b04ed7a4 - main - ipsec_newpolicies(): do not call key_freesp() with NULL value List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 7539b04ed7a462afde4d3aaae7f6ba234a868158 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7539b04ed7a462afde4d3aaae7f6ba234a868158 commit 7539b04ed7a462afde4d3aaae7f6ba234a868158 Author: Konstantin Belousov AuthorDate: 2021-08-22 19:19:06 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 03:29:30 +0000 ipsec_newpolicies(): do not call key_freesp() with NULL value Sponsored by: NVIDIA networking MFC after: 1 week --- sys/net/if_ipsec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/net/if_ipsec.c b/sys/net/if_ipsec.c index 5f43225bfaed..b503d0696691 100644 --- a/sys/net/if_ipsec.c +++ b/sys/net/if_ipsec.c @@ -901,8 +901,10 @@ ipsec_newpolicies(struct ipsec_softc *sc, struct secpolicy *sp[IPSEC_SPCOUNT], } return (0); fail: - for (i = 0; i < IPSEC_SPCOUNT; i++) - key_freesp(&sp[i]); + for (i = 0; i < IPSEC_SPCOUNT; i++) { + if (sp[i] != NULL) + key_freesp(&sp[i]); + } return (ENOMEM); } From nobody Fri Jul 12 11:24:52 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QD6lJVz5QBfM; Fri, 12 Jul 2024 11:24: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QD60flz4hc0; Fri, 12 Jul 2024 11:24:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783492; 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=NJOoq//mm0eKMv/IPkn2aMVzP5XtOu+PExLyvuriuj8=; b=j4hr1fw/p/wrxafbE9Z1uwpxXsnvjYEJ7MH5XHyjGHpfkdWpzkvukJKsxdOxkC713rQWcn HjCrdjvCgUN+dwq2708GgBOc9/69nS70MQ53pedeH/qa3m3JcAdH9yhZfJG7sNo05+Iuim hNBDvYbj5Lp6loCx9wdQTci6bePdN6C7V+WwypU1lpA9ySD9Swgwww/yeqlMlNHR4pBj5U NDG16cxRMcw+GqfDaD/wjUa33d+Cs+Fm7N+BCJZ6TkV/l9xki6HGpiF7XZ0nE0BfJwXBWj 5DfeS8G8to8I+YZesUSrmBH8urctX29NSKJi5atOYXYV1534NFR12JyK5OWpJQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783492; a=rsa-sha256; cv=none; b=q61gOx31Do9qvOD7XVAhjN1XGSskQ4sidgk8HPI+CQL3dDMhvgHtXgQC6d9u3VzRHvhrQ9 QfrLcTdd/CmSrRhXihUHvNFuGcEMCFhukhHSTJFIJzm14krRhHRzZO83ViEPZfpB9BVxog yHwPReSjJU8V+gmu3MmK9gRBlxv52PB8dYC1ecFZqROjmUzrwoIiDslpdQgWbvrNNy7UJU 8KY1NipfouzqGVY+BBuqMU2yrRrYIClM1DSZ6lMTUL2B964xZgd53y1XM9lbfYKRiNjeY5 32hZV3xy1MiuUiXglrHCLIJzccPr2RFlTIRlGNZE3yZJg8Oz/5nXK4+oi68TEw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783492; 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=NJOoq//mm0eKMv/IPkn2aMVzP5XtOu+PExLyvuriuj8=; b=sb7Hy0YpS6V1P6LnfZAnPc9b4Rgn++SaarY6ugwsPwIlAkzJ7/9ywYF58Bd2i6Os+kAWYG Zw6UZadXUBDQpP4w4Fj1QKVtFqcJZvwLokWS0eiUNBqT07TGs1kTrxlZMY+D20QO+OGCBc nBYEQkZ3yZOJvu0vf9ywlf0HbhgHBYN2qRk8ItkPdOzmvxAOyLwRcu8whJanWaSD13aJwo vfuOXz/E39jmZZq6lQAeKIPwPlGJ2DvuILHmLfji973/PAl1z4d0rK1hBWfUpvCn6NPaLN GYXlOtDyx7c0E3mw0ixXO6KK7Y6BF9KjDDEsUZX/mtovEIna1gBnQCiNlp2haw== 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 4WL8QD5bnTzhgf; Fri, 12 Jul 2024 11:24: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 46CBOqRw092400; Fri, 12 Jul 2024 11:24:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBOquC092396; Fri, 12 Jul 2024 11:24:52 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:24:52 GMT Message-Id: <202407121124.46CBOquC092396@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 54ac7b969f86 - main - ipsec: make key_do_allocsp() global List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 54ac7b969f8683b1398625cc283eb8383f95b263 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=54ac7b969f8683b1398625cc283eb8383f95b263 commit 54ac7b969f8683b1398625cc283eb8383f95b263 Author: Konstantin Belousov AuthorDate: 2022-12-25 21:56:45 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 03:29:31 +0000 ipsec: make key_do_allocsp() global Sponsored by: NVIDIA networking --- sys/netipsec/key.c | 1 - sys/netipsec/key.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c index a077f8007e47..501f5c0a7339 100644 --- a/sys/netipsec/key.c +++ b/sys/netipsec/key.c @@ -622,7 +622,6 @@ static struct callout key_timer; static void key_unlink(struct secpolicy *); static void key_detach(struct secpolicy *); -static struct secpolicy *key_do_allocsp(struct secpolicyindex *spidx, u_int dir); static struct secpolicy *key_getsp(struct secpolicyindex *); static struct secpolicy *key_getspbyid(u_int32_t); static struct mbuf *key_gather_mbuf(struct mbuf *, diff --git a/sys/netipsec/key.h b/sys/netipsec/key.h index 5c46c00feb39..d62426e6733e 100644 --- a/sys/netipsec/key.h +++ b/sys/netipsec/key.h @@ -49,6 +49,7 @@ struct xformsw; struct secpolicy *key_newsp(void); struct secpolicy *key_allocsp(struct secpolicyindex *, u_int); +struct secpolicy *key_do_allocsp(struct secpolicyindex *spidx, u_int dir); struct secpolicy *key_msg2sp(struct sadb_x_policy *, size_t, int *); int key_sp2msg(struct secpolicy *, void *, size_t *); void key_addref(struct secpolicy *); From nobody Fri Jul 12 11:24:53 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QG36zXz5QBbk; Fri, 12 Jul 2024 11:24: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QF6qPCz4hqT; Fri, 12 Jul 2024 11:24:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783494; 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=vA7E/nazFGbIEB7KYd5gw6cPfZhia4LJidE3Yvk+ALc=; b=I+iTcYQ0hUJ6I5iM1I0ATAh+gFktRONnwgmo0QWmfgmp0MpC5a78ynuX7RkHBbTeJ+OAlB mRuSJdlcMqyagHhFpzfJCFYOXSCngOWDn4HOHhKRu9mclFe4W8atZJMFJTdFEcRaeDLrn9 gskYByyrk2+Wal/n7K9ROdP6G7CK3Vzc/QMqeW0adpjYrLN4/GqfJFpUaz6E6K7fDcHb0z 7azbjVpVudfSnKrbKmTaixfVZVakiCcVCPJo3cpdrmzo6aG3ugL4OEwm8EA1Vtj0tA9oVp pgW36F9Np/GOTlKNlkJklAKA8L4ny69fI1dQwuCFKKOZsR6laJzQ/3fbUlt2pA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783494; a=rsa-sha256; cv=none; b=S2yYJlqefmoeRfkgf9loR1NL4gbpagL6qp0bKDiZLlH62DTpfbXEortUHXLOHOKT7rdl0V ENoGRPa4b6ZrHUhscK7DE5NkR3Istj92FV4SP22WoGeQFQRatD750Xi86CP0YqevzfkrMU Q6chWFFtX8yh52KIjER/f4o82ipAJ4YGvkfylEueY1yrpohbo62MZuluovbpBL4hSN9Pai aNv2qcVYytgvMNIJs2Q35paFJEfWx5vegvLGQIHsnoUIrw0iccGluL0aTJg3BoQ0jhzXfa Sz2hqueIT6CVPD5LqwHuYezSkmMo3JG0zPiqMCL3HwX1dR2Ngb54jwEfuRnSqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783494; 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=vA7E/nazFGbIEB7KYd5gw6cPfZhia4LJidE3Yvk+ALc=; b=HlXVBuQBqg0j4Iq3lQjjvwW96SUgX43/HyUV1uszd2lv3UlSiaB88BS6rOU/adu3skt3nv UhIHz7lE8y2oFhGCWO14YCE8L3tiwXIOKKWLP4XAzwfhROfoNyQZDRqtXtE6PWJNrpfc0Y wMbI6WJKtbxog6Dz+DCgvgI/xlmSjxL7oTxpNjRRaA0HqVKHz/7R4AgnwV8QC20wJ4jGff qT/SYYk6X4lkzU/xC1a/ODv8gKIqJa5eHPLWDfBIbLrQIXaOgxEDqrsahXkMPuWLyvHqw5 JwqxWaEEyjbypiGHYk8gCt80o1DfH11l6QT3mZ07wPBFW6iLDr23Ur3p/TfIhA== 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 4WL8QF6R9LzhB4; Fri, 12 Jul 2024 11:24: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 46CBOrlB092449; Fri, 12 Jul 2024 11:24:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBOrop092444; Fri, 12 Jul 2024 11:24:53 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:24:53 GMT Message-Id: <202407121124.46CBOrop092444@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 41106f5aa032 - main - netipsec/xform_esp.c: make esp_ctr_compatibility global List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 41106f5aa032502f474fb60180a97917b12f6568 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=41106f5aa032502f474fb60180a97917b12f6568 commit 41106f5aa032502f474fb60180a97917b12f6568 Author: Konstantin Belousov AuthorDate: 2023-03-13 00:22:21 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 03:29:31 +0000 netipsec/xform_esp.c: make esp_ctr_compatibility global Sponsored by: NVIDIA networking --- sys/netipsec/esp_var.h | 2 ++ sys/netipsec/xform_esp.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/netipsec/esp_var.h b/sys/netipsec/esp_var.h index bbcea005fcf3..c1f492913107 100644 --- a/sys/netipsec/esp_var.h +++ b/sys/netipsec/esp_var.h @@ -74,6 +74,8 @@ struct espstat { #include VNET_DECLARE(int, esp_enable); +VNET_DECLARE(int, esp_ctr_compatibility); +#define V_esp_ctr_compatibility VNET(esp_ctr_compatibility) VNET_PCPUSTAT_DECLARE(struct espstat, espstat); #define ESPSTAT_ADD(name, val) \ diff --git a/sys/netipsec/xform_esp.c b/sys/netipsec/xform_esp.c index 7ad6085db87f..599134f056ca 100644 --- a/sys/netipsec/xform_esp.c +++ b/sys/netipsec/xform_esp.c @@ -83,8 +83,7 @@ #define SPI_SIZE 4 VNET_DEFINE(int, esp_enable) = 1; -VNET_DEFINE_STATIC(int, esp_ctr_compatibility) = 1; -#define V_esp_ctr_compatibility VNET(esp_ctr_compatibility) +VNET_DEFINE(int, esp_ctr_compatibility) = 1; VNET_PCPUSTAT_DEFINE(struct espstat, espstat); VNET_PCPUSTAT_SYSINIT(espstat); From nobody Fri Jul 12 11:24:54 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QH3DmPz5QBJl; Fri, 12 Jul 2024 11:24: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QH0fGPz4hsg; Fri, 12 Jul 2024 11:24:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783495; 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=sQOakGDlpw6aslSLPsum79C5EUA1B/Xaz7ACUt2YnrA=; b=f+Z2F26V+9CC+9nJbeMItufZjp5zFelOk7VoEsWBm59bN5An1bTeo6dmvusH+Ts4IXGS0K 751BpuZSCr/A7dkCtS9j/qkECJeHvCu3UawOftIKzbS8ADZc246hjQDb3p9NIcr/ZQbibl vxkJyE7rQwMl1g/Wh9iyiRFvWoH1UuYSTKUi380Grp7n82juJZs2R+3LZYNYOVhW5g5UyT SqAnul1246wGky959s6FJPRoE7Si7AnwlOYcFOa2ZfFY2EWZF126nrmZjihG6MKXX2S7tT o1lqYd0U33asGm4rX/UuayPidiGaKOMpk1Zp9nmOTx3rXGEEBJbMOTjPUTTyfQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783495; a=rsa-sha256; cv=none; b=BAm6FyXEewP6Elzhou8aCKP4tDX2TAttzFubraebduGJmy0FF0Gq2S8sYY5s8Lx3m/6b2W 1BpIF5NT7M0Y4ofVH3yNBcna95Hjntcc8+r7M9LLFbvnkCAhPsm7RdKOEHPt+6Wr9lT1B8 LvsEqabI4dyYVnP0UGpilUQcRjH8YqgAVs8lH2C2Kh2y5KhmBTmU6Xl6MXnJnbr2fdwjPi Glm7ehN2fISIWgE8BuuB/6MOzEx7VJPyhthTtIez4ku+WLIvp7ZaZIyiPVuucylaPmJrBs Mw9wwRoAWfG4+Fzc4tRCg5XYwCUyMw64pC6awAi+9y2UYhflFmCkMJZT+05hKQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783495; 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=sQOakGDlpw6aslSLPsum79C5EUA1B/Xaz7ACUt2YnrA=; b=PZbXNKl3UxbtPfzjm7FXMh8KQNpdicpsXIfXE1237k1qoLKr/5JlrIIyryoTx31hew3mvt iygGji7G7DMBuJon1f9xfX3Qw7WYocVP1W96K3kaaGYSsLDCSoxo43G/V5wSQqr0LVNAIl qnN3g15FOH+GPj9YM/RhOre9s11E3DMv0ro6/5iA983VIgXfgePo3MXXNw0QWu26FLM6z7 8Cal/aIRv7XND4OgceHPxAc3/hXeZsOKlpMrKcO7EP80cB4lyenPLSYyAbH0aSj0W0Bvv9 BflMvlCXhjdkEAQOnQC/rT12p33hF9WQWD4WcmP7zVo7HhWYU0Ai4lRbDEocbA== 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 4WL8QH08ZPzgwm; Fri, 12 Jul 2024 11:24: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 46CBOsKk092500; Fri, 12 Jul 2024 11:24:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBOsgd092497; Fri, 12 Jul 2024 11:24:54 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:24:54 GMT Message-Id: <202407121124.46CBOsgd092497@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: de1da299daaa - main - ipsec_output(): add outcoming ifp argument List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: de1da299daaa4d26f5a4aba733d9b2880dc0be59 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=de1da299daaa4d26f5a4aba733d9b2880dc0be59 commit de1da299daaa4d26f5a4aba733d9b2880dc0be59 Author: Konstantin Belousov AuthorDate: 2023-01-25 10:54:47 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 03:29:31 +0000 ipsec_output(): add outcoming ifp argument The information about the interface is needed to coordinate inline offloading of IPSEC processing with corresponding driver. Sponsored by: NVIDIA networking Differential revision: https://reviews.freebsd.org/D44223 --- sys/net/if_ipsec.c | 4 +-- sys/netinet/ip_output.c | 2 +- sys/netinet6/ip6_output.c | 2 +- sys/netipsec/ipsec.h | 5 ++-- sys/netipsec/ipsec6.h | 5 ++-- sys/netipsec/ipsec_output.c | 64 +++++++++++++++++++++++++------------------- sys/netipsec/ipsec_support.h | 11 ++++---- sys/netipsec/subr_ipsec.c | 4 +-- 8 files changed, 54 insertions(+), 43 deletions(-) diff --git a/sys/net/if_ipsec.c b/sys/net/if_ipsec.c index b503d0696691..bdf500431eff 100644 --- a/sys/net/if_ipsec.c +++ b/sys/net/if_ipsec.c @@ -415,12 +415,12 @@ ipsec_transmit(struct ifnet *ifp, struct mbuf *m) switch (af) { #ifdef INET case AF_INET: - error = ipsec4_process_packet(m, sp, NULL); + error = ipsec4_process_packet(ifp, m, sp, NULL); break; #endif #ifdef INET6 case AF_INET6: - error = ipsec6_process_packet(m, sp, NULL); + error = ipsec6_process_packet(ifp, m, sp, NULL); break; #endif default: diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 28fb651a0bc9..77708f84c3e9 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -673,7 +673,7 @@ sendit: error = ENOBUFS; goto bad; } - if ((error = IPSEC_OUTPUT(ipv4, m, inp)) != 0) { + if ((error = IPSEC_OUTPUT(ipv4, ifp, m, inp)) != 0) { if (error == EINPROGRESS) error = 0; goto done; diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 530f86c36689..800fa691062f 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -462,7 +462,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt, error = ENOBUFS; goto bad; } - if ((error = IPSEC_OUTPUT(ipv6, m, inp)) != 0) { + if ((error = IPSEC_OUTPUT(ipv6, ifp, m, inp)) != 0) { if (error == EINPROGRESS) error = 0; goto done; diff --git a/sys/netipsec/ipsec.h b/sys/netipsec/ipsec.h index 88594d250fdb..a90953531b99 100644 --- a/sys/netipsec/ipsec.h +++ b/sys/netipsec/ipsec.h @@ -336,8 +336,9 @@ void ipsec_setspidx_inpcb(struct inpcb *, struct secpolicyindex *, u_int); void ipsec4_setsockaddrs(const struct mbuf *, union sockaddr_union *, union sockaddr_union *); int ipsec4_common_input_cb(struct mbuf *, struct secasvar *, int, int); -int ipsec4_check_pmtu(struct mbuf *, struct secpolicy *, int); -int ipsec4_process_packet(struct mbuf *, struct secpolicy *, struct inpcb *); +int ipsec4_check_pmtu(struct ifnet *, struct mbuf *, struct secpolicy *, int); +int ipsec4_process_packet(struct ifnet *, struct mbuf *, struct secpolicy *, + struct inpcb *); int ipsec_process_done(struct mbuf *, struct secpolicy *, struct secasvar *, u_int); diff --git a/sys/netipsec/ipsec6.h b/sys/netipsec/ipsec6.h index 3adb332aeb73..9c5d6e695417 100644 --- a/sys/netipsec/ipsec6.h +++ b/sys/netipsec/ipsec6.h @@ -66,8 +66,9 @@ struct secpolicy *ipsec6_checkpolicy(const struct mbuf *, void ipsec6_setsockaddrs(const struct mbuf *, union sockaddr_union *, union sockaddr_union *); int ipsec6_common_input_cb(struct mbuf *, struct secasvar *, int, int); -int ipsec6_check_pmtu(struct mbuf *, struct secpolicy *, int); -int ipsec6_process_packet(struct mbuf *, struct secpolicy *, struct inpcb *); +int ipsec6_check_pmtu(struct ifnet *, struct mbuf *, struct secpolicy *, int); +int ipsec6_process_packet(struct ifnet *, struct mbuf *, struct secpolicy *, + struct inpcb *); int ip6_ipsec_filtertunnel(struct mbuf *); int ip6_ipsec_pcbctl(struct inpcb *, struct sockopt *); diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index 707fe3421c97..08b6289ec1d5 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -110,7 +110,8 @@ static size_t ipsec_get_pmtu(struct secasvar *sav); #ifdef INET static struct secasvar * -ipsec4_allocsa(struct mbuf *m, struct secpolicy *sp, u_int *pidx, int *error) +ipsec4_allocsa(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, + u_int *pidx, int *error) { struct secasindex *saidx, tmpsaidx; struct ipsecrequest *isr; @@ -186,7 +187,7 @@ next: * IPsec output logic for IPv4. */ static int -ipsec4_perform_request(struct mbuf *m, struct secpolicy *sp, +ipsec4_perform_request(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, struct inpcb *inp, u_int idx) { struct ipsec_ctx_data ctx; @@ -206,7 +207,7 @@ ipsec4_perform_request(struct mbuf *m, struct secpolicy *sp, * determine next transform. At the end of transform we can * release reference to SP. */ - sav = ipsec4_allocsa(m, sp, &idx, &error); + sav = ipsec4_allocsa(ifp, m, sp, &idx, &error); if (sav == NULL) { if (error == EJUSTRETURN) { /* No IPsec required */ key_freesp(&sp); @@ -288,15 +289,16 @@ bad: } int -ipsec4_process_packet(struct mbuf *m, struct secpolicy *sp, +ipsec4_process_packet(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, struct inpcb *inp) { - return (ipsec4_perform_request(m, sp, inp, 0)); + return (ipsec4_perform_request(ifp, m, sp, inp, 0)); } int -ipsec4_check_pmtu(struct mbuf *m, struct secpolicy *sp, int forwarding) +ipsec4_check_pmtu(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, + int forwarding) { struct secasvar *sav; struct ip *ip; @@ -317,7 +319,7 @@ ipsec4_check_pmtu(struct mbuf *m, struct secpolicy *sp, int forwarding) setdf: idx = sp->tcount - 1; - sav = ipsec4_allocsa(m, sp, &idx, &error); + sav = ipsec4_allocsa(ifp, m, sp, &idx, &error); if (sav == NULL) { key_freesp(&sp); /* @@ -368,7 +370,8 @@ setdf: } static int -ipsec4_common_output(struct mbuf *m, struct inpcb *inp, int forwarding) +ipsec4_common_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, + int forwarding) { struct secpolicy *sp; int error; @@ -412,7 +415,7 @@ ipsec4_common_output(struct mbuf *m, struct inpcb *inp, int forwarding) #endif } /* NB: callee frees mbuf and releases reference to SP */ - error = ipsec4_check_pmtu(m, sp, forwarding); + error = ipsec4_check_pmtu(ifp, m, sp, forwarding); if (error != 0) { if (error == EJUSTRETURN) return (0); @@ -420,7 +423,7 @@ ipsec4_common_output(struct mbuf *m, struct inpcb *inp, int forwarding) return (error); } - error = ipsec4_process_packet(m, sp, inp); + error = ipsec4_process_packet(ifp, m, sp, inp); if (error == EJUSTRETURN) { /* * We had a SP with a level of 'use' and no SA. We @@ -440,7 +443,7 @@ ipsec4_common_output(struct mbuf *m, struct inpcb *inp, int forwarding) * other values - mbuf consumed by IPsec. */ int -ipsec4_output(struct mbuf *m, struct inpcb *inp) +ipsec4_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp) { /* @@ -451,7 +454,7 @@ ipsec4_output(struct mbuf *m, struct inpcb *inp) if (m_tag_find(m, PACKET_TAG_IPSEC_OUT_DONE, NULL) != NULL) return (0); - return (ipsec4_common_output(m, inp, 0)); + return (ipsec4_common_output(ifp, m, inp, 0)); } /* @@ -471,7 +474,7 @@ ipsec4_forward(struct mbuf *m) m_freem(m); return (EACCES); } - return (ipsec4_common_output(m, NULL, 1)); + return (ipsec4_common_output(NULL /* XXXKIB */, m, NULL, 1)); } #endif @@ -491,7 +494,8 @@ in6_sa_equal_addrwithscope(const struct sockaddr_in6 *sa, } static struct secasvar * -ipsec6_allocsa(struct mbuf *m, struct secpolicy *sp, u_int *pidx, int *error) +ipsec6_allocsa(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, + u_int *pidx, int *error) { struct secasindex *saidx, tmpsaidx; struct ipsecrequest *isr; @@ -579,7 +583,7 @@ next: * IPsec output logic for IPv6. */ static int -ipsec6_perform_request(struct mbuf *m, struct secpolicy *sp, +ipsec6_perform_request(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, struct inpcb *inp, u_int idx) { struct ipsec_ctx_data ctx; @@ -590,7 +594,7 @@ ipsec6_perform_request(struct mbuf *m, struct secpolicy *sp, IPSEC_ASSERT(idx < sp->tcount, ("Wrong IPsec request index %d", idx)); - sav = ipsec6_allocsa(m, sp, &idx, &error); + sav = ipsec6_allocsa(ifp, m, sp, &idx, &error); if (sav == NULL) { if (error == EJUSTRETURN) { /* No IPsec required */ key_freesp(&sp); @@ -671,18 +675,19 @@ bad: } int -ipsec6_process_packet(struct mbuf *m, struct secpolicy *sp, +ipsec6_process_packet(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, struct inpcb *inp) { - return (ipsec6_perform_request(m, sp, inp, 0)); + return (ipsec6_perform_request(ifp, m, sp, inp, 0)); } /* * IPv6 implementation is based on IPv4 implementation. */ int -ipsec6_check_pmtu(struct mbuf *m, struct secpolicy *sp, int forwarding) +ipsec6_check_pmtu(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, + int forwarding) { struct secasvar *sav; size_t hlen, pmtu; @@ -699,7 +704,7 @@ ipsec6_check_pmtu(struct mbuf *m, struct secpolicy *sp, int forwarding) return (0); idx = sp->tcount - 1; - sav = ipsec6_allocsa(m, sp, &idx, &error); + sav = ipsec6_allocsa(ifp, m, sp, &idx, &error); if (sav == NULL) { key_freesp(&sp); /* @@ -745,7 +750,8 @@ ipsec6_check_pmtu(struct mbuf *m, struct secpolicy *sp, int forwarding) } static int -ipsec6_common_output(struct mbuf *m, struct inpcb *inp, int forwarding) +ipsec6_common_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, + int forwarding) { struct secpolicy *sp; int error; @@ -779,7 +785,7 @@ ipsec6_common_output(struct mbuf *m, struct inpcb *inp, int forwarding) #endif } - error = ipsec6_check_pmtu(m, sp, forwarding); + error = ipsec6_check_pmtu(ifp, m, sp, forwarding); if (error != 0) { if (error == EJUSTRETURN) return (0); @@ -788,7 +794,7 @@ ipsec6_common_output(struct mbuf *m, struct inpcb *inp, int forwarding) } /* NB: callee frees mbuf and releases reference to SP */ - error = ipsec6_process_packet(m, sp, inp); + error = ipsec6_process_packet(ifp, m, sp, inp); if (error == EJUSTRETURN) { /* * We had a SP with a level of 'use' and no SA. We @@ -808,7 +814,7 @@ ipsec6_common_output(struct mbuf *m, struct inpcb *inp, int forwarding) * other values - mbuf consumed by IPsec. */ int -ipsec6_output(struct mbuf *m, struct inpcb *inp) +ipsec6_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp) { /* @@ -819,7 +825,7 @@ ipsec6_output(struct mbuf *m, struct inpcb *inp) if (m_tag_find(m, PACKET_TAG_IPSEC_OUT_DONE, NULL) != NULL) return (0); - return (ipsec6_common_output(m, inp, 0)); + return (ipsec6_common_output(ifp, m, inp, 0)); } /* @@ -839,7 +845,7 @@ ipsec6_forward(struct mbuf *m) m_freem(m); return (EACCES); } - return (ipsec6_common_output(m, NULL, 1)); + return (ipsec6_common_output(NULL /* XXXKIB */, m, NULL, 1)); } #endif /* INET6 */ @@ -916,14 +922,16 @@ ipsec_process_done(struct mbuf *m, struct secpolicy *sp, struct secasvar *sav, case AF_INET: key_freesav(&sav); IPSECSTAT_INC(ips_out_bundlesa); - return (ipsec4_perform_request(m, sp, NULL, idx)); + return (ipsec4_perform_request(NULL, m, sp, NULL, + idx)); /* NOTREACHED */ #endif #ifdef INET6 case AF_INET6: key_freesav(&sav); IPSEC6STAT_INC(ips_out_bundlesa); - return (ipsec6_perform_request(m, sp, NULL, idx)); + return (ipsec6_perform_request(NULL, m, sp, NULL, + idx)); /* NOTREACHED */ #endif /* INET6 */ default: diff --git a/sys/netipsec/ipsec_support.h b/sys/netipsec/ipsec_support.h index b7be62104d12..96d753f48f42 100644 --- a/sys/netipsec/ipsec_support.h +++ b/sys/netipsec/ipsec_support.h @@ -29,6 +29,7 @@ #ifdef _KERNEL #if defined(IPSEC) || defined(IPSEC_SUPPORT) +struct ifnet; struct mbuf; struct inpcb; struct tcphdr; @@ -58,7 +59,7 @@ int ipsec4_in_reject(const struct mbuf *, struct inpcb *); int ipsec4_input(struct mbuf *, int, int); int ipsec4_forward(struct mbuf *); int ipsec4_pcbctl(struct inpcb *, struct sockopt *); -int ipsec4_output(struct mbuf *, struct inpcb *); +int ipsec4_output(struct ifnet *, struct mbuf *, struct inpcb *); int ipsec4_capability(struct mbuf *, u_int); int ipsec4_ctlinput(ipsec_ctlinput_param_t); #endif /* INET */ @@ -68,7 +69,7 @@ int ipsec6_input(struct mbuf *, int, int); int ipsec6_in_reject(const struct mbuf *, struct inpcb *); int ipsec6_forward(struct mbuf *); int ipsec6_pcbctl(struct inpcb *, struct sockopt *); -int ipsec6_output(struct mbuf *, struct inpcb *); +int ipsec6_output(struct ifnet *, struct mbuf *, struct inpcb *); int ipsec6_capability(struct mbuf *, u_int); int ipsec6_ctlinput(ipsec_ctlinput_param_t); #endif /* INET6 */ @@ -77,7 +78,7 @@ struct ipsec_methods { int (*input)(struct mbuf *, int, int); int (*check_policy)(const struct mbuf *, struct inpcb *); int (*forward)(struct mbuf *); - int (*output)(struct mbuf *, struct inpcb *); + int (*output)(struct ifnet *, struct mbuf *, struct inpcb *); int (*pcbctl)(struct inpcb *, struct sockopt *); size_t (*hdrsize)(struct inpcb *); int (*capability)(struct mbuf *, u_int); @@ -187,8 +188,8 @@ int ipsec_kmod_input(struct ipsec_support * const, struct mbuf *, int, int); int ipsec_kmod_check_policy(struct ipsec_support * const, struct mbuf *, struct inpcb *); int ipsec_kmod_forward(struct ipsec_support * const, struct mbuf *); -int ipsec_kmod_output(struct ipsec_support * const, struct mbuf *, - struct inpcb *); +int ipsec_kmod_output(struct ipsec_support * const, struct ifnet *, + struct mbuf *, struct inpcb *); int ipsec_kmod_pcbctl(struct ipsec_support * const, struct inpcb *, struct sockopt *); int ipsec_kmod_capability(struct ipsec_support * const, struct mbuf *, u_int); diff --git a/sys/netipsec/subr_ipsec.c b/sys/netipsec/subr_ipsec.c index a1eb8f220525..46b3439908ce 100644 --- a/sys/netipsec/subr_ipsec.c +++ b/sys/netipsec/subr_ipsec.c @@ -369,8 +369,8 @@ IPSEC_KMOD_METHOD(int, ipsec_kmod_ctlinput, sc, ) IPSEC_KMOD_METHOD(int, ipsec_kmod_output, sc, - output, METHOD_DECL(struct ipsec_support * const sc, struct mbuf *m, - struct inpcb *inp), METHOD_ARGS(m, inp) + output, METHOD_DECL(struct ipsec_support * const sc, struct ifnet *ifp, + struct mbuf *m, struct inpcb *inp), METHOD_ARGS(ifp, m, inp) ) IPSEC_KMOD_METHOD(int, ipsec_kmod_pcbctl, sc, From nobody Fri Jul 12 11:24:56 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QJ3kYZz5QBlx; Fri, 12 Jul 2024 11:24: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QJ1V3fz4hhy; Fri, 12 Jul 2024 11:24:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783496; 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=PH5NQSFpALpDfmfM547otYpPa6BW8NBfnMadQdYbLws=; b=ToR1zHjRcjVUirB+5CXPaSECc6RwYJDTBHfMuCcwXmALP92BtxV1yx02i/JyiXwk/n1/Ip 0R9droc/g0n2hhUsttFoPp2jBQFh7jBIEeztzOpX/eNx7LCrrK452KMAsJeHxQMII8WXuR sKZ/aOtcxDkPHRxHEUQjO9+q9Kpk183UrcylnZ4eIAo5DyI5eSZkdg3GfnGKANXe75WM1E 9h/2BTYoaBYi5OzaKATRN9b+37XMiitclFbC34wecBYRC/N2zs+0r14Bge0pGU01WbKR8z gxLpGJndJkMCmRI2cF8wa0Trfsqo30qU91iBWtV16WPt8mWNKI+Ab8DTYS/4Jw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783496; a=rsa-sha256; cv=none; b=ojXgPQ0lMnk27An+GaLinOnKV18vnJM8wjn5BMP4bAtXufudKHwzrV+UxuN487Ihfcmm/I B8xinD/hIDQpOUoptN1bqmfnwZoiTfnjtb5pxBabEsHI5zDHA6n/tc2gGC7h4udd3B+Kd9 vO2XlfQ2I4+biM1y2DZ3eVoFTISTKm6D27J8ihZQ5EVHkmvOY4++yMbUjWX29+KXQ0eOKg fawEyAODsnX1u3uFK54zlgYVEP0o32YnwXngma8AvroCjBNlbvXQyuWYm1b7jPhMfFFq0Y +dmCogvL+qu74p4viqoNtO3raG7sjPnadi+QJAG2O56pk231evzk8D7rU3ufRQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783496; 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=PH5NQSFpALpDfmfM547otYpPa6BW8NBfnMadQdYbLws=; b=Eer59JYGqsNEOeVCrxyHzK68OWByvtLIMikkxl7NeJqvCDWuzrenBN/wv+PTY+Mz/BM30i 1NHfZAHlPHtdi+jMtTTb864L0et578j3H0f2/X21o2Zt+smBfWJ7NtN/n+IhDij5jJja+h 6R0Is6GcdUrF/CmoiUW4QAsAIvZEt7X/yy3Rj57g7SwUsIC8QLyT4k7MQTtH3gvt1oUBBG U2JeOlfi2gstdI80WKCMdtyRf6yTAvV0IKKbzmzd1x4hc8pZ+nqcTedbJz/yWeSvzIN1s9 AqiqJ46D1NIY5qxlU+QJ6tz0u56XelkCKUVGoMnArLO+NHshK/UUEw89+esh3Q== 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 4WL8QJ15yWzhgg; Fri, 12 Jul 2024 11:24: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 46CBOu9E092540; Fri, 12 Jul 2024 11:24:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBOupW092537; Fri, 12 Jul 2024 11:24:56 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:24:56 GMT Message-Id: <202407121124.46CBOupW092537@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 00524fd47599 - main - ipsec_output(): add mtu argument List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 00524fd475995d30780ce80ec75e085223206cac Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=00524fd475995d30780ce80ec75e085223206cac commit 00524fd475995d30780ce80ec75e085223206cac Author: Konstantin Belousov AuthorDate: 2023-01-30 17:56:00 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 03:29:31 +0000 ipsec_output(): add mtu argument Similarly, mtu is needed to decide inline IPSEC offloiad for the driver. Sponsored by: NVIDIA networking Differential revision: https://reviews.freebsd.org/D44224 --- sys/net/if_ipsec.c | 4 ++-- sys/netinet/ip_output.c | 2 +- sys/netinet6/ip6_output.c | 2 +- sys/netipsec/ipsec.h | 2 +- sys/netipsec/ipsec6.h | 2 +- sys/netipsec/ipsec_output.c | 36 ++++++++++++++++++------------------ sys/netipsec/ipsec_support.h | 9 +++++---- sys/netipsec/subr_ipsec.c | 7 ++++--- 8 files changed, 33 insertions(+), 31 deletions(-) diff --git a/sys/net/if_ipsec.c b/sys/net/if_ipsec.c index bdf500431eff..849127f75de6 100644 --- a/sys/net/if_ipsec.c +++ b/sys/net/if_ipsec.c @@ -415,12 +415,12 @@ ipsec_transmit(struct ifnet *ifp, struct mbuf *m) switch (af) { #ifdef INET case AF_INET: - error = ipsec4_process_packet(ifp, m, sp, NULL); + error = ipsec4_process_packet(ifp, m, sp, NULL, ifp->if_mtu); break; #endif #ifdef INET6 case AF_INET6: - error = ipsec6_process_packet(ifp, m, sp, NULL); + error = ipsec6_process_packet(ifp, m, sp, NULL, ifp->if_mtu); break; #endif default: diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 77708f84c3e9..770a95dae659 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -673,7 +673,7 @@ sendit: error = ENOBUFS; goto bad; } - if ((error = IPSEC_OUTPUT(ipv4, ifp, m, inp)) != 0) { + if ((error = IPSEC_OUTPUT(ipv4, ifp, m, inp, mtu)) != 0) { if (error == EINPROGRESS) error = 0; goto done; diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 800fa691062f..68dd376af5d0 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -462,7 +462,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt, error = ENOBUFS; goto bad; } - if ((error = IPSEC_OUTPUT(ipv6, ifp, m, inp)) != 0) { + if ((error = IPSEC_OUTPUT(ipv6, ifp, m, inp, mtu)) != 0) { if (error == EINPROGRESS) error = 0; goto done; diff --git a/sys/netipsec/ipsec.h b/sys/netipsec/ipsec.h index a90953531b99..2a1dcb8bb77b 100644 --- a/sys/netipsec/ipsec.h +++ b/sys/netipsec/ipsec.h @@ -338,7 +338,7 @@ void ipsec4_setsockaddrs(const struct mbuf *, union sockaddr_union *, int ipsec4_common_input_cb(struct mbuf *, struct secasvar *, int, int); int ipsec4_check_pmtu(struct ifnet *, struct mbuf *, struct secpolicy *, int); int ipsec4_process_packet(struct ifnet *, struct mbuf *, struct secpolicy *, - struct inpcb *); + struct inpcb *, u_long); int ipsec_process_done(struct mbuf *, struct secpolicy *, struct secasvar *, u_int); diff --git a/sys/netipsec/ipsec6.h b/sys/netipsec/ipsec6.h index 9c5d6e695417..a7410733c43f 100644 --- a/sys/netipsec/ipsec6.h +++ b/sys/netipsec/ipsec6.h @@ -68,7 +68,7 @@ void ipsec6_setsockaddrs(const struct mbuf *, union sockaddr_union *, int ipsec6_common_input_cb(struct mbuf *, struct secasvar *, int, int); int ipsec6_check_pmtu(struct ifnet *, struct mbuf *, struct secpolicy *, int); int ipsec6_process_packet(struct ifnet *, struct mbuf *, struct secpolicy *, - struct inpcb *); + struct inpcb *, u_long); int ip6_ipsec_filtertunnel(struct mbuf *); int ip6_ipsec_pcbctl(struct inpcb *, struct sockopt *); diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index 08b6289ec1d5..be996f257b64 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -188,7 +188,7 @@ next: */ static int ipsec4_perform_request(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, - struct inpcb *inp, u_int idx) + struct inpcb *inp, u_int idx, u_long mtu) { struct ipsec_ctx_data ctx; union sockaddr_union *dst; @@ -290,10 +290,10 @@ bad: int ipsec4_process_packet(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, - struct inpcb *inp) + struct inpcb *inp, u_long mtu) { - return (ipsec4_perform_request(ifp, m, sp, inp, 0)); + return (ipsec4_perform_request(ifp, m, sp, inp, 0, mtu)); } int @@ -371,7 +371,7 @@ setdf: static int ipsec4_common_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, - int forwarding) + int forwarding, u_long mtu) { struct secpolicy *sp; int error; @@ -423,7 +423,7 @@ ipsec4_common_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, return (error); } - error = ipsec4_process_packet(ifp, m, sp, inp); + error = ipsec4_process_packet(ifp, m, sp, inp, mtu); if (error == EJUSTRETURN) { /* * We had a SP with a level of 'use' and no SA. We @@ -443,7 +443,7 @@ ipsec4_common_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, * other values - mbuf consumed by IPsec. */ int -ipsec4_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp) +ipsec4_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, u_long mtu) { /* @@ -454,7 +454,7 @@ ipsec4_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp) if (m_tag_find(m, PACKET_TAG_IPSEC_OUT_DONE, NULL) != NULL) return (0); - return (ipsec4_common_output(ifp, m, inp, 0)); + return (ipsec4_common_output(ifp, m, inp, 0, mtu)); } /* @@ -474,7 +474,7 @@ ipsec4_forward(struct mbuf *m) m_freem(m); return (EACCES); } - return (ipsec4_common_output(NULL /* XXXKIB */, m, NULL, 1)); + return (ipsec4_common_output(NULL /* XXXKIB */, m, NULL, 1, 0)); } #endif @@ -584,7 +584,7 @@ next: */ static int ipsec6_perform_request(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, - struct inpcb *inp, u_int idx) + struct inpcb *inp, u_int idx, u_long mtu) { struct ipsec_ctx_data ctx; union sockaddr_union *dst; @@ -676,10 +676,10 @@ bad: int ipsec6_process_packet(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, - struct inpcb *inp) + struct inpcb *inp, u_long mtu) { - return (ipsec6_perform_request(ifp, m, sp, inp, 0)); + return (ipsec6_perform_request(ifp, m, sp, inp, 0, mtu)); } /* @@ -751,7 +751,7 @@ ipsec6_check_pmtu(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, static int ipsec6_common_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, - int forwarding) + int forwarding, u_long mtu) { struct secpolicy *sp; int error; @@ -794,7 +794,7 @@ ipsec6_common_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, } /* NB: callee frees mbuf and releases reference to SP */ - error = ipsec6_process_packet(ifp, m, sp, inp); + error = ipsec6_process_packet(ifp, m, sp, inp, mtu); if (error == EJUSTRETURN) { /* * We had a SP with a level of 'use' and no SA. We @@ -814,7 +814,7 @@ ipsec6_common_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, * other values - mbuf consumed by IPsec. */ int -ipsec6_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp) +ipsec6_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, u_long mtu) { /* @@ -825,7 +825,7 @@ ipsec6_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp) if (m_tag_find(m, PACKET_TAG_IPSEC_OUT_DONE, NULL) != NULL) return (0); - return (ipsec6_common_output(ifp, m, inp, 0)); + return (ipsec6_common_output(ifp, m, inp, 0, mtu)); } /* @@ -845,7 +845,7 @@ ipsec6_forward(struct mbuf *m) m_freem(m); return (EACCES); } - return (ipsec6_common_output(NULL /* XXXKIB */, m, NULL, 1)); + return (ipsec6_common_output(NULL /* XXXKIB */, m, NULL, 1, 0)); } #endif /* INET6 */ @@ -923,7 +923,7 @@ ipsec_process_done(struct mbuf *m, struct secpolicy *sp, struct secasvar *sav, key_freesav(&sav); IPSECSTAT_INC(ips_out_bundlesa); return (ipsec4_perform_request(NULL, m, sp, NULL, - idx)); + idx, 0)); /* NOTREACHED */ #endif #ifdef INET6 @@ -931,7 +931,7 @@ ipsec_process_done(struct mbuf *m, struct secpolicy *sp, struct secasvar *sav, key_freesav(&sav); IPSEC6STAT_INC(ips_out_bundlesa); return (ipsec6_perform_request(NULL, m, sp, NULL, - idx)); + idx, 0)); /* NOTREACHED */ #endif /* INET6 */ default: diff --git a/sys/netipsec/ipsec_support.h b/sys/netipsec/ipsec_support.h index 96d753f48f42..0cbfe6ddfee5 100644 --- a/sys/netipsec/ipsec_support.h +++ b/sys/netipsec/ipsec_support.h @@ -59,7 +59,7 @@ int ipsec4_in_reject(const struct mbuf *, struct inpcb *); int ipsec4_input(struct mbuf *, int, int); int ipsec4_forward(struct mbuf *); int ipsec4_pcbctl(struct inpcb *, struct sockopt *); -int ipsec4_output(struct ifnet *, struct mbuf *, struct inpcb *); +int ipsec4_output(struct ifnet *, struct mbuf *, struct inpcb *, u_long); int ipsec4_capability(struct mbuf *, u_int); int ipsec4_ctlinput(ipsec_ctlinput_param_t); #endif /* INET */ @@ -69,7 +69,7 @@ int ipsec6_input(struct mbuf *, int, int); int ipsec6_in_reject(const struct mbuf *, struct inpcb *); int ipsec6_forward(struct mbuf *); int ipsec6_pcbctl(struct inpcb *, struct sockopt *); -int ipsec6_output(struct ifnet *, struct mbuf *, struct inpcb *); +int ipsec6_output(struct ifnet *, struct mbuf *, struct inpcb *, u_long); int ipsec6_capability(struct mbuf *, u_int); int ipsec6_ctlinput(ipsec_ctlinput_param_t); #endif /* INET6 */ @@ -78,7 +78,8 @@ struct ipsec_methods { int (*input)(struct mbuf *, int, int); int (*check_policy)(const struct mbuf *, struct inpcb *); int (*forward)(struct mbuf *); - int (*output)(struct ifnet *, struct mbuf *, struct inpcb *); + int (*output)(struct ifnet *, struct mbuf *, struct inpcb *, + u_long); int (*pcbctl)(struct inpcb *, struct sockopt *); size_t (*hdrsize)(struct inpcb *); int (*capability)(struct mbuf *, u_int); @@ -189,7 +190,7 @@ int ipsec_kmod_check_policy(struct ipsec_support * const, struct mbuf *, struct inpcb *); int ipsec_kmod_forward(struct ipsec_support * const, struct mbuf *); int ipsec_kmod_output(struct ipsec_support * const, struct ifnet *, - struct mbuf *, struct inpcb *); + struct mbuf *, struct inpcb *, u_long); int ipsec_kmod_pcbctl(struct ipsec_support * const, struct inpcb *, struct sockopt *); int ipsec_kmod_capability(struct ipsec_support * const, struct mbuf *, u_int); diff --git a/sys/netipsec/subr_ipsec.c b/sys/netipsec/subr_ipsec.c index 46b3439908ce..2f7e0f09882e 100644 --- a/sys/netipsec/subr_ipsec.c +++ b/sys/netipsec/subr_ipsec.c @@ -368,9 +368,10 @@ IPSEC_KMOD_METHOD(int, ipsec_kmod_ctlinput, sc, ipsec_ctlinput_param_t param), METHOD_ARGS(param) ) -IPSEC_KMOD_METHOD(int, ipsec_kmod_output, sc, - output, METHOD_DECL(struct ipsec_support * const sc, struct ifnet *ifp, - struct mbuf *m, struct inpcb *inp), METHOD_ARGS(ifp, m, inp) +IPSEC_KMOD_METHOD(int, ipsec_kmod_output, sc, output, + METHOD_DECL(struct ipsec_support * const sc, struct ifnet *ifp, + struct mbuf *m, struct inpcb *inp, u_long mtu), + METHOD_ARGS(ifp, m, inp, mtu) ) IPSEC_KMOD_METHOD(int, ipsec_kmod_pcbctl, sc, From nobody Fri Jul 12 11:24:57 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QK5181z5QBpQ; Fri, 12 Jul 2024 11:24: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QK2VKjz4htH; Fri, 12 Jul 2024 11:24:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783497; 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=Nd6SlqqoJ6Xt7Z6r5jkNy9oovxYvRLMqHEim4f1YLRI=; b=tER+siZ92v8HehGZO3nfLNBoMU7YJ7HRpcrhr9pPnjOpjl5aFs2Ndhsid5paxqjKzxxHDH +b0Wyg6YCQ0S4YaWczp8Q5uNLfxk8yIPDyPs5kdlhxpXvUC9FsWFBNmMNZkEfEVT3ILpZU YbwNMXjNT0GjrSjr7730kj9YyC9sCLOaRpQJjhF8mpn9h1aP4EmMy65GTV8dr1wYo7eY+L n2V5XFtoB523mNlxz5wZfeiD1Kz346w6E3TzFPTAofLVfG4KO973630Ls4lgWGSDjaRZvq u7+pXSJiS2EIgNuOjZW04excMr9WhxVM1om9GIrZhz8f3IZgjLFy5lvYHsiLgg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783497; a=rsa-sha256; cv=none; b=j+uPBpqJtlAsrNWCPQ1qDXnOZyVvLkvDVCJROK6EIFr07G2nuk6/SKtYD+PPUEIgc0UaMP dckXs6ebW8gfWl8rXi8eHrNReCaXDOWHYFPFYcQpXMrwEUSv7QEZI3hUr4qa933+vh/5dn OoL1gaChOrNKaPJ41w6zfoUNk9uiwP4YFLc4NIeb3rMl/nY9k9YOq5ruUDc9bdlUy1am54 oisWEkt1BrNqjoU94EjKRxvjJwLx2CWJFliaUlO3OnHPxOdSvahTe915deRB9NTQfOdsc2 LdD0Tug5MtVXo2u4xm18UJJ8aWN+fBNCDZYbaoWBKPTf6NJCOGIBB1k+jClJoA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783497; 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=Nd6SlqqoJ6Xt7Z6r5jkNy9oovxYvRLMqHEim4f1YLRI=; b=hBRdFrw/cuXOWefaEw9KGgz9dANLk3qNIhjWXObW8yzs4lwOC51I3ixaAYIb67YkRcjzJ7 uK2SlqYX30Uws32uIfke4WQt/Ii+MKLJK5ygSViUdC2I9xE/Csk5bFC13CGEDACucZaTBv PzDwbvHuI7G7iQcFUri4xi41d3iS+/2mQiO+LSwkIvrA0+RCpACexNVC2DJ9diBuCwGnVl A1rAIMsVj98ZrytvywbppuMnaK6Yty28PbZQGTkMjp5QTgI0lf9nzpYGcTvPsyGTTl4R0V 0nWRmGdGre6pQJ3F3l1ms7VoDNp2yWhfHHeJB3GNog1C489DgJ4dbSMIdgcStA== 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 4WL8QK26NKzgwn; Fri, 12 Jul 2024 11:24: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 46CBOv0g092594; Fri, 12 Jul 2024 11:24:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBOvqp092591; Fri, 12 Jul 2024 11:24:57 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:24:57 GMT Message-Id: <202407121124.46CBOvqp092591@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3673801f5306 - main - Define mbuf tags for IPSEC_ACCEL in/out with ABI_COMPAT List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 3673801f53065529092ea22ecc2a07f306b984f2 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3673801f53065529092ea22ecc2a07f306b984f2 commit 3673801f53065529092ea22ecc2a07f306b984f2 Author: Konstantin Belousov AuthorDate: 2024-02-07 01:48:00 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 03:29:31 +0000 Define mbuf tags for IPSEC_ACCEL in/out with ABI_COMPAT The tags are used to pass the information about SA to/from the driver doing inline IPSEC offload. Sponsored by: NVIDIA networking --- sys/sys/mbuf.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 6e8454ea62d6..ab494a76833e 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1386,6 +1386,8 @@ extern bool mb_use_ext_pgs; /* Use ext_pgs for sendfile */ #define PACKET_TAG_IPSEC_NAT_T_PORTS 29 /* two uint16_t */ #define PACKET_TAG_ND_OUTGOING 30 /* ND outgoing */ #define PACKET_TAG_PF_REASSEMBLED 31 +#define PACKET_TAG_IPSEC_ACCEL_OUT 32 /* IPSEC accel out */ +#define PACKET_TAG_IPSEC_ACCEL_IN 33 /* IPSEC accel in */ /* Specific cookies and tags. */ From nobody Fri Jul 12 11:24:58 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QL48KZz5QBgX; Fri, 12 Jul 2024 11:24: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QL3JmKz4hlV; Fri, 12 Jul 2024 11:24:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783498; 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=SYnKnq36aYQuocv0ID8oi6FIJevxQqYoS+h6TA/aLAo=; b=YRvGkK3jsSvS3Mu1iJbBPtgXDHC4G2XHqvau9nf9I9COfTXK0bjFS76SgNob7UO4HqhSqE kRViaGDNdGVD6rBTKz2N6t/EEQILsTwYH9Eh4o5W4sF1Hb/sn2RzxFv0gLK4RsHzRzDC/h vcf4ryEJpRKh17LxADlqSqhr+1/XH25ks6G/4fHzpSBinKBk5liyAI5Fex1M7RHBjzrFQr KQW5dgy+cvXLyAO/6Pf0qVcup79zVdahh/3GuRPx6p7vdDZdSTQJXB4kCkkEEC6BkZdydw E5JduyWvN2P0p80XNycHu8KwfTIVMac6wMbwA8bRXBphmQnPFejdMnuMeVnKrA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783498; a=rsa-sha256; cv=none; b=vEOki1jn3zxhcJBJ1UU0DQsSrLeQL+wOALcXS1R18aSC2SCbkWvvS8IbnAWMqvVSYZhs0l 13DtmHpis+fWRdgwLQ1oAuIlm/yOaPA5xm9XUkdol++yeiWoM3ni80cW6NJLoEDoXWCdx9 d/Ajejk6npNKF8Rs3w16Xsw3qyL+N7Rpbcg1+7LYKRH/1qH+OSNiu2t0jSZIoWugUbvj26 5NUABN1zghWgpkx0ebiAMpA91spBjUU3kFB6DA1bkxmkux4BqJU5p4CnQEFElAF/oGJBo9 Oo3EgrPr4nH2XOzegK9Yb4pzSZGFWcycunGv1SM8bkXEB7VhlUc3IT6rvhqjhw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783498; 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=SYnKnq36aYQuocv0ID8oi6FIJevxQqYoS+h6TA/aLAo=; b=rImBxWu30cltnKzr+mHByotKVRcCIlZGyery6aFhCyE4cvcNOHvA03dy4raX+f4erdl1ku 60fmAXacRhpJbNMA2mjtS01SPN7gsYQgX2jq8z3HXmnNcA4YetMRdyXWkTq2HdKZvbwg2k FNGZ1ioOGrhK9cZdSi3ciBFwKavgQdB99z264271jWHktm7/4DWIe2N7nnHF0vofCJrrHT FYfa+Ctq/L7q4rIFqXjy7PiwJCEqRMsyjCVKVA+B3mVdnquPHGSINi6VREIEdukSnP4uQu KIRn8DXaIvU2SRIbXg0f1LOL7NT0QUFDL7WFxt6LBqbDoQzZrOcgzDAPnV6Gsg== 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 4WL8QL2tFWzhVf; Fri, 12 Jul 2024 11:24: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 46CBOwkb092651; Fri, 12 Jul 2024 11:24:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBOwO1092648; Fri, 12 Jul 2024 11:24:58 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:24:58 GMT Message-Id: <202407121124.46CBOwO1092648@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: da0efbdb8d95 - main - ip6_output: place IPSEC_OUTPUT hook after the outgoing ifp is calculated List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: da0efbdb8d952a1e9d15a5e332149e1f1092f5d9 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=da0efbdb8d952a1e9d15a5e332149e1f1092f5d9 commit da0efbdb8d952a1e9d15a5e332149e1f1092f5d9 Author: Konstantin Belousov AuthorDate: 2023-01-25 11:03:51 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 03:29:31 +0000 ip6_output: place IPSEC_OUTPUT hook after the outgoing ifp is calculated To be able to pass ifp and mtu to the ipsec_output() and ipsec accelerator filter. Sponsored by: NVIDIA networking Differential revision: https://reviews.freebsd.org/D44225 --- sys/netinet6/ip6_output.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 68dd376af5d0..7eea64bb6344 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -449,27 +449,6 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt, #endif } -#if defined(IPSEC) || defined(IPSEC_SUPPORT) - /* - * IPSec checking which handles several cases. - * FAST IPSEC: We re-injected the packet. - * XXX: need scope argument. - */ - if (IPSEC_ENABLED(ipv6)) { - m = mb_unmapped_to_ext(m); - if (m == NULL) { - IP6STAT_INC(ip6s_odropped); - error = ENOBUFS; - goto bad; - } - if ((error = IPSEC_OUTPUT(ipv6, ifp, m, inp, mtu)) != 0) { - if (error == EINPROGRESS) - error = 0; - goto done; - } - } -#endif /* IPSEC */ - /* Source address validation. */ ip6 = mtod(m, struct ip6_hdr *); if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src) && @@ -806,6 +785,27 @@ nonh6lookup: KASSERT((ifp != NULL), ("output interface must not be NULL")); KASSERT((origifp != NULL), ("output address interface must not be NULL")); +#if defined(IPSEC) || defined(IPSEC_SUPPORT) + /* + * IPSec checking which handles several cases. + * FAST IPSEC: We re-injected the packet. + * XXX: need scope argument. + */ + if (IPSEC_ENABLED(ipv6)) { + m = mb_unmapped_to_ext(m); + if (m == NULL) { + IP6STAT_INC(ip6s_odropped); + error = ENOBUFS; + goto bad; + } + if ((error = IPSEC_OUTPUT(ipv6, ifp, m, inp, mtu)) != 0) { + if (error == EINPROGRESS) + error = 0; + goto done; + } + } +#endif /* IPSEC */ + if ((flags & IPV6_FORWARDING) == 0) { /* XXX: the FORWARDING flag can be set for mrouting. */ in6_ifstat_inc(ifp, ifs6_out_request); From nobody Fri Jul 12 11:24:59 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QM6NyVz5QBpS; Fri, 12 Jul 2024 11:24: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QM4J1Lz4hp8; Fri, 12 Jul 2024 11:24:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783499; 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=xXy8isp+GZvlQ162OhIihgCgqQxf9/oIoDYsF7CQ/gc=; b=lqMSz6nhF/Wl0OgDHSHBd9XexyolYn25I4I3Orbu1MxQtsTdnGy8SlEByDYYk6FHZpueOD zRsW9NCBYfNnjgmospI163JgWfkyWNO0Ea3bU757/gII3r376nh8W2HRuR1kmbVUBD0XR1 W05AJ5RAtMHxgZPLzakgKHUADsNip2c8+Irv2ZMvdGeKn92tQ3+Y2RPpeqjtDwyNePoKDq iQHqJDMJkxZIRk1duaUF2qgqZdU59Da9M3rmLOqRn1rrtzxtF6Mudr1PUG+i7eCwJmQ5ei opVz5m51baHTsc0E8/5gvowbozFoFzJM1OJxGdzR2Ap+KK85dnCUT1pER/ozYg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783499; a=rsa-sha256; cv=none; b=QoY4BtBOSpyzxmnlSAPgBH6+kwpCvBXfB9JSef6MR2bMdxWHgqdI17FOeWQp8wnAf5HCdj DaMpXyNgCWghBI7ydZDOem6WxTzDI776L+8o+XdJ01xLiyC1XZc0VCosUXhcjF4JqsDyrA dnhs5MRWrm+W2qTq15gZUxxOUmAM31715ropFv2PM9zfxQlpBLE2rCHkKNdGa0OPLPOB0Y VpsQQCTkUDnXlkl2znoote2YcAr9Vi5KKR9S9mqjodlv0GQs6EyG5sdpl617IIi/OG2G+Q VqAtyfAIhz3yrsCqRAYNid6bafg9jaXGRzh1IM0HQmSfSaz4REoCwKY1Dkhchg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783499; 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=xXy8isp+GZvlQ162OhIihgCgqQxf9/oIoDYsF7CQ/gc=; b=RDeFmbN0Bj8qU6tPtWrevB0JJKmgmwXatXU4RwHk7UioSdffSc0SopO8Cznz1RplWltFQS +0Mk4R5ied0KFOweSnL/TeJT53SCKEq9aEy/CJNxKbaLT3Wy6b/KVWqMt0NrP3/28E6MdQ MWZAEba6Lcp2dQGZSj4WOGZt5cPnBZ5iBmps5lZ+EGn+FyifgvU/4bxu/FFZInqseoNP2W 8CBrzW7Fz4syS8T2wBFD+dgKJA8vHemBVXjl3eboBGrdKPDYgPaB8Su/XiJ4AVNNKuapeX eu9SpYdVv81qu9K/7ZmMnP8IDpAtA8YNQMH3U0JjwoITjrp8UPjeyJhG8fRtmg== 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 4WL8QM3vsHzhDx; Fri, 12 Jul 2024 11:24: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 46CBOxH3092708; Fri, 12 Jul 2024 11:24:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBOxlu092705; Fri, 12 Jul 2024 11:24:59 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:24:59 GMT Message-Id: <202407121124.46CBOxlu092705@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: b256ff9303ba - main - sys/pfkeyv2.h: define extensions for ipsec inline accel control List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: b256ff9303ba6457584de4fe695f8b0322cd5fdc Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b256ff9303ba6457584de4fe695f8b0322cd5fdc commit b256ff9303ba6457584de4fe695f8b0322cd5fdc Author: Konstantin Belousov AuthorDate: 2024-02-07 01:49:14 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 03:29:31 +0000 sys/pfkeyv2.h: define extensions for ipsec inline accel control The extensions allow to restrict interface where SP or SA are offloaded, and to receive software and hardware offload counters for given SA. Sponsored by: NVIDIA networking Differential revision: https://reviews.freebsd.org/D44316 --- sys/net/pfkeyv2.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/net/pfkeyv2.h b/sys/net/pfkeyv2.h index a0246c9223ba..8df7536f7563 100644 --- a/sys/net/pfkeyv2.h +++ b/sys/net/pfkeyv2.h @@ -296,6 +296,13 @@ struct sadb_x_sa_replay { }; _Static_assert(sizeof(struct sadb_x_sa_replay) == 8, "struct size mismatch"); +struct sadb_x_if_hw_offl { + u_int16_t sadb_x_if_hw_offl_len; + u_int16_t sadb_x_if_hw_offl_exttype; + u_int32_t sadb_x_if_hw_offl_flags; + u_int8_t sadb_x_if_hw_offl_if[32]; /* IF_NAMESIZE is 16, keep room */ +}; + #define SADB_EXT_RESERVED 0 #define SADB_EXT_SA 1 #define SADB_EXT_LIFETIME_CURRENT 2 @@ -326,7 +333,10 @@ _Static_assert(sizeof(struct sadb_x_sa_replay) == 8, "struct size mismatch"); #define SADB_X_EXT_SA_REPLAY 26 /* Replay window override. */ #define SADB_X_EXT_NEW_ADDRESS_SRC 27 #define SADB_X_EXT_NEW_ADDRESS_DST 28 -#define SADB_EXT_MAX 28 +#define SADB_X_EXT_LFT_CUR_SW_OFFL 29 +#define SADB_X_EXT_LFT_CUR_HW_OFFL 30 +#define SADB_X_EXT_IF_HW_OFFL 31 +#define SADB_EXT_MAX 31 #define SADB_SATYPE_UNSPEC 0 #define SADB_SATYPE_AH 2 From nobody Fri Jul 12 11:25:00 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QP00cLz5QBgc; Fri, 12 Jul 2024 11:25: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QN5bssz4hwh; Fri, 12 Jul 2024 11:25:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783500; 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=hblPQ/81LQvp7SgAoFhmptJ3EuqM3YACsdaBvLOOAbM=; b=PMbJ2g3JBNM5KThHIwpDStt81MrskGnELbsrJvBvQQa2c9n5A+T1HNJn8eaVOqruBHKGqo VbtzQfFTor9xOFA3PAIUaur5HfpxMntBJtevQ4Go7BQyGEQkYjg/3PtmPkNW7fQ7cB2EhW QYE/Tnxfof0bKQ0FYfFeEhZ4ePUN0Q3zqfeXaxUwmOS/BAfO6iqrplL+KNhxsorWXgna0u 8I2Pz8m7jtAZVXg8JmEkLuyealaQ4DbZxfXzlkBGVlquvGoltVtqirQq3O4/aqC98/SNwM VSm4wl+dEkv4qOJB8/GUdKPym7n0t9n0iYiYOGloqB5GrL8cizKsV+nb4H6Udw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783500; a=rsa-sha256; cv=none; b=Faz7+SuecdUJlLc9/py7YJP3V0TzgHYXRm6k+z/PNzmlHIUVuB9bWm7szn8fD8VFRh9cJK /iDhENrD7qA8w1EAa7Z0CZZvJh83JtRLUZrJ0966QdX4f6/tQV3th6ta23hAZjhHGWHRhp 2xolGDIV09TSeo0asAdfaGmDXiPTUGyel2Fz9vBNkWHmTN1CzmORojdmOfBF2zFe5K4b/F a7sVM77IcwC7VmXUCVlU0DvzvQZuZhKUd6XC3MQ/6rd8Mr54K93LS/aKtZpab3XcReotbA Y46Cs/6/b7WCeJjZS7nEjhrItTiY0HK9WSHUHnX7BuadMw6mmlxUiu7cj3y8Xw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783500; 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=hblPQ/81LQvp7SgAoFhmptJ3EuqM3YACsdaBvLOOAbM=; b=yKw6aH2GtdzQFt2MJ+ny70L+VV1k1X2+4iQtAt3biUKwNEqVwj662+anme+6Aw1o2jCY0f Pf/gar+4/6kWHU5Eo4H6nDy1DSNWrxbvh4hEFIMC9lz2K+kheQ7A8zrE5iiEtvdza2qsvl N+T8A0iZW6hyDzJzoiLmsdjqANheMnsfexiFHRLcpwTeh7+aPP8j9CqhaD3achArtW5Wt4 bAAu1Lv3Y1ldUBa/BShMMACpTyWMonbzuqy8moV4DdKDuw1lR2nHrx/hl3mz2eT1ekfWOn 6O4XVpB/TVGx9KKk/UAPRqY/4XIKio/FnyqUnWcqZP+5sgBjhO4WVmQHSWh88Q== 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 4WL8QN4vJ0zgwp; Fri, 12 Jul 2024 11:25: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 46CBP0Jr092773; Fri, 12 Jul 2024 11:25:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBP0Tw092770; Fri, 12 Jul 2024 11:25:00 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:25:00 GMT Message-Id: <202407121125.46CBP0Tw092770@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 1b1cd327d905 - main - setkey(8): print out SA sw/hw offload counters List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 1b1cd327d905fab5920e7af2582d15d48ad26999 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1b1cd327d905fab5920e7af2582d15d48ad26999 commit 1b1cd327d905fab5920e7af2582d15d48ad26999 Author: Konstantin Belousov AuthorDate: 2023-06-03 22:56:19 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 03:29:31 +0000 setkey(8): print out SA sw/hw offload counters Sponsored by: NVIDIA networking --- lib/libipsec/pfkey.c | 2 ++ lib/libipsec/pfkey_dump.c | 23 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/libipsec/pfkey.c b/lib/libipsec/pfkey.c index 31464d063241..2308dd3281a7 100644 --- a/lib/libipsec/pfkey.c +++ b/lib/libipsec/pfkey.c @@ -1713,6 +1713,8 @@ pfkey_align(struct sadb_msg *msg, caddr_t *mhp) case SADB_X_EXT_SA_REPLAY: case SADB_X_EXT_NEW_ADDRESS_SRC: case SADB_X_EXT_NEW_ADDRESS_DST: + case SADB_X_EXT_LFT_CUR_SW_OFFL: + case SADB_X_EXT_LFT_CUR_HW_OFFL: mhp[ext->sadb_ext_type] = (caddr_t)ext; break; default: diff --git a/lib/libipsec/pfkey_dump.c b/lib/libipsec/pfkey_dump.c index cd5961822751..2e69277fe6c2 100644 --- a/lib/libipsec/pfkey_dump.c +++ b/lib/libipsec/pfkey_dump.c @@ -201,7 +201,7 @@ pfkey_sadump(struct sadb_msg *m) caddr_t mhp[SADB_EXT_MAX + 1]; struct sadb_sa *m_sa; struct sadb_x_sa2 *m_sa2; - struct sadb_lifetime *m_lftc, *m_lfth, *m_lfts; + struct sadb_lifetime *m_lftc, *m_lfth, *m_lfts, *m_lft_sw, *m_lft_hw; struct sadb_address *m_saddr, *m_daddr, *m_paddr; struct sadb_key *m_auth, *m_enc; struct sadb_ident *m_sid, *m_did; @@ -240,7 +240,8 @@ pfkey_sadump(struct sadb_msg *m) natt_dport = (struct sadb_x_nat_t_port *)mhp[SADB_X_EXT_NAT_T_DPORT]; natt_oai = (struct sadb_address *)mhp[SADB_X_EXT_NAT_T_OAI]; natt_oar = (struct sadb_address *)mhp[SADB_X_EXT_NAT_T_OAR]; - + m_lft_sw = (struct sadb_lifetime *)mhp[SADB_X_EXT_LFT_CUR_SW_OFFL]; + m_lft_hw = (struct sadb_lifetime *)mhp[SADB_X_EXT_LFT_CUR_HW_OFFL]; /* source address */ if (m_saddr == NULL) { @@ -381,7 +382,23 @@ pfkey_sadump(struct sadb_msg *m) /* XXX DEBUG */ printf("refcnt=%u\n", m->sadb_msg_reserved); - return; + if (m_lft_sw != NULL) { + printf("\tsw offl use: %s", + str_time(m_lft_sw->sadb_lifetime_usetime)); + printf("\tsw offl allocated: %lu", + (unsigned long)m_lft_sw->sadb_lifetime_allocations); + str_lifetime_byte(m_lft_sw, "sw offl"); + printf("\n"); + } + + if (m_lft_hw != NULL) { + printf("\thw offl use: %s", + str_time(m_lft_hw->sadb_lifetime_usetime)); + printf("\thw offl allocated: %lu", + (unsigned long)m_lft_hw->sadb_lifetime_allocations); + str_lifetime_byte(m_lft_hw, "hw offl"); + printf("\n"); + } } void From nobody Fri Jul 12 11:25:01 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QQ1JhQz5QBjy; Fri, 12 Jul 2024 11:25:02 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QP6XK9z4j0V; Fri, 12 Jul 2024 11:25:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783501; 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=BM3KnbFWn0CANTbNLRZWWhDMxjrDVwCLgNvUsx83xTw=; b=Xa/a+k7K6kysLgM2jk98WVJVskokA4tJOSJ2vAVM6vRzNC1y5udoYd0VZd/nw3PB53nl4S VcFClywSSgTuDozqWCRqOuahAMgXUEATfq+3Vw4ULN4dOob+1EBLyyh6GuSqSLR+a3lUQV AH/AH0ywbld9VS+SW8L01tt9qBx47DxnIrTFnd3Ud8Zn7vFWDt2PyLB7pKdFi8O4zSGzD0 Tjw4cvoN3v7nZUgeZu9UiimINGR7kPB38Rk6JmhrIfmJ2Av1CfKHlveyHzPnpjHiZ0LJw+ Dvu4WjE/hFnlSIrv+YBjbDn3klMNZPtPuUL0cw8Wrazsu9o15GC2JIDApU9tZw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783501; a=rsa-sha256; cv=none; b=RpXcdfJZdLpxUzIw8OcGtIeJzXZNATFmoJAgb6UDKF/sneTSWY8n11oKfAxkUq4lOY5RA2 ksBqjLRojbiOJ/LF+r83ZTV+WdTwGc7cptxXMT9teKOKmpP3a+BaI7HEU632fV3O1Xmj6T wJtZdeT1/qn1Ycv1eW237PXMm4kjwsKVSVf40KuyJ86qO7waNl5NpVRFH5NP7cgo70vWMj h8rYkvzTp+Icj6Slv3cDxbYc5RHVGSAHZOCILKhCB8OTbaUPzFqNM1/CwxYqTCwYMzkNqJ UpDz8EbLSAfOH3LBJMX4Dgl3ZEsr0dP/q6neUk23r88XI+rcuFlgT9YJcxHh+A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783501; 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=BM3KnbFWn0CANTbNLRZWWhDMxjrDVwCLgNvUsx83xTw=; b=hxJHJcjpsRt2IRaWosCFTNspGtMRXQ76BgUCKq+KupcKIbkMeFN4jf+Vz4WdAb13s2VvEa LHxeBaI0G6b8bmFsUqOT10McJSfrfsmU8DG/DK+Mfvx7mGlwjR67AIAknZNKeOiJkAXrKR 1g9OdWYgppcLyh2wsD9PECC4O+pjNTGZRMEUPKnhQeAhbYq6lUtmCmVwf0dBheCEot8voP 0DKURDonwt4mjDbogTLNLLHVYOTs52C1kswAWJmBh7g6LQTYq6XNKqkpSwBMaSoixNV64R Iw+ijmgnRRabnL/DjffH524UMgl5/WC+UY4YrlXXJ6HwNkFkEjDhqnZd68oYkQ== 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 4WL8QP5slhzgwq; Fri, 12 Jul 2024 11:25: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 46CBP1n2092816; Fri, 12 Jul 2024 11:25:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBP1oG092813; Fri, 12 Jul 2024 11:25:01 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:25:01 GMT Message-Id: <202407121125.46CBP1oG092813@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3d95e9e3fe24 - main - libipsec: decode SADB_X_EXT_IF_HW_OFFL List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 3d95e9e3fe24f598a37c30e0418c49cfcec1b502 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3d95e9e3fe24f598a37c30e0418c49cfcec1b502 commit 3d95e9e3fe24f598a37c30e0418c49cfcec1b502 Author: Konstantin Belousov AuthorDate: 2023-09-04 18:32:27 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 03:29:31 +0000 libipsec: decode SADB_X_EXT_IF_HW_OFFL Sponsired by: NVIDIA networking --- lib/libipsec/pfkey.c | 4 +++- lib/libipsec/pfkey_dump.c | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/libipsec/pfkey.c b/lib/libipsec/pfkey.c index 2308dd3281a7..d5a033c4c501 100644 --- a/lib/libipsec/pfkey.c +++ b/lib/libipsec/pfkey.c @@ -1677,7 +1677,8 @@ pfkey_align(struct sadb_msg *msg, caddr_t *mhp) /* duplicate check */ /* XXX Are there duplication either KEY_AUTH or KEY_ENCRYPT ?*/ - if (mhp[ext->sadb_ext_type] != NULL) { + if (mhp[ext->sadb_ext_type] != NULL && + ext->sadb_ext_type != SADB_X_EXT_IF_HW_OFFL /* XXXKIB */) { __ipsec_errcode = EIPSEC_INVAL_EXTTYPE; return -1; } @@ -1715,6 +1716,7 @@ pfkey_align(struct sadb_msg *msg, caddr_t *mhp) case SADB_X_EXT_NEW_ADDRESS_DST: case SADB_X_EXT_LFT_CUR_SW_OFFL: case SADB_X_EXT_LFT_CUR_HW_OFFL: + case SADB_X_EXT_IF_HW_OFFL: mhp[ext->sadb_ext_type] = (caddr_t)ext; break; default: diff --git a/lib/libipsec/pfkey_dump.c b/lib/libipsec/pfkey_dump.c index 2e69277fe6c2..8dcc21be16e2 100644 --- a/lib/libipsec/pfkey_dump.c +++ b/lib/libipsec/pfkey_dump.c @@ -43,6 +43,7 @@ #include #include +#include #include #include #include @@ -210,6 +211,10 @@ pfkey_sadump(struct sadb_msg *m) struct sadb_x_nat_t_type *natt_type; struct sadb_x_nat_t_port *natt_sport, *natt_dport; struct sadb_address *natt_oai, *natt_oar; + struct sadb_x_if_hw_offl *if_hw_offl; + caddr_t p, ep; + struct sadb_ext *ext; + bool first; /* check pfkey message. */ if (pfkey_align(m, mhp)) { @@ -242,6 +247,7 @@ pfkey_sadump(struct sadb_msg *m) natt_oar = (struct sadb_address *)mhp[SADB_X_EXT_NAT_T_OAR]; m_lft_sw = (struct sadb_lifetime *)mhp[SADB_X_EXT_LFT_CUR_SW_OFFL]; m_lft_hw = (struct sadb_lifetime *)mhp[SADB_X_EXT_LFT_CUR_HW_OFFL]; + if_hw_offl = (struct sadb_x_if_hw_offl *)mhp[SADB_X_EXT_IF_HW_OFFL]; /* source address */ if (m_saddr == NULL) { @@ -333,6 +339,27 @@ pfkey_sadump(struct sadb_msg *m) GETMSGSTR(str_state, m_sa->sadb_sa_state); printf("\n"); + /* hw offload interface */ + if (if_hw_offl != NULL) { + p = (caddr_t)m; + ep = p + PFKEY_UNUNIT64(m->sadb_msg_len); + p += sizeof(struct sadb_msg); + printf("\thw offl if: "); + + for (first = true; p < ep; p += PFKEY_EXTLEN(ext)) { + ext = (struct sadb_ext *)p; + if (ext->sadb_ext_type != SADB_X_EXT_IF_HW_OFFL) + continue; + if_hw_offl = (struct sadb_x_if_hw_offl *)ext; + if (first) + first = false; + else + printf(","); + printf("%s", if_hw_offl->sadb_x_if_hw_offl_if); + } + printf("\n"); + } + /* lifetime */ if (m_lftc != NULL) { time_t tmp_time = time(0); From nobody Fri Jul 12 11:25:02 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QR3Pr8z5QBrc; Fri, 12 Jul 2024 11:25: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QR09lZz4jD4; Fri, 12 Jul 2024 11:25:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783503; 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=AV8keYdxoBj7VetCSIv+blhXpwXgT4TuZlIbNm68v2I=; b=ojGGSgxlgWttpqSiCupN4Q6oXLqOCHF6Bnye7ARcRAAFpH91dtdtr3Ev5LK1fnxYMisYgJ vEypNvceUVA/vuhyIVcaD83wI+WnLJYHAcilJLnjzpWyZIhHjCogUlXV72MgJxFHpNo7hZ fReVrH1bXu/0jbmiC1oq5avYuajOO+s3EHLkMTMFVhNerglatiQmCGkZKIvX28S0y2J3FK 3hY4+nQQG5i8rjKEoiXb7J2SRxZb6+jRWzg6iptDG6CnCsiYTt0pzplg6ofAlRo8+ZkT0q zsT5myLlGDUAcTKMDkNbVOc7t1oJgwKOV2/YTsgfNpHCMz7QKTWNIi1P0IUNBA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783503; a=rsa-sha256; cv=none; b=vWpGOPWDpRnymLxdvxE2Xt8OMiyDlrYjFcuLg4tdTjPsd23yUEcQJRcNnh+yp+yuUimAaI Kol3+50lFKLLwFlZuBOAa+3K1WKUhiw4MI8WK6btDF0qXllzNC5YCHXK0mOTUyeCQHCLUk CkUcpoFE9TECVS05f5x5BBwHMfn2GQSyi56uQb0qKqSp81x/ZkIwJhzrywPo3JydjhM6G/ oz7dXsoDXhctagykPVrVDf5iBDMpZPiiOwj0cXJRKnT7ErxYmPjhGamCE2UYdndbZBcWWA ZXUJvqoRqh1vFdSIexNjiyfkSiYseRCFVoVYT4EpbFeJB+FmYsUKA0aCj63IDg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783503; 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=AV8keYdxoBj7VetCSIv+blhXpwXgT4TuZlIbNm68v2I=; b=tiVA8yi1ItT+LylZ53E0E89dUmDjAsCeDl8OO1W7Efe/b6rV+oL9Xvb0IKhKJqdQOCL9CN CEd+ZCFd2Fw5P0omIEwmYtXrHJ6ow5iVpUjRj79SfLz5tClYGGGLzqJkNZktn7s1udBlni g6/kvnoIMtT4DHENCA1BpkoAKgN+CpUC4GKP5LUQZVcY7Zwj66Ufm+Rc6gKopN4AVLrDlV xEw1rymFkYVv1HauUxsCb9XfndKtDrktdhdjpwsUxBgvEvB4DMfcg8VqNEYpYjTN9OuQrU f8XATdTBIgTBcmp34QiEUOkH6U1QhVvgNNfC0jvNzLI80/GPbVzRdp/s/QvcWg== 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 4WL8QQ6vJTzhDy; Fri, 12 Jul 2024 11:25: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 46CBP2vj092871; Fri, 12 Jul 2024 11:25:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBP2cs092868; Fri, 12 Jul 2024 11:25:02 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:25:02 GMT Message-Id: <202407121125.46CBP2cs092868@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9b93b2d8b039 - main - setkey(8): add -esn extension option to enable ESN List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 9b93b2d8b039e24d8e2505a6aaf8bc1f29863052 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9b93b2d8b039e24d8e2505a6aaf8bc1f29863052 commit 9b93b2d8b039e24d8e2505a6aaf8bc1f29863052 Author: Konstantin Belousov AuthorDate: 2023-09-07 12:04:49 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 03:29:32 +0000 setkey(8): add -esn extension option to enable ESN Sponsored by: NVIDIA networking --- sbin/setkey/parse.y | 10 ++++++++++ sbin/setkey/setkey.8 | 2 ++ sbin/setkey/token.l | 1 + 3 files changed, 13 insertions(+) diff --git a/sbin/setkey/parse.y b/sbin/setkey/parse.y index 448a8ee5278c..27a0109db333 100644 --- a/sbin/setkey/parse.y +++ b/sbin/setkey/parse.y @@ -46,6 +46,7 @@ #include #include +#include #include #include #include @@ -68,6 +69,7 @@ u_int p_natt_type; struct addrinfo *p_natt_oai, *p_natt_oar; int p_natt_sport, p_natt_dport; int p_natt_fraglen; +bool esn; static int p_aiflags = 0, p_aifamily = PF_UNSPEC; @@ -115,6 +117,7 @@ extern void yyerror(const char *); %token SPDADD SPDDELETE SPDDUMP SPDFLUSH %token F_POLICY PL_REQUESTS %token F_AIFLAGS F_NATT F_NATT_MTU +%token F_ESN %token TAGGED %type prefix protocol_spec upper_spec @@ -539,6 +542,11 @@ extension { p_natt_fraglen = $2; } + | F_ESN + { + esn = true; + p_ext |= SADB_X_SAFLAGS_ESN; + } ; /* definition about command for SPD management */ @@ -1355,6 +1363,8 @@ parse_init(void) p_natt_oai = p_natt_oar = NULL; p_natt_sport = p_natt_dport = 0; p_natt_fraglen = -1; + + esn = false; } void diff --git a/sbin/setkey/setkey.8 b/sbin/setkey/setkey.8 index 88b4dc6fc91f..23a838f76541 100644 --- a/sbin/setkey/setkey.8 +++ b/sbin/setkey/setkey.8 @@ -341,6 +341,8 @@ symbols are part of the syntax for the ports specification, not indication of the optional components. .It Fl natt_mtu Ar fragsize Configure NAT-T fragment size. +.It Fl esn +Enable Extended Sequence Number extension for this SA. .El .\" .Pp diff --git a/sbin/setkey/token.l b/sbin/setkey/token.l index 054a57ef1015..b96eaf93924c 100644 --- a/sbin/setkey/token.l +++ b/sbin/setkey/token.l @@ -187,6 +187,7 @@ nocyclic-seq { return(NOCYCLICSEQ); } {hyphen}ls { return(F_LIFETIME_SOFT); } {hyphen}natt { return(F_NATT); } {hyphen}natt_mtu { return(F_NATT_MTU); } +{hyphen}esn { return(F_ESN); } /* ... */ any { return(ANY); } From nobody Fri Jul 12 11:25:03 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QS5qRRz5QBvH; Fri, 12 Jul 2024 11:25:04 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QS2TBMz4j7g; Fri, 12 Jul 2024 11:25:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783504; 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=/HfLj85O6QTSjNec2sncCwKbXgZk0KItsx1nh9oEd3s=; b=LzLw/Nq/jKj7z4ZOONyO3D/A1/LTkf6OlJYWyEYqPU+GmXE8Gt6HkfV6BH7jKnNsVF3+/g QwatUuoubYG1r01jI3w17v/DpghlmmKCc7DKTbrT+lljnKdLTnZRdQ6cdpX4TUEQ0ig817 3D5ewyJ04XpXG5xxuVBeaj2K7dj9btVc4TSsqpJTbu+hOS24L+/TIHTlNUNGAxlWgZfyTW ZYMT8+cF0tTjuTVyJkTa9pX5DjECtnKRdHYyBKwFNAWBNKM3MOp7jJ3qWE36C+vtw85k0N 1ycdf4yRCqHxPozBuKnCHDQeGGqYC98+s2pEWqH57dOQQFcBK9OU6pSQK2Gajg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783504; a=rsa-sha256; cv=none; b=gNi5gtE5jPutEiXAlV9p1ENnyhlRFuTves52k6msEuFcBQ2N+wdGChdeh2oERCDvbFlEgM iJNFdAiJXow90WOKTUAvD5HSHvEoGkvT1GVQ+etKnzu21Pw4hq+wX1Fdf25uZz10GdotGp LIDUv6hnI0LWguy1YNUSkmpcUsayzUU+JUOuECLHUr0MjcCp6D2jgjqo9PFJAR1aVE2Fb5 1wUy3pvmoyw42GbkaYi3nPAjXdRamnZ2YjujeEIArRMMoS+cLvplBaC2uS/I+M0BXX/3sB SKNIByj9ugPqCqU2FNen4OiIvO2I1vV8ULPIGQK88G8lExftRuF5hAsxe8c0cQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783504; 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=/HfLj85O6QTSjNec2sncCwKbXgZk0KItsx1nh9oEd3s=; b=gE6nWSNW/1zW1fQFIsTlHH/DJWIWer4KU2k9pEqVM6u/LipcUYZ6I/xjAZ6wCzOBUUzmAX SbM8C34rjKrJ7quEtu2307kT3BH7xie9c8ZkMzx2/DukjW2+JzHpkiyETeePnn1jqFU7LE U1zrok2SQfRpPhKEFP/qYhjRzQUXrL0xaTkX91WlvbdVpy/M+zOnLbkROuafK2SiBs1gN2 lF6drGMrkuo0AZPhn97qXAdm6pJqZQiD1s7bqe12uUH6Xfo00xoRRIuP9WMHquHt5W0ASl 7FXW831nAbd5FA+NiOKbGhifVf0Af8mH6uDtZtu9CsxTS79VRiWj/WWjgJ81iw== 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 4WL8QS0dfRzhVg; Fri, 12 Jul 2024 11:25:04 +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 46CBP3n7092934; Fri, 12 Jul 2024 11:25:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBP3i2092931; Fri, 12 Jul 2024 11:25:03 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:25:03 GMT Message-Id: <202407121125.46CBP3i2092931@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 83418c878b75 - main - setkey(8): add -hwif extension to specify offload interface for SA and SPD List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 83418c878b75fafd5f9bfc44baf049487ce99a86 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=83418c878b75fafd5f9bfc44baf049487ce99a86 commit 83418c878b75fafd5f9bfc44baf049487ce99a86 Author: Konstantin Belousov AuthorDate: 2023-09-18 02:04:45 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 03:29:32 +0000 setkey(8): add -hwif extension to specify offload interface for SA and SPD Sponsored by: NVIDIA networking --- sbin/setkey/parse.y | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- sbin/setkey/token.l | 1 + 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/sbin/setkey/parse.y b/sbin/setkey/parse.y index 27a0109db333..a7bcd2d8dafc 100644 --- a/sbin/setkey/parse.y +++ b/sbin/setkey/parse.y @@ -70,6 +70,7 @@ struct addrinfo *p_natt_oai, *p_natt_oar; int p_natt_sport, p_natt_dport; int p_natt_fraglen; bool esn; +vchar_t p_hwif; static int p_aiflags = 0, p_aifamily = PF_UNSPEC; @@ -117,7 +118,7 @@ extern void yyerror(const char *); %token SPDADD SPDDELETE SPDDUMP SPDFLUSH %token F_POLICY PL_REQUESTS %token F_AIFLAGS F_NATT F_NATT_MTU -%token F_ESN +%token F_ESN F_HWIF %token TAGGED %type prefix protocol_spec upper_spec @@ -547,12 +548,16 @@ extension esn = true; p_ext |= SADB_X_SAFLAGS_ESN; } + | F_HWIF STRING + { + p_hwif = $2; + } ; /* definition about command for SPD management */ /* spdadd */ spdadd_command - : SPDADD ipaddropts STRING prefix portstr STRING prefix portstr upper_spec upper_misc_spec policy_spec EOT + : SPDADD ipaddropts STRING prefix portstr STRING prefix portstr upper_spec upper_misc_spec policy_spec spd_hwif EOT { int status; struct addrinfo *src, *dst; @@ -656,6 +661,14 @@ ipaddropts | ipaddropts ipaddropt ; +spd_hwif + : + | F_HWIF STRING + { + p_hwif = $2; + } + ; + ipaddropt : F_AIFLAGS { @@ -839,6 +852,7 @@ setkeymsg_spdaddr(unsigned type, unsigned upper, vchar_t *policy, char buf[BUFSIZ]; int l, l0; struct sadb_address m_addr; + struct sadb_x_if_hw_offl m_if_hw; struct addrinfo *s, *d; int n; int plen; @@ -857,6 +871,20 @@ setkeymsg_spdaddr(unsigned type, unsigned upper, vchar_t *policy, memcpy(buf + l, policy->buf, policy->len); l += policy->len; + if (p_hwif.len != 0) { + l0 = sizeof(struct sadb_x_if_hw_offl); + m_if_hw.sadb_x_if_hw_offl_len = PFKEY_UNIT64(l0); + m_if_hw.sadb_x_if_hw_offl_exttype = SADB_X_EXT_IF_HW_OFFL; + m_if_hw.sadb_x_if_hw_offl_flags = 0; + memset(&m_if_hw.sadb_x_if_hw_offl_if[0], 0, + sizeof(m_if_hw.sadb_x_if_hw_offl_if)); + strlcpy(&m_if_hw.sadb_x_if_hw_offl_if[0], p_hwif.buf, + sizeof(m_if_hw.sadb_x_if_hw_offl_if)); + + memcpy(buf + l, &m_if_hw, l0); + l += l0; + } + l0 = l; n = 0; @@ -1048,6 +1076,7 @@ setkeymsg_add(unsigned type, unsigned satype, struct addrinfo *srcs, struct sadb_x_nat_t_type m_natt_type; struct sadb_x_nat_t_port m_natt_port; struct sadb_x_nat_t_frag m_natt_frag; + struct sadb_x_if_hw_offl m_if_hw; int n; int plen; struct sockaddr *sa; @@ -1264,6 +1293,20 @@ setkeymsg_add(unsigned type, unsigned satype, struct addrinfo *srcs, } } + if (p_hwif.len != 0) { + len = sizeof(struct sadb_x_if_hw_offl); + m_if_hw.sadb_x_if_hw_offl_len = PFKEY_UNIT64(len); + m_if_hw.sadb_x_if_hw_offl_exttype = SADB_X_EXT_IF_HW_OFFL; + m_if_hw.sadb_x_if_hw_offl_flags = 0; + memset(&m_if_hw.sadb_x_if_hw_offl_if[0], 0, + sizeof(m_if_hw.sadb_x_if_hw_offl_if)); + strlcpy(&m_if_hw.sadb_x_if_hw_offl_if[0], p_hwif.buf, + sizeof(m_if_hw.sadb_x_if_hw_offl_if)); + + memcpy(buf + l, &m_if_hw, len); + l += len; + } + if (n == 0) return -1; else @@ -1365,6 +1408,8 @@ parse_init(void) p_natt_fraglen = -1; esn = false; + p_hwif.len = 0; + p_hwif.buf = NULL; } void diff --git a/sbin/setkey/token.l b/sbin/setkey/token.l index b96eaf93924c..65756f0fd12c 100644 --- a/sbin/setkey/token.l +++ b/sbin/setkey/token.l @@ -188,6 +188,7 @@ nocyclic-seq { return(NOCYCLICSEQ); } {hyphen}natt { return(F_NATT); } {hyphen}natt_mtu { return(F_NATT_MTU); } {hyphen}esn { return(F_ESN); } +{hyphen}hwif { return(F_HWIF); } /* ... */ any { return(ANY); } From nobody Fri Jul 12 11:25:06 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QV5lcrz5QBvL; Fri, 12 Jul 2024 11:25:06 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QV3bxzz4j3S; Fri, 12 Jul 2024 11:25:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783506; 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=sCt3CP9MW9yCIyTG9NQ+w1DsxIT0DinH4oqOA1N4e7Q=; b=tqaKPJe0GqusN+oZFa25itPTdyPCiT98MhNK5U7O6yiSZJJyfDInbxuYA6f1dsELygeMB8 qPeU5HrHomyLBDcnF43zemmrvvH7+Jeea3hYeDbg3tSb3c1FgCFsKM4E/q2piUGGxwhneq jcr/VHisTRqxHW0frdMAii/reycB72v3bzZgeU03Jimj06y/hXovSoPzUvIIjM5zcmkbYH d6ZSfHY3MorAz2VMlrRrBOXm8qARlwtiVjGAdN3jRuK1EvUQJBMtEgcghsbPc67ssW2wCT RHixfRd1qLwrPNZltpZMB2bd5uc3xYJl/mAzvA2ZVuubUvyejXfaFMJblrPiiw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783506; a=rsa-sha256; cv=none; b=AKQcprzr0cdhZoyh4ESXTLLfex0lT1VoHHHH6aGxGqQ5PpLRC4XWAWUJ2v/aOZ6zylPsTk PYKbJtZ3WOMk2fpTFu4OaODwFcEc/74gJBlXM2rEEEGJoS4YQMp7/HaJaOXvMPMBQO7Zox jlsCg8vVOg0vejk6XCPE5grr8UJjTqNQnfGCH4AKSHsrV9IJlWg19XBa2HOyDTqwNdixe0 /mEgB1XmtVa5jA4NwylIhpcB+M5b/UqQJ6JNEH/w7WuFUleTdnL5k+YfsKEjQz9MtPnAE/ Hl4jw/lEEa/Pwp2qlxQGcZBenu06deAijpAY76BioATTg+pYsSML/X3GjWmbNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783506; 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=sCt3CP9MW9yCIyTG9NQ+w1DsxIT0DinH4oqOA1N4e7Q=; b=AsHcyrxtsYyek8CEQR/DUebI8Ues9V5P1dACRTm3fYzJngxgODpXZxaClcaJ3zIui8M2BM 0fMEBge+Fs6VgH6AXFPSQSj9BJ+Z67DBznJ0EVNYBFbb/oG5zoqxI5VVA7RttkNOn3FTk0 pRJROg5/ZA2LHwU8IL/vRTv+7twenwFxQWpsDpKxgoFTnUOG1mapo/TjB2OkCgpHRWKocb B2b0Kvv7Jz4jGv+i5GLHIgWgHHVxM6PHnzzQMXh9nmT5PkfJRqbcH6Z+oHxwojUTj8LSFY 6QZ1psNJ1c41QMocjMPmbqSvLSqdHlkcZXDAKid8lQbjAPTrfn1W+aU8mAx6OA== 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 4WL8QV2ZYrzhGv; Fri, 12 Jul 2024 11:25:06 +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 46CBP6c5093025; Fri, 12 Jul 2024 11:25:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBP6eJ093022; Fri, 12 Jul 2024 11:25:06 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:25:06 GMT Message-Id: <202407121125.46CBP6eJ093022@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9d269938e300 - main - ipsec_offload: ifconfig support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 9d269938e300a99481e4d28d3a49122201f9bc4f Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9d269938e300a99481e4d28d3a49122201f9bc4f commit 9d269938e300a99481e4d28d3a49122201f9bc4f Author: Konstantin Belousov AuthorDate: 2023-03-30 22:49:08 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 03:29:32 +0000 ipsec_offload: ifconfig support Sponsored by: NVIDIA networking --- sbin/ifconfig/ifconfig.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 615de5d4ae14..e6ed9015b34b 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -2144,6 +2144,8 @@ static struct cmd basic_cmds[] = { setifcapnv), DEF_CMD_SARG("-rxtls", "-"IFCAP2_RXTLS4_NAME ",-" IFCAP2_RXTLS6_NAME, setifcapnv), + DEF_CMD_SARG("ipsec", IFCAP2_IPSEC_OFFLOAD_NAME, setifcapnv), + DEF_CMD_SARG("-ipsec", "-"IFCAP2_IPSEC_OFFLOAD_NAME, setifcapnv), DEF_CMD("wol", IFCAP_WOL, setifcap), DEF_CMD("-wol", IFCAP_WOL, clearifcap), DEF_CMD("wol_ucast", IFCAP_WOL_UCAST, setifcap), From nobody Fri Jul 12 11:25:05 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QT3xZTz5QBkB; Fri, 12 Jul 2024 11:25:05 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QT23S9z4j7y; Fri, 12 Jul 2024 11:25:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783505; 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=qA0GejZFLzAqUveOw/QcGas+DUXNB5j2OqnU+/IYbkw=; b=Uo1N2Ih9cDs6b0+g3hlNSdhyImYqO75DdsuUmw+SgcHpmCgFbN/X+asZpHO2/kaRkbw9DI KtfOb/gPBJR4vHZlFZJqoj/0h2NwJSdS/7ZDNcgq8vpuCj3eb6PsYl80vyAiexKItxUYfG giPnjR7W9QG1E0iFc1yylMljA/3Zd8E+IZVA5Nolf43snjJdMnK1OJNATcIQia7pNygUjp qKaZJ+dxG2Xl4H58mH1fV86RyM2mA13Wev6G+lXFgi9dsmuQhiKnMqhuHb1Wr/RHKS5Rof /IzQU+awdguPONemwEePBLHQpBIKdxnm6MN7Y5dZlPJwvm7UrgoVNsmLC2hDYw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783505; a=rsa-sha256; cv=none; b=Ihaxl/tinwcItud2boiTNT1sb1i14izrW7fZZoH0GVbcZziQnKQNGvowo4eAmTWUlnBUQG /PogbEJy0HdUHtofPB1vP67JVFtnbMqrIud6tYVvw3HIH10CjIk3BY+clfNAwqxSTcwxQk Io8AhpGpUnRsvEN7quRKIW5w0T/wJpu5iE1rxlCctU2eWZHgyQ92mXzxiaZ1KXzBg81/dZ N8UmSYOJWKv4Qr5ef1O36p6zzEw1Tu3WOGU4kV169v2CGfjck3RXxoXup2J2yJDLfrO95b Y3C+skk76444+w9xjl49jx4EBnsNLRFMBufXr6RFvAI+NrqaznW1xZdty1Y49w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783505; 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=qA0GejZFLzAqUveOw/QcGas+DUXNB5j2OqnU+/IYbkw=; b=mEf++Th65Wos18ILa1nQW5JKfzacJL9sMXmPcDUJAQsnXAB6pK0mxkrlDP0Akn0ouH/orp gUAVVehVYpxZ8memz3pqKRsR4EqnJ/hEwlNPadvnQ8Pn0FDNXJ/XH52sa/waMqj93aZJrk MQMMAPysyHqzOo6GV/mFdgBxtmNwr6CBdwNienKbK6QWq4iq3gDlQGvdYVJEY04nNjJTXb D1GHnEtdr5Dih7gL54KRZcqBOGPDwzNObZadW6wVBef+G808ZhKG7Q1RkpDq7yFnVi+WjA GzM7c0jWze4//CnaU4Xpkv9aF7A7eJg4sI2EP8SAmDdlCjg4HVycuOisG6JuHQ== 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 4WL8QT1gThzhgh; Fri, 12 Jul 2024 11:25:05 +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 46CBP5mV092987; Fri, 12 Jul 2024 11:25:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBP56s092984; Fri, 12 Jul 2024 11:25:05 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:25:05 GMT Message-Id: <202407121125.46CBP56s092984@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 2131654bde1f - main - sys/net: Add IPSEC_OFFLOAD interface cap and methods structure List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 2131654bde1f91b04c959b388cffbf825a433d27 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2131654bde1f91b04c959b388cffbf825a433d27 commit 2131654bde1f91b04c959b388cffbf825a433d27 Author: Konstantin Belousov AuthorDate: 2024-02-07 01:51:21 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 03:29:32 +0000 sys/net: Add IPSEC_OFFLOAD interface cap and methods structure Reviewed by: glebius Sponsored by: NVIDIA networking Differential revision: https://reviews.freebsd.org/D44314 --- sys/net/if.c | 7 +++++++ sys/net/if.h | 4 +++- sys/net/if_private.h | 2 ++ sys/net/if_strings.h | 3 +++ sys/net/if_var.h | 30 ++++++++++++++++++++++++++++++ 5 files changed, 45 insertions(+), 1 deletion(-) diff --git a/sys/net/if.c b/sys/net/if.c index ee8fe533f338..604a93aa7cba 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -2392,6 +2392,7 @@ const struct ifcap_nv_bit_name ifcap_nv_bit_names[] = { const struct ifcap_nv_bit_name ifcap2_nv_bit_names[] = { CAP2NV(RXTLS4), CAP2NV(RXTLS6), + CAP2NV(IPSEC_OFFLOAD), {0, NULL} }; #undef CAPNV @@ -5149,6 +5150,12 @@ if_getl2com(if_t ifp) return (ifp->if_l2com); } +void +if_setipsec_accel_methods(if_t ifp, const struct if_ipsec_accel_methods *m) +{ + ifp->if_ipsec_accel_m = m; +} + #ifdef DDB static void if_show_ifnet(struct ifnet *ifp) diff --git a/sys/net/if.h b/sys/net/if.h index cbd69b4912ed..5c4b0637b25a 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -255,7 +255,8 @@ struct if_data { #define IFCAP_B_TXTLS_RTLMT 31 /* can do TLS with rate limiting */ #define IFCAP_B_RXTLS4 32 /* can to TLS receive for TCP */ #define IFCAP_B_RXTLS6 33 /* can to TLS receive for TCP6 */ -#define __IFCAP_B_SIZE 34 +#define IFCAP_B_IPSEC_OFFLOAD 34 /* inline IPSEC offload */ +#define __IFCAP_B_SIZE 35 #define IFCAP_B_MAX (__IFCAP_B_MAX - 1) #define IFCAP_B_SIZE (__IFCAP_B_SIZE) @@ -298,6 +299,7 @@ struct if_data { /* IFCAP2_* are integers, not bits. */ #define IFCAP2_RXTLS4 (IFCAP_B_RXTLS4 - 32) #define IFCAP2_RXTLS6 (IFCAP_B_RXTLS6 - 32) +#define IFCAP2_IPSEC_OFFLOAD (IFCAP_B_IPSEC_OFFLOAD - 32) #define IFCAP2_BIT(x) (1UL << (x)) diff --git a/sys/net/if_private.h b/sys/net/if_private.h index 1aaf9d217f0d..3da529e6b22e 100644 --- a/sys/net/if_private.h +++ b/sys/net/if_private.h @@ -138,6 +138,8 @@ struct ifnet { int (*if_requestencap) /* make link header from request */ (struct ifnet *, struct if_encap_req *); + const struct if_ipsec_accel_methods *if_ipsec_accel_m; + /* Statistics. */ counter_u64_t if_counters[IFCOUNTERS]; diff --git a/sys/net/if_strings.h b/sys/net/if_strings.h index bea15cfa9de5..a127fa273a8b 100644 --- a/sys/net/if_strings.h +++ b/sys/net/if_strings.h @@ -60,9 +60,11 @@ #define IFCAP_TXTLS_RTLMT_NAME "TXTLS_RTLMT" #define IFCAP_RXTLS4_NAME "RXTLS4" #define IFCAP_RXTLS6_NAME "RXTLS6" +#define IFCAP_IPSEC_OFFLOAD_NAME "IPSEC" #define IFCAP2_RXTLS4_NAME IFCAP_RXTLS4_NAME #define IFCAP2_RXTLS6_NAME IFCAP_RXTLS6_NAME +#define IFCAP2_IPSEC_OFFLOAD_NAME IFCAP_IPSEC_OFFLOAD_NAME static const char *ifcap_bit_names[] = { IFCAP_RXCSUM_NAME, @@ -99,6 +101,7 @@ static const char *ifcap_bit_names[] = { IFCAP_TXTLS_RTLMT_NAME, IFCAP_RXTLS4_NAME, IFCAP_RXTLS6_NAME, + IFCAP_IPSEC_OFFLOAD_NAME, }; #ifdef IFCAP_B_SIZE diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 1b9e158a1b29..3e094dcb3cd5 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -131,6 +131,23 @@ typedef void (*if_qflush_fn_t)(if_t); typedef int (*if_transmit_fn_t)(if_t, struct mbuf *); typedef uint64_t (*if_get_counter_t)(if_t, ift_counter); typedef void (*if_reassign_fn_t)(if_t, struct vnet *, char *); +typedef int (*if_spdadd_fn_t)(if_t, void *sp, void *inp, void **priv); +typedef int (*if_spddel_fn_t)(if_t, void *sp, void *priv); +typedef int (*if_sa_newkey_fn_t)(if_t ifp, void *sav, u_int drv_spi, + void **privp); +typedef int (*if_sa_deinstall_fn_t)(if_t ifp, u_int drv_spi, void *priv); +struct seclifetime; +#define IF_SA_CNT_UPD 0x80000000 +enum IF_SA_CNT_WHICH { + IF_SA_CNT_IFP_HW_VAL = 1, + IF_SA_CNT_TOTAL_SW_VAL, + IF_SA_CNT_TOTAL_HW_VAL, + IF_SA_CNT_IFP_HW_UPD = IF_SA_CNT_IFP_HW_VAL | IF_SA_CNT_UPD, + IF_SA_CNT_TOTAL_SW_UPD = IF_SA_CNT_TOTAL_SW_VAL | IF_SA_CNT_UPD, + IF_SA_CNT_TOTAL_HW_UPD = IF_SA_CNT_TOTAL_HW_VAL | IF_SA_CNT_UPD, +}; +typedef int (*if_sa_cnt_fn_t)(if_t ifp, void *sa, + uint32_t drv_spi, void *priv, struct seclifetime *lt); struct ifnet_hw_tsomax { u_int tsomaxbytes; /* TSO total burst length limit in bytes */ @@ -700,6 +717,19 @@ void if_setdebugnet_methods(if_t, struct debugnet_methods *); void if_setreassignfn(if_t ifp, if_reassign_fn_t); void if_setratelimitqueryfn(if_t ifp, if_ratelimit_query_t); +/* + * NB: The interface is not yet stable, drivers implementing IPSEC + * offload need to be prepared to adapt to changes. + */ +struct if_ipsec_accel_methods { + if_spdadd_fn_t if_spdadd; + if_spddel_fn_t if_spddel; + if_sa_newkey_fn_t if_sa_newkey; + if_sa_deinstall_fn_t if_sa_deinstall; + if_sa_cnt_fn_t if_sa_cnt; +}; +void if_setipsec_accel_methods(if_t ifp, const struct if_ipsec_accel_methods *); + /* TSO */ void if_hw_tsomax_common(if_t ifp, struct ifnet_hw_tsomax *); int if_hw_tsomax_update(if_t ifp, struct ifnet_hw_tsomax *); From nobody Fri Jul 12 11:25:07 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QW64Lxz5QBgp; Fri, 12 Jul 2024 11:25:07 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QW3zBwz4j8W; Fri, 12 Jul 2024 11:25:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783507; 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=0cTTO7jIwy0xfPTbHa+ZcBLZgIZYm9B7ODdwdivK41s=; b=lyB5OM7rZymGRLARXi+jvrjImx7i9x88/7jEWzEfklf3WuSXWAvW+2UEdy7C8cKUYl8GVi U/vLc/IhqUh7GUaepXGVCBcqWtOjZoF2Xybq4F2uE+bXgNS+F02s/xVad63PWZ5Dxlg5JA VTZ3XhSNAOjShIzKyE83wzHOCwbCUf7AgtqkIionLGVKFcb3hp9mxxu9xdRzQ8LZSZUvqg dCqtlyuwnYVj1UyIRSRMIVbvQxACLTGKchwcfUjMcp4no5ruf/1bJSpx1ljPq6W7dOmypO t+aY20wH0VbzC59KU2qlQXsaxfRvZybdG1SYM6ttpZK3sro3tCsJArttOPuIHw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783507; a=rsa-sha256; cv=none; b=Uk5HKXo2O1ORUiAQ1HZlDykBQF0ygKTJFhDwTeH/cHVBa5kiM9TBZYdum/6WSkicXV07Gu hQrfAdl2fOuw5pY+ihpCAJR2jF1UrK0GHIJT/IuLYe4Bnq2lBaJREPcKvxWcG4GL8r8E8r V+GDdRauXH7Ly+tl4Wnz6HpMZgmVCr5B4mrbHMsV505fFbvTEGwp3MNNEAj8mI666vIPlt peh/QOSHtHBg3klLi9Iacqj4FjMGsSLdbx95pHtRDscbC28micF3+2s1X9v2SnHTTDo7Tc gjRsYrRBnaxTSZyTdv3iEqXxRYEwMEGsY0kDLy+BDA5BITOkgQWxIfen7OrPgA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783507; 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=0cTTO7jIwy0xfPTbHa+ZcBLZgIZYm9B7ODdwdivK41s=; b=YKLCleQoOJwFFA8A7NE8N6MhojGdMIxqjLoD0n2qrZ5oQf4uo0fhPAlp0iOtMdWe/sffDz vDnbSIe/N6kmM19CIsKFmIDJFs1DBsFQDLMo2wbDHYyZEBxBnYragVRISFXbYpFZb31lb7 0rvNz1qvO7T2X6K4cuaesVtj+OeWSSfymgKQFC/sHD8hHdY6fP4W07dUypm9fL1RQLqcwJ lPSyUPG+hRt3mV9U2uB/w6JsOhn91RFdbMFsCMfxicJelNwgRtphnWgErkF5uY90xZsZcm Rd88N/aZNQiaTc4Zw2aSaTJXcA8XTSE3Vobmy7PEE/tHA1S8Jttglp88JyS0DQ== 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 4WL8QW3ZjVzh7x; Fri, 12 Jul 2024 11:25:07 +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 46CBP7rJ093087; Fri, 12 Jul 2024 11:25:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBP7nx093084; Fri, 12 Jul 2024 11:25:07 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:25:07 GMT Message-Id: <202407121125.46CBP7nx093084@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: b6919741b747 - main - ipsec_offload: handle TSO if supported List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: b6919741b7479fab6886ae76ec151f4103bcf350 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b6919741b7479fab6886ae76ec151f4103bcf350 commit b6919741b7479fab6886ae76ec151f4103bcf350 Author: Konstantin Belousov AuthorDate: 2023-11-14 01:45:49 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 03:29:32 +0000 ipsec_offload: handle TSO if supported Allow for TSO to operate if network interface supports ipsec inline offload and supports TSO over it. Reviewed by: tuexen Sponsored by: NVIDIA networking Differential revision: https://reviews.freebsd.org/D44222 --- sys/netinet/tcp_input.c | 2 ++ sys/netinet/tcp_output.c | 20 +++++++++----------- sys/netinet/tcp_subr.c | 4 ++++ sys/netinet/tcp_var.h | 2 ++ 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 7faa815fc1ac..833a1e501780 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -3979,6 +3979,8 @@ tcp_mss(struct tcpcb *tp, int offer) tp->t_tsomax = cap.tsomax; tp->t_tsomaxsegcount = cap.tsomaxsegcount; tp->t_tsomaxsegsize = cap.tsomaxsegsize; + if (cap.ipsec_tso) + tp->t_flags2 |= TF2_IPSEC_TSO; } } diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index c318e8517c2e..080dabf3232f 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -201,9 +201,7 @@ tcp_default_output(struct tcpcb *tp) struct tcphdr *th; u_char opt[TCP_MAXOLEN]; unsigned ipoptlen, optlen, hdrlen, ulen; -#if defined(IPSEC) || defined(IPSEC_SUPPORT) unsigned ipsec_optlen = 0; -#endif int idle, sendalot, curticks; int sack_rxmit, sack_bytes_rxmt; struct sackhole *p; @@ -553,15 +551,15 @@ after_sack_rexmit: offsetof(struct ipoption, ipopt_list); else ipoptlen = 0; -#if defined(IPSEC) || defined(IPSEC_SUPPORT) ipoptlen += ipsec_optlen; -#endif if ((tp->t_flags & TF_TSO) && V_tcp_do_tso && len > tp->t_maxseg && (tp->t_port == 0) && ((tp->t_flags & TF_SIGNATURE) == 0) && tp->rcv_numsacks == 0 && ((sack_rxmit == 0) || V_tcp_sack_tso) && - ipoptlen == 0 && !(flags & TH_SYN)) + (ipoptlen == 0 || (ipoptlen == ipsec_optlen && + (tp->t_flags2 & TF2_IPSEC_TSO) != 0)) && + !(flags & TH_SYN)) tso = 1; if (SEQ_LT((sack_rxmit ? p->rxmit : tp->snd_nxt) + len, @@ -917,7 +915,7 @@ send: * overflowing or exceeding the maximum length * allowed by the network interface: */ - KASSERT(ipoptlen == 0, + KASSERT(ipoptlen == ipsec_optlen, ("%s: TSO can't do IP options", __func__)); /* @@ -926,8 +924,8 @@ send: */ if (if_hw_tsomax != 0) { /* compute maximum TSO length */ - max_len = (if_hw_tsomax - hdrlen - - max_linkhdr); + max_len = if_hw_tsomax - hdrlen - + ipsec_optlen - max_linkhdr; if (max_len <= 0) { len = 0; } else if (len > max_len) { @@ -941,7 +939,7 @@ send: * fractional unless the send sockbuf can be * emptied: */ - max_len = (tp->t_maxseg - optlen); + max_len = tp->t_maxseg - optlen - ipsec_optlen; if (((uint32_t)off + (uint32_t)len) < sbavail(&so->so_snd)) { moff = len % max_len; @@ -1393,10 +1391,10 @@ send: * The TCP pseudo header checksum is always provided. */ if (tso) { - KASSERT(len > tp->t_maxseg - optlen, + KASSERT(len > tp->t_maxseg - optlen - ipsec_optlen, ("%s: len <= tso_segsz", __func__)); m->m_pkthdr.csum_flags |= CSUM_TSO; - m->m_pkthdr.tso_segsz = tp->t_maxseg - optlen; + m->m_pkthdr.tso_segsz = tp->t_maxseg - optlen - ipsec_optlen; } KASSERT(len + hdrlen == m_length(m, NULL), diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 3d860d0cf6f9..b4f605534d59 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -3349,6 +3349,9 @@ tcp_maxmtu(struct in_conninfo *inc, struct tcp_ifcap *cap) cap->tsomax = ifp->if_hw_tsomax; cap->tsomaxsegcount = ifp->if_hw_tsomaxsegcount; cap->tsomaxsegsize = ifp->if_hw_tsomaxsegsize; + /* XXXKIB IFCAP2_IPSEC_OFFLOAD_TSO */ + cap->ipsec_tso = (ifp->if_capenable2 & + IFCAP2_BIT(IFCAP2_IPSEC_OFFLOAD)) != 0; } } } @@ -3388,6 +3391,7 @@ tcp_maxmtu6(struct in_conninfo *inc, struct tcp_ifcap *cap) cap->tsomax = ifp->if_hw_tsomax; cap->tsomaxsegcount = ifp->if_hw_tsomaxsegcount; cap->tsomaxsegsize = ifp->if_hw_tsomaxsegsize; + cap->ipsec_tso = false; /* XXXKIB */ } } } diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index e81ebf301c8e..8330966c2c3f 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -844,6 +844,7 @@ tcp_packets_this_ack(struct tcpcb *tp, tcp_seq ack) #define TF2_DONT_SACK_QUEUE 0x00040000 /* Don't wake on sack */ #define TF2_CANNOT_DO_ECN 0x00080000 /* The stack does not do ECN */ #define TF2_PROC_SACK_PROHIBIT 0x00100000 /* Due to small MSS size do not process sack's */ +#define TF2_IPSEC_TSO 0x00200000 /* IPSEC + TSO supported */ /* * Structure to hold TCP options that are only used during segment @@ -1430,6 +1431,7 @@ struct tcp_ifcap { u_int tsomax; u_int tsomaxsegcount; u_int tsomaxsegsize; + bool ipsec_tso; }; uint32_t tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *); uint32_t tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *); From nobody Fri Jul 12 11:25:08 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QX5Z17z5QBxt; Fri, 12 Jul 2024 11:25: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QX4kXNz4jBt; Fri, 12 Jul 2024 11:25:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783508; 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=8SrHVJJHEJ2xbMj3plm8AMRHJrWmG2htmLGbbGltiaA=; b=EY7CVWWs8G/guNOrxv9S31adEK4B1s6U4Y+hSUU+tJfj5u7/nh7KpIzY6aWjQ0Xn/aUVq0 A4gEKVMEpIxUtp5+87kDCdAWcr/mtZ0Ert0qROZUX65iQTa6bDsp8ljA82Qx9TKrgV5OTA SBM38xqUmni9dbij6/ekKsxwHJ+BLnNdZ0OPlnoebdVZa/vFaFK2GcvYO7kjN9BEiyarmE 4FyF6e/2p5U5J7adIJMuo7vjpW07HTW4sJB83lZqRn/VJwlBdRhVL2jxa8dAJHzwx2UmNT 5A6mXBN+2dhLF0U//ER9z/FcfRHkjobY0EkeqoyWMqTwF0NiMURzz30E/7um3g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783508; a=rsa-sha256; cv=none; b=uOkeJDWoy47P/mqJF8OjY1l1jx3+calLLT/DFsFt1c2KG3wqN3TCLTak1Iqz5FSnZI7cnb eznmZiyiDc0DiMXuFj70vX1f33M7zPTPbTNQziIFejiKUwTKqahur+1N34rIpQCpkufWBP qTsVrc6VDX+RieY72+Ay93gTgmMcPlwgk2mNtIQNhnN9R0NphSs145qtv8VOuzgoZDz+15 qRAtxIKcy4lPjS2V1dMpUsIASNC/w2ZxMnWNiQXUktwT/34ZPinqUybgM4RRawhPmu3rAY PYD+V5WK++kqgZdULSUpsDh2ZrqGEd5y0EDJhfqaR8rLukUsSe+PwOitemvBtA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783508; 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=8SrHVJJHEJ2xbMj3plm8AMRHJrWmG2htmLGbbGltiaA=; b=UVjkRHtLrrx0xDtc3C/CKzk4VyxZ9Azs0DxS1+fWT2w7SzNpBHZdiXKSO9LG/Fw49J26K3 fClT4bPrBtJC9h3h2+H9glorEj+Som06WLuKSTX8UQFLRpaxiWihd/UGP4gKEAxMgGuW88 vVUIF837JD2ltjkwiRpahrYXYFGX56nQSvPfEgso8hiMagAIulwos/UDVD/fkzi0XZJ45L qYLXQ0DS9o7YgEmA36R73+GdNy7ZnoabQE0izcH8R4WchriFs1AeiyWUrDA+nefOTy2VQy FW2wiD2XEEnzoylZUyxZ4948kOGzFpz0OxB4UKZ5TsAxLOOFF9BweJzsQdeC4Q== 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 4WL8QX4LVtzhSY; Fri, 12 Jul 2024 11:25: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 46CBP8KO093124; Fri, 12 Jul 2024 11:25:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBP8eo093121; Fri, 12 Jul 2024 11:25:08 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:25:08 GMT Message-Id: <202407121125.46CBP8eo093121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: ef2a572bf6bd - main - ipsec_offload: kernel infrastructure List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: ef2a572bf6bdcac97ef29ce631d2f50f938e1ec8 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ef2a572bf6bdcac97ef29ce631d2f50f938e1ec8 commit ef2a572bf6bdcac97ef29ce631d2f50f938e1ec8 Author: Konstantin Belousov AuthorDate: 2021-08-22 19:38:04 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 04:27:58 +0000 ipsec_offload: kernel infrastructure Inline IPSEC offload moves almost whole IPSEC processing from the CPU/MCU and possibly crypto accelerator, to the network card. The transmitted packet content is not touched by CPU during TX operations, kernel only does the required policy and security association lookups to find out that given flow is offloaded, and then packet is transmitted as plain text to the card. For driver convenience, a metadata is attached to the packet identifying SA which must process the packet. Card does encryption of the payload, padding, calculates authentication, and does the reformat according to the policy. Similarly, on receive, card does the decapsulation, decryption, and authentification. Kernel receives the identifier of SA that was used to process the packet, together with the plain-text packet. Overall, payload octets are only read or written by card DMA engine, removing a lot of memory subsystem overhead, and saving CPU time because IPSEC algos calculations are avoided. If driver declares support for inline IPSEC offload (with the IFCAP2_IPSEC_OFFLOAD capability set and registering method table struct if_ipsec_accel_methods), kernel offers the SPD and SAD to driver. Driver decides which policies and SAs can be offloaded based on hardware capacity, and acks/nacks each SA for given interface to kernel. Kernel needs to keep this information to make a decision to skip software processing on TX, and to assume processing already done on RX. This shadow SPD/SAD database of offloads is rooted from policies (struct secpolicy accel_ifps, struct ifp_handle_sp) and SAs (struct secasvar accel_ipfs, struct ifp_handle_sav). Some extensions to the PF_KEY socket allow to limit interfaces for which given SP/SA could be offloaded (proposed for offload). Also, additional statistics extensions allow to observe allocation/octet/use counters for specific SA. Since SPs and SAs are typically instantiated in non-sleepable context, while offloading them into card is expected to require costly async manipulations of the card state, calls to the driver for offload and termination are executed in the threaded taskqueue. It also solves the issue of allocating resources needed for the offload database. Neither ipf_handle_sp nor ipf_handle_sav do not add reference to the owning SP/SA, the offload must be terminated before last reference is dropped. ipsec_accel only adds transient references to ensure safe pointer ownership by taskqueue. Maintaining the SA counters for hardware-accelerated packets is the duty of the driver. The helper ipsec_accel_drv_sa_lifetime_update() is provided to hide accel infrastructure from drivers which would use expected callout to query hardware periodically for updates. Reviewed by: rscheff (transport, stack integration), np Sponsored by: NVIDIA networking Differential revision: https://reviews.freebsd.org/D44219 --- sys/conf/files | 2 + sys/conf/options | 1 + sys/modules/ipsec/Makefile | 5 +- sys/netipsec/ipsec.c | 17 + sys/netipsec/ipsec.h | 11 + sys/netipsec/ipsec_input.c | 11 + sys/netipsec/ipsec_offload.c | 1061 ++++++++++++++++++++++++++++++++++++++++++ sys/netipsec/ipsec_offload.h | 191 ++++++++ sys/netipsec/ipsec_output.c | 15 + sys/netipsec/ipsec_pcb.c | 38 +- sys/netipsec/key.c | 270 ++++++++++- sys/netipsec/key.h | 6 + sys/netipsec/key_debug.c | 5 + sys/netipsec/keydb.h | 14 + 14 files changed, 1628 insertions(+), 19 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 609ac407d400..1f99c3586b86 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4464,6 +4464,8 @@ netipsec/ipsec.c optional ipsec inet | ipsec inet6 netipsec/ipsec_input.c optional ipsec inet | ipsec inet6 netipsec/ipsec_mbuf.c optional ipsec inet | ipsec inet6 netipsec/ipsec_mod.c optional ipsec inet | ipsec inet6 +netipsec/ipsec_offload.c optional ipsec ipsec_offload inet | \ + ipsec ipsec_offload inet6 netipsec/ipsec_output.c optional ipsec inet | ipsec inet6 netipsec/ipsec_pcb.c optional ipsec inet | ipsec inet6 | \ ipsec_support inet | ipsec_support inet6 diff --git a/sys/conf/options b/sys/conf/options index f50d009987bc..928927fe99df 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -466,6 +466,7 @@ IPFIREWALL_PMOD opt_ipfw.h IPSEC opt_ipsec.h IPSEC_DEBUG opt_ipsec.h IPSEC_SUPPORT opt_ipsec.h +IPSEC_OFFLOAD opt_ipsec.h IPSTEALTH KERN_TLS KRPC diff --git a/sys/modules/ipsec/Makefile b/sys/modules/ipsec/Makefile index 08a2e88d5794..8979508375a4 100644 --- a/sys/modules/ipsec/Makefile +++ b/sys/modules/ipsec/Makefile @@ -2,8 +2,9 @@ .PATH: ${SRCTOP}/sys/net ${SRCTOP}/sys/netipsec KMOD= ipsec -SRCS= if_ipsec.c ipsec.c ipsec_input.c ipsec_mbuf.c ipsec_mod.c \ - ipsec_output.c xform_ah.c xform_esp.c xform_ipcomp.c \ +SRCS= if_ipsec.c ipsec.c ipsec_input.c ipsec_mbuf.c \ + ipsec_mod.c ipsec_offload.c ipsec_output.c \ + xform_ah.c xform_esp.c xform_ipcomp.c \ opt_inet.h opt_inet6.h opt_ipsec.h opt_kern_tls.h opt_sctp.h .if "${MK_INET}" != "no" || "${MK_INET6}" != "no" SRCS+= udpencap.c diff --git a/sys/netipsec/ipsec.c b/sys/netipsec/ipsec.c index 0ca33424bca8..e22a3872d48d 100644 --- a/sys/netipsec/ipsec.c +++ b/sys/netipsec/ipsec.c @@ -85,6 +85,7 @@ #ifdef INET6 #include #endif +#include #include #include #include /*XXX*/ @@ -636,8 +637,16 @@ int ipsec4_in_reject(const struct mbuf *m, struct inpcb *inp) { struct secpolicy *sp; +#ifdef IPSEC_OFFLOAD + struct ipsec_accel_in_tag *tag; +#endif int result; +#ifdef IPSEC_OFFLOAD + tag = ipsec_accel_input_tag_lookup(m); + if (tag != NULL) + return (0); +#endif sp = ipsec4_getpolicy(m, inp, IPSEC_DIR_INBOUND, 0); result = ipsec_in_reject(sp, inp, m); key_freesp(&sp); @@ -802,8 +811,16 @@ int ipsec6_in_reject(const struct mbuf *m, struct inpcb *inp) { struct secpolicy *sp; +#ifdef IPSEC_OFFLOAD + struct ipsec_accel_in_tag *tag; +#endif int result; +#ifdef IPSEC_OFFLOAD + tag = ipsec_accel_input_tag_lookup(m); + if (tag != NULL) + return (0); +#endif sp = ipsec6_getpolicy(m, inp, IPSEC_DIR_INBOUND, 0); result = ipsec_in_reject(sp, inp, m); key_freesp(&sp); diff --git a/sys/netipsec/ipsec.h b/sys/netipsec/ipsec.h index 2a1dcb8bb77b..55cc0839eab9 100644 --- a/sys/netipsec/ipsec.h +++ b/sys/netipsec/ipsec.h @@ -71,6 +71,12 @@ struct ipsecrequest { u_int level; /* IPsec level defined below. */ }; +struct ipsec_accel_adddel_sp_tq { + struct vnet *adddel_vnet; + struct task adddel_task; + int adddel_scheduled; +}; + /* Security Policy Data Base */ struct secpolicy { TAILQ_ENTRY(secpolicy) chain; @@ -102,6 +108,11 @@ struct secpolicy { time_t lastused; /* updated every when kernel sends a packet */ long lifetime; /* duration of the lifetime of this policy */ long validtime; /* duration this policy is valid without use */ + CK_LIST_HEAD(, ifp_handle_sp) accel_ifps; + struct ipsec_accel_adddel_sp_tq accel_add_tq; + struct ipsec_accel_adddel_sp_tq accel_del_tq; + struct inpcb *ipsec_accel_add_sp_inp; + const char *accel_ifname; }; /* diff --git a/sys/netipsec/ipsec_input.c b/sys/netipsec/ipsec_input.c index 1150f3f470d3..dbb20748cf45 100644 --- a/sys/netipsec/ipsec_input.c +++ b/sys/netipsec/ipsec_input.c @@ -90,6 +90,7 @@ #include #include #include +#include #include #include @@ -237,6 +238,11 @@ ipsec_common_input(struct mbuf *m, int skip, int protoff, int af, int sproto) int ipsec4_input(struct mbuf *m, int offset, int proto) { + int error; + + error = ipsec_accel_input(m, offset, proto); + if (error != ENXIO) + return (error); switch (proto) { case IPPROTO_AH: @@ -536,7 +542,12 @@ ipsec6_lasthdr(int proto) int ipsec6_input(struct mbuf *m, int offset, int proto) { + int error; + error = ipsec_accel_input(m, offset, proto); + if (error != ENXIO) + return (error); + switch (proto) { case IPPROTO_AH: case IPPROTO_ESP: diff --git a/sys/netipsec/ipsec_offload.c b/sys/netipsec/ipsec_offload.c new file mode 100644 index 000000000000..851bacaf4ea1 --- /dev/null +++ b/sys/netipsec/ipsec_offload.c @@ -0,0 +1,1061 @@ +/*- + * Copyright (c) 2021,2022 NVIDIA CORPORATION & AFFILIATES. 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 SOFTWARE IS PROVIDED BY 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 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. + */ + +#include "opt_inet.h" +#include "opt_inet6.h" +#include "opt_ipsec.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef IPSEC_OFFLOAD + +static struct mtx ipsec_accel_sav_tmp; +static struct unrhdr *drv_spi_unr; +static struct mtx ipsec_accel_cnt_lock; + +struct ipsec_accel_install_newkey_tq { + struct secasvar *sav; + struct vnet *install_vnet; + struct task install_task; +}; + +struct ipsec_accel_forget_tq { + struct vnet *forget_vnet; + struct task forget_task; + struct secasvar *sav; +}; + +struct ifp_handle_sav { + CK_LIST_ENTRY(ifp_handle_sav) sav_link; + CK_LIST_ENTRY(ifp_handle_sav) sav_allh_link; + struct secasvar *sav; + struct ifnet *ifp; + void *ifdata; + uint64_t drv_spi; + uint32_t flags; + size_t hdr_ext_size; + uint64_t cnt_octets; + uint64_t cnt_allocs; +}; + +#define IFP_HS_HANDLED 0x00000001 +#define IFP_HS_REJECTED 0x00000002 +#define IFP_HS_INPUT 0x00000004 +#define IFP_HS_OUTPUT 0x00000008 +#define IFP_HS_MARKER 0x00000010 + +static CK_LIST_HEAD(, ifp_handle_sav) ipsec_accel_all_sav_handles; + +struct ifp_handle_sp { + CK_LIST_ENTRY(ifp_handle_sp) sp_link; + CK_LIST_ENTRY(ifp_handle_sp) sp_allh_link; + struct secpolicy *sp; + struct ifnet *ifp; + void *ifdata; + uint32_t flags; +}; + +#define IFP_HP_HANDLED 0x00000001 +#define IFP_HP_REJECTED 0x00000002 +#define IFP_HP_MARKER 0x00000004 + +static CK_LIST_HEAD(, ifp_handle_sp) ipsec_accel_all_sp_handles; + +static void * +drvspi_sa_trie_alloc(struct pctrie *ptree) +{ + void *res; + + res = malloc(pctrie_node_size(), M_IPSEC_MISC, M_ZERO | M_NOWAIT); + if (res != NULL) + pctrie_zone_init(res, 0, 0); + return (res); +} + +static void +drvspi_sa_trie_free(struct pctrie *ptree, void *node) +{ + free(node, M_IPSEC_MISC); +} + +PCTRIE_DEFINE(DRVSPI_SA, ifp_handle_sav, drv_spi, + drvspi_sa_trie_alloc, drvspi_sa_trie_free); +static struct pctrie drv_spi_pctrie; + +static void ipsec_accel_sa_newkey_impl(struct secasvar *sav); +static int ipsec_accel_handle_sav(struct secasvar *sav, struct ifnet *ifp, + u_int drv_spi, void *priv, uint32_t flags, struct ifp_handle_sav **ires); +static void ipsec_accel_forget_sav_clear(struct secasvar *sav); +static struct ifp_handle_sav *ipsec_accel_is_accel_sav_ptr(struct secasvar *sav, + struct ifnet *ifp); +static int ipsec_accel_sa_lifetime_op_impl(struct secasvar *sav, + struct seclifetime *lft_c, if_t ifp, enum IF_SA_CNT_WHICH op, + struct rm_priotracker *sahtree_trackerp); +static void ipsec_accel_sa_recordxfer(struct secasvar *sav, struct mbuf *m); +static void ipsec_accel_sync_imp(void); +static bool ipsec_accel_is_accel_sav_impl(struct secasvar *sav); +static struct mbuf *ipsec_accel_key_setaccelif_impl(struct secasvar *sav); + +static void +ipsec_accel_init(void *arg) +{ + mtx_init(&ipsec_accel_sav_tmp, "ipasat", MTX_DEF, 0); + mtx_init(&ipsec_accel_cnt_lock, "ipascn", MTX_DEF, 0); + drv_spi_unr = new_unrhdr(IPSEC_ACCEL_DRV_SPI_MIN, + IPSEC_ACCEL_DRV_SPI_MAX, &ipsec_accel_sav_tmp); + ipsec_accel_sa_newkey_p = ipsec_accel_sa_newkey_impl; + ipsec_accel_forget_sav_p = ipsec_accel_forget_sav_impl; + ipsec_accel_spdadd_p = ipsec_accel_spdadd_impl; + ipsec_accel_spddel_p = ipsec_accel_spddel_impl; + ipsec_accel_sa_lifetime_op_p = ipsec_accel_sa_lifetime_op_impl; + ipsec_accel_sync_p = ipsec_accel_sync_imp; + ipsec_accel_is_accel_sav_p = ipsec_accel_is_accel_sav_impl; + ipsec_accel_key_setaccelif_p = ipsec_accel_key_setaccelif_impl; + pctrie_init(&drv_spi_pctrie); +} +SYSINIT(ipsec_accel_init, SI_SUB_VNET_DONE, SI_ORDER_ANY, + ipsec_accel_init, NULL); + +static void +ipsec_accel_fini(void *arg) +{ + ipsec_accel_sa_newkey_p = NULL; + ipsec_accel_forget_sav_p = NULL; + ipsec_accel_spdadd_p = NULL; + ipsec_accel_spddel_p = NULL; + ipsec_accel_sa_lifetime_op_p = NULL; + ipsec_accel_sync_p = NULL; + ipsec_accel_is_accel_sav_p = NULL; + ipsec_accel_key_setaccelif_p = NULL; + ipsec_accel_sync_imp(); + clean_unrhdr(drv_spi_unr); /* avoid panic, should go later */ + clear_unrhdr(drv_spi_unr); + delete_unrhdr(drv_spi_unr); + mtx_destroy(&ipsec_accel_sav_tmp); + mtx_destroy(&ipsec_accel_cnt_lock); +} +SYSUNINIT(ipsec_accel_fini, SI_SUB_VNET_DONE, SI_ORDER_ANY, + ipsec_accel_fini, NULL); + +static void +ipsec_accel_alloc_forget_tq(struct secasvar *sav) +{ + void *ftq; + + if (sav->accel_forget_tq != 0) + return; + + ftq = malloc(sizeof(struct ipsec_accel_forget_tq), M_TEMP, M_WAITOK); + if (!atomic_cmpset_ptr(&sav->accel_forget_tq, 0, (uintptr_t)ftq)) + free(ftq, M_TEMP); +} + +static bool +ipsec_accel_sa_install_match(if_t ifp, void *arg) +{ + if ((ifp->if_capenable2 & IFCAP2_BIT(IFCAP2_IPSEC_OFFLOAD)) == 0) + return (false); + if (ifp->if_ipsec_accel_m->if_sa_newkey == NULL) { + printf("driver bug ifp %s if_sa_newkey NULL\n", + if_name(ifp)); + return (false); + } + return (true); +} + +static int +ipsec_accel_sa_newkey_cb(if_t ifp, void *arg) +{ + struct ipsec_accel_install_newkey_tq *tq; + void *priv; + u_int drv_spi; + int error; + + tq = arg; + + printf("ipsec_accel_sa_newkey_act: ifp %s h %p spi %#x " + "flags %#x seq %d\n", + if_name(ifp), ifp->if_ipsec_accel_m->if_sa_newkey, + be32toh(tq->sav->spi), tq->sav->flags, tq->sav->seq); + priv = NULL; + drv_spi = alloc_unr(drv_spi_unr); + if (tq->sav->accel_ifname != NULL && + strcmp(tq->sav->accel_ifname, if_name(ifp)) != 0) { + error = ipsec_accel_handle_sav(tq->sav, + ifp, drv_spi, priv, IFP_HS_REJECTED, NULL); + goto out; + } + if (drv_spi == -1) { + /* XXXKIB */ + printf("ipsec_accel_sa_install_newkey: cannot alloc " + "drv_spi if %s spi %#x\n", if_name(ifp), + be32toh(tq->sav->spi)); + return (ENOMEM); + } + error = ifp->if_ipsec_accel_m->if_sa_newkey(ifp, tq->sav, + drv_spi, &priv); + if (error != 0) { + if (error == EOPNOTSUPP) { + printf("ipsec_accel_sa_newkey: driver " + "refused sa if %s spi %#x\n", + if_name(ifp), be32toh(tq->sav->spi)); + error = ipsec_accel_handle_sav(tq->sav, + ifp, drv_spi, priv, IFP_HS_REJECTED, NULL); + /* XXXKIB */ + } else { + printf("ipsec_accel_sa_newkey: driver " + "error %d if %s spi %#x\n", + error, if_name(ifp), be32toh(tq->sav->spi)); + /* XXXKIB */ + } + } else { + error = ipsec_accel_handle_sav(tq->sav, ifp, + drv_spi, priv, IFP_HS_HANDLED, NULL); + if (error != 0) { + /* XXXKIB */ + printf("ipsec_accel_sa_newkey: handle_sav " + "err %d if %s spi %#x\n", error, + if_name(ifp), be32toh(tq->sav->spi)); + } + } +out: + return (error); +} + +static void +ipsec_accel_sa_newkey_act(void *context, int pending) +{ + struct ipsec_accel_install_newkey_tq *tq; + void *tqf; + struct secasvar *sav; + + tq = context; + tqf = NULL; + sav = tq->sav; + CURVNET_SET(tq->install_vnet); + mtx_lock(&ipsec_accel_sav_tmp); + if ((sav->accel_flags & (SADB_KEY_ACCEL_INST | + SADB_KEY_ACCEL_DEINST)) == 0 && + sav->state == SADB_SASTATE_MATURE) { + sav->accel_flags |= SADB_KEY_ACCEL_INST; + mtx_unlock(&ipsec_accel_sav_tmp); + if_foreach_sleep(ipsec_accel_sa_install_match, context, + ipsec_accel_sa_newkey_cb, context); + ipsec_accel_alloc_forget_tq(sav); + mtx_lock(&ipsec_accel_sav_tmp); + + /* + * If ipsec_accel_forget_sav() raced with us and set + * the flag, do its work. Its task cannot execute in + * parallel since taskqueue_thread is single-threaded. + */ + if ((sav->accel_flags & SADB_KEY_ACCEL_DEINST) != 0) { + tqf = (void *)sav->accel_forget_tq; + sav->accel_forget_tq = 0; + ipsec_accel_forget_sav_clear(sav); + } + } + mtx_unlock(&ipsec_accel_sav_tmp); + key_freesav(&tq->sav); + CURVNET_RESTORE(); + free(tq, M_TEMP); + free(tqf, M_TEMP); +} + +static void +ipsec_accel_sa_newkey_impl(struct secasvar *sav) +{ + struct ipsec_accel_install_newkey_tq *tq; + + if ((sav->accel_flags & (SADB_KEY_ACCEL_INST | + SADB_KEY_ACCEL_DEINST)) != 0) + return; + + printf( + "ipsec_accel_sa_install_newkey: spi %#x flags %#x seq %d\n", + be32toh(sav->spi), sav->flags, sav->seq); + + tq = malloc(sizeof(*tq), M_TEMP, M_NOWAIT); + if (tq == NULL) { + printf("ipsec_accel_sa_install_newkey: no memory for tq, " + "spi %#x\n", be32toh(sav->spi)); + /* XXXKIB */ + return; + } + + refcount_acquire(&sav->refcnt); + + TASK_INIT(&tq->install_task, 0, ipsec_accel_sa_newkey_act, tq); + tq->sav = sav; + tq->install_vnet = curthread->td_vnet; /* XXXKIB liveness */ + taskqueue_enqueue(taskqueue_thread, &tq->install_task); +} + +static int +ipsec_accel_handle_sav(struct secasvar *sav, struct ifnet *ifp, + u_int drv_spi, void *priv, uint32_t flags, struct ifp_handle_sav **ires) +{ + struct ifp_handle_sav *ihs, *i; + int error; + + MPASS(__bitcount(flags & (IFP_HS_HANDLED | IFP_HS_REJECTED)) == 1); + + ihs = malloc(sizeof(*ihs), M_IPSEC_MISC, M_WAITOK | M_ZERO); + ihs->ifp = ifp; + ihs->sav = sav; + ihs->drv_spi = drv_spi; + ihs->ifdata = priv; + ihs->flags = flags; + if ((flags & IFP_HS_OUTPUT) != 0) + ihs->hdr_ext_size = esp_hdrsiz(sav); + mtx_lock(&ipsec_accel_sav_tmp); + CK_LIST_FOREACH(i, &sav->accel_ifps, sav_link) { + if (i->ifp == ifp) { + error = EALREADY; + goto errout; + } + } + error = DRVSPI_SA_PCTRIE_INSERT(&drv_spi_pctrie, ihs); + if (error != 0) + goto errout; + if_ref(ihs->ifp); + CK_LIST_INSERT_HEAD(&sav->accel_ifps, ihs, sav_link); + CK_LIST_INSERT_HEAD(&ipsec_accel_all_sav_handles, ihs, sav_allh_link); + mtx_unlock(&ipsec_accel_sav_tmp); + if (ires != NULL) + *ires = ihs; + return (0); +errout: + mtx_unlock(&ipsec_accel_sav_tmp); + free(ihs, M_IPSEC_MISC); + if (ires != NULL) + *ires = NULL; + return (error); +} + +static void +ipsec_accel_forget_handle_sav(struct ifp_handle_sav *i, bool freesav) +{ + struct ifnet *ifp; + struct secasvar *sav; + + mtx_assert(&ipsec_accel_sav_tmp, MA_OWNED); + + CK_LIST_REMOVE(i, sav_link); + CK_LIST_REMOVE(i, sav_allh_link); + DRVSPI_SA_PCTRIE_REMOVE(&drv_spi_pctrie, i->drv_spi); + mtx_unlock(&ipsec_accel_sav_tmp); + NET_EPOCH_WAIT(); + ifp = i->ifp; + sav = i->sav; + if ((i->flags & (IFP_HS_HANDLED | IFP_HS_REJECTED)) == + IFP_HS_HANDLED) { + printf("sa deinstall %s %p spi %#x ifl %#x\n", + if_name(ifp), sav, be32toh(sav->spi), i->flags); + ifp->if_ipsec_accel_m->if_sa_deinstall(ifp, + i->drv_spi, i->ifdata); + } + if_rele(ifp); + free_unr(drv_spi_unr, i->drv_spi); + free(i, M_IPSEC_MISC); + if (freesav) + key_freesav(&sav); + mtx_lock(&ipsec_accel_sav_tmp); +} + +static void +ipsec_accel_forget_sav_clear(struct secasvar *sav) +{ + struct ifp_handle_sav *i; + + for (;;) { + i = CK_LIST_FIRST(&sav->accel_ifps); + if (i == NULL) + break; + ipsec_accel_forget_handle_sav(i, false); + } +} + +static void +ipsec_accel_forget_sav_act(void *arg, int pending) +{ + struct ipsec_accel_forget_tq *tq; + struct secasvar *sav; + + tq = arg; + sav = tq->sav; + CURVNET_SET(tq->forget_vnet); + mtx_lock(&ipsec_accel_sav_tmp); + ipsec_accel_forget_sav_clear(sav); + mtx_unlock(&ipsec_accel_sav_tmp); + key_freesav(&sav); + CURVNET_RESTORE(); + free(tq, M_TEMP); +} + +void +ipsec_accel_forget_sav_impl(struct secasvar *sav) +{ + struct ipsec_accel_forget_tq *tq; + + mtx_lock(&ipsec_accel_sav_tmp); + sav->accel_flags |= SADB_KEY_ACCEL_DEINST; + tq = (void *)atomic_load_ptr(&sav->accel_forget_tq); + if (tq == NULL || !atomic_cmpset_ptr(&sav->accel_forget_tq, + (uintptr_t)tq, 0)) { + mtx_unlock(&ipsec_accel_sav_tmp); + return; + } + mtx_unlock(&ipsec_accel_sav_tmp); + + refcount_acquire(&sav->refcnt); + TASK_INIT(&tq->forget_task, 0, ipsec_accel_forget_sav_act, tq); + tq->forget_vnet = curthread->td_vnet; + tq->sav = sav; + taskqueue_enqueue(taskqueue_thread, &tq->forget_task); +} + +static void +ipsec_accel_on_ifdown_sav(struct ifnet *ifp) +{ + struct ifp_handle_sav *i, *marker; + + marker = malloc(sizeof(*marker), M_IPSEC_MISC, M_WAITOK | M_ZERO); + marker->flags = IFP_HS_MARKER; + + mtx_lock(&ipsec_accel_sav_tmp); + CK_LIST_INSERT_HEAD(&ipsec_accel_all_sav_handles, marker, + sav_allh_link); + for (;;) { + i = CK_LIST_NEXT(marker, sav_allh_link); + if (i == NULL) + break; + CK_LIST_REMOVE(marker, sav_allh_link); + CK_LIST_INSERT_AFTER(i, marker, sav_allh_link); + if (i->ifp == ifp) { + refcount_acquire(&i->sav->refcnt); /* XXXKIB wrap ? */ + ipsec_accel_forget_handle_sav(i, true); + } + } + CK_LIST_REMOVE(marker, sav_allh_link); + mtx_unlock(&ipsec_accel_sav_tmp); + free(marker, M_IPSEC_MISC); +} + +static struct ifp_handle_sav * +ipsec_accel_is_accel_sav_ptr_raw(struct secasvar *sav, struct ifnet *ifp) +{ + struct ifp_handle_sav *i; + + if ((ifp->if_capenable2 & IFCAP2_BIT(IFCAP2_IPSEC_OFFLOAD)) == 0) + return (NULL); + CK_LIST_FOREACH(i, &sav->accel_ifps, sav_link) { + if (i->ifp == ifp) + return (i); + } + return (NULL); +} + +static struct ifp_handle_sav * +ipsec_accel_is_accel_sav_ptr(struct secasvar *sav, struct ifnet *ifp) +{ + NET_EPOCH_ASSERT(); + return (ipsec_accel_is_accel_sav_ptr_raw(sav, ifp)); +} + +static bool +ipsec_accel_is_accel_sav_impl(struct secasvar *sav) +{ + return (!CK_LIST_EMPTY(&sav->accel_ifps)); +} + +static struct secasvar * +ipsec_accel_drvspi_to_sa(u_int drv_spi) +{ + struct ifp_handle_sav *i; + + i = DRVSPI_SA_PCTRIE_LOOKUP(&drv_spi_pctrie, drv_spi); + if (i == NULL) + return (NULL); + return (i->sav); +} + +static struct ifp_handle_sp * +ipsec_accel_find_accel_sp(struct secpolicy *sp, if_t ifp) +{ + struct ifp_handle_sp *i; + + CK_LIST_FOREACH(i, &sp->accel_ifps, sp_link) { + if (i->ifp == ifp) + return (i); + } + return (NULL); +} + +static bool +ipsec_accel_is_accel_sp(struct secpolicy *sp, if_t ifp) +{ + return (ipsec_accel_find_accel_sp(sp, ifp) != NULL); +} + +static int +ipsec_accel_remember_sp(struct secpolicy *sp, if_t ifp, + struct ifp_handle_sp **ip) +{ + struct ifp_handle_sp *i; + + i = malloc(sizeof(*i), M_IPSEC_MISC, M_WAITOK | M_ZERO); + i->sp = sp; + i->ifp = ifp; + if_ref(ifp); + i->flags = IFP_HP_HANDLED; + mtx_lock(&ipsec_accel_sav_tmp); + CK_LIST_INSERT_HEAD(&sp->accel_ifps, i, sp_link); + CK_LIST_INSERT_HEAD(&ipsec_accel_all_sp_handles, i, sp_allh_link); + mtx_unlock(&ipsec_accel_sav_tmp); + *ip = i; + return (0); +} + +static bool +ipsec_accel_spdadd_match(if_t ifp, void *arg) +{ + struct secpolicy *sp; + + if ((ifp->if_capenable2 & IFCAP2_BIT(IFCAP2_IPSEC_OFFLOAD)) == 0 || + ifp->if_ipsec_accel_m->if_spdadd == NULL) + return (false); + sp = arg; + if (sp->accel_ifname != NULL && + strcmp(sp->accel_ifname, if_name(ifp)) != 0) + return (false); + if (ipsec_accel_is_accel_sp(sp, ifp)) + return (false); + return (true); +} + +static int +ipsec_accel_spdadd_cb(if_t ifp, void *arg) +{ + struct secpolicy *sp; + struct inpcb *inp; + struct ifp_handle_sp *i; + int error; + + sp = arg; + inp = sp->ipsec_accel_add_sp_inp; + printf("ipsec_accel_spdadd_cb: ifp %s m %p sp %p inp %p\n", + if_name(ifp), ifp->if_ipsec_accel_m->if_spdadd, sp, inp); + error = ipsec_accel_remember_sp(sp, ifp, &i); + if (error != 0) { + printf("ipsec_accel_spdadd: %s if_spdadd %p remember res %d\n", + if_name(ifp), sp, error); + return (error); + } + error = ifp->if_ipsec_accel_m->if_spdadd(ifp, sp, inp, &i->ifdata); + if (error != 0) { + i->flags |= IFP_HP_REJECTED; + printf("ipsec_accel_spdadd: %s if_spdadd %p res %d\n", + if_name(ifp), sp, error); + } + return (error); +} + +static void +ipsec_accel_spdadd_act(void *arg, int pending) +{ + struct secpolicy *sp; + struct inpcb *inp; + + sp = arg; + CURVNET_SET(sp->accel_add_tq.adddel_vnet); + if_foreach_sleep(ipsec_accel_spdadd_match, arg, + ipsec_accel_spdadd_cb, arg); + inp = sp->ipsec_accel_add_sp_inp; + if (inp != NULL) { + INP_WLOCK(inp); + if (!in_pcbrele_wlocked(inp)) + INP_WUNLOCK(inp); + sp->ipsec_accel_add_sp_inp = NULL; + } + CURVNET_RESTORE(); + key_freesp(&sp); +} + +void +ipsec_accel_spdadd_impl(struct secpolicy *sp, struct inpcb *inp) +{ + struct ipsec_accel_adddel_sp_tq *tq; + + if (sp == NULL) + return; + if (sp->tcount == 0 && inp == NULL) + return; + tq = &sp->accel_add_tq; + if (atomic_cmpset_int(&tq->adddel_scheduled, 0, 1) == 0) + return; + tq->adddel_vnet = curthread->td_vnet; + sp->ipsec_accel_add_sp_inp = inp; + if (inp != NULL) + in_pcbref(inp); + TASK_INIT(&tq->adddel_task, 0, ipsec_accel_spdadd_act, sp); + key_addref(sp); + taskqueue_enqueue(taskqueue_thread, &tq->adddel_task); +} + +static void +ipsec_accel_spddel_act(void *arg, int pending) +{ + struct ifp_handle_sp *i; + struct secpolicy *sp; + int error; + + sp = arg; + CURVNET_SET(sp->accel_del_tq.adddel_vnet); + mtx_lock(&ipsec_accel_sav_tmp); + for (;;) { + i = CK_LIST_FIRST(&sp->accel_ifps); + if (i == NULL) + break; + CK_LIST_REMOVE(i, sp_link); + CK_LIST_REMOVE(i, sp_allh_link); + mtx_unlock(&ipsec_accel_sav_tmp); + NET_EPOCH_WAIT(); + if ((i->flags & (IFP_HP_HANDLED | IFP_HP_REJECTED)) == + IFP_HP_HANDLED) { + printf("spd deinstall %s %p\n", if_name(i->ifp), sp); + error = i->ifp->if_ipsec_accel_m->if_spddel(i->ifp, + sp, i->ifdata); + if (error != 0) { + printf( + "ipsec_accel_spddel: %s if_spddel %p res %d\n", + if_name(i->ifp), sp, error); + } + } + if_rele(i->ifp); + free(i, M_IPSEC_MISC); + mtx_lock(&ipsec_accel_sav_tmp); + } + mtx_unlock(&ipsec_accel_sav_tmp); + key_freesp(&sp); + CURVNET_RESTORE(); +} + +void +ipsec_accel_spddel_impl(struct secpolicy *sp) +{ + struct ipsec_accel_adddel_sp_tq *tq; + + if (sp == NULL) + return; + + tq = &sp->accel_del_tq; + if (atomic_cmpset_int(&tq->adddel_scheduled, 0, 1) == 0) + return; + tq->adddel_vnet = curthread->td_vnet; + TASK_INIT(&tq->adddel_task, 0, ipsec_accel_spddel_act, sp); + key_addref(sp); + taskqueue_enqueue(taskqueue_thread, &tq->adddel_task); +} + +static void +ipsec_accel_on_ifdown_sp(struct ifnet *ifp) +{ + struct ifp_handle_sp *i, *marker; + struct secpolicy *sp; + int error; + + marker = malloc(sizeof(*marker), M_IPSEC_MISC, M_WAITOK | M_ZERO); + marker->flags = IFP_HS_MARKER; + + mtx_lock(&ipsec_accel_sav_tmp); + CK_LIST_INSERT_HEAD(&ipsec_accel_all_sp_handles, marker, + sp_allh_link); + for (;;) { + i = CK_LIST_NEXT(marker, sp_allh_link); + if (i == NULL) + break; + CK_LIST_REMOVE(marker, sp_allh_link); + CK_LIST_INSERT_AFTER(i, marker, sp_allh_link); + if (i->ifp != ifp) + continue; + + sp = i->sp; + key_addref(sp); + CK_LIST_REMOVE(i, sp_link); + CK_LIST_REMOVE(i, sp_allh_link); + mtx_unlock(&ipsec_accel_sav_tmp); + NET_EPOCH_WAIT(); + if ((i->flags & (IFP_HP_HANDLED | IFP_HP_REJECTED)) == + IFP_HP_HANDLED) { + printf("spd deinstall %s %p\n", if_name(ifp), sp); + error = ifp->if_ipsec_accel_m->if_spddel(ifp, + sp, i->ifdata); + } *** 1421 LINES SKIPPED *** From nobody Fri Jul 12 11:25:09 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8QY6Zgyz5QBkQ; Fri, 12 Jul 2024 11:25: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QY5Z0gz4j46; Fri, 12 Jul 2024 11:25:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783509; 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=7f+Xxxu1Mt0OsSglpK/tb0PNxuGt7kqmCBBzx02sZNs=; b=dF6g36I2cgPdf9gEBzYMQsEQYvGSRgdHcOIZ4z/FX/h2XRPacr1NPL4qxcfe6ij5WCmp1n LJlUOi1OM31GajtvLyHoe/n5vqVUP6zPNeG6e+LlVAx5Z9Y3ULPNIEKlIO5Vfd5LsZIN8J fHdDNdwUNbT/jGGCliO9J2DjNtOm3mqQREzKqFITEulqskyZVZEsOsvVzoS2z28Zw+TQBW M+8us4hGMZ8MRzfdIk72KJ81DnUqJPzdLRwB/wF2pA7KsXrNQx7xOyGY6DaM5jI7bPjc+L Oy1OY545lF8+9JrlRzDRXnNxRgSG3lKszBD4cOeK7XOUBUWkAU3zoM00ghBOTQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783509; a=rsa-sha256; cv=none; b=oMbqqqk8/wd3xBvtE6x3kxQMSHTO3Hwjzb4rCyHymgdn1c1eV9OAt1HTzKoZ2C3zxbvoGJ 0i2hoVLQuB2FKkEkO2uiSSSz8u4xSv0H8aGqUDERNHBSZHebZCf4kDF2SpvRkGOVwr2qug lbHeABxEsNstQ1nqqbFLxvAT3Q74P8Wr0hAd2pS9j71a+lfZEwcBVaW5oNdTN8XTcBdfhf C/Py/5kveGBEjVfECR3vVXnazNWuJEk1/D7c6II3nBFIu8o5lC8Zx42lZjdypEaaHlApZz V1tV/8hOQpNquDsqHtlPIux/fNIqvIY0aMitFNJD+OdKB+POM7QCyatF1oUEVg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783509; 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=7f+Xxxu1Mt0OsSglpK/tb0PNxuGt7kqmCBBzx02sZNs=; b=nxqKZv44SylsWendON6GyoPx5C7yk6MJ3b2kbhhQtCOR7jeeydEkZUoVdhAWcz5cnvEpSr o5LO7A5HfSdX2rKpVpQWRx5MpeIfVid2MYNTT1jvyNQG+x8Fy0HVyp9BzBs2+HL1K5xZ7N E+VS3lhJ1oQddj5sWRqM94xx7ZMYx0Ww/FgZHnCm3OECnkDLRp0vk+Nu0E4VZ4tzItuC7Y dLg1KomKE54MpR2N/6ABuo+g4DWT4Ycsjax+d1jECimhbpwBZSrX+wOPf7SWy3KncMQ9iA SQKfJu7xwCLNK3eYDyPzVMKBlQyqtYuIGvIEQnfAm2K7AxjcKrV86E+i/wAs+A== 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 4WL8QY5BcyzhB5; Fri, 12 Jul 2024 11:25:09 +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 46CBP9Vo093172; Fri, 12 Jul 2024 11:25:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBP9Dw093169; Fri, 12 Jul 2024 11:25:09 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:25:09 GMT Message-Id: <202407121125.46CBP9Dw093169@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 240b7bfe56f2 - main - ipsec_offload: offload inner checksums calculations for UDP/TCP/TSO List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 240b7bfe56f25b20ee248e4fb4a3232c5f13390d Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=240b7bfe56f25b20ee248e4fb4a3232c5f13390d commit 240b7bfe56f25b20ee248e4fb4a3232c5f13390d Author: Konstantin Belousov AuthorDate: 2024-02-14 12:52:56 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 04:27:58 +0000 ipsec_offload: offload inner checksums calculations for UDP/TCP/TSO and allow the interface driver to declare such support. Sponsored by: NVIDIA networking Differential revision: https://reviews.freebsd.org/D44221 --- sys/net/if_var.h | 3 ++ sys/netipsec/ipsec_offload.c | 5 ++- sys/netipsec/ipsec_offload.h | 7 +++- sys/netipsec/ipsec_output.c | 90 +++++++++++++++++++++++--------------------- 4 files changed, 60 insertions(+), 45 deletions(-) diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 3e094dcb3cd5..579585b25dd2 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -148,6 +148,8 @@ enum IF_SA_CNT_WHICH { }; typedef int (*if_sa_cnt_fn_t)(if_t ifp, void *sa, uint32_t drv_spi, void *priv, struct seclifetime *lt); +typedef int (*if_ipsec_hwassist_fn_t)(if_t ifp, void *sav, + u_int drv_spi,void *priv); struct ifnet_hw_tsomax { u_int tsomaxbytes; /* TSO total burst length limit in bytes */ @@ -727,6 +729,7 @@ struct if_ipsec_accel_methods { if_sa_newkey_fn_t if_sa_newkey; if_sa_deinstall_fn_t if_sa_deinstall; if_sa_cnt_fn_t if_sa_cnt; + if_ipsec_hwassist_fn_t if_hwassist; }; void if_setipsec_accel_methods(if_t ifp, const struct if_ipsec_accel_methods *); diff --git a/sys/netipsec/ipsec_offload.c b/sys/netipsec/ipsec_offload.c index 851bacaf4ea1..7f63a5e0ccb6 100644 --- a/sys/netipsec/ipsec_offload.c +++ b/sys/netipsec/ipsec_offload.c @@ -799,12 +799,13 @@ ipsec_accel_output_tag(struct mbuf *m, u_int drv_spi) bool ipsec_accel_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, - struct secpolicy *sp, struct secasvar *sav, int af, int mtu) + struct secpolicy *sp, struct secasvar *sav, int af, int mtu, int *hwassist) { struct ifp_handle_sav *i; struct ip *ip; u_long ip_len, skip; + *hwassist = 0; if (ifp == NULL) return (false); @@ -845,6 +846,8 @@ ipsec_accel_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, if (sp != NULL) key_freesp(&sp); + *hwassist = ifp->if_ipsec_accel_m->if_hwassist(ifp, sav, + i->drv_spi, i->ifdata); return (true); } diff --git a/sys/netipsec/ipsec_offload.h b/sys/netipsec/ipsec_offload.h index 87e2a33288be..27b9c938832e 100644 --- a/sys/netipsec/ipsec_offload.h +++ b/sys/netipsec/ipsec_offload.h @@ -173,11 +173,14 @@ void ipsec_accel_spddel_impl(struct secpolicy *sp); int ipsec_accel_input(struct mbuf *m, int offset, int proto); bool ipsec_accel_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, struct secpolicy *sp, struct secasvar *sav, int af, - int mtu); + int mtu, int *hwassist); void ipsec_accel_forget_sav(struct secasvar *sav); #else #define ipsec_accel_input(a, b, c) (ENXIO) -#define ipsec_accel_output(a, b, c, d, e, f, g) (false) +#define ipsec_accel_output(a, b, c, d, e, f, g, h) ({ \ + *h = 0; \ + false; \ +}) #define ipsec_accel_forget_sav(a) #endif diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index 8f49bc8fce24..10f1728f72ac 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -195,7 +195,8 @@ ipsec4_perform_request(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, union sockaddr_union *dst; struct secasvar *sav; struct ip *ip; - int error, i, off; + int error, hwassist, i, off; + bool accel; IPSEC_ASSERT(idx < sp->tcount, ("Wrong IPsec request index %d", idx)); @@ -212,7 +213,7 @@ ipsec4_perform_request(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, if (sav == NULL) { if (error == EJUSTRETURN) { /* No IPsec required */ (void)ipsec_accel_output(ifp, m, inp, sp, NULL, - AF_INET, mtu); + AF_INET, mtu, &hwassist); key_freesp(&sp); return (error); } @@ -225,7 +226,28 @@ ipsec4_perform_request(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, if ((error = ipsec_run_hhooks(&ctx, HHOOK_TYPE_IPSEC_OUT)) != 0) goto bad; - if (ipsec_accel_output(ifp, m, inp, sp, sav, AF_INET, mtu)) + hwassist = 0; + accel = ipsec_accel_output(ifp, m, inp, sp, sav, AF_INET, mtu, + &hwassist); + + /* + * Do delayed checksums now because we send before + * this is done in the normal processing path. + */ + if ((m->m_pkthdr.csum_flags & CSUM_DELAY_DATA & ~hwassist) != 0) { + in_delayed_cksum(m); + m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; + } +#if defined(SCTP) || defined(SCTP_SUPPORT) + if ((m->m_pkthdr.csum_flags & CSUM_SCTP & ~hwassist) != 0) { + struct ip *ip; + + ip = mtod(m, struct ip *); + sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2)); + m->m_pkthdr.csum_flags &= ~CSUM_SCTP; + } +#endif + if (accel) return (EJUSTRETURN); ip = mtod(m, struct ip *); @@ -401,25 +423,7 @@ ipsec4_common_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, * packets, and thus, even if they are forwarded, the replies will * return back to us. */ - if (!forwarding) { - /* - * Do delayed checksums now because we send before - * this is done in the normal processing path. - */ - if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { - in_delayed_cksum(m); - m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; - } -#if defined(SCTP) || defined(SCTP_SUPPORT) - if (m->m_pkthdr.csum_flags & CSUM_SCTP) { - struct ip *ip; - ip = mtod(m, struct ip *); - sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2)); - m->m_pkthdr.csum_flags &= ~CSUM_SCTP; - } -#endif - } /* NB: callee frees mbuf and releases reference to SP */ error = ipsec4_check_pmtu(ifp, m, sp, forwarding); if (error != 0) { @@ -596,7 +600,8 @@ ipsec6_perform_request(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, union sockaddr_union *dst; struct secasvar *sav; struct ip6_hdr *ip6; - int error, i, off; + int error, hwassist, i, off; + bool accel; IPSEC_ASSERT(idx < sp->tcount, ("Wrong IPsec request index %d", idx)); @@ -604,7 +609,7 @@ ipsec6_perform_request(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, if (sav == NULL) { if (error == EJUSTRETURN) { /* No IPsec required */ (void)ipsec_accel_output(ifp, m, inp, sp, NULL, - AF_INET6, mtu); + AF_INET6, mtu, &hwassist); key_freesp(&sp); return (error); } @@ -619,7 +624,26 @@ ipsec6_perform_request(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, if ((error = ipsec_run_hhooks(&ctx, HHOOK_TYPE_IPSEC_OUT)) != 0) goto bad; - if (ipsec_accel_output(ifp, m, inp, sp, sav, AF_INET6, mtu)) + hwassist = 0; + accel = ipsec_accel_output(ifp, m, inp, sp, sav, AF_INET6, mtu, + &hwassist); + + /* + * Do delayed checksums now because we send before + * this is done in the normal processing path. + */ + if ((m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6 & ~hwassist) != 0) { + in6_delayed_cksum(m, m->m_pkthdr.len - + sizeof(struct ip6_hdr), sizeof(struct ip6_hdr)); + m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; + } +#if defined(SCTP) || defined(SCTP_SUPPORT) + if ((m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6 & ~hwassist) != 0) { + sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); + m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; + } +#endif + if (accel) return (EJUSTRETURN); ip6 = mtod(m, struct ip6_hdr *); /* pfil can change mbuf */ @@ -778,24 +802,6 @@ ipsec6_common_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, return (0); /* No IPsec required. */ } - if (!forwarding) { - /* - * Do delayed checksums now because we send before - * this is done in the normal processing path. - */ - if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { - in6_delayed_cksum(m, m->m_pkthdr.len - - sizeof(struct ip6_hdr), sizeof(struct ip6_hdr)); - m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; - } -#if defined(SCTP) || defined(SCTP_SUPPORT) - if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) { - sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); - m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; - } -#endif - } - error = ipsec6_check_pmtu(ifp, m, sp, forwarding); if (error != 0) { if (error == EJUSTRETURN) From nobody Fri Jul 12 11:25:10 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8Qb23Vkz5QBrv; Fri, 12 Jul 2024 11:25:11 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8QZ6yRpz4jLJ; Fri, 12 Jul 2024 11:25:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783511; 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=Dzv89xfN42GjyR51m39QnTBX2yu8DJAePAsW3p6E8mI=; b=j9z0v9yZXdknx9dfVr15Vs4DBAQp7RxkXOgAB/quSbXcIc2YDqZm3xcwNWleCdcbVhIgpC byRPPsUGK09NJ5mh+f2Z5GS/3XWa8MJkcWl9cSkzay5BXZ0P6HN3NqIf4xAapdokwWYvLY +Pgxd1vNgSB5EJHbxFb4XzAMMvcPIPsGvR5pS7DxucO6+cIu0C6LBq0ebYAfgI021+SnPv /hXQZFQ24sNdnVdie6gyJuMbda17efFLJp2+3gas76Q6M7BpaoDsgoLLhHBlKF2V2dMlar SRaG4jrWBFiIQbPyn1bgr7O3Z/dTjZPehsEO73tpQPJZlIAcV1/xryr9jiooGA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783511; a=rsa-sha256; cv=none; b=b+2QnRTOSfGZICRY7sNQY7nXjVGhu0VIyPJ1Td8c8qiKbU/mbmDnY8e69LlOb3Tces1o6g slKnhAVAf1KlHJqHWwkeWpxRrtV43574ueERemvm5Ocv1aKUwkDOpAPzljNPQZ3sfp1yAF eW44ILm1s+tiBU2T/4tToJ99dvDGipJGwLNeNdHAjcCKD0IfP28U6lHt7lHeG0hEWaVIs9 s1UvUxlBWaiMJABtm4SbSEvteJK977PiYHxwYZnkiyCcIiit23+UPp1uHGYVqVa42t+CAD ECmFDf0FQNd9J2LesXk3nJaPp6lPeG/ERYWzpVMePI8h9M2Jd3xSU3R9tRJZ4A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783511; 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=Dzv89xfN42GjyR51m39QnTBX2yu8DJAePAsW3p6E8mI=; b=bvSyYr19qpWr6wHp8U5Oc/BxLx1iCLeCLJY+QRh62iPN4w7aYthtK0yJMRWm52Ez1C2It/ d/Gm5yCeJ32HhngeRllhpGECCJO+KMSJtgPlfK/eh+1Ctzze9ceAy4G5fAmWR6/FEOxEn/ 5IT/Gt4xv9AJN0ddDQ2N0Gvp2sur8danwxDFgWlpEm+V7vI9RWcBv6Ug5RxmWgCLq7A1Ep A6Qd0XPYeXnwP1mciO7trVURopcFKAInchzQG+LCl0DI9JfM7PZgU9ybkkdWjJdo5ZUdOr 5dS9wk56+3y/kIRZ4m8PiXQlekMXqps9MtrJzL4fga58hXwLoZ2K+WwOH/+qcw== 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 4WL8QZ6Z5Gzh7y; Fri, 12 Jul 2024 11:25:10 +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 46CBPA3f093223; Fri, 12 Jul 2024 11:25:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBPAWb093220; Fri, 12 Jul 2024 11:25:10 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:25:10 GMT Message-Id: <202407121125.46CBPAWb093220@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: e6e2c0a5ef5d - main - ipsec_offload: switch TF2_IPSEC_TSO on/off as appropriate on output List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: e6e2c0a5ef5d0454b19d2f89357b431eaeb1dd76 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e6e2c0a5ef5d0454b19d2f89357b431eaeb1dd76 commit e6e2c0a5ef5d0454b19d2f89357b431eaeb1dd76 Author: Konstantin Belousov AuthorDate: 2024-03-06 15:53:10 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 04:27:59 +0000 ipsec_offload: switch TF2_IPSEC_TSO on/off as appropriate on output after the interface ipsec_accel method if_hwassist() is consulted. Sponsored by: NVIDIA networking --- sys/netipsec/ipsec_offload.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/sys/netipsec/ipsec_offload.c b/sys/netipsec/ipsec_offload.c index 7f63a5e0ccb6..48082830b88b 100644 --- a/sys/netipsec/ipsec_offload.c +++ b/sys/netipsec/ipsec_offload.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -803,26 +804,31 @@ ipsec_accel_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, { struct ifp_handle_sav *i; struct ip *ip; + struct tcpcb *tp; u_long ip_len, skip; + bool res; *hwassist = 0; + res = false; if (ifp == NULL) - return (false); + return (res); M_ASSERTPKTHDR(m); NET_EPOCH_ASSERT(); - if (sav == NULL) - return (ipsec_accel_output_tag(m, IPSEC_ACCEL_DRV_SPI_BYPASS)); + if (sav == NULL) { + res = ipsec_accel_output_tag(m, IPSEC_ACCEL_DRV_SPI_BYPASS); + goto out; + } i = ipsec_accel_is_accel_sav_ptr(sav, ifp); if (i == NULL) - return (false); + goto out; if ((m->m_pkthdr.csum_flags & CSUM_TSO) == 0) { ip_len = m->m_pkthdr.len; if (ip_len + i->hdr_ext_size > mtu) - return (false); + goto out; switch (af) { case AF_INET: ip = mtod(m, struct ip *); @@ -835,11 +841,11 @@ ipsec_accel_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, __unreachable(); } if (!ipsec_accel_output_pad(m, sav, skip, mtu)) - return (false); + goto out; } if (!ipsec_accel_output_tag(m, i->drv_spi)) - return (false); + goto out; ipsec_accel_sa_recordxfer(sav, m); key_freesav(&sav); @@ -848,7 +854,18 @@ ipsec_accel_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, *hwassist = ifp->if_ipsec_accel_m->if_hwassist(ifp, sav, i->drv_spi, i->ifdata); - return (true); + res = true; +out: + if (inp != NULL && inp->inp_pcbinfo == &V_tcbinfo) { + INP_WLOCK_ASSERT(inp); + tp = (struct tcpcb *)inp; + if (res && (*hwassist & (CSUM_TSO | CSUM_IP6_TSO)) != 0) { + tp->t_flags2 |= TF2_IPSEC_TSO; + } else { + tp->t_flags2 &= ~TF2_IPSEC_TSO; + } + } + return (res); } struct ipsec_accel_in_tag * From nobody Fri Jul 12 11:25:11 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8Qc2Q6Bz5QBkV; Fri, 12 Jul 2024 11:25:12 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8Qc0hgcz4jMr; Fri, 12 Jul 2024 11:25:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783512; 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=M3DLbkXHWYrtehb7O70PFsfBpKPn4weUdwaO0/o7JmM=; b=O0BQFjPpN9JNDOpNr3OIGt0SjLD5Y2q6/jzhRk5oVK1MqAUTSy1i9QKGCSdLBFNDyNu+wF /78KGyspDnCcGJRSMsA43ue61C9/f/Rk4+7FrU7O6yc8jnawaaPXqgAU9CmV7Tr46u5HOe wlbt28VbS+1phjWjMGilD2j3lFbx9jO2gZjtDydWhrz1vl16M3Y5WAols76gon8Sn2Rq8j ygTXpo/ATGH/2M5CEIkfa38REVurb/46xG3sJ4/ITjXe7yE5l/yXtaXhlsEfYKHjv7RF1a FiYkxAKSMdXFrhvQ/Wc+K8acMgeeMxTnnu1Q5DSwJzZ+5ZKJGdCJUdMY0CR/yA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783512; a=rsa-sha256; cv=none; b=lKJngT9mYKKPAGjTipib+6z18tfe1fYucvIKp1q1qRxTboB4cEXUv1LlKpykuRkL5rY5ul Rit3AB+6j2s87NwKO3NmQxzdwmeHPFpu2mAJAxQLCZSIjvwNwIM1IUiLKRNmPCXpRC+FTm qX/ob5obFXIZRKHmR9i89y1tetxXz3LjZRmFt/7e0R3Srro8h/JO18c8pnpY7xfr9gEiWw N69Q3uvx5+s6Qqit1pNsbUxq+Hq+284bPmCQjWHVxe7UEPevh+kUypPWgg88Bog13O4RoC EQU6Ujx0keEhBMbmVyDocalPLDgERoqj/WbgVSZFCvQkwSLXB94ORkKUwsYLzA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783512; 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=M3DLbkXHWYrtehb7O70PFsfBpKPn4weUdwaO0/o7JmM=; b=KgTGdRNbald0u6Fg2aiwpf+1wL9NNzgRo13a83Cu6Hew01DkXmv7BQZI0N7jmfe+q4WQFt wxs1sOE7EBXZO+fULz6A/2JswB+/+f0GyX/anQluHGslQmwwp/b+3aGTUf6tUS027OkM1/ FyAxa1QrZxqIEkFG/MkxY7j+0x6V3WASm8OdCvIMCgJPPlD0bmjsBffqU82rPhCBBVbloD Ck1AW+4FPaQ+jN6JxYeIuoMxVud6LGOOAZdQZ/9nKnd5O8x2PLBKBrhIXAsFOU14G/6bBE NCkVFEv9poeOICC2cSEzu0MRCtOery7kGwJmmhvZMQqHl9iqB9hzMPPgdpQxUg== 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 4WL8Qc0K4PzhGw; Fri, 12 Jul 2024 11:25:12 +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 46CBPBMR093285; Fri, 12 Jul 2024 11:25:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBPBSZ093282; Fri, 12 Jul 2024 11:25:11 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:25:11 GMT Message-Id: <202407121125.46CBPBSZ093282@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 7a296a86d131 - main - IPSEC_OFFLOAD: add the option to GENERIC on amd64 and arm64 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 7a296a86d1317c79de5980b8346cb7c9f87e6ddc Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7a296a86d1317c79de5980b8346cb7c9f87e6ddc commit 7a296a86d1317c79de5980b8346cb7c9f87e6ddc Author: Konstantin Belousov AuthorDate: 2024-06-16 20:50:15 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-12 04:27:59 +0000 IPSEC_OFFLOAD: add the option to GENERIC on amd64 and arm64 Sponsored by: NVIDIA networking --- sys/amd64/conf/GENERIC | 1 + sys/arm64/conf/std.arm64 | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index 49fe8fde0e81..923574adf943 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -30,6 +30,7 @@ options VIMAGE # Subsystem virtualization, e.g. VNET options INET # InterNETworking options INET6 # IPv6 communications protocols options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 +options IPSEC_OFFLOAD # Inline ipsec offload infra options ROUTE_MPATH # Multipath routing support options FIB_ALGO # Modular fib lookups options TCP_OFFLOAD # TCP offload diff --git a/sys/arm64/conf/std.arm64 b/sys/arm64/conf/std.arm64 index cc4a5acbb314..69f333e32ed9 100644 --- a/sys/arm64/conf/std.arm64 +++ b/sys/arm64/conf/std.arm64 @@ -12,6 +12,7 @@ options INET # InterNETworking options INET6 # IPv6 communications protocols options CC_CUBIC # include CUBIC congestion control options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 +options IPSEC_OFFLOAD # Inline ipsec offload infra options ROUTE_MPATH # Multipath routing support options FIB_ALGO # Modular fib lookups options TCP_OFFLOAD # TCP offload From nobody Fri Jul 12 11:32:17 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8Zn1rcvz5QCBQ; Fri, 12 Jul 2024 11:32:17 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8Zn1P1Cz4ptw; Fri, 12 Jul 2024 11:32:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783937; 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=dgyLd3zKPgstaPVyONpCViJYRz67UQK9c3induJprDg=; b=iRywHHNGK7v/v41bhA+jgk9WSDpTRM+RUBSfD1gcu7zWjtx6WVz/hCFz83tOnmGmG4QdjQ r+3QPCV0/FIQUx8JEvi3HBS8QdFs/oEvJKXKyLTXls0UCHlCcVC/BgOT8acHxiHWAu2k0K sxtm50uy9rCEdjww/D1qSMU5hV2elDPo2uQxndYeJZtBSBhI3kuxsRXhaJjfvtH9Nfqkoi wERllqPtZv1ZWQRb/RZQm0xJXuMk3uf4d211SW+DkSv4oiJW3fte27ibNqMqgw1F8LGrHU gNNMqzAjKs+5/+32Ebr4YlyUrN5eMJAxW2T3w3CtZ5vg0TRMTcxKt0jYyTiK2Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783937; a=rsa-sha256; cv=none; b=Q3CnJIcQQlbWOVxSPeN1OxBUChjveIhdGT1usyIcp9MTAbMqoTB34xLuUXTew3njjbRJ9f ZGtofvM4dtveFGOtKmX7CYbMSTbiPKZcIuGeXaNbjUbDisA8eI/3SCbkkDtBKpPSQOUJxf dQMx2xpHjxZcpPb0LrQ/khAoXPCRETEjIxsX3gv6r1KhuGwFX96RTpxf9IOfPd+xAZv2Nf WUkiq2qH90t0THUTX0f3P8dPLAajD3qQIPMCqdfT4nTGgeKOtycRFgVrdijQHnPUjDHeow jOEusKaMB9u3JF9vh3q/xKmJMsU1V5F61gLPiZtqqEu473oRdBbaQvkUuIsBFg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783937; 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=dgyLd3zKPgstaPVyONpCViJYRz67UQK9c3induJprDg=; b=biSu6geCwMnvqaw3KlVF1fNpBzIrNyvk+mNM2NwuTU5J3re2yJChbb8V6yu2x+M9sOH7Lz ofqWKv22mSgk2nfndNJfPC2P9KrWrkjFi2jSv8utnU+P4FmiB8vkNYji0L23obv7/00qKe vhyY54jioQ5zI4B39SeBhtize276OJvzQ1VEtxr6Te5Gy2syxQGUTXs8bNtJU0utwFdF7J uS//6fQ3AQvTfULg+xXDgJkytlg1JphekM3/wjOqloxJhlDMAkb8ZqHjUT6nEzFajSs2Tu p3h2LQmFXm2C14OSI0QEYuxpqqcBmT+gZVUF7Ud9cPV34nKViq/NmvBcLRvyww== 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 4WL8Zn10CXzhBS; Fri, 12 Jul 2024 11:32: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 46CBWHAF010271; Fri, 12 Jul 2024 11:32:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBWHDZ010268; Fri, 12 Jul 2024 11:32:17 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:32:17 GMT Message-Id: <202407121132.46CBWHDZ010268@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 7818c2d37c2c - main - armv6: Remove support for building armv6 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7818c2d37c2c600fc9ad6f2a0951e50dd21b17c8 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=7818c2d37c2c600fc9ad6f2a0951e50dd21b17c8 commit 7818c2d37c2c600fc9ad6f2a0951e50dd21b17c8 Author: Andrew Turner AuthorDate: 2024-07-12 11:28:35 +0000 Commit: Andrew Turner CommitDate: 2024-07-12 11:31:53 +0000 armv6: Remove support for building armv6 With it planned that armv7 will be the only 32-bit kernel when 15.0 is released remove support for armv6. Remove the top level build infrastructure. It was already removed from universe, this just stops it from being built directly. Reviewed by: mmel, emaste Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45634 --- Makefile | 6 +----- Makefile.inc1 | 1 - UPDATING | 3 +++ sys/sys/param.h | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index b2613b68b645..5c113d5b83cc 100644 --- a/Makefile +++ b/Makefile @@ -521,9 +521,6 @@ worlds: .PHONY # Don't build rarely used, semi-supported architectures unless requested. # .if defined(EXTRA_TARGETS) -# armv6's importance has waned enough to make building it the exception rather -# than the rule. -EXTRA_ARCHES_arm= armv6 # powerpcspe excluded from main list until clang fixed EXTRA_ARCHES_powerpc= powerpcspe .endif @@ -535,8 +532,7 @@ TARGET_ARCHES_${target}= ${MACHINE_ARCH_LIST_${target}} .if defined(USE_GCC_TOOLCHAINS) TOOLCHAINS_amd64= amd64-gcc12 -TOOLCHAINS_arm= armv6-gcc12 armv7-gcc12 -TOOLCHAIN_armv7= armv7-gcc12 +TOOLCHAINS_arm= armv7-gcc12 TOOLCHAINS_arm64= aarch64-gcc12 TOOLCHAINS_i386= i386-gcc12 TOOLCHAINS_powerpc= powerpc-gcc12 powerpc64-gcc12 diff --git a/Makefile.inc1 b/Makefile.inc1 index 2f442bc9a394..19ed923702b1 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -146,7 +146,6 @@ TARGET_TRIPLE_ABI?= unknown TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/}-${TARGET_TRIPLE_ABI}-freebsd${OS_REVISION} KNOWN_ARCHES?= aarch64/arm64 \ amd64 \ - armv6/arm \ armv7/arm \ i386 \ powerpc \ diff --git a/UPDATING b/UPDATING index 2b6f9cb0d956..fc3abb285039 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 15.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20240712: + Support for armv6 has been disconnected and is being removed. + 20240617: ifconfig now treats IPv4 addresses without a width or mask as an error. Specify the desired mask or width along with the IP address on the diff --git a/sys/sys/param.h b/sys/sys/param.h index 75370d5998fb..887c595a1de5 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -73,7 +73,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1500019 +#define __FreeBSD_version 1500020 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From nobody Fri Jul 12 11:32:18 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8Zp4ZdZz5QCNR; Fri, 12 Jul 2024 11:32: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8Zp2vlmz4q0h; Fri, 12 Jul 2024 11:32:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783938; 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=b/6udvJC2wyXCT69I/bnCR8V+jpCLR/rQKrlAXyKTVk=; b=FTzyYJ1dZC7qDBGtF+EBPxJBZA49XZNrMFOaM7BSP1iUGzYX+lLijMj0EKwfcfno/aJiZ/ dF6TKUajOAwhZjzzWqZXetQLqk1PI4aasbpPqyQhe0PEQLLyzAf6g5A1BEeRZo1CP7JtRm yvt5/oNMmmM/7YtGAEp7kHeNDgaBGHHpGB5sAyLDKOuB3AL3M6ln0OZja3us2X+GPB29+m jcDtUMThBCA11OJIRL0+AWS+8W8BoSqFE/a017Y34n+4LeevfjYZ+Z3T/BEKeTEpHVvLTl oLUqZPv3pZxF1taNU0aFEe7LjpuZuRaxsXxrhxBdnaB4Mp93oMy0i4L7hQ1L+A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783938; a=rsa-sha256; cv=none; b=nCZV36fWS3sECKcyONDmA09R0CW4ErYNAd4yHINS2GY5RsgDAsXDa9HhK2uD2XA4mMqrGR R99M4FJbqmCqOrPqUVMjhGvj+ztm3dal9W6RSCLQWL/8HbS1Ny+WTfeBHtT5KD/DDby21g rVzz/hAMHmfwz79qLyQHZ8vU+Cy5qkR6oUHD7kX5h696Gz92p/hG610TfHKG4Aq08coB3R WCVX1nrI+2pTGsfU/bFBPhPyiScWj5pUBKn5p3+MYbAG3mMYcUNUWy2reubhwU/ZWGsoYL cJ2c4iKV1sZ/7h/S05EpYtP9zup1SQ65BzC7aWfD5MOTSrhh7FnjZgblkM21gg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783938; 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=b/6udvJC2wyXCT69I/bnCR8V+jpCLR/rQKrlAXyKTVk=; b=R2XbbsKgXe1lMIMhoizqYhQ9E+UDKtQeI1Zv7TCTgZ8iOsGX1gglAi9OZPxUFa7CgfwiBk 8W+ordT8Yu00hrXv5r6QL/hvGHkyXT46WkaUQbsHnEafOjqkrfor6xVyEoccDwY1LhzIJO ru9Qq3oOmnoycVeXZyk4Epvm6mqAFWUcnatY6ogBMbzj73Lj9nngaKBx6XNvVyUp6MtJrC aYNyUF7fyyUfb7RyHK0uUPvHiBsrzHOsWra6AD9xxsqH2cgonL9h/CLidlMHDNSeJ+z6OL VYmNeVBCzFrwe3n8CCzqgJsA4juvNuWpYFCWZeALOF5OMdCfLvLAg/oE9xRxnQ== 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 4WL8Zp2FpFzhHT; Fri, 12 Jul 2024 11:32: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 46CBWIbB010310; Fri, 12 Jul 2024 11:32:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBWI9x010307; Fri, 12 Jul 2024 11:32:18 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:32:18 GMT Message-Id: <202407121132.46CBWI9x010307@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 06999c8a3a3c - main - share/mk: Remove armv6 support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 06999c8a3a3cbd254b8e52b25549e5f5222dafa6 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=06999c8a3a3cbd254b8e52b25549e5f5222dafa6 commit 06999c8a3a3cbd254b8e52b25549e5f5222dafa6 Author: Andrew Turner AuthorDate: 2024-07-12 11:28:44 +0000 Commit: Andrew Turner CommitDate: 2024-07-12 11:31:54 +0000 share/mk: Remove armv6 support It is being removed from the tree. Remove the build infrastructure to configure armv6 builds. Reviewed by: manu, imp, emaste Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45643 --- share/mk/bsd.cpu.mk | 5 +---- share/mk/bsd.opts.mk | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk index 793c01b76dca..29eb4662dcdd 100644 --- a/share/mk/bsd.cpu.mk +++ b/share/mk/bsd.cpu.mk @@ -315,13 +315,10 @@ MACHINE_CPU = riscv ########## arm .if ${MACHINE_CPUARCH} == "arm" MACHINE_CPU += arm -. if ${MACHINE_ARCH:Marmv6*} != "" -MACHINE_CPU += armv6 -. endif . if ${MACHINE_ARCH:Marmv7*} != "" MACHINE_CPU += armv7 . endif -# Normally armv6 and armv7 are hard float ABI from FreeBSD 11 onwards. However +# Normally armv7 is hard float ABI from FreeBSD 11 onwards. However # when CPUTYPE has 'soft' in it, we use the soft-float ABI to allow building of # soft-float ABI libraries. In this case, we have to add the -mfloat-abi=softfp # to force that. diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index 18098c93605c..136215a2db47 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -95,7 +95,7 @@ __DEFAULT_DEPENDENT_OPTIONS = \ # means that ASLR is of limited effectiveness, and it may cause issues with # some memory-hungry workloads. # -.if ${MACHINE_ARCH} == "armv6" || ${MACHINE_ARCH} == "armv7" \ +.if ${MACHINE_ARCH} == "armv7" \ || ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" \ || ${MACHINE_ARCH} == "powerpcspe" __DEFAULT_NO_OPTIONS+= PIE From nobody Fri Jul 12 11:32:19 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8Zq6wMPz5QCQC; Fri, 12 Jul 2024 11:32: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8Zq3vshz4qB0; Fri, 12 Jul 2024 11:32:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783939; 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=fEDmx1WbsxDoWpsPAQM2bziUGan2cD+OA0U1xq+VCmE=; b=y0lHvuKZIUC78YR1wrTp4e25TzTElTyGt9SPjODqJ2EvmHrTbNAeEqz+BfOWY/LJCqYGfM nur/PSMw3lVGfI7hsNQi6DzMyfAjXn9AFTI4qaASlAu/LNKGusVHpTfH/aUTfMRgaCF/kG SzJnIgApm1XOoZL1YGQw3xp3TtFAuCQ6kkgXi68cj8xtvt5G5AlqFrlx3GDZlUOdgNZ71z JcjQmnnOo1FVQFYi3rXfACVlLAUuFV3dQgkkKxDaY/XpZtS7kVtx/knDRCRPaTPWIun0C/ oeMQ9Wvqnv1hcLhe72qVTMi6ZUcO1UIazbPvzhxXspL6oB4M6h0jpWnrjdYB6A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783939; a=rsa-sha256; cv=none; b=n/oo5ujPUrzt10RjToHRJlwfeGr4TRruwO1ILAghe39fa7ZpkuNJLnLwyMznwwYI5O/zgW ujWqVch7jsi0DwGPnd2WzvVaG12hzdZCW64F4yajCT9hkbtVE4eHqZYNFRW/yBW/RZ8/Lw 4yd9KtI14E88Ex9pWmONfSkQ6mTPYnpbYLyxZUXvgIUQ4wda4dSh/LXQWcWrv/aguKWA/h lP+A7Y3dCXj5NB+hIadJqnzI5T9Psh8boEygROt/etqeWOqItsqoLZ1E2miKi3jcJa80xs 4DRqz+ejn9ociC4RXhVnP2VOBxGN5geBl1m2TsX8oWl5q1h0Brbw1tfNvi4FGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783939; 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=fEDmx1WbsxDoWpsPAQM2bziUGan2cD+OA0U1xq+VCmE=; b=NKt3t35opgbKnSfp/FpT8BFpclt29TrVI17idicj8AwwLKH/SaXfiRD0V5pM2oM+B3/3S/ OVFyy88ZkwkVUCx5LmlqfAskvi+D8idxcMV93NRv4hk+HmWClEZ2i4Y7vYca+a+5neFwdk hmCzRYHqf8ktH692fUn2OSHQNiVqXBSViqaSTWvt0aqg8sUrxKHugaIYSTJCFEot37UbuF LZEWeFnI+vzBQSs0+H9VZJDLg2dfoPeqO757tzZNy3on5puqiXSnaRfAUAZUWqBU5zsx+0 ig7TZNWw9m/gILOmGh1jStZDhaedH0ZH6OXIJ3RHb+UqR78+CGeK6fqYWcc+mA== 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 4WL8Zq3Fqdzhqd; Fri, 12 Jul 2024 11:32: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 46CBWJU9010354; Fri, 12 Jul 2024 11:32:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBWJ8f010351; Fri, 12 Jul 2024 11:32:19 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:32:19 GMT Message-Id: <202407121132.46CBWJ8f010351@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 97dbe3e7ace2 - main - libclang_rt: Simplify the arm check List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 97dbe3e7ace2c222b18f4eb787de91ee44192e76 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=97dbe3e7ace2c222b18f4eb787de91ee44192e76 commit 97dbe3e7ace2c222b18f4eb787de91ee44192e76 Author: Andrew Turner AuthorDate: 2024-07-12 11:28:50 +0000 Commit: Andrew Turner CommitDate: 2024-07-12 11:31:54 +0000 libclang_rt: Simplify the arm check We just need to check we are building for arm. Reviewed by: manu, emaste Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45644 --- lib/libclang_rt/compiler-rt-vars.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libclang_rt/compiler-rt-vars.mk b/lib/libclang_rt/compiler-rt-vars.mk index 5a9f115697d9..c4a33309bc89 100644 --- a/lib/libclang_rt/compiler-rt-vars.mk +++ b/lib/libclang_rt/compiler-rt-vars.mk @@ -5,7 +5,7 @@ SANITIZER_SHAREDIR= ${CLANGDIR}/share # armv[67] is a bit special since we allow a soft-floating version via # CPUTYPE matching *soft*. This variant may not actually work though. -.if ${MACHINE_ARCH:Marmv[67]*} != "" && \ +.if ${MACHINE_CPUARCH} == "arm" && \ (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") CRTARCH?= armhf .else From nobody Fri Jul 12 11:32:20 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WL8Zr70Skz5QCHF; Fri, 12 Jul 2024 11:32: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WL8Zr4Dgcz4q63; Fri, 12 Jul 2024 11:32:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783940; 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=cM0PxCtjnKSS1+eONSf4tvKbbCb7nw7cxD87HQT50FM=; b=GVKUd3hrs9a5Pmp3LfTEkySJ+Y63AoSopnpBDn+k9+lnD0uk22vxykQXsK95cbe6Df84lS KFhvktsky+fnCq6IaSRpba74iOH9sgdn+gxXVbWTabH0nEEaWYAXNDSiTVeoRntl+3aa88 l75QUJnG1DNymnMEmwTa/lDTo4Z6raYOBzbQr2ddnO285KDg/S3DuGFYseKY1fv4KKh5pa WZ9Q5HVrM+bQsJpAEhVxUtjfsuZAJEyYqtcMN5TK9xFuFMYsw4LFeQ4hgx0LpNPDMFUZiI 9+P8RovBIIWA5B8V5hjLa82RnPhKVg2/ivcx2tuoMZ+JYtmhL1tCke9iHbtbfg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720783940; a=rsa-sha256; cv=none; b=P93uxQoqxlXKS4L7sPsgd/CRiFzyqhc7oioRzfxDY4QC7yQOwH/qWUPU6dUXQlpE7nZz0i IKzXhqh/zy5fskhZI6yg5QEq67gWHnSSVlhHjpXnGZimcV+lduaWa1ItJQ1Wv6uSyvfWyP M2kDnnOcBiyZ9M5cRdpWwjoDdv0p0gRoS/jFuxvulA0k8mt3TdWA0de0Bh7MukcfDzOB4Y vE7eaxsRFftwsBiMF913FJZUxhI2725DRnJLWo0Oe1xMD8iIG2l3z0owzy5f2x3b+F4Z8k XwJCtT1AfvcWhqAmvDdUf+aql8Grn3sIt3UdWtBWHC039Wq/OWkYs22YYCEIzg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720783940; 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=cM0PxCtjnKSS1+eONSf4tvKbbCb7nw7cxD87HQT50FM=; b=IK2tqgr6ldLpbUCvzj0t60Nvt69fBLrR0ZVLhfnwVjmY2LukLwDcpGF9vANFhlLdr91Ruz 9IFr0/k/HjFZdrtp754GhhkAqj2OPXKV5LAGNBsV00CgJrJuXhjkTUNLNMIKls8oATUudX 99MnfNrteqv0saSFwoPCOl+qR0IpUEoXFlrGgckTWpq4ZptRerr7OuIkKfiUZEMKPCs/B+ pa1unEEIDRHNAd+rc7LuVzeqTwQ/Wl4k6TM8ARbrKJd65oR7TlBpxUqxPgvgDfmjHY7lIJ LRVr8NfJ9TXyQBrz0wAIxHp4+UP515Xb/ozAFNwVuitBoQd8CxdRFr2fPqH/0Q== 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 4WL8Zr3qlBzhWb; Fri, 12 Jul 2024 11:32:20 +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 46CBWKmd010404; Fri, 12 Jul 2024 11:32:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CBWKnN010401; Fri, 12 Jul 2024 11:32:20 GMT (envelope-from git) Date: Fri, 12 Jul 2024 11:32:20 GMT Message-Id: <202407121132.46CBWKnN010401@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: f5c7644378f8 - main - sys/arm: Remove armv6 kernel configs List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f5c7644378f884dad473011a1f9350fed6fe4e4e Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=f5c7644378f884dad473011a1f9350fed6fe4e4e commit f5c7644378f884dad473011a1f9350fed6fe4e4e Author: Andrew Turner AuthorDate: 2024-07-12 11:28:57 +0000 Commit: Andrew Turner CommitDate: 2024-07-12 11:31:54 +0000 sys/arm: Remove armv6 kernel configs Only the Raspberry Pi config was supported on armv6. Remove it in preparation for removing armv6 support from the kernel. Reviewed by: manu, emaste Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45646 --- sys/arm/conf/RPI-B | 109 ------------------------------------------------- sys/arm/conf/std.armv6 | 81 ------------------------------------ 2 files changed, 190 deletions(-) diff --git a/sys/arm/conf/RPI-B b/sys/arm/conf/RPI-B deleted file mode 100644 index d0a3ee13c367..000000000000 --- a/sys/arm/conf/RPI-B +++ /dev/null @@ -1,109 +0,0 @@ -# -# RPI-B -- Custom configuration for the Raspberry Pi -# -# For more information on this file, please read the config(5) manual page, -# and/or the handbook section on Kernel Configuration Files: -# -# https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-config -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first -# in NOTES. -# - -ident RPI-B - -include "std.armv6" -include "../broadcom/bcm2835/std.rpi" -include "../broadcom/bcm2835/std.bcm2835" - -options SCHED_4BSD # 4BSD scheduler -options PLATFORM - -# NFS root from boopt/dhcp -#options BOOTP -#options BOOTP_NFSROOT -#options BOOTP_COMPAT -#options BOOTP_NFSV3 -#options BOOTP_WIRED_TO=ue0 - -#options ROOTDEVNAME=\"ufs:mmcsd0s2\" - -# pseudo devices -device clk -device phy -device hwreset -device nvmem -device regulator -device syscon - -device bpf -device loop -device ether -device uart -device pty -device snp -device pl011 - -# Device mode support -device usb_template # Control of the gadget - -# Comment following lines for boot console on serial port -device vt -device kbdmux -device hkbd -device ukbd - -device sdhci -device mmc -device mmcsd - -device gpio -device gpioled - -# I2C -device iic -device iicbus -device bcm2835_bsc - -device md - -# USB support -device usb -device dwcotg # DWC OTG controller - -# USB storage support -device scbus -device da -device umass - -# USB ethernet support -device smscphy -device mii -device smsc - -# SPI -device spibus -device bcm2835_spi - -device vchiq -device sound - -device fdt_pinctrl - -# HID support -device hid # Generic HID support - -# Flattened Device Tree -options FDT # Configure using FDT/DTB data -# Note: DTB is normally loaded and modified by RPi boot loader, then -# handed to kernel via U-Boot and ubldr. -#options FDT_DTB_STATIC -#makeoptions FDT_DTS_FILE=rpi.dts -makeoptions MODULES_EXTRA="dtb/rpi rpi_ft5406" diff --git a/sys/arm/conf/std.armv6 b/sys/arm/conf/std.armv6 deleted file mode 100644 index a24227fc838f..000000000000 --- a/sys/arm/conf/std.armv6 +++ /dev/null @@ -1,81 +0,0 @@ -# Standard kernel config items for all ARMv6 systems. -# - -options HZ=1000 -options PREEMPTION # Enable kernel thread preemption -options VIMAGE # Subsystem virtualization, e.g. VNET -options INET # InterNETworking -options INET6 # IPv6 communications protocols -options CC_CUBIC # include CUBIC congestion control -options TCP_HHOOK # hhook(9) framework for TCP -device crypto # core crypto support -options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 -options NETLINK # netlink(4) support -options SCTP_SUPPORT # Allow kldload of SCTP -options FFS # Berkeley Fast Filesystem -options SOFTUPDATES # Enable FFS soft updates support -options UFS_ACL # Support for access control lists -options UFS_DIRHASH # Improve performance on big directories -options UFS_GJOURNAL # Enable gjournal-based UFS journaling -options QUOTA # Enable disk quotas for UFS -options NFSCL # Network Filesystem Client -options NFSLOCKD # Network Lock Manager -options NFS_ROOT # NFS usable as /, requires NFSCL -options MSDOSFS # MSDOS Filesystem -options CD9660 # ISO 9660 Filesystem -options PROCFS # Process filesystem (requires PSEUDOFS) -options PSEUDOFS # Pseudo-filesystem framework -options TMPFS # Efficient memory filesystem -options GEOM_PART_GPT # GUID Partition Tables -options GEOM_PART_BSD # BSD partition scheme -options GEOM_PART_MBR # MBR partition scheme -options GEOM_LABEL # Provides labelization -options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!] -options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI -options KTRACE # ktrace(1) support -options STACK # stack(9) support -options SYSVSHM # SYSV-style shared memory -options SYSVMSG # SYSV-style message queues -options SYSVSEM # SYSV-style semaphores -options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions -options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. -options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) -options CAPABILITY_MODE # Capsicum capability mode -options CAPABILITIES # Capsicum capabilites -options FREEBSD_BOOT_LOADER # Process metadata passed from loader(8) -options VFP # Enable floating point hardware support -options MAC # Support for Mandatory Access Control (MAC) - -options COMPAT_FREEBSD10 # Compatible with FreeBSD10 -options COMPAT_FREEBSD11 # Compatible with FreeBSD11 -options COMPAT_FREEBSD12 # Compatible with FreeBSD12 -options COMPAT_FREEBSD13 # Compatible with FreeBSD13 -options COMPAT_FREEBSD14 # Compatible with FreeBSD14 - -# DTrace support -options KDTRACE_HOOKS # Kernel DTrace hooks -options DDB_CTF # all architectures - kernel ELF linker loads CTF data -makeoptions WITH_CTF=1 - -# Debugging support. Always need this: -makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols -options KDB # Enable kernel debugger support. -options KDB_TRACE # Print a stack trace for a panic. - -options USB_DEBUG # Enable usb debug support code - -# For full debugger support use (turn off in stable branch): -include "std.debug" - -# Optional extras, never enabled by default: -#options BOOTVERBOSE -#options DEBUG # May result in extreme spewage -#options KTR -#options KTR_COMPILE=KTR_ALL -#options KTR_ENTRIES=16384 -#options KTR_MASK=(KTR_SPARE2) -#options KTR_VERBOSE=0 -#options USB_REQ_DEBUG -#options USB_VERBOSE - From nobody Fri Jul 12 14:17:28 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLDFN68vxz5QTlF; Fri, 12 Jul 2024 14:17:28 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLDFN4tZfz4FQn; Fri, 12 Jul 2024 14:17:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720793848; 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=9LsGA8tvGH3/FINiPochz2qD+VLjs4fzpdq/ou/vJiI=; b=w5amZJL+nWVNYLcqAn7YFm944x2Pq8sLUgrcDBIn8ud2M4fHarHr0hxAXxP8Q/pEETX/5o 8OlOS0z5CODl/MElX+GWO0gGoMwGoXKXt96+wEc7ozCv3yeY1EITvxuJ/9Qbuqoef2Tz9U gEHOOupi03LTeeTlFyCxpzSIvZSewcoU3wuyT8V+qCYyxjtKm451Ot3MGzrbl1JASXgmon pBD6sK3aL4TL8IqKsBZ1CBwARZfvhmAPzI0moTh29Nqj6Fn1SogtY+VTp15zvqwgc0B1gY x0oP0h3coptAJAKqNbUMM9+vNfwkeHdKPe4JW6WTyWtESFbGw2kYduFPwDqIcQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720793848; a=rsa-sha256; cv=none; b=CJg5vNcXKy1LFXYdBiGWB0PcUrrpO2RKpgpko0YdBkGHwNE49SxN4b3OH8Tey2IJq160xz SVqhVRO6Mp5X0cY29xZUW2rSDm4jaos60aes3RPpzK+vyRN1I7soPEVSvc967EJOXTz1Ly UTY8DSWBLkDPwE+X3HdhGHpA81TaaNRpeK725WqOygBqkosVsg2guY7Bhk4hkOhmpqzA4b AOx+T6sbkH9xdbQI4xQUcQUIkmg4loiP6i2C0pNtftmsDu/2IWjUrCu17xwokVa+f5d1LY iZa13m6pR6fm4YgbqHNxevKdI+M1PS+k5BM2AlI2SHB09dxaBrBzBsEYW8A83w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720793848; 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=9LsGA8tvGH3/FINiPochz2qD+VLjs4fzpdq/ou/vJiI=; b=cH3Plo0I1Fe+PaRSgCX5ISqkQMdra2w2fXHE6mOfPqnY0pDzVlrkYSLLw26psv9EUSDxud IMwX2Q8ZE/fJl42Q4NCmYNRCl/oDKq96B52HkseBpk9MJndeA/7LnlEBa6tYXVF63nog0A bDRaEreauofE20z/q1iEfxi3Hbh6hL9fC3gYa43DLtKsHe2oo6l7wgSnB+XbuEBrIPhzEQ ahcEVjia7Pmx9KEz8fkHzK5HkeTlPXRxVabvIwtWaatFhApYyyVt/34+7MvugsE/XDhMi1 //X5WB2FC8dJKCAhYCyeYISGfi1vYGWh0iC89Z7K2e0ALeOHfVn9YwO7lXUMgw== 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 4WLDFN4RnWzmZy; Fri, 12 Jul 2024 14:17:28 +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 46CEHSXH082881; Fri, 12 Jul 2024 14:17:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CEHSoa082878; Fri, 12 Jul 2024 14:17:28 GMT (envelope-from git) Date: Fri, 12 Jul 2024 14:17:28 GMT Message-Id: <202407121417.46CEHSoa082878@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: cb18ba9df52d - main - time.1: minor cleanup (alignment/macro/spdx) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cb18ba9df52df247198c0f41979090686a0f8403 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=cb18ba9df52df247198c0f41979090686a0f8403 commit cb18ba9df52df247198c0f41979090686a0f8403 Author: Alexander Ziaee AuthorDate: 2024-07-05 00:22:03 +0000 Commit: Mitchell Horne CommitDate: 2024-07-12 14:16:39 +0000 time.1: minor cleanup (alignment/macro/spdx) + shorter example filename to minimize line wrap + standards macro clarifying posix => posix.2 + align options + tag spdx Reviewed by: mhorne MFC after: 3 days Pull-Request: https://github.com/freebsd/freebsd-src/pull/1315 --- usr.bin/time/time.1 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/usr.bin/time/time.1 b/usr.bin/time/time.1 index 6f70e8e52759..e6cfa6affaa1 100644 --- a/usr.bin/time/time.1 +++ b/usr.bin/time/time.1 @@ -1,3 +1,6 @@ +.\"- +.\" SPDX-License-Identifier: BSD-3-Clause +.\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -56,7 +59,7 @@ the time used to execute the process and the time consumed by system overhead. .Pp The following options are available: -.Bl -tag -width indent +.Bl -tag -width "-o file" .It Fl a If the .Fl o @@ -143,8 +146,8 @@ file. Then execute the command again to make a new copy and add the result to the same file: .Bd -literal -offset indent -$ /usr/bin/time -o times.txt cp FreeBSD-12.1-RELEASE-amd64-bootonly.iso copy1.iso -$ /usr/bin/time -a -o times.txt cp FreeBSD-12.1-RELEASE-amd64-bootonly.iso copy2.iso +$ /usr/bin/time -o times.txt cp source.iso copy1.iso +$ /usr/bin/time -a -o times.txt cp source.iso copy2.iso .Ed .Pp The @@ -190,7 +193,8 @@ sys 0.00 .Sh STANDARDS The .Nm -utility is expected to conform to ISO/IEC 9945-2:1993 (``POSIX''). +utility is expected to conform to +.St -iso9945-2-93 .Sh HISTORY A .Nm From nobody Fri Jul 12 15:37:18 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLG1V68xVz5QdNY; Fri, 12 Jul 2024 15:37: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLG1V5fg7z4N0x; Fri, 12 Jul 2024 15:37:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720798638; 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=zqCVxc9cfgAb3SjTdbqvMo87Tqei1f9dLxPOBzMZ808=; b=HYJ1Oa+lbN2rPVg9Z7xfShXP+b6oQLjBGNBxCapuN8sSqbVqYUhEa7S1XfYJc57Otu6zie IEyHX8ypKwj6bgSB4H0OrQVFL5ASXCCXGEmo75JXEe6KZys4p15mQq1vM35ndxabIjIw3Y KbuqbQ3I3OfcIbq+DHySgR8/IJJWEvDGaW+cuYraiHTtWE5jW+ikVaB9r4abru0U2LKtbs ktsfRG3jcZlI7wjyWx8fnLRSfaafSoSNpyvTZJ9/0EQVGm0Im0rM2r4aM0AcJB0x4bNvGP vre0uS0l6XK2NEPXJuvMQtVkPerQuFQO3df8ZEChL6Q0z20gDFfLqrPi2I4a5Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720798638; a=rsa-sha256; cv=none; b=ZL7hMGMoJDdhZ5USkR2HXKPA+xUdEb6M2Lx6b2wxm9lGg6jd2l8NtKrRwU/tju/Mf9OpnU qQma+183fOIyNXpnPuavbSCq8eTJT9kcNY0PckNzW9HSqj3HTP5jNIyUTnq0RD6wjGx2Sw g0M2y5TJ50UdMT1yZM4BKJ+NdZUUapRkhHLC9bSNegYnKpragrllfmBXDmnOgEzVy78tGE tuhAXl2YiD+NYwBNGlt9OOvdKGPCDNv3hE3TlOTFkza8Z5kigY+9EyiCjrLDLH0/M3tO3s 7IXjpgNiAQUXtZguTEDbY8+9bCOAqANpD8D031ftg7xzZYiF0qJpRtEjETdl7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720798638; 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=zqCVxc9cfgAb3SjTdbqvMo87Tqei1f9dLxPOBzMZ808=; b=jYck1kixb4dKzEfNBxt9fEdVngF3ReXk/a7ypOXZzT9fd8t7qcwcgXJOEAgfjAEGuM0S9u WXDxWBQJScvr0ZgogVDzjsyDcFj4xG+rn4lRujVmSL3B1WLkv7+SIWUmS+ppkgzdzoOF2k w9qneX3SQP62GK22n3mlrc2GZyUqS4oc951zX+0rLmDW4XR7DHg7HjaJY/U8NQwPazz0F/ pYubeUnfKFq0oh7Sxecygbr3DK+9HJS4iTupUVxhkDLQU4fkql6S7/OrZ4B4r8XPsddAtX Zyau2vSy3AqQxkc5xJqrOsfC4DFSVRfJBgBZ++qzPVJNopb7+ZrhChh6VBfIcw== 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 4WLG1V5FcZzpW2; Fri, 12 Jul 2024 15:37: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 46CFbICV019151; Fri, 12 Jul 2024 15:37:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46CFbINd019148; Fri, 12 Jul 2024 15:37:18 GMT (envelope-from git) Date: Fri, 12 Jul 2024 15:37:18 GMT Message-Id: <202407121537.46CFbINd019148@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 6ac0f711ad9e - main - nvmecontrol: Fix "Workloadd" typo List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6ac0f711ad9ecd9ac1525787bb08002c85c03cde Auto-Submitted: auto-generated The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=6ac0f711ad9ecd9ac1525787bb08002c85c03cde commit 6ac0f711ad9ecd9ac1525787bb08002c85c03cde Author: Alexander Motin AuthorDate: 2024-07-12 15:36:40 +0000 Commit: Alexander Motin CommitDate: 2024-07-12 15:36:40 +0000 nvmecontrol: Fix "Workloadd" typo MFC after: 1 week --- sbin/nvmecontrol/power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/power.c b/sbin/nvmecontrol/power.c index 57270e1995e3..b26570da0c52 100644 --- a/sbin/nvmecontrol/power.c +++ b/sbin/nvmecontrol/power.c @@ -90,7 +90,7 @@ power_list(struct nvme_controller_data *cdata) int i; printf("\nPower States Supported: %d\n\n", cdata->npss + 1); - printf(" # Max pwr Enter Lat Exit Lat RT RL WT WL Idle Pwr Act Pwr Workloadd\n"); + printf(" # Max pwr Enter Lat Exit Lat RT RL WT WL Idle Pwr Act Pwr Workload\n"); printf("-- -------- --------- --------- -- -- -- -- -------- -------- --\n"); for (i = 0; i <= cdata->npss; i++) power_list_one(i, &cdata->power_state[i]); From nobody Sat Jul 13 01:39:50 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLWNk2hvrz5RFRj; Sat, 13 Jul 2024 01:39: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLWNk29qcz4SKM; Sat, 13 Jul 2024 01:39:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720834790; 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=jPBQdCoJNr3d/1rXWVq+UEv/6wVeJ6Tg86mmEW6NKFI=; b=qTjgb1svu2CQLtKGcCd2PiU/Y24xU08NelkwE0Y3fCOrrtVst5G1tdel4oYnIm6pGA7nPR IwOtN3Whnm45LDznd6F+A5qme6oFVQ/LFRUl44OiWCfDOAeWPenwx+lmovVARO+w7j/ip3 lu6/aTfvICcUEPKBTUz9rNye3ep2UcvJTwmYSeplBTrzWWEzfUoXfqN1rmq9FemzF6j/UF QPmy4wIgzdgBSqvWmTLdDqL6Wx+EkRo/BYJBqiSm7U1HvGs4tSpeuIBeA6u1LYVweytV2K YV7X18PzIwIm+7e1z8f8pMbFjDjz29fu/OVBt0kQ1MIZ5Gti7utSyj9yy/WPXw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720834790; a=rsa-sha256; cv=none; b=xyXhTIQJF1/AsSpzhC8rn3ashiucsS89E0RhSuyA20Uns03CzfMmdAvlAIqi4pxpbIQHPX R3u9G7FLO47VyYs4J8KPYYo6TuR5sxipwNTQ7jQ+cXK9QxuSCjwO/iE+Y5gpU4jiGnaPa4 dkrjZrhNPYrpIZT39pSQp1ucThJbF8HTtR7GLGEXMWLuqkAIEPH+nd/zin/vd2iGoVVt9+ HmZwI8+TILFIpJMkDHRdgR8/XDUU0nh8D5ZO4jc4KGynU8oci58AKfdF2SPcU1HVIA8NWI vBIPt58lv4yRj3SCWQBSaA5UlH3gK8PYx0LyuURxiJ0NDW4W+VvhbPs5eVZcaQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720834790; 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=jPBQdCoJNr3d/1rXWVq+UEv/6wVeJ6Tg86mmEW6NKFI=; b=gUnlCJAUsCPRoLNpUPkCL1an+BBE3i3U8LlOjxtEqlRiWxar/NZZh+N8QFnP7guHQPt5tr ZVm8prMV3xvWWQIXopYNm2CewrCrH0vrNC7do/LxOJnFkvK+/iJZbGSePICa8De4yC53K1 jiQHuOux0yXaStqxP3B5pyKS08cROyOa5LFVCHJHb6Aou8oNn+KWfu205qyKuOE0dUk5it 8SMOPZwNyQYwPMU9ufver6lV+0i2Jda05RVMZkH4eXcNUC2SLEIG5CT6s34Gu+wM54TKZw ZIOrgAKHRtuQakRd6k78SwAwVEcpfI7VWUrj8k80ZCkH0GxEgXLZQFUyD8dmmQ== 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 4WLWNk1fwGz15fr; Sat, 13 Jul 2024 01:39: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 46D1dou3038784; Sat, 13 Jul 2024 01:39:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46D1doOh038780; Sat, 13 Jul 2024 01:39:50 GMT (envelope-from git) Date: Sat, 13 Jul 2024 01:39:50 GMT Message-Id: <202407130139.46D1doOh038780@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: eb60ff1ee16a - main - unionfs: rework locking scheme to only lock a single vnode List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eb60ff1ee16a7d22415d6065d808ddf0b5c13d7a Auto-Submitted: auto-generated The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=eb60ff1ee16a7d22415d6065d808ddf0b5c13d7a commit eb60ff1ee16a7d22415d6065d808ddf0b5c13d7a Author: Jason A. Harmening AuthorDate: 2024-02-28 17:45:56 +0000 Commit: Jason A. Harmening CommitDate: 2024-07-12 22:05:16 +0000 unionfs: rework locking scheme to only lock a single vnode Instead of locking both the lower and upper vnodes, which is both complex and deadlock-prone, only lock the upper vnode, or the lower vnode if no upper vnode is present. In most cases this is all that is needed; for the cases in which both vnodes do need to be locked, this change also employs deadlock- avoiding techniques such as LK_NOWAIT and vn_lock_pair(). There are still some corner cases in which the current implementation ends up taking multiple vnode locks across different filesystems without taking special steps to avoid deadlock; those cases have been noted in the comments. Differential Revision: https://reviews.freebsd.org/D45398 Reviewed by: olce Tested by: pho --- sys/fs/unionfs/union.h | 32 +- sys/fs/unionfs/union_subr.c | 768 +++++++++++++++++++++-------------- sys/fs/unionfs/union_vfsops.c | 15 +- sys/fs/unionfs/union_vnops.c | 910 +++++++++++++++++++++++------------------- 4 files changed, 979 insertions(+), 746 deletions(-) diff --git a/sys/fs/unionfs/union.h b/sys/fs/unionfs/union.h index 467db3b29ff8..c535a3b288b8 100644 --- a/sys/fs/unionfs/union.h +++ b/sys/fs/unionfs/union.h @@ -97,15 +97,17 @@ struct unionfs_node { char *un_path; /* path */ int un_pathlen; /* strlen of path */ - int un_flag; /* unionfs node flag */ -}; -/* - * unionfs node flags - * It needs the vnode with exclusive lock, when changing the un_flag variable. - */ -#define UNIONFS_OPENEXTL 0x01 /* openextattr (lower) */ -#define UNIONFS_OPENEXTU 0x02 /* openextattr (upper) */ + /* + * unionfs node flags + * Changing these flags requires the vnode to be locked exclusive. + */ + #define UNIONFS_OPENEXTL 0x01 /* openextattr (lower) */ + #define UNIONFS_OPENEXTU 0x02 /* openextattr (upper) */ + #define UNIONFS_COPY_IN_PROGRESS 0x04 /* copy/dir shadow in progres */ + #define UNIONFS_LOOKUP_IN_PROGRESS 0x08 + unsigned int un_flag; /* unionfs node flag */ +}; extern struct vop_vector unionfs_vnodeops; @@ -136,29 +138,25 @@ void unionfs_get_node_status(struct unionfs_node *, struct thread *, void unionfs_tryrem_node_status(struct unionfs_node *, struct unionfs_node_status *); int unionfs_check_rmdir(struct vnode *, struct ucred *, struct thread *td); -int unionfs_copyfile(struct unionfs_node *, int, struct ucred *, +int unionfs_copyfile(struct vnode *, int, struct ucred *, struct thread *); void unionfs_create_uppervattr_core(struct unionfs_mount *, struct vattr *, struct vattr *, struct thread *); int unionfs_create_uppervattr(struct unionfs_mount *, struct vnode *, struct vattr *, struct ucred *, struct thread *); -int unionfs_mkshadowdir(struct unionfs_mount *, struct vnode *, - struct unionfs_node *, struct componentname *, struct thread *); +int unionfs_mkshadowdir(struct vnode *, struct vnode *, + struct componentname *, struct thread *); int unionfs_mkwhiteout(struct vnode *, struct vnode *, struct componentname *, struct thread *, char *, int); int unionfs_relookup(struct vnode *, struct vnode **, struct componentname *, struct componentname *, struct thread *, char *, int, u_long); -int unionfs_relookup_for_create(struct vnode *, struct componentname *, - struct thread *); -int unionfs_relookup_for_delete(struct vnode *, struct componentname *, - struct thread *); -int unionfs_relookup_for_rename(struct vnode *, struct componentname *, - struct thread *); void unionfs_forward_vop_start_pair(struct vnode *, int *, struct vnode *, int *); bool unionfs_forward_vop_finish_pair(struct vnode *, struct vnode *, int, struct vnode *, struct vnode *, int); +int unionfs_set_in_progress_flag(struct vnode *, unsigned int); +void unionfs_clear_in_progress_flag(struct vnode *, unsigned int); static inline void unionfs_forward_vop_start(struct vnode *basevp, int *lkflags) diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index bb57f3d56ade..671322704dc5 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -203,19 +203,19 @@ unionfs_ins_cached_vnode(struct unionfs_node *uncp, struct unionfs_node_hashhead *hd; struct vnode *vp; - ASSERT_VOP_ELOCKED(uncp->un_uppervp, __func__); - ASSERT_VOP_ELOCKED(uncp->un_lowervp, __func__); - KASSERT(uncp->un_uppervp == NULLVP || uncp->un_uppervp->v_type == VDIR, - ("%s: v_type != VDIR", __func__)); - KASSERT(uncp->un_lowervp == NULLVP || uncp->un_lowervp->v_type == VDIR, - ("%s: v_type != VDIR", __func__)); - vp = NULLVP; VI_LOCK(dvp); - if (uncp->un_uppervp != NULL) + if (uncp->un_uppervp != NULLVP) { + ASSERT_VOP_ELOCKED(uncp->un_uppervp, __func__); + KASSERT(uncp->un_uppervp->v_type == VDIR, + ("%s: v_type != VDIR", __func__)); vp = unionfs_get_cached_vnode_locked(uncp->un_uppervp, dvp); - else if (uncp->un_lowervp != NULL) + } else if (uncp->un_lowervp != NULLVP) { + ASSERT_VOP_ELOCKED(uncp->un_lowervp, __func__); + KASSERT(uncp->un_lowervp->v_type == VDIR, + ("%s: v_type != VDIR", __func__)); vp = unionfs_get_cached_vnode_locked(uncp->un_lowervp, dvp); + } if (vp == NULLVP) { hd = unionfs_get_hashhead(dvp, (uncp->un_uppervp != NULLVP ? uncp->un_uppervp : uncp->un_lowervp)); @@ -276,9 +276,11 @@ unionfs_nodeget_cleanup(struct vnode *vp, struct unionfs_node *unp) if (unp->un_dvp != NULLVP) vrele(unp->un_dvp); - if (unp->un_uppervp != NULLVP) + if (unp->un_uppervp != NULLVP) { vput(unp->un_uppervp); - if (unp->un_lowervp != NULLVP) + if (unp->un_lowervp != NULLVP) + vrele(unp->un_lowervp); + } else if (unp->un_lowervp != NULLVP) vput(unp->un_lowervp); if (unp->un_hashtbl != NULL) hashdestroy(unp->un_hashtbl, M_UNIONFSHASH, UNIONFSHASHMASK); @@ -314,7 +316,7 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, *vpp = NULLVP; if (uppervp == NULLVP && lowervp == NULLVP) - panic("%s: upper and lower is null", __func__); + panic("%s: upper and lower are both null", __func__); vt = (uppervp != NULLVP ? uppervp->v_type : lowervp->v_type); @@ -327,7 +329,9 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, vp = unionfs_get_cached_vnode(uppervp, lowervp, dvp); if (vp != NULLVP) { *vpp = vp; - goto unionfs_nodeget_out; + if (lkflags != 0) + vn_lock(*vpp, lkflags | LK_RETRY); + return (0); } } @@ -385,27 +389,47 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, KASSERT(dvp != NULL || (vp->v_vflag & VV_ROOT) != 0, ("%s: NULL dvp for non-root vp %p", __func__, vp)); - vn_lock_pair(lowervp, false, LK_EXCLUSIVE, uppervp, false, - LK_EXCLUSIVE); + + /* + * NOTE: There is still a possibility for cross-filesystem locking here. + * If dvp has an upper FS component and is locked, while the new vnode + * created here only has a lower-layer FS component, then we will end + * up taking a lower-FS lock while holding an upper-FS lock. + * That situation could be dealt with here using vn_lock_pair(). + * However, that would only address one instance out of many in which + * a child vnode lock is taken while holding a lock on its parent + * directory. This is done in many places in common VFS code, as well as + * a few places within unionfs (which could lead to the same cross-FS + * locking issue if, for example, the upper FS is another nested unionfs + * instance). Additionally, it is unclear under what circumstances this + * specific lock sequence (a directory on one FS followed by a child of + * its 'peer' directory on another FS) would present the practical + * possibility of deadlock due to some other agent on the system + * attempting to lock those two specific vnodes in the opposite order. + */ + if (uppervp != NULLVP) + vn_lock(uppervp, LK_EXCLUSIVE | LK_RETRY); + else + vn_lock(lowervp, LK_EXCLUSIVE | LK_RETRY); error = insmntque1(vp, mp); if (error != 0) { unionfs_nodeget_cleanup(vp, unp); return (error); } - if (lowervp != NULL && VN_IS_DOOMED(lowervp)) { - vput(lowervp); - unp->un_lowervp = lowervp = NULL; - } - if (uppervp != NULL && VN_IS_DOOMED(uppervp)) { - vput(uppervp); - unp->un_uppervp = uppervp = NULL; - if (lowervp != NULLVP) - vp->v_vnlock = lowervp->v_vnlock; - } - if (lowervp == NULL && uppervp == NULL) { - unionfs_nodeget_cleanup(vp, unp); - return (ENOENT); - } + /* + * lowervp and uppervp should only be doomed by a forced unmount of + * their respective filesystems, but that can only happen if the + * unionfs instance is first unmounted. We also effectively hold the + * lock on the new unionfs vnode at this point. Therefore, if a + * unionfs umount has not yet reached the point at which the above + * insmntque1() would fail, then its vflush() call will end up + * blocked on our vnode lock, effectively also preventing unmount + * of the underlying filesystems. + */ + VNASSERT(lowervp == NULLVP || !VN_IS_DOOMED(lowervp), vp, + ("%s: doomed lowervp %p", __func__, lowervp)); + VNASSERT(uppervp == NULLVP || !VN_IS_DOOMED(uppervp), vp, + ("%s: doomed lowervp %p", __func__, uppervp)); vn_set_state(vp, VSTATE_CONSTRUCTED); @@ -413,18 +437,16 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, *vpp = unionfs_ins_cached_vnode(unp, dvp); if (*vpp != NULLVP) { unionfs_nodeget_cleanup(vp, unp); - vp = *vpp; - } else { - if (uppervp != NULL) - VOP_UNLOCK(uppervp); - if (lowervp != NULL) - VOP_UNLOCK(lowervp); + if (lkflags != 0) + vn_lock(*vpp, lkflags | LK_RETRY); + return (0); + } else *vpp = vp; - } -unionfs_nodeget_out: - if (lkflags & LK_TYPE_MASK) - vn_lock(vp, lkflags | LK_RETRY); + if ((lkflags & LK_SHARED) != 0) + vn_lock(vp, LK_DOWNGRADE); + else if ((lkflags & LK_EXCLUSIVE) == 0) + VOP_UNLOCK(vp); return (0); } @@ -443,6 +465,7 @@ unionfs_noderem(struct vnode *vp) struct vnode *dvp; int count; int writerefs; + bool unlock_lvp; /* * The root vnode lock may be recursed during unmount, because @@ -455,18 +478,36 @@ unionfs_noderem(struct vnode *vp) */ KASSERT(vp->v_vnlock->lk_recurse == 0 || (vp->v_vflag & VV_ROOT) != 0, ("%s: vnode %p locked recursively", __func__, vp)); + + unp = VTOUNIONFS(vp); + VNASSERT(unp != NULL, vp, ("%s: already reclaimed", __func__)); + lvp = unp->un_lowervp; + uvp = unp->un_uppervp; + dvp = unp->un_dvp; + unlock_lvp = (uvp == NULLVP); + + /* + * Lock the lower vnode in addition to the upper vnode lock in order + * to synchronize against any unionfs_lock() operation which may still + * hold the lower vnode lock. We do not need to do this for the root + * vnode, as the root vnode should always have both upper and lower + * base vnodes for its entire lifecycled, so unionfs_lock() should + * never attempt to lock its lower vnode in the first place. + * Moreover, during unmount of a non-"below" unionfs mount, the lower + * root vnode will already be locked as it is the covered vnode. + */ + if (uvp != NULLVP && lvp != NULLVP && (vp->v_vflag & VV_ROOT) == 0) { + vn_lock_pair(uvp, true, LK_EXCLUSIVE, lvp, false, LK_EXCLUSIVE); + unlock_lvp = true; + } + if (lockmgr(&vp->v_lock, LK_EXCLUSIVE | LK_NOWAIT, NULL) != 0) panic("%s: failed to acquire lock for vnode lock", __func__); - /* * Use the interlock to protect the clearing of v_data to * prevent faults in unionfs_lock(). */ VI_LOCK(vp); - unp = VTOUNIONFS(vp); - lvp = unp->un_lowervp; - uvp = unp->un_uppervp; - dvp = unp->un_dvp; unp->un_lowervp = unp->un_uppervp = NULLVP; vp->v_vnlock = &(vp->v_lock); vp->v_data = NULL; @@ -502,18 +543,16 @@ unionfs_noderem(struct vnode *vp) ("%s: write reference without upper vnode", __func__)); VOP_ADD_WRITECOUNT(uvp, -writerefs); } - if (lvp != NULLVP) - VOP_UNLOCK(lvp); if (uvp != NULLVP) - VOP_UNLOCK(uvp); + vput(uvp); + if (unlock_lvp) + vput(lvp); + else if (lvp != NULLVP) + vrele(lvp); if (dvp != NULLVP) unionfs_rem_cached_vnode(unp, dvp); - if (lvp != NULLVP) - vrele(lvp); - if (uvp != NULLVP) - vrele(uvp); if (unp->un_path != NULL) { free(unp->un_path, M_UNIONFSPATH); unp->un_path = NULL; @@ -696,110 +735,6 @@ unionfs_relookup(struct vnode *dvp, struct vnode **vpp, return (error); } -/* - * relookup for CREATE namei operation. - * - * dvp is unionfs vnode. dvp should be locked. - * - * If it called 'unionfs_copyfile' function by unionfs_link etc, - * VOP_LOOKUP information is broken. - * So it need relookup in order to create link etc. - */ -int -unionfs_relookup_for_create(struct vnode *dvp, struct componentname *cnp, - struct thread *td) -{ - struct vnode *udvp; - struct vnode *vp; - struct componentname cn; - int error; - - udvp = UNIONFSVPTOUPPERVP(dvp); - vp = NULLVP; - - error = unionfs_relookup(udvp, &vp, cnp, &cn, td, cnp->cn_nameptr, - cnp->cn_namelen, CREATE); - if (error) - return (error); - - if (vp != NULLVP) { - if (udvp == vp) - vrele(vp); - else - vput(vp); - - error = EEXIST; - } - - return (error); -} - -/* - * relookup for DELETE namei operation. - * - * dvp is unionfs vnode. dvp should be locked. - */ -int -unionfs_relookup_for_delete(struct vnode *dvp, struct componentname *cnp, - struct thread *td) -{ - struct vnode *udvp; - struct vnode *vp; - struct componentname cn; - int error; - - udvp = UNIONFSVPTOUPPERVP(dvp); - vp = NULLVP; - - error = unionfs_relookup(udvp, &vp, cnp, &cn, td, cnp->cn_nameptr, - cnp->cn_namelen, DELETE); - if (error) - return (error); - - if (vp == NULLVP) - error = ENOENT; - else { - if (udvp == vp) - vrele(vp); - else - vput(vp); - } - - return (error); -} - -/* - * relookup for RENAME namei operation. - * - * dvp is unionfs vnode. dvp should be locked. - */ -int -unionfs_relookup_for_rename(struct vnode *dvp, struct componentname *cnp, - struct thread *td) -{ - struct vnode *udvp; - struct vnode *vp; - struct componentname cn; - int error; - - udvp = UNIONFSVPTOUPPERVP(dvp); - vp = NULLVP; - - error = unionfs_relookup(udvp, &vp, cnp, &cn, td, cnp->cn_nameptr, - cnp->cn_namelen, RENAME); - if (error) - return (error); - - if (vp != NULLVP) { - if (udvp == vp) - vrele(vp); - else - vput(vp); - } - - return (error); -} - /* * Update the unionfs_node. * @@ -836,6 +771,8 @@ unionfs_node_update(struct unionfs_node *unp, struct vnode *uvp, vp->v_vnlock = uvp->v_vnlock; VI_UNLOCK(vp); + for (count = 0; count < lockrec + 1; count++) + VOP_UNLOCK(lvp); /* * Re-cache the unionfs vnode against the upper vnode */ @@ -850,19 +787,88 @@ unionfs_node_update(struct unionfs_node *unp, struct vnode *uvp, } } +/* + * Mark a unionfs operation as being in progress, sleeping if the + * same operation is already in progress. + * This is useful, for example, during copy-up operations in which + * we may drop the target vnode lock, but we want to avoid the + * possibility of a concurrent copy-up on the same vnode triggering + * a spurious failure. + */ +int +unionfs_set_in_progress_flag(struct vnode *vp, unsigned int flag) +{ + struct unionfs_node *unp; + int error; + + error = 0; + ASSERT_VOP_ELOCKED(vp, __func__); + VI_LOCK(vp); + unp = VTOUNIONFS(vp); + while (error == 0 && (unp->un_flag & flag) != 0) { + VOP_UNLOCK(vp); + error = msleep(vp, VI_MTX(vp), PCATCH | PDROP, "unioncp", 0); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + VI_LOCK(vp); + if (error == 0) { + /* + * If we waited on a concurrent copy-up and that + * copy-up was successful, return a non-fatal + * indication that the desired operation is already + * complete. If we waited on a concurrent lookup, + * return ERELOOKUP to indicate the VFS cache should + * be re-queried to avoid creating a duplicate unionfs + * vnode. + */ + unp = VTOUNIONFS(vp); + if (unp == NULL) + error = ENOENT; + else if (flag == UNIONFS_COPY_IN_PROGRESS && + unp->un_uppervp != NULLVP) + error = EJUSTRETURN; + else if (flag == UNIONFS_LOOKUP_IN_PROGRESS) + error = ERELOOKUP; + } + } + if (error == 0) + unp->un_flag |= flag; + VI_UNLOCK(vp); + + return (error); +} + +void +unionfs_clear_in_progress_flag(struct vnode *vp, unsigned int flag) +{ + struct unionfs_node *unp; + + ASSERT_VOP_ELOCKED(vp, __func__); + unp = VTOUNIONFS(vp); + VI_LOCK(vp); + if (unp != NULL) { + VNASSERT((unp->un_flag & flag) != 0, vp, + ("%s: copy not in progress", __func__)); + unp->un_flag &= ~flag; + } + wakeup(vp); + VI_UNLOCK(vp); +} + /* * Create a new shadow dir. * - * udvp should be locked on entry and will be locked on return. + * dvp and vp are unionfs vnodes representing a parent directory and + * child file, should be locked on entry, and will be locked on return. * * If no error returned, unp will be updated. */ int -unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp, - struct unionfs_node *unp, struct componentname *cnp, struct thread *td) +unionfs_mkshadowdir(struct vnode *dvp, struct vnode *vp, + struct componentname *cnp, struct thread *td) { struct vnode *lvp; struct vnode *uvp; + struct vnode *udvp; struct vattr va; struct vattr lva; struct nameidata nd; @@ -870,10 +876,25 @@ unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp, struct ucred *cred; struct ucred *credbk; struct uidinfo *rootinfo; + struct unionfs_mount *ump; + struct unionfs_node *dunp; + struct unionfs_node *unp; int error; + ASSERT_VOP_ELOCKED(dvp, __func__); + ASSERT_VOP_ELOCKED(vp, __func__); + ump = MOUNTTOUNIONFSMOUNT(vp->v_mount); + unp = VTOUNIONFS(vp); if (unp->un_uppervp != NULLVP) return (EEXIST); + dunp = VTOUNIONFS(dvp); + udvp = dunp->un_uppervp; + + error = unionfs_set_in_progress_flag(vp, UNIONFS_COPY_IN_PROGRESS); + if (error == EJUSTRETURN) + return (0); + else if (error != 0) + return (error); lvp = unp->un_lowervp; uvp = NULLVP; @@ -897,11 +918,29 @@ unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp, NDPREINIT(&nd); if ((error = VOP_GETATTR(lvp, &lva, cnp->cn_cred))) - goto unionfs_mkshadowdir_abort; + goto unionfs_mkshadowdir_finish; + vref(udvp); + VOP_UNLOCK(vp); if ((error = unionfs_relookup(udvp, &uvp, cnp, &nd.ni_cnd, td, - cnp->cn_nameptr, cnp->cn_namelen, CREATE))) - goto unionfs_mkshadowdir_abort; + cnp->cn_nameptr, cnp->cn_namelen, CREATE))) { + /* + * When handling error cases here, we drop udvp's lock and + * then jump to exit code that relocks dvp, which in most + * cases will effectively relock udvp. However, this is + * not guaranteed to be the case, as various calls made + * here (such as unionfs_relookup() above and VOP_MKDIR() + * below) may unlock and then relock udvp, allowing dvp to + * be reclaimed in the meantime. In such a situation dvp + * will no longer share its lock with udvp. Since + * performance isn't a concern for these error cases, it + * makes more sense to reuse the common code that locks + * dvp on exit than to explicitly check for reclamation + * of dvp. + */ + vput(udvp); + goto unionfs_mkshadowdir_relock; + } if (uvp != NULLVP) { if (udvp == uvp) vrele(uvp); @@ -909,11 +948,14 @@ unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp, vput(uvp); error = EEXIST; - goto unionfs_mkshadowdir_abort; + vput(udvp); + goto unionfs_mkshadowdir_relock; } - if ((error = vn_start_write(udvp, &mp, V_WAIT | V_PCATCH))) - goto unionfs_mkshadowdir_abort; + if ((error = vn_start_write(udvp, &mp, V_WAIT | V_PCATCH))) { + vput(udvp); + goto unionfs_mkshadowdir_relock; + } unionfs_create_uppervattr_core(ump, &lva, &va, td); /* @@ -924,7 +966,7 @@ unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp, * component. This *should* be fine, as cn_namelen will still * correctly indicate the length of only the current component, * but ZFS in particular does not respect cn_namelen in its VOP_MKDIR - * implementation + * implementation. * Note that this assumes nd.ni_cnd.cn_pnbuf was allocated by * something like a local namei() operation and the temporary * NUL-termination will not have an effect on other threads. @@ -934,27 +976,58 @@ unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp, *pathend = '\0'; error = VOP_MKDIR(udvp, &uvp, &nd.ni_cnd, &va); *pathend = pathterm; - - if (!error) { - /* - * XXX The bug which cannot set uid/gid was corrected. - * Ignore errors. - */ - va.va_type = VNON; - VOP_SETATTR(uvp, &va, nd.ni_cnd.cn_cred); - + if (error != 0) { /* - * VOP_SETATTR() may transiently drop uvp's lock, so it's - * important to call it before unionfs_node_update() transfers - * the unionfs vnode's lock from lvp to uvp; otherwise the - * unionfs vnode itself would be transiently unlocked and - * potentially doomed. + * See the comment after unionfs_relookup() above for an + * explanation of why we unlock udvp here only to relock + * dvp on exit. */ - unionfs_node_update(unp, uvp, td); + vput(udvp); + vn_finished_write(mp); + goto unionfs_mkshadowdir_relock; } + + /* + * XXX The bug which cannot set uid/gid was corrected. + * Ignore errors. + */ + va.va_type = VNON; + /* + * VOP_SETATTR() may transiently drop uvp's lock, so it's + * important to call it before unionfs_node_update() transfers + * the unionfs vnode's lock from lvp to uvp; otherwise the + * unionfs vnode itself would be transiently unlocked and + * potentially doomed. + */ + VOP_SETATTR(uvp, &va, nd.ni_cnd.cn_cred); + + /* + * uvp may become doomed during VOP_VPUT_PAIR() if the implementation + * must temporarily drop uvp's lock. However, since we hold a + * reference to uvp from the VOP_MKDIR() call above, this would require + * a forcible unmount of uvp's filesystem, which in turn can only + * happen if our unionfs instance is first forcibly unmounted. We'll + * therefore catch this case in the NULL check of unp below. + */ + VOP_VPUT_PAIR(udvp, &uvp, false); vn_finished_write(mp); + vn_lock_pair(vp, false, LK_EXCLUSIVE, uvp, true, LK_EXCLUSIVE); + unp = VTOUNIONFS(vp); + if (unp == NULL) { + vput(uvp); + error = ENOENT; + } else + unionfs_node_update(unp, uvp, td); + VOP_UNLOCK(vp); + +unionfs_mkshadowdir_relock: + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + if (error == 0 && (VN_IS_DOOMED(dvp) || VN_IS_DOOMED(vp))) + error = ENOENT; -unionfs_mkshadowdir_abort: +unionfs_mkshadowdir_finish: + unionfs_clear_in_progress_flag(vp, UNIONFS_COPY_IN_PROGRESS); cnp->cn_cred = credbk; chgproccnt(cred->cr_ruidinfo, -1, 0); crfree(cred); @@ -1116,23 +1189,31 @@ unionfs_forward_vop_finish_pair( /* * Create a new whiteout. * - * udvp and dvp should be locked on entry and will be locked on return. + * dvp and vp are unionfs vnodes representing a parent directory and + * child file, should be locked on entry, and will be locked on return. */ int -unionfs_mkwhiteout(struct vnode *dvp, struct vnode *udvp, +unionfs_mkwhiteout(struct vnode *dvp, struct vnode *vp, struct componentname *cnp, struct thread *td, char *path, int pathlen) { + struct vnode *udvp; struct vnode *wvp; struct nameidata nd; struct mount *mp; int error; - int lkflags; + bool dvp_locked; + + ASSERT_VOP_ELOCKED(dvp, __func__); + ASSERT_VOP_ELOCKED(vp, __func__); + udvp = VTOUNIONFS(dvp)->un_uppervp; wvp = NULLVP; NDPREINIT(&nd); + vref(udvp); + VOP_UNLOCK(vp); if ((error = unionfs_relookup(udvp, &wvp, cnp, &nd.ni_cnd, td, path, pathlen, CREATE))) { - return (error); + goto unionfs_mkwhiteout_cleanup; } if (wvp != NULLVP) { if (udvp == wvp) @@ -1140,18 +1221,27 @@ unionfs_mkwhiteout(struct vnode *dvp, struct vnode *udvp, else vput(wvp); - return (EEXIST); + if (nd.ni_cnd.cn_flags & ISWHITEOUT) + error = 0; + else + error = EEXIST; + goto unionfs_mkwhiteout_cleanup; } if ((error = vn_start_write(udvp, &mp, V_WAIT | V_PCATCH))) - goto unionfs_mkwhiteout_free_out; - unionfs_forward_vop_start(udvp, &lkflags); + goto unionfs_mkwhiteout_cleanup; error = VOP_WHITEOUT(udvp, &nd.ni_cnd, CREATE); - unionfs_forward_vop_finish(dvp, udvp, lkflags); - vn_finished_write(mp); -unionfs_mkwhiteout_free_out: +unionfs_mkwhiteout_cleanup: + if (VTOUNIONFS(dvp) == NULL) { + vput(udvp); + dvp_locked = false; + } else { + vrele(udvp); + dvp_locked = true; + } + vn_lock_pair(dvp, dvp_locked, LK_EXCLUSIVE, vp, false, LK_EXCLUSIVE); return (error); } @@ -1165,10 +1255,11 @@ unionfs_mkwhiteout_free_out: */ static int unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp, - struct unionfs_node *unp, struct vattr *uvap, struct thread *td) + struct vnode *vp, struct vattr *uvap, struct thread *td) { struct unionfs_mount *ump; - struct vnode *vp; + struct unionfs_node *unp; + struct vnode *uvp; struct vnode *lvp; struct ucred *cred; struct vattr lva; @@ -1176,8 +1267,10 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp, int fmode; int error; + ASSERT_VOP_ELOCKED(vp, __func__); + unp = VTOUNIONFS(vp); ump = MOUNTTOUNIONFSMOUNT(UNIONFSTOV(unp)->v_mount); - vp = NULLVP; + uvp = NULLVP; lvp = unp->un_lowervp; cred = td->td_ucred; fmode = FFLAGS(O_WRONLY | O_CREAT | O_TRUNC | O_EXCL); @@ -1200,42 +1293,39 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp, NDPREINIT(&nd); vref(udvp); - if ((error = vfs_relookup(udvp, &vp, &nd.ni_cnd, false)) != 0) - goto unionfs_vn_create_on_upper_free_out2; - vrele(udvp); + VOP_UNLOCK(vp); + if ((error = vfs_relookup(udvp, &uvp, &nd.ni_cnd, false)) != 0) { + vrele(udvp); + return (error); + } - if (vp != NULLVP) { - if (vp == udvp) - vrele(vp); + if (uvp != NULLVP) { + if (uvp == udvp) + vrele(uvp); else - vput(vp); + vput(uvp); error = EEXIST; - goto unionfs_vn_create_on_upper_free_out1; + goto unionfs_vn_create_on_upper_cleanup; } - if ((error = VOP_CREATE(udvp, &vp, &nd.ni_cnd, uvap)) != 0) - goto unionfs_vn_create_on_upper_free_out1; + if ((error = VOP_CREATE(udvp, &uvp, &nd.ni_cnd, uvap)) != 0) + goto unionfs_vn_create_on_upper_cleanup; - if ((error = VOP_OPEN(vp, fmode, cred, td, NULL)) != 0) { - vput(vp); - goto unionfs_vn_create_on_upper_free_out1; + if ((error = VOP_OPEN(uvp, fmode, cred, td, NULL)) != 0) { + vput(uvp); + goto unionfs_vn_create_on_upper_cleanup; } - error = VOP_ADD_WRITECOUNT(vp, 1); - CTR3(KTR_VFS, "%s: vp %p v_writecount increased to %d", - __func__, vp, vp->v_writecount); + error = VOP_ADD_WRITECOUNT(uvp, 1); + CTR3(KTR_VFS, "%s: newvp %p v_writecount increased to %d", + __func__, newvp, newvp->v_writecount); if (error == 0) { - *vpp = vp; + *vpp = uvp; } else { - VOP_CLOSE(vp, fmode, cred, td); + VOP_CLOSE(uvp, fmode, cred, td); } -unionfs_vn_create_on_upper_free_out1: - VOP_UNLOCK(udvp); - -unionfs_vn_create_on_upper_free_out2: - KASSERT(nd.ni_cnd.cn_pnbuf == unp->un_path, - ("%s: cn_pnbuf changed", __func__)); - +unionfs_vn_create_on_upper_cleanup: + vput(udvp); return (error); } @@ -1310,13 +1400,18 @@ unionfs_copyfile_core(struct vnode *lvp, struct vnode *uvp, * * If you need copy of the contents, set 1 to docopy. Otherwise, set 0 to * docopy. + * + * vp is a unionfs vnode that should be locked on entry and will be + * locked on return. * * If no error returned, unp will be updated. */ int -unionfs_copyfile(struct unionfs_node *unp, int docopy, struct ucred *cred, +unionfs_copyfile(struct vnode *vp, int docopy, struct ucred *cred, struct thread *td) { + struct unionfs_node *unp; + struct unionfs_node *dunp; struct mount *mp; struct vnode *udvp; struct vnode *lvp; @@ -1324,6 +1419,8 @@ unionfs_copyfile(struct unionfs_node *unp, int docopy, struct ucred *cred, struct vattr uva; int error; + ASSERT_VOP_ELOCKED(vp, __func__); + unp = VTOUNIONFS(vp); lvp = unp->un_lowervp; uvp = NULLVP; @@ -1333,22 +1430,51 @@ unionfs_copyfile(struct unionfs_node *unp, int docopy, struct ucred *cred, return (EINVAL); if (unp->un_uppervp != NULLVP) return (EEXIST); - udvp = VTOUNIONFS(unp->un_dvp)->un_uppervp; + + udvp = NULLVP; + VI_LOCK(unp->un_dvp); + dunp = VTOUNIONFS(unp->un_dvp); + if (dunp != NULL) + udvp = dunp->un_uppervp; + VI_UNLOCK(unp->un_dvp); + if (udvp == NULLVP) return (EROFS); if ((udvp->v_mount->mnt_flag & MNT_RDONLY)) return (EROFS); + ASSERT_VOP_UNLOCKED(udvp, __func__); + + error = unionfs_set_in_progress_flag(vp, UNIONFS_COPY_IN_PROGRESS); + if (error == EJUSTRETURN) + return (0); + else if (error != 0) + return (error); error = VOP_ACCESS(lvp, VREAD, cred, td); if (error != 0) - return (error); + goto unionfs_copyfile_cleanup; if ((error = vn_start_write(udvp, &mp, V_WAIT | V_PCATCH)) != 0) - return (error); - error = unionfs_vn_create_on_upper(&uvp, udvp, unp, &uva, td); + goto unionfs_copyfile_cleanup; + error = unionfs_vn_create_on_upper(&uvp, udvp, vp, &uva, td); if (error != 0) { vn_finished_write(mp); - return (error); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + goto unionfs_copyfile_cleanup; + } + + /* + * Note that it's still possible for e.g. VOP_WRITE to relock + * uvp below while holding vp[=lvp] locked. Replacing + * unionfs_copyfile_core with vn_generic_copy_file_range() will + * allow us to avoid the problem by moving this vn_lock_pair() + * call much later. + */ + vn_lock_pair(vp, false, LK_EXCLUSIVE, uvp, true, LK_EXCLUSIVE); + unp = VTOUNIONFS(vp); + if (unp == NULL) { + error = ENOENT; + goto unionfs_copyfile_cleanup; } if (docopy != 0) { @@ -1369,18 +1495,30 @@ unionfs_copyfile(struct unionfs_node *unp, int docopy, struct ucred *cred, /* Reset the attributes. Ignore errors. */ uva.va_type = VNON; VOP_SETATTR(uvp, &uva, cred); + unionfs_node_update(unp, uvp, td); } - unionfs_node_update(unp, uvp, td); - +unionfs_copyfile_cleanup: + unionfs_clear_in_progress_flag(vp, UNIONFS_COPY_IN_PROGRESS); return (error); } /* - * It checks whether vp can rmdir. (check empty) + * Determine if the unionfs view of a directory is empty such that + * an rmdir operation can be permitted. + * + * We assume the VOP_RMDIR() against the upper layer vnode will take + * care of this check for us where the upper FS is concerned, so here + * we concentrate on the lower FS. We need to check for the presence + * of files other than "." and ".." in the lower FS directory and + * then cross-check any files we find against the upper FS to see if + * a whiteout is present (in which case we treat the lower file as + * non-present). * - * vp is unionfs vnode. - * vp should be locked. + * The logic here is based heavily on vn_dir_check_empty(). + * + * vp should be a locked unionfs node, and vp's lowervp should also be + * locked. */ *** 1636 LINES SKIPPED *** From nobody Sat Jul 13 01:39:51 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLWNl3WhQz5RFFK; Sat, 13 Jul 2024 01:39: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLWNl2pN2z4SMy; Sat, 13 Jul 2024 01:39:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720834791; 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=cnVFHnC05goEPxwAA1/bKcO1sNQy7AhJGm3uvYM8tS4=; b=qtM/npk9/K87sIdLlfjMDJMCUuwHAduQreO/VClyuFPVpPbWGbjhbRxS9IZKKCoPgkW2NR JWsueF79XKDa+4urcAIZ4Qs9xCbPeySCJD4rwFciMe2UcGO7zlfgQevtKZQj/SWbRouyQn 29GHymAxh99TQv4oID7h8I3id7pSETnkH1trRhkyEa0HROfF88kBwg6wYIbScxFLMo562q WrKs66LSlwxEVVjpc8jW8SlP/x78C34/imwKse+YHxyIqKVunf4q+eN3mj+fBZFcK9761k sneNrCook6tIKNX5gyuPiuSrOv8S6fp29wFDZ0ffyl1+ZmHRZDVIhHf3do4Qhw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720834791; a=rsa-sha256; cv=none; b=chTLTPI6Y4/fG4QfwuqzcmgUTsTI8177fFdbejHS9hj6S9P5Rs+fBehV+UO9PYZ0aRPVCe Q6KBOzKHCEzzpGvydSkuW4bop+mFo3EgXqB+oSDKS3gsmreizFXtA9b5+bScDW03IZoAeI 9Y3uuQ3q0qx4E6lQ1bDa+9SVPpV289lj16F7oXNTR58L1foHwC/vNSG+wreJuZkdC/NuBA z0nhCRdkd5FgPVua5s2L/UZzxONXlwfnLgeZJ0qrglzT1UPp7RDGIta2VYOn1NbySgRJON FBF2FljuPfh8b1CawfAu1ZRoc6is+atAQ5uIk5EYOb2qxPMnPrj6zHS6PVz6vw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720834791; 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=cnVFHnC05goEPxwAA1/bKcO1sNQy7AhJGm3uvYM8tS4=; b=Xe30NWTaNKfJ3IfEfvWbG/MlLH6004ApqC/lkguuusrcj4NNDMvLq1AXdH/ri8AQ6dcbUy 2qnkeVg8nbvkgSwC3pshQPOtV5N6IyGos7rUuvTswE4b6kQ02GnpL9Ru6Fl0TvKRLUm3Dk zhZ+C/ws2NDUc7YDjmabubRnqZU7ZdiHlQ+sy0unjth8GCfAVoB70IoUuUZxY3lp70BIcn IAVh3bbEH4MIBMHMhwPD+x3vCW/R9eWn11XnAdQQWg+n5HTau6E3dwmjR+P/ZU+61unNKl zm+1y5H5hq2cfx4Hjr5sCNAu6eR8MFM4sLHJA7PttfTvZQ9bOIPBPShSonBVOA== 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 4WLWNl2Q2vz15vh; Sat, 13 Jul 2024 01:39: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 46D1dppI038850; Sat, 13 Jul 2024 01:39:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46D1dplR038847; Sat, 13 Jul 2024 01:39:51 GMT (envelope-from git) Date: Sat, 13 Jul 2024 01:39:51 GMT Message-Id: <202407130139.46D1dplR038847@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: 53a777bb52e3 - main - unionfs: do not create a new status object during vop_close() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 53a777bb52e3f1e8a29fa0cbea9b991daf7ba01e Auto-Submitted: auto-generated The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=53a777bb52e3f1e8a29fa0cbea9b991daf7ba01e commit 53a777bb52e3f1e8a29fa0cbea9b991daf7ba01e Author: Jason A. Harmening AuthorDate: 2024-06-14 21:01:22 +0000 Commit: Jason A. Harmening CommitDate: 2024-07-12 22:05:16 +0000 unionfs: do not create a new status object during vop_close() Split the portion of unionfs_get_node_status() that searches for an existing status object into a new helper function, unionfs_find_node_status(), and use that in unionfs_close(). Additionally, modify unionfs_close() to accept a NULL status object if unionfs_find_node_status() does not find a matching status object. This can happen due to the unconditional VOP_CLOSE() operation issued by vgonel(). Differential Revision: https://reviews.freebsd.org/D45398 Reviewed by: olce Tested by: pho --- sys/fs/unionfs/union.h | 2 ++ sys/fs/unionfs/union_subr.c | 45 ++++++++++++++++++++++++++++++-------------- sys/fs/unionfs/union_vnops.c | 9 +++++++-- 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/sys/fs/unionfs/union.h b/sys/fs/unionfs/union.h index c535a3b288b8..0bd1894a2195 100644 --- a/sys/fs/unionfs/union.h +++ b/sys/fs/unionfs/union.h @@ -133,6 +133,8 @@ int unionfs_uninit(struct vfsconf *); int unionfs_nodeget(struct mount *, struct vnode *, struct vnode *, struct vnode *, struct vnode **, struct componentname *); void unionfs_noderem(struct vnode *); +struct unionfs_node_status * unionfs_find_node_status(struct unionfs_node *, + struct thread *td); void unionfs_get_node_status(struct unionfs_node *, struct thread *, struct unionfs_node_status **); void unionfs_tryrem_node_status(struct unionfs_node *, diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 671322704dc5..e02dd547f249 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -578,35 +578,52 @@ unionfs_noderem(struct vnode *vp) } /* - * Get the unionfs node status object for the vnode corresponding to unp, - * for the process that owns td. Allocate a new status object if one - * does not already exist. + * Find the unionfs node status object for the vnode corresponding to unp, + * for the process that owns td. Return NULL if no such object exists. */ -void -unionfs_get_node_status(struct unionfs_node *unp, struct thread *td, - struct unionfs_node_status **unspp) +struct unionfs_node_status * +unionfs_find_node_status(struct unionfs_node *unp, struct thread *td) { struct unionfs_node_status *unsp; pid_t pid; pid = td->td_proc->p_pid; - KASSERT(NULL != unspp, ("%s: NULL status", __func__)); ASSERT_VOP_ELOCKED(UNIONFSTOV(unp), __func__); LIST_FOREACH(unsp, &(unp->un_unshead), uns_list) { if (unsp->uns_pid == pid) { - *unspp = unsp; - return; + return (unsp); } } - /* create a new unionfs node status */ - unsp = malloc(sizeof(struct unionfs_node_status), - M_TEMP, M_WAITOK | M_ZERO); + return (NULL); +} + +/* + * Get the unionfs node status object for the vnode corresponding to unp, + * for the process that owns td. Allocate a new status object if one + * does not already exist. + */ +void +unionfs_get_node_status(struct unionfs_node *unp, struct thread *td, + struct unionfs_node_status **unspp) +{ + struct unionfs_node_status *unsp; + pid_t pid; + + pid = td->td_proc->p_pid; - unsp->uns_pid = pid; - LIST_INSERT_HEAD(&(unp->un_unshead), unsp, uns_list); + KASSERT(NULL != unspp, ("%s: NULL status", __func__)); + unsp = unionfs_find_node_status(unp, td); + if (unsp == NULL) { + /* create a new unionfs node status */ + unsp = malloc(sizeof(struct unionfs_node_status), + M_TEMP, M_WAITOK | M_ZERO); + + unsp->uns_pid = pid; + LIST_INSERT_HEAD(&(unp->un_unshead), unsp, uns_list); + } *unspp = unsp; } diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index ae1d3946266d..3f39352ea5c0 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -793,9 +793,14 @@ unionfs_close(struct vop_close_args *ap) unp = VTOUNIONFS(vp); lvp = unp->un_lowervp; uvp = unp->un_uppervp; - unionfs_get_node_status(unp, td, &unsp); + unsp = unionfs_find_node_status(unp, td); - if (unsp->uns_lower_opencnt <= 0 && unsp->uns_upper_opencnt <= 0) { + if (unsp == NULL || + (unsp->uns_lower_opencnt <= 0 && unsp->uns_upper_opencnt <= 0)) { +#ifdef DIAGNOSTIC + if (unsp != NULL) + printf("unionfs_close: warning: open count is 0\n"); +#endif if (uvp != NULLVP) ovp = uvp; else From nobody Sat Jul 13 03:40:03 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLZ3R4047z5PDC0; Sat, 13 Jul 2024 03:40: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLZ3R3YTjz4c6x; Sat, 13 Jul 2024 03:40:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720842003; 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=FR1xicgT7k6LrCDAuxPx0DHcwkiVTJIItPAClvzP/Uc=; b=oLgXrzU7Bok45SHFm3ta9zcMPUzpCtpmRFBNi7YLfeO1zYRLHJzlqQ60rMZdETTSgin0rR u21rywM7CWIZhQ37TOEnWakzWROMjCmLUnqyE289j8Fq0D1nplbhzoQFj7q/inrHzc+iAD W8Pry7FaXCXXNEwy1se1n3tD8wZG9SDJdh0Uphyrt4/AprmJd2+xAJzl7gFm24eEd/sJCK 7JmcT2dzOYwJV50Uhp8gJjL1YVnVwPSLRMKScX8bUahSUvfZALGFM8sas1EwADVGKW48x9 z4/BeSo62fQPy4Y3sN0vytDSrP1PXi3f6SkJcz6k22ITcqF8sdQoE47f5z1Vsw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720842003; a=rsa-sha256; cv=none; b=QJ5jStjsBZI6HmsD/Mc5iIPTZerRPwvLXbs6Abc6k5PGe2dPsGOLhezrIyhNi20wqt//Ms Wil+Lmk8ydviOnZM98rsO8GsRb1/67k1P4IQm2lv676FEKq4tgRJk1Jti4EKUuXIHUcEie aIdop3QZVweoUzwTGGxlkM9kF395xVxJGM5Cs/QVmZv+EZn4Y4/oDWb07fs0RaUbK02dAD 17qeQ1b2bK1UJfS7u+IIlE7lT10g+SHJxJr9nCQ5Q3JE6YHCMM46MwEel+LzrII7Rj28Ea cFQJzlHwmY3YA7oLc5m3vhXU9qaOHr0LsDVCoLMCwr14mnJPBYkwIIqqq0YSwQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720842003; 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=FR1xicgT7k6LrCDAuxPx0DHcwkiVTJIItPAClvzP/Uc=; b=iZRx+MVhvwX9MjmlQUgnLQKSxZUfeLuYv2SGvrI87YaRZbKNI1V7Df5IMF1GVGaMwFtNqt TJISMNnDFuCHb5P5P9YdddkmiVmoz+6EX9ouwCCqLzMCOj5SPEyOwn5FQRR3ncciBnm614 epY1lVWrm34NpjSDAxUbwt9yCcNWbVQsbsZTtxWhnrDrIYHb+eHGHURkhT23/UyJ3BuRPF Ik4/7ft0HK0KdGfBW3Bb+rJOvgHS1vyfzLGJoFG2xo0UwElICXE7+FlCnhOmsZ9Jfx6LVS N+Wk+xnQD/bDgnd3M+3gssI8bu7SV6lmhKFxK5HcJ71ZOx+Eh0ld6Ft6tGu5ag== 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 4WLZ3R2VX5z19Q3; Sat, 13 Jul 2024 03:40:03 +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 46D3e3hn045650; Sat, 13 Jul 2024 03:40:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46D3e3rf045645; Sat, 13 Jul 2024 03:40:03 GMT (envelope-from git) Date: Sat, 13 Jul 2024 03:40:03 GMT Message-Id: <202407130340.46D3e3rf045645@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: c55f56de9da1 - main - networking.7: remove confusing caveat List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c55f56de9da11e11ee950993afe8b8575d8daa56 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c55f56de9da11e11ee950993afe8b8575d8daa56 commit c55f56de9da11e11ee950993afe8b8575d8daa56 Author: Alexander Ziaee AuthorDate: 2024-07-05 00:50:25 +0000 Commit: Warner Losh CommitDate: 2024-07-13 03:40:09 +0000 networking.7: remove confusing caveat + service routing restart breaks on dhcp + change my copyright from inbox to home Fixes: 75eda009 MFC after: 3 days Reported by: Graham Perrin, zlei Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1316 --- share/man/man7/networking.7 | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/share/man/man7/networking.7 b/share/man/man7/networking.7 index 869812c05a9b..03e80793e98d 100644 --- a/share/man/man7/networking.7 +++ b/share/man/man7/networking.7 @@ -1,7 +1,7 @@ .\"- .\" SPDX-License-Identifier: BSD-2-Clause .\" -.\" Copyright (c) 2024 Alexander Ziaee +.\" Copyright (c) 2024 Alexander Ziaee. Ohio. .\" .Dd April 17, 2024 .Dt "NETWORKING" 7 @@ -92,10 +92,3 @@ will need to be escaped for commonly using .Ql \e , see the manual page for your shell for more details. -.Pp -Currently -.Ql Ic service netif restart -does not restart routing. -A common workaround is to issue -.Ql Ic service netif restart && service routing restart -instead. From nobody Sat Jul 13 03:40:04 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLZ3S4CnTz5PDRv; Sat, 13 Jul 2024 03:40:04 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLZ3S3P7Fz4cCZ; Sat, 13 Jul 2024 03:40:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720842004; 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=5q36IyANHWUUSJgJjJH2YJjJ6EIjPueSwwN44SyFEow=; b=Sb4pqOxDWMAdudsJSMBoxhB9OCpSk2WXiTHGN/NFJIcFiBOwgWm2S0Epkqp+gvx/dSeGyR cDnOFVxYXFo3WTEMcOjVxfDhgvyhdpxchilJsyzn9lQIVI/Ylh/uHJKMxmsT/ru/jlBX86 Gl9mNm3v7w1R5Gqmv1vmzunC8clJ8XsZ7zfsH/eBjnGk2g4xwQqoU0b3L9f5opqb7JKbQk 09lwLtDUuJVSrEw/amkQ5QuedHRwYbeIr8OScVn+t5blJgfGVfHftR3Qj0skrQhVftjkzD v2N8MvL2LeDrvxdO9daRc0vCb2/Q7j5pWtGAYvmqlmZDtmXNu/XBfnEkHh2+hQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720842004; a=rsa-sha256; cv=none; b=gwpEoUU38m6k+vJlS/UxcGac7qMDCuiDIi7nJlEzw6yBwaLruj/2cs9RmLfTQL9GZq40nO 2g2UQJsfVC7C4vOPeU2Qa7uRRc6dHupIMBG64c8By6l1YmCw/POPzZ4TwBJiINtQJlgWyt Fg63F//mdtQRovh7HZfYQYaVoYxr5kdODq4ygUQTftIV1rENmRk5IMSWBrhtt9RXMUw+q2 SQ4WV2HmaOul/4MOW4FrOklbuGaU3065SBFqN+wVrA48btp2kTYmgYik9GREIGORrd9Ncd yGkD3fV5orsFzhZ80KIiaygIFc7iK5PwiLgvZ7xaxlyZsJOyzaAV9WbWTfOBNw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720842004; 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=5q36IyANHWUUSJgJjJH2YJjJ6EIjPueSwwN44SyFEow=; b=UgXaDMgz7gXm7++G8QEM4owwILGKrjaD+5L2OV71NkWlQ9paW5dBHghXJXSYNom5247WLK LY+X39A3DFjlsAUoQQx3iePd9u9hOWLPPfqPz5N7mO7F5b1Fy4jNgewwZKIHbDfs/cYy+m mVlDZKptIzc4C5xQqW8Qd6jBO8QCtytCBaUD2f5PJ1IiBDhcTkF5SKPrNiIqmWt7M4XOnJ /DOkq+fdOTnuVs0+JuPcDxA+t4dWrOE3duMMhv5rQl+49e1ZFsYkCqMBLF3DEADc2fD8vY kuMlvTAqe80T7wP0Vn2tgya8tviSM7EMi/ZZjBBnYgBqKJ4RjnAu8EhsY17AYw== 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 4WLZ3S310qz18fv; Sat, 13 Jul 2024 03:40:04 +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 46D3e4De045924; Sat, 13 Jul 2024 03:40:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46D3e4xS045919; Sat, 13 Jul 2024 03:40:04 GMT (envelope-from git) Date: Sat, 13 Jul 2024 03:40:04 GMT Message-Id: <202407130340.46D3e4xS045919@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a6ca6dfd60b6 - main - p9fs: remove duplicated code List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a6ca6dfd60b66eec563bd473d96b31f0be1de80a Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a6ca6dfd60b66eec563bd473d96b31f0be1de80a commit a6ca6dfd60b66eec563bd473d96b31f0be1de80a Author: Danilo Egea Gondolfo AuthorDate: 2024-07-09 19:07:18 +0000 Commit: Warner Losh CommitDate: 2024-07-13 03:40:09 +0000 p9fs: remove duplicated code This code is using the vnode after it has been released and causing a panic when a p9fs shared volume is unmounted. In fact, it seems like it's just duplicated code left behind from a bad merge. PR: 279887 Reported by: Michael Dexter Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1323 --- sys/fs/p9fs/p9fs_vnops.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sys/fs/p9fs/p9fs_vnops.c b/sys/fs/p9fs/p9fs_vnops.c index 5556e60f4bae..6ac0a7c008cc 100644 --- a/sys/fs/p9fs/p9fs_vnops.c +++ b/sys/fs/p9fs/p9fs_vnops.c @@ -125,16 +125,6 @@ p9fs_cleanup(struct p9fs_node *np) /* Destroy the vm object and flush associated pages. */ vnode_destroy_vobject(vp); - /* Remove the vnode from hash list if vnode is not already deleted */ - if ((np->flags & P9FS_NODE_DELETED) == 0) - vfs_hash_remove(vp); - - /* Invalidate all entries to a particular vnode. */ - cache_purge(vp); - - /* Destroy the vm object and flush associated pages. */ - vnode_destroy_vobject(vp); - /* Remove all the FID */ p9fs_fid_remove_all(np, FALSE); From nobody Sat Jul 13 03:41:43 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLZ5N3GWMz5PDKN; Sat, 13 Jul 2024 03:41: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLZ5N0mjrz4dC2; Sat, 13 Jul 2024 03:41:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720842104; 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=AILOUeG15ixtF5ZLdb/+WarzBbmHVQ+hzhshsMwUmNY=; b=GU9aT9I0PgMzc/9eFTyY3whL0/BUOgtM8qUTrMIufuJzJQzUpQvcRYHzyVED+ZhroeUm2W 78rWBoG7V3iRHLHXBUlowlP/uk9wyset3q9oNUiSFgoU6fE3SOc+HxEVPUpVKaEWZSJIdh wPgUy+mJAj0sHv5DWvBOb+ef69WHqy7V/ZLLIBKLRVVeaW6I1OAzttgH7n/BSWS45ocG2s GaIIIzvl057MgcjfM5LhZQLLoX6DnYJjWjw0by2eLkXx4KlrbCrqCBBiMISIdpTHDaE9O9 QVwjAHVqJY2KfvBqWhlWdxzZkmz+u9OaIwHg6kDWdhxdXzGb2H/lXw0R2AjnjQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720842104; a=rsa-sha256; cv=none; b=BR6y9x/dxdSIpHBCxaAxCGm2aMY3WlM6nI/URzYPPZWc5/0DKUSVRhCiKygWMhRUtJM31c C9qXgCRLgYsyidqsp5M75s5Hu6jTGjOnIx6sTxShF8oUOb1OVWd8SODw01H4CQ6Wdi1zqd w6zdQhchtK7R8kCbQ5pquPC/D4WKAaxWrZZePCe7Jdc4GcfxkMIfIk9DhoJvYSL8Bdcnqg Rg8ftAdecnMCC28b9IS8NU8hHXQv/YOJPsNo1lp4XXvbKxt3oXI/Cwh28ec35LApG1Vfit brn/1dXQmzkKSUXxHh2F0cKYW/uQ7p4jRvpApbESPhQA8fCvu1tsCUSqtN411Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720842104; 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=AILOUeG15ixtF5ZLdb/+WarzBbmHVQ+hzhshsMwUmNY=; b=uJzsBn17MPZ+ZwpWkVpqTaI15Rah7PE5n0IXCzzwryFOpMFlyMtrcKjs33OeC068XXOxzy oBpWNPjRypKjTPuNQ1qau7FsnDaDPIG9IUkPAo6KB0sXC/g3rYT1yg7DhYudEg8F/m6jve 5SpiN2dnNlQ/YGQVuCsQhxkHLHllgFAdONHLobe14EmKsvfrUMHl1ARg33aHQEXntqsYjw JilZCexnXdKGRhJD574hT1KXyGjYYLViRxaeD/u8ovohRYXgplUgFQHYLgTjtK09WdKHo1 nAqiWq5pzoFUJq72BZvZJRN6I0lvAaX2HITCJoWexGLdn8RwlppsPZ0//La6cg== 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 4WLZ5N0Ndcz19c4; Sat, 13 Jul 2024 03:41: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 46D3fhv6058784; Sat, 13 Jul 2024 03:41:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46D3fhU0058781; Sat, 13 Jul 2024 03:41:43 GMT (envelope-from git) Date: Sat, 13 Jul 2024 03:41:43 GMT Message-Id: <202407130341.46D3fhU0058781@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: 9b505845a3ae - main - unionfs: fix LINT build List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9b505845a3aefd2ffaef77764aeca092653f0772 Auto-Submitted: auto-generated The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=9b505845a3aefd2ffaef77764aeca092653f0772 commit 9b505845a3aefd2ffaef77764aeca092653f0772 Author: Jason A. Harmening AuthorDate: 2024-07-13 03:38:02 +0000 Commit: Jason A. Harmening CommitDate: 2024-07-13 03:41:17 +0000 unionfs: fix LINT build Fix a stale variable name that snuck into a tracepoint from an earlier version of the change. Fixes: eb60ff1e "unionfs: rework locking scheme to only lock a single vnode" Reported by: jenkins --- sys/fs/unionfs/union_subr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index e02dd547f249..b731c562f97d 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -1333,8 +1333,8 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp, goto unionfs_vn_create_on_upper_cleanup; } error = VOP_ADD_WRITECOUNT(uvp, 1); - CTR3(KTR_VFS, "%s: newvp %p v_writecount increased to %d", - __func__, newvp, newvp->v_writecount); + CTR3(KTR_VFS, "%s: vp %p v_writecount increased to %d", + __func__, uvp, uvp->v_writecount); if (error == 0) { *vpp = uvp; } else { From nobody Sat Jul 13 05:22:57 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLcL962jsz5Pvj9; Sat, 13 Jul 2024 05:22: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLcL95CSgz4nrL; Sat, 13 Jul 2024 05:22:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848177; 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=Qe9nJQRVKSHRxgpY/sx84VPZRm+QiVwxlvQ/hXioZ1k=; b=ELpkFyk+9RAtRjdUGLaGvS1b4MY3OSoMeOSWj2TkoPcEGBI2Gi/QPTzRK+Vyp2e9HSIbhp XR0pxKV7gELPLP1eEk4Mx+uxxE+OMpTEnI2iJ6hDSO9v+xtu1IzonAju6IaToWfFz65rX/ PuPVDJWIBmWiOA4jJW48lQXXzV/czjlBZUEPmcm/Egsx9GUw26D0+3Qe937dOIHsjGGGeP cPu+JuJgsGegRppN8pLpB+7HLuoxF5tMdKeIFtrokyggU057/5gmva9PixIEzlq1Ec8eCG Cedr3dW5FsqHRkDPyxF7J0SGeb+sqIlIjgASbdmLOaeJlR4lE0yMd/MjTENqiQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720848177; a=rsa-sha256; cv=none; b=L/j2EGFWHiNSxjjFucyiRDU39DavugUpdjSQKB1KLh+3UsKXk0bJ+RZv6drCGDWDoAmC9m 8UkzpAlg8AuAtzNxac+6D1xXRf18bPRhEyUaRYJnOkrkw4s6d3B9q9H05AK5VEhGN5L/3G 5WThayUMvUOQzTpQvmoJ/4AVq/+YctGHyQUpDpmvdgGeF3sE8bCscXq/iWhX3Di/NW4aQT 7f/d/H+saFYpjLqDolzPj/xy+bEhYBk068OIciV1nuxJuD5BesjJEkelkr2whBiFpF6yrA 9EuECJ6x/FMprUIoJqGbaD/MntbyKmwkChiawIdvLfjSxbTxNWbslw+ailTSvA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848177; 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=Qe9nJQRVKSHRxgpY/sx84VPZRm+QiVwxlvQ/hXioZ1k=; b=KIxUyX+AIok//+ZzGNNOJl56FoViOiT3J+iZPnQFEj7R4/Grd+b8L3Q3YufxMj5r+AMlwK 6+zugRye/VJIy1s7VC+dWakHDnzys722278VD/m2GmGgsNWXT3LLLRRMPzRcxREs8Omopa kZ+m3unQbJerkVxv0Rma28rHJIaKoY6PyhxFe9J1lcYv72tDD7yzmhw63QrS/DLoKBj6Dg 1Cp86BroJvQF4YnhtQvocnsYXrzpaC68zjI5RZn83g48tMngFR6UA8roirb/GyOct4/Gwm +Xis32tZadFBv3d2XFmWMhyyn13flQaiCujDxEIPLAHvSKr1Qsd7e0v9FLnNXg== 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 4WLcL94qpjzDqM; Sat, 13 Jul 2024 05:22: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 46D5MvAt032363; Sat, 13 Jul 2024 05:22:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46D5Mvoa032360; Sat, 13 Jul 2024 05:22:57 GMT (envelope-from git) Date: Sat, 13 Jul 2024 05:22:57 GMT Message-Id: <202407130522.46D5Mvoa032360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 4719366192d3 - main - libc: move __ssp_overlap back out into List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 4719366192d306a76e8e86bf926387f1c4122fd3 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=4719366192d306a76e8e86bf926387f1c4122fd3 commit 4719366192d306a76e8e86bf926387f1c4122fd3 Author: Kyle Evans AuthorDate: 2024-07-13 05:16:09 +0000 Commit: Kyle Evans CommitDate: 2024-07-13 05:16:23 +0000 libc: move __ssp_overlap back out into We'll be using it in some upcoming definitions in headers, so move it back now but slap a warning on it. Our upcoming uses will all be inside of inline functions, so we're not overly concerned about double evaluation immediately. Reviewed by: markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45677 --- include/ssp/ssp.h | 7 +++++++ lib/libc/secure/memcpy_chk.c | 2 -- lib/libc/secure/ssp_internal.h | 37 ------------------------------------- lib/libc/secure/stpcpy_chk.c | 2 -- lib/libc/secure/stpncpy_chk.c | 2 -- lib/libc/secure/strcpy_chk.c | 2 -- lib/libc/secure/strncpy_chk.c | 2 -- 7 files changed, 7 insertions(+), 47 deletions(-) diff --git a/include/ssp/ssp.h b/include/ssp/ssp.h index 35a9aeee02df..622e9e901ba6 100644 --- a/include/ssp/ssp.h +++ b/include/ssp/ssp.h @@ -83,6 +83,13 @@ __ssp_inline rtype fun args { \ #define __ssp_redirect0(rtype, fun, args, call) \ __ssp_redirect_raw(rtype, fun, fun, args, call, 1, __ssp_bos0) +/* + * Take caution when using __ssp_overlap! Don't use it in contexts where we + * can end up with double-evaluation of a statement with some side-effects. + */ +#define __ssp_overlap(a, b, l) \ + (((a) <= (b) && (b) < (a) + (l)) || ((b) <= (a) && (a) < (b) + (l))) + __BEGIN_DECLS void __stack_chk_fail(void) __dead2; void __chk_fail(void) __dead2; diff --git a/lib/libc/secure/memcpy_chk.c b/lib/libc/secure/memcpy_chk.c index 99cf2d5f13ff..2a269cb475ab 100644 --- a/lib/libc/secure/memcpy_chk.c +++ b/lib/libc/secure/memcpy_chk.c @@ -37,8 +37,6 @@ __RCSID("$NetBSD: memcpy_chk.c,v 1.7 2015/05/13 19:57:16 joerg Exp $"); #include #undef memcpy -#include "ssp_internal.h" - void * __memcpy_chk(void * __restrict dst, const void * __restrict src, size_t len, size_t slen) diff --git a/lib/libc/secure/ssp_internal.h b/lib/libc/secure/ssp_internal.h deleted file mode 100644 index 34e5981ba0ca..000000000000 --- a/lib/libc/secure/ssp_internal.h +++ /dev/null @@ -1,37 +0,0 @@ -/* $NetBSD: ssp.h,v 1.13 2015/09/03 20:43:47 plunky Exp $ */ - -/*- - * Copyright (c) 2006, 2011 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Christos Zoulas. - * - * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. - */ -#ifndef _SECURE_SSP_INTERNAL_H_ -#define _SECURE_SSP_INTERNAL_H_ - -#define __ssp_overlap(a, b, l) \ - (((a) <= (b) && (b) < (a) + (l)) || ((b) <= (a) && (a) < (b) + (l))) - -#endif /* _SECURE_SSP_INTERNAL_H_ */ diff --git a/lib/libc/secure/stpcpy_chk.c b/lib/libc/secure/stpcpy_chk.c index 72a4bfb8017a..fd4849099675 100644 --- a/lib/libc/secure/stpcpy_chk.c +++ b/lib/libc/secure/stpcpy_chk.c @@ -37,8 +37,6 @@ __RCSID("$NetBSD: stpcpy_chk.c,v 1.6 2015/05/09 15:42:21 christos Exp $"); #include #undef memcpy -#include "ssp_internal.h" - char * __stpcpy_chk(char * __restrict dst, const char * __restrict src, size_t slen) { diff --git a/lib/libc/secure/stpncpy_chk.c b/lib/libc/secure/stpncpy_chk.c index dfd26133feed..d76f0eb62fcd 100644 --- a/lib/libc/secure/stpncpy_chk.c +++ b/lib/libc/secure/stpncpy_chk.c @@ -37,8 +37,6 @@ __RCSID("$NetBSD: stpncpy_chk.c,v 1.3 2015/05/09 15:42:21 christos Exp $"); #include #undef stpncpy -#include "ssp_internal.h" - char * __stpncpy_chk(char * __restrict dst, const char * __restrict src, size_t len, size_t slen) diff --git a/lib/libc/secure/strcpy_chk.c b/lib/libc/secure/strcpy_chk.c index b89be466240d..14403bd74469 100644 --- a/lib/libc/secure/strcpy_chk.c +++ b/lib/libc/secure/strcpy_chk.c @@ -37,8 +37,6 @@ __RCSID("$NetBSD: strcpy_chk.c,v 1.8 2015/05/09 15:42:21 christos Exp $"); #include #undef memcpy -#include "ssp_internal.h" - char * __strcpy_chk(char * __restrict dst, const char * __restrict src, size_t slen) { diff --git a/lib/libc/secure/strncpy_chk.c b/lib/libc/secure/strncpy_chk.c index 3a2c19796a39..c8d411638862 100644 --- a/lib/libc/secure/strncpy_chk.c +++ b/lib/libc/secure/strncpy_chk.c @@ -37,8 +37,6 @@ __RCSID("$NetBSD: strncpy_chk.c,v 1.6 2015/05/09 15:42:21 christos Exp $"); #include #undef strncpy -#include "ssp_internal.h" - char * __strncpy_chk(char * __restrict dst, const char * __restrict src, size_t len, size_t slen) From nobody Sat Jul 13 05:22:59 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLcLD1lf2z5PvqG; Sat, 13 Jul 2024 05:23: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLcLC72nrz4nd0; Sat, 13 Jul 2024 05:22:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848180; 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=8B267RMflq7sOhAAsAz2TlP8Dk4R3qIbHYD+aBj17Cg=; b=A9PCNBexQ/pczCOvmBjuLJddDbVFy8VAHZkcYkeTMpx5Dft6cC/+ZF5IJ3mIlpwoSlPCUE 8fM9rpV+tJ+TTZG6uAuc0a31DCpDgSuu4guZiK+5rXVkBlHQr2Sseig8uTmD+fktU5FI2T lBRQZMyCfRQfGPRXPAQsBu6EMVNyVpEFJ2GewXp8hPnZa6S/+/KswbphZmMH/DLTFbNyu9 2Wrt/lnqVR1LxBkrNE5WWNSRaVJcjJ/M5P7TQzBPANEkTOZHGZK7Nt/4Tlr+xi7KQWrD+Y +5i2Theh9mdreYdK5cdvm+hNa6djl2H6Piv8WGY7PWcNT7qfpfkzkz+PIBmYSA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720848180; a=rsa-sha256; cv=none; b=J2U7rfyYgS0ZlUCyvQN2kD7oJxs7m3FN46WyLXCEsihB5MfQJW8nvBDPaT5bvOHIkU2A+t b2mOkNfw3FawV6iqNNQaIn2+98/wgtM2Q/GMzXOcC50151IU1bohIaWsW6F/ckeGroGIbN kiexcKr2n/mAOFeD+jacauHpJbn6iAl3vcS2FmoJsQYAiltT7d5376UpBzanaTe9aLvIYr QiuRMCouU7/mc2EMrfYzh1HWNMedqQXNTabKAQevIhtIoJMGS5wpk+OKLdLA0ew3HXoxAR qi3CaI/8G5YUVOguwdl/UDNetfcKCKX9IxRXIbm4wlzP8w0BoHPiLTrU7KSiqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848180; 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=8B267RMflq7sOhAAsAz2TlP8Dk4R3qIbHYD+aBj17Cg=; b=Wd4MnzmCbiK4thQsO/sANUZj7Hiym82wDfylpfKUpdv9N6PtNMxBeklqyMvhj/5CejyAmB JcGSyMcU7z/jBzX58h0JgouuaLZ9ND3Qg+M2AjtnU4m1SxGNvrCOOGRjDPqChTnAXI91yy R1XhAfJcoiHtKKkGlNorIplaNekgjuf0tUtECn5G6X4QAMybXyYf59x2O3TgVtbBAqTUbE zCtEg/rhfrGNHYeCVZ6jtKUqlAFYWhTUpK0IxB24R6OxR6slg4Who4zx4MzFcKAQPlZt9L N6StjjaoytpLop3Qkvciz5aPdaArDPF7nwXJoLuhJMEuUYbLkAps7AniEypjsw== 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 4WLcLC6fzyz1Cj6; Sat, 13 Jul 2024 05:22: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 46D5Mxvh032474; Sat, 13 Jul 2024 05:22:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46D5MxKK032471; Sat, 13 Jul 2024 05:22:59 GMT (envelope-from git) Date: Sat, 13 Jul 2024 05:22:59 GMT Message-Id: <202407130522.46D5MxKK032471@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: c10d567ea022 - main - include: de-macro __ssp_overlap(), improve semantics and checking List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: c10d567ea022de8705fb23f8563c4726f2d09ca0 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=c10d567ea022de8705fb23f8563c4726f2d09ca0 commit c10d567ea022de8705fb23f8563c4726f2d09ca0 Author: Kyle Evans AuthorDate: 2024-07-13 05:16:10 +0000 Commit: Kyle Evans CommitDate: 2024-07-13 05:16:23 +0000 include: de-macro __ssp_overlap(), improve semantics and checking Switch away from pointer arithmetic to provide more obvious semantics for checking overlap on pointer ranges. This lets us remove some casts that need not exist and removes some possible fragility in its use. While we're here, check for overflow just in case; sometimes we use a caller-supplied size if __builtin_object_size(3) can't deduce the buffer size, and we should fail the check if the size is nonsensical for the provided buffers. Reviewed by: markj Sponsored by: Klara, Inc. Sponsored by: Stormshield --- include/ssp/ssp.h | 19 +++++++++++++------ lib/libc/secure/memcpy_chk.c | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/ssp/ssp.h b/include/ssp/ssp.h index 622e9e901ba6..de109da4959e 100644 --- a/include/ssp/ssp.h +++ b/include/ssp/ssp.h @@ -83,12 +83,19 @@ __ssp_inline rtype fun args { \ #define __ssp_redirect0(rtype, fun, args, call) \ __ssp_redirect_raw(rtype, fun, fun, args, call, 1, __ssp_bos0) -/* - * Take caution when using __ssp_overlap! Don't use it in contexts where we - * can end up with double-evaluation of a statement with some side-effects. - */ -#define __ssp_overlap(a, b, l) \ - (((a) <= (b) && (b) < (a) + (l)) || ((b) <= (a) && (a) < (b) + (l))) +#include + +static inline int +__ssp_overlap(const void *leftp, const void *rightp, __size_t sz) +{ + __uintptr_t left = (__uintptr_t)leftp; + __uintptr_t right = (__uintptr_t)rightp; + + if (left <= right) + return (SIZE_MAX - sz < left || right < left + sz); + + return (SIZE_MAX - sz < right || left < right + sz); +} __BEGIN_DECLS void __stack_chk_fail(void) __dead2; diff --git a/lib/libc/secure/memcpy_chk.c b/lib/libc/secure/memcpy_chk.c index 2a269cb475ab..ac995d00ee8c 100644 --- a/lib/libc/secure/memcpy_chk.c +++ b/lib/libc/secure/memcpy_chk.c @@ -44,7 +44,7 @@ __memcpy_chk(void * __restrict dst, const void * __restrict src, size_t len, if (len > slen) __chk_fail(); - if (__ssp_overlap((const char *)src, (const char *)dst, len)) + if (__ssp_overlap(src, dst, len)) __chk_fail(); return (memcpy(dst, src, len)); From nobody Sat Jul 13 05:22:58 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLcLC13rpz5PvZ5; Sat, 13 Jul 2024 05:22: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLcLB63Zfz4nth; Sat, 13 Jul 2024 05:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848178; 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=JO9P6nYoE3iWh2fOthMI3aRdFftVZG+45gqAJGVdQnc=; b=Pdc7gKSLJU7BMSkOCqgV+HoBnhRfbvZ7dHUshrsxv33TtkzwqI3oyAZAZJeB9opMc8Uz6L OwFTbsE2Z0LJ2ww+UUu8ZQkDvRL44+H/toFAYb2Sx0gbZaWTs3HzcMJCMdLNWeeaqAAAcV 4Jbgwq8D9UlhgnzOR1hSxCCHbe37M1LIrpCpulXKfzrOzWCX35rTDlUsbrwjAerAqKkDOL 4q8rf2VBOfhHNkh0sYrgoDDUwCODZbpWm54+WiZt5w/xr47LCSvuNAmo8fi8zzoltLySFy 2/oWtc9ahfri7uU/FHAsmftlBvD+K+YudFxMnfDqamVj3VqOWqgX3nKSMB6b1g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720848178; a=rsa-sha256; cv=none; b=eHzEH69PIQSrO1YrT8AwdZ8XgIq0TW0vfHvQDF9ZTXSrw9sDWSQH8J6u3lGqyhT7lRXRMi UGS6b8jubDRvHvDJeK6b7kfN0B3H0PhSXJ7vHR6cF3u8pcp8WjAEOBKwUfotFqc4W6bU7f tudfrur46IdABGwDxfsA4w94a7+l530F0jB4BLFSJrLU8m6UTVdejTV/9nK3BjOZT6bc1k xva0OEsD/8PHWxOChhssYPgQm5UHy8PCFDegGomhoC41QSFfRQMfx5KMXwT+VyhhdJ1sqT LdroF/fELi7pqq5vFilfOISuzn4YodxBxZp3GWn3MyGXbf5YX757LZnXAWc31w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848178; 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=JO9P6nYoE3iWh2fOthMI3aRdFftVZG+45gqAJGVdQnc=; b=Ixfg3772x/U/Na9s5gC/8CCjpyF7EYAvNMLQ8HA4oiBNkha/nQSNGw5JmEEAunf2WDUuK1 RxyJmaLfkYqWEOAtZZ3ix4+Qw9BaLnpGQES+4rn8h7Q7Sfv7RTYbIe7CEEraftX7qbystX YonXAVv1TQZP4e8Jw8Gbftiegxt7wNt28eS5N2alDXJR1RsAt4RGAIZKqlB1AaX3UEXQMk hK78IYJXHAnxho2framLwoYYc6V4XBPpn5Crv6KcSKNZQ4v1EYRCGKikI4QAL6bO09OUQ+ 6anjiScSLFo/W2XKwAf4jsT3zDcqsRHjUCTpmF8oI9/JMGWqoLRLVBKSHL/AbA== 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 4WLcLB5g8BzDqN; Sat, 13 Jul 2024 05:22: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 46D5MwSo032422; Sat, 13 Jul 2024 05:22:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46D5Mwo9032418; Sat, 13 Jul 2024 05:22:58 GMT (envelope-from git) Date: Sat, 13 Jul 2024 05:22:58 GMT Message-Id: <202407130522.46D5Mwo9032418@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 020d003c8636 - main - libc: tests: add testing infrastructure for _FORTIFY_SOURCE List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 020d003c86367bb5751b6d58fb58611242802c7f Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=020d003c86367bb5751b6d58fb58611242802c7f commit 020d003c86367bb5751b6d58fb58611242802c7f Author: Kyle Evans AuthorDate: 2024-07-13 05:16:10 +0000 Commit: Kyle Evans CommitDate: 2024-07-13 05:16:23 +0000 libc: tests: add testing infrastructure for _FORTIFY_SOURCE The _FORTIFY_SOURCE tests will be generated by a lua script to avoid a lot of redundancy in writing these tests. For each function that we're fortifying, the plan is to test at least the following three scenarios: - Writing up to one byte before the end of the buffer, - Writing up to the end of the buffer, - Writing one byte past the end of the buffer The buffer is shoved into a struct on the stack to guarantee a stack layout in which we have a valid byte after the buffer so that level 2 fortification will trip and we can have confidence that it wasn't some other stack/memory protection instead. The generated tests are divided roughly into which header we're attributing them to so that we can parallelize the build -- the full set is a bit over 9000 lines of C and takes 11s to build on the hardware that I'm testing on if it's a single monolothic file. Reviewed by: markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45678 --- etc/mtree/BSD.tests.dist | 2 + lib/libc/tests/Makefile | 1 + lib/libc/tests/secure/Makefile | 20 + lib/libc/tests/secure/fortify_stdio_test.c | 383 ++++++ lib/libc/tests/secure/fortify_string_test.c | 1415 ++++++++++++++++++++++ lib/libc/tests/secure/fortify_strings_test.c | 354 ++++++ lib/libc/tests/secure/fortify_unistd_test.c | 505 ++++++++ lib/libc/tests/secure/generate-fortify-tests.lua | 706 +++++++++++ 8 files changed, 3386 insertions(+) diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index 375e4900b5d5..bd9edc786f17 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -372,6 +372,8 @@ .. rpc .. + secure + .. setjmp .. ssp diff --git a/lib/libc/tests/Makefile b/lib/libc/tests/Makefile index 7b262ea646fb..7f72fb619004 100644 --- a/lib/libc/tests/Makefile +++ b/lib/libc/tests/Makefile @@ -13,6 +13,7 @@ TESTS_SUBDIRS+= nss TESTS_SUBDIRS+= regex TESTS_SUBDIRS+= resolv TESTS_SUBDIRS+= rpc +TESTS_SUBDIRS+= secure TESTS_SUBDIRS+= setjmp TESTS_SUBDIRS+= stdio TESTS_SUBDIRS+= stdlib diff --git a/lib/libc/tests/secure/Makefile b/lib/libc/tests/secure/Makefile new file mode 100644 index 000000000000..d809f7cadd74 --- /dev/null +++ b/lib/libc/tests/secure/Makefile @@ -0,0 +1,20 @@ +.include + +TESTSDIR:= ${TESTSBASE}/${RELDIR:C/libc\/tests/libc/} + +FORTIFY_TCATS+= stdio +FORTIFY_TCATS+= string +FORTIFY_TCATS+= strings +FORTIFY_TCATS+= unistd + +# Manually run after updating the test generator. +generate-tests: .PHONY +.for tcat in ${FORTIFY_TCATS} +ATF_TESTS_C+= fortify_${tcat}_test + +generate-tests: generate-tests-${tcat} +generate-tests-${tcat}: .PHONY + ${.CURDIR}/generate-fortify-tests.lua ${tcat} > ${.CURDIR}/fortify_${tcat}_test.c +.endfor + +.include diff --git a/lib/libc/tests/secure/fortify_stdio_test.c b/lib/libc/tests/secure/fortify_stdio_test.c new file mode 100644 index 000000000000..20ecdab89a8b --- /dev/null +++ b/lib/libc/tests/secure/fortify_stdio_test.c @@ -0,0 +1,383 @@ +/* @generated by `generate-fortify-tests.lua "stdio"` */ + +#define _FORTIFY_SOURCE 2 +#define TMPFILE_SIZE (1024 * 32) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Create a new symlink to use for readlink(2) style tests, we'll just use a + * random target name to have something interesting to look at. + */ +static const char * __unused +new_symlink(size_t __len) +{ + static const char linkname[] = "link"; + char target[MAXNAMLEN]; + int error; + + ATF_REQUIRE(__len <= sizeof(target)); + + arc4random_buf(target, sizeof(target)); + + error = unlink(linkname); + ATF_REQUIRE(error == 0 || errno == ENOENT); + + error = symlink(target, linkname); + ATF_REQUIRE(error == 0); + + return (linkname); +} + +/* + * Constructs a tmpfile that we can use for testing read(2) and friends. + */ +static int __unused +new_tmpfile(void) +{ + char buf[1024]; + ssize_t rv; + size_t written; + int fd; + + fd = open("tmpfile", O_RDWR | O_CREAT | O_TRUNC, 0644); + ATF_REQUIRE(fd >= 0); + + written = 0; + while (written < TMPFILE_SIZE) { + rv = write(fd, buf, sizeof(buf)); + ATF_REQUIRE(rv > 0); + + written += rv; + } + + ATF_REQUIRE_EQ(0, lseek(fd, 0, SEEK_SET)); + return (fd); +} + +static void +disable_coredumps(void) +{ + struct rlimit rl = { 0 }; + + if (setrlimit(RLIMIT_CORE, &rl) == -1) + _exit(EX_OSERR); +} + +ATF_TC_WITHOUT_HEAD(sprintf_before_end); +ATF_TC_BODY(sprintf_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + char srcvar[__len + 10]; + + memset(srcvar, 'A', sizeof(srcvar) - 1); + srcvar[sizeof(srcvar) - 1] = '\0'; + + sprintf(__stack.__buf, "%.*s", (int)__len - 1, srcvar); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(sprintf_end); +ATF_TC_BODY(sprintf_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + char srcvar[__len + 10]; + + memset(srcvar, 'A', sizeof(srcvar) - 1); + srcvar[sizeof(srcvar) - 1] = '\0'; + + sprintf(__stack.__buf, "%.*s", (int)__len - 1, srcvar); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(sprintf_heap_before_end); +ATF_TC_BODY(sprintf_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + char srcvar[__len + 10]; + + __stack.__buf = malloc(__bufsz); + memset(srcvar, 'A', sizeof(srcvar) - 1); + srcvar[sizeof(srcvar) - 1] = '\0'; + + sprintf(__stack.__buf, "%.*s", (int)__len - 1, srcvar); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(sprintf_heap_end); +ATF_TC_BODY(sprintf_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + char srcvar[__len + 10]; + + __stack.__buf = malloc(__bufsz); + memset(srcvar, 'A', sizeof(srcvar) - 1); + srcvar[sizeof(srcvar) - 1] = '\0'; + + sprintf(__stack.__buf, "%.*s", (int)__len - 1, srcvar); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(sprintf_heap_after_end); +ATF_TC_BODY(sprintf_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + char srcvar[__len + 10]; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + memset(srcvar, 'A', sizeof(srcvar) - 1); + srcvar[sizeof(srcvar) - 1] = '\0'; + + sprintf(__stack.__buf, "%.*s", (int)__len - 1, srcvar); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(snprintf_before_end); +ATF_TC_BODY(snprintf_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + char srcvar[__len + 10]; + + memset(srcvar, 'A', sizeof(srcvar) - 1); + srcvar[sizeof(srcvar) - 1] = '\0'; + + snprintf(__stack.__buf, __len, "%.*s", (int)__len - 1, srcvar); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(snprintf_end); +ATF_TC_BODY(snprintf_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + char srcvar[__len + 10]; + + memset(srcvar, 'A', sizeof(srcvar) - 1); + srcvar[sizeof(srcvar) - 1] = '\0'; + + snprintf(__stack.__buf, __len, "%.*s", (int)__len - 1, srcvar); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(snprintf_heap_before_end); +ATF_TC_BODY(snprintf_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + char srcvar[__len + 10]; + + __stack.__buf = malloc(__bufsz); + memset(srcvar, 'A', sizeof(srcvar) - 1); + srcvar[sizeof(srcvar) - 1] = '\0'; + + snprintf(__stack.__buf, __len, "%.*s", (int)__len - 1, srcvar); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(snprintf_heap_end); +ATF_TC_BODY(snprintf_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + char srcvar[__len + 10]; + + __stack.__buf = malloc(__bufsz); + memset(srcvar, 'A', sizeof(srcvar) - 1); + srcvar[sizeof(srcvar) - 1] = '\0'; + + snprintf(__stack.__buf, __len, "%.*s", (int)__len - 1, srcvar); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(snprintf_heap_after_end); +ATF_TC_BODY(snprintf_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + char srcvar[__len + 10]; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + memset(srcvar, 'A', sizeof(srcvar) - 1); + srcvar[sizeof(srcvar) - 1] = '\0'; + + snprintf(__stack.__buf, __len, "%.*s", (int)__len - 1, srcvar); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, sprintf_before_end); + ATF_TP_ADD_TC(tp, sprintf_end); + ATF_TP_ADD_TC(tp, sprintf_heap_before_end); + ATF_TP_ADD_TC(tp, sprintf_heap_end); + ATF_TP_ADD_TC(tp, sprintf_heap_after_end); + ATF_TP_ADD_TC(tp, snprintf_before_end); + ATF_TP_ADD_TC(tp, snprintf_end); + ATF_TP_ADD_TC(tp, snprintf_heap_before_end); + ATF_TP_ADD_TC(tp, snprintf_heap_end); + ATF_TP_ADD_TC(tp, snprintf_heap_after_end); + return (atf_no_error()); +} diff --git a/lib/libc/tests/secure/fortify_string_test.c b/lib/libc/tests/secure/fortify_string_test.c new file mode 100644 index 000000000000..109ef40fd62d --- /dev/null +++ b/lib/libc/tests/secure/fortify_string_test.c @@ -0,0 +1,1415 @@ +/* @generated by `generate-fortify-tests.lua "string"` */ + +#define _FORTIFY_SOURCE 2 +#define TMPFILE_SIZE (1024 * 32) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Create a new symlink to use for readlink(2) style tests, we'll just use a + * random target name to have something interesting to look at. + */ +static const char * __unused +new_symlink(size_t __len) +{ + static const char linkname[] = "link"; + char target[MAXNAMLEN]; + int error; + + ATF_REQUIRE(__len <= sizeof(target)); + + arc4random_buf(target, sizeof(target)); + + error = unlink(linkname); + ATF_REQUIRE(error == 0 || errno == ENOENT); + + error = symlink(target, linkname); + ATF_REQUIRE(error == 0); + + return (linkname); +} + +/* + * Constructs a tmpfile that we can use for testing read(2) and friends. + */ +static int __unused +new_tmpfile(void) +{ + char buf[1024]; + ssize_t rv; + size_t written; + int fd; + + fd = open("tmpfile", O_RDWR | O_CREAT | O_TRUNC, 0644); + ATF_REQUIRE(fd >= 0); + + written = 0; + while (written < TMPFILE_SIZE) { + rv = write(fd, buf, sizeof(buf)); + ATF_REQUIRE(rv > 0); + + written += rv; + } + + ATF_REQUIRE_EQ(0, lseek(fd, 0, SEEK_SET)); + return (fd); +} + +static void +disable_coredumps(void) +{ + struct rlimit rl = { 0 }; + + if (setrlimit(RLIMIT_CORE, &rl) == -1) + _exit(EX_OSERR); +} + +ATF_TC_WITHOUT_HEAD(memcpy_before_end); +ATF_TC_BODY(memcpy_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + char src[__len + 10]; + + memcpy(__stack.__buf, src, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(memcpy_end); +ATF_TC_BODY(memcpy_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + char src[__len + 10]; + + memcpy(__stack.__buf, src, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(memcpy_heap_before_end); +ATF_TC_BODY(memcpy_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + char src[__len + 10]; + + __stack.__buf = malloc(__bufsz); + + memcpy(__stack.__buf, src, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(memcpy_heap_end); +ATF_TC_BODY(memcpy_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + char src[__len + 10]; + + __stack.__buf = malloc(__bufsz); + + memcpy(__stack.__buf, src, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(memcpy_heap_after_end); +ATF_TC_BODY(memcpy_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + char src[__len + 10]; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + + memcpy(__stack.__buf, src, __len); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(memmove_before_end); +ATF_TC_BODY(memmove_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + char src[__len + 10]; + + memmove(__stack.__buf, src, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(memmove_end); +ATF_TC_BODY(memmove_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + char src[__len + 10]; + + memmove(__stack.__buf, src, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(memmove_heap_before_end); +ATF_TC_BODY(memmove_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + char src[__len + 10]; + + __stack.__buf = malloc(__bufsz); + + memmove(__stack.__buf, src, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(memmove_heap_end); +ATF_TC_BODY(memmove_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + char src[__len + 10]; + + __stack.__buf = malloc(__bufsz); + + memmove(__stack.__buf, src, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(memmove_heap_after_end); +ATF_TC_BODY(memmove_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + char src[__len + 10]; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + + memmove(__stack.__buf, src, __len); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(memset_before_end); +ATF_TC_BODY(memset_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + + memset(__stack.__buf, 0, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(memset_end); +ATF_TC_BODY(memset_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + + memset(__stack.__buf, 0, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(memset_heap_before_end); +ATF_TC_BODY(memset_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + memset(__stack.__buf, 0, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(memset_heap_end); +ATF_TC_BODY(memset_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + memset(__stack.__buf, 0, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(memset_heap_after_end); +ATF_TC_BODY(memset_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + + memset(__stack.__buf, 0, __len); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(stpcpy_before_end); +ATF_TC_BODY(stpcpy_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + char src[__len]; + + memset(__stack.__buf, 0, __len); + memset(src, 'A', __len - 1); + src[__len - 1] = '\0'; + + stpcpy(__stack.__buf, src); +#undef BUF + +} + *** 2503 LINES SKIPPED *** From nobody Sat Jul 13 05:23:00 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLcLF2LdWz5PvL0; Sat, 13 Jul 2024 05:23: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLcLF0xcjz4nx2; Sat, 13 Jul 2024 05:23:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848181; 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=ucBuWDesATbEurE1am0i5OBn6KLA+byi9LJARc3NPXE=; b=M1DeeFXYdhaCmxNCo9DCiPImaQEIbkhL31sNbip8oC59YgyuEZGBceZn9TeLYmSJiHRXWm BH6NIXwSBdbqDeF5vYODJIOOVOq5gIZymoouUMn8QQZTL6exMzL+BLAyS+NCwNW+I6Ar8f G5BxCu0V9D+JXIlljdI/C6JLuJf2Jtwb5UtIwITcoOzi8mk6l0uI23+EySs177Vh57oGMx i3s0XyWRcKCvlLW6rUpItIUZ3d2vdsmuQgRYbXX3H+VxeBjJYSVLcA6++SnXtF6P0X447k +TNK+t6B4pW2Myuej4DNdobaH5Y+cMEcO2/F02NR5bUTGBkzssT1XoUYijN76g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720848181; a=rsa-sha256; cv=none; b=y0Zi/vcdh+z1gFkMTzN70bXN9Ihy6TBw8Hcb4SlUlxbKJiOeYFzf8wwACBOSpggFJ9Qbdm mgW44GJ5IKMUqsAjq3C5bzcdMDOS2yyIvsXb9k/JtN3VcymkrQ5AtLDzfRfucr9AnRACUk ot5gDczIEKVDuGX8XsYe0xGMLDnhzUD/nBaTZp+vADJ1KZvIrmPgyw/xV6zbXS6ggoXdCp qS9hR33DIwfhWkd2wmPa2TOm+E91aaVgRAL7JmHHBAIpj+IR8rKTy1vjKQSgcYPEyV/Og1 pifMTp2JBX1TweWnOrBxse0yCYve7/J7n7j3J5wteByIOetnW9HaqIKSskQ7/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848181; 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=ucBuWDesATbEurE1am0i5OBn6KLA+byi9LJARc3NPXE=; b=VRobLREYZlODXICAp+SUEOzihERmkepotequBrASCKu7OGNvMSECqq4AQKT2q1+2O7S4T1 WZQv930FVUr7IwY8yZc4qcEd89lRK6RP1xeGpHoPV69aH5Yu6q6cVr9kWD/Jl8ArF4TXtB uxJdmJdW6ZKPiqnk+2VLdl0ljyFG9nibcCQk+dXyBuRxmozk8aZIMm1gWJ5eMORmCiPw1f WryB/0lvc4NibU4Fr0NA1hlVTmrB3NiIxGQ4HabwIb0u0YfvwAgpZiz+3YK3CffJYO3l+f doQktXlg3ToBYUZkOs8sSCgkDC3TvZdRVfPP5hz78aHd36R8hCdm94LsggBVUw== 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 4WLcLF0Yj4zDqP; Sat, 13 Jul 2024 05:23: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 46D5N1pI032537; Sat, 13 Jul 2024 05:23:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46D5N0Qh032534; Sat, 13 Jul 2024 05:23:00 GMT (envelope-from git) Date: Sat, 13 Jul 2024 05:23:00 GMT Message-Id: <202407130523.46D5N0Qh032534@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: cf8e5289a110 - main - include: ssp: round out fortification of current set of headers List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: cf8e5289a110954600f135024d1515a77d0ae34d Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=cf8e5289a110954600f135024d1515a77d0ae34d commit cf8e5289a110954600f135024d1515a77d0ae34d Author: Kyle Evans AuthorDate: 2024-07-13 05:16:10 +0000 Commit: Kyle Evans CommitDate: 2024-07-13 05:16:24 +0000 include: ssp: round out fortification of current set of headers ssp/ssp.h needed some improvements: - `len` isn't always a size_t, it may need casted - In some cases we may want to use a len that isn't specified as a parameter (e.g., L_ctermid), so __ssp_redirect() should be more flexible. - In other cases we may want additional checking, so pull all of the declaration bits out of __ssp_redirect_raw() so that some functions can implement the body themselves. strlcat/strlcpy should be the last of the fortified functions that get their own __*_chk symbols, and these cases are only done to be consistent with the rest of the str*() set. Reviewed by: markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45679 --- include/ssp/ssp.h | 16 +- include/ssp/stdio.h | 18 + include/ssp/string.h | 22 + include/ssp/strings.h | 5 + include/ssp/unistd.h | 36 +- include/stdio.h | 37 +- include/string.h | 29 +- include/strings.h | 11 +- lib/libc/amd64/string/strlcat.c | 2 + lib/libc/gen/ctermid.c | 5 +- lib/libc/gen/getdomainname.c | 3 +- lib/libc/gen/getentropy.c | 3 +- lib/libc/gen/getgrouplist.c | 3 +- lib/libc/gen/gethostname.c | 3 +- lib/libc/gen/getlogin.c | 3 +- lib/libc/gen/ttyname.c | 3 +- lib/libc/secure/Makefile.inc | 4 +- lib/libc/secure/Symbol.map | 2 + lib/libc/secure/strlcat_chk.c | 70 + lib/libc/secure/strlcpy_chk.c | 43 + lib/libc/stdio/fread.c | 4 +- lib/libc/stdio/gets_s.c | 3 +- lib/libc/stdio/tmpnam.c | 3 +- lib/libc/string/mempcpy.c | 4 +- lib/libc/string/strerror.c | 4 +- lib/libc/string/strlcat.c | 2 + lib/libc/string/strlcpy.c | 2 + lib/libc/string/strncpy.c | 2 + lib/libc/tests/secure/fortify_stdio_test.c | 1024 +++++++++++++- lib/libc/tests/secure/fortify_string_test.c | 478 +++++++ lib/libc/tests/secure/fortify_strings_test.c | 165 +++ lib/libc/tests/secure/fortify_unistd_test.c | 1592 +++++++++++++++++++++- lib/libc/tests/secure/generate-fortify-tests.lua | 271 ++++ lib/libutil/tests/trimdomain-nodomain_test.c | 4 +- lib/libutil/tests/trimdomain_test.c | 4 +- sys/libkern/explicit_bzero.c | 3 +- sys/sys/libkern.h | 6 + 37 files changed, 3745 insertions(+), 144 deletions(-) diff --git a/include/ssp/ssp.h b/include/ssp/ssp.h index de109da4959e..6ebc23288391 100644 --- a/include/ssp/ssp.h +++ b/include/ssp/ssp.h @@ -67,21 +67,25 @@ #define __ssp_bos0(ptr) __builtin_object_size(ptr, 0) #define __ssp_check(buf, len, bos) \ - if (bos(buf) != (size_t)-1 && len > bos(buf)) \ + if (bos(buf) != (size_t)-1 && (size_t)len > bos(buf)) \ __chk_fail() -#define __ssp_redirect_raw(rtype, fun, symbol, args, call, cond, bos) \ + +#define __ssp_redirect_raw_impl(rtype, fun, symbol, args) \ rtype __ssp_real_(fun) args __RENAME(symbol); \ __ssp_inline rtype fun args __RENAME(__ssp_protected_ ## fun); \ -__ssp_inline rtype fun args { \ +__ssp_inline rtype fun args + +#define __ssp_redirect_raw(rtype, fun, symbol, args, call, cond, bos, len) \ +__ssp_redirect_raw_impl(rtype, fun, symbol, args) { \ if (cond) \ - __ssp_check(__buf, __len, bos); \ + __ssp_check(__buf, len, bos); \ return __ssp_real_(fun) call; \ } #define __ssp_redirect(rtype, fun, args, call) \ - __ssp_redirect_raw(rtype, fun, fun, args, call, 1, __ssp_bos) + __ssp_redirect_raw(rtype, fun, fun, args, call, 1, __ssp_bos, __len) #define __ssp_redirect0(rtype, fun, args, call) \ - __ssp_redirect_raw(rtype, fun, fun, args, call, 1, __ssp_bos0) + __ssp_redirect_raw(rtype, fun, fun, args, call, 1, __ssp_bos0, __len) #include diff --git a/include/ssp/stdio.h b/include/ssp/stdio.h index 4bca1de7d4f9..f7a390f315a4 100644 --- a/include/ssp/stdio.h +++ b/include/ssp/stdio.h @@ -37,6 +37,24 @@ #include __BEGIN_DECLS +#if __SSP_FORTIFY_LEVEL > 0 +#if __POSIX_VISIBLE +__ssp_redirect_raw(char *, ctermid, ctermid, (char *__buf), (__buf), + __buf != NULL, __ssp_bos, L_ctermid); +#if __BSD_VISIBLE +__ssp_redirect_raw(char *, ctermid_r, ctermid_r, (char *__buf), (__buf), + __buf != NULL, __ssp_bos, L_ctermid); +#endif /* __BSD_VISIBLE */ +#endif /* __POSIX_VISIBLE */ +__ssp_redirect(size_t, fread, (void *__restrict __buf, size_t __len, + size_t __nmemb, FILE *__restrict __fp), (__buf, __len, __nmemb, __fp)); +__ssp_redirect(size_t, fread_unlocked, (void *__restrict __buf, size_t __len, + size_t __nmemb, FILE *__restrict __fp), (__buf, __len, __nmemb, __fp)); +__ssp_redirect(char *, gets_s, (char *__buf, rsize_t __len), (__buf, __len)); +__ssp_redirect_raw(char *, tmpnam, tmpnam, (char *__buf), (__buf), 1, + __ssp_bos, L_tmpnam); +#endif + int __sprintf_chk(char *__restrict, int, size_t, const char *__restrict, ...) __printflike(4, 5); int __vsprintf_chk(char *__restrict, int, size_t, const char *__restrict, diff --git a/include/ssp/string.h b/include/ssp/string.h index ceb4ba2a2174..b9f2dceb1df5 100644 --- a/include/ssp/string.h +++ b/include/ssp/string.h @@ -45,7 +45,9 @@ char *__stpncpy_chk(char *, const char *, size_t, size_t); char *__strcat_chk(char *, const char *, size_t); char *__strcpy_chk(char *, const char *, size_t); char *__strncat_chk(char *, const char *, size_t, size_t); +size_t __strlcat_chk(char *, const char *, size_t, size_t); char *__strncpy_chk(char *, const char *, size_t, size_t); +size_t __strlcpy_chk(char *, const char *, size_t, size_t); __END_DECLS #if __SSP_FORTIFY_LEVEL > 0 @@ -110,8 +112,24 @@ __ssp_bos_icheck2_restrict(stpcpy, char *, const char *) __ssp_bos_icheck3_restrict(stpncpy, char *, const char *) __ssp_bos_icheck2_restrict(strcpy, char *, const char *) __ssp_bos_icheck2_restrict(strcat, char *, const char *) +__ssp_redirect0(int, strerror_r, (int __errnum, char *__buf, size_t __len), + (__errnum, __buf, __len)); __ssp_bos_icheck3_restrict(strncpy, char *, const char *) __ssp_bos_icheck3_restrict(strncat, char *, const char *) + +__ssp_redirect_raw_impl(void *, mempcpy, mempcpy, + (void *__restrict buf, const void *__restrict src, size_t len)) +{ + const size_t slen = __ssp_bos(buf); + + if (len > slen) + __chk_fail(); + + if (__ssp_overlap(src, buf, len)) + __chk_fail(); + + return (__ssp_real(mempcpy)(buf, src, len)); +} __END_DECLS #define memcpy(dst, src, len) __ssp_bos_check3(memcpy, dst, src, len) @@ -122,7 +140,11 @@ __END_DECLS #define stpncpy(dst, src, len) __ssp_bos_check3(stpncpy, dst, src, len) #define strcpy(dst, src) __ssp_bos_check2(strcpy, dst, src) #define strcat(dst, src) __ssp_bos_check2(strcat, dst, src) +#define strlcpy(dst, src, dstlen) \ + __strlcpy_chk(dst, src, dstlen, __ssp_bos(dst)) #define strncpy(dst, src, len) __ssp_bos_check3(strncpy, dst, src, len) +#define strlcat(dst, src, dstlen) \ + __strlcat_chk(dst, src, dstlen, __ssp_bos(dst)) #define strncat(dst, src, len) __ssp_bos_check3(strncat, dst, src, len) #endif /* __SSP_FORTIFY_LEVEL > 0 */ diff --git a/include/ssp/strings.h b/include/ssp/strings.h index 51b11a14ee87..79b70eba1c5c 100644 --- a/include/ssp/strings.h +++ b/include/ssp/strings.h @@ -63,5 +63,10 @@ #define bzero(dst, len) _ssp_bzero(__ssp_var(dstv), dst, __ssp_var(lenv), len) +__BEGIN_DECLS +__ssp_redirect(void, explicit_bzero, (void *__buf, size_t __len), + (__buf, __len)); +__END_DECLS + #endif /* __SSP_FORTIFY_LEVEL > 0 */ #endif /* _SSP_STRINGS_H_ */ diff --git a/include/ssp/unistd.h b/include/ssp/unistd.h index bcd3664116cc..7e9d72343dde 100644 --- a/include/ssp/unistd.h +++ b/include/ssp/unistd.h @@ -43,14 +43,46 @@ __BEGIN_DECLS #define _FORTIFY_SOURCE_read read #endif -__ssp_redirect0(ssize_t, _FORTIFY_SOURCE_read, (int __fd, void *__buf, +__ssp_inline size_t +__ssp_gid_bos(const void *ptr) +{ + size_t ptrsize = __ssp_bos(ptr); + + if (ptrsize == (size_t)-1) + return (ptrsize); + + return (ptrsize / sizeof(gid_t)); +} + +__ssp_redirect_raw(int, getgrouplist, getgrouplist, + (const char *__name, gid_t __base, gid_t *__buf, int *__lenp), + (__name, __base, __buf, __lenp), 1, __ssp_gid_bos, *__lenp); + +__ssp_redirect_raw(int, getgroups, getgroups, (int __len, gid_t *__buf), + (__len, __buf), 1, __ssp_gid_bos, __len); + +__ssp_redirect(int, getloginclass, (char *__buf, size_t __len), + (__buf, __len)); + +__ssp_redirect(ssize_t, _FORTIFY_SOURCE_read, (int __fd, void *__buf, size_t __len), (__fd, __buf, __len)); +__ssp_redirect(ssize_t, pread, (int __fd, void *__buf, size_t __len, + off_t __offset), (__fd, __buf, __len, __offset)); __ssp_redirect(ssize_t, readlink, (const char *__restrict __path, \ char *__restrict __buf, size_t __len), (__path, __buf, __len)); +__ssp_redirect(ssize_t, readlinkat, (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len), (__fd, __path, __buf, __len)); __ssp_redirect_raw(char *, getcwd, getcwd, (char *__buf, size_t __len), - (__buf, __len), __buf != 0, __ssp_bos); + (__buf, __len), __buf != 0, __ssp_bos, __len); + +__ssp_redirect(int, getdomainname, (char *__buf, int __len), (__buf, __len)); +__ssp_redirect(int, getentropy, (void *__buf, size_t __len), (__buf, __len)); +__ssp_redirect(int, gethostname, (char *__buf, size_t __len), (__buf, __len)); +__ssp_redirect(int, getlogin_r, (char *__buf, size_t __len), (__buf, __len)); +__ssp_redirect(int, ttyname_r, (int __fd, char *__buf, size_t __len), + (__fd, __buf, __len)); __END_DECLS diff --git a/include/stdio.h b/include/stdio.h index ea53816cf1d4..b0190d25eb4f 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -238,6 +238,21 @@ __END_DECLS #define stdout __stdoutp #define stderr __stderrp +/* + * Functions defined in all versions of POSIX 1003.1. + */ +#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 199506) +#define L_cuserid 17 /* size for cuserid(3); MAXLOGNAME, legacy */ +#endif + +#if __POSIX_VISIBLE +#define L_ctermid 1024 /* size for ctermid(3); PATH_MAX */ +#endif /* __POSIX_VISIBLE */ + +#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#include +#endif + __BEGIN_DECLS #ifdef _XLOCALE_H_ #include @@ -252,7 +267,7 @@ int ferror(FILE *); int fflush(FILE *); int fgetc(FILE *); int fgetpos(FILE * __restrict, fpos_t * __restrict); -char *fgets(char * __restrict, int, FILE * __restrict); +char *(fgets)(char * __restrict, int, FILE * __restrict); FILE *fopen(const char * __restrict, const char * __restrict); int fprintf(FILE * __restrict, const char * __restrict, ...); int fputc(int, FILE *); @@ -280,7 +295,7 @@ void rewind(FILE *); int scanf(const char * __restrict, ...); void setbuf(FILE * __restrict, char * __restrict); int setvbuf(FILE * __restrict, char * __restrict, int, size_t); -int sprintf(char * __restrict, const char * __restrict, ...); +int (sprintf)(char * __restrict, const char * __restrict, ...); int sscanf(const char * __restrict, const char * __restrict, ...); FILE *tmpfile(void); char *tmpnam(char *); @@ -288,13 +303,13 @@ int ungetc(int, FILE *); int vfprintf(FILE * __restrict, const char * __restrict, __va_list); int vprintf(const char * __restrict, __va_list); -int vsprintf(char * __restrict, const char * __restrict, +int (vsprintf)(char * __restrict, const char * __restrict, __va_list); #if __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE >= 199506 -int snprintf(char * __restrict, size_t, const char * __restrict, +int (snprintf)(char * __restrict, size_t, const char * __restrict, ...) __printflike(3, 4); -int vsnprintf(char * __restrict, size_t, const char * __restrict, +int (vsnprintf)(char * __restrict, size_t, const char * __restrict, __va_list) __printflike(3, 0); #endif #if __ISO_C_VISIBLE >= 1999 @@ -305,16 +320,7 @@ int vsscanf(const char * __restrict, const char * __restrict, __va_list) __scanflike(2, 0); #endif -/* - * Functions defined in all versions of POSIX 1003.1. - */ -#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 199506) -#define L_cuserid 17 /* size for cuserid(3); MAXLOGNAME, legacy */ -#endif - #if __POSIX_VISIBLE -#define L_ctermid 1024 /* size for ctermid(3); PATH_MAX */ - char *ctermid(char *); FILE *fdopen(int, const char *); int fileno(FILE *); @@ -530,7 +536,4 @@ extern int __isthreaded; __END_DECLS __NULLABILITY_PRAGMA_POP -#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 -#include -#endif #endif /* !_STDIO_H_ */ diff --git a/include/string.h b/include/string.h index ce605117daa6..c9d3e1add1a1 100644 --- a/include/string.h +++ b/include/string.h @@ -49,6 +49,10 @@ typedef __size_t size_t; #define _SIZE_T_DECLARED #endif +#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#include +#endif + __BEGIN_DECLS #if __XSI_VISIBLE >= 600 void *memccpy(void * __restrict, const void * __restrict, int, size_t); @@ -58,23 +62,23 @@ void *memchr(const void *, int, size_t) __pure; void *memrchr(const void *, int, size_t) __pure; #endif int memcmp(const void *, const void *, size_t) __pure; -void *memcpy(void * __restrict, const void * __restrict, size_t); +void *(memcpy)(void * __restrict, const void * __restrict, size_t); #if __BSD_VISIBLE void *memmem(const void *, size_t, const void *, size_t) __pure; #endif -void *memmove(void *, const void *, size_t); +void *(memmove)(void *, const void *, size_t); #if __BSD_VISIBLE void *mempcpy(void * __restrict, const void * __restrict, size_t); #endif -void *memset(void *, int, size_t); +void *(memset)(void *, int, size_t); #if __POSIX_VISIBLE >= 200809 -char *stpcpy(char * __restrict, const char * __restrict); -char *stpncpy(char * __restrict, const char * __restrict, size_t); +char *(stpcpy)(char * __restrict, const char * __restrict); +char *(stpncpy)(char * __restrict, const char * __restrict, size_t); #endif #if __BSD_VISIBLE char *strcasestr(const char *, const char *) __pure; #endif -char *strcat(char * __restrict, const char * __restrict); +char *(strcat)(char * __restrict, const char * __restrict); char *strchr(const char *, int) __pure; #if __BSD_VISIBLE char *strchrnul(const char*, int) __pure; @@ -82,7 +86,7 @@ int strverscmp(const char *, const char *) __pure; #endif int strcmp(const char *, const char *) __pure; int strcoll(const char *, const char *); -char *strcpy(char * __restrict, const char * __restrict); +char *(strcpy)(char * __restrict, const char * __restrict); size_t strcspn(const char *, const char *) __pure; #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE char *strdup(const char *) __malloc_like; @@ -92,8 +96,8 @@ char *strerror(int); int strerror_r(int, char *, size_t); #endif #if __BSD_VISIBLE -size_t strlcat(char * __restrict, const char * __restrict, size_t); -size_t strlcpy(char * __restrict, const char * __restrict, size_t); +size_t (strlcat)(char * __restrict, const char * __restrict, size_t); +size_t (strlcpy)(char * __restrict, const char * __restrict, size_t); #endif size_t strlen(const char *) __pure; #if __BSD_VISIBLE @@ -105,9 +109,9 @@ typedef __mode_t mode_t; void strmode(mode_t, char *); #endif -char *strncat(char * __restrict, const char * __restrict, size_t); +char *(strncat)(char * __restrict, const char * __restrict, size_t); int strncmp(const char *, const char *, size_t) __pure; -char *strncpy(char * __restrict, const char * __restrict, size_t); +char *(strncpy)(char * __restrict, const char * __restrict, size_t); #if __POSIX_VISIBLE >= 200809 char *strndup(const char *, size_t) __malloc_like; size_t strnlen(const char *, size_t) __pure; @@ -168,7 +172,4 @@ errno_t memset_s(void *, rsize_t, int, rsize_t); #endif /* __EXT1_VISIBLE */ __END_DECLS -#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 -#include -#endif #endif /* _STRING_H_ */ diff --git a/include/strings.h b/include/strings.h index 511f7c03cb3c..889f43bd2311 100644 --- a/include/strings.h +++ b/include/strings.h @@ -37,11 +37,15 @@ typedef __size_t size_t; #define _SIZE_T_DECLARED #endif +#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#include +#endif + __BEGIN_DECLS #if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 int bcmp(const void *, const void *, size_t) __pure; /* LEGACY */ -void bcopy(const void *, void *, size_t); /* LEGACY */ -void bzero(void *, size_t); /* LEGACY */ +void (bcopy)(const void *, void *, size_t); /* LEGACY */ +void (bzero)(void *, size_t); /* LEGACY */ #endif #if __BSD_VISIBLE void explicit_bzero(void *, size_t); @@ -68,7 +72,4 @@ int strncasecmp(const char *, const char *, size_t) __pure; #endif __END_DECLS -#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 -#include -#endif #endif /* _STRINGS_H_ */ diff --git a/lib/libc/amd64/string/strlcat.c b/lib/libc/amd64/string/strlcat.c index 0c1e1c5d05f7..94fdc0963dc3 100644 --- a/lib/libc/amd64/string/strlcat.c +++ b/lib/libc/amd64/string/strlcat.c @@ -8,6 +8,8 @@ #include +#undef strlcat /* FORTIFY_SOURCE */ + void *__memchr(const void *, int, size_t); size_t __strlcpy(char *restrict, const char *restrict, size_t); diff --git a/lib/libc/gen/ctermid.c b/lib/libc/gen/ctermid.c index 9265d402930c..fb117b3c8ded 100644 --- a/lib/libc/gen/ctermid.c +++ b/lib/libc/gen/ctermid.c @@ -34,11 +34,12 @@ #include #include #include +#include #define LEN_PATH_DEV (sizeof(_PATH_DEV) - 1) char * -ctermid(char *s) +__ssp_real(ctermid)(char *s) { static char def[sizeof(_PATH_DEV) + SPECNAMELEN]; struct stat sb; @@ -62,7 +63,7 @@ ctermid(char *s) } char * -ctermid_r(char *s) +__ssp_real(ctermid_r)(char *s) { return (s != NULL ? ctermid(s) : NULL); diff --git a/lib/libc/gen/getdomainname.c b/lib/libc/gen/getdomainname.c index a9527b36a247..c0be7465f967 100644 --- a/lib/libc/gen/getdomainname.c +++ b/lib/libc/gen/getdomainname.c @@ -33,9 +33,10 @@ #include #include +#include int -getdomainname(char *name, int namelen) +__ssp_real(getdomainname)(char *name, int namelen) { int mib[2]; size_t size; diff --git a/lib/libc/gen/getentropy.c b/lib/libc/gen/getentropy.c index 38cd515e74d7..40b84af65f83 100644 --- a/lib/libc/gen/getentropy.c +++ b/lib/libc/gen/getentropy.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "libc_private.h" @@ -105,7 +106,7 @@ getentropy_fallback(void *buf, size_t buflen) } int -getentropy(void *buf, size_t buflen) +__ssp_real(getentropy)(void *buf, size_t buflen) { ssize_t rd; bool have_getrandom; diff --git a/lib/libc/gen/getgrouplist.c b/lib/libc/gen/getgrouplist.c index 1c29b249f8c4..5bd06bc5121f 100644 --- a/lib/libc/gen/getgrouplist.c +++ b/lib/libc/gen/getgrouplist.c @@ -37,11 +37,12 @@ #include #include #include +#include extern int __getgroupmembership(const char *, gid_t, gid_t *, int, int *); int -getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt) +__ssp_real(getgrouplist)(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt) { return __getgroupmembership(uname, agroup, groups, *grpcnt, grpcnt); } diff --git a/lib/libc/gen/gethostname.c b/lib/libc/gen/gethostname.c index 36e988c91ecc..66d401fad846 100644 --- a/lib/libc/gen/gethostname.c +++ b/lib/libc/gen/gethostname.c @@ -34,9 +34,10 @@ #include #include +#include int -gethostname(char *name, size_t namelen) +__ssp_real(gethostname)(char *name, size_t namelen) { int mib[2]; diff --git a/lib/libc/gen/getlogin.c b/lib/libc/gen/getlogin.c index 55ed83795f7d..f8a3fb079067 100644 --- a/lib/libc/gen/getlogin.c +++ b/lib/libc/gen/getlogin.c @@ -37,6 +37,7 @@ #include #include "namespace.h" #include +#include #include "un-namespace.h" #include "libc_private.h" @@ -54,7 +55,7 @@ getlogin(void) } int -getlogin_r(char *logname, size_t namelen) +__ssp_real(getlogin_r)(char *logname, size_t namelen) { char tmpname[MAXLOGNAME]; int len; diff --git a/lib/libc/gen/ttyname.c b/lib/libc/gen/ttyname.c index 268b2e0f7b65..f1e2f401fe5d 100644 --- a/lib/libc/gen/ttyname.c +++ b/lib/libc/gen/ttyname.c @@ -42,6 +42,7 @@ #include #include #include "reentrant.h" +#include #include "un-namespace.h" #include "libc_private.h" @@ -53,7 +54,7 @@ static thread_key_t ttyname_key; static int ttyname_keycreated = 0; int -ttyname_r(int fd, char *buf, size_t len) +__ssp_real(ttyname_r)(int fd, char *buf, size_t len) { size_t used; diff --git a/lib/libc/secure/Makefile.inc b/lib/libc/secure/Makefile.inc index 28289127c7a6..5d10612e67a8 100644 --- a/lib/libc/secure/Makefile.inc +++ b/lib/libc/secure/Makefile.inc @@ -6,8 +6,8 @@ # _FORTIFY_SOURCE SRCS+= fgets_chk.c memcpy_chk.c memmove_chk.c memset_chk.c \ snprintf_chk.c sprintf_chk.c stpcpy_chk.c stpncpy_chk.c \ - strcat_chk.c strcpy_chk.c strncat_chk.c strncpy_chk.c \ - vsnprintf_chk.c vsprintf_chk.c + strcat_chk.c strcpy_chk.c strlcat_chk.c strncat_chk.c strlcpy_chk.c \ + strncpy_chk.c vsnprintf_chk.c vsprintf_chk.c CFLAGS.snprintf_chk.c+= -Wno-unused-parameter CFLAGS.sprintf_chk.c+= -Wno-unused-parameter diff --git a/lib/libc/secure/Symbol.map b/lib/libc/secure/Symbol.map index 0d854039955f..1f12fe059367 100644 --- a/lib/libc/secure/Symbol.map +++ b/lib/libc/secure/Symbol.map @@ -15,7 +15,9 @@ FBSD_1.8 { __stpncpy_chk; __strcat_chk; __strcpy_chk; + __strlcat_chk; __strncat_chk; + __strlcpy_chk; __strncpy_chk; __vsnprintf_chk; __vsprintf_chk; diff --git a/lib/libc/secure/strlcat_chk.c b/lib/libc/secure/strlcat_chk.c new file mode 100644 index 000000000000..26448bd37af0 --- /dev/null +++ b/lib/libc/secure/strlcat_chk.c @@ -0,0 +1,70 @@ +/* $OpenBSD: strlcat.c,v 1.15 2015/03/02 21:41:08 millert Exp $ */ + +/* + * SPDX-License-Identifier: ISC + * + * Copyright (c) 1998, 2015 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include + +#include + +/* + * Appends src to string dst of size dsize (unlike strncat, dsize is the + * full size of dst, not space left). At most dsize-1 characters + * will be copied. Always NUL terminates (unless dsize <= strlen(dst)). + * Returns strlen(src) + MIN(dsize, strlen(initial dst)). + * If retval >= dsize, truncation occurred. + */ +size_t +__strlcat_chk(char * __restrict dst, const char * __restrict src, size_t dsize, + size_t dbufsize) +{ + const char *odst = dst; + const char *osrc = src; + size_t n = dsize; + size_t dlen; + + if (dsize > dbufsize) + __chk_fail(); + + /* Find the end of dst and adjust bytes left but don't go past end. */ + while (n-- != 0 && *dst != '\0') { + dst++; + } + + dlen = dst - odst; + n = dsize - dlen; + + if (n-- == 0) + return (dlen + strlen(src)); + while (*src != '\0') { + if (n != 0) { + if (dbufsize-- == 0) + __chk_fail(); + *dst++ = *src; + n--; + } + + src++; + } + + if (dbufsize-- == 0) + __chk_fail(); + *dst = '\0'; + return (dlen + (src - osrc)); /* count does not include NUL */ +} diff --git a/lib/libc/secure/strlcpy_chk.c b/lib/libc/secure/strlcpy_chk.c new file mode 100644 index 000000000000..8c11ee3e07eb --- /dev/null +++ b/lib/libc/secure/strlcpy_chk.c @@ -0,0 +1,43 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024, Klara, Inc. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#include +#include + +#include +#undef strlcpy + +size_t +__strlcpy_chk(char * __restrict dst, const char * __restrict src, size_t dsize, + size_t dbufsize) +{ + + if (dsize > dbufsize) + __chk_fail(); + + return (strlcpy(dst, src, dsize)); +} diff --git a/lib/libc/stdio/fread.c b/lib/libc/stdio/fread.c index bf943fdd1d0d..65d9ecf94366 100644 --- a/lib/libc/stdio/fread.c +++ b/lib/libc/stdio/fread.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "un-namespace.h" #include "local.h" #include "libc_private.h" @@ -46,7 +47,8 @@ */ size_t -fread(void * __restrict buf, size_t size, size_t count, FILE * __restrict fp) +__ssp_real(fread)(void * __restrict buf, size_t size, size_t count, + FILE * __restrict fp) { size_t ret; diff --git a/lib/libc/stdio/gets_s.c b/lib/libc/stdio/gets_s.c index 9a8cf34916fb..41e379507483 100644 --- a/lib/libc/stdio/gets_s.c +++ b/lib/libc/stdio/gets_s.c @@ -39,6 +39,7 @@ #include #include #include +#include #include "un-namespace.h" #include "libc_private.h" #include "local.h" @@ -77,7 +78,7 @@ _gets_s(char *buf, rsize_t n) /* ISO/IEC 9899:2011 K.3.7.4.1 */ char * -gets_s(char *buf, rsize_t n) +__ssp_real(gets_s)(char *buf, rsize_t n) { char *ret; if (buf == NULL) { diff --git a/lib/libc/stdio/tmpnam.c b/lib/libc/stdio/tmpnam.c index d7c436928cd7..fab4253e2834 100644 --- a/lib/libc/stdio/tmpnam.c +++ b/lib/libc/stdio/tmpnam.c @@ -36,6 +36,7 @@ #include #include +#include __warn_references(tmpnam, "warning: tmpnam() possibly used unsafely; consider using mkstemp()"); @@ -43,7 +44,7 @@ __warn_references(tmpnam, extern char *_mktemp(char *); char * -tmpnam(char *s) +__ssp_real(tmpnam)(char *s) { static u_long tmpcount; static char buf[L_tmpnam]; diff --git a/lib/libc/string/mempcpy.c b/lib/libc/string/mempcpy.c index 619371632922..86e44cdebb85 100644 --- a/lib/libc/string/mempcpy.c +++ b/lib/libc/string/mempcpy.c @@ -29,9 +29,11 @@ */ #include +#include void * -mempcpy(void *__restrict dst, const void *__restrict src, size_t len) +__ssp_real(mempcpy)(void *__restrict dst, const void *__restrict src, + size_t len) { return ((char *)memcpy(dst, src, len) + len); } diff --git a/lib/libc/string/strerror.c b/lib/libc/string/strerror.c index ecad55caa673..922bb0284497 100644 --- a/lib/libc/string/strerror.c +++ b/lib/libc/string/strerror.c @@ -38,6 +38,8 @@ #include #include +#include + #include "errlst.h" #include "../locale/xlocale_private.h" #include "libc_private.h" @@ -114,7 +116,7 @@ __strerror_rl(int errnum, char *strerrbuf, size_t buflen, locale_t locale) } int -strerror_r(int errnum, char *strerrbuf, size_t buflen) +__ssp_real(strerror_r)(int errnum, char *strerrbuf, size_t buflen) { return (__strerror_rl(errnum, strerrbuf, buflen, __get_locale())); } diff --git a/lib/libc/string/strlcat.c b/lib/libc/string/strlcat.c index bdb302def7b0..fc18fad179db 100644 --- a/lib/libc/string/strlcat.c +++ b/lib/libc/string/strlcat.c @@ -19,6 +19,8 @@ #include #include +#undef strlcat /* FORTIFY_SOURCE */ + /* * Appends src to string dst of size dsize (unlike strncat, dsize is the * full size of dst, not space left). At most dsize-1 characters diff --git a/lib/libc/string/strlcpy.c b/lib/libc/string/strlcpy.c index 58a42e321f6a..79f7ab19cdfd 100644 --- a/lib/libc/string/strlcpy.c +++ b/lib/libc/string/strlcpy.c @@ -19,6 +19,8 @@ #include #include +#undef strlcpy /* FORTIFY_SOURCE */ + /* * Copy string src to buffer dst of size dsize. At most dsize-1 * chars will be copied. Always NUL terminates (unless dsize == 0). diff --git a/lib/libc/string/strncpy.c b/lib/libc/string/strncpy.c index b1df82a2dbf8..67240a855196 100644 --- a/lib/libc/string/strncpy.c +++ b/lib/libc/string/strncpy.c @@ -34,6 +34,8 @@ #include +#undef strncpy /* FORTIFY_SOURCE */ + /* * Copy src to dst, truncating or null-padding to always copy n bytes. * Return dst. diff --git a/lib/libc/tests/secure/fortify_stdio_test.c b/lib/libc/tests/secure/fortify_stdio_test.c index 20ecdab89a8b..fe0f14acd988 100644 --- a/lib/libc/tests/secure/fortify_stdio_test.c +++ b/lib/libc/tests/secure/fortify_stdio_test.c @@ -20,6 +20,23 @@ #include #include +static FILE * __unused +new_fp(size_t __len) +{ + static char fpbuf[LINE_MAX]; + FILE *fp; + + ATF_REQUIRE(__len <= sizeof(fpbuf)); + + memset(fpbuf, 'A', sizeof(fpbuf) - 1); + fpbuf[sizeof(fpbuf) - 1] = '\0'; + + fp = fmemopen(fpbuf, sizeof(fpbuf), "rb"); + ATF_REQUIRE(fp != NULL); + + return (fp); +} + /* * Create a new symlink to use for readlink(2) style tests, we'll just use a * random target name to have something interesting to look at. @@ -55,28 +72,700 @@ new_tmpfile(void) size_t written; int fd; - fd = open("tmpfile", O_RDWR | O_CREAT | O_TRUNC, 0644); - ATF_REQUIRE(fd >= 0); + fd = open("tmpfile", O_RDWR | O_CREAT | O_TRUNC, 0644); + ATF_REQUIRE(fd >= 0); + + written = 0; + while (written < TMPFILE_SIZE) { + rv = write(fd, buf, sizeof(buf)); + ATF_REQUIRE(rv > 0); + + written += rv; + } + + ATF_REQUIRE_EQ(0, lseek(fd, 0, SEEK_SET)); + return (fd); +} + +static void +disable_coredumps(void) +{ + struct rlimit rl = { 0 }; + + if (setrlimit(RLIMIT_CORE, &rl) == -1) + _exit(EX_OSERR); +} + +/* + * Replaces stdin with a file that we can actually read from, for tests where + * we want a FILE * or fd that we can get data from. + */ +static void __unused +replace_stdin(void) +{ + int fd; + + fd = new_tmpfile(); + + (void)dup2(fd, STDIN_FILENO); + if (fd != STDIN_FILENO) + close(fd); +} + +ATF_TC_WITHOUT_HEAD(ctermid_before_end); +ATF_TC_BODY(ctermid_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[L_ctermid + 1]; + uint8_t padding_r; + } __stack; *** 3922 LINES SKIPPED *** From nobody Sat Jul 13 05:23:02 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLcLG3y91z5PvZ8; Sat, 13 Jul 2024 05:23:02 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLcLG1l8Wz4nrN; Sat, 13 Jul 2024 05:23:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848182; 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=+n8Vwc4L71G+OhY3c/kdnlmutHQ8VI3T3AfbKRpPN2w=; b=B9JV6sGNgzdlbb8X2/0AJ8gbIXiXj6Q9fCJ8OOLNwGnR9GDlrC0v+pqIsR2HMWSZ8aloUg dDgCKak4R5UbPb6W+ypK39vX/uAYiBTpRzfD3PO+dDGRfPEX/ua/jye7BkpcqhLJxdBdH1 p+GDfkLL9lP6VZdbiRLFdeC4nwBnBSXQeaFaYDx3NT1p1wcG/9STHW+CR78bjekmM4G4L2 9fCA8ZLsY8KAxf5dE8rSrhNiz62DLlZAVzL7EWJowJ6XTWn7gihBowk/HhLsN+CbUJmdkH Y5W2RBVPOLG4g8+qx8xRl5npOblGoJP93Tm3KV6nN5BfOEZWWT1Jj4KMB4kpmg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720848182; a=rsa-sha256; cv=none; b=GR8SOH9Rli+KDi8PEGb9gpf5ljKOtH1NCE2tIuvOTjXsYNTyX6tmsTUe0sPDQcrqLfDFO7 QRs0oWAshGyh0/Y2LlGUuT9iwGeyOCpQ25hCUuGsYGg4I6IrWbirli9pMBEI2Gz+DAQdEZ yEeNUWWh70ZWXPMul34JtYNNuD7xNu2oTiHBpw2slftklze4fjkDMElK2GASQigpji0IAB FfPq4rFzhYlDuEI3gFKdBgMgR9nlpDHjJlFYfS0APBU58ack+fXoXjMI56hwXbcQjq0mJ0 yaz5jG86dxhmPWMUC/Jma1BZ1HRMGKQOSKGe2sKMUgPauFtkbT+oYe5+rXdOUg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848182; 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=+n8Vwc4L71G+OhY3c/kdnlmutHQ8VI3T3AfbKRpPN2w=; b=PxgynoY/T9CGCwFx87i7sjv5ukBO8sMlbrlivc+w6uHbqdt/B4C+2nK0h2LD2lzRBHMr2/ wLSdBwCo01TvVCv8UM6PdowEmWW+NTZH89ghhcQKj4kbdF5+n+F0dOYGVD6LrrAcS1Tq1T Yc66wBPaotFcvYG5Yg9ErQKyvGQUC4b1SVK1218uTLD6GG74A8+XIiCuhuwmoteM+ihrJS lN6mykCPZqOBU1CBijkUjQyl/iW3aIQSQfo7JcDb1xzGF1qEVpJFY184rt1zXCRYc8h3O2 r39DLqwIK8QJHboIBV2j9auQ3inPXV5U9e/eFyjo1nvCjCSIQUKoTpOIhp3A1A== 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 4WLcLG1Kq8z1Cj7; Sat, 13 Jul 2024 05:23: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 46D5N2dX032583; Sat, 13 Jul 2024 05:23:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46D5N2qn032580; Sat, 13 Jul 2024 05:23:02 GMT (envelope-from git) Date: Sat, 13 Jul 2024 05:23:02 GMT Message-Id: <202407130523.46D5N2qn032580@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 88276dfbf19e - main - include: ssp: fortify poll/ppoll from List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 88276dfbf19e3c0dbd1abee5c2e18c8a4a8c5559 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=88276dfbf19e3c0dbd1abee5c2e18c8a4a8c5559 commit 88276dfbf19e3c0dbd1abee5c2e18c8a4a8c5559 Author: Kyle Evans AuthorDate: 2024-07-13 05:16:11 +0000 Commit: Kyle Evans CommitDate: 2024-07-13 05:16:24 +0000 include: ssp: fortify poll/ppoll from For poll/ppoll we just need to bounds-check the poll array that we're about to write out to. Reviewed by: kib, markj (earlier version) Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45680 --- include/ssp/Makefile | 2 +- include/ssp/poll.h | 60 +++ lib/libc/sys/poll.c | 5 +- lib/libc/sys/ppoll.c | 8 +- lib/libc/tests/secure/Makefile | 1 + lib/libc/tests/secure/fortify_poll_test.c | 531 +++++++++++++++++++++++ lib/libc/tests/secure/fortify_stdio_test.c | 1 + lib/libc/tests/secure/fortify_string_test.c | 1 + lib/libc/tests/secure/fortify_strings_test.c | 1 + lib/libc/tests/secure/fortify_unistd_test.c | 1 + lib/libc/tests/secure/generate-fortify-tests.lua | 34 ++ sys/sys/poll.h | 4 + 12 files changed, 643 insertions(+), 6 deletions(-) diff --git a/include/ssp/Makefile b/include/ssp/Makefile index 69e7df68bb47..a97139e75c7b 100644 --- a/include/ssp/Makefile +++ b/include/ssp/Makefile @@ -1,4 +1,4 @@ -INCS= ssp.h stdio.h string.h strings.h unistd.h +INCS= poll.h ssp.h stdio.h string.h strings.h unistd.h INCSDIR= ${INCLUDEDIR}/ssp .include diff --git a/include/ssp/poll.h b/include/ssp/poll.h new file mode 100644 index 000000000000..66992009e928 --- /dev/null +++ b/include/ssp/poll.h @@ -0,0 +1,60 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024, Klara, Inc. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ +#ifndef _SSP_POLL_H_ +#define _SSP_POLL_H_ + +#include + +#if __SSP_FORTIFY_LEVEL > 0 + +__BEGIN_DECLS + +__ssp_redirect_raw_impl(int, poll, poll, + (struct pollfd fds[], nfds_t nfds, int timeout)) +{ + if (__ssp_bos(fds) / sizeof(fds[0]) < nfds) + __chk_fail(); + + return (__ssp_real(poll)(fds, nfds, timeout)); +} + + +__ssp_redirect_raw_impl(int, ppoll, ppoll, + (struct pollfd fds[], nfds_t nfds, + const struct timespec *__restrict timeout, + const sigset_t *__restrict newsigmask)) +{ + if (__ssp_bos(fds) / sizeof(fds[0]) < nfds) + __chk_fail(); + + return (__ssp_real(ppoll)(fds, nfds, timeout, newsigmask)); +} + +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_POLL_H_ */ diff --git a/lib/libc/sys/poll.c b/lib/libc/sys/poll.c index 6528603e7603..7a418afbbf49 100644 --- a/lib/libc/sys/poll.c +++ b/lib/libc/sys/poll.c @@ -31,13 +31,14 @@ #include #include +#include #include "libc_private.h" __weak_reference(__sys_poll, __poll); -#pragma weak poll +#pragma weak __ssp_real(poll) int -poll(struct pollfd pfd[], nfds_t nfds, int timeout) +__ssp_real(poll)(struct pollfd pfd[], nfds_t nfds, int timeout) { return (INTERPOS_SYS(poll, pfd, nfds, timeout)); } diff --git a/lib/libc/sys/ppoll.c b/lib/libc/sys/ppoll.c index 52c4c177cf0a..ef72a902548b 100644 --- a/lib/libc/sys/ppoll.c +++ b/lib/libc/sys/ppoll.c @@ -31,14 +31,16 @@ #include #include +#include #include "libc_private.h" __weak_reference(__sys_ppoll, __ppoll); -#pragma weak ppoll +#pragma weak __ssp_real(ppoll) int -ppoll(struct pollfd pfd[], nfds_t nfds, const struct timespec *__restrict - timeout, const sigset_t *__restrict newsigmask) +__ssp_real(ppoll)(struct pollfd pfd[], nfds_t nfds, + const struct timespec *__restrict timeout, + const sigset_t *__restrict newsigmask) { return (INTERPOS_SYS(ppoll, pfd, nfds, timeout, newsigmask)); } diff --git a/lib/libc/tests/secure/Makefile b/lib/libc/tests/secure/Makefile index d809f7cadd74..2e98b5f2ed35 100644 --- a/lib/libc/tests/secure/Makefile +++ b/lib/libc/tests/secure/Makefile @@ -2,6 +2,7 @@ TESTSDIR:= ${TESTSBASE}/${RELDIR:C/libc\/tests/libc/} +FORTIFY_TCATS+= poll FORTIFY_TCATS+= stdio FORTIFY_TCATS+= string FORTIFY_TCATS+= strings diff --git a/lib/libc/tests/secure/fortify_poll_test.c b/lib/libc/tests/secure/fortify_poll_test.c new file mode 100644 index 000000000000..9d9cb4ace35a --- /dev/null +++ b/lib/libc/tests/secure/fortify_poll_test.c @@ -0,0 +1,531 @@ +/* @generated by `generate-fortify-tests.lua "poll"` */ + +#define _FORTIFY_SOURCE 2 +#define TMPFILE_SIZE (1024 * 32) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static FILE * __unused +new_fp(size_t __len) +{ + static char fpbuf[LINE_MAX]; + FILE *fp; + + ATF_REQUIRE(__len <= sizeof(fpbuf)); + + memset(fpbuf, 'A', sizeof(fpbuf) - 1); + fpbuf[sizeof(fpbuf) - 1] = '\0'; + + fp = fmemopen(fpbuf, sizeof(fpbuf), "rb"); + ATF_REQUIRE(fp != NULL); + + return (fp); +} + +/* + * Create a new symlink to use for readlink(2) style tests, we'll just use a + * random target name to have something interesting to look at. + */ +static const char * __unused +new_symlink(size_t __len) +{ + static const char linkname[] = "link"; + char target[MAXNAMLEN]; + int error; + + ATF_REQUIRE(__len <= sizeof(target)); + + arc4random_buf(target, sizeof(target)); + + error = unlink(linkname); + ATF_REQUIRE(error == 0 || errno == ENOENT); + + error = symlink(target, linkname); + ATF_REQUIRE(error == 0); + + return (linkname); +} + +/* + * Constructs a tmpfile that we can use for testing read(2) and friends. + */ +static int __unused +new_tmpfile(void) +{ + char buf[1024]; + ssize_t rv; + size_t written; + int fd; + + fd = open("tmpfile", O_RDWR | O_CREAT | O_TRUNC, 0644); + ATF_REQUIRE(fd >= 0); + + written = 0; + while (written < TMPFILE_SIZE) { + rv = write(fd, buf, sizeof(buf)); + ATF_REQUIRE(rv > 0); + + written += rv; + } + + ATF_REQUIRE_EQ(0, lseek(fd, 0, SEEK_SET)); + return (fd); +} + +static void +disable_coredumps(void) +{ + struct rlimit rl = { 0 }; + + if (setrlimit(RLIMIT_CORE, &rl) == -1) + _exit(EX_OSERR); +} + +/* + * Replaces stdin with a file that we can actually read from, for tests where + * we want a FILE * or fd that we can get data from. + */ +static void __unused +replace_stdin(void) +{ + int fd; + + fd = new_tmpfile(); + + (void)dup2(fd, STDIN_FILENO); + if (fd != STDIN_FILENO) + close(fd); +} + +ATF_TC_WITHOUT_HEAD(poll_before_end); +ATF_TC_BODY(poll_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + struct pollfd __buf[4]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 4 - 1; + const size_t __idx __unused = __len - 1; + + for (size_t i = 0; i < howmany(__bufsz, sizeof(struct pollfd)); i++) { + __stack.__buf[i].fd = -1; + } + + poll(__stack.__buf, __len, 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(poll_end); +ATF_TC_BODY(poll_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + struct pollfd __buf[4]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 4; + const size_t __idx __unused = __len - 1; + + for (size_t i = 0; i < howmany(__bufsz, sizeof(struct pollfd)); i++) { + __stack.__buf[i].fd = -1; + } + + poll(__stack.__buf, __len, 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(poll_after_end); +ATF_TC_BODY(poll_after_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + struct pollfd __buf[4]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 4 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + for (size_t i = 0; i < howmany(__bufsz, sizeof(struct pollfd)); i++) { + __stack.__buf[i].fd = -1; + } + + poll(__stack.__buf, __len, 0); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(poll_heap_before_end); +ATF_TC_BODY(poll_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct pollfd * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (4); + const size_t __len = 4 - 1; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + for (size_t i = 0; i < howmany(__bufsz, sizeof(struct pollfd)); i++) { + __stack.__buf[i].fd = -1; + } + + poll(__stack.__buf, __len, 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(poll_heap_end); +ATF_TC_BODY(poll_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct pollfd * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (4); + const size_t __len = 4; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + for (size_t i = 0; i < howmany(__bufsz, sizeof(struct pollfd)); i++) { + __stack.__buf[i].fd = -1; + } + + poll(__stack.__buf, __len, 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(poll_heap_after_end); +ATF_TC_BODY(poll_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct pollfd * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (4); + const size_t __len = 4 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + for (size_t i = 0; i < howmany(__bufsz, sizeof(struct pollfd)); i++) { + __stack.__buf[i].fd = -1; + } + + poll(__stack.__buf, __len, 0); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(ppoll_before_end); +ATF_TC_BODY(ppoll_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + struct pollfd __buf[4]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 4 - 1; + const size_t __idx __unused = __len - 1; + struct timespec tv = { 0 }; + + for (size_t i = 0; i < howmany(__bufsz, sizeof(struct pollfd)); i++) { + __stack.__buf[i].fd = -1; + } + + ppoll(__stack.__buf, __len, &tv, NULL); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(ppoll_end); +ATF_TC_BODY(ppoll_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + struct pollfd __buf[4]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 4; + const size_t __idx __unused = __len - 1; + struct timespec tv = { 0 }; + + for (size_t i = 0; i < howmany(__bufsz, sizeof(struct pollfd)); i++) { + __stack.__buf[i].fd = -1; + } + + ppoll(__stack.__buf, __len, &tv, NULL); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(ppoll_after_end); +ATF_TC_BODY(ppoll_after_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + struct pollfd __buf[4]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 4 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + struct timespec tv = { 0 }; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + for (size_t i = 0; i < howmany(__bufsz, sizeof(struct pollfd)); i++) { + __stack.__buf[i].fd = -1; + } + + ppoll(__stack.__buf, __len, &tv, NULL); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(ppoll_heap_before_end); +ATF_TC_BODY(ppoll_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct pollfd * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (4); + const size_t __len = 4 - 1; + const size_t __idx __unused = __len - 1; + struct timespec tv = { 0 }; + + __stack.__buf = malloc(__bufsz); + for (size_t i = 0; i < howmany(__bufsz, sizeof(struct pollfd)); i++) { + __stack.__buf[i].fd = -1; + } + + ppoll(__stack.__buf, __len, &tv, NULL); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(ppoll_heap_end); +ATF_TC_BODY(ppoll_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct pollfd * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (4); + const size_t __len = 4; + const size_t __idx __unused = __len - 1; + struct timespec tv = { 0 }; + + __stack.__buf = malloc(__bufsz); + for (size_t i = 0; i < howmany(__bufsz, sizeof(struct pollfd)); i++) { + __stack.__buf[i].fd = -1; + } + + ppoll(__stack.__buf, __len, &tv, NULL); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(ppoll_heap_after_end); +ATF_TC_BODY(ppoll_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct pollfd * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (4); + const size_t __len = 4 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + struct timespec tv = { 0 }; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + for (size_t i = 0; i < howmany(__bufsz, sizeof(struct pollfd)); i++) { + __stack.__buf[i].fd = -1; + } + + ppoll(__stack.__buf, __len, &tv, NULL); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, poll_before_end); + ATF_TP_ADD_TC(tp, poll_end); + ATF_TP_ADD_TC(tp, poll_after_end); + ATF_TP_ADD_TC(tp, poll_heap_before_end); + ATF_TP_ADD_TC(tp, poll_heap_end); + ATF_TP_ADD_TC(tp, poll_heap_after_end); + ATF_TP_ADD_TC(tp, ppoll_before_end); + ATF_TP_ADD_TC(tp, ppoll_end); + ATF_TP_ADD_TC(tp, ppoll_after_end); + ATF_TP_ADD_TC(tp, ppoll_heap_before_end); + ATF_TP_ADD_TC(tp, ppoll_heap_end); + ATF_TP_ADD_TC(tp, ppoll_heap_after_end); + return (atf_no_error()); +} diff --git a/lib/libc/tests/secure/fortify_stdio_test.c b/lib/libc/tests/secure/fortify_stdio_test.c index fe0f14acd988..035d84b316e6 100644 --- a/lib/libc/tests/secure/fortify_stdio_test.c +++ b/lib/libc/tests/secure/fortify_stdio_test.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_string_test.c b/lib/libc/tests/secure/fortify_string_test.c index 8306abb5f9e2..5651d3107e91 100644 --- a/lib/libc/tests/secure/fortify_string_test.c +++ b/lib/libc/tests/secure/fortify_string_test.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_strings_test.c b/lib/libc/tests/secure/fortify_strings_test.c index f9cb1e4917f7..28f5e9ec4940 100644 --- a/lib/libc/tests/secure/fortify_strings_test.c +++ b/lib/libc/tests/secure/fortify_strings_test.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_unistd_test.c b/lib/libc/tests/secure/fortify_unistd_test.c index 76702321676a..dddc23596368 100644 --- a/lib/libc/tests/secure/fortify_unistd_test.c +++ b/lib/libc/tests/secure/fortify_unistd_test.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/generate-fortify-tests.lua b/lib/libc/tests/secure/generate-fortify-tests.lua index bff1162c7d83..bb654bbf2f71 100755 --- a/lib/libc/tests/secure/generate-fortify-tests.lua +++ b/lib/libc/tests/secure/generate-fortify-tests.lua @@ -69,6 +69,7 @@ local includes = { "errno.h", "fcntl.h", "limits.h", + "poll.h", "signal.h", "stdio.h", "stdlib.h", @@ -90,6 +91,12 @@ local function excludes_stack_overflow(disposition, is_heap) return (not is_heap) and disposition > 0 end +local poll_init = [[ + for (size_t i = 0; i < howmany(__bufsz, sizeof(struct pollfd)); i++) { + __stack.__buf[i].fd = -1; + } +]] + local printf_stackvars = "\tchar srcvar[__len + 10];\n" local printf_init = [[ memset(srcvar, 'A', sizeof(srcvar) - 1); @@ -132,6 +139,33 @@ local string_init = [[ -- circumstances it's useful to use a different type (e.g., for alignment -- requirements). local all_tests = { + poll = { + -- + { + func = "poll", + bufsize = "4", + buftype = "struct pollfd[]", + arguments = { + "__buf", + "__len", + "0", + }, + init = poll_init, + }, + { + func = "ppoll", + bufsize = "4", + buftype = "struct pollfd[]", + arguments = { + "__buf", + "__len", + "&tv", + "NULL", + }, + stackvars = "\tstruct timespec tv = { 0 };\n", + init = poll_init, + }, + }, stdio = { -- { diff --git a/sys/sys/poll.h b/sys/sys/poll.h index 0ae4e0f4dd15..d5f2c0373942 100644 --- a/sys/sys/poll.h +++ b/sys/sys/poll.h @@ -109,6 +109,10 @@ typedef __sigset_t sigset_t; #endif +#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#include +#endif + __BEGIN_DECLS int poll(struct pollfd _pfd[], nfds_t _nfds, int _timeout); #if __BSD_VISIBLE From nobody Sat Jul 13 05:23:05 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLcLK6KkVz5Pvkr; Sat, 13 Jul 2024 05:23:05 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLcLK3tVrz4nrY; Sat, 13 Jul 2024 05:23:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848185; 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=aaoLMIa/e6LG17L1kPYzq/GLD1/LDn/k8mXz8riMsQI=; b=rCbjzCPLSBpCaTO2zFfru4y6aDQq1W8KQJWfycjvpN/4rR4LFozrEWi7cSOdNRM4sxTXvz 5A0thDCkxRR/3GBwZ+iGn7ysi+6zCD77Hdn94SOI3C1sHdMR+nz+cte2TwcYDk/rtRvlSo 3fFRc5S4CKhSudyTsklW6zuS0pOu8h/Fv5lcWf/pipGzYEK151QaxtprQ/qHZPLRn3ctxF touN/+9imwwj2fxK9viL1q200X0UcSAOnO+/TCDHI4lgqUiqkFvlKVkGzPEV/5AUXyw5k5 PVsgM2qFi8gG04aHTAKPUdpCOXP5lswVzMQOa+sjy6JD91pa/3Dg5otcNyoufw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720848185; a=rsa-sha256; cv=none; b=gWpNjRUnxnXGVjY43wEoGZAvfQzGgPxww368QQCaemWbvQj5DEpMVR2rZTXKlC3YF8UAaW gd7is+kCTxTK6m+1SzYUkXYCZFLd4UTIY8MrDOuYct6Qi4rT8qvoltBLZ2yUxLHC/RRyrD YJCiFUgOMnmYP3uofi3A2pHpmYI8U1uckFIZz3CHRpPonWYcWjG3yp+Zihv0Xzj03dl7rf +T0W9yh9CEvVdlooUAxTA6/byHyAcd7t64QfBHFoOTmK+z+xrvq9Lgucltk5vwda5k1E5j uxBQ7XLFLeSugbzu9cz7W/yqXg1G5ewp93MsnstWTWmmRu9AfRLXbJFCodViRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848185; 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=aaoLMIa/e6LG17L1kPYzq/GLD1/LDn/k8mXz8riMsQI=; b=XVD+Lr9XbWm2mDFH+/pSpCLhO8KvhD5s7GyB1geW9QEKUZStZ+LLKZDrGCWxr+ogKCT8gJ 8MJxknsQq3MqXZZhniKnfkxCHT1G43STX9J96cDknmz6Ne4WYSINYf6UGV1BwSOwqaD7He RRjG3yTLyLbKV2oc6Q2Xs0wO8PTndd8GK08luTtN/MXgaPKz3BPuNVL0czLkcx14bd83Kg BcbmVuTkWe7Dww6Fc1EhjtdWcCDUEXcx0HzicjFry6Afmn0Kkf3PYoboxBrxwjISfbgAOl U02TpznVWS22xuZoe0xFCKErnALhwIoLyW73TweSNqysTfQjSFbV2qTD8rrJfw== 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 4WLcLK3RxLz1Cwk; Sat, 13 Jul 2024 05:23:05 +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 46D5N5Iv032707; Sat, 13 Jul 2024 05:23:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46D5N5pM032704; Sat, 13 Jul 2024 05:23:05 GMT (envelope-from git) Date: Sat, 13 Jul 2024 05:23:05 GMT Message-Id: <202407130523.46D5N5pM032704@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 062d9380b986 - main - include: ssp: fortify List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 062d9380b98663eb2a4a3d7ce9e919e743984060 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=062d9380b98663eb2a4a3d7ce9e919e743984060 commit 062d9380b98663eb2a4a3d7ce9e919e743984060 Author: Kyle Evans AuthorDate: 2024-07-13 05:16:11 +0000 Commit: Kyle Evans CommitDate: 2024-07-13 05:16:25 +0000 include: ssp: fortify That is to say, fortify getrandom(2). Reviewed by: markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45683 --- include/ssp/Makefile | 3 +- include/ssp/random.h | 42 ++++ lib/libc/tests/secure/Makefile | 4 + lib/libc/tests/secure/fortify_poll_test.c | 1 + lib/libc/tests/secure/fortify_random_test.c | 253 +++++++++++++++++++++++ lib/libc/tests/secure/fortify_stdio_test.c | 1 + lib/libc/tests/secure/fortify_stdlib_test.c | 1 + lib/libc/tests/secure/fortify_string_test.c | 1 + lib/libc/tests/secure/fortify_strings_test.c | 1 + lib/libc/tests/secure/fortify_unistd_test.c | 1 + lib/libc/tests/secure/fortify_wchar_test.c | 1 + lib/libc/tests/secure/generate-fortify-tests.lua | 13 ++ sys/sys/random.h | 4 + 13 files changed, 325 insertions(+), 1 deletion(-) diff --git a/include/ssp/Makefile b/include/ssp/Makefile index 725d82ff10e5..d6e0e0698e36 100644 --- a/include/ssp/Makefile +++ b/include/ssp/Makefile @@ -1,4 +1,5 @@ -INCS= poll.h ssp.h stdio.h stdlib.h string.h strings.h unistd.h wchar.h +INCS= poll.h random.h ssp.h stdio.h stdlib.h string.h strings.h unistd.h +INCS+= wchar.h INCSDIR= ${INCLUDEDIR}/ssp .include diff --git a/include/ssp/random.h b/include/ssp/random.h new file mode 100644 index 000000000000..9f98ad2315a1 --- /dev/null +++ b/include/ssp/random.h @@ -0,0 +1,42 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024, Klara, Inc. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ +#ifndef _SSP_RANDOM_H_ +#define _SSP_RANDOM_H_ + +#include + +#if __SSP_FORTIFY_LEVEL > 0 + +__BEGIN_DECLS + +__ssp_redirect(ssize_t, getrandom, (void *__buf, size_t __len, + unsigned int __flags), (__buf, __len, __flags)); + +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_RANDOM_H_ */ diff --git a/lib/libc/tests/secure/Makefile b/lib/libc/tests/secure/Makefile index 27d29eabe689..87c491d9cf2f 100644 --- a/lib/libc/tests/secure/Makefile +++ b/lib/libc/tests/secure/Makefile @@ -2,6 +2,10 @@ TESTSDIR:= ${TESTSBASE}/${RELDIR:C/libc\/tests/libc/} +# sys/ headers +FORTIFY_TCATS+= random + +# non-sys/ headers FORTIFY_TCATS+= poll FORTIFY_TCATS+= stdlib FORTIFY_TCATS+= stdio diff --git a/lib/libc/tests/secure/fortify_poll_test.c b/lib/libc/tests/secure/fortify_poll_test.c index 447ff400dc05..2723052ac501 100644 --- a/lib/libc/tests/secure/fortify_poll_test.c +++ b/lib/libc/tests/secure/fortify_poll_test.c @@ -4,6 +4,7 @@ #define TMPFILE_SIZE (1024 * 32) #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_random_test.c b/lib/libc/tests/secure/fortify_random_test.c new file mode 100644 index 000000000000..b89410a702d0 --- /dev/null +++ b/lib/libc/tests/secure/fortify_random_test.c @@ -0,0 +1,253 @@ +/* @generated by `generate-fortify-tests.lua "random"` */ + +#define _FORTIFY_SOURCE 2 +#define TMPFILE_SIZE (1024 * 32) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static FILE * __unused +new_fp(size_t __len) +{ + static char fpbuf[LINE_MAX]; + FILE *fp; + + ATF_REQUIRE(__len <= sizeof(fpbuf)); + + memset(fpbuf, 'A', sizeof(fpbuf) - 1); + fpbuf[sizeof(fpbuf) - 1] = '\0'; + + fp = fmemopen(fpbuf, sizeof(fpbuf), "rb"); + ATF_REQUIRE(fp != NULL); + + return (fp); +} + +/* + * Create a new symlink to use for readlink(2) style tests, we'll just use a + * random target name to have something interesting to look at. + */ +static const char * __unused +new_symlink(size_t __len) +{ + static const char linkname[] = "link"; + char target[MAXNAMLEN]; + int error; + + ATF_REQUIRE(__len <= sizeof(target)); + + arc4random_buf(target, sizeof(target)); + + error = unlink(linkname); + ATF_REQUIRE(error == 0 || errno == ENOENT); + + error = symlink(target, linkname); + ATF_REQUIRE(error == 0); + + return (linkname); +} + +/* + * Constructs a tmpfile that we can use for testing read(2) and friends. + */ +static int __unused +new_tmpfile(void) +{ + char buf[1024]; + ssize_t rv; + size_t written; + int fd; + + fd = open("tmpfile", O_RDWR | O_CREAT | O_TRUNC, 0644); + ATF_REQUIRE(fd >= 0); + + written = 0; + while (written < TMPFILE_SIZE) { + rv = write(fd, buf, sizeof(buf)); + ATF_REQUIRE(rv > 0); + + written += rv; + } + + ATF_REQUIRE_EQ(0, lseek(fd, 0, SEEK_SET)); + return (fd); +} + +static void +disable_coredumps(void) +{ + struct rlimit rl = { 0 }; + + if (setrlimit(RLIMIT_CORE, &rl) == -1) + _exit(EX_OSERR); +} + +/* + * Replaces stdin with a file that we can actually read from, for tests where + * we want a FILE * or fd that we can get data from. + */ +static void __unused +replace_stdin(void) +{ + int fd; + + fd = new_tmpfile(); + + (void)dup2(fd, STDIN_FILENO); + if (fd != STDIN_FILENO) + close(fd); +} + +ATF_TC_WITHOUT_HEAD(getrandom_before_end); +ATF_TC_BODY(getrandom_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + + getrandom(__stack.__buf, __len, 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(getrandom_end); +ATF_TC_BODY(getrandom_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + + getrandom(__stack.__buf, __len, 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(getrandom_heap_before_end); +ATF_TC_BODY(getrandom_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + getrandom(__stack.__buf, __len, 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(getrandom_heap_end); +ATF_TC_BODY(getrandom_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + getrandom(__stack.__buf, __len, 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(getrandom_heap_after_end); +ATF_TC_BODY(getrandom_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + + getrandom(__stack.__buf, __len, 0); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, getrandom_before_end); + ATF_TP_ADD_TC(tp, getrandom_end); + ATF_TP_ADD_TC(tp, getrandom_heap_before_end); + ATF_TP_ADD_TC(tp, getrandom_heap_end); + ATF_TP_ADD_TC(tp, getrandom_heap_after_end); + return (atf_no_error()); +} diff --git a/lib/libc/tests/secure/fortify_stdio_test.c b/lib/libc/tests/secure/fortify_stdio_test.c index f399a32f3ca2..a19bfebba1bb 100644 --- a/lib/libc/tests/secure/fortify_stdio_test.c +++ b/lib/libc/tests/secure/fortify_stdio_test.c @@ -4,6 +4,7 @@ #define TMPFILE_SIZE (1024 * 32) #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_stdlib_test.c b/lib/libc/tests/secure/fortify_stdlib_test.c index 87e6b4b86302..47f4157b5a01 100644 --- a/lib/libc/tests/secure/fortify_stdlib_test.c +++ b/lib/libc/tests/secure/fortify_stdlib_test.c @@ -4,6 +4,7 @@ #define TMPFILE_SIZE (1024 * 32) #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_string_test.c b/lib/libc/tests/secure/fortify_string_test.c index 0ba1cf0160b4..6a4f08705602 100644 --- a/lib/libc/tests/secure/fortify_string_test.c +++ b/lib/libc/tests/secure/fortify_string_test.c @@ -4,6 +4,7 @@ #define TMPFILE_SIZE (1024 * 32) #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_strings_test.c b/lib/libc/tests/secure/fortify_strings_test.c index a476564f1596..ec6340e77f74 100644 --- a/lib/libc/tests/secure/fortify_strings_test.c +++ b/lib/libc/tests/secure/fortify_strings_test.c @@ -4,6 +4,7 @@ #define TMPFILE_SIZE (1024 * 32) #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_unistd_test.c b/lib/libc/tests/secure/fortify_unistd_test.c index cfd9267d0d79..fa478955283e 100644 --- a/lib/libc/tests/secure/fortify_unistd_test.c +++ b/lib/libc/tests/secure/fortify_unistd_test.c @@ -4,6 +4,7 @@ #define TMPFILE_SIZE (1024 * 32) #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_wchar_test.c b/lib/libc/tests/secure/fortify_wchar_test.c index f02e4045c8f2..cd09e5dac93c 100644 --- a/lib/libc/tests/secure/fortify_wchar_test.c +++ b/lib/libc/tests/secure/fortify_wchar_test.c @@ -4,6 +4,7 @@ #define TMPFILE_SIZE (1024 * 32) #include +#include #include #include #include diff --git a/lib/libc/tests/secure/generate-fortify-tests.lua b/lib/libc/tests/secure/generate-fortify-tests.lua index 1807cbf477e9..259c9a7825d9 100755 --- a/lib/libc/tests/secure/generate-fortify-tests.lua +++ b/lib/libc/tests/secure/generate-fortify-tests.lua @@ -62,6 +62,7 @@ local includes = { "sys/param.h", + "sys/random.h", "sys/resource.h", "sys/time.h", "sys/wait.h", @@ -147,6 +148,18 @@ local wstring_init = [[ -- circumstances it's useful to use a different type (e.g., for alignment -- requirements). local all_tests = { + random = { + -- + { + func = "getrandom", + arguments = { + "__buf", + "__len", + "0", + }, + exclude = excludes_stack_overflow, + }, + }, poll = { -- { diff --git a/sys/sys/random.h b/sys/sys/random.h index aa4457fc8c22..31071d356714 100644 --- a/sys/sys/random.h +++ b/sys/sys/random.h @@ -161,6 +161,10 @@ void random_harvest_deregister_source(enum random_entropy_source); #define GRND_RANDOM 0x2 #define GRND_INSECURE 0x4 +#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#include +#endif + __BEGIN_DECLS ssize_t getrandom(void *buf, size_t buflen, unsigned int flags); __END_DECLS From nobody Sat Jul 13 05:23:04 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLcLJ5gvlz5Pvcp; Sat, 13 Jul 2024 05:23:04 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLcLJ38C4z4nXG; Sat, 13 Jul 2024 05:23:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848184; 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=NK1Qaw9cmEtK13XPftoiTjmwDUGSHjcw3Z5EJULx3AI=; b=V5hgoiaFL6e0GHDz5JDd3eFN8wpF+flIEp8nXE6SxR1tmm6c2NiXkK0w3aez3MCg/Wop3v UC1/B2EnXZ9TGB2j4JnedCbmXcg5hvUOVh2Ld8oydw04SB5tJqgHYAj+RDZBfwS8+3H/mu AS0nV/DAFtWHYgdUwH8ahZR50WzsQT4j4TmZky+nVOMrFbMYIG488Bft+hLUNiE24yElKC 4nyH7VgJbS/7adcxSEdNcqzMAldEPTsOvjsdHw5Tu/EBUHzhFriKnTCuxzXudJzGnztRXT GMtC5ev2QOIcB2Ytd2iOSjIvt0hrJxQjDIsHhab0mN7h075CMuL+JohTzMLHTw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720848184; a=rsa-sha256; cv=none; b=t3oTb6aNnU70I88P1ztigy/pU79zSbQHayC1pD4fls3i5WLZyZGyRDly5vBiktp/hnxE2i FloigifAR6CGXNspualLeV9tvwbt8YWXKink+YnMus4qMSV9r4F4XLqyNhfK2MFQLp3lV5 7Q/m+fvbHryM0dvDM6HEG/IfSMgfZ2x8OdSeZAwlvFaYXZkQ5iV7O0+qY4sBShc0fpF6ZK DUhcmKBtD3izsNm0J5VrvDXvY7997+14zN81HZ7f8A6NrKlWuSVgpO4p1TnylciFjuG8KX C3Vjz8boK5Rzkr5NoVndsYQ00kp+rOnp30AQDWrLJZI55sv9dZla6tTUeMJzkQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848184; 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=NK1Qaw9cmEtK13XPftoiTjmwDUGSHjcw3Z5EJULx3AI=; b=IyWGEjGGJYxIICnBw03J4jBp03716jlCX94Nsht+fDO9rWFZ7C8jQRynSfhrPJSvqAGK78 W5EaBe2I7lJFFWP95akWhJ3ADn5osc1JYDZWSpxCHCengXUHS/MFoooGXJbalTwQWmRwR0 3hlXbU1N2dqmQhG7+cCIK1cJAq8h4VWuXOhlUKfkb8GSM040WP706E33N/R425aM3frsSv baFyjIkLAb5kR6t8D5ED7HFSXBnjaX8YmBTvog26h1sUWowCR7VWiE34SiK9ZWuhZwwJwu M11WxgRNrL9j8aAvC90w6wZ3JdV82Of4zVLH5a8GK/9iNm6Wn/YWA9jfMPI1EQ== 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 4WLcLJ2lvFz1CpX; Sat, 13 Jul 2024 05:23:04 +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 46D5N4G7032662; Sat, 13 Jul 2024 05:23:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46D5N47u032659; Sat, 13 Jul 2024 05:23:04 GMT (envelope-from git) Date: Sat, 13 Jul 2024 05:23:04 GMT Message-Id: <202407130523.46D5N47u032659@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: b53d7aa88fd5 - main - include: ssp: fortify List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: b53d7aa88fd5a5e8a67dd71ea7332fa473595d28 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b53d7aa88fd5a5e8a67dd71ea7332fa473595d28 commit b53d7aa88fd5a5e8a67dd71ea7332fa473595d28 Author: Kyle Evans AuthorDate: 2024-07-13 05:16:11 +0000 Commit: Kyle Evans CommitDate: 2024-07-13 05:16:25 +0000 include: ssp: fortify This includes all of the w*() equivalents to str*()/mem*() implemented in more or less the same way. For these ones, we'll just use header-only implementations from the start to stop further cluttering the libc symbol table. Reviewed by: markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45682 --- include/ssp/Makefile | 2 +- include/ssp/wchar.h | 229 +++ include/wchar.h | 9 +- lib/libc/string/wcpcpy.c | 3 +- lib/libc/string/wcpncpy.c | 4 +- lib/libc/string/wcscat.c | 3 +- lib/libc/string/wcscpy.c | 3 +- lib/libc/string/wcslcat.c | 3 +- lib/libc/string/wcslcpy.c | 3 +- lib/libc/string/wcsncat.c | 4 +- lib/libc/string/wcsncpy.c | 4 +- lib/libc/string/wmemcpy.c | 4 +- lib/libc/string/wmemmove.c | 3 +- lib/libc/string/wmempcpy.c | 4 +- lib/libc/string/wmemset.c | 3 +- lib/libc/tests/secure/Makefile | 1 + lib/libc/tests/secure/fortify_poll_test.c | 1 + lib/libc/tests/secure/fortify_stdio_test.c | 1 + lib/libc/tests/secure/fortify_stdlib_test.c | 1 + lib/libc/tests/secure/fortify_string_test.c | 1 + lib/libc/tests/secure/fortify_strings_test.c | 1 + lib/libc/tests/secure/fortify_unistd_test.c | 1 + lib/libc/tests/secure/fortify_wchar_test.c | 1895 ++++++++++++++++++++++ lib/libc/tests/secure/generate-fortify-tests.lua | 150 ++ 24 files changed, 2319 insertions(+), 14 deletions(-) diff --git a/include/ssp/Makefile b/include/ssp/Makefile index 2bbbc2eab705..725d82ff10e5 100644 --- a/include/ssp/Makefile +++ b/include/ssp/Makefile @@ -1,4 +1,4 @@ -INCS= poll.h ssp.h stdio.h stdlib.h string.h strings.h unistd.h +INCS= poll.h ssp.h stdio.h stdlib.h string.h strings.h unistd.h wchar.h INCSDIR= ${INCLUDEDIR}/ssp .include diff --git a/include/ssp/wchar.h b/include/ssp/wchar.h new file mode 100644 index 000000000000..48fc56f9d243 --- /dev/null +++ b/include/ssp/wchar.h @@ -0,0 +1,229 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024, Klara, Inc. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ +#ifndef _SSP_WCHAR_H_ +#define _SSP_WCHAR_H_ + +#include + +#if __SSP_FORTIFY_LEVEL > 0 + +static inline int +__ssp_wchar_overlap(const void *leftp, const void *rightp, size_t len) +{ + + if (len > SIZE_MAX / sizeof(wchar_t)) + return (1); + return (__ssp_overlap(leftp, rightp, len * sizeof(wchar_t))); +} + +/* + * __ssp_wbos for w*() calls where the size parameters are in sizeof(wchar_t) + * units, so the result needs to be scaled appropriately. + */ +__ssp_inline size_t +__ssp_wbos(void *ptr) +{ + const size_t ptrsize = __ssp_bos(ptr); + + if (ptrsize == (size_t)-1) + return (ptrsize); + + return (ptrsize / sizeof(wchar_t)); +} + +__BEGIN_DECLS +__ssp_redirect_raw_impl(wchar_t *, wmemcpy, wmemcpy, + (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len > slen) + __chk_fail(); + if (__ssp_wchar_overlap(src, buf, len)) + __chk_fail(); + + return (__ssp_real(wmemcpy)(buf, src, len)); +} + +__ssp_redirect_raw_impl(wchar_t *, wmempcpy, wmempcpy, + (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len > slen) + __chk_fail(); + if (__ssp_wchar_overlap(src, buf, len)) + __chk_fail(); + + return (__ssp_real(wmempcpy)(buf, src, len)); +} + +__ssp_redirect_raw_impl(wchar_t *, wmemmove, wmemmove, + (wchar_t *buf, const wchar_t *src, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len > slen) + __chk_fail(); + + return (__ssp_real(wmemmove)(buf, src, len)); +} + +__ssp_redirect_raw_impl(wchar_t *, wmemset, wmemset, + (wchar_t *buf, wchar_t c, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len > slen) + __chk_fail(); + return (__ssp_real(wmemset)(buf, c, len)); +} + +__ssp_redirect_raw_impl(wchar_t *, wcpcpy, wcpcpy, + (wchar_t *__restrict buf, const wchar_t *__restrict src)) +{ + const size_t slen = __ssp_wbos(buf); + const size_t len = wcslen(src); + + if (len >= slen) + __chk_fail(); + if (__ssp_wchar_overlap(buf, src, len)) + __chk_fail(); + + (void)__ssp_real(wmemcpy)(buf, src, len + 1); + return (buf + len); +} + +__ssp_redirect_raw_impl(wchar_t *, wcpncpy, wcpncpy, + (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len > slen) + __chk_fail(); + if (__ssp_wchar_overlap(buf, src, len)) + __chk_fail(); + + return (__ssp_real(wcpncpy)(buf, src, len)); +} + +__ssp_redirect_raw_impl(wchar_t *, wcscat, wcscat, + (wchar_t *__restrict buf, const wchar_t *__restrict src)) +{ + size_t slen = __ssp_wbos(buf); + wchar_t *cp; + + cp = buf; + while (*cp != L'\0') { + cp++; + if (slen-- == 0) + __chk_fail(); + } + + while (*src != L'\0') { + if (slen-- == 0) + __chk_fail(); + *cp++ = *src++; + } + + if (slen-- == 0) + __chk_fail(); + *cp = '\0'; + return (buf); +} + +__ssp_redirect_raw_impl(wchar_t *, wcscpy, wcscpy, + (wchar_t *__restrict buf, const wchar_t *__restrict src)) +{ + const size_t slen = __ssp_wbos(buf); + size_t len = wcslen(src) + 1; + + if (len > slen) + __chk_fail(); + if (__ssp_wchar_overlap(buf, src, len)) + __chk_fail(); + + return (__ssp_real(wmemcpy)(buf, src, len)); +} + +__ssp_redirect_raw_impl(wchar_t *, wcsncat, wcsncat, + (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len == 0) + return (buf); + if (len > slen) + __chk_fail(); + if (__ssp_wchar_overlap(buf, src, len)) + __chk_fail(); + + return (__ssp_real(wcsncat)(buf, src, len)); +} + +__ssp_redirect_raw_impl(size_t, wcslcat, wcslcat, + (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len > slen) + __chk_fail(); + if (__ssp_wchar_overlap(buf, src, len)) + __chk_fail(); + + return (__ssp_real(wcslcat)(buf, src, len)); +} + +__ssp_redirect_raw_impl(wchar_t *, wcsncpy, wcsncpy, + (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len > slen) + __chk_fail(); + if (__ssp_wchar_overlap(buf, src, len)) + __chk_fail(); + + return (__ssp_real(wcsncpy)(buf, src, len)); +} + +__ssp_redirect_raw_impl(size_t, wcslcpy, wcslcpy, + (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len > slen) + __chk_fail(); + if (__ssp_wchar_overlap(buf, src, len)) + __chk_fail(); + + return (__ssp_real(wcslcpy)(buf, src, len)); +} +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_WCHAR_H_ */ diff --git a/include/wchar.h b/include/wchar.h index 2f23feec8792..e4b037c9b16f 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -108,6 +108,14 @@ typedef struct __sFILE FILE; #endif struct tm; +__BEGIN_DECLS +size_t wcslen(const wchar_t *) __pure; +__END_DECLS + +#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#include +#endif + __BEGIN_DECLS wint_t btowc(int); wint_t fgetwc(FILE *); @@ -146,7 +154,6 @@ wchar_t *wcscpy(wchar_t * __restrict, const wchar_t * __restrict); size_t wcscspn(const wchar_t *, const wchar_t *) __pure; size_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict, const struct tm * __restrict); -size_t wcslen(const wchar_t *) __pure; wchar_t *wcsncat(wchar_t * __restrict, const wchar_t * __restrict, size_t); int wcsncmp(const wchar_t *, const wchar_t *, size_t) __pure; diff --git a/lib/libc/string/wcpcpy.c b/lib/libc/string/wcpcpy.c index 2d377dab2777..2ae014b31d29 100644 --- a/lib/libc/string/wcpcpy.c +++ b/lib/libc/string/wcpcpy.c @@ -32,9 +32,10 @@ */ #include +#include wchar_t * -wcpcpy(wchar_t * __restrict to, const wchar_t * __restrict from) +__ssp_real(wcpcpy)(wchar_t * __restrict to, const wchar_t * __restrict from) { for (; (*to = *from); ++from, ++to); diff --git a/lib/libc/string/wcpncpy.c b/lib/libc/string/wcpncpy.c index 72c060842e26..e89facfeb642 100644 --- a/lib/libc/string/wcpncpy.c +++ b/lib/libc/string/wcpncpy.c @@ -27,9 +27,11 @@ */ #include +#include wchar_t * -wcpncpy(wchar_t * __restrict dst, const wchar_t * __restrict src, size_t n) +__ssp_real(wcpncpy)(wchar_t * __restrict dst, const wchar_t * __restrict src, + size_t n) { for (; n--; dst++, src++) { diff --git a/lib/libc/string/wcscat.c b/lib/libc/string/wcscat.c index 3599e562e9b4..98e088100a87 100644 --- a/lib/libc/string/wcscat.c +++ b/lib/libc/string/wcscat.c @@ -35,9 +35,10 @@ __RCSID("$NetBSD: wcscat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $"); #endif /* LIBC_SCCS and not lint */ #endif #include +#include wchar_t * -wcscat(wchar_t * __restrict s1, const wchar_t * __restrict s2) +__ssp_real(wcscat)(wchar_t * __restrict s1, const wchar_t * __restrict s2) { wchar_t *cp; diff --git a/lib/libc/string/wcscpy.c b/lib/libc/string/wcscpy.c index 622e4201f84b..d4aed8721bb8 100644 --- a/lib/libc/string/wcscpy.c +++ b/lib/libc/string/wcscpy.c @@ -35,9 +35,10 @@ __RCSID("$NetBSD: wcscpy.c,v 1.1 2000/12/23 23:14:36 itojun Exp $"); #endif /* LIBC_SCCS and not lint */ #endif #include +#include wchar_t * -wcscpy(wchar_t * __restrict s1, const wchar_t * __restrict s2) +__ssp_real(wcscpy)(wchar_t * __restrict s1, const wchar_t * __restrict s2) { wchar_t *cp; diff --git a/lib/libc/string/wcslcat.c b/lib/libc/string/wcslcat.c index 336947e3cd23..f74ce520b6a7 100644 --- a/lib/libc/string/wcslcat.c +++ b/lib/libc/string/wcslcat.c @@ -37,6 +37,7 @@ __RCSID("$NetBSD: wcslcat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $"); #endif #include #include +#include /* * Appends src to string dst of size siz (unlike wcsncat, siz is the @@ -46,7 +47,7 @@ __RCSID("$NetBSD: wcslcat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $"); * truncation occurred. */ size_t -wcslcat(wchar_t *dst, const wchar_t *src, size_t siz) +__ssp_real(wcslcat)(wchar_t *dst, const wchar_t *src, size_t siz) { wchar_t *d = dst; const wchar_t *s = src; diff --git a/lib/libc/string/wcslcpy.c b/lib/libc/string/wcslcpy.c index 920425bb5efc..82269656b985 100644 --- a/lib/libc/string/wcslcpy.c +++ b/lib/libc/string/wcslcpy.c @@ -37,6 +37,7 @@ __RCSID("$NetBSD: wcslcpy.c,v 1.1 2000/12/23 23:14:36 itojun Exp $"); #endif #include #include +#include /* * Copy src to string dst of size siz. At most siz-1 characters @@ -44,7 +45,7 @@ __RCSID("$NetBSD: wcslcpy.c,v 1.1 2000/12/23 23:14:36 itojun Exp $"); * Returns wcslen(src); if retval >= siz, truncation occurred. */ size_t -wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz) +__ssp_real(wcslcpy)(wchar_t *dst, const wchar_t *src, size_t siz) { wchar_t *d = dst; const wchar_t *s = src; diff --git a/lib/libc/string/wcsncat.c b/lib/libc/string/wcsncat.c index 004391423f53..5b36fd40bb4f 100644 --- a/lib/libc/string/wcsncat.c +++ b/lib/libc/string/wcsncat.c @@ -35,9 +35,11 @@ __RCSID("$NetBSD: wcsncat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $"); #endif /* LIBC_SCCS and not lint */ #endif #include +#include wchar_t * -wcsncat(wchar_t * __restrict s1, const wchar_t * __restrict s2, size_t n) +__ssp_real(wcsncat)(wchar_t * __restrict s1, const wchar_t * __restrict s2, + size_t n) { wchar_t *p; wchar_t *q; diff --git a/lib/libc/string/wcsncpy.c b/lib/libc/string/wcsncpy.c index a02a8292c0d1..2491dadadfa4 100644 --- a/lib/libc/string/wcsncpy.c +++ b/lib/libc/string/wcsncpy.c @@ -33,13 +33,15 @@ */ #include +#include /* * Copy src to dst, truncating or null-padding to always copy n bytes. * Return dst. */ wchar_t * -wcsncpy(wchar_t * __restrict dst, const wchar_t * __restrict src, size_t n) +__ssp_real(wcsncpy)(wchar_t * __restrict dst, const wchar_t * __restrict src, + size_t n) { if (n != 0) { wchar_t *d = dst; diff --git a/lib/libc/string/wmemcpy.c b/lib/libc/string/wmemcpy.c index f692a25fc95b..9db16fe77a69 100644 --- a/lib/libc/string/wmemcpy.c +++ b/lib/libc/string/wmemcpy.c @@ -36,9 +36,11 @@ __RCSID("$NetBSD: wmemcpy.c,v 1.1 2000/12/23 23:14:37 itojun Exp $"); #endif #include #include +#include wchar_t * -wmemcpy(wchar_t * __restrict d, const wchar_t * __restrict s, size_t n) +__ssp_real(wmemcpy)(wchar_t * __restrict d, const wchar_t * __restrict s, + size_t n) { return (wchar_t *)memcpy(d, s, n * sizeof(wchar_t)); } diff --git a/lib/libc/string/wmemmove.c b/lib/libc/string/wmemmove.c index cbbdb4afdd6c..837dbe12dc7a 100644 --- a/lib/libc/string/wmemmove.c +++ b/lib/libc/string/wmemmove.c @@ -36,9 +36,10 @@ __RCSID("$NetBSD: wmemmove.c,v 1.1 2000/12/23 23:14:37 itojun Exp $"); #endif #include #include +#include wchar_t * -wmemmove(wchar_t *d, const wchar_t *s, size_t n) +__ssp_real(wmemmove)(wchar_t *d, const wchar_t *s, size_t n) { return (wchar_t *)memmove(d, s, n * sizeof(wchar_t)); } diff --git a/lib/libc/string/wmempcpy.c b/lib/libc/string/wmempcpy.c index 6551787abf65..152bb76c7e80 100644 --- a/lib/libc/string/wmempcpy.c +++ b/lib/libc/string/wmempcpy.c @@ -30,9 +30,11 @@ #include #include +#include wchar_t * -wmempcpy(wchar_t *__restrict dst, const wchar_t *__restrict src, size_t len) +__ssp_real(wmempcpy)(wchar_t *__restrict dst, const wchar_t *__restrict src, + size_t len) { return (wmemcpy(dst, src, len) + len); } diff --git a/lib/libc/string/wmemset.c b/lib/libc/string/wmemset.c index 4276373399f9..60fb14b6a4af 100644 --- a/lib/libc/string/wmemset.c +++ b/lib/libc/string/wmemset.c @@ -35,9 +35,10 @@ __RCSID("$NetBSD: wmemset.c,v 1.1 2000/12/23 23:14:37 itojun Exp $"); #endif /* LIBC_SCCS and not lint */ #endif #include +#include wchar_t * -wmemset(wchar_t *s, wchar_t c, size_t n) +__ssp_real(wmemset)(wchar_t *s, wchar_t c, size_t n) { size_t i; wchar_t *p; diff --git a/lib/libc/tests/secure/Makefile b/lib/libc/tests/secure/Makefile index 63fe4cb96f02..27d29eabe689 100644 --- a/lib/libc/tests/secure/Makefile +++ b/lib/libc/tests/secure/Makefile @@ -8,6 +8,7 @@ FORTIFY_TCATS+= stdio FORTIFY_TCATS+= string FORTIFY_TCATS+= strings FORTIFY_TCATS+= unistd +FORTIFY_TCATS+= wchar # Manually run after updating the test generator. generate-tests: .PHONY diff --git a/lib/libc/tests/secure/fortify_poll_test.c b/lib/libc/tests/secure/fortify_poll_test.c index 9d9cb4ace35a..447ff400dc05 100644 --- a/lib/libc/tests/secure/fortify_poll_test.c +++ b/lib/libc/tests/secure/fortify_poll_test.c @@ -19,6 +19,7 @@ #include #include #include +#include #include static FILE * __unused diff --git a/lib/libc/tests/secure/fortify_stdio_test.c b/lib/libc/tests/secure/fortify_stdio_test.c index 035d84b316e6..f399a32f3ca2 100644 --- a/lib/libc/tests/secure/fortify_stdio_test.c +++ b/lib/libc/tests/secure/fortify_stdio_test.c @@ -19,6 +19,7 @@ #include #include #include +#include #include static FILE * __unused diff --git a/lib/libc/tests/secure/fortify_stdlib_test.c b/lib/libc/tests/secure/fortify_stdlib_test.c index e00983a58aa4..87e6b4b86302 100644 --- a/lib/libc/tests/secure/fortify_stdlib_test.c +++ b/lib/libc/tests/secure/fortify_stdlib_test.c @@ -19,6 +19,7 @@ #include #include #include +#include #include static FILE * __unused diff --git a/lib/libc/tests/secure/fortify_string_test.c b/lib/libc/tests/secure/fortify_string_test.c index 5651d3107e91..0ba1cf0160b4 100644 --- a/lib/libc/tests/secure/fortify_string_test.c +++ b/lib/libc/tests/secure/fortify_string_test.c @@ -19,6 +19,7 @@ #include #include #include +#include #include static FILE * __unused diff --git a/lib/libc/tests/secure/fortify_strings_test.c b/lib/libc/tests/secure/fortify_strings_test.c index 28f5e9ec4940..a476564f1596 100644 --- a/lib/libc/tests/secure/fortify_strings_test.c +++ b/lib/libc/tests/secure/fortify_strings_test.c @@ -19,6 +19,7 @@ #include #include #include +#include #include static FILE * __unused diff --git a/lib/libc/tests/secure/fortify_unistd_test.c b/lib/libc/tests/secure/fortify_unistd_test.c index dddc23596368..cfd9267d0d79 100644 --- a/lib/libc/tests/secure/fortify_unistd_test.c +++ b/lib/libc/tests/secure/fortify_unistd_test.c @@ -19,6 +19,7 @@ #include #include #include +#include #include static FILE * __unused diff --git a/lib/libc/tests/secure/fortify_wchar_test.c b/lib/libc/tests/secure/fortify_wchar_test.c new file mode 100644 index 000000000000..f02e4045c8f2 --- /dev/null +++ b/lib/libc/tests/secure/fortify_wchar_test.c @@ -0,0 +1,1895 @@ +/* @generated by `generate-fortify-tests.lua "wchar"` */ + +#define _FORTIFY_SOURCE 2 +#define TMPFILE_SIZE (1024 * 32) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static FILE * __unused +new_fp(size_t __len) +{ + static char fpbuf[LINE_MAX]; + FILE *fp; + + ATF_REQUIRE(__len <= sizeof(fpbuf)); + + memset(fpbuf, 'A', sizeof(fpbuf) - 1); + fpbuf[sizeof(fpbuf) - 1] = '\0'; + + fp = fmemopen(fpbuf, sizeof(fpbuf), "rb"); + ATF_REQUIRE(fp != NULL); + + return (fp); +} + +/* + * Create a new symlink to use for readlink(2) style tests, we'll just use a + * random target name to have something interesting to look at. + */ +static const char * __unused +new_symlink(size_t __len) +{ + static const char linkname[] = "link"; + char target[MAXNAMLEN]; + int error; + + ATF_REQUIRE(__len <= sizeof(target)); + + arc4random_buf(target, sizeof(target)); + + error = unlink(linkname); + ATF_REQUIRE(error == 0 || errno == ENOENT); + + error = symlink(target, linkname); + ATF_REQUIRE(error == 0); + + return (linkname); +} + +/* + * Constructs a tmpfile that we can use for testing read(2) and friends. + */ +static int __unused +new_tmpfile(void) +{ + char buf[1024]; + ssize_t rv; + size_t written; + int fd; + + fd = open("tmpfile", O_RDWR | O_CREAT | O_TRUNC, 0644); + ATF_REQUIRE(fd >= 0); + + written = 0; + while (written < TMPFILE_SIZE) { + rv = write(fd, buf, sizeof(buf)); + ATF_REQUIRE(rv > 0); + + written += rv; + } + + ATF_REQUIRE_EQ(0, lseek(fd, 0, SEEK_SET)); + return (fd); +} + +static void +disable_coredumps(void) +{ + struct rlimit rl = { 0 }; + + if (setrlimit(RLIMIT_CORE, &rl) == -1) + _exit(EX_OSERR); +} + +/* + * Replaces stdin with a file that we can actually read from, for tests where + * we want a FILE * or fd that we can get data from. + */ +static void __unused +replace_stdin(void) +{ + int fd; + + fd = new_tmpfile(); + + (void)dup2(fd, STDIN_FILENO); + if (fd != STDIN_FILENO) + close(fd); +} + +ATF_TC_WITHOUT_HEAD(wmemcpy_before_end); +ATF_TC_BODY(wmemcpy_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + wchar_t __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + wchar_t src[__len + 10]; + + wmemcpy(__stack.__buf, src, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(wmemcpy_end); +ATF_TC_BODY(wmemcpy_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + wchar_t __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + wchar_t src[__len + 10]; + + wmemcpy(__stack.__buf, src, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(wmemcpy_heap_before_end); +ATF_TC_BODY(wmemcpy_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + wchar_t * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + wchar_t src[__len + 10]; + + __stack.__buf = malloc(__bufsz); + + wmemcpy(__stack.__buf, src, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(wmemcpy_heap_end); +ATF_TC_BODY(wmemcpy_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + wchar_t * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + wchar_t src[__len + 10]; + + __stack.__buf = malloc(__bufsz); + + wmemcpy(__stack.__buf, src, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(wmemcpy_heap_after_end); +ATF_TC_BODY(wmemcpy_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + wchar_t * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + wchar_t src[__len + 10]; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + + wmemcpy(__stack.__buf, src, __len); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(wmempcpy_before_end); +ATF_TC_BODY(wmempcpy_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + wchar_t __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + wchar_t src[__len + 10]; + + wmempcpy(__stack.__buf, src, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(wmempcpy_end); +ATF_TC_BODY(wmempcpy_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + wchar_t __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + wchar_t src[__len + 10]; + + wmempcpy(__stack.__buf, src, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(wmempcpy_heap_before_end); +ATF_TC_BODY(wmempcpy_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + wchar_t * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + wchar_t src[__len + 10]; + + __stack.__buf = malloc(__bufsz); + + wmempcpy(__stack.__buf, src, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(wmempcpy_heap_end); +ATF_TC_BODY(wmempcpy_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + wchar_t * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + wchar_t src[__len + 10]; + + __stack.__buf = malloc(__bufsz); + + wmempcpy(__stack.__buf, src, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(wmempcpy_heap_after_end); +ATF_TC_BODY(wmempcpy_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + wchar_t * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + wchar_t src[__len + 10]; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + + wmempcpy(__stack.__buf, src, __len); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; *** 1704 LINES SKIPPED *** From nobody Sat Jul 13 05:23:03 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLcLH4640z5PvZ9; Sat, 13 Jul 2024 05:23: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLcLH2h8Yz4nrQ; Sat, 13 Jul 2024 05:23:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848183; 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=f61Z4ZEMLAZd5TC0hKeb1I+iw/bLieLzJkpxj0WReJ0=; b=f59KrzremUjLUC7OVRfk4rF+pXpFZfy+EiGsUnf9uIrSJNEKesNJfB4ztjwix5iHKlnddr OBUn5h8XRgFRFflzJdvsNMlOaxIiHgqH3C6i1uvYNEilcXWDzhF1bkCPjQFUgcRXh2eLpD rdIy3jQeQFVo0JrrhK4uIB0V8+byIaa66A5hKG/fJL/QI/A/QpN268FrEH6ANxwQ16u+QP Ap0LZM0H6+P3WH+rGzPcx147tgHbZGUnNsYv8gHu2VLI0Y+i70bDeEaAxPBGD3vNmhz0Jo zn8OsTRAIdWdU+i+pL4NBEYbxcUQ2100OU7FkynaC+vuoZqCJRhfhM6xO56gvA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720848183; a=rsa-sha256; cv=none; b=dzd+xMzZx2PsY3mspxnF0UQtGX/v/jt/bAO3q0UkHoFMJjHiF4PgTPV+Svnt4G6Sq1+OZm zwd8UvSZc4hlOxEEIa3wz4wpmQoRQx9XQ/SQ3UWZYaIYZAb4eeJWnQLeccZHOgs6hx5dB+ JIPt24j2FejYDNmsTM0ycWKQwwx/fkhHY9r4/ifUOAFmZFCDIW1mkLDltdPgmkKBrp8FJC loyYECqCAMe5Xx7lgifMlT/XxEEkkCllAkdLYsnehIccWCoC7krHYZrMUXdpYA4bjtxl2Z R9Kqldeps504HIE63m4XZtQkju3ROWeWhLSyJPdo2zBwWYDvpoR/NzlE4q6xRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848183; 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=f61Z4ZEMLAZd5TC0hKeb1I+iw/bLieLzJkpxj0WReJ0=; b=Uz3NdKs6K0q6h3etzRIoFSmFKBp5w5yYqQanyAUkt6by5vjuIchO3HKKtyNYdWS6Jx3axV r+XADyiCsNsUoWbCFUFDC05kbiaZghFtFLZCljEABhOeQCOdD8cW1W2TuDBC9cMvJmPiTE bPDE2jFo5sRKBQ1Mmcj1wfHcH7qYvj/6X4dyInzZrRRJRBJa6+dvQBWQ6bUWYUN9pVQKXH WA9ruR+HeRZ2TR5VRKrTXWN4ewY0co8UMGQsDTg/2c6HXrKwYQOFRf5D/5jG6cqnruC47C ru7P0gjGX2Il1noU+Z5Bd3GD1SxmrSiWKIQqjVUp1YktJvQeT1O2EndbqOTNsw== 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 4WLcLH2HRNzDn3; Sat, 13 Jul 2024 05:23:03 +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 46D5N3vN032623; Sat, 13 Jul 2024 05:23:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46D5N3bh032620; Sat, 13 Jul 2024 05:23:03 GMT (envelope-from git) Date: Sat, 13 Jul 2024 05:23:03 GMT Message-Id: <202407130523.46D5N3bh032620@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: d0b7445904f5 - main - include: ssp: fortify List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: d0b7445904f592bf379d64932fb6f1fdc29c4aa7 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d0b7445904f592bf379d64932fb6f1fdc29c4aa7 commit d0b7445904f592bf379d64932fb6f1fdc29c4aa7 Author: Kyle Evans AuthorDate: 2024-07-13 05:16:11 +0000 Commit: Kyle Evans CommitDate: 2024-07-13 05:16:24 +0000 include: ssp: fortify The immediately obvious and attractive targets from are arc4random_buf(3) and realpath(3) -- scraping the header didn't reveal much else of interest. Reviewed by: markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45681 --- include/ssp/Makefile | 2 +- include/ssp/stdlib.h | 53 ++++ include/stdlib.h | 4 + lib/libc/gen/arc4random.c | 3 +- lib/libc/stdlib/realpath.c | 3 +- lib/libc/tests/secure/Makefile | 1 + lib/libc/tests/secure/fortify_stdlib_test.c | 383 +++++++++++++++++++++++ lib/libc/tests/secure/generate-fortify-tests.lua | 20 ++ 8 files changed, 466 insertions(+), 3 deletions(-) diff --git a/include/ssp/Makefile b/include/ssp/Makefile index a97139e75c7b..2bbbc2eab705 100644 --- a/include/ssp/Makefile +++ b/include/ssp/Makefile @@ -1,4 +1,4 @@ -INCS= poll.h ssp.h stdio.h string.h strings.h unistd.h +INCS= poll.h ssp.h stdio.h stdlib.h string.h strings.h unistd.h INCSDIR= ${INCLUDEDIR}/ssp .include diff --git a/include/ssp/stdlib.h b/include/ssp/stdlib.h new file mode 100644 index 000000000000..f595ecbcbc0a --- /dev/null +++ b/include/ssp/stdlib.h @@ -0,0 +1,53 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024, Klara, Inc. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ +#ifndef _SSP_STDLIB_H_ +#define _SSP_STDLIB_H_ + +#include + +#if __SSP_FORTIFY_LEVEL > 0 + +#include + +__BEGIN_DECLS + +__ssp_redirect(void, arc4random_buf, (void *__buf, size_t __len), + (__buf, __len)); + +__ssp_redirect_raw_impl(char *, realpath, realpath, + (const char *__restrict path, char *__restrict buf)) +{ + if (__ssp_bos(buf) < PATH_MAX) + __chk_fail(); + + return (__ssp_real(realpath)(path, buf)); +} + +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_STDLIB_H_ */ diff --git a/include/stdlib.h b/include/stdlib.h index db339688cb78..162031ab393d 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -69,6 +69,10 @@ typedef struct { */ #define RAND_MAX 0x7fffffff +#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#include +#endif + __BEGIN_DECLS #ifdef _XLOCALE_H_ #include diff --git a/lib/libc/gen/arc4random.c b/lib/libc/gen/arc4random.c index fdb1688cfe9c..cc65e0131970 100644 --- a/lib/libc/gen/arc4random.c +++ b/lib/libc/gen/arc4random.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -243,7 +244,7 @@ arc4random(void) } void -arc4random_buf(void *buf, size_t n) +__ssp_real(arc4random_buf)(void *buf, size_t n) { _ARC4_LOCK(); _rs_random_buf(buf, n); diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c index 992d14302fe0..554d70b43a29 100644 --- a/lib/libc/stdlib/realpath.c +++ b/lib/libc/stdlib/realpath.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "un-namespace.h" #include "libc_private.h" @@ -203,7 +204,7 @@ realpath1(const char *path, char *resolved) } char * -realpath(const char * __restrict path, char * __restrict resolved) +__ssp_real(realpath)(const char * __restrict path, char * __restrict resolved) { char *m, *res; diff --git a/lib/libc/tests/secure/Makefile b/lib/libc/tests/secure/Makefile index 2e98b5f2ed35..63fe4cb96f02 100644 --- a/lib/libc/tests/secure/Makefile +++ b/lib/libc/tests/secure/Makefile @@ -3,6 +3,7 @@ TESTSDIR:= ${TESTSBASE}/${RELDIR:C/libc\/tests/libc/} FORTIFY_TCATS+= poll +FORTIFY_TCATS+= stdlib FORTIFY_TCATS+= stdio FORTIFY_TCATS+= string FORTIFY_TCATS+= strings diff --git a/lib/libc/tests/secure/fortify_stdlib_test.c b/lib/libc/tests/secure/fortify_stdlib_test.c new file mode 100644 index 000000000000..e00983a58aa4 --- /dev/null +++ b/lib/libc/tests/secure/fortify_stdlib_test.c @@ -0,0 +1,383 @@ +/* @generated by `generate-fortify-tests.lua "stdlib"` */ + +#define _FORTIFY_SOURCE 2 +#define TMPFILE_SIZE (1024 * 32) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static FILE * __unused +new_fp(size_t __len) +{ + static char fpbuf[LINE_MAX]; + FILE *fp; + + ATF_REQUIRE(__len <= sizeof(fpbuf)); + + memset(fpbuf, 'A', sizeof(fpbuf) - 1); + fpbuf[sizeof(fpbuf) - 1] = '\0'; + + fp = fmemopen(fpbuf, sizeof(fpbuf), "rb"); + ATF_REQUIRE(fp != NULL); + + return (fp); +} + +/* + * Create a new symlink to use for readlink(2) style tests, we'll just use a + * random target name to have something interesting to look at. + */ +static const char * __unused +new_symlink(size_t __len) +{ + static const char linkname[] = "link"; + char target[MAXNAMLEN]; + int error; + + ATF_REQUIRE(__len <= sizeof(target)); + + arc4random_buf(target, sizeof(target)); + + error = unlink(linkname); + ATF_REQUIRE(error == 0 || errno == ENOENT); + + error = symlink(target, linkname); + ATF_REQUIRE(error == 0); + + return (linkname); +} + +/* + * Constructs a tmpfile that we can use for testing read(2) and friends. + */ +static int __unused +new_tmpfile(void) +{ + char buf[1024]; + ssize_t rv; + size_t written; + int fd; + + fd = open("tmpfile", O_RDWR | O_CREAT | O_TRUNC, 0644); + ATF_REQUIRE(fd >= 0); + + written = 0; + while (written < TMPFILE_SIZE) { + rv = write(fd, buf, sizeof(buf)); + ATF_REQUIRE(rv > 0); + + written += rv; + } + + ATF_REQUIRE_EQ(0, lseek(fd, 0, SEEK_SET)); + return (fd); +} + +static void +disable_coredumps(void) +{ + struct rlimit rl = { 0 }; + + if (setrlimit(RLIMIT_CORE, &rl) == -1) + _exit(EX_OSERR); +} + +/* + * Replaces stdin with a file that we can actually read from, for tests where + * we want a FILE * or fd that we can get data from. + */ +static void __unused +replace_stdin(void) +{ + int fd; + + fd = new_tmpfile(); + + (void)dup2(fd, STDIN_FILENO); + if (fd != STDIN_FILENO) + close(fd); +} + +ATF_TC_WITHOUT_HEAD(arc4random_buf_before_end); +ATF_TC_BODY(arc4random_buf_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + + arc4random_buf(__stack.__buf, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(arc4random_buf_end); +ATF_TC_BODY(arc4random_buf_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + + arc4random_buf(__stack.__buf, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(arc4random_buf_heap_before_end); +ATF_TC_BODY(arc4random_buf_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + arc4random_buf(__stack.__buf, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(arc4random_buf_heap_end); +ATF_TC_BODY(arc4random_buf_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + arc4random_buf(__stack.__buf, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(arc4random_buf_heap_after_end); +ATF_TC_BODY(arc4random_buf_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + + arc4random_buf(__stack.__buf, __len); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(realpath_before_end); +ATF_TC_BODY(realpath_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[PATH_MAX + 1]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = PATH_MAX + 1; + const size_t __idx __unused = __len - 1; + + realpath(".", __stack.__buf); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(realpath_end); +ATF_TC_BODY(realpath_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[PATH_MAX]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = PATH_MAX; + const size_t __idx __unused = __len - 1; + + realpath(".", __stack.__buf); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(realpath_heap_before_end); +ATF_TC_BODY(realpath_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (PATH_MAX + 1); + const size_t __len = PATH_MAX + 1; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + realpath(".", __stack.__buf); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(realpath_heap_end); +ATF_TC_BODY(realpath_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (PATH_MAX); + const size_t __len = PATH_MAX; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + realpath(".", __stack.__buf); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(realpath_heap_after_end); +ATF_TC_BODY(realpath_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (PATH_MAX - 1); + const size_t __len = PATH_MAX - 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + + realpath(".", __stack.__buf); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, arc4random_buf_before_end); + ATF_TP_ADD_TC(tp, arc4random_buf_end); + ATF_TP_ADD_TC(tp, arc4random_buf_heap_before_end); + ATF_TP_ADD_TC(tp, arc4random_buf_heap_end); + ATF_TP_ADD_TC(tp, arc4random_buf_heap_after_end); + ATF_TP_ADD_TC(tp, realpath_before_end); + ATF_TP_ADD_TC(tp, realpath_end); + ATF_TP_ADD_TC(tp, realpath_heap_before_end); + ATF_TP_ADD_TC(tp, realpath_heap_end); + ATF_TP_ADD_TC(tp, realpath_heap_after_end); + return (atf_no_error()); +} diff --git a/lib/libc/tests/secure/generate-fortify-tests.lua b/lib/libc/tests/secure/generate-fortify-tests.lua index bb654bbf2f71..b559fbded070 100755 --- a/lib/libc/tests/secure/generate-fortify-tests.lua +++ b/lib/libc/tests/secure/generate-fortify-tests.lua @@ -262,6 +262,26 @@ local all_tests = { ]], }, }, + stdlib = { + -- + { + func = "arc4random_buf", + arguments = { + "__buf", + "__len", + }, + exclude = excludes_stack_overflow, + }, + { + func = "realpath", + bufsize = "PATH_MAX", + arguments = { + "\".\"", + "__buf", + }, + exclude = excludes_stack_overflow, + }, + }, string = { -- { From nobody Sat Jul 13 05:23:08 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLcLP0clLz5Pvd0; Sat, 13 Jul 2024 05:23: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLcLN64lfz4nxq; Sat, 13 Jul 2024 05:23:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848188; 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=kWaiyBKUhcZhd6dfNydtUePc4MhuQXNKjtuzOMzTHn8=; b=OkmNF5Lmae2RIMm0i64NXfXb+IF1q0Df3vA8+prARjqS41Z4Yehz9M2gS4PO6W1gN9+Pak IF3d7u84Kov6qtUj4/nr6+/vtJNO96VYgdQlvVzjOcGBowWFrYu7ZtlB/L+aVa4WIWCRP0 1x+cJOBH3/eiGUgucbAxNk59Xs/JZ/rrEio+8nDHG+WAom5uHXz7Bv6LwTE1yIEnHKwLl8 OXkqATx6HyK55/Y1XfucH76ZNiynS9QKbwb9Hw/MS/4OWXRip0m6Osj4rBXnIZSr0RU59s bu0UoRV43KhZ9claKzYRn5b+YnYp19gfdSHaXVTyuk36fJTsesMZDXayStkFAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720848188; a=rsa-sha256; cv=none; b=JI+DaBM5p0Rs9+g7F2DsnF6PXPC8VTEcAGEK22l4v7hNRREG0jjtzMAHOPRf22QCfZ9run 7yCuh3PsfJOlNiMdVMrsHrt7SruwrnjO0LWxC52j5skddFY5N94rBTj9S8BMg4NNg9AxaY 78/XWwHe11vTeBWZZ7qOFrr2938yF87s5aJUmKTv0Wk5+Uc0pa27MaAyY2MniBZ/EHGwf+ mrfp8lFTnEQ5LFOFOH9/Cxb0FGNRs6WM2pvmAuWHStHpI+OE3Icf33WGZ1qqrY5d3Iw/RM v1YgoTGKKJf0Jhc9eHj6q2ZNyY6POOci+imqN5uAwP3z3PguZLw3IiZjEWQRWw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848188; 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=kWaiyBKUhcZhd6dfNydtUePc4MhuQXNKjtuzOMzTHn8=; b=xMbIDW4PNl8E37SFLxXNdtHkawtjmO+DK1td2/GJ2m5RkgLxEP+slG8WNulq9u55WtekUH V+w0cqY6qLOVpPtil9UpUL4Hd1YWg7/xB+j0XojLzG9ipDIXNVgUJ5J9pDzCk2uZrdOoG8 U/4OP6BWcqDE7wCxWoDfS9bhop90uAB7ALukhUd70b01Bqvju2snIEira5oue1cMnJaqjb 2UpoaLDd9RzYyUO7Ktdi8bZyMUNl5FMwbM9e4AY5S/jCHG1orNiIuRBwlE4jWkqvjVfxoK MqAdN07pHvwu3WhGIz3qyLQfOcwqqu6k/JqET48uUmMTozaY1s2LhTkI/AFv/w== 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 4WLcLN5hVwzDn4; Sat, 13 Jul 2024 05:23: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 46D5N8ms032825; Sat, 13 Jul 2024 05:23:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46D5N8ix032822; Sat, 13 Jul 2024 05:23:08 GMT (envelope-from git) Date: Sat, 13 Jul 2024 05:23:08 GMT Message-Id: <202407130523.46D5N8ix032822@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 1f155d48f878 - main - include: ssp: fortify List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 1f155d48f878495d31592c59cab82f975c210ad8 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=1f155d48f878495d31592c59cab82f975c210ad8 commit 1f155d48f878495d31592c59cab82f975c210ad8 Author: Kyle Evans AuthorDate: 2024-07-13 05:16:12 +0000 Commit: Kyle Evans CommitDate: 2024-07-13 05:16:26 +0000 include: ssp: fortify The entire recv*() implementation set is ripe for opportunities to validate, so do what we can with what we have. Reviewed by: markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45686 --- include/ssp/Makefile | 4 +- include/ssp/socket.h | 119 ++ lib/libc/sys/recv.c | 3 +- lib/libc/sys/recvfrom.c | 3 +- lib/libc/sys/recvmsg.c | 3 +- lib/libc/tests/secure/Makefile | 1 + lib/libc/tests/secure/fortify_poll_test.c | 45 + lib/libc/tests/secure/fortify_random_test.c | 45 + lib/libc/tests/secure/fortify_select_test.c | 45 + lib/libc/tests/secure/fortify_socket_test.c | 1817 ++++++++++++++++++++++ lib/libc/tests/secure/fortify_stdio_test.c | 45 + lib/libc/tests/secure/fortify_stdlib_test.c | 45 + lib/libc/tests/secure/fortify_string_test.c | 45 + lib/libc/tests/secure/fortify_strings_test.c | 45 + lib/libc/tests/secure/fortify_uio_test.c | 45 + lib/libc/tests/secure/fortify_unistd_test.c | 45 + lib/libc/tests/secure/fortify_wchar_test.c | 45 + lib/libc/tests/secure/generate-fortify-tests.lua | 239 +++ lib/libsys/recvmmsg.c | 5 +- sys/sys/socket.h | 4 + 20 files changed, 2641 insertions(+), 7 deletions(-) diff --git a/include/ssp/Makefile b/include/ssp/Makefile index e6c5a1e6c15e..ff622aeecfe9 100644 --- a/include/ssp/Makefile +++ b/include/ssp/Makefile @@ -1,5 +1,5 @@ -INCS= poll.h random.h ssp.h stdio.h stdlib.h string.h strings.h uio.h unistd.h -INCS+= wchar.h +INCS= poll.h random.h socket.h ssp.h stdio.h stdlib.h string.h strings.h +INCS+= uio.h unistd.h wchar.h INCSDIR= ${INCLUDEDIR}/ssp .include diff --git a/include/ssp/socket.h b/include/ssp/socket.h new file mode 100644 index 000000000000..6c0051ad72dc --- /dev/null +++ b/include/ssp/socket.h @@ -0,0 +1,119 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024, Klara, Inc. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ +#ifndef _SSP_SOCKET_H_ +#define _SSP_SOCKET_H_ + +#include + +#if __SSP_FORTIFY_LEVEL > 0 + +#include + +__BEGIN_DECLS + +__ssp_inline void +__ssp_check_msghdr(struct msghdr *hdr) +{ + if (__ssp_bos(hdr->msg_name) < hdr->msg_namelen) + __chk_fail(); + + __ssp_check_iovec(hdr->msg_iov, hdr->msg_iovlen); + + if (__ssp_bos(hdr->msg_control) < hdr->msg_controllen) + __chk_fail(); +} + +__ssp_redirect_raw_impl(int, getpeername, getpeername, + (int fdes, struct sockaddr *__restrict name, socklen_t *__restrict namelen)) +{ + size_t namesz = __ssp_bos(name); + + if (namesz != (size_t)-1 && namesz < *namelen) + __chk_fail(); + + return (__ssp_real(getpeername)(fdes, name, namelen)); +} + +__ssp_redirect_raw_impl(int, getsockname, getsockname, + (int fdes, struct sockaddr *__restrict name, + socklen_t *__restrict namelen)) +{ + size_t namesz = __ssp_bos(name); + + if (namesz != (size_t)-1 && namesz < *namelen) + __chk_fail(); + + return (__ssp_real(getsockname)(fdes, name, namelen)); +} + +__ssp_redirect(ssize_t, recv, (int __sock, void *__buf, size_t __len, + int __flags), (__sock, __buf, __len, __flags)); + +__ssp_redirect_raw_impl(ssize_t, recvfrom, recvfrom, + (int s, void *buf, size_t len, int flags, + struct sockaddr *__restrict from, + socklen_t *__restrict fromlen)) +{ + if (__ssp_bos(buf) < len) + __chk_fail(); + if (from != NULL && __ssp_bos(from) < *fromlen) + __chk_fail(); + + return (__ssp_real(recvfrom)(s, buf, len, flags, from, fromlen)); +} + +__ssp_redirect_raw_impl(ssize_t, recvmsg, recvmsg, + (int s, struct msghdr *hdr, int flags)) +{ + __ssp_check_msghdr(hdr); + return (__ssp_real(recvmsg)(s, hdr, flags)); +} + +#if __BSD_VISIBLE +struct timespec; + +__ssp_redirect_raw_impl(ssize_t, recvmmsg, recvmmsg, + (int s, struct mmsghdr *__restrict hdrvec, size_t vlen, int flags, + const struct timespec *__restrict timeout)) +{ + const size_t vecsz = __ssp_bos(hdrvec); + + if (vecsz != (size_t)-1 && vecsz / sizeof(*hdrvec) < vlen) + __chk_fail(); + + for (size_t i = 0; i < vlen; i++) { + __ssp_check_msghdr(&hdrvec[i].msg_hdr); + } + + return (__ssp_real(recvmmsg)(s, hdrvec, vlen, flags, timeout)); +} +#endif + +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_SOCKET_H_ */ diff --git a/lib/libc/sys/recv.c b/lib/libc/sys/recv.c index 9afb1dee0654..2bccfbee4eed 100644 --- a/lib/libc/sys/recv.c +++ b/lib/libc/sys/recv.c @@ -31,12 +31,13 @@ #include #include +#include #include "libc_private.h" #include ssize_t -recv(int s, void *buf, size_t len, int flags) +__ssp_real(recv)(int s, void *buf, size_t len, int flags) { /* * POSIX says recv() shall be a cancellation point, so call the diff --git a/lib/libc/sys/recvfrom.c b/lib/libc/sys/recvfrom.c index 04738d06a71c..6247b315d078 100644 --- a/lib/libc/sys/recvfrom.c +++ b/lib/libc/sys/recvfrom.c @@ -32,13 +32,14 @@ #include #include #include +#include #include "libc_private.h" __weak_reference(__sys_recvfrom, __recvfrom); #pragma weak recvfrom ssize_t -recvfrom(int s, void *buf, size_t len, int flags, +__ssp_real(recvfrom)(int s, void *buf, size_t len, int flags, struct sockaddr * __restrict from, socklen_t * __restrict fromlen) { return (INTERPOS_SYS(recvfrom, s, buf, len, flags, from, fromlen)); diff --git a/lib/libc/sys/recvmsg.c b/lib/libc/sys/recvmsg.c index c7e34b9beeb4..334049d6cfad 100644 --- a/lib/libc/sys/recvmsg.c +++ b/lib/libc/sys/recvmsg.c @@ -32,13 +32,14 @@ #include #include #include +#include #include "libc_private.h" __weak_reference(__sys_recvmsg, __recvmsg); #pragma weak recvmsg ssize_t -recvmsg(int s, struct msghdr *msg, int flags) +__ssp_real(recvmsg)(int s, struct msghdr *msg, int flags) { return (INTERPOS_SYS(recvmsg, s, msg, flags)); } diff --git a/lib/libc/tests/secure/Makefile b/lib/libc/tests/secure/Makefile index 996536beac91..ccf89afb1ad5 100644 --- a/lib/libc/tests/secure/Makefile +++ b/lib/libc/tests/secure/Makefile @@ -5,6 +5,7 @@ TESTSDIR:= ${TESTSBASE}/${RELDIR:C/libc\/tests/libc/} # sys/ headers FORTIFY_TCATS+= random FORTIFY_TCATS+= select +FORTIFY_TCATS+= socket FORTIFY_TCATS+= uio # non-sys/ headers diff --git a/lib/libc/tests/secure/fortify_poll_test.c b/lib/libc/tests/secure/fortify_poll_test.c index 47648fe54b47..dce0b0bb65ea 100644 --- a/lib/libc/tests/secure/fortify_poll_test.c +++ b/lib/libc/tests/secure/fortify_poll_test.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -66,6 +67,50 @@ new_symlink(size_t __len) return (linkname); } +/* + * For our purposes, first descriptor will be the reader; we'll send both + * raw data and a control message over it so that the result can be used for + * any of our recv*() tests. + */ +static void __unused +new_socket(int sock[2]) +{ + unsigned char ctrl[CMSG_SPACE(sizeof(int))] = { 0 }; + static char sockbuf[256]; + ssize_t rv; + size_t total = 0; + struct msghdr hdr = { 0 }; + struct cmsghdr *cmsg; + int error, fd; + + error = socketpair(AF_UNIX, SOCK_STREAM, 0, sock); + ATF_REQUIRE(error == 0); + + while (total != sizeof(sockbuf)) { + rv = send(sock[1], &sockbuf[total], sizeof(sockbuf) - total, 0); + + ATF_REQUIRE_MSG(rv > 0, + "expected bytes sent, got %zd with %zu left (size %zu, total %zu)", + rv, sizeof(sockbuf) - total, sizeof(sockbuf), total); + ATF_REQUIRE_MSG(total + (size_t)rv <= sizeof(sockbuf), + "%zd exceeds total %zu", rv, sizeof(sockbuf)); + total += rv; + } + + hdr.msg_control = ctrl; + hdr.msg_controllen = sizeof(ctrl); + + cmsg = CMSG_FIRSTHDR(&hdr); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(fd)); + fd = STDIN_FILENO; + memcpy(CMSG_DATA(cmsg), &fd, sizeof(fd)); + + error = sendmsg(sock[1], &hdr, 0); + ATF_REQUIRE(error != -1); +} + /* * Constructs a tmpfile that we can use for testing read(2) and friends. */ diff --git a/lib/libc/tests/secure/fortify_random_test.c b/lib/libc/tests/secure/fortify_random_test.c index 64c32c6c6a8f..7763607dd2ed 100644 --- a/lib/libc/tests/secure/fortify_random_test.c +++ b/lib/libc/tests/secure/fortify_random_test.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -66,6 +67,50 @@ new_symlink(size_t __len) return (linkname); } +/* + * For our purposes, first descriptor will be the reader; we'll send both + * raw data and a control message over it so that the result can be used for + * any of our recv*() tests. + */ +static void __unused +new_socket(int sock[2]) +{ + unsigned char ctrl[CMSG_SPACE(sizeof(int))] = { 0 }; + static char sockbuf[256]; + ssize_t rv; + size_t total = 0; + struct msghdr hdr = { 0 }; + struct cmsghdr *cmsg; + int error, fd; + + error = socketpair(AF_UNIX, SOCK_STREAM, 0, sock); + ATF_REQUIRE(error == 0); + + while (total != sizeof(sockbuf)) { + rv = send(sock[1], &sockbuf[total], sizeof(sockbuf) - total, 0); + + ATF_REQUIRE_MSG(rv > 0, + "expected bytes sent, got %zd with %zu left (size %zu, total %zu)", + rv, sizeof(sockbuf) - total, sizeof(sockbuf), total); + ATF_REQUIRE_MSG(total + (size_t)rv <= sizeof(sockbuf), + "%zd exceeds total %zu", rv, sizeof(sockbuf)); + total += rv; + } + + hdr.msg_control = ctrl; + hdr.msg_controllen = sizeof(ctrl); + + cmsg = CMSG_FIRSTHDR(&hdr); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(fd)); + fd = STDIN_FILENO; + memcpy(CMSG_DATA(cmsg), &fd, sizeof(fd)); + + error = sendmsg(sock[1], &hdr, 0); + ATF_REQUIRE(error != -1); +} + /* * Constructs a tmpfile that we can use for testing read(2) and friends. */ diff --git a/lib/libc/tests/secure/fortify_select_test.c b/lib/libc/tests/secure/fortify_select_test.c index ccd3f97004fc..dfafac7e4d6d 100644 --- a/lib/libc/tests/secure/fortify_select_test.c +++ b/lib/libc/tests/secure/fortify_select_test.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -66,6 +67,50 @@ new_symlink(size_t __len) return (linkname); } +/* + * For our purposes, first descriptor will be the reader; we'll send both + * raw data and a control message over it so that the result can be used for + * any of our recv*() tests. + */ +static void __unused +new_socket(int sock[2]) +{ + unsigned char ctrl[CMSG_SPACE(sizeof(int))] = { 0 }; + static char sockbuf[256]; + ssize_t rv; + size_t total = 0; + struct msghdr hdr = { 0 }; + struct cmsghdr *cmsg; + int error, fd; + + error = socketpair(AF_UNIX, SOCK_STREAM, 0, sock); + ATF_REQUIRE(error == 0); + + while (total != sizeof(sockbuf)) { + rv = send(sock[1], &sockbuf[total], sizeof(sockbuf) - total, 0); + + ATF_REQUIRE_MSG(rv > 0, + "expected bytes sent, got %zd with %zu left (size %zu, total %zu)", + rv, sizeof(sockbuf) - total, sizeof(sockbuf), total); + ATF_REQUIRE_MSG(total + (size_t)rv <= sizeof(sockbuf), + "%zd exceeds total %zu", rv, sizeof(sockbuf)); + total += rv; + } + + hdr.msg_control = ctrl; + hdr.msg_controllen = sizeof(ctrl); + + cmsg = CMSG_FIRSTHDR(&hdr); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(fd)); + fd = STDIN_FILENO; + memcpy(CMSG_DATA(cmsg), &fd, sizeof(fd)); + + error = sendmsg(sock[1], &hdr, 0); + ATF_REQUIRE(error != -1); +} + /* * Constructs a tmpfile that we can use for testing read(2) and friends. */ diff --git a/lib/libc/tests/secure/fortify_socket_test.c b/lib/libc/tests/secure/fortify_socket_test.c new file mode 100644 index 000000000000..a2125d60fc2d --- /dev/null +++ b/lib/libc/tests/secure/fortify_socket_test.c @@ -0,0 +1,1817 @@ +/* @generated by `generate-fortify-tests.lua "socket"` */ + +#define _FORTIFY_SOURCE 2 +#define TMPFILE_SIZE (1024 * 32) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static FILE * __unused +new_fp(size_t __len) +{ + static char fpbuf[LINE_MAX]; + FILE *fp; + + ATF_REQUIRE(__len <= sizeof(fpbuf)); + + memset(fpbuf, 'A', sizeof(fpbuf) - 1); + fpbuf[sizeof(fpbuf) - 1] = '\0'; + + fp = fmemopen(fpbuf, sizeof(fpbuf), "rb"); + ATF_REQUIRE(fp != NULL); + + return (fp); +} + +/* + * Create a new symlink to use for readlink(2) style tests, we'll just use a + * random target name to have something interesting to look at. + */ +static const char * __unused +new_symlink(size_t __len) +{ + static const char linkname[] = "link"; + char target[MAXNAMLEN]; + int error; + + ATF_REQUIRE(__len <= sizeof(target)); + + arc4random_buf(target, sizeof(target)); + + error = unlink(linkname); + ATF_REQUIRE(error == 0 || errno == ENOENT); + + error = symlink(target, linkname); + ATF_REQUIRE(error == 0); + + return (linkname); +} + +/* + * For our purposes, first descriptor will be the reader; we'll send both + * raw data and a control message over it so that the result can be used for + * any of our recv*() tests. + */ +static void __unused +new_socket(int sock[2]) +{ + unsigned char ctrl[CMSG_SPACE(sizeof(int))] = { 0 }; + static char sockbuf[256]; + ssize_t rv; + size_t total = 0; + struct msghdr hdr = { 0 }; + struct cmsghdr *cmsg; + int error, fd; + + error = socketpair(AF_UNIX, SOCK_STREAM, 0, sock); + ATF_REQUIRE(error == 0); + + while (total != sizeof(sockbuf)) { + rv = send(sock[1], &sockbuf[total], sizeof(sockbuf) - total, 0); + + ATF_REQUIRE_MSG(rv > 0, + "expected bytes sent, got %zd with %zu left (size %zu, total %zu)", + rv, sizeof(sockbuf) - total, sizeof(sockbuf), total); + ATF_REQUIRE_MSG(total + (size_t)rv <= sizeof(sockbuf), + "%zd exceeds total %zu", rv, sizeof(sockbuf)); + total += rv; + } + + hdr.msg_control = ctrl; + hdr.msg_controllen = sizeof(ctrl); + + cmsg = CMSG_FIRSTHDR(&hdr); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(fd)); + fd = STDIN_FILENO; + memcpy(CMSG_DATA(cmsg), &fd, sizeof(fd)); + + error = sendmsg(sock[1], &hdr, 0); + ATF_REQUIRE(error != -1); +} + +/* + * Constructs a tmpfile that we can use for testing read(2) and friends. + */ +static int __unused +new_tmpfile(void) +{ + char buf[1024]; + ssize_t rv; + size_t written; + int fd; + + fd = open("tmpfile", O_RDWR | O_CREAT | O_TRUNC, 0644); + ATF_REQUIRE(fd >= 0); + + written = 0; + while (written < TMPFILE_SIZE) { + rv = write(fd, buf, sizeof(buf)); + ATF_REQUIRE(rv > 0); + + written += rv; + } + + ATF_REQUIRE_EQ(0, lseek(fd, 0, SEEK_SET)); + return (fd); +} + +static void +disable_coredumps(void) +{ + struct rlimit rl = { 0 }; + + if (setrlimit(RLIMIT_CORE, &rl) == -1) + _exit(EX_OSERR); +} + +/* + * Replaces stdin with a file that we can actually read from, for tests where + * we want a FILE * or fd that we can get data from. + */ +static void __unused +replace_stdin(void) +{ + int fd; + + fd = new_tmpfile(); + + (void)dup2(fd, STDIN_FILENO); + if (fd != STDIN_FILENO) + close(fd); +} + +ATF_TC_WITHOUT_HEAD(getpeername_before_end); +ATF_TC_BODY(getpeername_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + struct sockaddr __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = sizeof(struct sockaddr) - 1; + const size_t __idx __unused = __len - 1; + int sock[2] = { -1, -1 }; + socklen_t socklen; + new_socket(sock); + socklen = __len; + + getpeername(sock[0], &__stack.__buf, &socklen); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(getpeername_end); +ATF_TC_BODY(getpeername_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + struct sockaddr __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = sizeof(struct sockaddr); + const size_t __idx __unused = __len - 1; + int sock[2] = { -1, -1 }; + socklen_t socklen; + new_socket(sock); + socklen = __len; + + getpeername(sock[0], &__stack.__buf, &socklen); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(getpeername_heap_before_end); +ATF_TC_BODY(getpeername_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct sockaddr * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (1); + const size_t __len = sizeof(struct sockaddr) - 1; + const size_t __idx __unused = __len - 1; + int sock[2] = { -1, -1 }; + socklen_t socklen; + __stack.__buf = malloc(__bufsz); + new_socket(sock); + socklen = __len; + + getpeername(sock[0], __stack.__buf, &socklen); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(getpeername_heap_end); +ATF_TC_BODY(getpeername_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct sockaddr * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (1); + const size_t __len = sizeof(struct sockaddr); + const size_t __idx __unused = __len - 1; + int sock[2] = { -1, -1 }; + socklen_t socklen; + __stack.__buf = malloc(__bufsz); + new_socket(sock); + socklen = __len; + + getpeername(sock[0], __stack.__buf, &socklen); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(getpeername_heap_after_end); +ATF_TC_BODY(getpeername_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct sockaddr * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (1); + const size_t __len = sizeof(struct sockaddr) + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + int sock[2] = { -1, -1 }; + socklen_t socklen; + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + new_socket(sock); + socklen = __len; + + getpeername(sock[0], __stack.__buf, &socklen); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(getsockname_before_end); +ATF_TC_BODY(getsockname_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + struct sockaddr __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = sizeof(struct sockaddr) - 1; + const size_t __idx __unused = __len - 1; + int sock[2] = { -1, -1 }; + socklen_t socklen; + new_socket(sock); + socklen = __len; + + getsockname(sock[0], &__stack.__buf, &socklen); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(getsockname_end); +ATF_TC_BODY(getsockname_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + struct sockaddr __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = sizeof(struct sockaddr); + const size_t __idx __unused = __len - 1; + int sock[2] = { -1, -1 }; + socklen_t socklen; + new_socket(sock); + socklen = __len; + + getsockname(sock[0], &__stack.__buf, &socklen); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(getsockname_heap_before_end); +ATF_TC_BODY(getsockname_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct sockaddr * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (1); + const size_t __len = sizeof(struct sockaddr) - 1; + const size_t __idx __unused = __len - 1; + int sock[2] = { -1, -1 }; + socklen_t socklen; + __stack.__buf = malloc(__bufsz); + new_socket(sock); + socklen = __len; + + getsockname(sock[0], __stack.__buf, &socklen); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(getsockname_heap_end); +ATF_TC_BODY(getsockname_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct sockaddr * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (1); + const size_t __len = sizeof(struct sockaddr); + const size_t __idx __unused = __len - 1; + int sock[2] = { -1, -1 }; + socklen_t socklen; + __stack.__buf = malloc(__bufsz); + new_socket(sock); + socklen = __len; + + getsockname(sock[0], __stack.__buf, &socklen); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(getsockname_heap_after_end); +ATF_TC_BODY(getsockname_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct sockaddr * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (1); + const size_t __len = sizeof(struct sockaddr) + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + int sock[2] = { -1, -1 }; + socklen_t socklen; + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + new_socket(sock); + socklen = __len; + + getsockname(sock[0], __stack.__buf, &socklen); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(recv_before_end); +ATF_TC_BODY(recv_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + int sock[2] = { -1, -1 }; + + new_socket(sock); + + recv(sock[0], __stack.__buf, __len, 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(recv_end); +ATF_TC_BODY(recv_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + int sock[2] = { -1, -1 }; + + new_socket(sock); + + recv(sock[0], __stack.__buf, __len, 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(recv_heap_before_end); +ATF_TC_BODY(recv_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + int sock[2] = { -1, -1 }; + + __stack.__buf = malloc(__bufsz); + new_socket(sock); + + recv(sock[0], __stack.__buf, __len, 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(recv_heap_end); +ATF_TC_BODY(recv_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + int sock[2] = { -1, -1 }; + + __stack.__buf = malloc(__bufsz); + new_socket(sock); + + recv(sock[0], __stack.__buf, __len, 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(recv_heap_after_end); +ATF_TC_BODY(recv_heap_after_end, tc) +{ +#define BUF __stack.__buf *** 2021 LINES SKIPPED *** From nobody Sat Jul 13 05:23:06 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLcLM0RpSz5Pvfn; Sat, 13 Jul 2024 05:23:07 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLcLL4Rytz4nXh; Sat, 13 Jul 2024 05:23:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848186; 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=tjT60eHs/D8o9GmQURCx1/D0sbCb560LOpH68/a+lls=; b=CMI+gGut0PQ9aGxY7kfbcsCD1OfGBWtEvL62LAdgEJgXuxdHndXL+YWlObeM4/nzBQikwZ rF1RIVNxf3DEAn0djkVD1JH3L4B4e25/xa+OCD7uDNvxldjizz1VQMbTuEuadXr6SUps9T JuwkZuAy4IB27Kwm1o8qBYQAA8KDEVgb+5EOPlYud5vHL2MQLZo4nm3xqybJrasGJgwSr0 3KmmUzwWTAgS2icGMFSgvbUM4vzkxYSnRZmd2rKfhf0JruVihT/0Y86++1UkPnXUPI5559 VWvHL33KFLpOHctvPEQs2OJVdhfIADQLrV9cDiKxnaR816tlAl3qXwosgoFI8Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720848186; a=rsa-sha256; cv=none; b=DtHh0IZJSSATH/uJrKSch5IzMSRx5csA5Kmip4qQDjKAhnlJcve3OY9yum2ufp1mRXdXes SYp+KDX/k0JLFTQ1seV5IwUBjMZiV0N7DcXTLJqRPypTX0s6mL9/idj7SIWZFCiFogMQ/i 1nI47rWjI/l2YNIi8XmwnVBeCYy9em5m6IeKUkUxOcbY9lIn0nJTEZ/IMgXoR6MoaAYnQP R2sjpOBg/nuVJe2o8uttRvkZ4WCEbRJ8iXO/hEnpD5iQQfhbPt5GUXopBisRmkCPgRJ/lZ lIl450cjGdwceRkasmn5AmFUfZjbxb6x+rmjInp56mEmR+w/Y+WtA8CVGt8z3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848186; 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=tjT60eHs/D8o9GmQURCx1/D0sbCb560LOpH68/a+lls=; b=OJyH4QyrSKpmH220C6yPuOWzaD90iNCrgtDoKhIUzd80hv+69UGHHw/ztO5Mnu0GugzSG3 XcTcJ/qRAMH5wrO6UHhtJAAOwHeihNxh4wAI8hR+mfKt1GtQEBRvccbrMm+iNYyJyaRrT/ oC/e6Tpcbe401D3Xm398YLBMLoraihkKlmDKq5fFy5RO/krhciN08+cTG6oEXoae3/mOAM dIkUAlaaMohA3lHOFFREhZLKYJzqjOnV6WTEL8ENM03LocedFj7Ai6OsA/M8e+Pbfslo3w IXaDjLJJAhcWCYLQHDy6I0TVfMNZwgOLf9BEpOrfysuMB8WFlPcDUEMcu5an6g== 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 4WLcLL3qHJz1Cj8; Sat, 13 Jul 2024 05:23:06 +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 46D5N6Ie032746; Sat, 13 Jul 2024 05:23:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46D5N6me032743; Sat, 13 Jul 2024 05:23:06 GMT (envelope-from git) Date: Sat, 13 Jul 2024 05:23:06 GMT Message-Id: <202407130523.46D5N6me032743@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 1ace24b30cad - main - include: ssp: fortify List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 1ace24b30cad59c8ae509d0c690aa55b8df73136 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=1ace24b30cad59c8ae509d0c690aa55b8df73136 commit 1ace24b30cad59c8ae509d0c690aa55b8df73136 Author: Kyle Evans AuthorDate: 2024-07-13 05:16:12 +0000 Commit: Kyle Evans CommitDate: 2024-07-13 05:16:25 +0000 include: ssp: fortify Check both the buffer size of the iov object itself, as well as that of each indidvidually io base. Reviewed by: markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45684 --- include/ssp/Makefile | 2 +- include/ssp/ssp.h | 16 + include/ssp/uio.h | 53 ++ lib/libc/sys/readv.c | 3 +- lib/libc/tests/secure/Makefile | 1 + lib/libc/tests/secure/fortify_poll_test.c | 1 + lib/libc/tests/secure/fortify_random_test.c | 1 + lib/libc/tests/secure/fortify_stdio_test.c | 1 + lib/libc/tests/secure/fortify_stdlib_test.c | 1 + lib/libc/tests/secure/fortify_string_test.c | 1 + lib/libc/tests/secure/fortify_strings_test.c | 1 + lib/libc/tests/secure/fortify_uio_test.c | 804 +++++++++++++++++++++++ lib/libc/tests/secure/fortify_unistd_test.c | 1 + lib/libc/tests/secure/fortify_wchar_test.c | 1 + lib/libc/tests/secure/generate-fortify-tests.lua | 60 ++ sys/sys/uio.h | 4 + 16 files changed, 949 insertions(+), 2 deletions(-) diff --git a/include/ssp/Makefile b/include/ssp/Makefile index d6e0e0698e36..e6c5a1e6c15e 100644 --- a/include/ssp/Makefile +++ b/include/ssp/Makefile @@ -1,4 +1,4 @@ -INCS= poll.h random.h ssp.h stdio.h stdlib.h string.h strings.h unistd.h +INCS= poll.h random.h ssp.h stdio.h stdlib.h string.h strings.h uio.h unistd.h INCS+= wchar.h INCSDIR= ${INCLUDEDIR}/ssp diff --git a/include/ssp/ssp.h b/include/ssp/ssp.h index 6ebc23288391..bdc14137d45b 100644 --- a/include/ssp/ssp.h +++ b/include/ssp/ssp.h @@ -101,9 +101,25 @@ __ssp_overlap(const void *leftp, const void *rightp, __size_t sz) return (SIZE_MAX - sz < right || left < right + sz); } +#include + __BEGIN_DECLS void __stack_chk_fail(void) __dead2; void __chk_fail(void) __dead2; __END_DECLS +__ssp_inline void +__ssp_check_iovec(const struct iovec *iov, int iovcnt) +{ + const size_t iovsz = __ssp_bos(iov); + + if (iovsz != (size_t)-1 && iovsz / sizeof(*iov) < (size_t)iovcnt) + __chk_fail(); + + for (int i = 0; i < iovcnt; i++) { + if (__ssp_bos(iov[i].iov_base) < iov[i].iov_len) + __chk_fail(); + } +} + #endif /* _SSP_SSP_H_ */ diff --git a/include/ssp/uio.h b/include/ssp/uio.h new file mode 100644 index 000000000000..adf1dcbb3d67 --- /dev/null +++ b/include/ssp/uio.h @@ -0,0 +1,53 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024, Klara, Inc. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ +#ifndef _SSP_UIO_H_ +#define _SSP_UIO_H_ + +#include + +#if __SSP_FORTIFY_LEVEL > 0 + +__BEGIN_DECLS + +__ssp_redirect_raw_impl(ssize_t, readv, readv, + (int fd, const struct iovec *iov, int iovcnt)) +{ + __ssp_check_iovec(iov, iovcnt); + return (__ssp_real(readv)(fd, iov, iovcnt)); +} + +__ssp_redirect_raw_impl(ssize_t, preadv, preadv, + (int fd, const struct iovec *iov, int iovcnt, off_t offset)) +{ + __ssp_check_iovec(iov, iovcnt); + return (__ssp_real(preadv)(fd, iov, iovcnt, offset)); +} + +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_UIO_H_ */ diff --git a/lib/libc/sys/readv.c b/lib/libc/sys/readv.c index 78a529254fa0..d58dba1fc47e 100644 --- a/lib/libc/sys/readv.c +++ b/lib/libc/sys/readv.c @@ -33,13 +33,14 @@ #include #include #include +#include #include "libc_private.h" __weak_reference(__sys_readv, __readv); #pragma weak readv ssize_t -readv(int fd, const struct iovec *iov, int iovcnt) +__ssp_real(readv)(int fd, const struct iovec *iov, int iovcnt) { return (INTERPOS_SYS(readv, fd, iov, iovcnt)); } diff --git a/lib/libc/tests/secure/Makefile b/lib/libc/tests/secure/Makefile index 87c491d9cf2f..7aa9212b97a8 100644 --- a/lib/libc/tests/secure/Makefile +++ b/lib/libc/tests/secure/Makefile @@ -4,6 +4,7 @@ TESTSDIR:= ${TESTSBASE}/${RELDIR:C/libc\/tests/libc/} # sys/ headers FORTIFY_TCATS+= random +FORTIFY_TCATS+= uio # non-sys/ headers FORTIFY_TCATS+= poll diff --git a/lib/libc/tests/secure/fortify_poll_test.c b/lib/libc/tests/secure/fortify_poll_test.c index 2723052ac501..83c0f68b0daa 100644 --- a/lib/libc/tests/secure/fortify_poll_test.c +++ b/lib/libc/tests/secure/fortify_poll_test.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_random_test.c b/lib/libc/tests/secure/fortify_random_test.c index b89410a702d0..1eb18cfcaaf4 100644 --- a/lib/libc/tests/secure/fortify_random_test.c +++ b/lib/libc/tests/secure/fortify_random_test.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_stdio_test.c b/lib/libc/tests/secure/fortify_stdio_test.c index a19bfebba1bb..75f81c0a0750 100644 --- a/lib/libc/tests/secure/fortify_stdio_test.c +++ b/lib/libc/tests/secure/fortify_stdio_test.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_stdlib_test.c b/lib/libc/tests/secure/fortify_stdlib_test.c index 47f4157b5a01..8556e1110156 100644 --- a/lib/libc/tests/secure/fortify_stdlib_test.c +++ b/lib/libc/tests/secure/fortify_stdlib_test.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_string_test.c b/lib/libc/tests/secure/fortify_string_test.c index 6a4f08705602..70f247b09e39 100644 --- a/lib/libc/tests/secure/fortify_string_test.c +++ b/lib/libc/tests/secure/fortify_string_test.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_strings_test.c b/lib/libc/tests/secure/fortify_strings_test.c index ec6340e77f74..e6a8ea0291de 100644 --- a/lib/libc/tests/secure/fortify_strings_test.c +++ b/lib/libc/tests/secure/fortify_strings_test.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_uio_test.c b/lib/libc/tests/secure/fortify_uio_test.c new file mode 100644 index 000000000000..56d7cf5d9a84 --- /dev/null +++ b/lib/libc/tests/secure/fortify_uio_test.c @@ -0,0 +1,804 @@ +/* @generated by `generate-fortify-tests.lua "uio"` */ + +#define _FORTIFY_SOURCE 2 +#define TMPFILE_SIZE (1024 * 32) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static FILE * __unused +new_fp(size_t __len) +{ + static char fpbuf[LINE_MAX]; + FILE *fp; + + ATF_REQUIRE(__len <= sizeof(fpbuf)); + + memset(fpbuf, 'A', sizeof(fpbuf) - 1); + fpbuf[sizeof(fpbuf) - 1] = '\0'; + + fp = fmemopen(fpbuf, sizeof(fpbuf), "rb"); + ATF_REQUIRE(fp != NULL); + + return (fp); +} + +/* + * Create a new symlink to use for readlink(2) style tests, we'll just use a + * random target name to have something interesting to look at. + */ +static const char * __unused +new_symlink(size_t __len) +{ + static const char linkname[] = "link"; + char target[MAXNAMLEN]; + int error; + + ATF_REQUIRE(__len <= sizeof(target)); + + arc4random_buf(target, sizeof(target)); + + error = unlink(linkname); + ATF_REQUIRE(error == 0 || errno == ENOENT); + + error = symlink(target, linkname); + ATF_REQUIRE(error == 0); + + return (linkname); +} + +/* + * Constructs a tmpfile that we can use for testing read(2) and friends. + */ +static int __unused +new_tmpfile(void) +{ + char buf[1024]; + ssize_t rv; + size_t written; + int fd; + + fd = open("tmpfile", O_RDWR | O_CREAT | O_TRUNC, 0644); + ATF_REQUIRE(fd >= 0); + + written = 0; + while (written < TMPFILE_SIZE) { + rv = write(fd, buf, sizeof(buf)); + ATF_REQUIRE(rv > 0); + + written += rv; + } + + ATF_REQUIRE_EQ(0, lseek(fd, 0, SEEK_SET)); + return (fd); +} + +static void +disable_coredumps(void) +{ + struct rlimit rl = { 0 }; + + if (setrlimit(RLIMIT_CORE, &rl) == -1) + _exit(EX_OSERR); +} + +/* + * Replaces stdin with a file that we can actually read from, for tests where + * we want a FILE * or fd that we can get data from. + */ +static void __unused +replace_stdin(void) +{ + int fd; + + fd = new_tmpfile(); + + (void)dup2(fd, STDIN_FILENO); + if (fd != STDIN_FILENO) + close(fd); +} + +ATF_TC_WITHOUT_HEAD(readv_before_end); +ATF_TC_BODY(readv_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + struct iovec __buf[2]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 2 - 1; + const size_t __idx __unused = __len - 1; + + readv(STDIN_FILENO, __stack.__buf, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(readv_end); +ATF_TC_BODY(readv_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + struct iovec __buf[2]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 2; + const size_t __idx __unused = __len - 1; + + readv(STDIN_FILENO, __stack.__buf, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(readv_after_end); +ATF_TC_BODY(readv_after_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + struct iovec __buf[2]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 2 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + readv(STDIN_FILENO, __stack.__buf, __len); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(readv_heap_before_end); +ATF_TC_BODY(readv_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct iovec * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (2); + const size_t __len = 2 - 1; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + readv(STDIN_FILENO, __stack.__buf, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(readv_heap_end); +ATF_TC_BODY(readv_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct iovec * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (2); + const size_t __len = 2; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + readv(STDIN_FILENO, __stack.__buf, __len); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(readv_heap_after_end); +ATF_TC_BODY(readv_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct iovec * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (2); + const size_t __len = 2 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + + readv(STDIN_FILENO, __stack.__buf, __len); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(readv_iov_before_end); +ATF_TC_BODY(readv_iov_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + struct iovec iov[1]; + + iov[0].iov_base = __stack.__buf; + iov[0].iov_len = __len; + + replace_stdin(); + + readv(STDIN_FILENO, iov, nitems(iov)); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(readv_iov_end); +ATF_TC_BODY(readv_iov_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + struct iovec iov[1]; + + iov[0].iov_base = __stack.__buf; + iov[0].iov_len = __len; + + replace_stdin(); + + readv(STDIN_FILENO, iov, nitems(iov)); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(readv_iov_heap_before_end); +ATF_TC_BODY(readv_iov_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + struct iovec iov[1]; + + __stack.__buf = malloc(__bufsz); + iov[0].iov_base = __stack.__buf; + iov[0].iov_len = __len; + + replace_stdin(); + + readv(STDIN_FILENO, iov, nitems(iov)); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(readv_iov_heap_end); +ATF_TC_BODY(readv_iov_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + struct iovec iov[1]; + + __stack.__buf = malloc(__bufsz); + iov[0].iov_base = __stack.__buf; + iov[0].iov_len = __len; + + replace_stdin(); + + readv(STDIN_FILENO, iov, nitems(iov)); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(readv_iov_heap_after_end); +ATF_TC_BODY(readv_iov_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + struct iovec iov[1]; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + iov[0].iov_base = __stack.__buf; + iov[0].iov_len = __len; + + replace_stdin(); + + readv(STDIN_FILENO, iov, nitems(iov)); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(preadv_before_end); +ATF_TC_BODY(preadv_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + struct iovec __buf[2]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 2 - 1; + const size_t __idx __unused = __len - 1; + + preadv(STDIN_FILENO, __stack.__buf, __len, 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(preadv_end); +ATF_TC_BODY(preadv_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + struct iovec __buf[2]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 2; + const size_t __idx __unused = __len - 1; + + preadv(STDIN_FILENO, __stack.__buf, __len, 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(preadv_after_end); +ATF_TC_BODY(preadv_after_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + struct iovec __buf[2]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 2 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + preadv(STDIN_FILENO, __stack.__buf, __len, 0); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(preadv_heap_before_end); +ATF_TC_BODY(preadv_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct iovec * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (2); + const size_t __len = 2 - 1; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + preadv(STDIN_FILENO, __stack.__buf, __len, 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(preadv_heap_end); +ATF_TC_BODY(preadv_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct iovec * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (2); + const size_t __len = 2; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + preadv(STDIN_FILENO, __stack.__buf, __len, 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(preadv_heap_after_end); +ATF_TC_BODY(preadv_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + struct iovec * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (2); + const size_t __len = 2 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + + preadv(STDIN_FILENO, __stack.__buf, __len, 0); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(preadv_iov_before_end); +ATF_TC_BODY(preadv_iov_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + struct iovec iov[1]; + + iov[0].iov_base = __stack.__buf; + iov[0].iov_len = __len; + + replace_stdin(); + + preadv(STDIN_FILENO, iov, nitems(iov), 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(preadv_iov_end); +ATF_TC_BODY(preadv_iov_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + unsigned char __buf[42]; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + struct iovec iov[1]; + + iov[0].iov_base = __stack.__buf; + iov[0].iov_len = __len; + + replace_stdin(); + + preadv(STDIN_FILENO, iov, nitems(iov), 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(preadv_iov_heap_before_end); +ATF_TC_BODY(preadv_iov_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 - 1; + const size_t __idx __unused = __len - 1; + struct iovec iov[1]; + + __stack.__buf = malloc(__bufsz); + iov[0].iov_base = __stack.__buf; + iov[0].iov_len = __len; + + replace_stdin(); + + preadv(STDIN_FILENO, iov, nitems(iov), 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(preadv_iov_heap_end); +ATF_TC_BODY(preadv_iov_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42; + const size_t __idx __unused = __len - 1; + struct iovec iov[1]; + + __stack.__buf = malloc(__bufsz); + iov[0].iov_base = __stack.__buf; + iov[0].iov_len = __len; + + replace_stdin(); + + preadv(STDIN_FILENO, iov, nitems(iov), 0); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(preadv_iov_heap_after_end); +ATF_TC_BODY(preadv_iov_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + unsigned char * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (42); + const size_t __len = 42 + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + struct iovec iov[1]; + + __child = fork(); + ATF_REQUIRE(__child >= 0); *** 188 LINES SKIPPED *** From nobody Sat Jul 13 05:23:07 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLcLN06B3z5Pvfq; Sat, 13 Jul 2024 05:23: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLcLM5FRCz4nq1; Sat, 13 Jul 2024 05:23:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848187; 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=9KLmLIBdIy46aaaH+eeNJmlsAWH7vHtT4fujdvYlREw=; b=sE7QfZZcwxGSzHDNhV/JPiOCfKJC/HB7Pe2muz1UX0zHAsOM31398u+rXvZq8xYt6XsZGJ /7HqpE9Un2+OdoRPGr36lAP6l+qqYsuYlOeQU+q/9YOGTRl6P1c6mWFcYM6ec+WaIm3jbZ 78velE2wo8DbuAVkgbfckwZlCLcWovMi+N7YtzXC8kDJa+r5Liaxn8OtTlIf8D9ApF5Cs0 GepXaqFH+RjUxtZR5braai8GVDP2tRli1rr+/HcIFYFlDzZGkjeAAHepqVl8ipwVmSs+FU sTV/KI9QwkWeTBiLD2Zhy2AHRkIphyQ7AnRUlTPVRxlxfRFjB9BdvLuwUIXDOw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720848187; a=rsa-sha256; cv=none; b=VXq+rFyMHNYI/W0xP0nLZDkUTeB6Z42ZaHdaOsaU4tKWc5cjzgyRK+eQoiHIrvADdcLv2w L+duB4DA8YsZQRaNG1YluY5vNhFHbRG7rpk+0cq902X/4xCRMtHbJQXJpcaR6K9IQUJCYk OdAJiwFGPArnYA+Fb0A2brOWR5qsMdyDRDgZse3/SP2E33939t+YD3nycBCC23XNQ5FTHu 64LyhJqiQYfDOuCz8/1DbtY/a4SqGjYcxgAbNoFfld++UFIeoNWXs7flIhYcAT6eaB+u1j //LN62d6xy2n4mplDX+ziid54k4v6xRIKWQBhkuB8ZlYPDgO8cOJVROroRMZSA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720848187; 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=9KLmLIBdIy46aaaH+eeNJmlsAWH7vHtT4fujdvYlREw=; b=Hp9qU6GZs5FtcobP2PXoQUu7YH6NrR+0OFiSbaAx7pubuhk7uWGZT5qAKyziKQKQE7KwG/ 1YcX+Z4gv8Wv2eFv2aV+Y3s8tUU6QhPJKVJFbMIMV4PMdXNVVWVKRcC/TmDCSE+52WH4hE OFMhe+W/3uJgQWnYi2/6wm/7PIAkI9MseC9fVM9Oib3TXrrTkyZ0uheGV/Fiv/L28F3lAZ +e4FowIDg8OKWair8oHsdjcL45V9fG4pNi63PjZoCkDmz9E8cw2FUynfGorryi0X3JHyy/ EZCdMAjmGUoatjeZmo9GvPd0iG/+P1ljtnNKKshMvYjeLpc7LNUOvhERgWI91w== 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 4WLcLM4sDgzDqQ; Sat, 13 Jul 2024 05:23:07 +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 46D5N7gS032785; Sat, 13 Jul 2024 05:23:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46D5N7Re032782; Sat, 13 Jul 2024 05:23:07 GMT (envelope-from git) Date: Sat, 13 Jul 2024 05:23:07 GMT Message-Id: <202407130523.46D5N7Re032782@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 2aba0eea3fff - main - include: ssp: fortify List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 2aba0eea3ffffce74f9d8df20e0aaf49ea6d76c3 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=2aba0eea3ffffce74f9d8df20e0aaf49ea6d76c3 commit 2aba0eea3ffffce74f9d8df20e0aaf49ea6d76c3 Author: Kyle Evans AuthorDate: 2024-07-13 05:16:12 +0000 Commit: Kyle Evans CommitDate: 2024-07-13 05:16:25 +0000 include: ssp: fortify Notably sanity check indices passed to the FD_*() macros against the size of the fd_set itself. Reviewed by: markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45685 --- lib/libc/tests/secure/Makefile | 1 + lib/libc/tests/secure/fortify_poll_test.c | 1 + lib/libc/tests/secure/fortify_random_test.c | 1 + lib/libc/tests/secure/fortify_select_test.c | 669 +++++++++++++++++++++++ lib/libc/tests/secure/fortify_stdio_test.c | 1 + lib/libc/tests/secure/fortify_stdlib_test.c | 1 + lib/libc/tests/secure/fortify_string_test.c | 1 + lib/libc/tests/secure/fortify_strings_test.c | 1 + lib/libc/tests/secure/fortify_uio_test.c | 1 + lib/libc/tests/secure/fortify_unistd_test.c | 1 + lib/libc/tests/secure/fortify_wchar_test.c | 1 + lib/libc/tests/secure/generate-fortify-tests.lua | 31 ++ sys/sys/select.h | 32 +- 13 files changed, 739 insertions(+), 3 deletions(-) diff --git a/lib/libc/tests/secure/Makefile b/lib/libc/tests/secure/Makefile index 7aa9212b97a8..996536beac91 100644 --- a/lib/libc/tests/secure/Makefile +++ b/lib/libc/tests/secure/Makefile @@ -4,6 +4,7 @@ TESTSDIR:= ${TESTSBASE}/${RELDIR:C/libc\/tests/libc/} # sys/ headers FORTIFY_TCATS+= random +FORTIFY_TCATS+= select FORTIFY_TCATS+= uio # non-sys/ headers diff --git a/lib/libc/tests/secure/fortify_poll_test.c b/lib/libc/tests/secure/fortify_poll_test.c index 83c0f68b0daa..47648fe54b47 100644 --- a/lib/libc/tests/secure/fortify_poll_test.c +++ b/lib/libc/tests/secure/fortify_poll_test.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_random_test.c b/lib/libc/tests/secure/fortify_random_test.c index 1eb18cfcaaf4..64c32c6c6a8f 100644 --- a/lib/libc/tests/secure/fortify_random_test.c +++ b/lib/libc/tests/secure/fortify_random_test.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_select_test.c b/lib/libc/tests/secure/fortify_select_test.c new file mode 100644 index 000000000000..ccd3f97004fc --- /dev/null +++ b/lib/libc/tests/secure/fortify_select_test.c @@ -0,0 +1,669 @@ +/* @generated by `generate-fortify-tests.lua "select"` */ + +#define _FORTIFY_SOURCE 2 +#define TMPFILE_SIZE (1024 * 32) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static FILE * __unused +new_fp(size_t __len) +{ + static char fpbuf[LINE_MAX]; + FILE *fp; + + ATF_REQUIRE(__len <= sizeof(fpbuf)); + + memset(fpbuf, 'A', sizeof(fpbuf) - 1); + fpbuf[sizeof(fpbuf) - 1] = '\0'; + + fp = fmemopen(fpbuf, sizeof(fpbuf), "rb"); + ATF_REQUIRE(fp != NULL); + + return (fp); +} + +/* + * Create a new symlink to use for readlink(2) style tests, we'll just use a + * random target name to have something interesting to look at. + */ +static const char * __unused +new_symlink(size_t __len) +{ + static const char linkname[] = "link"; + char target[MAXNAMLEN]; + int error; + + ATF_REQUIRE(__len <= sizeof(target)); + + arc4random_buf(target, sizeof(target)); + + error = unlink(linkname); + ATF_REQUIRE(error == 0 || errno == ENOENT); + + error = symlink(target, linkname); + ATF_REQUIRE(error == 0); + + return (linkname); +} + +/* + * Constructs a tmpfile that we can use for testing read(2) and friends. + */ +static int __unused +new_tmpfile(void) +{ + char buf[1024]; + ssize_t rv; + size_t written; + int fd; + + fd = open("tmpfile", O_RDWR | O_CREAT | O_TRUNC, 0644); + ATF_REQUIRE(fd >= 0); + + written = 0; + while (written < TMPFILE_SIZE) { + rv = write(fd, buf, sizeof(buf)); + ATF_REQUIRE(rv > 0); + + written += rv; + } + + ATF_REQUIRE_EQ(0, lseek(fd, 0, SEEK_SET)); + return (fd); +} + +static void +disable_coredumps(void) +{ + struct rlimit rl = { 0 }; + + if (setrlimit(RLIMIT_CORE, &rl) == -1) + _exit(EX_OSERR); +} + +/* + * Replaces stdin with a file that we can actually read from, for tests where + * we want a FILE * or fd that we can get data from. + */ +static void __unused +replace_stdin(void) +{ + int fd; + + fd = new_tmpfile(); + + (void)dup2(fd, STDIN_FILENO); + if (fd != STDIN_FILENO) + close(fd); +} + +ATF_TC_WITHOUT_HEAD(FD_SET_before_end); +ATF_TC_BODY(FD_SET_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + fd_set __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = FD_SETSIZE - 1; + const size_t __idx __unused = __len - 1; + + FD_SET(__idx, &__stack.__buf); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_SET_end); +ATF_TC_BODY(FD_SET_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + fd_set __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = FD_SETSIZE; + const size_t __idx __unused = __len - 1; + + FD_SET(__idx, &__stack.__buf); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_SET_after_end); +ATF_TC_BODY(FD_SET_after_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + fd_set __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = FD_SETSIZE + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + FD_SET(__idx, &__stack.__buf); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_SET_heap_before_end); +ATF_TC_BODY(FD_SET_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + fd_set * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (1); + const size_t __len = FD_SETSIZE - 1; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + FD_SET(__idx, __stack.__buf); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_SET_heap_end); +ATF_TC_BODY(FD_SET_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + fd_set * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (1); + const size_t __len = FD_SETSIZE; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + FD_SET(__idx, __stack.__buf); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_SET_heap_after_end); +ATF_TC_BODY(FD_SET_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + fd_set * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (1); + const size_t __len = FD_SETSIZE + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + + FD_SET(__idx, __stack.__buf); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_CLR_before_end); +ATF_TC_BODY(FD_CLR_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + fd_set __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = FD_SETSIZE - 1; + const size_t __idx __unused = __len - 1; + + FD_CLR(__idx, &__stack.__buf); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_CLR_end); +ATF_TC_BODY(FD_CLR_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + fd_set __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = FD_SETSIZE; + const size_t __idx __unused = __len - 1; + + FD_CLR(__idx, &__stack.__buf); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_CLR_after_end); +ATF_TC_BODY(FD_CLR_after_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + fd_set __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = FD_SETSIZE + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + FD_CLR(__idx, &__stack.__buf); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_CLR_heap_before_end); +ATF_TC_BODY(FD_CLR_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + fd_set * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (1); + const size_t __len = FD_SETSIZE - 1; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + FD_CLR(__idx, __stack.__buf); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_CLR_heap_end); +ATF_TC_BODY(FD_CLR_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + fd_set * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (1); + const size_t __len = FD_SETSIZE; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + FD_CLR(__idx, __stack.__buf); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_CLR_heap_after_end); +ATF_TC_BODY(FD_CLR_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + fd_set * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (1); + const size_t __len = FD_SETSIZE + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + + FD_CLR(__idx, __stack.__buf); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_ISSET_before_end); +ATF_TC_BODY(FD_ISSET_before_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + fd_set __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = FD_SETSIZE - 1; + const size_t __idx __unused = __len - 1; + + FD_ISSET(__idx, &__stack.__buf); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_ISSET_end); +ATF_TC_BODY(FD_ISSET_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + fd_set __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = FD_SETSIZE; + const size_t __idx __unused = __len - 1; + + FD_ISSET(__idx, &__stack.__buf); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_ISSET_after_end); +ATF_TC_BODY(FD_ISSET_after_end, tc) +{ +#define BUF &__stack.__buf + struct { + uint8_t padding_l; + fd_set __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(__stack.__buf); + const size_t __len = FD_SETSIZE + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + FD_ISSET(__idx, &__stack.__buf); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_ISSET_heap_before_end); +ATF_TC_BODY(FD_ISSET_heap_before_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + fd_set * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (1); + const size_t __len = FD_SETSIZE - 1; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + FD_ISSET(__idx, __stack.__buf); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_ISSET_heap_end); +ATF_TC_BODY(FD_ISSET_heap_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + fd_set * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (1); + const size_t __len = FD_SETSIZE; + const size_t __idx __unused = __len - 1; + + __stack.__buf = malloc(__bufsz); + + FD_ISSET(__idx, __stack.__buf); +#undef BUF + +} + +ATF_TC_WITHOUT_HEAD(FD_ISSET_heap_after_end); +ATF_TC_BODY(FD_ISSET_heap_after_end, tc) +{ +#define BUF __stack.__buf + struct { + uint8_t padding_l; + fd_set * __buf; + uint8_t padding_r; + } __stack; + const size_t __bufsz __unused = sizeof(*__stack.__buf) * (1); + const size_t __len = FD_SETSIZE + 1; + const size_t __idx __unused = __len - 1; + pid_t __child; + int __status; + + __child = fork(); + ATF_REQUIRE(__child >= 0); + if (__child > 0) + goto monitor; + + /* Child */ + disable_coredumps(); + __stack.__buf = malloc(__bufsz); + + FD_ISSET(__idx, __stack.__buf); + _exit(EX_SOFTWARE); /* Should have aborted. */ + +monitor: + while (waitpid(__child, &__status, 0) != __child) { + ATF_REQUIRE_EQ(EINTR, errno); + } + + if (!WIFSIGNALED(__status)) { + switch (WEXITSTATUS(__status)) { + case EX_SOFTWARE: + atf_tc_fail("FORTIFY_SOURCE failed to abort"); + break; + case EX_OSERR: + atf_tc_fail("setrlimit(2) failed"); + break; + default: + atf_tc_fail("child exited with status %d", + WEXITSTATUS(__status)); + } + } else { + ATF_REQUIRE_EQ(SIGABRT, WTERMSIG(__status)); + } +#undef BUF + +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, FD_SET_before_end); + ATF_TP_ADD_TC(tp, FD_SET_end); + ATF_TP_ADD_TC(tp, FD_SET_after_end); + ATF_TP_ADD_TC(tp, FD_SET_heap_before_end); + ATF_TP_ADD_TC(tp, FD_SET_heap_end); + ATF_TP_ADD_TC(tp, FD_SET_heap_after_end); + ATF_TP_ADD_TC(tp, FD_CLR_before_end); + ATF_TP_ADD_TC(tp, FD_CLR_end); + ATF_TP_ADD_TC(tp, FD_CLR_after_end); + ATF_TP_ADD_TC(tp, FD_CLR_heap_before_end); + ATF_TP_ADD_TC(tp, FD_CLR_heap_end); + ATF_TP_ADD_TC(tp, FD_CLR_heap_after_end); + ATF_TP_ADD_TC(tp, FD_ISSET_before_end); + ATF_TP_ADD_TC(tp, FD_ISSET_end); + ATF_TP_ADD_TC(tp, FD_ISSET_after_end); + ATF_TP_ADD_TC(tp, FD_ISSET_heap_before_end); + ATF_TP_ADD_TC(tp, FD_ISSET_heap_end); + ATF_TP_ADD_TC(tp, FD_ISSET_heap_after_end); + return (atf_no_error()); +} diff --git a/lib/libc/tests/secure/fortify_stdio_test.c b/lib/libc/tests/secure/fortify_stdio_test.c index 75f81c0a0750..61ccc8fc5592 100644 --- a/lib/libc/tests/secure/fortify_stdio_test.c +++ b/lib/libc/tests/secure/fortify_stdio_test.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_stdlib_test.c b/lib/libc/tests/secure/fortify_stdlib_test.c index 8556e1110156..5383b73d4058 100644 --- a/lib/libc/tests/secure/fortify_stdlib_test.c +++ b/lib/libc/tests/secure/fortify_stdlib_test.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_string_test.c b/lib/libc/tests/secure/fortify_string_test.c index 70f247b09e39..918445ca68a1 100644 --- a/lib/libc/tests/secure/fortify_string_test.c +++ b/lib/libc/tests/secure/fortify_string_test.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_strings_test.c b/lib/libc/tests/secure/fortify_strings_test.c index e6a8ea0291de..1cecd7033ae3 100644 --- a/lib/libc/tests/secure/fortify_strings_test.c +++ b/lib/libc/tests/secure/fortify_strings_test.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_uio_test.c b/lib/libc/tests/secure/fortify_uio_test.c index 56d7cf5d9a84..0c709ac8b945 100644 --- a/lib/libc/tests/secure/fortify_uio_test.c +++ b/lib/libc/tests/secure/fortify_uio_test.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_unistd_test.c b/lib/libc/tests/secure/fortify_unistd_test.c index 7a91d3b06c75..e2127450f565 100644 --- a/lib/libc/tests/secure/fortify_unistd_test.c +++ b/lib/libc/tests/secure/fortify_unistd_test.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/fortify_wchar_test.c b/lib/libc/tests/secure/fortify_wchar_test.c index 8c5e0782c65a..31ae02c412a7 100644 --- a/lib/libc/tests/secure/fortify_wchar_test.c +++ b/lib/libc/tests/secure/fortify_wchar_test.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/libc/tests/secure/generate-fortify-tests.lua b/lib/libc/tests/secure/generate-fortify-tests.lua index 23b33acb757b..fdbc6c550551 100755 --- a/lib/libc/tests/secure/generate-fortify-tests.lua +++ b/lib/libc/tests/secure/generate-fortify-tests.lua @@ -64,6 +64,7 @@ local includes = { "sys/param.h", "sys/random.h", "sys/resource.h", + "sys/select.h", "sys/time.h", "sys/uio.h", "sys/wait.h", @@ -169,6 +170,36 @@ local all_tests = { exclude = excludes_stack_overflow, }, }, + select = { + -- + { + func = "FD_SET", + bufsize = "FD_SETSIZE", + buftype = "fd_set", + arguments = { + "__idx", + "__buf", + }, + }, + { + func = "FD_CLR", + bufsize = "FD_SETSIZE", + buftype = "fd_set", + arguments = { + "__idx", + "__buf", + }, + }, + { + func = "FD_ISSET", + bufsize = "FD_SETSIZE", + buftype = "fd_set", + arguments = { + "__idx", + "__buf", + }, + }, + }, uio = { -- { diff --git a/sys/sys/select.h b/sys/sys/select.h index 1ded44197de9..9b734754b944 100644 --- a/sys/sys/select.h +++ b/sys/sys/select.h @@ -49,6 +49,12 @@ typedef __fd_mask fd_mask; typedef __sigset_t sigset_t; #endif +#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#include +#else +#define __SSP_FORTIFY_LEVEL 0 +#endif + /* * Select uses bit masks of file descriptors in longs. These macros * manipulate such bit fields (the filesystem macros use chars). @@ -75,13 +81,33 @@ typedef struct fd_set { #define fds_bits __fds_bits #endif +#define __fdset_idx_(p, n) ((n) / _NFDBITS) +#if __SSP_FORTIFY_LEVEL == 0 +#define __fdset_idx(p, n) __fdset_idx_(p, n) +#else +__ssp_inline unsigned long +__fdset_idx(fd_set *p, unsigned long idx) +{ + __size_t psz = __ssp_bos0(p); + unsigned long sidx = __fdset_idx_(p, idx); + + if (idx >= FD_SETSIZE) + __chk_fail(); + if (psz / sizeof(__fd_mask) < (sidx + 1)) + __chk_fail(); + + return (sidx); +} +#endif + #define __fdset_mask(n) ((__fd_mask)1 << ((n) % _NFDBITS)) -#define FD_CLR(n, p) ((p)->__fds_bits[(n)/_NFDBITS] &= ~__fdset_mask(n)) +#define FD_CLR(n, p) ((p)->__fds_bits[__fdset_idx(p, n)] &= ~__fdset_mask(n)) #if __BSD_VISIBLE #define FD_COPY(f, t) (void)(*(t) = *(f)) #endif -#define FD_ISSET(n, p) (((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) != 0) -#define FD_SET(n, p) ((p)->__fds_bits[(n)/_NFDBITS] |= __fdset_mask(n)) +#define FD_ISSET(n, p) \ + (((p)->__fds_bits[__fdset_idx(p, n)] & __fdset_mask(n)) != 0) +#define FD_SET(n, p) ((p)->__fds_bits[__fdset_idx(p, n)] |= __fdset_mask(n)) #define FD_ZERO(p) do { \ fd_set *_p; \ __size_t _n; \ From nobody Sat Jul 13 10:28:08 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLl6J4M2fz5QTby; Sat, 13 Jul 2024 10:28: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLl6J3ZTZz45BN; Sat, 13 Jul 2024 10:28:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720866488; 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=3Z/uL9gMWQDtevD672io7SFgbVTcC2Xr75taT4Ohrp4=; b=Zl2pUkayxsa7ek926u3NDtPTpB7cIUoKhyCTSI6x7+/xE1oP/PdFd6Yp2Bq3tpZ9y5Kfus ZxljgLS1Uw11cRS6Yv4GzjLJxIQO+zRrC9IKM+AefSOz45L0LmJx17Kjv8ASbj/JEKvCmo Jp1n1r0kr8veEeCys/m1+/h7W4spdxYuEeeov2V2m2LbvRcGMlYf1KsP/cOwxTN42sEKrE P8LyqA3MxzKGoP35HqLt5tSvdXAVKvm3GGXi+RN4mGHdwMJ9//lmQ3n1h5ocF+grRdLK/D S/BVmX6BGokhqHa/Bk2GohcHF58dHszhnoUtfkMkQZgley/NBHBziLFegMmXpg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720866488; a=rsa-sha256; cv=none; b=EESVQnC2QFCm7piRNAEWg+ejkwS0d7AjDBQX0eIYN2f0CxM2lwIxH9ehnekTy8HK3BTWBT NHgGvo5H+flntdvJuPShD+Fj+KQsEsvs+RRRXstxlux+oLvBViKUAvLAxp07tdQnLA28+f +ELw/R5Vfx/7t/brfCCO9yeknYf0jNGyw7QUaOniOAquCqQ8nOTUPMGkLDxcT/IhOaz3G9 sWLDbsCz7k9XeDqb/eCZScjwC2Hl9SbdEKYv7mE9XITjT3a/OmhGCBSq+Rm9ek+hlkfBwA iXP2nyEuaHMy1pj/fKKqDA9DMH/MMSuD52jBkvSDTcLXjtXa2nNxtxX7e8czDA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720866488; 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=3Z/uL9gMWQDtevD672io7SFgbVTcC2Xr75taT4Ohrp4=; b=UI/nnKu2mxcsTgMP9fNlFB+bbF4tiCU9g0MjdRr513uoAopkRBWzkAyrYF3tNB73sOPf7m jvaICXW4I0NZdyC5BuwEFFmKyHoXObkO3Nh/EYWF4O4GVp+8FukWypHMXjWA7/cXMdNVE5 5JRWd8Qf5VFHkDe/9kdkdR3maXZMDBR74zb3ssUfkUri0ROJXwfRGPXXoE0Xz0brLkchYs CEq0pm6kqezydJelY145G5YJsu+MQxyxFr9BMVkWg/SjjLDM+mQXQyDx1hFemCirSkY38V 8C5wNx8eMjqM1IWoZLCBbzeUfJv6xI9oCEFhKz7lhDr5ouEKwtS7Aa4WyPM56Q== 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 4WLl6J2pBTzMfR; Sat, 13 Jul 2024 10:28: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 46DAS8e8043813; Sat, 13 Jul 2024 10:28:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46DAS8We043810; Sat, 13 Jul 2024 10:28:08 GMT (envelope-from git) Date: Sat, 13 Jul 2024 10:28:08 GMT Message-Id: <202407131028.46DAS8We043810@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 859f0f0d6bf7 - main - tcp: refactor register_tcp_functions_as_names() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 859f0f0d6bf753c16caa0103a541c69fb6bd5e37 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=859f0f0d6bf753c16caa0103a541c69fb6bd5e37 commit 859f0f0d6bf753c16caa0103a541c69fb6bd5e37 Author: Michael Tuexen AuthorDate: 2024-07-13 10:22:25 +0000 Commit: Michael Tuexen CommitDate: 2024-07-13 10:22:25 +0000 tcp: refactor register_tcp_functions_as_names() Refactor register_tcp_functions_as_names() such that either all or no (in error cases) registrations happen atomically (while holding the tcp_function_lock write lock). Also ensure that the TCP function block is not already registered. This avoids situations, where some registrations were performed and then they were removed without holding a lock in between or checking ref counts. Reviewed by: cc MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D45947 --- share/man/man9/tcp_functions.9 | 25 +++++++++++--- sys/netinet/tcp_subr.c | 78 ++++++++++++++++++++++-------------------- sys/netinet/tcp_var.h | 3 ++ 3 files changed, 64 insertions(+), 42 deletions(-) diff --git a/share/man/man9/tcp_functions.9 b/share/man/man9/tcp_functions.9 index 1e0616e03a9f..8ba7f21c978c 100644 --- a/share/man/man9/tcp_functions.9 +++ b/share/man/man9/tcp_functions.9 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 6, 2024 +.Dd July 13, 2024 .Dt TCP_FUNCTIONS 9 .Os .Sh NAME @@ -37,6 +37,7 @@ .Ft int .Fn register_tcp_functions_as_name "struct tcp_function_block *blk" \ "const char *name" "int wait" +.Ft int .Fn register_tcp_functions_as_names "struct tcp_function_block *blk" \ "int wait" "const char *names[]" "int *num_names" .Ft int @@ -112,6 +113,7 @@ argument. The .Fa num_names argument provides a pointer to the number of names. +This number must not exceed TCP_FUNCTION_NAME_NUM_MAX. This function will either succeed in registering all of the names in the array, or none of the names in the array. On failure, the @@ -328,8 +330,11 @@ must be prepared to wait until all connections have stopped using the specified TCP stack. .Sh ERRORS The -.Fn register_tcp_functions -function will fail if: +.Fn register_tcp_functions , +.Fn register_tcp_functions_as_name , +and +.Fn register_tcp_functions_as_names +functions will fail if: .Bl -tag -width Er .It Bq Er EINVAL Any of the members of the @@ -338,7 +343,19 @@ argument are set incorrectly. .It Bq Er ENOMEM The function could not allocate memory for its internal data. .It Bq Er EALREADY -A function block is already registered with the same name. +The +.Fa blk +is already registered or a function block is already registered with the same +name. +.El +Additionally, +.Fn register_tcp_functions_as_names +will fail if: +.Bl -tag -width Er +.It Bq Er E2BIG +The number of names pointed to by the +.Fa num_names +argument is larger than TCP_FUNCTION_NAME_NUM_MAX. .El The .Fn deregister_tcp_functions diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index b4f605534d59..5743d1bbd100 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1172,9 +1172,9 @@ int register_tcp_functions_as_names(struct tcp_function_block *blk, int wait, const char *names[], int *num_names) { - struct tcp_function *n; + struct tcp_function *f[TCP_FUNCTION_NAME_NUM_MAX]; struct tcp_function_set fs; - int error, i; + int error, i, num_registered; KASSERT(names != NULL, ("%s: Called with NULL name list", __func__)); KASSERT(*num_names > 0, @@ -1182,71 +1182,73 @@ register_tcp_functions_as_names(struct tcp_function_block *blk, int wait, KASSERT(rw_initialized(&tcp_function_lock), ("%s: called too early", __func__)); + if (*num_names > TCP_FUNCTION_NAME_NUM_MAX) { + /* Too many names. */ + *num_names = 0; + return (E2BIG); + } if ((blk->tfb_tcp_output == NULL) || (blk->tfb_tcp_do_segment == NULL) || (blk->tfb_tcp_ctloutput == NULL) || (blk->tfb_tcp_handoff_ok == NULL) || (strlen(blk->tfb_tcp_block_name) == 0)) { - /* - * These functions are required and you - * need a name. - */ + /* These functions are required and a name is needed. */ *num_names = 0; return (EINVAL); } - if (blk->tfb_flags & TCP_FUNC_BEING_REMOVED) { - *num_names = 0; - return (EINVAL); + for (i = 0; i < *num_names; i++) { + f[i] = malloc(sizeof(struct tcp_function), M_TCPFUNCTIONS, wait); + if (f[i] == NULL) { + while (--i >= 0) + free(f[i], M_TCPFUNCTIONS); + *num_names = 0; + return (ENOMEM); + } } + num_registered = 0; + rw_wlock(&tcp_function_lock); + if (find_tcp_fb_locked(blk, NULL) != NULL) { + /* A TCP function block can only be registered once. */ + error = EALREADY; + goto cleanup; + } + if (blk->tfb_flags & TCP_FUNC_BEING_REMOVED) { + error = EINVAL; + goto cleanup; + } refcount_init(&blk->tfb_refcnt, 0); blk->tfb_id = atomic_fetchadd_int(&next_tcp_stack_id, 1); for (i = 0; i < *num_names; i++) { - n = malloc(sizeof(struct tcp_function), M_TCPFUNCTIONS, wait); - if (n == NULL) { - error = ENOMEM; - goto cleanup; - } - n->tf_fb = blk; - (void)strlcpy(fs.function_set_name, names[i], sizeof(fs.function_set_name)); - rw_wlock(&tcp_function_lock); if (find_tcp_functions_locked(&fs) != NULL) { /* Duplicate name space not allowed */ - rw_wunlock(&tcp_function_lock); - free(n, M_TCPFUNCTIONS); error = EALREADY; goto cleanup; } - (void)strlcpy(n->tf_name, names[i], sizeof(n->tf_name)); - TAILQ_INSERT_TAIL(&t_functions, n, tf_next); + f[i]->tf_fb = blk; + (void)strlcpy(f[i]->tf_name, names[i], sizeof(f[i]->tf_name)); + TAILQ_INSERT_TAIL(&t_functions, f[i], tf_next); tcp_fb_cnt++; - rw_wunlock(&tcp_function_lock); + num_registered++; } + rw_wunlock(&tcp_function_lock); return (0); cleanup: - /* - * Deregister the names we just added. Because registration failed - * for names[i], we don't need to deregister that name. - */ - *num_names = i; - rw_wlock(&tcp_function_lock); - while (--i >= 0) { - TAILQ_FOREACH(n, &t_functions, tf_next) { - if (!strncmp(n->tf_name, names[i], - TCP_FUNCTION_NAME_LEN_MAX)) { - TAILQ_REMOVE(&t_functions, n, tf_next); - tcp_fb_cnt--; - n->tf_fb = NULL; - free(n, M_TCPFUNCTIONS); - break; - } + /* Remove the entries just added. */ + for (i = 0; i < *num_names; i++) { + if (i < num_registered) { + TAILQ_REMOVE(&t_functions, f[i], tf_next); + tcp_fb_cnt--; } + f[i]->tf_fb = NULL; + free(f[i], M_TCPFUNCTIONS); } rw_wunlock(&tcp_function_lock); + *num_names = num_registered; return (error); } diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 8330966c2c3f..1f48297c2b0a 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -634,6 +634,9 @@ struct tcp_function_block { uint8_t tfb_id; }; +/* Maximum number of names each TCP function block can be registered with. */ +#define TCP_FUNCTION_NAME_NUM_MAX 8 + struct tcp_function { TAILQ_ENTRY(tcp_function) tf_next; char tf_name[TCP_FUNCTION_NAME_LEN_MAX]; From nobody Sat Jul 13 10:39:51 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLlMq6gDNz5QVv4; Sat, 13 Jul 2024 10:39: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLlMq629Kz46Mh; Sat, 13 Jul 2024 10:39:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720867191; 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=plcL5x94cDVuo7LH/dI9icbXD0qGzlsMA13C/q4dUFI=; b=gIcOr18mH3NhCFuaPkYvikBYzUYKKu//bIsBsrBN0Zd3pH0LyDceFx2s7ntaW7gTZFP5Cu /MlNGy8PJFWEV8bsotbl84SHLMYJJwMCVdJwMiYYy69cyw+IaRd6gIL3BptBbn4NfEUlwi e12KI3OSp0BQ6fVdOwylUagEfoBhvhrLgQIOYr6cN2fwfhjluOvmqfYycitazANXdpkCif lI8KsWNNYbhmucjnHmdsFj/gozhMBvVOQdA4brzByO0B92fB19dHIgVoKorE1MOrCs0g8O Lzi7zyJJkP/PtGU0OCChwt1mUXK76+SDrqj8rFo14YkJfjfmsM63VJmorJT+Fw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720867191; a=rsa-sha256; cv=none; b=YXrF3LH6qpgjxOrfySCthZbcPFBlneJRbFEW2Pryo8NkW8FladsU5eU5hz2wcTSFh4xN1/ CZuGzHsaAKKHPdY0lED95AfC7IGSpTGFa25YQRSUI5UEM5mrqZzdMm3KnwrYtgORaXxzdN o3/ewmDLd1M7WOBeP4+kxhN6FRbzntcsBBtI4iw/4Ui5HMKL+POzdFsVzP6YTaWAEsVs/T 0JwpfFtCTubgYsLDn5/R+DB1KpVTv4sj2SZ914ng52RD3PN5K8xiv3jrG305F5QLKodfVb XqJD7HrZInUT6kXUB9b5d97Uq9hHzdz5U6vgK/DpVRFXtfDFVkr8jJymlv9bfw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720867191; 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=plcL5x94cDVuo7LH/dI9icbXD0qGzlsMA13C/q4dUFI=; b=XOzYbGnRiqdIWrYh0CiuIEKm9UZfpPPcUAcfneXAJYNxdBgeCtxSH70kXBjsnIJ539jRrG ezZ1h3EbwYw4tbKUwhCRl+J9DxVH/5oP2ZbG7T2iX3L59gss4O9ud+iOMjxC0BuYyVO7So bi0NxRAoJDMt/GT/snPGdFrCwe9npIJWczcLzQd5mhT5NEPuIAYZwPrCxqHWUgiP/P/opM WhlLQQrICn5i++j7fZGKeWAGIz6oGQEt7S5AoSlRQH4cj0x13UCuvD3B3EN+/yZ1Kt25iD oaW//V4h0DK48c++398yRtdXhaZLbhPcR6WawKLkTFmx2IYr9vAujp+aeINLcQ== 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 4WLlMq5ClJzNXy; Sat, 13 Jul 2024 10:39: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 46DAdp7d060635; Sat, 13 Jul 2024 10:39:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46DAdpeF060632; Sat, 13 Jul 2024 10:39:51 GMT (envelope-from git) Date: Sat, 13 Jul 2024 10:39:51 GMT Message-Id: <202407131039.46DAdpeF060632@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wolfram Schneider Subject: git: e5a0202f9694 - main - Makefile.inc1: show time for `make installworld' List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wosch X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5a0202f96948a95bf1b879727e155a4f1d1da93 Auto-Submitted: auto-generated The branch main has been updated by wosch: URL: https://cgit.FreeBSD.org/src/commit/?id=e5a0202f96948a95bf1b879727e155a4f1d1da93 commit e5a0202f96948a95bf1b879727e155a4f1d1da93 Author: Wolfram Schneider AuthorDate: 2024-07-13 10:37:14 +0000 Commit: Wolfram Schneider CommitDate: 2024-07-13 10:37:14 +0000 Makefile.inc1: show time for `make installworld' For years we display the time in seconds how long it takes to run `make buildworld' (see PR 224433). Now we will display the time for "installworld" and "installkernel" as well. e.g.: -------------------------------------------------------------- >>> Installing everything completed on Sun Jul  7 16:11:37 UTC 2024 >>> Install world completed in 110 seconds, ncpu: 2, make -j2 -------------------------------------------------------------- PR: 280187 Approved by: imp Differential Revision: https://reviews.freebsd.org/D45912 --- Makefile.inc1 | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 19ed923702b1..7ff961e22e7a 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1241,11 +1241,19 @@ WMAKE_TGTS+= build${libcompat} .endif WMAKE_TGTS+= everything -# record buildworld time in seconds +# record buildworld / install time in seconds .if make(buildworld) _BUILDWORLD_START!= date '+%s' .export _BUILDWORLD_START .endif +.if make(installworld) +_INSTALLWORLD_START!= date '+%s' +.export _INSTALLWORLD_START +.endif +.if make(installkernel) +_INSTALLKERNEL_START!= date '+%s' +.export _INSTALLKERNEL_START +.endif buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue .PHONY .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue @@ -1313,11 +1321,11 @@ kernel-toolchain: ${KERNEL_TOOLCHAIN_TGTS} .PHONY installcheck: _installcheck_world _installcheck_kernel .PHONY _installcheck_world: .PHONY @echo "--------------------------------------------------------------" - @echo ">>> Install check world" + @echo ">>> Install check world started on `LC_ALL=C date`" @echo "--------------------------------------------------------------" _installcheck_kernel: .PHONY @echo "--------------------------------------------------------------" - @echo ">>> Install check kernel" + @echo ">>> Install check kernel started on `LC_ALL=C date`" @echo "--------------------------------------------------------------" # @@ -1641,6 +1649,8 @@ restage reinstall: .MAKE .PHONY .endfor @echo "--------------------------------------------------------------" @echo ">>> Installing everything completed on `LC_ALL=C date`" + @seconds=$$(($$(date '+%s') - ${_INSTALLWORLD_START})); \ + echo ">>> Install world completed in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}" @echo "--------------------------------------------------------------" redistribute: .MAKE .PHONY @@ -1873,6 +1883,9 @@ reinstallkernel reinstallkernel.debug: _installcheck_kernel .PHONY @echo "--------------------------------------------------------------" @echo ">>> Installing kernel ${INSTALLKERNEL} completed on $$(LC_ALL=C date)" @echo "--------------------------------------------------------------" + @seconds=$$(($$(date '+%s') - ${_INSTALLKERNEL_START})); \ + echo ">>> Install kernel(s) ${INSTALLKERNEL} completed in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}" + @echo "--------------------------------------------------------------" .endif .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" .for _kernel in ${BUILDKERNELS:[2..-1]} @@ -1887,6 +1900,9 @@ reinstallkernel reinstallkernel.debug: _installcheck_kernel .PHONY @echo ">>> Installing kernel ${_kernel} completed on $$(LC_ALL=C date)" @echo "--------------------------------------------------------------" .endfor + @seconds=$$(($$(date '+%s') - ${_INSTALLKERNEL_START})); \ + echo ">>> Install kernel(s) ${BUILDKERNELS} completed in $$seconds seconds, ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}" + @echo "--------------------------------------------------------------" .endif distributekernel distributekernel.debug: .PHONY From nobody Sat Jul 13 11:56:53 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLn4k29QFz5QdX4; Sat, 13 Jul 2024 11:56: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLn4k07dFz4F38; Sat, 13 Jul 2024 11:56:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720871814; 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=RzxS/bh7LTaYoR1/Jas8Q9mVJNt7Rv1YK5qInqRn3Kw=; b=dU2zwPg99V74j+V18kOMYdpUbXgQgzGRcsfxIhyjclT1fpPAqblEwj+NacGZ7b7wzyZ1Fo 9/8Yo4VA7jdpTesfVhGIprV18fAArg06kkoTCBM94FC9CpT2LhFlUDBcqcjW+K0glWI1qT PKryDKgvIYttWWM1zVLUb/rfZmSINtxNCXMcacNpjQi/FFc9dKvG7OrLPbYzXOOnVFsnJl qVUIbkhJpKUXD+ikW1xKRFgKJMSg6fiz8gaMhdde7oV7ps3p28eB7C1wSROxBitTtpFBTE fe5HQxKdHZvgOO2weBH19pNtnpH5wSFs/FS1ZiTVArbQAk6UO9LQRgYWrLSz3g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720871814; a=rsa-sha256; cv=none; b=R5BwUr2md5M4Vqp2KXV9ibB22RrzTBhrdSFHyyVuIFtb4G/YHVTmbOIhwSSuNir0eqk+zi To9AM33XkZIPZ4XziI9+NWKU4GLyavNzv/FbaqpSmUqSqV0nhC9DbX5vqHydUv5bWlwqHP jGaPM7Oz3tCACKoKfXA6sK6J82mnbh/EKDat12utPBVYGwJ8kYY4R5ZjNNQu6MdMl2RdPX VgalVxaon/vftcKNozF1wPh1bxfckh1IhipNEmLEOgPXkYMXA6Ent90HAd/aJ1BeRuGrTn /x1D5XISUHu3UPa3EFRRCXr/gIjhpfMTJQ8wbaaH7hpzHS1gNvnu2EveK1yImA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720871814; 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=RzxS/bh7LTaYoR1/Jas8Q9mVJNt7Rv1YK5qInqRn3Kw=; b=fcMe1kJkpwMwvGG6NBjgzhl2mHqoF9/IsI0cKz15NZ0ArOg2M0cdtvsiW2d1Zstkvj6GqF Lxpx5jfRJrAgTIF8eZBjQ/bQkeXL4M4LeVO0x0qwVD1XDxih37m4HnXF0y6OUlYA26SCwG SAnnXVXiioXh93OJPK5DsUWQlgjMiY2l/m1OU6bYpo03uUrJXxo2A5d5jLNN9bylHZlBww ro/0WQ2XbWeMbib8Henkykgs/M1ZF4pUTWvJiKSLLA2XovTTdpeVwNc7vEDiZvmqwm+iQr RxkCByYn518BkYsgUdyhlpzGZLPLs7/t8SoU0c0Ew1yFN5yrZJeXIRZM9ZPxIg== 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 4WLn4j6kflzQ8t; Sat, 13 Jul 2024 11:56: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 46DBurvl095872; Sat, 13 Jul 2024 11:56:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46DBur42095869; Sat, 13 Jul 2024 11:56:53 GMT (envelope-from git) Date: Sat, 13 Jul 2024 11:56:53 GMT Message-Id: <202407131156.46DBur42095869@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 69dace892d58 - main - tcp: fix number in comment List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 69dace892d58516fa32ab03de39ea6205b2363c4 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=69dace892d58516fa32ab03de39ea6205b2363c4 commit 69dace892d58516fa32ab03de39ea6205b2363c4 Author: Peter Lei AuthorDate: 2024-07-13 11:43:09 +0000 Commit: Michael Tuexen CommitDate: 2024-07-13 11:53:48 +0000 tcp: fix number in comment Fixes: e18b97bd63a8 ("Update to bring the rack stack with all its fixes in.") MFC after: 1 week Sponsored by: Netflix, Inc. --- sys/netinet/tcp_log_buf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/tcp_log_buf.h b/sys/netinet/tcp_log_buf.h index 082c2ca0f057..011506e2ed8a 100644 --- a/sys/netinet/tcp_log_buf.h +++ b/sys/netinet/tcp_log_buf.h @@ -269,7 +269,7 @@ enum tcp_log_events { TCP_LOG_PRU, /* TCP protocol user request 70 */ TCP_POLICER_DET, /* TCP Policer detectionn 71 */ TCP_PCM_MEASURE, /* TCP Path Capacity Measurement 72 */ - TCP_LOG_END /* End (keep at end) 72 */ + TCP_LOG_END /* End (keep at end) 73 */ }; enum tcp_log_states { From nobody Sat Jul 13 13:08:31 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLpgM26mGz5QlwN; Sat, 13 Jul 2024 13:08:31 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLpgM1cVMz4NJQ; Sat, 13 Jul 2024 13:08:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720876111; 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=iaGRnsUlSswy2TbKrupE3Oyk6GBFFONV9q1MRIHT9i0=; b=krLGVtTPnVT4ScSyqMXGJc/tw12l/w1fflZ+ZlRWIi5jtu8DnY35mX2DwOUzwOf++uuS6/ 0U02AHRlcAv+qHQHLEJHKMpbILzhYk9oB3D0I2p+4RtIcFMOCEeQ6hL7lNvOBP8AJjHs29 jnSGtR0LLauTMv38xhjVDIgQ3LvAaKwU+HNgkr+MQ0NQEShpS1wxZl1dn4ynK/hE3JZSKt UC4O6DxXGs2xVeb0b8HLJJIOlWodLcMBUH/UDEpq44XYdCu2F+RF1618H50SsUMN75W2X5 LyhmdIA5guq3erX6sDNjoY9MYd8cwR2GV5fZ6TdJFXupOOOTGczoKB9AL1DFwg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720876111; a=rsa-sha256; cv=none; b=ouK/6SLmrc3W4f48vIYfCTycJi2UiVjz2UgJV1fuCmt9F3mMoZhnQ9Eko2LiCa+Yr5kv6d mZCTzGdQWp5hfnSfNjmM+hKig6DYfoZl/sr5ap/moi8bv4jtT0UTNtAHAM7Dfo6rWWqQuP Ozr1tou5jmD68BzH/ydq9IneL67sJK5fr2IIPKi+9ojGw7GLgRVyYu6i7/K+32CHDd8Zf+ Gxqzlm4zf9nk4mlVtVhB/Dv73mZTJITHP+lL00mQtjh7KpG/wKWoxXlYl4SXA00IOabr1r q/Si1QSl77JgyGevtVSBvza3wYtdfvIlrxTk2P9JIj1VhvVgRJH1Xu5ZIyax4A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720876111; 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=iaGRnsUlSswy2TbKrupE3Oyk6GBFFONV9q1MRIHT9i0=; b=vi/P2YrcQvCY536uTzHNRP3mdko03X0Hjl9h3GGTIuKhB1+ATcozi7wLKLiiXgFNnCfZaD cWctXx041/xcQ+NmoBQZ+3rqtZKII8XWgp4qXvZCDusqbOaMaaVWu4Tq8cNjDgRKQsIwZ0 Fmuulpnv6FSKDpkN95G+mKfZcQJQ+4gZni1ehCFQm7gv3J1evBmN0bO8HrAgNGG7Nkinmb 3tx+5h6fwtYFzcoHB1sol+hH8x60ChcPKipwB/YfFU3p1eUBPJ8sk4Qud60TI1I/0A+TS2 YVoljnOUU27MCd4mhvXqV6t6tl5uVmP2yH2aqan1cOeSG2eZLYdK3FHf7X3Arg== 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 4WLpgM197szS7Y; Sat, 13 Jul 2024 13:08: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 46DD8V5x016153; Sat, 13 Jul 2024 13:08:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46DD8V3B016150; Sat, 13 Jul 2024 13:08:31 GMT (envelope-from git) Date: Sat, 13 Jul 2024 13:08:31 GMT Message-Id: <202407131308.46DD8V3B016150@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: f0d1236f0fc9 - main - libc: Add memset test for int-to-char conversion List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0d1236f0fc944165b657306a39d44fcc6aaa709 Auto-Submitted: auto-generated The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=f0d1236f0fc944165b657306a39d44fcc6aaa709 commit f0d1236f0fc944165b657306a39d44fcc6aaa709 Author: Strahinja Stanišić AuthorDate: 2024-07-13 12:53:07 +0000 Commit: Robert Clausecker CommitDate: 2024-07-13 13:07:49 +0000 libc: Add memset test for int-to-char conversion Test case to check if an implementation of memset correctly handles the value passed being wider than a byte Approved by: emaste Reviewed By: fuz (GSoC mentor), emaste Sponsored by: Google LLC (GSoC 2024) Differential Revision: https://reviews.freebsd.org/D45738 --- lib/libc/tests/string/Makefile | 2 ++ lib/libc/tests/string/memset_test.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/lib/libc/tests/string/Makefile b/lib/libc/tests/string/Makefile index 4fce79685c0e..c71a83eede61 100644 --- a/lib/libc/tests/string/Makefile +++ b/lib/libc/tests/string/Makefile @@ -12,6 +12,7 @@ ATF_TESTS_C+= flsll_test ATF_TESTS_C+= memccpy_test ATF_TESTS_C+= memcmp_test ATF_TESTS_C+= memrchr_test +ATF_TESTS_C+= memset2_test ATF_TESTS_C+= memset_s_test ATF_TESTS_C+= strncmp_test ATF_TESTS_C+= stpncpy_test @@ -45,6 +46,7 @@ NETBSD_ATF_TESTS_C+= strpbrk_test NETBSD_ATF_TESTS_C+= strrchr_test NETBSD_ATF_TESTS_C+= swab_test +SRCS.memset2_test= memset_test.c SRCS.strcmp2_test= strcmp_test.c SRCS.strerror2_test= strerror_test.c diff --git a/lib/libc/tests/string/memset_test.c b/lib/libc/tests/string/memset_test.c new file mode 100644 index 000000000000..b898ad5af251 --- /dev/null +++ b/lib/libc/tests/string/memset_test.c @@ -0,0 +1,29 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024 Strahinja Stanisic + */ + +#include +#include + +#include + +ATF_TC_WITHOUT_HEAD(int_char_conv); +ATF_TC_BODY(int_char_conv, tc) +{ + char b[64]; + int c = 0xDEADBEEF; + memset(&b, c, 64); + for(int i = 0; i < 64; i++) { + assert(b[i] == (char)c); + } + +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, int_char_conv); + return (atf_no_error()); +} + From nobody Sat Jul 13 14:57:20 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLs5H1Bnmz5QSX4 for ; Sat, 13 Jul 2024 14:57:39 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-oo1-xc31.google.com (mail-oo1-xc31.google.com [IPv6:2607:f8b0:4864:20::c31]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLs5G0jXRz4WyZ for ; Sat, 13 Jul 2024 14:57:38 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20230601.gappssmtp.com header.s=20230601 header.b=yMlhtqBv; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::c31) smtp.mailfrom=wlosh@bsdimp.com Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-5c697fc4aa2so1918726eaf.2 for ; Sat, 13 Jul 2024 07:57:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1720882656; x=1721487456; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=K4xbI/36PM50MqO62dfkw0j1/V8DWglcU0j2fYz0pfg=; b=yMlhtqBvoNcFivsvx94Ikt6+ai6PC+Z+zcnILrixlddJfU27DnYFVqPk3RI3bcS/LR jvMo5e3HjDU8BBmG+n+GAPw2mHDejk/YiuUvewfXGtw0VykTpealt2X3qEoeG8CvpMZJ uYKZ03uIvpXuL3m9KJsXbWSb6vRA4DzKV+nMIYTL1exz3Eszr8ZkrtE2ADcuu0qG0D4S tFBwMTqc31OJ/W0r/FuTQAMKOm6fd2hlKpBPX/jRFzaPS2ktrN3ZfHaiDMF8u4Rc8Z0J u7yprxhQG4XUeslH3WNmWqUAMSPUcjVEGy4+0d05tpEHM+DcswIhfuYm59WBJ9SScd5c 0wfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720882656; x=1721487456; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=K4xbI/36PM50MqO62dfkw0j1/V8DWglcU0j2fYz0pfg=; b=PYLTvLUo3pabuUEmzXqNGx8CLHBqLspF/hmwCF1AiO83MwTcWIb9ON75LUcx7VM/1G Kq66TxYW64QtXzrp+WfhzGSRg36uB/CYnHXrC3UI7Rjl+vYt6mYNilxVAzzCZwtgtr4D okaKoqF9GKr9+OBC9f7c10PVNK9Ft7TWl4AdQRTor1+spGye6nly9Yov7ftauNIPoEmM UDgSUw41dHXIUvhVA4pLpatwVSvMyCM4qwZYhkDDHOp7QPuXdjJ5lehMR4Wn3TTeIhCr nacoxTc3mP2ny+ti1ePWmPvx8XetmwHtLgLxg/mSPO7byTi9vAB1WNy/6ZW1i1zqLDia Qizg== X-Forwarded-Encrypted: i=1; AJvYcCVPSbMeeCFLP59Y5cXQrkAuGVe7reodyHr0RGwfF24x++LjuA3ad7H1d5BsvIW9s4TalkOSJzCoQKlgZv9h/FSlxjR8RrJfhfhgitiIsSeIRw== X-Gm-Message-State: AOJu0YzTksGjO2jLFiEX32MONCjaz/unp444PQercn4u5TgmOhUUe4M+ EJkcnJFWi/0gATLdB3ZNV0AGMeMeRQPm8pyu0HJnJNH3/NCUlvhIbj8u0+1HdWQUyrokgRIWJks DQfvSf0OKSjCQ+BrjeTQDhupvzf5MXGzyIE2JtQ== X-Google-Smtp-Source: AGHT+IGktudakV+7XzQbcTKsQItvefZCJfCCnMuIVi9Hjwt19FGBIkEQFx5a8X7k6aIqWd0WeJ2WTdJYKo3xyGjlkWc= X-Received: by 2002:a05:6358:6f19:b0:1ac:671a:f39f with SMTP id e5c5f4694b2df-1ac671af3f6mr94176655d.11.1720882656403; Sat, 13 Jul 2024 07:57:36 -0700 (PDT) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 References: <202406281500.45SF0sOZ057462@gitrepo.freebsd.org> In-Reply-To: From: Warner Losh Date: Sat, 13 Jul 2024 08:57:20 -0600 Message-ID: Subject: Re: git: fc3e5334ab89 - main - Fix "%hhi" conversion for kvprintf() To: Konstantin Belousov Cc: Warner Losh , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="0000000000006f7e83061d223750" X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.97)[-0.974]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20230601.gappssmtp.com:s=20230601]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::c31:from]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_COUNT_ONE(0.00)[1]; MISSING_XM_UA(0.00)[]; ARC_NA(0.00)[]; DMARC_NA(0.00)[bsdimp.com]; FREEMAIL_TO(0.00)[gmail.com]; MLMMJ_DEST(0.00)[dev-commits-src-main@freebsd.org]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; R_SPF_NA(0.00)[no SPF record]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-main@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20230601.gappssmtp.com:+] X-Rspamd-Queue-Id: 4WLs5G0jXRz4WyZ --0000000000006f7e83061d223750 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jun 28, 2024 at 9:13=E2=80=AFAM Konstantin Belousov wrote: > On Fri, Jun 28, 2024 at 03:00:54PM +0000, Warner Losh wrote: > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3Dfc3e5334ab891eab22a4278384be6f9= b74d6d91a > > > > commit fc3e5334ab891eab22a4278384be6f9b74d6d91a > > Author: Sebastian Huber > > AuthorDate: 2024-06-13 11:01:31 +0000 > > Commit: Warner Losh > > CommitDate: 2024-06-28 14:57:39 +0000 > > > > Fix "%hhi" conversion for kvprintf() > > > > The signedness of "char" is implementation-dependent. > > > > Reviewed by: imp,zlei,nightquick@proton.me > > Pull Request: https://github.com/freebsd/freebsd-src/pull/1290 > > --- > > sys/kern/subr_prf.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c > > index e291a1fa00a6..4dc989e2d1f1 100644 > > --- a/sys/kern/subr_prf.c > > +++ b/sys/kern/subr_prf.c > > @@ -904,7 +904,7 @@ handle_sign: > > else if (hflag) > > num =3D (short)va_arg(ap, int); > > else if (cflag) > > - num =3D (char)va_arg(ap, int); > > + num =3D (signed char)va_arg(ap, int); > > else > > num =3D va_arg(ap, int); > > number: > Isn't the same fix needed for libexec/rtld-elf/rtld_printf.c ? > Oh I believe that it is. The code is different in appearance, but it's clear that this is needed there too... I'm a little behind on things, but I hadn't forgotten. Warner --0000000000006f7e83061d223750 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Fri, Jun 28, 2024 at 9:13=E2=80=AF= AM Konstantin Belousov <kostikbel= @gmail.com> wrote:
On Fri, Jun 28, 2024 at 03:00:54PM +0000, Warner Losh wrote:
> The branch main has been updated by imp:
>
> URL: https://= cgit.FreeBSD.org/src/commit/?id=3Dfc3e5334ab891eab22a4278384be6f9b74d6d91a<= /a>
>
> commit fc3e5334ab891eab22a4278384be6f9b74d6d91a
> Author:=C2=A0 =C2=A0 =C2=A0Sebastian Huber <
sebastian.huber@embedded-b= rains.de>
> AuthorDate: 2024-06-13 11:01:31 +0000
> Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org>
> CommitDate: 2024-06-28 14:57:39 +0000
>
>=C2=A0 =C2=A0 =C2=A0Fix "%hhi" conversion for kvprintf()
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0The signedness of "char" is implementatio= n-dependent.
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0Reviewed by: imp,zlei,nightquick@proton.me
>=C2=A0 =C2=A0 =C2=A0Pull Request: https://github= .com/freebsd/freebsd-src/pull/1290
> ---
>=C2=A0 sys/kern/subr_prf.c | 2 +-
>=C2=A0 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
> index e291a1fa00a6..4dc989e2d1f1 100644
> --- a/sys/kern/subr_prf.c
> +++ b/sys/kern/subr_prf.c
> @@ -904,7 +904,7 @@ handle_sign:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0else if (hflag)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0num =3D (short)va_arg(ap, int); >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0else if (cflag)
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0num =3D (char)va_arg(ap, int);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0num =3D (signed char)va_arg(ap, int); >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0else
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0num =3D va_arg(ap, int);
>=C2=A0 number:
Isn't the same fix needed for libexec/rtld-elf/rtld_printf.c ?

Oh I believe that it is. The code is different = in appearance, but it's clear that this is needed there too... I'm = a little behind on things, but I hadn't forgotten.

Warner
--0000000000006f7e83061d223750-- From nobody Sat Jul 13 17:47:14 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLwry4Bv8z5QnlZ; Sat, 13 Jul 2024 17:47:14 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLwry3wRBz4qXc; Sat, 13 Jul 2024 17:47:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720892834; 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=nmfS06E+nG4HRLrczh4KompgsPmp5VAB+LhwlnDNgHo=; b=uMDwUTLt1ZbTgVuCvQAVRtSi6/ajY4lsCxCdjo1sXWbqmWKU8nTRsAkPD7iILVYOaBfSo2 sBEDbptL34RFZvFLSo8mE0NWDOAbeV8wHQZQR/FVyIzVfnPBUh9fAM93h81UPIRkHfNBTM HghA5O1GmBFSAi5D6OAUWLHJqtiw0KKtgSWz4GZC7xrsnbp8ufamljPdSwsZSoZUwSV6Kf Rf+M7MAkiKYfdW5S8kxOigACcumZ24KNYYXTbUvIgIN3rN0va4RW/ZLv8u3Ie8UJx1lJD9 48wytXffaUZvHwlIR5LhzvFnDRSs0iwg31RYKPukBZkRryZZfG+KeIdszlIh9g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720892834; a=rsa-sha256; cv=none; b=HvOZcS/Atcsm+2wrDkqdItuVVje/VZPvnaZyxuaSRwvLi+m4L16MO58V0o2y1PFj90Jk9Z pI9BWvPhgjB58IEARbmr99KxJMMrEfYuuJYrXX3Ry46kspPEh5Qz4rXFCZuB8lHd9YfVJ8 pyUTwM/VSKtlAol75T1miLnpvPHxPlUh1qoSH2R0svNEsRgSgRc6ijZT/jvFA0veKfdefY n480XNwbuNTt1LzuFkbOfKPz7enmrTCaDGFfMtw9Y+cTwE9GCy8RpwFve7g4xtMVtsP9Yd wYVRi2F4Rg6BcaXer0rFW2/8QUjG/LjdDS72pFBR79Y1TKog2i/mlrG0/qFHhw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720892834; 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=nmfS06E+nG4HRLrczh4KompgsPmp5VAB+LhwlnDNgHo=; b=EWCjw62QXL6po7EpDnX2dr9Q8q6kKB6kbM7uBYdXLjdg+eqRSVhpRvmQZCtRGD5cyfR3C0 0sED/uvHA7f7PpfmFs3UhSLXJEC+wx5VABljHzAUU6cXGjXxc5FnX9qOZx8rPriOCUXmKN 94F9NobfrUa1XjN3rAB5frCkTJuvmsX+qssLFDFDj9ZsrYz4svCtcXvOAqoihMuflQX2KQ rjuYSZLfL2eAGL4HfKzfYJQC/r/l+0RRTZFiS3ycxYoZhfLZk+FNZaC/U3OIZVfjl3pFVo cejlSLWFuxmI2fBtB0P+Xub42fgwuYYBWQv0WNmluKR2r3eaVevHzNNHmGr7Hw== 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 4WLwry3NVgzbGV; Sat, 13 Jul 2024 17:47:14 +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 46DHlEw5089924; Sat, 13 Jul 2024 17:47:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46DHlEa5089921; Sat, 13 Jul 2024 17:47:14 GMT (envelope-from git) Date: Sat, 13 Jul 2024 17:47:14 GMT Message-Id: <202407131747.46DHlEa5089921@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 3e00c11a4f43 - main - arm64: Support the L3 ATTR_CONTIGUOUS page size in pagesizes[] List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3e00c11a4f43bf1c7b88d25638e2bfee399e7674 Auto-Submitted: auto-generated The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=3e00c11a4f43bf1c7b88d25638e2bfee399e7674 commit 3e00c11a4f43bf1c7b88d25638e2bfee399e7674 Author: Alan Cox AuthorDate: 2024-07-12 07:44:56 +0000 Commit: Alan Cox CommitDate: 2024-07-13 17:43:42 +0000 arm64: Support the L3 ATTR_CONTIGUOUS page size in pagesizes[] Update pagesizes[] to include the L3 ATTR_CONTIGUOUS (L3C) page size, which is 64KB when the base page size is 4KB and 2MB when the base page size is 16KB. Add support for L3C pages to shm_create_largepage(). Add support for creating L3C page mappings to pmap_enter(psind=1). Add support for reporting L3C page mappings to mincore(2) and procstat(8). Update vm_fault_soft_fast() and vm_fault_populate() to handle multiple superpage sizes. Declare arm64 as supporting two superpage reservation sizes, and simulate two superpage reservation sizes, updating the vm_page's psind field to reflect the correct page size from pagesizes[]. (The next patch in this series will replace this simulation. This patch is already big enough.) Co-authored-by: Eliot Solomon Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D45766 --- share/man/man7/arch.7 | 2 +- sys/arm64/arm64/pmap.c | 162 +++++++++++++++++++++++++++++++++----------- sys/arm64/include/param.h | 2 +- sys/arm64/include/vmparam.h | 25 ++++--- sys/kern/imgact_elf.c | 8 ++- sys/kern/kern_mib.c | 8 ++- sys/kern/kern_proc.c | 12 +++- sys/kern/uipc_shm.c | 15 +++- sys/sys/mman.h | 4 +- sys/vm/vm_domainset.c | 3 + sys/vm/vm_fault.c | 32 ++++++--- sys/vm/vm_glue.c | 5 +- sys/vm/vm_kern.c | 5 +- sys/vm/vm_map.c | 46 ++++++++++--- sys/vm/vm_page.c | 6 +- sys/vm/vm_page.h | 2 +- sys/vm/vm_reserv.c | 104 ++++++++++++++++++++++++---- 17 files changed, 344 insertions(+), 97 deletions(-) diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 index f3d2e1036706..88228b807e6a 100644 --- a/share/man/man7/arch.7 +++ b/share/man/man7/arch.7 @@ -218,7 +218,7 @@ is 8 bytes on all supported architectures except i386. .Ss Page Size .Bl -column -offset indent "Architecture" "Page Sizes" .It Sy Architecture Ta Sy Page Sizes -.It aarch64 Ta 4K, 2M, 1G +.It aarch64 Ta 4K, 64K, 2M, 1G .It amd64 Ta 4K, 2M, 1G .It armv7 Ta 4K, 1M .It i386 Ta 4K, 2M (PAE), 4M diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index c3357900e1be..2540b5eaf4b9 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -1631,11 +1631,14 @@ pmap_init(void) if (superpages_enabled) { KASSERT(MAXPAGESIZES > 1 && pagesizes[1] == 0, ("pmap_init: can't assign to pagesizes[1]")); - pagesizes[1] = L2_SIZE; + pagesizes[1] = L3C_SIZE; + KASSERT(MAXPAGESIZES > 2 && pagesizes[2] == 0, + ("pmap_init: can't assign to pagesizes[2]")); + pagesizes[2] = L2_SIZE; if (L1_BLOCKS_SUPPORTED) { - KASSERT(MAXPAGESIZES > 2 && pagesizes[2] == 0, - ("pmap_init: can't assign to pagesizes[2]")); - pagesizes[2] = L1_SIZE; + KASSERT(MAXPAGESIZES > 3 && pagesizes[3] == 0, + ("pmap_init: can't assign to pagesizes[3]")); + pagesizes[3] = L1_SIZE; } } @@ -4959,7 +4962,7 @@ static int pmap_enter_largepage(pmap_t pmap, vm_offset_t va, pt_entry_t pte, int flags, int psind) { - pd_entry_t *l0p, *l1p, *l2p, newpte, origpte; + pd_entry_t *l0p, *l1p, *l2p, *l3p, newpte, origpte, *tl3p; vm_page_t mp; PMAP_LOCK_ASSERT(pmap, MA_OWNED); @@ -4973,9 +4976,11 @@ restart: newpte = pte; if (!pmap_bti_same(pmap, va, va + pagesizes[psind], &newpte)) return (KERN_PROTECTION_FAILURE); - if (psind == 2) { + if (psind == 3) { PMAP_ASSERT_L1_BLOCKS_SUPPORTED; + KASSERT(pagesizes[psind] == L1_SIZE, + ("pagesizes[%d] != L1_SIZE", psind)); l0p = pmap_l0(pmap, va); if ((pmap_load(l0p) & ATTR_DESCR_VALID) == 0) { mp = _pmap_alloc_l3(pmap, pmap_l0_pindex(va), NULL); @@ -5005,7 +5010,9 @@ restart: ("va %#lx changing 1G phys page l1 %#lx newpte %#lx", va, origpte, newpte)); pmap_store(l1p, newpte); - } else /* (psind == 1) */ { + } else if (psind == 2) { + KASSERT(pagesizes[psind] == L2_SIZE, + ("pagesizes[%d] != L2_SIZE", psind)); l2p = pmap_l2(pmap, va); if (l2p == NULL) { mp = _pmap_alloc_l3(pmap, pmap_l1_pindex(va), NULL); @@ -5034,6 +5041,40 @@ restart: ("va %#lx changing 2M phys page l2 %#lx newpte %#lx", va, origpte, newpte)); pmap_store(l2p, newpte); + } else /* (psind == 1) */ { + KASSERT(pagesizes[psind] == L3C_SIZE, + ("pagesizes[%d] != L3C_SIZE", psind)); + l2p = pmap_l2(pmap, va); + if (l2p == NULL || (pmap_load(l2p) & ATTR_DESCR_VALID) == 0) { + mp = _pmap_alloc_l3(pmap, pmap_l2_pindex(va), NULL); + if (mp == NULL) { + if ((flags & PMAP_ENTER_NOSLEEP) != 0) + return (KERN_RESOURCE_SHORTAGE); + PMAP_UNLOCK(pmap); + vm_wait(NULL); + PMAP_LOCK(pmap); + goto restart; + } + mp->ref_count += L3C_ENTRIES - 1; + l3p = (pd_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mp)); + l3p = &l3p[pmap_l3_index(va)]; + } else { + l3p = pmap_l2_to_l3(l2p, va); + if ((pmap_load(l3p) & ATTR_DESCR_VALID) == 0) { + mp = PTE_TO_VM_PAGE(pmap_load(l2p)); + mp->ref_count += L3C_ENTRIES; + } + } + for (tl3p = l3p; tl3p < &l3p[L3C_ENTRIES]; tl3p++) { + origpte = pmap_load(tl3p); + KASSERT((origpte & ATTR_DESCR_VALID) == 0 || + ((origpte & ATTR_CONTIGUOUS) != 0 && + PTE_TO_PHYS(origpte) == PTE_TO_PHYS(newpte)), + ("va %#lx changing 64K phys page l3 %#lx newpte %#lx", + va, origpte, newpte)); + pmap_store(tl3p, newpte); + newpte += L3_SIZE; + } } dsb(ishst); @@ -5072,7 +5113,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_paddr_t opa, pa; vm_page_t mpte, om; bool nosleep; - int lvl, rv; + int full_lvl, lvl, rv; KASSERT(ADDR_IS_CANONICAL(va), ("%s: Address not in canonical form: %lx", __func__, va)); @@ -5128,24 +5169,47 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, if ((flags & PMAP_ENTER_LARGEPAGE) != 0) { KASSERT((m->oflags & VPO_UNMANAGED) != 0, ("managed largepage va %#lx flags %#x", va, flags)); - new_l3 &= ~L3_PAGE; - if (psind == 2) { + if (psind == 3) { PMAP_ASSERT_L1_BLOCKS_SUPPORTED; + new_l3 &= ~L3_PAGE; new_l3 |= L1_BLOCK; - } else /* (psind == 1) */ + } else if (psind == 2) { + new_l3 &= ~L3_PAGE; new_l3 |= L2_BLOCK; + } else /* (psind == 1) */ + new_l3 |= ATTR_CONTIGUOUS; rv = pmap_enter_largepage(pmap, va, new_l3, flags, psind); goto out; } - if (psind == 1) { + if (psind == 2) { /* Assert the required virtual and physical alignment. */ KASSERT((va & L2_OFFSET) == 0, ("pmap_enter: va unaligned")); - KASSERT(m->psind > 0, ("pmap_enter: m->psind < psind")); + KASSERT(m->psind > 1, ("pmap_enter: m->psind < psind")); rv = pmap_enter_l2(pmap, va, (new_l3 & ~L3_PAGE) | L2_BLOCK, flags, m, &lock); goto out; } mpte = NULL; + if (psind == 1) { + KASSERT((va & L3C_OFFSET) == 0, ("pmap_enter: va unaligned")); + KASSERT(m->psind > 0, ("pmap_enter: m->psind < psind")); + rv = pmap_enter_l3c(pmap, va, new_l3 | ATTR_CONTIGUOUS, flags, + m, &mpte, &lock); +#if VM_NRESERVLEVEL > 0 + /* + * Attempt L2 promotion, if both the PTP and a level 1 + * reservation are fully populated. + */ + if (rv == KERN_SUCCESS && + (mpte == NULL || mpte->ref_count == NL3PG) && + (m->flags & PG_FICTITIOUS) == 0 && + vm_reserv_level_iffullpop(m) == 1) { + pde = pmap_l2(pmap, va); + (void)pmap_promote_l2(pmap, pde, va, mpte, &lock); + } +#endif + goto out; + } /* * In the case that a page table page is not @@ -5365,15 +5429,14 @@ validate: * are aligned with each other and an underlying reservation has the * neighboring L3 pages allocated. The first condition is simply an * optimization that recognizes some eventual promotion failures early - * at a lower run-time cost. Then, if both the page table page and - * the reservation are fully populated, attempt L2 promotion. + * at a lower run-time cost. Then, if both a level 1 reservation and + * the PTP are fully populated, attempt L2 promotion. */ if ((va & L3C_OFFSET) == (pa & L3C_OFFSET) && (m->flags & PG_FICTITIOUS) == 0 && - vm_reserv_is_populated(m, L3C_ENTRIES) && + (full_lvl = vm_reserv_level_iffullpop(m)) >= 0 && pmap_promote_l3c(pmap, l3, va) && - (mpte == NULL || mpte->ref_count == NL3PG) && - vm_reserv_level_iffullpop(m) == 0) + full_lvl == 1 && (mpte == NULL || mpte->ref_count == NL3PG)) (void)pmap_promote_l2(pmap, pde, va, mpte, &lock); #endif @@ -5667,6 +5730,8 @@ pmap_enter_l3c(pmap_t pmap, vm_offset_t va, pt_entry_t l3e, u_int flags, ("pmap_enter_l3c: va is not aligned")); KASSERT(!VA_IS_CLEANMAP(va) || (l3e & ATTR_SW_MANAGED) == 0, ("pmap_enter_l3c: managed mapping within the clean submap")); + KASSERT((l3e & ATTR_CONTIGUOUS) != 0, + ("pmap_enter_l3c: l3e is missing ATTR_CONTIGUOUS")); /* * If the L3 PTP is not resident, we attempt to create it here. @@ -5873,14 +5938,12 @@ pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_offset_t end, while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { va = start + ptoa(diff); if ((va & L2_OFFSET) == 0 && va + L2_SIZE <= end && - m->psind == 1 && pmap_ps_enabled(pmap) && + m->psind == 2 && pmap_ps_enabled(pmap) && ((rv = pmap_enter_l2_rx(pmap, va, m, prot, &lock)) == KERN_SUCCESS || rv == KERN_NO_SPACE)) m = &m[L2_SIZE / PAGE_SIZE - 1]; else if ((va & L3C_OFFSET) == 0 && va + L3C_SIZE <= end && - (VM_PAGE_TO_PHYS(m) & L3C_OFFSET) == 0 && - vm_reserv_is_populated(m, L3C_ENTRIES) && - pmap_ps_enabled(pmap) && + m->psind >= 1 && pmap_ps_enabled(pmap) && ((rv = pmap_enter_l3c_rx(pmap, va, m, &mpte, prot, &lock)) == KERN_SUCCESS || rv == KERN_NO_SPACE)) m = &m[L3C_ENTRIES - 1]; @@ -5932,7 +5995,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, { pt_entry_t *l1, *l2, *l3, l3_val; vm_paddr_t pa; - int lvl; + int full_lvl, lvl; KASSERT(!VA_IS_CLEANMAP(va) || (m->oflags & VPO_UNMANAGED) != 0, @@ -6063,18 +6126,17 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, * are aligned with each other and an underlying reservation has the * neighboring L3 pages allocated. The first condition is simply an * optimization that recognizes some eventual promotion failures early - * at a lower run-time cost. Then, attempt L2 promotion, if both the - * PTP and the reservation are fully populated. + * at a lower run-time cost. Then, attempt L2 promotion, if both a + * level 1 reservation and the PTP are fully populated. */ if ((prot & VM_PROT_NO_PROMOTE) == 0 && (va & L3C_OFFSET) == (pa & L3C_OFFSET) && (m->flags & PG_FICTITIOUS) == 0 && - vm_reserv_is_populated(m, L3C_ENTRIES) && + (full_lvl = vm_reserv_level_iffullpop(m)) >= 0 && pmap_promote_l3c(pmap, l3, va) && - (mpte == NULL || mpte->ref_count == NL3PG) && - vm_reserv_level_iffullpop(m) == 0) { + full_lvl == 1 && (mpte == NULL || mpte->ref_count == NL3PG)) { if (l2 == NULL) - l2 = pmap_pde(pmap, va, &lvl); + l2 = pmap_l2(pmap, va); /* * If promotion succeeds, then the next call to this function @@ -8566,7 +8628,7 @@ pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap) { pt_entry_t *pte, tpte; vm_paddr_t mask, pa; - int lvl, val; + int lvl, psind, val; bool managed; PMAP_ASSERT_STAGE1(pmap); @@ -8578,21 +8640,22 @@ pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap) switch (lvl) { case 3: mask = L3_OFFSET; + psind = (tpte & ATTR_CONTIGUOUS) != 0 ? 1 : 0; break; case 2: mask = L2_OFFSET; + psind = 2; break; case 1: mask = L1_OFFSET; + psind = 3; break; default: panic("pmap_mincore: invalid level %d", lvl); } managed = (tpte & ATTR_SW_MANAGED) != 0; - val = MINCORE_INCORE; - if (lvl != 3) - val |= MINCORE_PSIND(3 - lvl); + val = MINCORE_INCORE | MINCORE_PSIND(psind); if ((managed && pmap_pte_dirty(pmap, tpte)) || (!managed && (tpte & ATTR_S1_AP_RW_BIT) == ATTR_S1_AP(ATTR_S1_AP_RW))) val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; @@ -9128,18 +9191,37 @@ pmap_align_superpage(vm_object_t object, vm_ooffset_t offset, { vm_offset_t superpage_offset; - if (size < L2_SIZE) + if (size < L3C_SIZE) return; if (object != NULL && (object->flags & OBJ_COLORED) != 0) offset += ptoa(object->pg_color); + + /* + * Considering the object's physical alignment, is the mapping large + * enough to encompass an L2 (2MB/32MB) superpage ... + */ superpage_offset = offset & L2_OFFSET; - if (size - ((L2_SIZE - superpage_offset) & L2_OFFSET) < L2_SIZE || - (*addr & L2_OFFSET) == superpage_offset) + if (size - ((L2_SIZE - superpage_offset) & L2_OFFSET) >= L2_SIZE) { + /* + * If the virtual and physical alignments differ, then + * increase the virtual address so that the alignments match. + */ + if ((*addr & L2_OFFSET) < superpage_offset) + *addr = (*addr & ~L2_OFFSET) + superpage_offset; + else if ((*addr & L2_OFFSET) > superpage_offset) + *addr = ((*addr + L2_OFFSET) & ~L2_OFFSET) + + superpage_offset; return; - if ((*addr & L2_OFFSET) < superpage_offset) - *addr = (*addr & ~L2_OFFSET) + superpage_offset; - else - *addr = ((*addr + L2_OFFSET) & ~L2_OFFSET) + superpage_offset; + } + /* ... or an L3C (64KB/2MB) superpage? */ + superpage_offset = offset & L3C_OFFSET; + if (size - ((L3C_SIZE - superpage_offset) & L3C_OFFSET) >= L3C_SIZE) { + if ((*addr & L3C_OFFSET) < superpage_offset) + *addr = (*addr & ~L3C_OFFSET) + superpage_offset; + else if ((*addr & L3C_OFFSET) > superpage_offset) + *addr = ((*addr + L3C_OFFSET) & ~L3C_OFFSET) + + superpage_offset; + } } /** diff --git a/sys/arm64/include/param.h b/sys/arm64/include/param.h index ca3fae11c515..6eb58a69dba1 100644 --- a/sys/arm64/include/param.h +++ b/sys/arm64/include/param.h @@ -97,7 +97,7 @@ #define PAGE_SIZE (1 << PAGE_SHIFT) #define PAGE_MASK (PAGE_SIZE - 1) -#define MAXPAGESIZES 3 /* maximum number of supported page sizes */ +#define MAXPAGESIZES 4 /* maximum number of supported page sizes */ #ifndef KSTACK_PAGES #if defined(KASAN) || defined(KMSAN) diff --git a/sys/arm64/include/vmparam.h b/sys/arm64/include/vmparam.h index 28b8380fc7c1..349849845e73 100644 --- a/sys/arm64/include/vmparam.h +++ b/sys/arm64/include/vmparam.h @@ -114,25 +114,34 @@ #endif /* - * Enable superpage reservations: 1 level. + * Enable superpage reservations: 2 levels. */ #ifndef VM_NRESERVLEVEL -#define VM_NRESERVLEVEL 1 +#define VM_NRESERVLEVEL 2 #endif /* - * Level 0 reservations consist of 512 pages when PAGE_SIZE is 4KB, and - * 2048 pages when PAGE_SIZE is 16KB. + * Level 0 reservations consist of 16 pages when PAGE_SIZE is 4KB, and 128 + * pages when PAGE_SIZE is 16KB. Level 1 reservations consist of 32 64KB + * pages when PAGE_SIZE is 4KB, and 16 2M pages when PAGE_SIZE is 16KB. */ -#ifndef VM_LEVEL_0_ORDER #if PAGE_SIZE == PAGE_SIZE_4K -#define VM_LEVEL_0_ORDER 9 +#ifndef VM_LEVEL_0_ORDER +#define VM_LEVEL_0_ORDER 4 +#endif +#ifndef VM_LEVEL_1_ORDER +#define VM_LEVEL_1_ORDER 5 +#endif #elif PAGE_SIZE == PAGE_SIZE_16K -#define VM_LEVEL_0_ORDER 11 +#ifndef VM_LEVEL_0_ORDER +#define VM_LEVEL_0_ORDER 7 +#endif +#ifndef VM_LEVEL_1_ORDER +#define VM_LEVEL_1_ORDER 4 +#endif #else #error Unsupported page size #endif -#endif /** * Address space layout. diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 4cee366ed747..a623a63e9c2e 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1360,8 +1360,12 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) if ((map->flags & MAP_ASLR) != 0) { maxv1 = maxv / 2 + addr / 2; error = __CONCAT(rnd_, __elfN(base))(map, addr, maxv1, - (MAXPAGESIZES > 1 && pagesizes[1] != 0) ? - pagesizes[1] : pagesizes[0], &anon_loc); +#if VM_NRESERVLEVEL > 0 + pagesizes[VM_NRESERVLEVEL] != 0 ? + /* Align anon_loc to the largest superpage size. */ + pagesizes[VM_NRESERVLEVEL] : +#endif + pagesizes[0], &anon_loc); if (error != 0) goto ret; map->anon_loc = anon_loc; diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c index e4f557a3461d..5724ed3f6932 100644 --- a/sys/kern/kern_mib.c +++ b/sys/kern/kern_mib.c @@ -58,6 +58,8 @@ #include #include +#include + SYSCTL_ROOT_NODE(0, sysctl, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "Sysctl internal magic"); SYSCTL_ROOT_NODE(CTL_KERN, kern, CTLFLAG_RW | CTLFLAG_CAPRD | CTLFLAG_MPSAFE, 0, @@ -242,7 +244,11 @@ SYSCTL_PROC(_hw, HW_USERMEM, usermem, SYSCTL_LONG(_hw, OID_AUTO, availpages, CTLFLAG_RD, &physmem, 0, "Amount of physical memory (in pages)"); -u_long pagesizes[MAXPAGESIZES] = { PAGE_SIZE }; +#if VM_NRESERVLEVEL > 0 +_Static_assert(MAXPAGESIZES > VM_NRESERVLEVEL, "MAXPAGESIZES is too small"); +#endif + +u_long __read_mostly pagesizes[MAXPAGESIZES] = { PAGE_SIZE }; static int sysctl_hw_pagesizes(SYSCTL_HANDLER_ARGS) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 2ecc82026b3f..52b361832218 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2542,6 +2542,7 @@ kern_proc_vmmap_resident(vm_map_t map, vm_map_entry_t entry, vm_offset_t addr; vm_paddr_t pa; vm_pindex_t pi, pi_adv, pindex; + int incore; *super = false; *resident_count = 0; @@ -2577,10 +2578,15 @@ kern_proc_vmmap_resident(vm_map_t map, vm_map_entry_t entry, } m_adv = NULL; if (m->psind != 0 && addr + pagesizes[1] <= entry->end && - (addr & (pagesizes[1] - 1)) == 0 && - (pmap_mincore(map->pmap, addr, &pa) & MINCORE_SUPER) != 0) { + (addr & (pagesizes[1] - 1)) == 0 && (incore = + pmap_mincore(map->pmap, addr, &pa) & MINCORE_SUPER) != 0) { *super = true; - pi_adv = atop(pagesizes[1]); + /* + * The virtual page might be smaller than the physical + * page, so we use the page size reported by the pmap + * rather than m->psind. + */ + pi_adv = atop(pagesizes[incore >> MINCORE_PSIND_SHIFT]); } else { /* * We do not test the found page on validity. diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index c83455d1e70b..7672ded459df 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -1589,9 +1589,20 @@ shm_mmap_large(struct shmfd *shmfd, vm_map_t map, vm_offset_t *addr, if (align == 0) { align = pagesizes[shmfd->shm_lp_psind]; } else if (align == MAP_ALIGNED_SUPER) { - if (shmfd->shm_lp_psind != 1) + /* + * MAP_ALIGNED_SUPER is only supported on superpage sizes, + * i.e., [1, VM_NRESERVLEVEL]. shmfd->shm_lp_psind < 1 is + * handled above. + */ + if ( +#if VM_NRESERVLEVEL > 0 + shmfd->shm_lp_psind > VM_NRESERVLEVEL +#else + shmfd->shm_lp_psind > 1 +#endif + ) return (EINVAL); - align = pagesizes[1]; + align = pagesizes[shmfd->shm_lp_psind]; } else { align >>= MAP_ALIGNMENT_SHIFT; align = 1ULL << align; diff --git a/sys/sys/mman.h b/sys/sys/mman.h index cc840fb96d8e..8feba252e2fe 100644 --- a/sys/sys/mman.h +++ b/sys/sys/mman.h @@ -175,7 +175,9 @@ #define MINCORE_REFERENCED_OTHER 0x8 /* Page has been referenced */ #define MINCORE_MODIFIED_OTHER 0x10 /* Page has been modified */ #define MINCORE_SUPER 0x60 /* Page is a "super" page */ -#define MINCORE_PSIND(i) (((i) << 5) & MINCORE_SUPER) /* Page size */ +#define MINCORE_PSIND_SHIFT 5 +#define MINCORE_PSIND(i) (((i) << MINCORE_PSIND_SHIFT) & MINCORE_SUPER) + /* Page size */ /* * Anonymous object constant for shm_open(). diff --git a/sys/vm/vm_domainset.c b/sys/vm/vm_domainset.c index b881466bffe5..f6ac3c984cbf 100644 --- a/sys/vm/vm_domainset.c +++ b/sys/vm/vm_domainset.c @@ -77,6 +77,9 @@ vm_domainset_iter_init(struct vm_domainset_iter *di, struct domainset *ds, * reservation boundary. */ pindex += obj->pg_color; +#if VM_NRESERVLEVEL > 1 + pindex >>= VM_LEVEL_1_ORDER; +#endif pindex >>= VM_LEVEL_0_ORDER; } else #endif diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 3da411643f26..df686f3e46dc 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -380,12 +380,10 @@ vm_fault_soft_fast(struct faultstate *fs) psind = 0; #if VM_NRESERVLEVEL > 0 if ((m->flags & PG_FICTITIOUS) == 0 && - (m_super = vm_reserv_to_superpage(m)) != NULL && - rounddown2(vaddr, pagesizes[m_super->psind]) >= fs->entry->start && - roundup2(vaddr + 1, pagesizes[m_super->psind]) <= fs->entry->end && - (vaddr & (pagesizes[m_super->psind] - 1)) == (VM_PAGE_TO_PHYS(m) & - (pagesizes[m_super->psind] - 1)) && - pmap_ps_enabled(fs->map->pmap)) { + (m_super = vm_reserv_to_superpage(m)) != NULL) { + psind = m_super->psind; + KASSERT(psind > 0, + ("psind %d of m_super %p < 1", psind, m_super)); flags = PS_ALL_VALID; if ((fs->prot & VM_PROT_WRITE) != 0) { /* @@ -398,9 +396,23 @@ vm_fault_soft_fast(struct faultstate *fs) if ((fs->first_object->flags & OBJ_UNMANAGED) == 0) flags |= PS_ALL_DIRTY; } - if (vm_page_ps_test(m_super, flags, m)) { + while (rounddown2(vaddr, pagesizes[psind]) < fs->entry->start || + roundup2(vaddr + 1, pagesizes[psind]) > fs->entry->end || + (vaddr & (pagesizes[psind] - 1)) != + (VM_PAGE_TO_PHYS(m) & (pagesizes[psind] - 1)) || + !vm_page_ps_test(m_super, psind, flags, m) || + !pmap_ps_enabled(fs->map->pmap)) { + psind--; + if (psind == 0) + break; + m_super += rounddown2(m - m_super, + atop(pagesizes[psind])); + KASSERT(m_super->psind >= psind, + ("psind %d of m_super %p < %d", m_super->psind, + m_super, psind)); + } + if (psind > 0) { m_map = m_super; - psind = m_super->psind; vaddr = rounddown2(vaddr, pagesizes[psind]); /* Preset the modified bit for dirty superpages. */ if ((flags & PS_ALL_DIRTY) != 0) @@ -615,10 +627,10 @@ vm_fault_populate(struct faultstate *fs) vaddr = fs->entry->start + IDX_TO_OFF(pidx) - fs->entry->offset; psind = m->psind; - if (psind > 0 && ((vaddr & (pagesizes[psind] - 1)) != 0 || + while (psind > 0 && ((vaddr & (pagesizes[psind] - 1)) != 0 || pidx + OFF_TO_IDX(pagesizes[psind]) - 1 > pager_last || !pmap_ps_enabled(fs->map->pmap))) - psind = 0; + psind--; npages = atop(pagesizes[psind]); for (i = 0; i < npages; i++) { diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 641800413e68..4f8121fa1064 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -106,7 +106,10 @@ #include -#if VM_NRESERVLEVEL > 0 +#if VM_NRESERVLEVEL > 1 +#define KVA_KSTACK_QUANTUM_SHIFT (VM_LEVEL_1_ORDER + VM_LEVEL_0_ORDER + \ + PAGE_SHIFT) +#elif VM_NRESERVLEVEL > 0 #define KVA_KSTACK_QUANTUM_SHIFT (VM_LEVEL_0_ORDER + PAGE_SHIFT) #else #define KVA_KSTACK_QUANTUM_SHIFT (8 + PAGE_SHIFT) diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 1ef3154845b3..a04044463fe2 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -120,7 +120,10 @@ SYSCTL_ULONG(_vm, OID_AUTO, max_kernel_address, CTLFLAG_RD, #endif "Max kernel address"); -#if VM_NRESERVLEVEL > 0 +#if VM_NRESERVLEVEL > 1 +#define KVA_QUANTUM_SHIFT (VM_LEVEL_1_ORDER + VM_LEVEL_0_ORDER + \ + PAGE_SHIFT) +#elif VM_NRESERVLEVEL > 0 #define KVA_QUANTUM_SHIFT (VM_LEVEL_0_ORDER + PAGE_SHIFT) #else /* On non-superpage architectures we want large import sizes. */ diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index fa71bb8a01d6..b9c27e14d1d0 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -1993,8 +1993,15 @@ out: return (result); } +#if VM_NRESERVLEVEL == 1 static const int aslr_pages_rnd_64[2] = {0x1000, 0x10}; static const int aslr_pages_rnd_32[2] = {0x100, 0x4}; +#elif VM_NRESERVLEVEL == 2 +static const int aslr_pages_rnd_64[3] = {0x1000, 0x1000, 0x10}; +static const int aslr_pages_rnd_32[3] = {0x100, 0x100, 0x4}; +#else +#error "Unsupported VM_NRESERVLEVEL" +#endif static int cluster_anon = 1; SYSCTL_INT(_vm, OID_AUTO, cluster_anon, CTLFLAG_RW, @@ -2190,9 +2197,23 @@ again: * Find space for allocation, including * gap needed for later randomization. */ - pidx = MAXPAGESIZES > 1 && pagesizes[1] != 0 && - (find_space == VMFS_SUPER_SPACE || find_space == - VMFS_OPTIMAL_SPACE) ? 1 : 0; + pidx = 0; +#if VM_NRESERVLEVEL > 0 + if ((find_space == VMFS_SUPER_SPACE || + find_space == VMFS_OPTIMAL_SPACE) && + pagesizes[VM_NRESERVLEVEL] != 0) { + /* + * Do not pointlessly increase the space that + * is requested from vm_map_findspace(). + * pmap_align_superpage() will only change a + * mapping's alignment if that mapping is at + * least a superpage in size. + */ + pidx = VM_NRESERVLEVEL; + while (pidx > 0 && length < pagesizes[pidx]) + pidx--; + } +#endif gap = vm_map_max(map) > MAP_32BIT_MAX_ADDR && (max_addr == 0 || max_addr > MAP_32BIT_MAX_ADDR) ? aslr_pages_rnd_64[pidx] : aslr_pages_rnd_32[pidx]; @@ -2656,6 +2677,7 @@ vm_map_pmap_enter(vm_map_t map, vm_offset_t addr, vm_prot_t prot, vm_offset_t start; vm_page_t p, p_start; vm_pindex_t mask, psize, threshold, tmpidx; + int psind; if ((prot & (VM_PROT_READ | VM_PROT_EXECUTE)) == 0 || object == NULL) return; @@ -2710,13 +2732,17 @@ vm_map_pmap_enter(vm_map_t map, vm_offset_t addr, vm_prot_t prot, p_start = p; } /* Jump ahead if a superpage mapping is possible. */ - if (p->psind > 0 && ((addr + ptoa(tmpidx)) & - (pagesizes[p->psind] - 1)) == 0) { - mask = atop(pagesizes[p->psind]) - 1; - if (tmpidx + mask < psize && - vm_page_ps_test(p, PS_ALL_VALID, NULL)) { - p += mask; - threshold += mask; + for (psind = p->psind; psind > 0; psind--) { + if (((addr + ptoa(tmpidx)) & + (pagesizes[psind] - 1)) == 0) { + mask = atop(pagesizes[psind]) - 1; + if (tmpidx + mask < psize && + vm_page_ps_test(p, psind, + PS_ALL_VALID, NULL)) { + p += mask; + threshold += mask; + break; + } } } } else if (p_start != NULL) { diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index e343170eff6a..c9ac79330696 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -5562,7 +5562,7 @@ vm_page_is_valid(vm_page_t m, int base, int size) * (super)page and false otherwise. */ bool -vm_page_ps_test(vm_page_t m, int flags, vm_page_t skip_m) +vm_page_ps_test(vm_page_t m, int psind, int flags, vm_page_t skip_m) { vm_object_t object; int i, npages; @@ -5571,7 +5571,9 @@ vm_page_ps_test(vm_page_t m, int flags, vm_page_t skip_m) if (skip_m != NULL && skip_m->object != object) return (false); VM_OBJECT_ASSERT_LOCKED(object); - npages = atop(pagesizes[m->psind]); + KASSERT(psind <= m->psind, + ("psind %d > psind %d of m %p", psind, m->psind, m)); + npages = atop(pagesizes[psind]); /* * The physically contiguous pages that make up a superpage, i.e., a diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 5422f8df89a0..f419ba8e3d34 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -657,7 +657,7 @@ void vm_page_pqbatch_submit(vm_page_t m, uint8_t queue); bool vm_page_pqstate_commit(vm_page_t m, vm_page_astate_t *old, vm_page_astate_t new); vm_page_t vm_page_prev(vm_page_t m); -bool vm_page_ps_test(vm_page_t m, int flags, vm_page_t skip_m); +bool vm_page_ps_test(vm_page_t m, int psind, int flags, vm_page_t skip_m); void vm_page_putfake(vm_page_t m); void vm_page_readahead_finish(vm_page_t m); int vm_page_reclaim_contig(int req, u_long npages, vm_paddr_t low, diff --git a/sys/vm/vm_reserv.c b/sys/vm/vm_reserv.c index a4bbccdfb428..aa20eca129fb 100644 --- a/sys/vm/vm_reserv.c +++ b/sys/vm/vm_reserv.c @@ -77,6 +77,29 @@ #if VM_NRESERVLEVEL > 0 +/* + * Temporarily simulate two-level reservations. Effectively, VM_LEVEL_0_* is + * level 1, and VM_SUBLEVEL_0_* is level 0. + */ +#if VM_NRESERVLEVEL == 2 +#undef VM_NRESERVLEVEL +#define VM_NRESERVLEVEL 1 +#if VM_LEVEL_0_ORDER == 4 +#undef VM_LEVEL_0_ORDER +#define VM_LEVEL_0_ORDER (4 + VM_LEVEL_1_ORDER) +#define VM_SUBLEVEL_0_NPAGES (1 << 4) +#elif VM_LEVEL_0_ORDER == 7 +#undef VM_LEVEL_0_ORDER +#define VM_LEVEL_0_ORDER (7 + VM_LEVEL_1_ORDER) +#define VM_SUBLEVEL_0_NPAGES (1 << 7) +#else +#error "Unsupported level 0 reservation size" +#endif +#define VM_LEVEL_0_PSIND 2 +#else +#define VM_LEVEL_0_PSIND 1 +#endif + #ifndef VM_LEVEL_0_ORDER_MAX #define VM_LEVEL_0_ORDER_MAX VM_LEVEL_0_ORDER #endif @@ -381,6 +404,27 @@ vm_reserv_insert(vm_reserv_t rv, vm_object_t object, vm_pindex_t pindex) vm_reserv_object_unlock(object); } +#ifdef VM_SUBLEVEL_0_NPAGES +static inline bool +vm_reserv_is_sublevel_full(vm_reserv_t rv, int index) +{ + _Static_assert(VM_SUBLEVEL_0_NPAGES == 16 || + VM_SUBLEVEL_0_NPAGES == 128, + "vm_reserv_is_sublevel_full: unsupported VM_SUBLEVEL_0_NPAGES"); + /* An equivalent bit_ntest() compiles to more instructions. */ + switch (VM_SUBLEVEL_0_NPAGES) { + case 16: + return (((uint16_t *)rv->popmap)[index / 16] == UINT16_MAX); + case 128: + index = rounddown2(index, 128) / 64; + return (((uint64_t *)rv->popmap)[index] == UINT64_MAX && + ((uint64_t *)rv->popmap)[index + 1] == UINT64_MAX); + default: + __unreachable(); + } +} +#endif + /* * Reduces the given reservation's population count. If the population count * becomes zero, the reservation is destroyed. Additionally, moves the @@ -406,11 +450,15 @@ vm_reserv_depopulate(vm_reserv_t rv, int index) ("vm_reserv_depopulate: reserv %p's domain is corrupted %d", rv, rv->domain)); if (rv->popcnt == VM_LEVEL_0_NPAGES) { - KASSERT(rv->pages->psind == 1, + KASSERT(rv->pages->psind == VM_LEVEL_0_PSIND, ("vm_reserv_depopulate: reserv %p is already demoted", rv)); - rv->pages->psind = 0; + rv->pages->psind = VM_LEVEL_0_PSIND - 1; } +#ifdef VM_SUBLEVEL_0_NPAGES + if (vm_reserv_is_sublevel_full(rv, index)) + rv->pages[rounddown2(index, VM_SUBLEVEL_0_NPAGES)].psind = 0; +#endif bit_clear(rv->popmap, index); rv->popcnt--; if ((unsigned)(ticks - rv->lasttick) >= PARTPOPSLOP || @@ -522,12 +570,17 @@ vm_reserv_populate(vm_reserv_t rv, int index) index)); KASSERT(rv->popcnt < VM_LEVEL_0_NPAGES, ("vm_reserv_populate: reserv %p is already full", rv)); - KASSERT(rv->pages->psind == 0, + KASSERT(rv->pages->psind >= 0 && + rv->pages->psind < VM_LEVEL_0_PSIND, ("vm_reserv_populate: reserv %p is already promoted", rv)); KASSERT(rv->domain < vm_ndomains, ("vm_reserv_populate: reserv %p's domain is corrupted %d", rv, rv->domain)); bit_set(rv->popmap, index); +#ifdef VM_SUBLEVEL_0_NPAGES + if (vm_reserv_is_sublevel_full(rv, index)) + rv->pages[rounddown2(index, VM_SUBLEVEL_0_NPAGES)].psind = 1; +#endif rv->popcnt++; if ((unsigned)(ticks - rv->lasttick) < PARTPOPSLOP && rv->inpartpopq && rv->popcnt != VM_LEVEL_0_NPAGES) @@ -542,10 +595,10 @@ vm_reserv_populate(vm_reserv_t rv, int index) rv->inpartpopq = TRUE; TAILQ_INSERT_TAIL(&vm_rvd[rv->domain].partpop, rv, partpopq); } else { - KASSERT(rv->pages->psind == 0, + KASSERT(rv->pages->psind == VM_LEVEL_0_PSIND - 1, ("vm_reserv_populate: reserv %p is already promoted", rv)); - rv->pages->psind = 1; + rv->pages->psind = VM_LEVEL_0_PSIND; } vm_reserv_domain_unlock(rv->domain); } @@ -889,13 +942,18 @@ out: static void vm_reserv_break(vm_reserv_t rv) { + vm_page_t m; int hi, lo, pos; vm_reserv_assert_locked(rv); CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); vm_reserv_remove(rv); - rv->pages->psind = 0; + m = rv->pages; +#ifdef VM_SUBLEVEL_0_NPAGES + for (; m < rv->pages + VM_LEVEL_0_NPAGES; m += VM_SUBLEVEL_0_NPAGES) +#endif + m->psind = 0; hi = lo = -1; pos = 0; for (;;) { @@ -1089,7 +1147,11 @@ vm_reserv_level(vm_page_t m) vm_reserv_t rv; rv = vm_reserv_from_page(m); +#ifdef VM_SUBLEVEL_0_NPAGES + return (rv->object != NULL ? 1 : -1); +#else return (rv->object != NULL ? 0 : -1); +#endif } /* @@ -1102,7 +1164,15 @@ vm_reserv_level_iffullpop(vm_page_t m) vm_reserv_t rv; rv = vm_reserv_from_page(m); - return (rv->popcnt == VM_LEVEL_0_NPAGES ? 0 : -1); + if (rv->popcnt == VM_LEVEL_0_NPAGES) { +#ifdef VM_SUBLEVEL_0_NPAGES + return (1); + } else if (rv->pages != NULL && + vm_reserv_is_sublevel_full(rv, m - rv->pages)) { +#endif + return (0); + } + return (-1); } /* @@ -1357,6 +1427,10 @@ vm_reserv_size(int level) switch (level) { case 0: +#ifdef VM_SUBLEVEL_0_NPAGES + return (VM_SUBLEVEL_0_NPAGES * PAGE_SIZE); + case 1: +#endif return (VM_LEVEL_0_SIZE); case -1: return (PAGE_SIZE); @@ -1432,12 +1506,16 @@ vm_reserv_to_superpage(vm_page_t m) VM_OBJECT_ASSERT_LOCKED(m->object); rv = vm_reserv_from_page(m); - if (rv->object == m->object && rv->popcnt == VM_LEVEL_0_NPAGES) - m = rv->pages; - else - m = NULL; - - return (m); + if (rv->object == m->object) { + if (rv->popcnt == VM_LEVEL_0_NPAGES) + return (rv->pages); +#ifdef VM_SUBLEVEL_0_NPAGES + if (vm_reserv_is_sublevel_full(rv, m - rv->pages)) + return (rv->pages + rounddown2(m - rv->pages, + VM_SUBLEVEL_0_NPAGES)); +#endif + } + return (NULL); } #endif /* VM_NRESERVLEVEL > 0 */ From nobody Sat Jul 13 19:49:35 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WLzZ76gf9z5R1VR; Sat, 13 Jul 2024 19:49:35 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WLzZ768xFz428g; Sat, 13 Jul 2024 19:49:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720900175; 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=IyzedditnouSEDptC8Ly9x9bT9QCPme9emRUIeogtCg=; b=AeZdu/ONPc5bOB2i0zG1MX7w99YzcNKFajHFHtnaPH2qXfOf7ElD7FA0WyVv5eSqLEafc2 QEyyWjjzEjBufniT5KBjnjBewDDj39y+hUSHgH/lnidZB6fvmDHz5UsAzAEYpuIO8uZNyv 6EYzP7CQ/Okz1HuTsxdTrG4Igd7d8mDqpJj2zKCGA74JpC0Im/hhlVLAWn6qo+IIxFmrhr VdxIN9q1LTP2BZbz6WSu3D/IIrVGZju8hB8eOyCye24hNvTNpvEqWx2s+IoR0YJ2BR+odu WgzQ917xXoMH7HLbdroOo+pVkVQ4WmJmGOLnduKLMWutYxOZ1ce+N0SYUn24zA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720900175; a=rsa-sha256; cv=none; b=vKx8GlPBu2313KpZHpWZ4VuyT5Acaji8j6qQ1/lN2LOlSoZgPlIGwFItJoSfQ6j2X1yLez PeMshG/PFIrFv3YQc4FpjJQIfsE+TrkC35pI17kChxDwhLyogJ72RFgd/Slvte8r9nuOG0 8KPGm07yjjYxrlkn7QI9UkHWvh5uKRQ1KjHrp98Ygzj6SG5ACm3ByNZffX9PTwGslY5HdW StS2/UlmieNONUtO3hYcRPtPhvj5zypgmyQTkSvHhtYKOfyTCwP9F03g13uBOkayLVJJjc i8G2c1fCQBppfvYtclSRIWvBLWqZpGq9HXwRZa5my4raN5e/uje/ArnEgkW8OA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720900175; 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=IyzedditnouSEDptC8Ly9x9bT9QCPme9emRUIeogtCg=; b=ZOIsDmxxDDhly+Ex4lQ6+RcBXS7l/D9u8rGhe0zsG/K4uVmUGWZgNyBq+ItX3c+NEnjwEK 4H2ZnCz1ngSGNPTlI2JRQvDQfuKbHLJ4MBdBMPcKJTtafBFC7PVPmP1W4LKfrOG6Pq4Opp mc6qZpaJYIgPzHN261cKhV/wOy56LIo/hXDMjI2+gvmNamtnD30Sg3efq61JBLNx5mfzoN lwInB8CRKLg0/P6nj39MRNmRYzimyzmOV32OHCA3eBxh4UskDpCOEsBF+CmOcbvkPrlD6x i/lAyKwQ2VjzP0MFtnZcFksIl5G9ipyzwbLrP52eaOcBtZfdSKsSsvnBckQMHg== 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 4WLzZ75lDbzg2Y; Sat, 13 Jul 2024 19:49:35 +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 46DJnZFP094135; Sat, 13 Jul 2024 19:49:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46DJnZiE094132; Sat, 13 Jul 2024 19:49:35 GMT (envelope-from git) Date: Sat, 13 Jul 2024 19:49:35 GMT Message-Id: <202407131949.46DJnZiE094132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 772ae9eddf87 - main - vm ASLR: Handle VM_NRESERV_LEVEL == 0 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 772ae9eddf87d835279ea6aaaf08b8ca421101ff Auto-Submitted: auto-generated The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=772ae9eddf87d835279ea6aaaf08b8ca421101ff commit 772ae9eddf87d835279ea6aaaf08b8ca421101ff Author: Alan Cox AuthorDate: 2024-07-13 19:40:43 +0000 Commit: Alan Cox CommitDate: 2024-07-13 19:40:43 +0000 vm ASLR: Handle VM_NRESERV_LEVEL == 0 Some flavors of powerpc don't enable superpage reservations. Fixes: 3e00c11a4f43 ("arm64: Support the L3 ATTR_CONTIGUOUS page ...") --- sys/vm/vm_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index b9c27e14d1d0..77297a0e3957 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -1993,7 +1993,7 @@ out: return (result); } -#if VM_NRESERVLEVEL == 1 +#if VM_NRESERVLEVEL <= 1 static const int aslr_pages_rnd_64[2] = {0x1000, 0x10}; static const int aslr_pages_rnd_32[2] = {0x100, 0x4}; #elif VM_NRESERVLEVEL == 2 From nobody Sun Jul 14 03:23:14 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WM9dZ4cv4z5Q1Dc; Sun, 14 Jul 2024 03:23:14 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WM9dZ45PFz4tCN; Sun, 14 Jul 2024 03:23:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720927394; 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=kOewz8ZaEM+8Lhl016QVoO6nzQxVsAzW4Xovet3qkEY=; b=DVV7Pp+s9CDBr+FxhDFaSjErdLxobw7ruy8TEptkFbHXx4ZpF3Bgfrrey3IpAQpjtCdhuC W2p3PnNTXgeSMvjhuI+7Pre1fpRKwGX+ThOdicTiOfoztcPPeXPT/+85LziGQHbMXN7g5e hiT9LULoZQcVDdUXcpvxfLRnomvI6jIOplT7Ml10GcV10vv8XrycKPhblNW2y5UfgnTf79 /VCL7+Y5GHS16PFfqdr9oJBGzoIIWb5lMMA5ST3/vFRVd70LZ/TwaN6HH+YpPcvCUbzO6w NvpiduibsPO73/zs3oZw9GuutrF00Gi8FCAVLsYzIzl7Gppwj4gvwsWTnTQ7iw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720927394; a=rsa-sha256; cv=none; b=Sh+LtuwjF6yx9aU9kgLIildpd2EOQvHJop8oKHlv7XoQGWvfgEKEwHI30u7La5FQSJSky7 BvSH5y9m9Y2o/QwKLROdzGOAS9lHxB6V3fnH5gnSgXKbjUpK8Q1St/+WBVZM+e4nN8W6h7 LO/VlV2zMtCejVkbmmRDhYsH9aUJ7CqkNtH5Gd8W44SN8eQvwFIL8SO1zuOkw44XCaz5EF sqQblEO+ruVfmoJKf5fD+0EjMDF95dzdikR8HZLJ1vdrHaaaNgOxLzNCLpYBlTR6OW9LRi hUzmNLQSadWCXhuSpY1II8d7Eh9p/wG0AijqE12CHK4MjkUFCgP+zUNwKmg7Uw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720927394; 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=kOewz8ZaEM+8Lhl016QVoO6nzQxVsAzW4Xovet3qkEY=; b=XOoXUy9oXgAIoyyT654+JZIrDIY/+N9xJ5RPW2OhYG07fZvoAJIpUokKuOZBot1qZHKrvI HzJ4//3A/N838Tl2+ZT5kuHVsMkR0mevmBjVmDIJTzhrYy3lIFLHxfsZuPKawMIPapAYEd 1apDXlVkowoYeo+YuTLSUjJhV1w3t4LfYhIdONrIs90dlfTMmSya+r2eDGFuV7Q22Y4tIf szmbVxQhUNK1GCo6iFOXR4w9NKGan6yIWtSSX9hk3X84D2rchNcsQ6zvP7lp5o2SHgM2NP o0whCcQ1NjjGpwW92qOItmJQzgUwfD5EFRmZy9lCpfjR+sLum6ErPBtVI/Wl2g== 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 4WM9dZ3jBHzsvg; Sun, 14 Jul 2024 03:23:14 +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 46E3NEhV079107; Sun, 14 Jul 2024 03:23:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46E3NE83079104; Sun, 14 Jul 2024 03:23:14 GMT (envelope-from git) Date: Sun, 14 Jul 2024 03:23:14 GMT Message-Id: <202407140323.46E3NE83079104@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 616dd88a2e68 - main - amd64 pmap_allocpte_nosleep(): fix indent List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 616dd88a2e68c1243e4c8b57e883742937a61af0 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=616dd88a2e68c1243e4c8b57e883742937a61af0 commit 616dd88a2e68c1243e4c8b57e883742937a61af0 Author: Konstantin Belousov AuthorDate: 2024-07-13 04:05:36 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-14 03:22:45 +0000 amd64 pmap_allocpte_nosleep(): fix indent Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D45966 --- sys/amd64/amd64/pmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 9f85e903cd74..337edd646ca0 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -4761,8 +4761,8 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, } if ((*pdp & PG_V) == 0) { /* Have to allocate a new pd, recurse */ - if (pmap_allocpte_nosleep(pmap, pmap_pdpe_pindex(va), - lockp, va) == NULL) { + if (pmap_allocpte_nosleep(pmap, pmap_pdpe_pindex(va), + lockp, va) == NULL) { pmap_allocpte_free_unref(pmap, va, pmap_pml4e(pmap, va)); pmap_free_pt_page(pmap, m, true); From nobody Sun Jul 14 03:23:15 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WM9db5ynhz5Q1Xn; Sun, 14 Jul 2024 03:23: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WM9db5TgZz4t6L; Sun, 14 Jul 2024 03:23:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720927395; 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=P1JBPpQaF84/9qWdUgqYCdYv9x/W65Q9T4cpgpT/cVA=; b=DbTt22f5iir93Oo5wbWRt1Se+ZHenxgAClSkIS9xLrK1ZOSgauUmi5MlPM5u9222ZpLlde 6bihqvKMrophEcrV214m39atwnchfsWcvhTbfnjf3cqC/ma7H5OB7V+XlNh9Nw9NHx7wQT 9iWUixFjR92o0WJIdgOY+TbEjsOxxprvyXvxSB4Ono5TLmevz+7r7IBTq4H57MoFRwcXcj IThvqq3BSN7EDGVotK9oYA4DZEYkFxFhCLJm8j5Y/2DxxbKUtly9VkN4T3CoUzdIsfxKlX N+ep64G5E/Y5KoHxxhmgctDClhlHd7UONRCEeVjacu9A/1rvb7Isizt/YQ6EAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720927395; a=rsa-sha256; cv=none; b=Kg8IK33OeYLOWj+K5T811i5Jn/AbBgu6K7Pf+oNKy8rNzAP2yUbHS2Hb+bh+3BvJyVK7LX 7GYmYmusgfbSIwIMgZjzRljjl60ksGc25y0wX0fodpa7UwEeTyVc/z5lq8DKj1vZhV0csd z/9TBWe1AgqX/34Ol8aWIKaqR9avS/L3XnulUTntPVEuOE0HTps5uUJ2B6V8Yf/5/kwGg2 96wgV0/ETLb+S18pS7G8/3LHcxnI2d7Y7qxv8qwjdIQ9cJ2AHq2ezm7SALegDSIsEUFuAV /hJzI8O3dcUFC2Gmw2x6/KSMlh4QdsUY1z1RyxH2tau41MICwUMyj/GUfivJog== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720927395; 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=P1JBPpQaF84/9qWdUgqYCdYv9x/W65Q9T4cpgpT/cVA=; b=iGSSnmOPoHWUXYVKt6/5mscGgYLCAmF1/P7BhNki73TdMZuQkqFzvf3D5ylDcIk3jjqSFU NqgIKka28ADWq3RCrmvJLx5s9dtK7dcKAc8ANeufzNz9pVT0iqSYdhxALaqEBbaEjrTSA1 E2ZaWPw+Glx2cTIlL+4i6rMiWvZYMU6KFGn9R4hDzOjbeLEzkQrsCynsgQ3vL1hdgv7t/S nwnn21eb8oe6z6KC6widn/O3af+B5c1M10QanM4eLtWWrzlPGqJfbi5oIk3jjjbXf3u+Iu l2zgHUt/4E+4owF11NJ7byTsY10rQ54j6HEmWZOEETw0Xqla1M3RmqOW7wTI+A== 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 4WM9db5329zsJM; Sun, 14 Jul 2024 03:23: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 46E3NFNd079152; Sun, 14 Jul 2024 03:23:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46E3NF1Z079149; Sun, 14 Jul 2024 03:23:15 GMT (envelope-from git) Date: Sun, 14 Jul 2024 03:23:15 GMT Message-Id: <202407140323.46E3NF1Z079149@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 10a6ae0ddffb - main - amd64 pmap_allocpte_nosleep(): stop testing tautological condition List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 10a6ae0ddffb1de842a0ba6a6ca29786de6d3bfd Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=10a6ae0ddffb1de842a0ba6a6ca29786de6d3bfd commit 10a6ae0ddffb1de842a0ba6a6ca29786de6d3bfd Author: Konstantin Belousov AuthorDate: 2024-07-13 04:07:18 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-14 03:22:45 +0000 amd64 pmap_allocpte_nosleep(): stop testing tautological condition Enabled PTI for given pmap is equivalent to pm_ucr3 being valid is equivalent to root userspace page table page pm_pmltopu being allocated. Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D45966 --- sys/amd64/amd64/pmap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 337edd646ca0..dcf9b4f5a4f3 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -4707,8 +4707,8 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, *pml5 = VM_PAGE_TO_PHYS(m) | PG_U | PG_RW | PG_V | PG_A | PG_M; if (pmap->pm_pmltopu != NULL && pml5index < NUPML5E) { - if (pmap->pm_ucr3 != PMAP_NO_CR3) - *pml5 |= pg_nx; + MPASS(pmap->pm_ucr3 != PMAP_NO_CR3); + *pml5 |= pg_nx; pml5u = &pmap->pm_pmltopu[pml5index]; *pml5u = VM_PAGE_TO_PHYS(m) | PG_U | PG_RW | PG_V | @@ -4728,6 +4728,8 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, if (!pmap_is_la57(pmap) && pmap->pm_pmltopu != NULL && pml4index < NUPML4E) { + MPASS(pmap->pm_ucr3 != PMAP_NO_CR3); + /* * PTI: Make all user-space mappings in the * kernel-mode page table no-execute so that @@ -4735,8 +4737,7 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, * the kernel-mode page table active on return * to user space. */ - if (pmap->pm_ucr3 != PMAP_NO_CR3) - *pml4 |= pg_nx; + *pml4 |= pg_nx; pml4u = &pmap->pm_pmltopu[pml4index]; *pml4u = VM_PAGE_TO_PHYS(m) | PG_U | PG_RW | PG_V | From nobody Sun Jul 14 06:00:19 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WMF6q5lmdz5QJHs; Sun, 14 Jul 2024 06:00: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WMF6q4pwXz4Cqk; Sun, 14 Jul 2024 06:00:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720936819; 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=RV9QWuiNYVnPX5mh++OHNKkv1OMPVmWPmw2mxS1LlJw=; b=bWkk/4mGIOEgzQuZyxZBfWRb6E24H83nDjT1RuqVuE+DPfz31A3wYFeEj5/3Wn1leiIE1z XByyCF96xInxuAjt2ZLb5MK4/UX9QhHJ4TD/mop5HbOj3xLOSzKWJ8F9pJThzADMuQCunN wN2R/TeTe0cVeZDs7EIrNqVuoZkDHdOJRVMIeBJGHRcTGapkHcrlZ/lLwUJKlfELHG/iMG gnwrdqiePGtBfbGapoDom31XCr4b89eTGlkvpP+yRy9rW1yj+wAyxdU+ymJ6ELcMC6jTud aiTgRA+c8uIKB/jXKwUhDSR7UQe0As85OldGgug2S5UxOGbtUdn3Kd0TgMO/Aw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720936819; a=rsa-sha256; cv=none; b=I3ZjRLKGJ35PGB0wgL7U6Knq3LOqFDNrzig24Jzo/TBpV9elEbcfUytYE0hhqjGuU8yszg 04I3hqI4ztz01cD1y51BxwZj2CIHQmkkwsNKZ3OIvOCN3PZBY3Cu05FAbYJsI3TsYPqhZw fZUzEt6Kdz1O86PWhGQ5HlaVsDi2uvizwtykOXdq3EKAOYxr9zMiujGwDmUN9jrxahxuPW /dU4bVmKxKcnpLTOUGWYm5znlhr9fwRLbU2LrApzuwrR4Iij1fGx16CX2szaiyg5Pq6vui vno7fpRkCTMybxG/zfcmdKnrLyUAiqzFexqlgBSEKey5wg5QNFtjpGAvu6UwRQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720936819; 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=RV9QWuiNYVnPX5mh++OHNKkv1OMPVmWPmw2mxS1LlJw=; b=PuV+MHxyJ8V/SuOAu2V8p+aDVGZO/NcUrDEwYKX/6q6MzlrkH87uhephvLw0kCxNKDq2yW +twmvydcKhvIhhy6QU0zSEPls/Xn+MaDAz49jqYnhHwZ6fSYo3BVeNDHUKVCFswros77cj YrIYjLe4d4CMPEUkZpK+tK/j40/K3xp0u4X6V65dZ31x401Rwhwhe7cqgzYVs/LnsHsxRv 2aIYu9jgDxmW6c3XY4HqxXnOj3pcT3B/ljeNTiec4GcdyC2K62M+EnFdOoLVEbiHCsjl5c D/cP3gpgkop4cnmEVzkSWnJ8dy474fwWwnMn1FSfqZgQQ9/qZeAv5bDo6dhNqw== 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 4WMF6q4NhCzxv6; Sun, 14 Jul 2024 06:00: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 46E60JEE047513; Sun, 14 Jul 2024 06:00:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46E60JKl047510; Sun, 14 Jul 2024 06:00:19 GMT (envelope-from git) Date: Sun, 14 Jul 2024 06:00:19 GMT Message-Id: <202407140600.46E60JKl047510@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 60f098f84119 - main - arch: Update to remove armv6 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 60f098f841198d06a3b10d66c99c4778f2167fbb Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=60f098f841198d06a3b10d66c99c4778f2167fbb commit 60f098f841198d06a3b10d66c99c4778f2167fbb Author: Warner Losh AuthorDate: 2024-07-14 05:47:20 +0000 Commit: Warner Losh CommitDate: 2024-07-14 05:59:31 +0000 arch: Update to remove armv6 There were two stray places where armv6 remained that shouldn't be there. Remove them. Replace one with aarch64 and update MACHINE_ARCH description of amd64 while I'm here. Eliminate a near-by contraction igor noted. Sponsored by: Netflix --- share/man/man7/arch.7 | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 index 88228b807e6a..21d2b156af87 100644 --- a/share/man/man7/arch.7 +++ b/share/man/man7/arch.7 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 19, 2024 +.Dd July 13, 2024 .Dt ARCH 7 .Os .Sh NAME @@ -161,12 +161,11 @@ Examples are: .Pp .Dv aarch64 will support execution of -.Dv armv6 -or .Dv armv7 binaries if the CPU implements .Dv AArch32 -execution state, however older arm binaries aren't supported. +execution state, however older arm binaries are not supported by +.Fx . .Pp On all supported architectures: .Bl -column -offset -indent "long long" "Size" @@ -374,15 +373,19 @@ It, along with defines the ABI used by the system. Generally, the plain CPU name specifies the most common (or at least first) variant of the CPU. -This is why powerpc and powerpc64 imply 'big endian' while 'armv6' and 'armv7' +This is why powerpc and powerpc64 imply 'big endian' while armv7 and aarch64 imply little endian. If we ever were to support the so-called x32 ABI (using 32-bit pointers on the amd64 architecture), it would most likely be encoded as amd64-x32. -It is unfortunate that amd64 specifies the 64-bit evolution of the x86 -platform (it matches the 'first rule') as everybody else uses x86_64. -There is no standard name for the processor: each OS selects its own -conventions. +It is unfortunate that amd64 specifies the 64-bit evolution of the x86 platform +(it matches the 'first rule') as almost everybody else uses x86_64. +The +.Fx +port was so early, it predated processor name standardization after Intel joined +the market. +At the time, each OS selected its own conventions. +Backwards compatibility means it is not easy to change to the consensus name. .It Dv MACHINE_CPUARCH Represents the source location for a given .Dv MACHINE_ARCH . From nobody Sun Jul 14 18:02:03 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WMY7c0bspz5R6BG; Sun, 14 Jul 2024 18:02:04 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WMY7b4JgFz4V5P; Sun, 14 Jul 2024 18:02:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720980123; 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=l2AkDHKZvZlsHgXLAeOhi3mgKgV/0Umph7izxQ6aEKA=; b=aCMYQWFHGK9pM7JfsZPvxeoQ9BZ3aeAOIxFbvo5eLX4cJndrqRmimuEwLItFobpxFx5c/r mLaibFiUQjV7fJEEI5MDy3MEIDemIHqsWEfZKcMmWjcSu7JPm7VhipsI2G/xWPcZRuXI5F LAP++uacUCQ/4i9GBG8MH2Bv3rQxrE2i377LC3kmqCdg4azv96cK/UzwdiQp7JCHJP63oJ m8cN+W8MVcvQYWf/zIfQTkbgkfIE0mp19KXlf+F4E3LNtpOSL3XfbuCMrpRiSpIIn3QH8q 3/kPYsKWZsHWhNii6z3b9wDDNxGysW720MplMfjA3j/tPMw7KTcgtlHtn1TuSw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720980123; a=rsa-sha256; cv=none; b=BPij1od5ex0YBmyZpDmIj1KFNj8IBz8RRhuSLxJE8dTGnkelNxAjT7sHIAzJiliDDjsq4s 4pQtk8qIes3qj1gbpLoBshZkOhODKBgj8pEguLeUujnkildvqGUsh/2OhM3aTcQAWik5WH 2k9txrsHo1dIaFkaNn5CGdj87MDMkmkCmzCJdTnOhGj+dfcnCPLsrMapin6oR9YwMjHUoS iilS4wpAdmMcp+rQXhaTMraIPKpGNd3ZGpe01W7dw5TL8q1eqhzehJHnRgy86vzIH1bl6V eDvop9wP4WQlhRZ6bJ/KI0H5deSBaXHZCowEaLnrzvY+fqsdvsDqb95Hkzs5Qg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720980123; 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=l2AkDHKZvZlsHgXLAeOhi3mgKgV/0Umph7izxQ6aEKA=; b=MPI1xRTyXAF5gQ/IJ+Sydv+27RoFqmnsB5SWnDQ0l7rWG8aQsICthBx75E/uO3zSiFQfpr 8juH4p6+5dA7yo3MxHG2ia4KMkZENpRiP/h4VRfd+DuVMc/JPy2l7SJLl5uIPU8NQHHwt8 KJjyEwDneslkgUhIYV9eLgN4rvTIwr7iufEvw+U5md0Dpw+GrecrZmvZj4hQzFH2quQWci xF1ZA3pJ+awRBRYFVsVFipV6Ma6Keiz72oM+s4gB8F8A2Z4WrYwaHS3jjudXb07Us2T6uk VKgK6ET8L24QW00Uwini7gaOjwc5V+tCtk6K3eZGAerWdbrg4zImZPwAYiWPWg== 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 4WMY7b3w55zK7v; Sun, 14 Jul 2024 18:02:03 +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 46EI230W074737; Sun, 14 Jul 2024 18:02:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46EI23iO074734; Sun, 14 Jul 2024 18:02:03 GMT (envelope-from git) Date: Sun, 14 Jul 2024 18:02:03 GMT Message-Id: <202407141802.46EI23iO074734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 82dfbaf7e7ca - main - rtld-elf: Fix signed conversion for %hh List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 82dfbaf7e7ca1334960ee918fa1b4eb2537d444b Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=82dfbaf7e7ca1334960ee918fa1b4eb2537d444b commit 82dfbaf7e7ca1334960ee918fa1b4eb2537d444b Author: Warner Losh AuthorDate: 2024-07-14 18:01:43 +0000 Commit: Warner Losh CommitDate: 2024-07-14 18:01:43 +0000 rtld-elf: Fix signed conversion for %hh While char is signed on some of FreeBSD's architecutres, it's unsigned on others. So the naked 'char' cast here needs to be 'signed char' because in this context, we want the signed interpretation. We don't really use %hh conversions in the run time linker, so this is likely a nop. However, for correctness, we need this, like we did in the kernel in fc3e5334ab89. It's a nop on x86 and riscv due to defaults as well, but does fix a bug on arm and powerpc where char is unsigned. Suggested by: kib Sponsored by: Netflix --- libexec/rtld-elf/rtld_printf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld_printf.c b/libexec/rtld-elf/rtld_printf.c index befac1c547b7..45c0bdc00b29 100644 --- a/libexec/rtld-elf/rtld_printf.c +++ b/libexec/rtld-elf/rtld_printf.c @@ -367,7 +367,7 @@ handle_sign: else if (hflag) num = (short)va_arg(ap, int); else if (cflag) - num = (char)va_arg(ap, int); + num = (signed char)va_arg(ap, int); else num = va_arg(ap, int); number: From nobody Sun Jul 14 18:30:14 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WMYm640mHz5R86S; Sun, 14 Jul 2024 18:30:14 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WMYm63Vqqz4XVj; Sun, 14 Jul 2024 18:30:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981814; 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=5JLVKNDOICvU4XFKtsp/t2g9ppwxWt43LkYcdKzDHs4=; b=U1V5lMFjoA9y+kdbsyx7J46nwz+A4PJHCcIx40iZ2pR882Trh9p3BSBJXZOFQoHY69pEpF ChbKet90FKAZP0tSiB3hy0EeyOvaH3A6AhAZFIqs4PNzodGhs3fWFt/5wbm1bXvY8vY7jF f5Jt2cFZB/3zeAQeeLqLTTHj1kjRJhAyTwPBgGnV+hLCNbz3/AVTGKodDYiLXF7EtBi3cf N+E8ri3124xWq+0MUe/aUfs3cRJ766xoG/6qNUabw0Azi5NDwu23hnCCKy2Bf9pgyK1nej B1BUMg/XhiHKZwE4Rg6rVpKMQqGeQa6f0aNmCnwreAfCLoB756wKFeKg0tTRvg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720981814; a=rsa-sha256; cv=none; b=Kz51fuegSx/B0jb49rt5JPEvlQK/lqRSedBcjwZ5jFmU4MhUOP8cOzNlKBl01qbuQasFjE J6gIFu+ApdVcEaQ2nC3ByCXlczYwckv7RIDQHwuEObtD8xwlZcNSxUcWec3k0hWbOL+HOK kp0JNvi9plQ8UGwiMsjuDOXSuvslmGKsqJC3cTkRIrMJMhdpMt9UOcroOaTAu7oltT7PxO NbyO6Aj2Q26to1zOj+wuZyxT2UyS8n8C0RUit52s8XU5HlIdwq7b+9YgIGuiPLQFyrPwQx +OxvgNMDEZctrBk4tMzGsQ6bLq4cizKmFPg9Dya8IeRGADKkVCKv1UFud/ctPA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981814; 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=5JLVKNDOICvU4XFKtsp/t2g9ppwxWt43LkYcdKzDHs4=; b=qQ2gsIbob3ihr3mJbgR8c1WnZd8zZqVO1QbXltPu86MF35y4ltuWMPTzSBwkwzGfbZDmBi g2QeOl2T8I7LrqCOup8snmnf6XRSyhG4+HjWB7uFt5MiV3DlbjoMh9fF1obEclLxSKmdEK 3JwI9CEgCpmuc/2HG5Fqnd8tQKfmj0NPjVk9rPfjAI4LDhQlVx3ryPQAbjvBMo/lh37k/Y KUcBn2c9JI6tQI/D7KtrS5g2nI6rpG6kKdQ2AOp9lwCynTdeKHhSK9xNs+DllA3NTlZdBC 6xbIuaF2ctgVaOeUzcK+nsq4jxtf9iL1WiH0gxEemMAB14qA+uvoewtnDynkyA== 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 4WMYm6348YzKm5; Sun, 14 Jul 2024 18:30:14 +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 46EIUEEE018322; Sun, 14 Jul 2024 18:30:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46EIUEsY018314; Sun, 14 Jul 2024 18:30:14 GMT (envelope-from git) Date: Sun, 14 Jul 2024 18:30:14 GMT Message-Id: <202407141830.46EIUEsY018314@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 7cd91315911d - main - vmm: Conditionalize addition of opt_*.h headers List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7cd91315911d3413ccf527228d4b8c060b681fba Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7cd91315911d3413ccf527228d4b8c060b681fba commit 7cd91315911d3413ccf527228d4b8c060b681fba Author: Mark Johnston AuthorDate: 2024-07-14 16:12:01 +0000 Commit: Mark Johnston CommitDate: 2024-07-14 18:29:14 +0000 vmm: Conditionalize addition of opt_*.h headers These are only included in the amd64 vmm code, so it doesn't make sense to list them unconditionally. PR: 280171 Reviewed by: wosch, imp, emaste Differential Revision: https://reviews.freebsd.org/D45964 --- sys/modules/vmm/Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/modules/vmm/Makefile b/sys/modules/vmm/Makefile index 8f6eb915290a..96155753f1de 100644 --- a/sys/modules/vmm/Makefile +++ b/sys/modules/vmm/Makefile @@ -3,8 +3,13 @@ KMOD= vmm -SRCS= opt_acpi.h opt_bhyve_snapshot.h opt_ddb.h \ - acpi_if.h bus_if.h device_if.h pci_if.h pcib_if.h vnode_if.h +.if ${MACHINE_CPUARCH} == "amd64" +SRCS+= opt_acpi.h \ + opt_bhyve_snapshot.h \ + opt_ddb.h +.endif + +SRCS+= acpi_if.h bus_if.h device_if.h pci_if.h pcib_if.h vnode_if.h CFLAGS+= -DVMM_KEEP_STATS CFLAGS+= -I${SRCTOP}/sys/${MACHINE}/vmm From nobody Sun Jul 14 18:30:15 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WMYm74YHjz5R8Fl; Sun, 14 Jul 2024 18:30: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WMYm73z5Zz4Xs4; Sun, 14 Jul 2024 18:30:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981815; 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=2vk7b/Go/7xwFyEy4s9C9k/DIMIuj1YzsGramfJkRpQ=; b=j4okp1kJRtAGh1RxDIVHWgD+Dr5S1sLI6Y6AnCtGmPEJPoMTyf/PDBZfVxW63mWAJwJsYJ P4eLeW7EHlgQRgyBbuRdBY+Bv7Dl5459E97KvIc1BNSs4BpDBAvRK3hiES/jiCZHu+9Jc1 y1XNb4dQWLroreY+hV0s36vx2RW6f66zVtTfnq4ZW43IXQNpOmZnbvCV5Hlgch5muPUKi9 pBhmdM/+v6oIQQXHO92xmElgxFmDH8W9147opNnGksLfZZsM+kClEii3MjHYbcGeAYRMsY copAwy+zJWisunuXqJTfb+0lU0M1qfYtTcPS3uRGqkTTWBXkrbpGaH37zZKmiw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720981815; a=rsa-sha256; cv=none; b=wPEZslae3jRWyOps5J3IBMbRmFaT/OflAcDePkETG/+OU+OLs7B50r3bgeBmtw21mtRAxe 0HIOzBsAI1rnBdpBt+hX47o9fPRnvfkMFFKqI796wwpIc3tGhXUgcSj53qhJ1LeKdxdKEj dvZM4K8ZiNQDBQrVGIXVzrhkniAnkPaKk5UNhqz8v9D8eYZ6IHaSX2pzoM213fJh0osY/u bQ0RurB9kj9SVE2KIumy0sVRK/pMjb83G5dvgGZIMaSkeLuz/O1JAwKWlgg0TtxBMrz5nG ZiuH7YUbOflgZ/qe1C9sMii2RzOXCau0BDYNRJ3RI/hX7Fa47TNHn8E0e1PSQQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981815; 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=2vk7b/Go/7xwFyEy4s9C9k/DIMIuj1YzsGramfJkRpQ=; b=rJwLByMInwsR+h/hz1FePyQm5tQyfnnFlILrGMdvOS9+ms8djPvZYDVCyncMxOf4/pnXEB /TpkojJ0yOJOCp7lDLVKJxWygBkGYYpdxjYefR8VFi11VN8g+22WHVcm2B+78kxWKqBL71 /wT07GAW2T9nQeqE2LhsuWSO7mA+haxDAXhq0kMZSEhzGzAVyHgtdeGcfVje1vFCbyHPwM WQE/7L0GZMNG8Nx6+M7aCzxIsYL4b9HGZVUWniUwE6e/h7NGcJqfGQpZkMPRBRf2kzGSCW A6V6VVv64DsYvCqXItjwutSX5nX3t96ZQxPrATiFN0h6R0IcVwTkcXHaeINnOw== 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 4WMYm73ZbzzKZQ; Sun, 14 Jul 2024 18:30: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 46EIUF2c019020; Sun, 14 Jul 2024 18:30:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46EIUFUF019011; Sun, 14 Jul 2024 18:30:15 GMT (envelope-from git) Date: Sun, 14 Jul 2024 18:30:15 GMT Message-Id: <202407141830.46EIUFUF019011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5b98bd30686a - main - sched tests: Avoid underflow when maxcpuid == 0 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5b98bd30686a358b2a20728a4a6b5cecb7e28dc9 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5b98bd30686a358b2a20728a4a6b5cecb7e28dc9 commit 5b98bd30686a358b2a20728a4a6b5cecb7e28dc9 Author: Mark Johnston AuthorDate: 2024-07-14 16:12:32 +0000 Commit: Mark Johnston CommitDate: 2024-07-14 18:29:14 +0000 sched tests: Avoid underflow when maxcpuid == 0 MFC after: 1 week --- tests/sys/kern/sched_affinity.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/sys/kern/sched_affinity.c b/tests/sys/kern/sched_affinity.c index cbba226b3fa2..9af6076c1649 100644 --- a/tests/sys/kern/sched_affinity.c +++ b/tests/sys/kern/sched_affinity.c @@ -67,13 +67,16 @@ ATF_TC_BODY(test_setinvalidcpu, tc) { size_t cpusetsize; cpuset_t *set; + int cpu; + + cpu = maxcpuid > 1 ? maxcpuid - 1 : 0; cpusetsize = CPU_ALLOC_SIZE(maxcpuid + 1); set = CPU_ALLOC(maxcpuid + 1); ATF_REQUIRE(set != NULL); CPU_ZERO_S(cpusetsize, set); CPU_SET_S(maxcpuid + 1, cpusetsize, set); - CPU_SET_S(maxcpuid - 1, cpusetsize, set); + CPU_SET_S(cpu, cpusetsize, set); ATF_REQUIRE(sched_setaffinity(0, cpusetsize, set) == 0); CPU_FREE(set); @@ -82,7 +85,7 @@ ATF_TC_BODY(test_setinvalidcpu, tc) ATF_REQUIRE(set != NULL); CPU_ZERO_S(cpusetsize, set); CPU_SET_S(maxcpuid + 1, cpusetsize, set); - CPU_SET_S(maxcpuid - 1, cpusetsize, set); + CPU_SET_S(cpu, cpusetsize, set); ATF_REQUIRE(cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, cpusetsize, set) == -1); ATF_REQUIRE_EQ(errno, EINVAL); From nobody Sun Jul 14 18:30:16 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WMYm86xP7z5R81t; Sun, 14 Jul 2024 18:30: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WMYm84X2Lz4XkX; Sun, 14 Jul 2024 18:30:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981816; 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=xC8/WQP703RrkziLdXi7ndH6Nepwhw0zW3br2mUMYwc=; b=AVaBfgBc+NgLv9yXffXGCZjvGvW1RGkWVTaPlBRcjABCfSmaqLFt33i7u35u0DzBiTh1uq WvstQGn/2YFWoWTylBNOrULEWA6mnmfy6Y4EkM9KkF3ZYiOYrKFbypEbica1EzWIf6by+6 zaAu4+BWPBDZQVG1g/ZDMgleAbn9NVRPQeIF97IQQ2Gnp74Sg0R9nvODJOqZ//Raw4F0zo Tx6bvnZrQ+/d6zHPe23WTfGQcbYZRLuWZaIuBE1Jc8CpqEfhHQ+PGPrcUFcTrGf4kIpneE WqUKcjUuPCMaDILN9lZKnE/JW1iUCTwG4G3ki6G7wHZlYkDOvmpW3HD6RWdtzg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720981816; a=rsa-sha256; cv=none; b=DoyrlcBnFzFnAjQ76OaEttC4xwan0f7ohXOXLgZgFhjuVizuqsPW6/0w5DGybXerGdGlFz HPUb7aisqJjCmhcnDlx34h3g3D/4lZ3ddmcVq3ZjuqJbKB3T+FuAAsJ9rJk8M8X1/43Kf0 q//OGXtUxCyXysquDuidG4HLQIoRyE9fxGoX891VQMfbrfmr2japXUlKrkmLqfeAHFwmeS 7AWizss9n5i5Pn4BVQgmQPx418HSJ2CRtHx4smF+04ATpITa+agTOgtUOVMrCNJed5A++O eMOSyBRrq59f4daBXKptLz7olvBEJ9jgmd1IzJZkdHgK83wiL8QhwEhWKCQuIg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981816; 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=xC8/WQP703RrkziLdXi7ndH6Nepwhw0zW3br2mUMYwc=; b=B5p25dDDTAAWllZ2OAo1+EoIBetPgGLK2rUaLLBIpA19ddBi9z948xu4GDcMtd+25HaJoz D7NEMeL3O6aDMtg2K2/SVuTvI2Q3KfiXmtFTQifFmuT6vOb78GNoNZZVFhjjRGWQm2qAik Wr7KLugGxxPrhCUeAyscPy1JV3/ZWvOtF9puobk4TLTCgFsI0TePC9AGDRAFu8VLDnIR1T J+4dLBgsQjXfCFjqcGpQHfrbCsk5CAI8HeTUiAWQTZ8UyNDjt04t9fsfygTeyR5RR04ntd dB9J2rhE0NJs0k4VuMQ2JeaAdNZ8xV1FCX+Ljy0erl/KuD3x7Z/V1f8MhUgh7Q== 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 4WMYm847zKzKvh; Sun, 14 Jul 2024 18:30: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 46EIUGYm019683; Sun, 14 Jul 2024 18:30:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46EIUGEC019675; Sun, 14 Jul 2024 18:30:16 GMT (envelope-from git) Date: Sun, 14 Jul 2024 18:30:16 GMT Message-Id: <202407141830.46EIUGEC019675@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: ab27e232b14c - main - socket tests: Serialize sonewconn_overflow List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ab27e232b14c07317642a2e4c546c9b71bd9c00b Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ab27e232b14c07317642a2e4c546c9b71bd9c00b commit ab27e232b14c07317642a2e4c546c9b71bd9c00b Author: Mark Johnston AuthorDate: 2024-07-14 16:12:50 +0000 Commit: Mark Johnston CommitDate: 2024-07-14 18:29:14 +0000 socket tests: Serialize sonewconn_overflow It relies on being able inspect the dmesg buffer to see whether the kernel logged certain messages. If it's interleaved with tests that generate large amounts of console output (e.g., GELI tests), then it can fail spuriously. MFC after: 2 weeks --- tests/sys/kern/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile index c5107ce8f9fe..0b9182b0808c 100644 --- a/tests/sys/kern/Makefile +++ b/tests/sys/kern/Makefile @@ -60,6 +60,7 @@ ATF_TESTS_SH+= coredump_phnum_test ATF_TESTS_SH+= sonewconn_overflow TEST_METADATA.sonewconn_overflow+= required_programs="python" TEST_METADATA.sonewconn_overflow+= required_user="root" +TEST_METADATA.sonewconn_overflow+= is_exclusive="true" ATF_TESTS_SH+= sendfile_test ATF_TESTS_SH+= sysctl_security_jail_children TEST_METADATA.sysctl_security_jail_children+= is_exclusive="true" From nobody Sun Jul 14 18:30:17 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WMYmB18Hcz5R86W; Sun, 14 Jul 2024 18:30: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WMYm95DKJz4Y1D; Sun, 14 Jul 2024 18:30:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981817; 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=obMy6WHtUfVUWvQ7lsbZ+AnQ7QQrTa2mq2igJ6ov/zg=; b=Tu7jGb2kRI56AZqKgPv81pE6EtZJoW9CDCWpEOHuwCSdmjmwsXNkd7IjlNrUJHx5kIP7XZ N8hiLl7O4M/OX/srTZZM6x/rk7W8qkgrDjcPP+lzRTRXpKz8ZQZCjnim9+bKomslNhQgWv EfkZbryeVOtujiO5YzFnKxVTW689jT8wPANtWSxxmdD3PiEa/f7InA8FTJ5vXJvmiz6gxP UqOeam7MSvjzcn2VUCqQS7mjXgjara2Yxgn/lbuX5WqO5mo/wPp//CQ0dwjjCqirxTbTLE o5o86S9GCuKP44NwVIhc/FdelbQm6Xc4CnUrQNxEoY3DcgAJc72DOE42y9E/3A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720981817; a=rsa-sha256; cv=none; b=UJS9fBr6KL1tZhrvum+AtH5+IOTzRFdF6cYpSVQpEunb5Xpt+HS4/crNNWLSZ66P3/qaVX S04hG5OpmxD/LGmqK9VYhJoESZZBpsDnPCv+bTzW/oWf3YDOQvS0Ll9/amspGfMq3k8NQB qKJbqlKMgbPc1ZuPe0EhGBv/tD7PtVMdl5tM/4FDWBQy5qi3vgDn5xLA1fjrl3ATNoXhqE PxbhOOWH4MfrjOiD0ykjtctRagP+ISnmKVFtHYt5Os/SwBQvPUrrfhbuDKfThUv7WVFAcL +s1gb9x1VNKj+rR5WGC3VS2xnPAggx62BxZ8+JBJEl/meAGZhzOwpsu/MvxAgA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981817; 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=obMy6WHtUfVUWvQ7lsbZ+AnQ7QQrTa2mq2igJ6ov/zg=; b=XVrNC32X/5vPff3UYNJXuwP2tZgvOZu/bUevhs+nS4QVZOh9RPT8B+sdsb3wdTLHcPnXnl Obj4r4qsh7R8shsryxXPr4eRL9c0nlOgmRtgDnUfd2Mr2pJRLsNmTVCwP6U1OAmnWr+BwM 59JFrqMXAfXDqk5hBhDSvxpE+HM1nFWJGED2tR9vKEpF57wfo1I6TKfPA3nLHbrIbnM/O9 is6OZNfjJcjMuomCZUuTdbCKooCd5WI61zgEXBQtul6JvGyoE/GFqlNbcmHeBk9B37YpqP E/Xz5LHayOFcEW6wceSAU6Ls4hLSCjUZ7Kk5arQcZ0FbitL9IpMyJ3rexhX5sg== 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 4WMYm94r3WzKvj; Sun, 14 Jul 2024 18:30: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 46EIUHPj020320; Sun, 14 Jul 2024 18:30:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46EIUHOJ020312; Sun, 14 Jul 2024 18:30:17 GMT (envelope-from git) Date: Sun, 14 Jul 2024 18:30:17 GMT Message-Id: <202407141830.46EIUHOJ020312@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 498b3b494b8b - main - lockf tests: Fix a race List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 498b3b494b8b3e500e555a9653d950b9e25a2f1a Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=498b3b494b8b3e500e555a9653d950b9e25a2f1a commit 498b3b494b8b3e500e555a9653d950b9e25a2f1a Author: Mark Johnston AuthorDate: 2024-07-14 16:13:13 +0000 Commit: Mark Johnston CommitDate: 2024-07-14 18:29:14 +0000 lockf tests: Fix a race The test launches lockf(1) in the background and races with it, so it shouldn't be using atf_check to check that lockf won the race. MFC after: 1 week --- usr.bin/lockf/tests/lockf_test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.bin/lockf/tests/lockf_test.sh b/usr.bin/lockf/tests/lockf_test.sh index cc6938d2306e..d73c7590653d 100644 --- a/usr.bin/lockf/tests/lockf_test.sh +++ b/usr.bin/lockf/tests/lockf_test.sh @@ -47,7 +47,9 @@ basic_body() lpid=$! # Make sure that the lock exists... - atf_check test -e "testlock" + while ! test -e "testlock"; do + sleep 0.1 + done # Attempt both verbose and silent re-lock atf_check -s exit:${EX_TEMPFAIL} -e not-empty \ From nobody Sun Jul 14 18:30:18 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WMYmC0g86z5R8Fs; Sun, 14 Jul 2024 18:30: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WMYmB6Dbmz4Xqv; Sun, 14 Jul 2024 18:30:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981818; 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=ZrOHuLewTK2bDvUUxILSXIqKYAcBkBYZ8RZRyQIF2Y4=; b=d9IxbRtcT7OfsZNltTIgrphq4LQzcKVRuq+vUSwmMlJ++UogG4QYquiCSZVdbznCjhTXy1 sPApZRmngJ4kcx1SHcC2hA2CheLFSpOIz8eWKskOuSvTK9pCbiMj5Ss+mziFzCAtY1EOwO IRT10MI8gQTB9Whn22NTj565HVBsulvt4Z0y242Ixs5lW/7rATvrDip8hcrmhBBmHuEL4a /Fz5Tq2KTn+SuKblODWXc6nO6DKtGzkXJVSX809bbRnssAg4L6pAyZRoz7jx0427KLYcBy BLQ4Ye/WOYh3KLH/y36Qh6ejBErtaaFiGn3V/MbuJquIKLPilZ1BOOwsbulXrg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720981818; a=rsa-sha256; cv=none; b=xmQxiWfS5nJYJFNFN/hbhQkqPkt94yoJ5SyB4Fk+adb67YQ17TAglrVcsPotU+UA2b2Q8I WP03yYdHBlzICEbulrcc3DVz5lS6j1bx4dqK0aZF0EAJ+G7bt1HJeTPpeOTp6fvivyaJ1i aO6Nr0cz6xn3MKxQVT2oGM9Mxrp/kQWV2mNRqc8ynVWWoJuMhe5kIU2jCGo9ejPEWcUbgf y1hdQqNidQMBeqvhsWOf8c6ndTIBoRPKdpWFVpWWyqt/nuiY2ty2cOIscKZaRuWq5FUBko Nio5Oji8YxL093gIyyBinGd9NKBoKU7gxPzFTzOlN2XIw9bL0CNTSsvsj8sy1w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981818; 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=ZrOHuLewTK2bDvUUxILSXIqKYAcBkBYZ8RZRyQIF2Y4=; b=RwzVvZ+2jeJXUSj/NCDw/p0U8Q/LVQyosD1RSp1Sa+aJiv0RYm+EUSlPdaMpIKV9lqaxXD 0tgcHRVmNc5YOc8us6mGGqKHoOLUWFrTzKC9l31wNfdQ56n/MMeAWrQXnQ5v2S3WxeAILz g6wR76ku8YQbLuXL51Xl+Fgwv7Jw6FHrHe5VChgX0fEpYjbOa59Nr4tYQ/RkPzG1oDMufa K7tGMqE18W3IdfFS8qZVlntiD4zLE4niro4IE8MWTxHt/twhXpuE+OH+lJ6w78JNjAxVP2 YwpWrsHHSahDIzrhnq1Mn5g/2LnzZcr/IGqO7fsMm0s1DK6gNKsDS5GzZSylPg== 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 4WMYmB5s3wzKvk; Sun, 14 Jul 2024 18:30: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 46EIUISG020448; Sun, 14 Jul 2024 18:30:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46EIUIu2020445; Sun, 14 Jul 2024 18:30:18 GMT (envelope-from git) Date: Sun, 14 Jul 2024 18:30:18 GMT Message-Id: <202407141830.46EIUIu2020445@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: dc8357de606a - main - gnop tests: Serialize List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc8357de606aa65fc1c35a43d4a5f1d706164ddb Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=dc8357de606aa65fc1c35a43d4a5f1d706164ddb commit dc8357de606aa65fc1c35a43d4a5f1d706164ddb Author: Mark Johnston AuthorDate: 2024-07-14 16:14:50 +0000 Commit: Mark Johnston CommitDate: 2024-07-14 18:29:15 +0000 gnop tests: Serialize Some of these tests make use of test disk devices, but then they can't run in parallel. MFC after: 2 weeks --- tests/sys/geom/class/nop/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/sys/geom/class/nop/Makefile b/tests/sys/geom/class/nop/Makefile index 54b41584d441..a3347e0cdb65 100644 --- a/tests/sys/geom/class/nop/Makefile +++ b/tests/sys/geom/class/nop/Makefile @@ -5,4 +5,8 @@ TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} ATF_TESTS_SH+= nop_test +# Some tests make use of the "disks" property and kyua may schedule +# them to run at the time time, which the tests do not expect. +TEST_METADATA.nop_test+= is_exclusive="true" + .include From nobody Sun Jul 14 18:30:20 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WMYmF2RsDz5R88x; Sun, 14 Jul 2024 18:30: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WMYmF0kKQz4XtF; Sun, 14 Jul 2024 18:30:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981821; 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=27huV686KT2e7IhnjcKphfcnJubmRAsQXa5dOFKQU/8=; b=NcbsppuC70kbCyhepy0A4UlLWo5zECWvtlBNGKXu847L7m3mDIZemhlDAhp2/CUkPNpiIq FDiI10kw4mRd1oCU0/eLDVo4Wma+ItgXenZfJZ0fJ0iYuV7uTbDP0XEfrNL0np/S80bRM7 PC2avS1NjSNJkdFyXvkcWGi4jx98j7ytRbwox+lZKY5g30RgQZIesx2bRhmcuMe/qU7vqq C7qe/2IjpMjW+wV9jgAn3IxWbmQz21RDsJC4Y2TLe6C+r6pXw+Bf5A5aMa0Dd/mO6cpxCk EjnbuqQ1f+TTdb+jtF5KuXi5Vj3Ckffun2Ux2N9hl2XvzfueXPmgauh0w/LGlA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720981821; a=rsa-sha256; cv=none; b=ogtwmqjV6tijWuU34OvT8V9VnTyYEeFgUTV6ufH6KfncVn4HxJy8zID6MKSW9RE4/GgZ+N hLNtJ7ZpBosmEDAPfKLdBr5XUFwzkVaTraXAo6E6aJE+LhTktc5OECgEB8vNqOur0+7yDJ 6OLkPjnVoasCalvmzhunArVdS7lrqZTd/lMHQBqz7cHtFGPA+L5cOUVF3j6GpONsKVdOgc lAJTaLEb+uEXIXKPouGq01W0hPvhaZuDBESIiDJa2Kir+aFsBdHMkNAaRAzPc0grBSb+13 pUK1Dfs1ikU/bt9f18raMAPkf9l/C+qm1Itra4Jnkq1Z4eymZxlq+oK4Wc9Lnw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981821; 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=27huV686KT2e7IhnjcKphfcnJubmRAsQXa5dOFKQU/8=; b=w7EfboVIA0PBAIZUKUeWtg259vBdzPv2mS6IOMlbSd8yte2h85pYpGxqIt3i9L9o9IK53O Pbs3JrytEJCnPO58l+rM3USp+2J0Y/C+XF5ThOS5XdX1u1hBard8SvTMqugIIv9ojmRlme bbV10Tsup4l/YLllEAupLK8Tu2Umo0oq86wA9R2h9bBJueJEbnKuYC651tZyjZR1sqYoOr 0A+4JNTKOEwLTgTjKaVm4sNnV6qKsR3+zKZ6gzCL39tIKVpRrMP2V/M48TgJD16vA3ZtzW Toy48EEGPmjY2UmiU5h3zqV1AVoGiD7KDRJDXb6ya7LrZVQcSSsi1BAyIjSeyQ== 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 4WMYmF0LltzKx8; Sun, 14 Jul 2024 18:30: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 46EIUKoV020541; Sun, 14 Jul 2024 18:30:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46EIUKLZ020538; Sun, 14 Jul 2024 18:30:20 GMT (envelope-from git) Date: Sun, 14 Jul 2024 18:30:20 GMT Message-Id: <202407141830.46EIUKLZ020538@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 1c64b3aba3d0 - main - hptiop: Use device_set_descf() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1c64b3aba3d0e2910ac52c18e3c240348eb3e36e Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1c64b3aba3d0e2910ac52c18e3c240348eb3e36e commit 1c64b3aba3d0e2910ac52c18e3c240348eb3e36e Author: Mark Johnston AuthorDate: 2024-07-14 16:18:27 +0000 Commit: Mark Johnston CommitDate: 2024-07-14 18:29:15 +0000 hptiop: Use device_set_descf() No functional change intended. MFC after: 1 week --- sys/dev/hptiop/hptiop.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/dev/hptiop/hptiop.c b/sys/dev/hptiop/hptiop.c index 547957c30ef1..8252dbad4a07 100644 --- a/sys/dev/hptiop/hptiop.c +++ b/sys/dev/hptiop/hptiop.c @@ -1798,7 +1798,6 @@ static int hptiop_probe(device_t dev) { struct hpt_iop_hba *hba; u_int32_t id; - static char buf[256]; int sas = 0; struct hptiop_adapter_ops *ops; @@ -1851,9 +1850,8 @@ static int hptiop_probe(device_t dev) pci_get_bus(dev), pci_get_slot(dev), pci_get_function(dev), pci_get_irq(dev)); - sprintf(buf, "RocketRAID %x %s Controller\n", - id, sas ? "SAS" : "SATA"); - device_set_desc_copy(dev, buf); + device_set_descf(dev, "RocketRAID %x %s Controller", + id, sas ? "SAS" : "SATA"); hba = (struct hpt_iop_hba *)device_get_softc(dev); bzero(hba, sizeof(struct hpt_iop_hba)); From nobody Sun Jul 14 18:30:19 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WMYmD16C4z5R8Kn; Sun, 14 Jul 2024 18:30: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WMYmC6sp0z4Xt0; Sun, 14 Jul 2024 18:30:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981820; 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=+VIgeOoB0kdSLwayOWnvCzbMDFcb4kmilz38Cl6IWUY=; b=oI5AtdA+gXAawmkRmbsi1wLyAmrJdEtWAK5m6HfxWNkoC5JEKKzkeqVy9uqUSMlqsp0cjU eRxON6lE423cPXWFmslE6XI0e71KsBByMJC3KOlMumVAlLC+3W3uZc3tF3EJxNfoFvkBx6 eY6KYr/ZAUqMYLo+zpbv8xv5cyfkZgqKgAjKJUVeNggD4KjAuJhz0XzJnXJVZ1Y37SiUdy dsw8L75yluQg5Sju6wos6WtDhO+FIa44UkrInF1E5woGb9pKoZZBSlO3bupzieBxP/ifn4 VzKWCsqSh7YkuaCsWjS4tdo8sQXKQMlyHgDdrYNOwhW/W3/dIYdkp+uddj+3ng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720981820; a=rsa-sha256; cv=none; b=nnzN/apylW+fZkSBcVwH1E/UngT5J9DY9f7jEw5YhAUE1EwnRvYbfUa0gXPQddynew/7yW jldORGcE4rAERHJDcwRIenpEBVWUC9jg1p2qka6JkoL45jWN4hJCvuJTRpFQArXJMaRbPT t0FrjX2gE9PEcLPZWWXO5Ol2kB16eA4YQtH1zkMQAcMhdG6RoooSEiLBGBRCkVX9DXJXIM 7hsd9FK4bFl4NB6zMpfb0jrunF3pBj+wrRVb63fDicOKIVIRTYON3wuTzwtvTBlp21ak6m iL76ujdTtMQTZxVBOMAbC/LRDx+vm7e9g3LbcxpwH0B246xPZJaZLJW6wgQhWA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981820; 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=+VIgeOoB0kdSLwayOWnvCzbMDFcb4kmilz38Cl6IWUY=; b=LXd/g3woyqScxko9AiNTg+u10rSutD4qgE25b9I/2SArlZqGPzwC8WAHDihJpN5KS28Wx6 Y23RksGoVNbvCohoub3N56WNnKIoSTtRLBtKjg27nJaqhWgyyjOI5LbGhS+1Z7ckHPWyVk QKGPcHIo1WEYEj9WJ4MAGDVA85x9ucNLumkyhUKnii4xnoiaDZhYdLU7+57u2Mh9UHqHF/ TgECdlBwFONp+7velY1wqKT/LcGtk3tApycVPssHAvrGqFrHfzfJgIiOv+rTexC0If48ji Hx0KMzOULn3AmJoJkzIDWJDDlOv9sRw5prhVRj6hAiFVkPZUgH9qplLx1rF57A== 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 4WMYmC6T52zKx7; Sun, 14 Jul 2024 18:30: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 46EIUJat020503; Sun, 14 Jul 2024 18:30:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46EIUJ6b020499; Sun, 14 Jul 2024 18:30:19 GMT (envelope-from git) Date: Sun, 14 Jul 2024 18:30:19 GMT Message-Id: <202407141830.46EIUJ6b020499@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: d254651de392 - main - axgbe: Remove a nonsensical use of kernel_sysctlbyname() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d254651de392538fa7f5c0020093dde0ca06c614 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d254651de392538fa7f5c0020093dde0ca06c614 commit d254651de392538fa7f5c0020093dde0ca06c614 Author: Mark Johnston AuthorDate: 2024-07-14 16:15:23 +0000 Commit: Mark Johnston CommitDate: 2024-07-14 18:29:15 +0000 axgbe: Remove a nonsensical use of kernel_sysctlbyname() No functional change intended. MFC after: 1 week --- sys/dev/axgbe/if_axgbe_pci.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/sys/dev/axgbe/if_axgbe_pci.c b/sys/dev/axgbe/if_axgbe_pci.c index 3e68525067fb..320799e77188 100644 --- a/sys/dev/axgbe/if_axgbe_pci.c +++ b/sys/dev/axgbe/if_axgbe_pci.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -610,8 +611,6 @@ axgbe_set_counts(if_ctx_t ctx) struct axgbe_if_softc *sc = iflib_get_softc(ctx); struct xgbe_prv_data *pdata = &sc->pdata; cpuset_t lcpus; - int cpu_count, err; - size_t len; /* Set all function pointers */ xgbe_init_all_fptrs(pdata); @@ -638,21 +637,12 @@ axgbe_set_counts(if_ctx_t ctx) * number of Rx queues or maximum allowed */ - /* Get cpu count from sysctl */ - len = sizeof(cpu_count); - err = kernel_sysctlbyname(curthread, "hw.ncpu", &cpu_count, &len, NULL, - 0, NULL, 0); - if (err) { - axgbe_error("Unable to fetch number of cpus\n"); - cpu_count = 1; - } - if (bus_get_cpus(pdata->dev, INTR_CPUS, sizeof(lcpus), &lcpus) != 0) { axgbe_error("Unable to fetch CPU list\n"); /* TODO - handle CPU_COPY(&all_cpus, &lcpus); */ } - DBGPR("ncpu %d intrcpu %d\n", cpu_count, CPU_COUNT(&lcpus)); + DBGPR("ncpu %d intrcpu %d\n", mp_ncpus, CPU_COUNT(&lcpus)); pdata->tx_ring_count = min(CPU_COUNT(&lcpus), pdata->hw_feat.tx_ch_cnt); pdata->tx_ring_count = min(pdata->tx_ring_count, From nobody Sun Jul 14 18:30:22 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WMYmG4Pg5z5R86f; Sun, 14 Jul 2024 18:30: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WMYmG1Mgsz4Xww; Sun, 14 Jul 2024 18:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981822; 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=8GTCXUQfI/qRXwhSjSGa1Tq2Rn2CvnAVfpPAmMKPJHI=; b=NayvLCKbtqT0uoKpcumSRleJsn+C7LG9W0wK47uYf1p77Hw6UYdzVRcade75WBp/pTM6Hu /lAml5U71E6ot8D5kkXCWTbyCHfawJP7vByy37sJMJSUDDNbC2cByuRNiNEwHvx++vdT/z UXYduz3MTy2wKFj09qPHRH58jLt7iN5TaynLUrswmD0NNpMrU1VohMT7p0v72Y3m/zcn2i vhyg2mq1rpku2Jif65YXBf1zAZVkwIlV8yzrGWFZxbXQnfI3EZXhleTz4yKma8p45qDHdD Op5TsgtFzaDkhhCOZzqYCE8cTZ9LDeuJGcDQ3yfh9bs6ILw3+oN5KscIDvRwJQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720981822; a=rsa-sha256; cv=none; b=rlH+DhnAExbWnNFCVEW3E70oDOPuwplhw/qWw6JDChATG67jhlG7ytIG/rJS0ViTE66SbF e2ONq7cky36KBggHXnrIfCk7NMvz+suNDIuGJQTqJyPvyrfeciMrSIdJebovjKZxett5Ek OyZZMz38Im2ZitgfpMSi+nQ1WTIPrJvOgHla2k2dN1DzhxH53WDvU4V8kszRSVx7WyXZi/ doVyEyS8oX2YaJ9rwtu6+8qmwaPVq8UIBwe0r6W3blvLfv6oCTP/tIYX+BsO1y4kc7EMcQ l9RBxIwKQ6HgE1Yh1iKLOEze0WtbN7fBIooNiIJ3xa4bn5wEIdU6/5xykyv/WQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981822; 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=8GTCXUQfI/qRXwhSjSGa1Tq2Rn2CvnAVfpPAmMKPJHI=; b=U1mVr7kPUgExro+47zcv/latGtezkMC4b4eLew0KSHuNEe4M80hfJOItBiGvC4dGx/smwD UY5CINuVFaIj+tnw1fsg3Cgl818Kisea7OBuhqHWFdaYXLA5+HvLi8X4XD3cNknY1BhoE/ BzVIQvDMC0qDkshCeHg894AmZEjLXoknlzkqhhCUuu8H8jEiFK4n5WUXCTmdbw03AxgALZ g8eTzPnh/Nvq7TB+FPHGRIegZks6U7aDElFOhjM8ybGHA2xXY1KZ7ZXwWaAEOpmLCbmV19 spC8Bl1ArQo9d2FtFerYGGLxNVKRc/AG4usPFsgOpx1/s3V2OC063PIcLy/64A== 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 4WMYmG103bzKx9; Sun, 14 Jul 2024 18:30:22 +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 46EIUMeR020582; Sun, 14 Jul 2024 18:30:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46EIUMT8020579; Sun, 14 Jul 2024 18:30:22 GMT (envelope-from git) Date: Sun, 14 Jul 2024 18:30:22 GMT Message-Id: <202407141830.46EIUMT8020579@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e536b197c0cf - main - netlink: Wrap long lines List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e536b197c0cf5c245e0b65f1b73447d53f3656f2 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e536b197c0cf5c245e0b65f1b73447d53f3656f2 commit e536b197c0cf5c245e0b65f1b73447d53f3656f2 Author: Mark Johnston AuthorDate: 2024-07-14 16:20:18 +0000 Commit: Mark Johnston CommitDate: 2024-07-14 18:29:15 +0000 netlink: Wrap long lines No functional change intended. MFC after: 1 week Sponsored by: Klara, Inc. --- sys/netlink/netlink_debug.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/sys/netlink/netlink_debug.h b/sys/netlink/netlink_debug.h index 0d8423d4933a..db987b26b6d7 100644 --- a/sys/netlink/netlink_debug.h +++ b/sys/netlink/netlink_debug.h @@ -46,12 +46,16 @@ SYSCTL_DECL(_net_netlink_debug); * Logging for events specific for particular process * Example: [nl_domain] PID 4834 fdump_sa: unsupported family: 45 */ -#define NL_RAW_PID_LOG(_l, _pid, _fmt, ...) NL_RAW_PID_LOG_##_l(_l, _pid, _fmt, ## __VA_ARGS__) -#define _NL_RAW_PID_LOG(_l, _pid, _fmt, ...) if (_DEBUG_PASS_MSG(_l)) { \ - _output("[" DEBUG_PREFIX_NAME "] PID %u %s: " _fmt "\n", _pid, __func__, ##__VA_ARGS__); \ -} +#define NL_RAW_PID_LOG(_l, _pid, _fmt, ...) \ + NL_RAW_PID_LOG_##_l(_l, _pid, _fmt, ## __VA_ARGS__) +#define _NL_RAW_PID_LOG(_l, _pid, _fmt, ...) \ + if (_DEBUG_PASS_MSG(_l)) { \ + _output("[" DEBUG_PREFIX_NAME "] PID %u %s: " _fmt "\n", _pid, \ + __func__, ##__VA_ARGS__); \ + } -#define NLP_LOG(_l, _nlp, _fmt, ...) NL_RAW_PID_LOG_##_l(_l, nlp_get_pid(_nlp), _fmt, ## __VA_ARGS__) +#define NLP_LOG(_l, _nlp, _fmt, ...) \ + NL_RAW_PID_LOG_##_l(_l, nlp_get_pid(_nlp), _fmt, ## __VA_ARGS__) #if DEBUG_MAX_LEVEL>=LOG_DEBUG3 #define NL_RAW_PID_LOG_LOG_DEBUG3 _NL_RAW_PID_LOG @@ -77,7 +81,5 @@ SYSCTL_DECL(_net_netlink_debug); #define NL_RAW_PID_LOG_LOG_ERR _NL_RAW_PID_LOG #define NL_RAW_PID_LOG_LOG_WARNING _NL_RAW_PID_LOG - - -#endif -#endif +#endif /* _KERNEL */ +#endif /* !_NETLINK_NETLINK_DEBUG_H_ */ From nobody Sun Jul 14 18:30:23 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WMYmH4zs8z5R84f; Sun, 14 Jul 2024 18:30: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WMYmH2WF3z4Y6Y; Sun, 14 Jul 2024 18:30:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981823; 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=Ar8iXG7ovJ5C1mnXAa6mstkrW1pjNYYTPE6O4RoxjIE=; b=Oz7Ppv1ovGhLoHx7YpSYJVW+ztnfUocmLNVF0PT68wC5Kkc4njBh0Tku1/eUJntf39G7jQ NqPghWoy+NNRjSkVQJLa5dBXwgZZlQI+OvcGWt+FQsLeeEIOKi4iTtYPPKdZAqEts82+mY rCYa8Jys089QEBXhBx13iW6AlCmclLXmXEHGjjbgoUeM3uQXyt2G37x4fzjKblHrIj0B+j l/yexLu2pqMiZU6jEusJ7kPD2kG7whKu9DkP/rUUU7JhC7cQIDi4ookqEXkmt/lfKAOk54 aZ2n0gKBoMyjcf98otBlcsXZnx338qZhR9UEB3SmQ7ygC2IG/eb8MTpKEnkTCA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720981823; a=rsa-sha256; cv=none; b=Na8MRqmlGjBvd6spmb4cM9FLAetSnvJW6YwTHnw6slWS2g4LB2Eb7+aMn/EsgUjJw0WVlu IkCAXStqbU1AELbUrNDooBQTqqeixqpBgCT4v00oaNxUKvJH7SK3yaguBpB76vdHeHfApx VHXS0Xn66/R5l1Jh0r9qqQXm5iINB4JcwTBXqZrngqAcsLq+7Qp95bpK6c77PD9DIJSqxG OOplIzGE1dl2JeLFGuXVonoolPEPBkFjvWp3Lu9E8KDhL4cgpBW3fjKLhyb3BOhywZvQGp 0ZyZ7z1FsR7OvRu+t7WTMFivPMuW1VIl2gvW/z+MmMsEyq0OETPzdOiRm0EK4g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720981823; 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=Ar8iXG7ovJ5C1mnXAa6mstkrW1pjNYYTPE6O4RoxjIE=; b=I27jwYluChsF8w3yCJTkrKLqmCSgIyZTuwJacdqlmLOqnsCjrTZQx+SPnQpX9pe9AobooQ W77QL6EhGrbS1QhV7l5ycIm7dXapQ9BLZlhUJRIIdwLZAeCqsnbNshwAQ7VQm78KSZKuiV zKsDVXyY19sWlvbMYsjxm8z7Jbnm0D+4GP1bskrAwytVIoiRnbj01iFrHTqLFsWKvpeczR oEBBdv0x9PPkGqqGqJd9obx0x0sATIwF8nl+pfycAZN+pFX0VMd2Txjf1P01k6wpb3nrJc z5dJcr+D7GfE73rPGMW8wHbG9urufjzzKPaKT976YKuR1nd0zuZiNZ5Xy5faLg== 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 4WMYmH26RpzKvl; Sun, 14 Jul 2024 18:30: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 46EIUNpm020725; Sun, 14 Jul 2024 18:30:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46EIUNNO020722; Sun, 14 Jul 2024 18:30:23 GMT (envelope-from git) Date: Sun, 14 Jul 2024 18:30:23 GMT Message-Id: <202407141830.46EIUNNO020722@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: ec1b18c7353a - main - route: Wrap long lines List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ec1b18c7353ad20d2d373e58931aeccfccd5599d Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ec1b18c7353ad20d2d373e58931aeccfccd5599d commit ec1b18c7353ad20d2d373e58931aeccfccd5599d Author: Mark Johnston AuthorDate: 2024-07-14 16:20:48 +0000 Commit: Mark Johnston CommitDate: 2024-07-14 18:29:15 +0000 route: Wrap long lines No functional change intended. MFC after: 1 week Sponsored by: Klara, Inc. --- sys/net/route/route_debug.h | 36 +++++++++++++++++++++++------------- sys/net/rtsock.c | 4 +++- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/sys/net/route/route_debug.h b/sys/net/route/route_debug.h index 1e682bd4561b..d0b1f864eec9 100644 --- a/sys/net/route/route_debug.h +++ b/sys/net/route/route_debug.h @@ -78,33 +78,42 @@ SYSCTL_DECL(_net_route_debug); * This is NOT compiled in by default. Turning it on should NOT seriously impact performance * LOG_DEBUG3 - last debug level. Per-item large debug outputs. * This is NOT compiled in by default. All performance bets are off. - * */ -#define _output printf +#define _output printf #define _DEBUG_PASS_MSG(_l) (DEBUG_VAR_NAME >= (_l)) -#define IF_DEBUG_LEVEL(_l) if ((DEBUG_MAX_LEVEL >= (_l)) && (__predict_false(DEBUG_VAR_NAME >= (_l)))) +#define IF_DEBUG_LEVEL(_l) \ + if ((DEBUG_MAX_LEVEL >= (_l)) && (__predict_false(DEBUG_VAR_NAME >= (_l)))) /* * Logging for events specific for particular family and fib - * Example: [nhop_neigh] inet.0 find_lle: nhop nh#4/inet/vtnet0/10.0.0.1: mapped to lle NULL + * Example: [nhop_neigh] inet.0 find_lle: */ -#define FIB_LOG(_l, _fib, _fam, _fmt, ...) FIB_LOG_##_l(_l, _fib, _fam, _fmt, ## __VA_ARGS__) -#define _FIB_LOG(_l, _fib, _fam, _fmt, ...) if (_DEBUG_PASS_MSG(_l)) { \ - _output("[" DEBUG_PREFIX_NAME "] %s.%u %s: " _fmt "\n", rib_print_family(_fam), _fib, __func__, ##__VA_ARGS__); \ -} +#define FIB_LOG(_l, _fib, _fam, _fmt, ...) \ + FIB_LOG_##_l(_l, _fib, _fam, _fmt, ## __VA_ARGS__) +#define _FIB_LOG(_l, _fib, _fam, _fmt, ...) \ + if (_DEBUG_PASS_MSG(_l)) { \ + _output("[" DEBUG_PREFIX_NAME "] %s.%u %s: " _fmt "\n", \ + rib_print_family(_fam), _fib, __func__, ##__VA_ARGS__); \ + } /* Same as FIB_LOG, but uses nhop to get fib and family */ -#define FIB_NH_LOG(_l, _nh, _fmt, ...) FIB_LOG_##_l(_l, nhop_get_fibnum(_nh), nhop_get_upper_family(_nh), _fmt, ## __VA_ARGS__) +#define FIB_NH_LOG(_l, _nh, _fmt, ...) \ + FIB_LOG_##_l(_l, nhop_get_fibnum(_nh), nhop_get_upper_family(_nh), \ + _fmt, ## __VA_ARGS__) /* Same as FIB_LOG, but uses rib_head to get fib and family */ -#define FIB_RH_LOG(_l, _rh, _fmt, ...) FIB_LOG_##_l(_l, (_rh)->rib_fibnum, (_rh)->rib_family, _fmt, ## __VA_ARGS__) +#define FIB_RH_LOG(_l, _rh, _fmt, ...) \ + FIB_LOG_##_l(_l, (_rh)->rib_fibnum, (_rh)->rib_family, _fmt, \ + ## __VA_ARGS__) /* Same as FIB_LOG, but uses nh_control to get fib and family from linked rib */ -#define FIB_CTL_LOG(_l, _ctl, _fmt, ...) FIB_LOG_##_l(_l, (_ctl)->ctl_rh->rib_fibnum, (_ctl)->ctl_rh->rib_family, _fmt, ## __VA_ARGS__) +#define FIB_CTL_LOG(_l, _ctl, _fmt, ...) \ + FIB_LOG_##_l(_l, (_ctl)->ctl_rh->rib_fibnum, \ + (_ctl)->ctl_rh->rib_family, _fmt, ## __VA_ARGS__) /* * Generic logging for routing subsystem - * Example: [nhop_neigh] nhops_update_neigh: L2 prepend update from lle/inet/valid/vtnet0/10.0.0.157 + * Example: [nhop_neigh] nhops_update_neigh: */ #define RT_LOG(_l, _fmt, ...) RT_LOG_##_l(_l, _fmt, ## __VA_ARGS__) #define _RT_LOG(_l, _fmt, ...) do { \ @@ -114,7 +123,8 @@ SYSCTL_DECL(_net_route_debug); } while (0) /* - * Wrapper logic to avoid compiling high levels of debugging messages for production systems. + * Wrapper logic to avoid compiling high levels of debugging messages for + * production systems. */ #if DEBUG_MAX_LEVEL>=LOG_DEBUG3 #define FIB_LOG_LOG_DEBUG3 _FIB_LOG diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index e0411ed0c1d0..09d463dc17af 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -136,7 +136,9 @@ struct linear_buffer { }; #define SCRATCH_BUFFER_SIZE 1024 -#define RTS_PID_LOG(_l, _fmt, ...) RT_LOG_##_l(_l, "PID %d: " _fmt, curproc ? curproc->p_pid : 0, ## __VA_ARGS__) +#define RTS_PID_LOG(_l, _fmt, ...) \ + RT_LOG_##_l(_l, "PID %d: " _fmt, curproc ? curproc->p_pid : 0, \ + ## __VA_ARGS__) MALLOC_DEFINE(M_RTABLE, "routetbl", "routing tables"); From nobody Sun Jul 14 19:12:37 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WMZj30j2bz5RD76; Sun, 14 Jul 2024 19:12:39 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WMZj3052Tz4hMy; Sun, 14 Jul 2024 19:12:39 +0000 (UTC) (envelope-from bapt@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720984359; 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: in-reply-to:in-reply-to:references:references; bh=U/j+Hq59qw/UXi9N6mD0K+dqBQHYtKW8bEIkLggKfnY=; b=UyRezk+SSlLQg+afjNfEls7fuCb0rQ2CWU2b0T9QPCwLIgnEWb4D+b5TnXFFnZXnH5VGdc dCP2BViNqVc2IDE9K0BBh7LZJMtbC/0ZVKZKW0eEFf9V2ZhMhKrXTXfuxTOt6zLyLP7CvY xMEUfB3ji7C2NMUUXLBGf842rmWaQQIaYM0EmTekg7zLIxk2j4eYgdfU+tqXcgEHcxFelP R1Zxf00H+c4tKl0lPvcbBnPAHpBaaUe1hZUzr4RGC3c9wymJirYHcRH4NOoujQ8HM9ceil m42zcXqmymK9Q7TEh0NE+qp40tdOy2TqcPk8JlVy/gGBCL5tsoApKG3UQ4K9bw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720984359; a=rsa-sha256; cv=none; b=IhssfivMJi4/Q+rgIJeWmLFJjPkTMitC9eycL3lsMgnPagi9P2BLY6eTN2w97UoS83yZZi mpG963ImISdPHmOGRqbmUWl4xfgiopCCQmP3647bedtDs1SLDTNfb4ckkByQOWmBmr3Cme uJWCmhNxGo5Gkpch596FJla0Gkry8AeRs5Amh+zjsowODLf6rtd+RfKmnqt09PhW2oX19H u7HRypDYEJ62qk7gd1mTOLVaa4WHe0FtNBSeFVet95Dm0/PQVIf3f7VfAkP+aE5GGdjGWi 1u/3PpA/14NXeRwd/biBhbZJFmPWSeNix8sYCsb21TCkdQ1S1gQHu9CsmLL89Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720984359; 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: in-reply-to:in-reply-to:references:references; bh=U/j+Hq59qw/UXi9N6mD0K+dqBQHYtKW8bEIkLggKfnY=; b=vCHwaUz8MRUfe1dIfVyCgGvzpfm81uH3oP9oAckD5AoMWSUNR1R+PPYPcBcjppVhksnv/W OyrSErv1igc7Cu4HDf0iLCtPUAMb/qiAQEkNL6ysWnj0G0v5osfsxCBEblvGyVjEk90bny L+EcQMe2NIDTcA2dKRKU7xYglom+c2ziVcl0NSVHlLUtgGAfLz4aN+BQsEwNPOfjt4dk+V iXBqYjK7e0DSGnTeocqmyBI3CifTf2ED6jXOKUVhCSATFldpyUpBRFFtJKdLkbQ7bTDdjZ ZBjgX+BDt83nv26Da2lsil0Wi3BfINk4knzEb98Vyl9eQzKT+uRW+SMpKlcPsw== Received: from aniel.nours.eu (nours.eu [IPv6:2001:41d0:8:3a4d::1]) (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) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id 4WMZj25gCPzhGJ; Sun, 14 Jul 2024 19:12:38 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from [127.0.0.1] (unknown [78.152.223.113]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aniel.nours.eu (Postfix) with ESMTPSA id D6FFB14E98B; Sun, 14 Jul 2024 21:12:35 +0200 (CEST) Date: Sun, 14 Jul 2024 20:12:37 +0100 From: Baptiste Daroussin To: Wolfram Schneider , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: =?US-ASCII?Q?Re=3A_git=3A_e5a0202f9694_-_main_-_Makefile=2E?= =?US-ASCII?Q?inc1=3A_show_time_for__=60make_installworld=27?= User-Agent: K-9 Mail for Android In-Reply-To: <202407131039.46DAdpeF060632@gitrepo.freebsd.org> References: <202407131039.46DAdpeF060632@gitrepo.freebsd.org> Message-ID: <1A2FA96F-3AB4-4A8C-A64D-7C15C0AD49BB@FreeBSD.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Le 13 juillet 2024 11:39:51 GMT+01:00, Wolfram Schneider a =C3=A9crit=C2=A0: >The branch main has been updated by wosch: > >URL: https://cgit=2EFreeBSD=2Eorg/src/commit/?id=3De5a0202f96948a95bf1b87= 9727e155a4f1d1da93 > >commit e5a0202f96948a95bf1b879727e155a4f1d1da93 >Author: Wolfram Schneider >AuthorDate: 2024-07-13 10:37:14 +0000 >Commit: Wolfram Schneider >CommitDate: 2024-07-13 10:37:14 +0000 > > Makefile=2Einc1: show time for `make installworld' > =20 > For years we display the time in seconds how long it takes to > run `make buildworld' (see PR 224433)=2E Now we will display the > time for "installworld" and "installkernel" as well=2E > =20 > e=2Eg=2E: > -------------------------------------------------------------- > >>> Installing everything completed on Sun Jul =C2=A07 16:11:37 UTC 2= 024 > >>> Install world completed in 110 seconds, ncpu: 2, make -j2 > -------------------------------------------------------------- > =20 > PR: 280187 > Approved by: imp > Differential Revision: https://reviews=2Efreebsd=2Eorg/D45912 >--- > Makefile=2Einc1 | 22 +++++++++++++++++++--- > 1 file changed, 19 insertions(+), 3 deletions(-) > >diff --git a/Makefile=2Einc1 b/Makefile=2Einc1 >index 19ed923702b1=2E=2E7ff961e22e7a 100644 >--- a/Makefile=2Einc1 >+++ b/Makefile=2Einc1 >@@ -1241,11 +1241,19 @@ WMAKE_TGTS+=3D build${libcompat} > =2Eendif > WMAKE_TGTS+=3D everything >=20 >-# record buildworld time in seconds >+# record buildworld / install time in seconds > =2Eif make(buildworld) > _BUILDWORLD_START!=3D date '+%s' > =2Eexport _BUILDWORLD_START > =2Eendif >+=2Eif make(installworld) >+_INSTALLWORLD_START!=3D date '+%s' >+=2Eexport _INSTALLWORLD_START >+=2Eendif >+=2Eif make(installkernel) >+_INSTALLKERNEL_START!=3D date '+%s' >+=2Eexport _INSTALLKERNEL_START >+=2Eendif >=20 > buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue =2EPHO= NY > =2EORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue >@@ -1313,11 +1321,11 @@ kernel-toolchain: ${KERNEL_TOOLCHAIN_TGTS} =2EPHO= NY > installcheck: _installcheck_world _installcheck_kernel =2EPHONY > _installcheck_world: =2EPHONY > @echo "--------------------------------------------------------------" >- @echo ">>> Install check world" >+ @echo ">>> Install check world started on `LC_ALL=3DC date`" > @echo "--------------------------------------------------------------" > _installcheck_kernel: =2EPHONY > @echo "--------------------------------------------------------------" >- @echo ">>> Install check kernel" >+ @echo ">>> Install check kernel started on `LC_ALL=3DC date`" > @echo "--------------------------------------------------------------" >=20 > # >@@ -1641,6 +1649,8 @@ restage reinstall: =2EMAKE =2EPHONY > =2Eendfor > @echo "--------------------------------------------------------------" > @echo ">>> Installing everything completed on `LC_ALL=3DC date`" >+ @seconds=3D$$(($$(date '+%s') - ${_INSTALLWORLD_START})); \ >+ echo ">>> Install world completed in $$seconds seconds, ncpu: $$(${_n= cpu_cmd})${=2EMAKE=2EJOBS:S/^/, make -j/}" > @echo "--------------------------------------------------------------" >=20 > redistribute: =2EMAKE =2EPHONY >@@ -1873,6 +1883,9 @@ reinstallkernel reinstallkernel=2Edebug: _installch= eck_kernel =2EPHONY > @echo "--------------------------------------------------------------" > @echo ">>> Installing kernel ${INSTALLKERNEL} completed on $$(LC_ALL=3D= C date)" > @echo "--------------------------------------------------------------" >+ @seconds=3D$$(($$(date '+%s') - ${_INSTALLKERNEL_START})); \ >+ echo ">>> Install kernel(s) ${INSTALLKERNEL} completed in $$seconds s= econds, ncpu: $$(${_ncpu_cmd})${=2EMAKE=2EJOBS:S/^/, make -j/}" >+ @echo "--------------------------------------------------------------" > =2Eendif > =2Eif ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} !=3D "yes" > =2Efor _kernel in ${BUILDKERNELS:[2=2E=2E-1]} >@@ -1887,6 +1900,9 @@ reinstallkernel reinstallkernel=2Edebug: _installch= eck_kernel =2EPHONY > @echo ">>> Installing kernel ${_kernel} completed on $$(LC_ALL=3DC date= )" > @echo "--------------------------------------------------------------" > =2Eendfor >+ @seconds=3D$$(($$(date '+%s') - ${_INSTALLKERNEL_START})); \ >+ echo ">>> Install kernel(s) ${BUILDKERNELS} completed in $$seconds se= conds, ncpu: $$(${_ncpu_cmd})${=2EMAKE=2EJOBS:S/^/, make -j/}" >+ @echo "--------------------------------------------------------------" > =2Eendif >=20 > distributekernel distributekernel=2Edebug: =2EPHONY this breaks pkgbase: package production and distribution is broken since t= his commit seconds=3D$(($(date '+%s') - )); echo ">>> Install world completed in $se= conds seconds, ncpu: $(sysctl -n hw=2Encpu 2>/dev/null || nproc 2>/dev/null= || echo unknown), make -j64" = sh: arithmetic expression: expecting primary: "1720982146 - " best regards bapt