From nobody Mon Jan 20 01:41:32 2025 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 4YbtNZ4BNKz5k2rb; Mon, 20 Jan 2025 01:41:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.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 4YbtNZ3T8sz3kD7; Mon, 20 Jan 2025 01:41:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737337294; 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=XZbKYL0dMtbw3XBXPhFP7lP7WXAH3CIEjfLjM/h/EXM=; b=xCVrv4Ah4o9b94N/3Q83Br2ZO/q7n3dFN5/lFpWVATjs9xx3L8NTQ8W19UaXONc1VCm0K1 lBDW7XIYTTmWJwX/z/4sp59IQlrOfmjQ03wZ2SSQy9tsvV7tS1QVxtDQe+v6/4eTgAbSIe 4phl+uabOXhiER3coHenVmkpNzfZf2V9eWpQEEVB768rAKNCZqAulw8eSEkWSS28zSzlzA smB4klS/8ygtxFu90xVdobVnxLWosAZrI/cllIkLQ2X0awOWZ+rm3PLxW/bnNPa42MoVwA Utsp55sUKhIHmYOOm1mnCSzZVQUyLrseWdZm453fs7Q9zokTT5hc4PrjLEAHdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737337294; 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=XZbKYL0dMtbw3XBXPhFP7lP7WXAH3CIEjfLjM/h/EXM=; b=wcP0vWNW/OgKkZBH6LL5NOyERe5kXNMtDC2Pqr49mV8y2C5/SenozrURuca72XjPZe3G62 +JopzVD7pbadv2qI/v8xtzuJqSwBzczNgm0LCUmUBHHLNq5k2w3087ojqNsKL1tlSeGfeD 87vTj8ddtKpoMMLO7EFwOBc0tDqPsTVfKJEep2rIXpKJkPsu78IO9TivU6Wzefwuzgq4ao KcO5raPY/QhC8tBImbX9YgKa2oZQfxh+P26SXMdsb4qS61Y15BEkJ5JRiCs2Sbp9ZvfEia y904Rpzt8lTEMvuZdZi1NjMmwPkvhHacCet1qyUvpRTehm1vM/XjJ6S6Mt6fNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737337294; a=rsa-sha256; cv=none; b=qCxktLhCrlSuDSrFBgGa7q98HbQNizhGDVui1/R2+kNDx5+q8QAN157l3EDLn9x5AtnCy7 6OLcUURndQIbNebEku+eKAxM2YiXppUNN6IQj3kxVRlprcYAXHG5ZTfI/n35t2v36KcOTb Iuvfww+pI8Stg7etLjR2wfMop2llNt/fLEpchYdaVhrmIPCHgalV+xq56tWW7t40K2LYrw RgR/7Utz05vV6sBNFtdj1GGgaBHAFloi3rTtu8mArjRZSS674AdbJsXeMa6kxQpfqSfR0n qViNcGVQUSTnJsdVkHAqqY5wDK+O8VM65s5EFT5mxutwkiOd18atP6H2cjoCRA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from [10.9.4.95] (unknown [209.182.120.176]) (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: kevans/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4YbtNZ04myzQ6f; Mon, 20 Jan 2025 01:41:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Message-ID: <7371f49b-125a-47af-b36b-38f3a8ebfef1@FreeBSD.org> Date: Sun, 19 Jan 2025 19:41:32 -0600 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: 9ded074e875c - main - Refactor makesyscalls.lua into a library To: Brooks Davis Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Warner Losh References: <202410302108.49UL8tGl053622@gitrepo.freebsd.org> <25a28def-fbfd-49df-a2bf-dc4ef6609440@FreeBSD.org> Content-Language: en-US From: Kyle Evans In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/17/25 12:35, Brooks Davis wrote: > On Thu, Jan 16, 2025 at 08:53:07PM -0600, Kyle Evans wrote: >> On 1/16/25 16:43, Brooks Davis wrote: >>> On Thu, Jan 16, 2025 at 03:52:22PM -0600, Kyle Evans wrote: >>>> On 10/30/24 16:08, Brooks Davis wrote: >>>>> The branch main has been updated by brooks: >>>>> >>>>> URL: https://cgit.FreeBSD.org/src/commit/?id=9ded074e875c29cb92d5f643801990d7bb23cca4 >>>>> >>>>> commit 9ded074e875c29cb92d5f643801990d7bb23cca4 >>>>> Author: agge3 >>>>> AuthorDate: 2024-10-21 21:42:13 +0000 >>>>> Commit: Brooks Davis >>>>> CommitDate: 2024-10-30 21:04:30 +0000 >>>>> >>>>> Refactor makesyscalls.lua into a library >>>>> * main.lua replicates the functionality of makesyscalls.lua >>>>> * Individual files are generated by their associated module >>>>> * Modules can be called as standalone scripts to generate a specific >>>>> file >>>>> * Data and procedures are performed by objects instead of procedual code >>>>> * Bitmasks are replaced by declarative types >>>>> * Temporary files are no longer produced, writing is stored in memory >>>>> * Comments provide explanation to functions and semantics >>>>> Google Summer of Code 2024 Final Work Product >>>>> Co-authored-by: Warner Losh >>>>> Co-authored-by: Kyle Evans >>>>> Co-authored-by: Brooks Davis >>>>> Sponsored by: Google (GSoC 24) >>>>> Pull Request: https://github.com/freebsd/freebsd-src/pull/1362 >>>>> Signed-off-by: agge3 >>>>> --- >>>>> sys/tools/syscalls/README.md | 49 +++ >>>>> sys/tools/syscalls/config.lua | 312 +++++++++++++++++ >>>>> sys/tools/syscalls/core/freebsd-syscall.lua | 147 ++++++++ >>>>> sys/tools/syscalls/core/scarg.lua | 163 +++++++++ >>>>> sys/tools/syscalls/core/scret.lua | 45 +++ >>>>> sys/tools/syscalls/core/syscall.lua | 497 +++++++++++++++++++++++++++ >>>>> sys/tools/syscalls/main.lua | 64 ++++ >>>>> sys/tools/syscalls/scripts/init_sysent.lua | 193 +++++++++++ >>>>> sys/tools/syscalls/scripts/libsys_h.lua | 111 ++++++ >>>>> sys/tools/syscalls/scripts/syscall_h.lua | 97 ++++++ >>>>> sys/tools/syscalls/scripts/syscall_mk.lua | 90 +++++ >>>>> sys/tools/syscalls/scripts/syscalls.lua | 109 ++++++ >>>>> sys/tools/syscalls/scripts/syscalls_map.lua | 74 ++++ >>>>> sys/tools/syscalls/scripts/sysproto_h.lua | 242 +++++++++++++ >>>>> sys/tools/syscalls/scripts/systrace_args.lua | 268 +++++++++++++++ >>>>> sys/tools/syscalls/tools/generator.lua | 113 ++++++ >>>>> sys/tools/syscalls/tools/util.lua | 194 +++++++++++ >>>>> 17 files changed, 2768 insertions(+) >>>>> >>>>> [...] >>>>> diff --git a/sys/tools/syscalls/core/freebsd-syscall.lua b/sys/tools/syscalls/core/freebsd-syscall.lua >>>>> new file mode 100644 >>>>> index 000000000000..193b1e43563c >>>>> --- /dev/null >>>>> +++ b/sys/tools/syscalls/core/freebsd-syscall.lua >>>>> @@ -0,0 +1,147 @@ >>>>> [...] >>>>> +function FreeBSDSyscall:parseSysfile() >>>>> + local file = self.sysfile >>>>> + local config = self.config >>>>> + local commentExpr = "^%s*;.*" >>>>> + >>>>> + if file == nil then >>>>> + return nil, "No file given" >>>>> + end >>>>> + >>>>> + self.syscalls = {} >>>>> + >>>>> + local fh, msg = io.open(file) >>>>> + if fh == nil then >>>>> + return nil, msg >>>>> + end >>>>> + >>>>> + local incs = "" >>>>> + local defs = "" >>>>> + local s >>>>> + for line in fh:lines() do >>>>> + line = line:gsub(commentExpr, "") -- Strip any comments. >>>>> + -- NOTE: Can't use pure pattern matching here because of >>>>> + -- the 's' test and this is shorter than a generic pattern >>>>> + -- matching pattern. >>>>> + if line == nil or line == "" then >>>>> + goto skip -- Blank line, skip this line. >>>>> + elseif s ~= nil then >>>>> + -- If we have a partial system call object s, >>>>> + -- then feed it one more line. >>>>> + if s:add(line) then >>>>> + -- Append to system call list. >>>>> + for t in s:iter() do >>>>> + if t:validate(t.num - 1) then >>>>> + table.insert(self.syscalls, t) >>>>> + else >>>>> + util.abort(1, >>>>> + "Skipped system call " .. >>>>> + "at number " .. t.num) >>>>> + end >>>>> + end >>>>> + s = nil >>>>> + end >>>>> + elseif line:match("^#%s*include") then >>>>> + incs = incs .. line .. "\n" >>>>> + elseif line:match("%%ABI_HEADERS%%") then >>>>> + local h = self.config.abi_headers >>>>> + if h ~= nil and h ~= "" then >>>>> + incs = incs .. h .. "\n" >>>>> + end >>>>> + elseif line:match("^#%s*define") then >>>>> + defs = defs .. line.. "\n" >>>>> + elseif line:match("^#") then >>>>> + util.abort(1, "Unsupported cpp op " .. line) >>>> >>>> This specifically is kind of a huge regression, and I don't really know how to >>>> cope with it. We've guaranteed for years that we'll copy preprocessor >>>> directives through to all output files. We don't use that upstream in >>>> FreeBSD, but we work with downstreams/vendors that make extensive use of it in >>>> their syscall definitions. >>>> >>>> I don't really know what the answer is to this, but we probably shouldn't have >>>> dropped it without some discussion first. This is going to be a bit of a >>>> headache... >>> >>> This response seems rather hyperbolic. This change was up for review >>> for months and the feature is unused in tree so there was no way to know >>> it was important. >>> >> >> Re-reading, yes, this was a bit dramatic; my apologies. There's plenty of >> frustration here, mostly amplified by the fact that I was on the review just >> as much as you folks and have worked in environments that use it- it certainly >> should have stuck out to me, but I just didn't have the time into it that I'd >> hoped I would. >> >> I would've also really liked to see an "XXX" comment at a minimum drawing >> attention to it or a call-out in the commit message, given that the syscall >> definition documentation isn't that lengthy and this is one of the few >> guarantees we make it. I think there's some compromise to be had, but... >> >>> It would be helpful to work through some examples understand what people >>> need here and if it really has to be a refactor to pass things through >>> or if adding some new tags and config values could do the job. >>> >> >> ... I'll respond to this this weekend, hopefully. I'd like to condense what >> I'm aware of into some formal test cases in sys/tools that I can point to so >> that we have something less abstract to debate the merits of, and also so that >> we have something we can verify the functionality against. > > I've implemented simple support for ifdef's syscall variants in > https://github.com/freebsd/freebsd-src/pull/1575. It's not robust at all > and may be missing some bits in newly generated files, but it's probably > not much worse than what's in 14. > I'll take a look when I get a chance, thanks. > I agree some tests would be good. I think I'd deviate from the norm and > run them as part of the top level `make sysent` for ease of develoment. I took a stab at this here: https://github.com/kevans91/freebsd/commit/083215d48541eb2be5e7725031c319f50f3881c8 Most of the uses are fairly trivial but, IMO, pretty reasonable (and generally of the same pattern). Even just a subset of CPP parsing to cover trivial #ifdef / #else / #endif sequences and tagging syscalls with a `condition`` that propagates to generated files would be sufficient, even if we aren't blindly propagating preprocessor conditions anymore. Thanks, Kyle Evans From nobody Mon Jan 20 13:23:17 2025 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 4Yc9yF3xNRz5lLSg; Mon, 20 Jan 2025 13:23: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 4Yc9yF3D7Tz41pQ; Mon, 20 Jan 2025 13:23:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737379397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Qd+E9lp1aY0SANtat480bLc2EBSCcGaPKYYz9k9lxQ4=; b=yWCj7MqoCS90BASgjezvAXWtL7hL3PaW6p3nMGQXvCpGxUBp3QQ40wdxLH7xWU0h2hwwWp PO8GK1n7+KNbBly6VQx6hwkW0fwR2OZPFlOo7AGKo9qVLU+HXvNZnQ8xgtWVkxSFrHNFD1 +OKxizIw5z5qgFczgN2YM2NJ9gBvnVl7vS5SjxXQ06hh+g8GnWus4SiFUGGbHfG9IST/ZM f3cw3H0T6ltWMiN7ogytvlrn3zVnLRaAaxga76EO97AMwub5djf1azO4oxXvABY9YdGQs6 R8NM4XucPPq/+fxi+1W/xTF2IUaKzC0JII78USqNY2zSdmkBuQMPmnxEq5NvNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737379397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Qd+E9lp1aY0SANtat480bLc2EBSCcGaPKYYz9k9lxQ4=; b=uv1KMCGqPP97Vj/acYYwFqpT/833nnwS/9bd24Z9W27+OLpnzd8BOlr3hNJ+uyFhjNu4Eq YO8WUldBoNxDen0IPjTpz3ahzK2EIF7ufR/mvHUcLIyATtbuSLMaDlS28QKK5CDWbDGMBT YrhzBppa/0A8d23lhvhpa/PIhvKUsxNBm58J92pax76mNRmTBH1d+C1EITuF1yKb0/KNBx jVyrjkqcTd3EAsxHK8wQhzuy5sb9Ilecbyal2COTHfbmn1EEX9Quz6XekngNihKCUC9gAg 1uZlHuwARxuHnCZyBeuYTzA83i2as4BNCuQJBN68cywCDVD4xrLE6RdZGR/8Yw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737379397; a=rsa-sha256; cv=none; b=TQmG2kV6gfa4wDpVYltcC/g5h3ifdwOaoecOSp91ZkQPPkvKEe7UBHvg5rhlepdzBU8Jhb 68WBzLUOp/5vi00hSaqeuihhbxlRD98CIWon2wh3xw6OhCMWyFNpUz8nsD/IR8ORBwfaDx XQuTnANbEvyC44MA+1Cu6XzupRvmP72SS6aJeXrLIxJc6S1iom7UOjTv54ffxqKdXlm1fv Wv7+wf9iANoYMdnUpVEivijoBqh48rPIHVECgBCGolsXSY5eYYmHLixFxKgDCVggE3B7fb 65rz3e2yZpbHUpOPFc1x32l496jVpJnaKFOmYR72xX7xIk+XhUBo6rwwR3NU/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yc9yF2pHPz62H; Mon, 20 Jan 2025 13:23: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 50KDNHu1074468; Mon, 20 Jan 2025 13:23:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KDNHsf074465; Mon, 20 Jan 2025 13:23:17 GMT (envelope-from git) Date: Mon, 20 Jan 2025 13:23:17 GMT Message-Id: <202501201323.50KDNHsf074465@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 90670e0e275c - main - jls.8: Reference correct manpage for libxo options 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 90670e0e275c6e36fc7e14368fc4e3e7f1d3671d Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=90670e0e275c6e36fc7e14368fc4e3e7f1d3671d commit 90670e0e275c6e36fc7e14368fc4e3e7f1d3671d Author: Ed Maste AuthorDate: 2025-01-20 13:21:51 +0000 Commit: Ed Maste CommitDate: 2025-01-20 13:22:44 +0000 jls.8: Reference correct manpage for libxo options PR: 284135 Sponsored by: The FreeBSD Foundation --- usr.sbin/jls/jls.8 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/jls/jls.8 b/usr.sbin/jls/jls.8 index 1361d70b654b..ce148da0d138 100644 --- a/usr.sbin/jls/jls.8 +++ b/usr.sbin/jls/jls.8 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 20, 2012 +.Dd January 20, 2025 .Dt JLS 8 .Os .Sh NAME @@ -66,7 +66,7 @@ Generate output via .Xr libxo 3 in a selection of different human and machine readable formats. See -.Xr xo_parse_args 3 +.Xr xo_options 7 for details on command line arguments. .It Fl d List @@ -112,7 +112,7 @@ Without this option, all active jails will be listed. .Sh SEE ALSO .Xr jail_get 2 , .Xr libxo 3 , -.Xr xo_parse_args 3 , +.Xr xo_options 7 , .Xr jail 8 , .Xr jexec 8 .Sh HISTORY From nobody Mon Jan 20 13:55:12 2025 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 4YcBg50wCyz5lN5m; Mon, 20 Jan 2025 13:55: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 4YcBg475XQz458N; Mon, 20 Jan 2025 13:55:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737381313; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zPaRw3Bj1RE3Ph/4UdqEQBAHCkhxfJQSOUQbf+EawMo=; b=OU84vyd3dYrubuV1rjbs/Lxd9PZswe6bafkKo9J7igT0JxXXSD4YKM9rXE0OocWsy63VBy RNwHIMIfin61qm2/6lBdoNPyK4sc5OdJaKSEkKSjPJ1wyCYEVzRJ27oJxQfSHbIbi3vILY jhTo+i/YDe9p4++tY1wqkiP40rr0ehbxaAAM0qBP0lE3UKSTAulMk57oTlOmr8qU+BUbii 3PNpIaOC2qLW5iJD+fL5A5RoGoFMjeMFVC15KhxHO0953v63+6lQ0heYUYm5Vxc2ofyAiR p2zGtV8VaxB8aMeFz3/V3Ftwglf+5ckl840bK58nbUzgXJZ3hSKWwSo3xtZBkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737381313; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zPaRw3Bj1RE3Ph/4UdqEQBAHCkhxfJQSOUQbf+EawMo=; b=ZeFrAYWogbruBNfw4gFUzapLAdYx8R2Dv9guZOFTVSFXBRu7t1jondbPNrCBjZ6ONwIQea 8PjyLTbvNV2Ku1fby5MrUAbxsKGOkjYczeCtg02MZLfgmrAEvK5ksXYWpFwUjKJ8go2h7L yNS2Nn3e0IHrekTpgI7xVJ5xJVlr/vw1HLkMxJU7COVJTr3fJ3aWKklCPl7vSM1V2Xnlsa dTM2uSjBKVniItueRuQle25xmMVxDXTQLC60Mi09uPRpg8pyjzA5cazuhqNDuKw8rzCm1A Ya8Hz0F14WkDx7AaOTPftWiz6IwngzvC6eV7WuCIc/BJ3Kr6vGeDmDpmEJDWMw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737381313; a=rsa-sha256; cv=none; b=B5dPRhOX2dyl2tsoj0FqBI6tx6E3eIwLpmITqwNknlGbDrBqrEwc2ErUxnvG/WdWv0fC1s V/vi8yVMi9NwU0leG4ub+WiO0+uQyL/p5wE96yO1uvpyo6AGi003c/4ZK0NeLJyzI3FVZB owpfmRi3FokZVIg71BWIJN/01TaP6K0BLlmCUjucx5twdpdZyYbaldAYEktzWJ/FLOHdm/ WZWdJvfRpc9/ltJhM2DYEjIegsQcRBf6oyO28aXKI9J48PPPG09hdfmlgxB+iN2k/Jd1oI ALqx18g20k7+lIJ3BLpkmyaRCrkAdb4bVe0mncF2Gzm62JE8FQkkOfXMWF0sfA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcBg46Qbkz6pF; Mon, 20 Jan 2025 13:55: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 50KDtCOZ030759; Mon, 20 Jan 2025 13:55:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KDtCjV030756; Mon, 20 Jan 2025 13:55:12 GMT (envelope-from git) Date: Mon, 20 Jan 2025 13:55:12 GMT Message-Id: <202501201355.50KDtCjV030756@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: f9097705fb1c - main - pkgbase: Fix OSVERSION specification when creating a repo 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: f9097705fb1c8d9c1f8946d1c1897d606bdbd517 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f9097705fb1c8d9c1f8946d1c1897d606bdbd517 commit f9097705fb1c8d9c1f8946d1c1897d606bdbd517 Author: Mark Johnston AuthorDate: 2025-01-19 23:25:09 +0000 Commit: Mark Johnston CommitDate: 2025-01-20 13:54:49 +0000 pkgbase: Fix OSVERSION specification when creating a repo -o OSVERSION= needs to appear before the "repo" verb, otherwise it has no effect. In this case, recent pkg-devel fails to create the repo, saying that ABI cannot be specified without OSVERSION. Reviewed by: kevans, manu MFC after: 2 weeks Fixes: 188fe88ec50e ("pkgbase: force OSVERSION") Differential Revision: https://reviews.freebsd.org/D48518 --- Makefile.inc1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index c8e6e63d2e39..efa1299b76a7 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2362,7 +2362,7 @@ real-sign-packages: _pkgbootstrap .PHONY .if ${PKG_BIN_VERSION} < 11700 printf "packing_format = \"${PKG_FORMAT}\";\n" >> ${WSTAGEDIR}/meta .endif - @${PKG_CMD} -o ABI=${PKG_ABI} repo -o OSVERSION="${SRCRELDATE}" \ + @${PKG_CMD} -o ABI=${PKG_ABI} -o OSVERSION="${SRCRELDATE}" repo \ -m ${WSTAGEDIR}/meta \ -o ${REPODIR}/${PKG_ABI}/${PKG_VERSION} \ ${REPODIR}/${PKG_ABI}/${PKG_VERSION} \ From nobody Mon Jan 20 13:55:13 2025 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 4YcBg61G4Fz5lN5n; Mon, 20 Jan 2025 13:55: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 4YcBg60dKTz45FC; Mon, 20 Jan 2025 13:55:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737381314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6g/RPq5UfLmjqyLdM8vcccCm0tPfhRuoZ4boM/aLVLY=; b=N1QA2EREDCnEUapiWEcd635dhdR7BDrcuc2K6tjIbuApohl/nokdpBBXn6a1P+Ix4Y+BMm jIrFn5XjtFehXLsDu8WMPA60RUUUQGN3WWwiEvPbvPaBxN4exKPBgYMtGBUsau609+UNAn JANZ1lI9r2+Adx5NqmYNklSp+ADg+K4oAF6av3trEebklNewBvWXW7qZQ78mL0HAFwIQwf R/s5Tu+qc+7/IIt+EBnftPYqXo9JCQCGee1+96n/qXBWl28TxwCQSRRoILRcwAkIATGbu5 HX2KAQ9peekC2fvekjH46iMrNcsGfCjCEr/IDPIcb9Yc/WlCiIZexrYZqE4f4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737381314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6g/RPq5UfLmjqyLdM8vcccCm0tPfhRuoZ4boM/aLVLY=; b=WzuZ+7uO60SMeG4R3Q75YPH3l4/XdVAO1k3suSzi22gfkMA02c8Vq+n0GpAG90MdAbYHyD I3mA2HKgKDgV9lGA9mdeyWx0wxLeCbtJ/YN8bIT26G1zKvg4+c3khFIwITI8FYs7D2DaxT z2nFVEn5nxC3tfzAHJLHgkFZjQsqQg7BkOm7fR0TF0BV0p2Tw9JEBJ8GJ0cEtNWYMZxbw4 KammH2HHENPKL9OPwq4mwlprBfg4SS8L3kFKrmNgddO+1MtUi/gnYfARNodmwIBcAqVb/0 Eho2/iCrcN+IhIP7ru7Ih1fTUrn3iJShvhd8vpB0doGBjcNiA2Rmr19anRFkvQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737381314; a=rsa-sha256; cv=none; b=FHQaTjkrhjtvjHi9CyBpvPM9UrYOgzbtmVaejeXqQzjuItCVDNpRNmo10CfALtAsgjyMy+ jmWC9Zmm7LAAAG3WDR3uFHZJb6JXxjZDYtEEAfQvDSBNue2H0Xn4kPDqU7wapHGMGOn+Pw drFM6Mgd1nF+UWOsSh4GuOnWUADbPMiz2+MMWeRckbNm+FySAwhl98mTB71ysLQ+dDPTx5 MV7FBYDr4jAZ1XzQ+I2MmXzRhXrcAkUtEMfOC/BnYxLFvRbI+l+/MmALkjVQ2pHVBfJY/b XXlv3+OQe7nrsRWGdURh1w52Q9Ibbntj8Vwa0QIo4IrtUuy+ckxdaTXuiuty3g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcBg60Dxfz6Qh; Mon, 20 Jan 2025 13:55: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 50KDtDIC030793; Mon, 20 Jan 2025 13:55:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KDtDJh030790; Mon, 20 Jan 2025 13:55:13 GMT (envelope-from git) Date: Mon, 20 Jan 2025 13:55:13 GMT Message-Id: <202501201355.50KDtDJh030790@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: 5b86888bae65 - main - ktrace: Fix uninitialized memory disclosure 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: 5b86888bae651e54ccc0adde0ed897ec1c1e0d45 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5b86888bae651e54ccc0adde0ed897ec1c1e0d45 commit 5b86888bae651e54ccc0adde0ed897ec1c1e0d45 Author: Mark Johnston AuthorDate: 2025-01-20 13:50:04 +0000 Commit: Mark Johnston CommitDate: 2025-01-20 13:54:49 +0000 ktrace: Fix uninitialized memory disclosure The sockaddr passed to ktrcapfail() may be smaller than sizeof(struct sockaddr), and the trailing bytes in the sockaddr structure will be uninitialized, whereupon they get copied out to userspace. PR: 283673 Reviewed by: jfree, emaste Reported by: Yichen Chai Reported by: Zhuo Ying Jiang Li Fixes: 9bec84131215 ("ktrace: Record detailed ECAPMODE violations") MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D48499 --- sys/kern/kern_ktrace.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 7a31fe234cb5..a67b773a154c 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -973,9 +973,16 @@ ktrcapfail(enum ktr_cap_violation type, const void *data) case CAPFAIL_PROTO: kcd->cap_int = *(const int *)data; break; - case CAPFAIL_SOCKADDR: - kcd->cap_sockaddr = *(const struct sockaddr *)data; + case CAPFAIL_SOCKADDR: { + size_t len; + + len = MIN(((const struct sockaddr *)data)->sa_len, + sizeof(kcd->cap_sockaddr)); + memset(&kcd->cap_sockaddr, 0, + sizeof(kcd->cap_sockaddr)); + memcpy(&kcd->cap_sockaddr, data, len); break; + } case CAPFAIL_NAMEI: strlcpy(kcd->cap_path, data, MAXPATHLEN); break; From nobody Mon Jan 20 14:21:03 2025 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 4YcCF32nbTz5lPHZ; Mon, 20 Jan 2025 14:21:11 +0000 (UTC) (envelope-from bapt@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.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 4YcCF26NKFz47Qx; Mon, 20 Jan 2025 14:21:10 +0000 (UTC) (envelope-from bapt@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737382870; 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: in-reply-to:in-reply-to:references:references; bh=RLgtl7JmaOu7BykleyseIyEWVi8uk61k7cZZQ5aqzXs=; b=jef9BSLihZjIqVT4UhXq8lODne0tfgv1vpLAI9UNyTsDf5L4pa7Jl5bxjH2WNtWwjEj+/V mpK1HDbDktb8FcQUqbyss1fsnhSnrNzpgPOXf8qNmHc4q64gTgtG1Do86KX5v7Kt5fytsb Bj5dL+nrrMSkNGQQxtQEFPRJ4vYFA4ijzq6wu8UwfExFTGSmacngoJyWjHdBAPzpMAZrBp rCsUHBmBFv24Hi3TUszS9VA7itKpbClzzNAH7WgttoA0U45aYt/M3ebnXMxtKLtFNULOEH AGx/unq1CRmBvh/tUhHxet85bTQ7/6E3Z0YcGa/EVF8W3ePhYlnD6/OQOjXX6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737382870; 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: in-reply-to:in-reply-to:references:references; bh=RLgtl7JmaOu7BykleyseIyEWVi8uk61k7cZZQ5aqzXs=; b=hCnom3EWRbxjcduH5tXxujzjb4kt19L1VQPU+OdyKsUW/rJgnLV7up3SXtC2KDutpKUMtD vonDm9Qm82rjXjfUknKnF0WygHsBgYn4LG2srUJEdqtaOg2XEbXiLnoCPHWwk0Lne6ZIl5 +mZipZhcr//nmbMJSVf50NKV5jxRyCRmFUYNxFlpKvj15fDm+u2TAKEpl2F4bZNIH1/oWy E+Bzh5L1am4FAszgwOdu7GgLqDPJX75n9NLlRgb6FVIU+rxfzza8VHlsgdPDIPa0hoZFED 4rW9az9ZNEAidKenMROG3+x8baYIe95XQXQDPH494X5NGQ5OBalAbQ+Yw2xE2w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737382870; a=rsa-sha256; cv=none; b=mN7leVcSXXDtqmIZFHzGrlK5MquOu5EifI5m+eenx1ZgInXOK2K/2PIwQvtmlicy1Inic6 lOIx9mgwBlq2E3M5Yq9brZ5g3TU4NPFVj7h15cOFfvGY0VVcfs66ji7fASWRv7c0aRuDA7 vLG0YelwGQxDwfw+5auV8+7MlNFgcMcmEknfpeCWlEe6CmOQPg/YSt4I667DzUHvpwDeZ0 ONoRU4SPbL+tBIYsvf3T3QVImu+koPt8yIJbf8W+c/9kRkHwAvr9du1ElqWplHmjE06JVv dkHqDqCMZV5vPu+tPjkKHGSJz8irqeaUOenm2h6aecFezEAH+03U6UBzl7vp5Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcCF255QTzw3w; Mon, 20 Jan 2025 14:21:10 +0000 (UTC) (envelope-from bapt@freebsd.org) Received: by aniel.nours.eu (Postfix, from userid 1001) id 980F3DFCBD; Mon, 20 Jan 2025 15:21:03 +0100 (CET) Date: Mon, 20 Jan 2025 15:21:03 +0100 From: Baptiste Daroussin To: Mark Johnston Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: f9097705fb1c - main - pkgbase: Fix OSVERSION specification when creating a repo Message-ID: References: <202501201355.50KDtCjV030756@gitrepo.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=us-ascii Content-Disposition: inline In-Reply-To: <202501201355.50KDtCjV030756@gitrepo.freebsd.org> On Mon 20 Jan 13:55, Mark Johnston wrote: > The branch main has been updated by markj: > > URL: https://cgit.FreeBSD.org/src/commit/?id=f9097705fb1c8d9c1f8946d1c1897d606bdbd517 > > commit f9097705fb1c8d9c1f8946d1c1897d606bdbd517 > Author: Mark Johnston > AuthorDate: 2025-01-19 23:25:09 +0000 > Commit: Mark Johnston > CommitDate: 2025-01-20 13:54:49 +0000 > > pkgbase: Fix OSVERSION specification when creating a repo > > -o OSVERSION= needs to appear before the "repo" verb, otherwise it has > no effect. In this case, recent pkg-devel fails to create the repo, > saying that ABI cannot be specified without OSVERSION. > > Reviewed by: kevans, manu > MFC after: 2 weeks > Fixes: 188fe88ec50e ("pkgbase: force OSVERSION") > Differential Revision: https://reviews.freebsd.org/D48518 Good catch! Thanks! Best regards, Bapt From nobody Mon Jan 20 15:10:51 2025 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 4YcDLM4fM6z5kDJW; Mon, 20 Jan 2025 15:10: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 4YcDLM2J7wz3Fnf; Mon, 20 Jan 2025 15:10:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737385851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dFPuyR+W2aMdXRpkzc+PfXLoC2NHEogoryOuK69WkTM=; b=nZYFhUVniAekv5iJsBjkhj5sZIiB2yybpDB7WE+LbIcUkgCpDbz25mqkgTJoK5daiyrZH5 TLWeWjeVJMXgjO5wlNGrRvmYNc+p+GBZI4s1ce1XG6gidDefXPqDjyhlWbn3X+LnXA0siW qFyeA6jDpr+nLiOs48yhKSm3H9JmyL3d15yZb1KjGxFE1IXN1WDygZzAhr51GhgidQw4r0 p297Lexr9Lm/bIxXLUWsHCr8ydxoV3jYRWN35gr9hnLo1YSTJWr6rnhqEMF5zotkP9KPWC SljE7Q7m4xPPFrH0iEw5pxIV7HyZT9w5uBpWSDxBx7/gOWlwqtaJVvdFU7X2Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737385851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dFPuyR+W2aMdXRpkzc+PfXLoC2NHEogoryOuK69WkTM=; b=fYL75yvIGgyJoDIwnT7pb1sxQUzzNva7ntSf/0biEwh0YW8lXL+sBED4aqmLPfnFAUzxrm PyUKwDlfWn41pEUVNZstbC30mIX98LFsSZbWHtFPL6Vrh2FCLg6Qx8Vq/uFvFyhZYNpDMD k9HzeAJvjODKad45oH/7JcVgnXv76SzeiFVVkECAnbQN3OwujTDG5WaCWccCT3X6NVeXvR tF/t1Hmhsz0y8jX4/42YCCdxGG2MeMVpbyD8Em8HOngCp5R6ddCS2c11/a7t1vfq+fsi8G u6WPs94WJyDZyJT/6fvmq4S6EVuClSKPEetU8GIkoKIoilFdcWbZWvelOROnBQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737385851; a=rsa-sha256; cv=none; b=ETeImRDBCVsRVvAuDe9ITQlkSolnU+vdUk70CNUa5xU39TXaCc9BaiR8dNjkon7uHhdxO1 wutU3s7hAOm4lrZfdvsglP+D6jznWY3lWMxghXqPVyPf4S17u1Y0XB4frw/2vHX4vdGK9Q wWV5MshHPf+33nK3sGEawSVhfsBuFwlf95g/oAM/4H8oG4eMc6c5StzVHL7q8f2fVPrBeF y5Th8KakSNWE3w8lbu/Ok+aNKBLixmcKy3bhJkw+qjrSL3KQjP3xTChfaj9eBOdOg/XRc6 ekDwdFoaqFpLAcBvGEclnxWPrSGdM5yvktbKs4gpqNQCbZhGnJmXiycKHw532A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcDLM1lHdz9Jw; Mon, 20 Jan 2025 15:10: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 50KFApZX073396; Mon, 20 Jan 2025 15:10:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KFAp9H073393; Mon, 20 Jan 2025 15:10:51 GMT (envelope-from git) Date: Mon, 20 Jan 2025 15:10:51 GMT Message-Id: <202501201510.50KFAp9H073393@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: 013784c967f9 - main - netinet: virtualize net.link.ether.inet.garp_rexmit_count 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: 013784c967f994058f701c1fd2a82a2cc0bd90b0 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=013784c967f994058f701c1fd2a82a2cc0bd90b0 commit 013784c967f994058f701c1fd2a82a2cc0bd90b0 Author: Kristof Provost AuthorDate: 2025-01-20 13:19:20 +0000 Commit: Kristof Provost CommitDate: 2025-01-20 13:28:38 +0000 netinet: virtualize net.link.ether.inet.garp_rexmit_count Turn garp_rexmit_count into a per-vnet variable. This immediate use case is to enable easier testing. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netinet/if_ether.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 81f4b901f21b..502261f5f2d9 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -155,11 +155,12 @@ SYSCTL_INT(_net_link_ether_inet, OID_AUTO, max_log_per_second, */ #define MAX_GARP_RETRANSMITS 16 static int sysctl_garp_rexmit(SYSCTL_HANDLER_ARGS); -static int garp_rexmit_count = 0; /* GARP retransmission setting. */ +VNET_DEFINE_STATIC(int, garp_rexmit_count) = 0; /* GARP retransmission setting. */ +#define V_garp_rexmit_count VNET(garp_rexmit_count) SYSCTL_PROC(_net_link_ether_inet, OID_AUTO, garp_rexmit_count, - CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, - &garp_rexmit_count, 0, sysctl_garp_rexmit, "I", + CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE|CTLFLAG_VNET, + &VNET_NAME(garp_rexmit_count), 0, sysctl_garp_rexmit, "I", "Number of times to retransmit GARP packets;" " 0 to disable, maximum of 16"); @@ -1377,7 +1378,7 @@ garp_rexmit(void *arg) * the callout to retransmit another GARP packet. */ ++ia->ia_garp_count; - if (ia->ia_garp_count >= garp_rexmit_count) { + if (ia->ia_garp_count >= V_garp_rexmit_count) { ifa_free(&ia->ia_ifa); } else { int rescheduled; @@ -1444,7 +1445,7 @@ arp_ifinit(struct ifnet *ifp, struct ifaddr *ifa) NET_EPOCH_ENTER(et); arp_announce_ifaddr(ifp, dst_in->sin_addr, IF_LLADDR(ifp)); NET_EPOCH_EXIT(et); - if (garp_rexmit_count > 0) { + if (V_garp_rexmit_count > 0) { garp_timer_start(ifa); } From nobody Mon Jan 20 15:10:52 2025 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 4YcDLN4KCSz5kDMm; Mon, 20 Jan 2025 15:10: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 4YcDLN3Crrz3G37; Mon, 20 Jan 2025 15:10:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737385852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=R6sjyqjZfFIryK/CeJVjob8fB1CgiPWtRZG1t9JTNG8=; b=Bp5gZtlJqmtvvL6pZjy0Z4DeCfZxDzLu+/Ytn/AFCLkopio/Zritozfkbg/dDnxKJDpfzl Ng0FOUPtwT5VEeiXCOqGMp5+eSWHqQQH8a7FqinBj+YjwHrryk6miZpw9oZWtSTM4F6H7y YrOaGNzvCROmBaMNfiNhXwpicngzAh0bHeve7sXV3dDKGMSfHCalaxoBAtVGnfkhQDr/cp WMwhEDSHv7AueXntg4iKbqRnNVnh+3wEtjbbXSVT9vb6hIp27pKysJQkuzPjOqYrPjZk1i TT0BA7UcRieSx/ZFmdr4fEBUvm4BbuNK1/y4bk6iE5PmtwN7Y+P+4ltaa8tx3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737385852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=R6sjyqjZfFIryK/CeJVjob8fB1CgiPWtRZG1t9JTNG8=; b=oJ07PpLpNxxTrNrLv3sK0jttkIRD7bgC6lwlSKoNiFvUO9tYn5wgAHG8D6L8zeK9toW/dj Ubr8kusUdrhLWUBkfJneJVFbbU5tpIvnfNV6YSYGQVOotY6X9YO4rT56D740oWyz/BgQRN Ob5sIbIds/3idwRrZI0KuX71CZGpHYoQdlOkGQNV+t1IO/iig/r15w3ZnSB0/ATvayywBQ 026S2YQCExtTte6nUUnX7qhSL5UpSCXNsz+N6YNzHQxQuJ9UVc7IQyj57m9/y/v2NMskcz yDdxhIvZ7o2HKCEhfSGRjZDrLeyVF720DilOz4EJIgyq7oIJwyc+TMST5rnu+A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737385852; a=rsa-sha256; cv=none; b=uNZxwN6qzZUxmqyT7RqY9QCJ2QRpm2GA3glE1yrbdoRsNFonVxpNP9wtBKBTSqIIIsL0Pr /7ID7jhmPELeO4MMj52OvyKa8P9f578nBh86pJ3b1ErifFd9bS1MR0Qq4mU5I7hEMdWvJT G8WHL4yWiF4OJ95PMNzm1NNnsa1oap4y+IIkxFRoBvzY2eSU1CXndyhbHznbqHZdxuz9ne ZWMUFOTKIAa+IDDccX22UBZmp/hk3JIZbRYS7xmym9sogkNMy3nlvGnVqj3xKc0RVu7tMp 5Y6DTrXxl19TZwjZw0DxO5cszxjaZWESHGnltOTLdi6Se0olnC8OgMfK67jRhQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcDLN2hFSz8vp; Mon, 20 Jan 2025 15:10: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 50KFAqkr073431; Mon, 20 Jan 2025 15:10:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KFAqfU073428; Mon, 20 Jan 2025 15:10:52 GMT (envelope-from git) Date: Mon, 20 Jan 2025 15:10:52 GMT Message-Id: <202501201510.50KFAqfU073428@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: 38fdcca05d09 - main - netinet: enter epoch in garp_rexmit() 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: 38fdcca05d09b4d5426a253d3c484f9481a73ac2 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=38fdcca05d09b4d5426a253d3c484f9481a73ac2 commit 38fdcca05d09b4d5426a253d3c484f9481a73ac2 Author: Kristof Provost AuthorDate: 2025-01-20 13:24:48 +0000 Commit: Kristof Provost CommitDate: 2025-01-20 13:28:39 +0000 netinet: enter epoch in garp_rexmit() garp_rexmit() is a callback, so is not in net_epoch, which arprequest_internal() expects. Enter and exit the net_epoch. PR: 284073 MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netinet/if_ether.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 502261f5f2d9..88da1b139b1f 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1353,6 +1353,7 @@ sysctl_garp_rexmit(SYSCTL_HANDLER_ARGS) static void garp_rexmit(void *arg) { + struct epoch_tracker et; struct in_ifaddr *ia = arg; if (callout_pending(&ia->ia_garp_timer) || @@ -1362,6 +1363,7 @@ garp_rexmit(void *arg) return; } + NET_EPOCH_ENTER(et); CURVNET_SET(ia->ia_ifa.ifa_ifp->if_vnet); /* @@ -1393,6 +1395,7 @@ garp_rexmit(void *arg) } CURVNET_RESTORE(); + NET_EPOCH_EXIT(et); } /* From nobody Mon Jan 20 15:10:53 2025 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 4YcDLQ0Bj7z5kD6d; Mon, 20 Jan 2025 15:10: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 4YcDLP4C9yz3G3C; Mon, 20 Jan 2025 15:10:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737385853; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=e2F2FkxtasF2/KfByqSHHoLssFcboqnjVB+zJ46yohM=; b=EhnLq2Wy9yZ5mwJcPqGeTYyUtehXNI13nSIEqNAV2PaQLsK8RmSF3WLarSMrB4J9SFglNj ++pvP9sUp3Mfc6V9oRpR5AgQQGY4H6/gvJhyFMohTqYIODdZHGu0T7V/1w7mAJWNLNwsYE cOFVe4SA9aRpzQ2qJ3LHWUVkh/B9GoxqudWHY7zOMa8eNcncRCp9j6UaASelq6zpYNyyon tCBOzChsHbPI3XbnCfae01tu0ZUH5GetLyHvxOaNK7NBgp9seAdKlYPR9ov5rMcpmVtbj5 NwcK1WDbx2F40GbTqFhfhlW944KSqD9Mkhp2+wQseEPpy0Q/v0norrWEKrWYwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737385853; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=e2F2FkxtasF2/KfByqSHHoLssFcboqnjVB+zJ46yohM=; b=Mk9f5Va85JMZ34MbtI/g/f9QFCL/eMCKpu2zfBNztrWuKr/R/5w4PrARSuvioL+3dRjd40 6abREiettsDhc2dzs+yiYG0BVnoax2CQ9L+mG9/Kx79hfWeoPuWaVUbR2hihhp9lgi++3r bd7gOV7BrEAm+roIDmXf5dWDOpELH7Vfr1CVsOrYQwQr+E1hqTTbj8XiQBDgfedcwwLr9Q s2CM3ArX+x/yymJ4nkO7ULOqD4dL/eF+HlAXUMkIGH5NDS2RXwY1rIVIMuq8/Hss3n7hOy JpBY7ZnfZr2W41WMNlFNAA2mU2ZepockAvU7F38Wk/TFzEujpRl8WT3ESM7pQg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737385853; a=rsa-sha256; cv=none; b=smoL1Fd5T5wJx5EwJhJ7dE/SOGfQlLWZ7wdtPWaOlCWEEdXgep7OfmC7Ij6z8OL0uDRi/4 WCTgOYrkHFXmpiR1JM0TosIj/NnITxMy+52SPu2PNZyNwuXXN2MX0aTnc6bTBWXLZaP4oe ZfsKanUvxwCQ55p7nF7HdS8nnwWLgNrV+is1vl1e/3HbTR8uEHxfth7xyrAsHNCeB0KYsZ T3VprDucfhSgxz8K5Ffm3sTEnVERL6dlPKtmlKXM1Q64rV8CPnxqKl432oYe2tKhUl5O6K +pC4aDYcVFQCyS18ONTT2ibSakk0BgjPf30Ai2dwWssBTUFZ2DqiIvbcsb+ZtA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcDLP3bZHz8vr; Mon, 20 Jan 2025 15:10: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 50KFArRi073466; Mon, 20 Jan 2025 15:10:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KFArq4073463; Mon, 20 Jan 2025 15:10:53 GMT (envelope-from git) Date: Mon, 20 Jan 2025 15:10:53 GMT Message-Id: <202501201510.50KFArq4073463@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: b4bd97ec168e - main - netinet tests: basic garp test 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: b4bd97ec168e97360cf9511b975a20f677864661 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b4bd97ec168e97360cf9511b975a20f677864661 commit b4bd97ec168e97360cf9511b975a20f677864661 Author: Kristof Provost AuthorDate: 2025-01-20 13:27:05 +0000 Commit: Kristof Provost CommitDate: 2025-01-20 13:28:39 +0000 netinet tests: basic garp test Excercise the garp code. This doesn't actively verify anything, but is sufficient to trigger the panic reported in PR 284073, so it's a useful test case to keep. PR: 284073 Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netinet/arp.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/sys/netinet/arp.sh b/tests/sys/netinet/arp.sh index 34946d42f250..c7744d5de938 100755 --- a/tests/sys/netinet/arp.sh +++ b/tests/sys/netinet/arp.sh @@ -229,6 +229,32 @@ static_cleanup() { vnet_cleanup } +atf_test_case "garp" "cleanup" +garp_head() { + atf_set descr 'Basic gratuitous arp test' + atf_set require.user root +} + +garp_body() { + vnet_init + + j="v4t-garp" + + epair=$(vnet_mkepair) + + vnet_mkjail ${j} ${epair}a + atf_check -s exit:0 -o ignore \ + jexec ${j} sysctl net.link.ether.inet.garp_rexmit_count=3 + jexec ${j} ifconfig ${epair}a inet 192.0.2.1/24 up + + # Allow some time for the timer to actually fire + sleep 5 +} + +garp_cleanup() { + vnet_cleanup +} + atf_init_test_cases() { @@ -238,6 +264,7 @@ atf_init_test_cases() atf_add_test_case "pending_delete_if" atf_add_test_case "arp_lookup_host" atf_add_test_case "static" + atf_add_test_case "garp" } # end From nobody Mon Jan 20 15:50:43 2025 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 4YcFDM4W2Pz5kGr7; Mon, 20 Jan 2025 15: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 4YcFDM3xtfz3NYK; Mon, 20 Jan 2025 15: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=1737388243; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WRFkgexaSgPNWAlYVs0tSLJ0OAwWGNDS+u86Z+ua+hg=; b=ekNbr6GCeLSGlBhqrbwetOtmHitCQTqG8JBLgap3g6R4exiun2tdgWeTVziWrfV+WM+viz 5/Fmf5EVRt6cA2u+TRdBLR0nDpsL21cqQFGDq16PwY63Xawb7C/V672/2VAijAZadHgCKN qlKChoXKddSwKVoJ3jtbnukfMfwWYFx8bsDA46JButCHxdryKcqKFlxVLYfgYsFiS51ddB 6qyw9q225AT9A2WNjcgIgsT6XyVULl507drWvFSggBtFRWV0ZadKOBKg78RQ/7cxiJRkVQ 6edT0QWBpCTyZJvb4WjszXP9JmdbjLAd8dsWHU/rZDelLEEO8OVcsIqZbqdDWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737388243; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WRFkgexaSgPNWAlYVs0tSLJ0OAwWGNDS+u86Z+ua+hg=; b=etXOYjyfbJF34i+5wOPwxZOW2cB4ABmxKLojmvX4pzia+3iobQ216q1OLmnXAEoOxXNCGr qzTOUob4FyWQetJfrONVlQbsSqtmei5djnMKmTbSLOu04VCqqF2U60GeaVeGy5KN9ifP3b z3pJwDzp7Pm7eRB6tk2abyzWIzWljPFYerU4sib3cLBVGdXrrj7GiKidwJDoOKX55l0csm Cqc6mmnX+7VjJLHDch+aNBj/W7iqFZgDX/dg/vhxhpLavz+ruHRFW/WS7PpmvSeisYC2vx UX2splN2PANCwcVxv8SJU4CiEn4RVat1/KuT0k5TLpuHpvPdxW9d14hWm1Inkw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737388243; a=rsa-sha256; cv=none; b=YuNHv8ILW83x+tsVUEiWhb9HYIaDiX3cp7angPtUhSF81wW1x10sbvpBT8EKSp/JpuXU8w B5g8cSV+od3Nq7fGPYiCRG5Sabt151yyacI6bD/1b5mvDCxCV//FB0tZ5v/jSVobXwkUxh LqYqTNqJv+3ftrf5Lx8Nhc00MsUM+pFXd51vzSDfoBtoFeaFVHW0iLdSKdlpX/xVFKaqAb vpPPwoYDjhUXSxBAyjIFgtbFzfSaqHCvXCFVTJ6fG3zJnfRWkxfQag3V79uHSo6O2+jHw3 ZLHK4N1qY3VE92dPxvr18dVkjnwRDtgkebgOWtvxHip4wtBzfTiQjHkBYXsasA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcFDM3NCVzBP5; Mon, 20 Jan 2025 15: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 50KFohFc047237; Mon, 20 Jan 2025 15: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 50KFohIa047221; Mon, 20 Jan 2025 15:50:43 GMT (envelope-from git) Date: Mon, 20 Jan 2025 15:50:43 GMT Message-Id: <202501201550.50KFohIa047221@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: ac2156c139f8 - main - atomics: Constify loads: riscv: Convert missed atomic_load_acq_64() 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ac2156c139f8f685b84a71a7f0f164d6cccc7656 Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=ac2156c139f8f685b84a71a7f0f164d6cccc7656 commit ac2156c139f8f685b84a71a7f0f164d6cccc7656 Author: Olivier Certner AuthorDate: 2025-01-20 12:53:13 +0000 Commit: Olivier Certner CommitDate: 2025-01-20 15:49:45 +0000 atomics: Constify loads: riscv: Convert missed atomic_load_acq_64() Reviewed by: kib Fixes: 5e9a82e898d5 ("atomics: Constify loads") MFC after: 4 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48497 --- sys/riscv/include/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/riscv/include/atomic.h b/sys/riscv/include/atomic.h index bf9c42453d8b..74ffc171b028 100644 --- a/sys/riscv/include/atomic.h +++ b/sys/riscv/include/atomic.h @@ -569,7 +569,7 @@ ATOMIC_CMPSET_ACQ_REL(64); ATOMIC_FCMPSET_ACQ_REL(64); static __inline uint64_t -atomic_load_acq_64(volatile uint64_t *p) +atomic_load_acq_64(const volatile uint64_t *p) { uint64_t ret; From nobody Mon Jan 20 15:50:44 2025 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 4YcFDN6Nb8z5kGcW; Mon, 20 Jan 2025 15:50: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 4YcFDN4lgCz3NVn; Mon, 20 Jan 2025 15: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=1737388244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lJCWwyQuHx67SBB3eAXsN78pQuNHQbbmIwuO3wjGgAs=; b=eb30PZonn0dKGydKVRSSUcdGZmXtEET6ocycvloGJA4c+405NlpevW78QARxDXBWxiam+s TZhQhhLCISR/KWd6QAESt/h3JL2dpVSIwbqqnovlHPNp4+IjGm/PpfaPO9EcK989gOvDOc xYOWT08FvsFJ4VKWLtUlvXYvM6VXYbarKKuEiX1trSRNl3oGAQImAZndB3vflEzjgbKIQe 6wS+3J3BW8Nbda5ZfUk/13rUQSdVOEaJjyyMQjysRzKlD3VN+c4g69ZFcM1DPPopHB6jmr h+4OJZW1XvgY84aAG2FwO2IeHKD6cWrrnIcLiCBd99zJ5h0v2nZvo3eInX7bTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737388244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lJCWwyQuHx67SBB3eAXsN78pQuNHQbbmIwuO3wjGgAs=; b=rI4MeSsgOvccikEFNx++THt96atXFOtvdkDLDZ1vOUhkf/02/fNMbEQpMBP0yD3hTEsDs1 I3UG1PIGBW3Aoq6HTajzJva5tqdycu+NyzDiDD1k2MhT3V0oK4s+k02ADO1llKF6PIwVqQ ezELhSJ8CqAPaKgPJqED22R2cOZUluScxZGAyAMJLNKoPk7JMOD53m2qM2Hz/qV0UOP+tW HxaRfDv8ilk36iNx9XDK1Sy56mWjaow5KeEIms8p9TrkEc+M92LRFCnjrmKkTdU158Z46K vuROVytzTyCV1kSVBmrrAdzMDqvjeqEinHeUrPNAusa3EPmYnyhIS0NmO+u/EQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737388244; a=rsa-sha256; cv=none; b=Bckb1yqZrdYSOkZ6dPit02WSF/zatdFYpVWcGtdj1WlfpDNNxNWn6FvbGpMgo8woMfsUkr wALOdhhiO4JgHFx2Z8CT+eZ2NBfnjNvy6l6LfEA0WSBHeSzCnKtGDajmsAh1wbpsDM2Wa+ 9UMct8tnnZB0cmKMDYJzVQcXs0fcmz3JMNmTu/8k7uLEYR++ghDG8i3tGrh3e6C3G1jgdr g+DXgqQmERBAifCTptWD6XWfRZTYXyDkoVMIkoQwBoNnK7hsX8mKZgIuiZNpYyAnUOY6YF jiE7PIZnBDvqd5RuyMBzVNMcMJ3TYn7gt5h/fWVOnv9W9Um19wPVY3XkLe0nFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcFDN4HxYzBcn; Mon, 20 Jan 2025 15: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 50KFoie6047868; Mon, 20 Jan 2025 15: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 50KFoiO1047865; Mon, 20 Jan 2025 15:50:44 GMT (envelope-from git) Date: Mon, 20 Jan 2025 15:50:44 GMT Message-Id: <202501201550.50KFoiO1047865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: d0cbb1930e82 - main - atomics: atomic_load_consume_ptr(): Accept pointers to const 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d0cbb1930e82a53b07b1091402ff14cdfe7a4898 Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=d0cbb1930e82a53b07b1091402ff14cdfe7a4898 commit d0cbb1930e82a53b07b1091402ff14cdfe7a4898 Author: Olivier Certner AuthorDate: 2025-01-20 13:53:35 +0000 Commit: Olivier Certner CommitDate: 2025-01-20 15:49:52 +0000 atomics: atomic_load_consume_ptr(): Accept pointers to const Now that all directly-implemented loads (with acquire semantics or not) accept pointers to const, ensure that atomic_load_consume_ptr(), built on atomic_load_acq_ptr(), does so too, in the common atomics header as well as *SAN interceptors. Reviewed by: kib Fixes: 5e9a82e898d5 ("atomics: Constify loads") MFC after: 4 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48497 --- sys/sys/atomic_common.h | 2 +- sys/sys/atomic_san.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/sys/atomic_common.h b/sys/sys/atomic_common.h index e03cd93c2d4a..e802b2a99630 100644 --- a/sys/sys/atomic_common.h +++ b/sys/sys/atomic_common.h @@ -133,7 +133,7 @@ * openly resorting to the stronger acquire fence, to be sorted out. */ #define atomic_load_consume_ptr(p) \ - ((__typeof(*p)) atomic_load_acq_ptr((uintptr_t *)p)) + ((__typeof(*p)) atomic_load_acq_ptr((const volatile uintptr_t *)p)) #define atomic_interrupt_fence() __compiler_membar() diff --git a/sys/sys/atomic_san.h b/sys/sys/atomic_san.h index 93a9bfcbf593..06c6c98ec8a8 100644 --- a/sys/sys/atomic_san.h +++ b/sys/sys/atomic_san.h @@ -270,7 +270,7 @@ ATOMIC_SAN_THREAD_FENCE(SAN_INTERCEPTOR_PREFIX); __DECONST(volatile uintptr_t *, (x)))) #define atomic_load_acq_ptr ATOMIC_SAN(load_acq_ptr) #define atomic_load_consume_ptr(x) \ - ((__typeof(*x))atomic_load_acq_ptr((volatile uintptr_t *)(x))) + ((__typeof(*x))atomic_load_acq_ptr((const volatile uintptr_t *)(x))) #define atomic_readandclear_ptr ATOMIC_SAN(readandclear_ptr) #define atomic_set_ptr ATOMIC_SAN(set_ptr) #define atomic_set_acq_ptr ATOMIC_SAN(set_acq_ptr) From nobody Mon Jan 20 15:50:45 2025 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 4YcFDQ0053z5kGgq; Mon, 20 Jan 2025 15: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 4YcFDP5jgGz3NYS; Mon, 20 Jan 2025 15:50:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737388245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=32pe9Pf499pgiN9nnnVTwCFK8Sm61u3H/JR7JDixdH0=; b=YvBh23BKJ9c2n+DxNfwJjZ9FcXCnfS63Mq61vcBcv2NVYZvv2h+IICX/SwMRyolQbopLum hzsTdsRY5bDaadJ5JnMmnRkD/RY88nOAJ1iiV+JrtoIoNKIZ1aNGq038OhJwsPmc7y91fV ojlZvlmmyqwkc51cWDjA1gn3nA9O7zf6VcLLJ9EijWe6UmJrkdbIrtFs663wmZkggiViNd DnDk6dFEZYWA1Bf5NiBijSSfHt+9I47em9YT287J7VZKnlQ74e/pkA+c6RlinRXoKJIHBt UaPZqDEXTiI2ZEYnBNuhqonL0gwoECXMBhiea0oMV7tnfClRazuf/bVNt1bCaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737388245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=32pe9Pf499pgiN9nnnVTwCFK8Sm61u3H/JR7JDixdH0=; b=aO3FMjDGKOu5tmvoH5zTN6PAFZaR5OUpin6LSWFYLAdfsA6iPRYn1GLLcLYaWmNJlGiH55 YitFaoSJ1a7pFhfmhTOSsazpQ6CQPzN0tlSJHhGQqsqyK5G6qsTKTw616VdOOJS8w4qmek KYC4Q7Fn/0klr+xEMq1geM0/dEBTr7pbuex6Flt9SlhYlcA98+fErKhn/A8PkDZKrNN11K Gx7SzNQZqqIBw9X2Vn8Zrzylm4VRt8TcZvbJnajZPKo/ZlHG75VB0z2bGNixCILBCTOYOd K3fDfKC3qc9z2YFLSp6Q5GHpjoYhYGAoBXjj/IbIUUdPiTgo4lD04yR6eFrcWg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737388245; a=rsa-sha256; cv=none; b=QMf4lGpaauWxjcEQELTFsA/jvMikz3k0fgCZHA6fig4h/1bld+yuDUams9m8pVIkA8+QHx vaH4jak2I/t35pcn19Fd66vUkmCVa9jinX8btAoZDWlASseIIAtv3kil3tMcBtH4b43SfZ REfChumm2cilnzqUCiXuLJx5Qm4yKt2J+8gYZCqzNskKpA996bxjrqJ87McBGs7bpxOTAV fpz2qH3mj78nmJH4enq63+vI+kh7YaTt417+60fI72Gnn54dyi5gm6DXeENlTvRn7t2Zwy zhAycAqSXFpksR0fnwu3pdYPgHvuApiKWuL8I76mppjBXfyKoIEA1yt1QAFDPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcFDP5DdQzBDh; Mon, 20 Jan 2025 15:50: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 50KFojHX047902; Mon, 20 Jan 2025 15:50:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KFojnA047899; Mon, 20 Jan 2025 15:50:45 GMT (envelope-from git) Date: Mon, 20 Jan 2025 15:50:45 GMT Message-Id: <202501201550.50KFojnA047899@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 62af5b9dc620 - main - atomics: Constify loads: Remove now superfluous uses of DECONST() 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 62af5b9dc6205289a0ace964d060fba64e71ef28 Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=62af5b9dc6205289a0ace964d060fba64e71ef28 commit 62af5b9dc6205289a0ace964d060fba64e71ef28 Author: Olivier Certner AuthorDate: 2025-01-20 14:28:37 +0000 Commit: Olivier Certner CommitDate: 2025-01-20 15:49:52 +0000 atomics: Constify loads: Remove now superfluous uses of DECONST() No functional change (intended). Reviewed by: kib MFC after: 4 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48497 --- sys/compat/linuxkpi/common/include/linux/seqlock.h | 2 +- sys/sys/atomic_san.h | 3 +-- sys/sys/seqc.h | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/seqlock.h b/sys/compat/linuxkpi/common/include/linux/seqlock.h index 48e42efc10fe..554fdfd6e202 100644 --- a/sys/compat/linuxkpi/common/include/linux/seqlock.h +++ b/sys/compat/linuxkpi/common/include/linux/seqlock.h @@ -99,7 +99,7 @@ lkpi_write_seqcount_invalidate(seqc_t *seqcp) static inline seqc_t lkpi_seqprop_sequence(const seqc_t *seqcp) { - return (atomic_load_int(__DECONST(seqc_t *, seqcp))); + return (atomic_load_int(seqcp)); } #define seqprop_sequence(s) lkpi_seqprop_sequence(&(s)->seqc) diff --git a/sys/sys/atomic_san.h b/sys/sys/atomic_san.h index 06c6c98ec8a8..9a82ff6762c6 100644 --- a/sys/sys/atomic_san.h +++ b/sys/sys/atomic_san.h @@ -266,8 +266,7 @@ ATOMIC_SAN_THREAD_FENCE(SAN_INTERCEPTOR_PREFIX); #define atomic_fcmpset_rel_ptr ATOMIC_SAN(fcmpset_rel_ptr) #define atomic_fetchadd_ptr ATOMIC_SAN(fetchadd_ptr) #define atomic_load_ptr(x) \ - ((__typeof(*x))ATOMIC_SAN(load_ptr)( \ - __DECONST(volatile uintptr_t *, (x)))) + ((__typeof(*x))ATOMIC_SAN(load_ptr)((const volatile uintptr_t *)(x))) #define atomic_load_acq_ptr ATOMIC_SAN(load_acq_ptr) #define atomic_load_consume_ptr(x) \ ((__typeof(*x))atomic_load_acq_ptr((const volatile uintptr_t *)(x))) diff --git a/sys/sys/seqc.h b/sys/sys/seqc.h index 6472c2e3cfd7..17854b6f4adb 100644 --- a/sys/sys/seqc.h +++ b/sys/sys/seqc.h @@ -78,14 +78,14 @@ static __inline seqc_t seqc_read_any(const seqc_t *seqcp) { - return (atomic_load_acq_int(__DECONST(seqc_t *, seqcp))); + return (atomic_load_acq_int(seqcp)); } static __inline seqc_t seqc_read_notmodify(const seqc_t *seqcp) { - return (atomic_load_acq_int(__DECONST(seqc_t *, seqcp)) & ~SEQC_MOD); + return (atomic_load_acq_int(seqcp) & ~SEQC_MOD); } static __inline seqc_t From nobody Mon Jan 20 15:50:46 2025 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 4YcFDR10J6z5kGcf; Mon, 20 Jan 2025 15:50: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 4YcFDQ6jNgz3NW8; Mon, 20 Jan 2025 15:50:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737388247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nxG5hRFQsvSqSnmfTAeADzBGLAsaegY/v/WgD3fApfI=; b=xiZPQ5kSiBKO89J95zWifvw2sUv/8Yh3R+ArTjBmwxoUX1dMcSa28+O+V/mOcta0PYCT+O xK5DP3y/ZTF/VBSxIwZKFsLGcgHkSOYVztqB1VOhpos69P+lQf3tL0A1tfSS0r7PiQ50m/ AFJT7X9hr8Jxqk7lB2VzwX11X+ecZz767OWUx0IuYdXBkkKZHOZtYNsBcQifjCR+H3EI9K XXig8qDrcXj/rOhRucy2NSLzqdPtoTBFXqL9whzhGoyy04LK0/wgb9hFACVDHwmhHEGqqu p0h+wQmB0duikTtZGABpFdQZGGk2O5FmS4ufux2VN37RCJZDzIeCZzXSTGw+Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737388247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nxG5hRFQsvSqSnmfTAeADzBGLAsaegY/v/WgD3fApfI=; b=LGrw+0z0zPKDP00YuPyCsbM+2xsJJrOG0rtH3sw1qqNpR4dRRe3mZeMeboEzrPSTcFJTRv iHKHSupQnCUz5PryeQLAC4OtCunqmpCDhtz+Rm+AjVhJyQFubIIqKD/eeB4b0KezdkStCG Uv7Ar5RjqKzdeoWeSO/rAWyG4ycvmBScIXXXsNBcXtOUol6LDOCcC8SVo4c1z99KezmT9c pcMwaAnVurh2o4hscLegy0vA9EeITXaYa0PrpNoyPQ/I+Rl+yIIs3YRl7ju6e/BVDyWSP4 ONub6EfvYRm8xMQVl+eZLZP4IGE/P8jycdR09pLj9vylsEfGwk3RhAwWWBlqhg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737388247; a=rsa-sha256; cv=none; b=A/Fa5tPP7T+5NCzA8bI39M7cAr7bgfm3sR+HX4ARGdi4gXk6QmMVOE/OxeJWybaz/laKf3 k91nhBARnGWYbU3QXAMXUO7I+/xdFdGcTEazkPiQJpMAvRQCWeTjr6tjy8YhQ3UDl3i3Eh o024mufGEMi6nrHPprvyoJhBqrI1Tz7bvhYWmcRakI6AhM/ComyLEOKf6JanRC4eGvR95Q vnc//l6KgRl3gJ++1FNClYjs1qVmH8oln/QIBJS7W24NUBN4S2c06gCvyic1vL2tjwbwZ0 dqJL5dL83P4Wn5EpdATruL2exfXEBtdMsunT0Erp5g6ps/nqRf+y01CEY1A4Hw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcFDQ6C2QzBQY; Mon, 20 Jan 2025 15:50: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 50KFokI0047935; Mon, 20 Jan 2025 15:50:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KFokt2047932; Mon, 20 Jan 2025 15:50:46 GMT (envelope-from git) Date: Mon, 20 Jan 2025 15:50:46 GMT Message-Id: <202501201550.50KFokt2047932@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: c57c02ebf7bc - main - smr: Load to accept pointers to const pointers 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c57c02ebf7bcc9b02a0dc11711e8d8a6960ad34b Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=c57c02ebf7bcc9b02a0dc11711e8d8a6960ad34b commit c57c02ebf7bcc9b02a0dc11711e8d8a6960ad34b Author: Olivier Certner AuthorDate: 2025-01-20 14:38:42 +0000 Commit: Olivier Certner CommitDate: 2025-01-20 15:49:52 +0000 smr: Load to accept pointers to const pointers Pointers passed to the smr_entered_load() and smr_serialized_load() macros are in the end used as arguments to atomic_load_*ptr(), so convert them to the now acceptable 'const uintptr_t *' ones (instead of 'uintptr_tr *'), making these macros accept pointers to constant pointers. Reviewed by: kib MFC after: 4 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48497 --- sys/sys/smr_types.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/sys/smr_types.h b/sys/sys/smr_types.h index 9da4a73c568c..0257236f7314 100644 --- a/sys/sys/smr_types.h +++ b/sys/sys/smr_types.h @@ -60,7 +60,8 @@ struct { \ */ #define smr_entered_load(p, smr) ({ \ SMR_ASSERT(SMR_ENTERED((smr)), "smr_entered_load"); \ - (__typeof((p)->__ptr))atomic_load_acq_ptr((uintptr_t *)&(p)->__ptr); \ + (__typeof((p)->__ptr))atomic_load_acq_ptr( \ + (const uintptr_t *)&(p)->__ptr); \ }) /* @@ -70,7 +71,8 @@ struct { \ */ #define smr_serialized_load(p, ex) ({ \ SMR_ASSERT(ex, "smr_serialized_load"); \ - (__typeof((p)->__ptr))atomic_load_ptr(&(p)->__ptr); \ + (__typeof((p)->__ptr))atomic_load_ptr( \ + (const uintptr_t *)&(p)->__ptr); \ }) /* From nobody Mon Jan 20 16:44:42 2025 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 4YcGQf3kSBz5kLXj; Mon, 20 Jan 2025 16:44: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 4YcGQf2sw7z3Vjb; Mon, 20 Jan 2025 16:44:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737391482; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Hxy6C2S2sKA627E8kBoV5/LUhnawbUQrUYnR8X5qsrY=; b=l1x2tH/fw0tNoDtNjB7BTyfqeUPQ1S3rNmyUjo48OwaDcm/j2nj0wb6RoLSzJ/vWxH+hI/ f2xViE1CDt+1ievlkOVFZPLsZh6VgJGXnuWL3zijXE3/2eX109tkso28LCVh72xhU5eAFy Y8lFty6RtYUoGxvDS3yAQHAc2LtW53Wv4NIDGEPR9Dn8ZTarD11CycQCfeOqgzVNUZX6VZ cxn4DrWUQs2TTNMFWdm94ZcpCH9VkoDH+2WPb/foCyFyB+w9EICyFcHTbb/m9svAGsnohP xzpioAWmiw5Y/R5EyMO64JaRzdnJ9v7awCFLbIMMXIP5L0Lsj4OPUx+KApBDwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737391482; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Hxy6C2S2sKA627E8kBoV5/LUhnawbUQrUYnR8X5qsrY=; b=U7era29Ra+lSweMtrCzgF/v2bdUJWD8qg/VtOz1DPx6wHgV0rTIW4HyzPAwuoRWQtfxf1c N5NKKfB5cAXPIbggUogYm8Q6pOeOH0OcAbKNAxc1gsqGSa8T8heL7cH56C5tb38zGTxMWM Rdo/a5flt4k1n7wnaR745JLqR9DphHAeYbTqSngbRT3E61ekuMH5WZqRa8Y9oXoMC+gUSk CSjCIu9Z7NRnYw7zVBthIq1ctxn8781EbwLIfuDbraiL/mqKwemKAF+LZKPJNVV84jgZWt oPw1+sWo5m9U+ZFBcjLRaifKtwx+aq+LIlTjiAfbkolOVgmICpCUvPPGIPhAdA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737391482; a=rsa-sha256; cv=none; b=osp05gRNwb0TM8nI0tDfG+hy6St17T9Kcs6rFwz16X3JVZLSq5BRqWwlMX5ZpcMzlJWzK9 ydPKhy26pAGAinP76A/5gMxwIRB7R+NMqkZGM5OwwWwkODV1vZHhzgHHhybOz8xAL2iTdD XTSbgdFtAaBo3bTobj9SaBiwCqEyniU5D6d955YO1cRwWs5ER2itzokxZwzKf09ahcgB82 H6gVRoz5p/hJQ+Y/Fv+U1iv68necwehljVZjCTMBkqcF4gl1ticaiDVf2lvYQadEBx4oa3 9CXW1uf48onyYBDhaHDh57hZG/12xQoTFHnMJPsQcTfgS8Kb85D0zjNDfmjSyg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcGQf2SpLzCjK; Mon, 20 Jan 2025 16:44: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 50KGig6O048924; Mon, 20 Jan 2025 16:44:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KGigBK048921; Mon, 20 Jan 2025 16:44:42 GMT (envelope-from git) Date: Mon, 20 Jan 2025 16:44:42 GMT Message-Id: <202501201644.50KGigBK048921@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 4f4b2b7a4b6c - main - boottrace: Don't say we've unmounted if we haven't. 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f4b2b7a4b6c5642320479a765f850c394766276 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=4f4b2b7a4b6c5642320479a765f850c394766276 commit 4f4b2b7a4b6c5642320479a765f850c394766276 Author: Dag-Erling Smørgrav AuthorDate: 2025-01-20 16:44:12 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-01-20 16:44:25 +0000 boottrace: Don't say we've unmounted if we haven't. MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: imp, markj Differential Revision: https://reviews.freebsd.org/D48515 --- sys/kern/vfs_bio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index d6392c025a94..08ba752bcf29 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1518,8 +1518,8 @@ bufshutdown(int show_busybufs) if (!KERNEL_PANICKED()) { swapoff_all(); vfs_unmountall(); + BOOTTRACE("shutdown unmounted all filesystems"); } - BOOTTRACE("shutdown unmounted all filesystems"); } DELAY(100000); /* wait for console output to finish */ } From nobody Mon Jan 20 18:59:43 2025 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 4YcKQR6jF0z5kmrQ; Mon, 20 Jan 2025 18:59: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 4YcKQR5xqlz3qbm; Mon, 20 Jan 2025 18:59:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737399583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5TE0HfQnesz4Dzf33eKlKBxBUU0X5+Ou7EbGiQ6i8D0=; b=D2PeYIB1ZMm6vB+0YfsvBzus7NVaCTYWhvppb0EewfBlwA1fbMGFppsMWR+iK3OZizZVeZ gJxIRVX5vlHrY5kdTRgI1lAlQ4aks534Tf5n5/4bs9O49yYRZG2a81oeP+3w3iSJQUnS4R nJey3L+BTmg7txErXyas/e6cmBp0q85jI9aKCQ1Ps78RPLJw64Q9D/9KM/hyMeJgWK/Mrc 71vbMoi4hDkcwQr5ZjIQctpiuoLU4K76O874jAQoA342PGcJ3b68/2e7EbA7qhLgNceJdA WkEH+lerKThvf5bzyb0WTSDv4xiYJny8ieD1jHqYcGpeEPuroE7bLDwnZKp+xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737399583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5TE0HfQnesz4Dzf33eKlKBxBUU0X5+Ou7EbGiQ6i8D0=; b=Hsv2O+ECIZYNNNd45tUEWyFgAPGzyRKA2v7beBXvItJ+oGLKsmPjNAceynXcqNLfAhbVB1 CBm3VXNhKed3dCVfmFu43A1MYPPQ5z0rHnuW8diVVpw+8TiCb3Z+bGknM0OOAEQnZJ3rDD 9cWpeOjU1lkQIuhiDbiV9ILjB/5tv544dgac9dOoPhDTnFIfJSXQH17p4ZGeoWpQnwAN8w 8PWZqMRMixv9c1+tcAJPi0xj1ZboKt5OMoMiI2EHr1e34iBe2h4UwUt2WXvF0zFtS5AQtv wR5bdiBTDSosInE4kndkaoGlyaWY83SLIhllBg1tcY3adeuHyhUy3NjuBEYjwA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737399583; a=rsa-sha256; cv=none; b=bd47PqwL1QS2qXormzWJhrTSeRRwNIant0LkdyWZBBYPpdd0ueU+X8QzCAGSNgMP6SThzx +SyFUSYjzkWnsi3ger4QyMs3/NrZyR5wdHFRJ+Ue0CjwGdCDszTHYEq/6kOZNxy+MLR3XL Dfu4ROv1cWn+NbKWMBW6FaqSVNhmwwWPZgxTqZtlkT/ZIIYcCMb68fzXLs6O4Y6KUElJdP HTgJS5ucpljvteJLdD9I3LCMFRIPekcR9rmwsln/By+14ejsUdPSd51qd+JktJx2zM22nM vDpgm5PnaB1w2MtDXa2GRuyigtE/DV3nbSf+xDqrUwhMlGt9oUzUuPJwGxhTWg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcKQR5XtGzYqP; Mon, 20 Jan 2025 18:59: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 50KIxhJE093611; Mon, 20 Jan 2025 18:59:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KIxh3v093608; Mon, 20 Jan 2025 18:59:43 GMT (envelope-from git) Date: Mon, 20 Jan 2025 18:59:43 GMT Message-Id: <202501201859.50KIxh3v093608@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: caaeab697bf9 - main - libsecureboot: Report failure for unsupported hash algorithm 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: caaeab697bf98bf96e2fa8cb4a1e22240511fbcc Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=caaeab697bf98bf96e2fa8cb4a1e22240511fbcc commit caaeab697bf98bf96e2fa8cb4a1e22240511fbcc Author: Huwyler AuthorDate: 2025-01-17 14:55:15 +0000 Commit: Ed Maste CommitDate: 2025-01-20 18:59:20 +0000 libsecureboot: Report failure for unsupported hash algorithm Reviewed by: sjg Pull request: https://github.com/freebsd/freebsd-src/pull/1574 --- lib/libsecureboot/openpgp/opgp_sig.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libsecureboot/openpgp/opgp_sig.c b/lib/libsecureboot/openpgp/opgp_sig.c index b99a1be459c1..73c482e4c28d 100644 --- a/lib/libsecureboot/openpgp/opgp_sig.c +++ b/lib/libsecureboot/openpgp/opgp_sig.c @@ -341,6 +341,7 @@ openpgp_verify(const char *filename, break; default: warnx("unsupported hash algorithm: %s", hname); + rc = -1; goto oops; } md->init(&mctx.vtable); From nobody Mon Jan 20 20:24:22 2025 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 4YcMJ665Rwz5ktjY; Mon, 20 Jan 2025 20:24: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 4YcMJ65VHdz41ZK; Mon, 20 Jan 2025 20:24:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737404662; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nRM3+dBz/tVOPGKu2k7uQdceqlyFyp4m/MQlwyzUWrI=; b=nQz35Ke1bScqCVbIdQDV6/aQGXoBP9ysaKN/0Ug3+UBu3DWi2vhgU+UWBVeSb2vOprJjo2 t1X4VgKWFwoWfDUsCGgwN3rDmsMnNHBW5gWw21CEuLWYCY04CpbC+LTdkX+kqIfVk7X1c3 BPNXE2JuFF72C07r7jRyIJlh0LsNRfSOIIeiAptdbEJmoJM6coPOz6BJDCooQ7sRKhhdEH KKVWSAB3OdsgG2QuePavcNtBwswIoiXHz8VoZ4sXccc9gqfC+wwL4Y8CbmsR+pzjuHSMdc if/zoMlZ42tYTjRTcqVnltt/R0Z1HjwkXueLWiX/QY0YTVLEmSK71KnpWa1q3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737404662; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nRM3+dBz/tVOPGKu2k7uQdceqlyFyp4m/MQlwyzUWrI=; b=eUMGgNbyIgswCekZ4RtSnW65AdTQqyVAM9Rn57kb0vrDXWaInaHmBVcvutLXBQFpKJZnMn UJ4/I8AeN4Bdo9xEcMy8hmsjActoyB8bgrkdTI3Nb1I6zU9K8NhdWsARSbPSxGmU62+OQX CrJ35rghJ957UIWq8AHsu1ef5/oJGmr+DM61mqUJ7vXH8aXaRUG0Fk411Y+s02WcGZjMC0 ddFiHoI9CmXIv7D9mmWlNqOXdQh21JpdpHkMIQi1t9G9W+u+txvVJEd7D/6CnLGFVZAf8J 1cEa+sJ0dsQK2u9AfJjjx+6Tn3XpJKSdFAUFHDF6LVrLwmGZQGrWYDmvrmYUGA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737404662; a=rsa-sha256; cv=none; b=Qp9kJeEr9d0RLAy7KAlOW+UOc8jXgcjrkStziO/zcXzGkkQ9LdwsYInC+9C/Qv9fmJbz6M UuDDbTNNjPS0sk7omBjzluc/dMP1f/E9oRq64oHiu1sqgATjGYghxPZUb1yXzeiSK8sQtY xoZg+cKasJCoCSKu/IjcqjRtMGSTpLcw+Q3+6B9frSUaAi5xes5TH+sDLj31R5MB+AyCpg N5zgZkqjTOCmNcvlPVq7Sty0U595ZEm+Or9tYaSt/qBLHKrW+5sOsrsNlL8RzoB0vQzL0f cr0Tzt8RILpXFETqnwuwr3fWBiSiFludCN97wlk8b3+u3Qck+77uIZs6/1egpA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcMJ651L8zc5d; Mon, 20 Jan 2025 20:24: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 50KKOMHq060578; Mon, 20 Jan 2025 20:24:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KKOM2k060575; Mon, 20 Jan 2025 20:24:22 GMT (envelope-from git) Date: Mon, 20 Jan 2025 20:24:22 GMT Message-Id: <202501202024.50KKOM2k060575@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 3433daae0d20 - main - vtfontcvt: Improve error message for unsupported DWIDTH 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3433daae0d20d55503084c4d17b8a3e685657ad2 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=3433daae0d20d55503084c4d17b8a3e685657ad2 commit 3433daae0d20d55503084c4d17b8a3e685657ad2 Author: Ed Maste AuthorDate: 2025-01-20 20:04:20 +0000 Commit: Ed Maste CommitDate: 2025-01-20 20:23:49 +0000 vtfontcvt: Improve error message for unsupported DWIDTH vtfontcvt requires that all glyphs are 1x or 2x a common width, reporting for example "bitmap with unsupported DWIDTH 27 0 on line xxx" if the font is expected to be 32 pixels wide. Add the expected / permitted values to the error message to make the issue more clear - for the same example, "bitmap with unsupported DWIDTH 27 0 (not 32 or 64)". Reviewed by: ziaee Sponsored by: The FreeBSD Foundation --- usr.bin/vtfontcvt/vtfontcvt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/vtfontcvt/vtfontcvt.c b/usr.bin/vtfontcvt/vtfontcvt.c index ddff1580a993..773072813d8a 100644 --- a/usr.bin/vtfontcvt/vtfontcvt.c +++ b/usr.bin/vtfontcvt/vtfontcvt.c @@ -450,8 +450,8 @@ parse_bdf(FILE *fp, unsigned int map_idx) if (sscanf(ln + 7, "%d %d", &dwidth, &dwy) != 2) errx(1, "invalid DWIDTH at line %u", linenum); if (dwy != 0 || (dwidth != fbbw && dwidth * 2 != fbbw)) - errx(1, "bitmap with unsupported DWIDTH %d %d at line %u", - dwidth, dwy, linenum); + errx(1, "bitmap with unsupported DWIDTH %d %d (not %d or %d) at line %u", + dwidth, dwy, fbbw, 2 * fbbw, linenum); if (dwidth < fbbw) set_width(dwidth); } From nobody Mon Jan 20 20:29:10 2025 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 4YcMPf5LWhz5ktms; Mon, 20 Jan 2025 20:29: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 4YcMPf4ggGz42Bc; Mon, 20 Jan 2025 20:29:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737404950; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ODqNnn9kd3/623C4tZS9M5UBq1H6kA7ZRK/qu9gEa0w=; b=w4xoR/a8ZPUiWbWIIPKjxvPBpLvV6Qf4S150qtTH3cz0sgoAKLAcz5+eWkrZshdKx61BNB bvAgZ9tQXnVcPahyvOHOwSV6bvmzWmVnhfnyExLo4ZJab+qB3hurwQNpN/XVmqEzQihTAt kMUKxek5+ygaaulLc7W/KjIGYW0Q6OniupIVSu0GBchD+yOJu7qAnXbK2kbvVuE6gGukJt 6xV/cVSrZsJjqdaqVEdy7ab+KculCyHcpVmQpFo4BPyg4BzwAAN6vAHhb90ryfI8Xe5X3E 30cnIdMM2Lpf4cemAGZ8avHvU0Xy6QcQgougMeyTHHQG+wnl2NhrrjaK0Z6txA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737404950; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ODqNnn9kd3/623C4tZS9M5UBq1H6kA7ZRK/qu9gEa0w=; b=qwRW9IbF7Fa3A0LbAsz4tm9wSm3g2/k/ZAJBb7HqsFBemUpN7KriTay8ZTMbOMkDX4eH6+ V3SlaYNrIyrHF0JmJSECtwc1Bm8CiwbUak5DPKQGatELpbRV09uR2W7RdIzkPtjAnDKXVJ ihWcTy4f0q7DEoSaG+b2JrDMjCxpLgR7RJ3rxywrhpVkWi6vYo6HDV8qyYol0V0b+NeMWY 3BPNbSinp3CRpniO8mSC/vW+5+mm0KPM0ty42D4aCOFPIzHsl3Vx15p7800RE/HCwvF1CL LlCGMdcyG9ITo5D1rLvQ8HdtJSy+TfSCD69iE5MKf/wwErjUs09ssWqwQVU0yA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737404950; a=rsa-sha256; cv=none; b=hMwTT9g7kQAiww7k9Z6E+VkhapYyRqrf7ehQDnU4fmL32aiHkVu3WrpfAKcGDwL/FnuEPz AiNvdgQlXDJN/ZOoa6gK5e1i/Y0IKUnqAaTC2Z0Kr0QyzO4MrpXzRnLXUFPKUVhWcm5fRi qh+G34nz8AWx+wniWVYzVzmJIGfBiWtEWbcyaxNYS5nug6Ar1NUhQ3ZemKSep0F9BLSTRI 9PENCTPpuFO4OQQv+pA3Kg9Nqulp0MCaVjjK+UbutUaREdNNESFjlRlTniZhi4Z6u/9zai wxIh8VQ+JUmtjVWawA9p8sNLRaHuHSdHsKDkSFOzhKmdA+nsFa/kdcFOFczRbQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcMPf4FQ6zc0b; Mon, 20 Jan 2025 20:29: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 50KKTA8a062076; Mon, 20 Jan 2025 20:29:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KKTAGP062073; Mon, 20 Jan 2025 20:29:10 GMT (envelope-from git) Date: Mon, 20 Jan 2025 20:29:10 GMT Message-Id: <202501202029.50KKTAGP062073@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 127b443124d1 - main - gvinum: Emit deprecation notice upon drive tasting 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 127b443124d1e720b246ad381648c436c3d240de Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=127b443124d1e720b246ad381648c436c3d240de commit 127b443124d1e720b246ad381648c436c3d240de Author: Ed Maste AuthorDate: 2022-12-12 21:07:26 +0000 Commit: Ed Maste CommitDate: 2025-01-20 20:25:33 +0000 gvinum: Emit deprecation notice upon drive tasting Reviewed by: phk, jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D38607 --- sys/geom/vinum/geom_vinum_events.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/geom/vinum/geom_vinum_events.c b/sys/geom/vinum/geom_vinum_events.c index e1206a671091..4175a438aa9f 100644 --- a/sys/geom/vinum/geom_vinum_events.c +++ b/sys/geom/vinum/geom_vinum_events.c @@ -39,6 +39,8 @@ #include #include +static bool deprecation_printed; + void gv_post_event(struct gv_softc *sc, int event, void *arg1, void *arg2, intmax_t arg3, intmax_t arg4) @@ -179,6 +181,13 @@ gv_drive_tasted(struct gv_softc *sc, struct g_provider *pp) gv_setup_objects(sc); gv_set_drive_state(d, GV_DRIVE_UP, 0); + /* Emit deprecation notice. */ + if (!deprecation_printed) { + gone_in(15, "gvinum volume manager"); + deprecation_printed = true; + } + G_VINUM_DEBUG(1, "drive '%s' relies on deprecated gvinum", d->name); + return; failed: From nobody Mon Jan 20 20:54:06 2025 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 4YcMyQ4RS5z5kwkp; Mon, 20 Jan 2025 20:54: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 4YcMyQ3yS0z44FC; Mon, 20 Jan 2025 20:54:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737406446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=n/LE18Pojf6tFa850QAv2j5VJSvQQU8dl79hHE4fUTE=; b=VEpWuCoWxlfMsUsPb1gDyRE8qXC72rlDiSZUBxCdgY0VDL0DcQKyjL7YbIpwMSA3M0R3JI I3fDnp2Y+ztIdsZD+rHEjadQ/jPEoEyJYWrHtJD9P3n2D1cfqoC4so3fqS2mNV+JzhIwfg 3204yRgUiM7Qcb21cC8qmMacCxThlMRn25rcG0qyg6WwDUEB163cDf980vtlnnFQpGquXk IlPPWzRbCIwvVbobKF10Fw20hcXIHWJIrQeJKjvXmuaS+QtgJbr1w61ohQx6TmyeorfRCh E4+lv8HSBwKb0jXDf94w/nxMJAzIyQiqrjMmxOcG8+PKNXKGWFv0VZKf62l3jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737406446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=n/LE18Pojf6tFa850QAv2j5VJSvQQU8dl79hHE4fUTE=; b=r+MVCmc4YJ56Sf6YCNVP4FW7Md5FPHLpL27HE6tOAQGyNIiwepnooBd6yeXIfbxfemirY/ wHuL6rmf74sFgmm6QulXelHwM7Ev37e8R6q1RaqVUfAIwBUxbDA6ldLTi2tXzqRAuf3HCF ynicbyjLClorW4AOpU7dc6rt52Tgu4+XQ195MjFmiDMrUCC7VaCKQVn5i31oyitU4hYpgE uqUUAECJh5t2yQtb9uHhlqHlB99floPZBDNF61JN+zmkP4CjNQjR03Qp65Gq7NcTWNvPDe fMvNIIprltJ6fzdHcbB28wZH0PPHN68WhB2pGY5Fu3rlowP3ZLRXnTn1GJmxAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737406446; a=rsa-sha256; cv=none; b=oIQsTOrLSCTrnoy65g7LPhNXu5q5t85/nVgGgF3wzzZjqvIbxYNdr0mr7YQFirk5AXVh2L K5jSHC1dZ9IVkpSeJ2kzA7mnmbpGNqvsvxJRsHtnlwUFpo2M/XtGWtG+BrMJ1pbqtaO3k6 hi544FmN5++7CCeQv3qqrG+xriQJ/4fJQw4aRGmBxVqo3gyM/k96VXeKPoxb7s2+6GQBJR W92XSeZGgCd5EQeaSd58PLSi47oaHNZ0V2A6+6k3t6/KAP9hF4fOx8PPpAD5djxrbC6iJn IDHD4pfiat2nMJWXIAlWy/hW8YwrpHsLmUOPcab3q+9QiQ5niuBS1QHllEjFdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcMyQ2pPtzcC8; Mon, 20 Jan 2025 20:54: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 50KKs6f3017491; Mon, 20 Jan 2025 20:54:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KKs6Mp017488; Mon, 20 Jan 2025 20:54:06 GMT (envelope-from git) Date: Mon, 20 Jan 2025 20:54:06 GMT Message-Id: <202501202054.50KKs6Mp017488@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: fb63082c0cc6 - main - netlink: provide snl(3) API for variable length raw data attribute 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fb63082c0cc6a7da68ff9c5b3a9bd023abafe1d2 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=fb63082c0cc6a7da68ff9c5b3a9bd023abafe1d2 commit fb63082c0cc6a7da68ff9c5b3a9bd023abafe1d2 Author: Gleb Smirnoff AuthorDate: 2025-01-20 20:53:07 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-20 20:53:07 +0000 netlink: provide snl(3) API for variable length raw data attribute Rename supposedly internal _snl_reserve_msg_attr() into an official snl_reserve_msg_attr_raw(), that would return pointer to a struct nlattr followed by allocated memory. Adjust the snl_reserve_msg_attr() macro to work on top of that function. Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D48311 --- sys/netlink/netlink_snl.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/netlink/netlink_snl.h b/sys/netlink/netlink_snl.h index 0f3b3b44622d..44967b6f444a 100644 --- a/sys/netlink/netlink_snl.h +++ b/sys/netlink/netlink_snl.h @@ -1109,20 +1109,22 @@ snl_reserve_msg_data_raw(struct snl_writer *nw, size_t sz) #define snl_reserve_msg_object(_ns, _t) ((_t *)snl_reserve_msg_data_raw(_ns, sizeof(_t))) #define snl_reserve_msg_data(_ns, _sz, _t) ((_t *)snl_reserve_msg_data_raw(_ns, _sz)) -static inline void * -_snl_reserve_msg_attr(struct snl_writer *nw, uint16_t nla_type, uint16_t sz) +static inline struct nlattr * +snl_reserve_msg_attr_raw(struct snl_writer *nw, uint16_t nla_type, uint16_t sz) { - sz += sizeof(struct nlattr); + struct nlattr *nla; - struct nlattr *nla = snl_reserve_msg_data(nw, sz, struct nlattr); + sz += sizeof(struct nlattr); + nla = snl_reserve_msg_data(nw, sz, struct nlattr); if (__predict_false(nla == NULL)) return (NULL); nla->nla_type = nla_type; nla->nla_len = sz; - return ((void *)(nla + 1)); + return (nla); } -#define snl_reserve_msg_attr(_ns, _at, _t) ((_t *)_snl_reserve_msg_attr(_ns, _at, sizeof(_t))) +#define snl_reserve_msg_attr(_ns, _at, _t) \ + ((_t *)(snl_reserve_msg_attr_raw(_ns, _at, sizeof(_t)) + 1)) static inline bool snl_add_msg_attr(struct snl_writer *nw, int attr_type, int attr_len, const void *data) From nobody Mon Jan 20 20:54:07 2025 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 4YcMyR5Bb4z5kwqk; Mon, 20 Jan 2025 20:54: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 4YcMyR4VCGz44QP; Mon, 20 Jan 2025 20:54:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737406447; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xkw+zh6SDp8ylxBNA4DNu1KWGyxuZh7ufrHXu03r68o=; b=YehUeWZpYmLCm0tFqhhpH3zrk+JYvoNfXFgiGPu5kxA++ysazAyFe/yW3dWNfHU3jR0wek Gin1k4wpSQBFKvrQELddF+h0ziDGZc82f3NtUrJrPNoqkcTaaYB8RnvTcA1P/GdxTx9Umh iMlqqdVYWND0viZMkWWCTMeotyg8ukDI6sC+BYyjxkL8E3/okHo506b3q45HHZmPJWbp6S vhiH9TSlu0UAhAnB7jwTzumXB4MJomuhyshD8Du5Rq6RaJsRenD3QWnidvd35nUJL7+6y+ sh7Lr5XcTL2HLEgajHkSHCa0PGXhxUSqQ4574NhqDJTBE0hGjsWrFuDAxC6YCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737406447; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xkw+zh6SDp8ylxBNA4DNu1KWGyxuZh7ufrHXu03r68o=; b=h/VPJhUySdViwROMKLzrCpT9pcrWwKHDyP91nC8HRjPnmr3TIZA9Lb6VZp041HgScUdqsv /5iU/ug2Ybv+BXjYjX/CmCaQgIqxLxpSW+o9U9f2MmbbSSdUSj0WJur7X+u612TmUiK4Z/ Ev1cy3ep+EvgKBI9gs/n1WPWR0ix8I7Fu3ZxduKPtq5OqIS+wg+FSViOGBObHA+8rj8wFK ZRFP1W8L+6RM7iGWvchfwcfV1eBkRKFE2m1CkYo/LSQysHYIUsFlcYb+XS0+6WsKZeK/Nl H5mF22rHPUO2WNqVJbci9mH8+idJeS+s1J4iMefGczIzlAqBx5Mz3N47UqPkMw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737406447; a=rsa-sha256; cv=none; b=rhIu+xJOQZqYJisv+aYSDyWknXoNxsB58qewol18ycD7K4XjpyiDttdpOTyuKSON1BRsfj PMuWDIziNcNLwiYRWuGQgpoljD4VdIpk0ubVGckTPbR+P1xuYyV2oNFWGz0XXbk9zNTAn7 TkcHSCVh61VowhhbHEavxw0CGmoFKaU1agxwAXUiYuPJ0Q9LUsKKsPBJSXu9hPHdLAQVSM z/M6q3JwUoTEm6JhRkMY4E0jxR+ryzmy85xWlUt/rwF6YLnSodrySKnT1JKCXAGgmlRMkD u0cpN9T3WIIt5k2ZzEFdH2DVPtNdxCEfvFx99MrfcQasH4jggiSuf9mYIMNqbg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcMyR41ykzcqS; Mon, 20 Jan 2025 20:54: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 50KKs7KF017524; Mon, 20 Jan 2025 20:54:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KKs7qh017521; Mon, 20 Jan 2025 20:54:07 GMT (envelope-from git) Date: Mon, 20 Jan 2025 20:54:07 GMT Message-Id: <202501202054.50KKs7qh017521@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: f2a4eed3e13b - main - netlink: underscore snl_get_genl_family_info() to discourage its use 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f2a4eed3e13b6aeb9ddeef580d3b931cf22a14e3 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=f2a4eed3e13b6aeb9ddeef580d3b931cf22a14e3 commit f2a4eed3e13b6aeb9ddeef580d3b931cf22a14e3 Author: Gleb Smirnoff AuthorDate: 2025-01-20 20:53:37 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-20 20:53:37 +0000 netlink: underscore snl_get_genl_family_info() to discourage its use This function uses already supposedly opaque struct _getfamily_attrs as the argument and it fills it with pointers to volatile memory, which makes it is unsafe for general use. While here also underscore structures that hang off the struct _getfamily_attrs. Small programs like powerd(8) and RPC daemons are converted to use snl_get_genl_mcast_group() and/or snl_get_genl_family(). The genl(1) utility was fixed not to mix its own parsers with parsers declared in netlink_snl_generic.h. Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D48480 --- sys/netlink/netlink_snl_generic.h | 36 +++++++++++++++++++++++------------- tests/sys/netlink/test_snl_generic.c | 2 +- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/sys/netlink/netlink_snl_generic.h b/sys/netlink/netlink_snl_generic.h index bdbefb914259..7dc8980e1c5c 100644 --- a/sys/netlink/netlink_snl_generic.h +++ b/sys/netlink/netlink_snl_generic.h @@ -60,17 +60,17 @@ static struct snl_field_parser snl_fp_genl[] = {}; #define SNL_DECLARE_GENL_PARSER(_name, _np) SNL_DECLARE_PARSER(_name,\ struct genlmsghdr, snl_fp_genl, _np) -struct snl_genl_ctrl_mcast_group { +struct _snl_genl_ctrl_mcast_group { uint32_t mcast_grp_id; const char *mcast_grp_name; }; -struct snl_genl_ctrl_mcast_groups { +struct _snl_genl_ctrl_mcast_groups { uint32_t num_groups; - struct snl_genl_ctrl_mcast_group **groups; + struct _snl_genl_ctrl_mcast_group **groups; }; -#define _OUT(_field) offsetof(struct snl_genl_ctrl_mcast_group, _field) +#define _OUT(_field) offsetof(struct _snl_genl_ctrl_mcast_group, _field) static struct snl_attr_parser _nla_p_getmc[] = { { .type = CTRL_ATTR_MCAST_GRP_NAME, @@ -85,12 +85,12 @@ static struct snl_attr_parser _nla_p_getmc[] = { }; #undef _OUT SNL_DECLARE_ATTR_PARSER_EXT(_genl_ctrl_mc_parser, - sizeof(struct snl_genl_ctrl_mcast_group), _nla_p_getmc, NULL); + sizeof(struct _snl_genl_ctrl_mcast_group), _nla_p_getmc, NULL); struct _getfamily_attrs { uint16_t family_id; const char *family_name; - struct snl_genl_ctrl_mcast_groups mcast_groups; + struct _snl_genl_ctrl_mcast_groups mcast_groups; }; #define _IN(_field) offsetof(struct genlmsghdr, _field) @@ -118,7 +118,7 @@ static struct snl_attr_parser _nla_p_getfam[] = { SNL_DECLARE_GENL_PARSER(_genl_ctrl_getfam_parser, _nla_p_getfam); static bool -snl_get_genl_family_info(struct snl_state *ss, const char *family_name, +_snl_get_genl_family_info(struct snl_state *ss, const char *family_name, struct _getfamily_attrs *attrs) { struct snl_writer nw; @@ -126,10 +126,16 @@ snl_get_genl_family_info(struct snl_state *ss, const char *family_name, memset(attrs, 0, sizeof(*attrs)); - snl_init_writer(ss, &nw); - hdr = snl_create_genl_msg_request(&nw, GENL_ID_CTRL, CTRL_CMD_GETFAMILY); - snl_add_msg_attr_string(&nw, CTRL_ATTR_FAMILY_NAME, family_name); - if ((hdr = snl_finalize_msg(&nw)) == NULL || !snl_send_message(ss, hdr)) + if (__predict_false(!snl_init_writer(ss, &nw))) + return (false); + if (__predict_false(snl_create_genl_msg_request(&nw, GENL_ID_CTRL, + CTRL_CMD_GETFAMILY) == NULL)) + return (false); + if (__predict_false(!snl_add_msg_attr_string(&nw, + CTRL_ATTR_FAMILY_NAME, family_name))) + return (false); + hdr = snl_finalize_msg(&nw); + if (!snl_send_message(ss, hdr)) return (false); hdr = snl_read_reply(ss, hdr->nlmsg_seq); @@ -146,7 +152,9 @@ snl_get_genl_family(struct snl_state *ss, const char *family_name) { struct _getfamily_attrs attrs = {}; - snl_get_genl_family_info(ss, family_name, &attrs); + if (__predict_false(!_snl_get_genl_family_info(ss, family_name, + &attrs))) + return (0); return (attrs.family_id); } @@ -156,7 +164,9 @@ snl_get_genl_mcast_group(struct snl_state *ss, const char *family_name, { struct _getfamily_attrs attrs = {}; - snl_get_genl_family_info(ss, family_name, &attrs); + if (__predict_false(!_snl_get_genl_family_info(ss, family_name, + &attrs))) + return (0); if (attrs.family_id == 0) return (0); if (family_id != NULL) diff --git a/tests/sys/netlink/test_snl_generic.c b/tests/sys/netlink/test_snl_generic.c index d84d3f88f487..839127fe5232 100644 --- a/tests/sys/netlink/test_snl_generic.c +++ b/tests/sys/netlink/test_snl_generic.c @@ -98,7 +98,7 @@ ATF_TC_BODY(test_snl_get_genl_family_groups, tc) ATF_CHECK(snl_parse_nlmsg(&ss, hdr, &_genl_ctrl_getfam_parser, &attrs)); ATF_CHECK_EQ(attrs.mcast_groups.num_groups, 1); - struct snl_genl_ctrl_mcast_group *group = attrs.mcast_groups.groups[0]; + struct _snl_genl_ctrl_mcast_group *group = attrs.mcast_groups.groups[0]; ATF_CHECK(group->mcast_grp_id > 0); ATF_CHECK(!strcmp(group->mcast_grp_name, "notify")); From nobody Mon Jan 20 20:58:43 2025 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 4YcN3m1CwDz5kwvJ; Mon, 20 Jan 2025 20:58: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 4YcN3m0P1Hz45Hl; Mon, 20 Jan 2025 20:58:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737406724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=63uKdV7HbjHSHaqorujUIoB2/49aDzNmeCduvMh9ko0=; b=Q+5wCHQRN7KHY9b9iHGxHcL6fOMUa4LTFUpzfT0e5s8RvNIB6+MAz3LH67+Og+fxjW0Hyo hMMz6rQoxs/mx9BUxEDuLD1LIsbJdeVwmEwQdbGX5ECSJQomhd4jiQKGNt/bkkmOgvAeXH sUqWcjHJs7wH9smNVcSzNwpwoVJ6aDOIIxTQVnVhvn0ydTOwjQCqGCFugbNgH3n7IXY4Ro /HekwXE+yCgh4m99y+2hkr1l2X8MpL4Jfxj8o4NSv1/2uAlbANx1qinW+UPZv2wAdPVt+7 Sar4KA1mdfPYz801CXndmH668MPRGVrsIoBvCNRfsVIaFyn+XtgRy5dsa9FWDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737406724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=63uKdV7HbjHSHaqorujUIoB2/49aDzNmeCduvMh9ko0=; b=m/1gDFcHyh22k/bVF6Nr20OZsZiuq81fOPO/4foDV7DM2gjn/L08Rk7ks1qfUb80mmMbhY frSEINJeYB5JCOo8bov3ZhS1eG4oNButr5HQe2VXCJq6lwDKHe7C8uEBBU+v0NnvN14LP0 nZtA5QKF8LmMLu9iNShcK6Y4nho050SYuDsKAumWZHVKGggRe7m19dBL6jLxdaFUig3qV9 /LB4LAP25oJy7ZBKcgVtZKKpjZDl98X66eqAaZjEGhFm9LliCMZf2DQq3A5jbKE4byNso/ Oinm2T3fFupYmggXWvQLiGuEh/llohOMf/QryYiiIOv/YGfA+MRC7syIcuMY0g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737406724; a=rsa-sha256; cv=none; b=TqBNzNJQwSELJBnxUPKc3SJsT9snXqp42FKDGZgsra5pZsURnJYUbMAnCvEZffPFl9ifEY O9BBSvxHF2lYkSdYqdD2jimJtvJlX2ULj2DoCMQoVfdo42pvlSnVP57OJsyVZR4JMF06vO hXQiTSwehE8Mjy/CfZ1xOBc/lZMgjOonrLuS9L+geDWQVTt7jmO9tIeMZHiVOsQGQpPeew JFj5W4KbenW+CjFY1nFuE8KHm5FuUFBuyfH/zTuAI/HoHIcrrFrY0+OqNONIBfmOInFF0A muq/gLbpaPQlM/YpkGaZUyViTk4iDGmqFY/DxpWcnTuokK/2AiohS5TAQJCL0Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcN3l6nHBzcqT; Mon, 20 Jan 2025 20:58: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 50KKwhlD018964; Mon, 20 Jan 2025 20:58:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KKwhp4018961; Mon, 20 Jan 2025 20:58:43 GMT (envelope-from git) Date: Mon, 20 Jan 2025 20:58:43 GMT Message-Id: <202501202058.50KKwhp4018961@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Simon J. Gerraty" Subject: git: dae4eb623e86 - main - libsecureboot add sha384 and sha512 for OpenPGP 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: sjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dae4eb623e862789533dca8b644ea531502a088f Auto-Submitted: auto-generated The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=dae4eb623e862789533dca8b644ea531502a088f commit dae4eb623e862789533dca8b644ea531502a088f Author: Simon J. Gerraty AuthorDate: 2025-01-20 20:56:44 +0000 Commit: Simon J. Gerraty CommitDate: 2025-01-20 20:56:44 +0000 libsecureboot add sha384 and sha512 for OpenPGP gpg supports SHA384, SHA512 as well as SHA256 so allow for them. Tweak Makefile.inc so we can build libsecureboot with only OpenPGP trust anchors. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D48546 --- lib/libsecureboot/Makefile.inc | 6 +++++- lib/libsecureboot/openpgp/opgp_sig.c | 10 ++++++++++ lib/libsecureboot/vets.c | 30 ++++++++++++++++++------------ 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/lib/libsecureboot/Makefile.inc b/lib/libsecureboot/Makefile.inc index b9d986cdc6b3..21ad019a0cb5 100644 --- a/lib/libsecureboot/Makefile.inc +++ b/lib/libsecureboot/Makefile.inc @@ -77,12 +77,16 @@ VE_SIGNATURE_EXT_LIST?= sig # needs to be yes for FIPS 140-2 compliance VE_SELF_TESTS?= no +CFLAGS+= -I. + +.if ${VE_SIGNATURE_EXT_LIST:M*sig} != "" # this is what we use as our trust anchor -CFLAGS+= -I. -DTRUST_ANCHOR_STR=ta_PEM +CFLAGS+= -DTRUST_ANCHOR_STR=ta_PEM .if ${VE_SELF_TESTS} != "no" XCFLAGS.vets+= -DVERIFY_CERTS_STR=vc_PEM .endif +.endif # clean these up VE_HASH_LIST:= ${VE_HASH_LIST:tu:O:u} diff --git a/lib/libsecureboot/openpgp/opgp_sig.c b/lib/libsecureboot/openpgp/opgp_sig.c index 73c482e4c28d..8846296d7122 100644 --- a/lib/libsecureboot/openpgp/opgp_sig.c +++ b/lib/libsecureboot/openpgp/opgp_sig.c @@ -339,6 +339,16 @@ openpgp_verify(const char *filename, mlen = br_sha256_SIZE; hash_oid = BR_HASH_OID_SHA256; break; + case 9: /* sha384 */ + md = &br_sha384_vtable; + mlen = br_sha384_SIZE; + hash_oid = BR_HASH_OID_SHA384; + break; + case 10: /* sha512 */ + md = &br_sha512_vtable; + mlen = br_sha512_SIZE; + hash_oid = BR_HASH_OID_SHA512; + break; default: warnx("unsupported hash algorithm: %s", hname); rc = -1; diff --git a/lib/libsecureboot/vets.c b/lib/libsecureboot/vets.c index c86b198c45c5..67d27d567485 100644 --- a/lib/libsecureboot/vets.c +++ b/lib/libsecureboot/vets.c @@ -200,11 +200,13 @@ ve_utc_set(time_t utc) } } +#ifdef VERIFY_CERTS_STR static void free_cert_contents(br_x509_certificate *xc) { xfree(xc->data); } +#endif /* * a bit of a dance to get commonName from a certificate @@ -372,13 +374,15 @@ ve_trust_anchors_add_buf(unsigned char *buf, size_t len) size_t num; num = 0; - xcs = parse_certificates(buf, len, &num); - if (xcs != NULL) { - num = ve_trust_anchors_add(xcs, num); + if (len > 0) { + xcs = parse_certificates(buf, len, &num); + if (xcs != NULL) { + num = ve_trust_anchors_add(xcs, num); #ifdef VE_OPENPGP_SUPPORT - } else { - num = openpgp_trust_add_buf(buf, len); + } else { + num = openpgp_trust_add_buf(buf, len); #endif + } } return (num); } @@ -398,15 +402,17 @@ ve_trust_anchors_revoke(unsigned char *buf, size_t len) size_t num; num = 0; - xcs = parse_certificates(buf, len, &num); - if (xcs != NULL) { - num = ve_forbidden_anchors_add(xcs, num); + if (len > 0) { + xcs = parse_certificates(buf, len, &num); + if (xcs != NULL) { + num = ve_forbidden_anchors_add(xcs, num); #ifdef VE_OPENPGP_SUPPORT - } else { - if (buf[len - 1] == '\n') - buf[len - 1] = '\0'; - num = openpgp_trust_revoke((char *)buf); + } else { + if (buf[len - 1] == '\n') + buf[len - 1] = '\0'; + num = openpgp_trust_revoke((char *)buf); #endif + } } return (num); } From nobody Mon Jan 20 21:15:47 2025 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 4YcNRR3pvyz5kyD4; Mon, 20 Jan 2025 21:15: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 4YcNRR345rz47q8; Mon, 20 Jan 2025 21:15:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737407747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3SHm6WJ+QYPQPjcNDA9P1t8xo5THeQ5YUp+k/gilES8=; b=r5tzZXGtzhJXCw/l+6Q8JElTLGeKwVSvMpwZG9/xSGZVtZrdRwpP59/itl2LL8GAtVKEZo 4XgZX/lEo3ZDtl15NUgYfBMNRO2Iyi9MvWlWeu3L1q6wRE0aF2n/nmXvzrg1ClfBpPyz/e Eyr+/UcTDaiH+dltijbV+wqVpolumWDGJ2xLyQfqzcGKQGmBV0uLGhT5uiPc5UPrODdynp SbzWzDczPwOlYz9Kze6mGp/qqFeCCuiqdj0Fb4+GQEyXq5n5r+wZ0SK7ynJAqUfvFvHlIi NMRSRD5+Z8EBvtMQOqseaOM21jeym1D8+QRFBz00K+0Kk6f0nWkHwLrXR7nyXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737407747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3SHm6WJ+QYPQPjcNDA9P1t8xo5THeQ5YUp+k/gilES8=; b=HpYqHvvOpi7wZwhVUGxcR4eM4rkySOAhakWaTNMe17nyaeoV0D5eVEUbFQdGMDIb1xP9OL JfxDObYdUd/BK/DrFg7UrdnbOeJD4xjkbSALdWtvyi85BCTQAcsjvH2Ge/pDcdXZhSlJDW lNmb05hHucguMr5xT1GBwGI394JB32lbfUGOzNYeDhN9f6/OW56AZVxxurEdCWAxrV6g6l M3fjqfBAKzNRtbcsYcYLZgjO8dzL7wQSMBP5vJiSg/3ny+L1/nBvIwfOLnloxUuYTeqyqz GrZKwE38XiTFJvWQLRNSsQf7Z8a3estEQVC06CdRVZr+ZBnEV4qd9UynLj2MJw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737407747; a=rsa-sha256; cv=none; b=WKQgsRnm41XFxnBQG9y0gxHWCgV26VDc1V1y4g2gzAsbP87vwI7gNusCT27KC7j06MVNN9 S7R7Zx54vX98xRajvU0TfEugqIrQzEuQL06ujzV+oHi7coSm4iPfdpu2b6MoGLRhK+s49l zl4tDK0IBeW2I0YRE0BqKdmJKmB4yccT7ppzoKRGp8Rq9iHf1asiL3ffUd8Cq/pF22butf vJZqFFB1Mfeb7Yc6R3wzv4SEQ8h8XZKnv+DrCB2vuspNhpyOUTq/R8kWsXC6R0envbeYiZ Kl5IN+FleC3D+X9rPt5S6eZp9k2migQnipdtQ9l4qf8HABTIhwbIBpj0scVqgQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcNRR2S1szdMg; Mon, 20 Jan 2025 21:15:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50KLFl1X057493; Mon, 20 Jan 2025 21:15:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KLFlcd057490; Mon, 20 Jan 2025 21:15:47 GMT (envelope-from git) Date: Mon, 20 Jan 2025 21:15:47 GMT Message-Id: <202501202115.50KLFlcd057490@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: ddc7fd6641c3 - main - netlink: provide snl_clone() to create a secondary snl state 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ddc7fd6641c38a00d8d299d69ba57f0657f5eaac Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=ddc7fd6641c38a00d8d299d69ba57f0657f5eaac commit ddc7fd6641c38a00d8d299d69ba57f0657f5eaac Author: Gleb Smirnoff AuthorDate: 2025-01-20 21:15:39 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-20 21:15:39 +0000 netlink: provide snl_clone() to create a secondary snl state The function will clone an existing snl_state(). The clone points at the same socket, but has a separate allocator. Closing a clone frees the memory, but doesn't close the socket. Such clones are handy in a multithreaded process that has a single socket with multiple writers and a serialized reader. It can be easily extended to support multiple readers, too, but now there is no use. Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D48568 --- sys/netlink/netlink_snl.h | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/sys/netlink/netlink_snl.h b/sys/netlink/netlink_snl.h index 44967b6f444a..faaeebe52eac 100644 --- a/sys/netlink/netlink_snl.h +++ b/sys/netlink/netlink_snl.h @@ -240,14 +240,13 @@ snl_clear_lb(struct snl_state *ss) static void snl_free(struct snl_state *ss) { - if (ss->init_done) { + if (ss->init_done) close(ss->fd); - if (ss->buf != NULL) - free(ss->buf); - if (ss->lb != NULL) { - snl_clear_lb(ss); - lb_free(ss->lb); - } + if (ss->buf != NULL) + free(ss->buf); + if (ss->lb != NULL) { + snl_clear_lb(ss); + lb_free(ss->lb); } } @@ -290,6 +289,16 @@ snl_init(struct snl_state *ss, int netlink_family) return (true); } +static inline bool +snl_clone(struct snl_state *ss, const struct snl_state *orig) +{ + *ss = (struct snl_state){ + .fd = orig->fd, + .init_done = false, + }; + return ((ss->lb = lb_init(SCRATCH_BUFFER_SIZE)) != NULL); +} + static inline bool snl_send(struct snl_state *ss, void *data, int sz) { From nobody Mon Jan 20 21:40:11 2025 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 4YcNzb3RSvz5l0Gy; Mon, 20 Jan 2025 21:40: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 4YcNzb2vH5z4Ggj; Mon, 20 Jan 2025 21:40:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737409211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1fkBU6A7tWcr4U5k16RhfJFYXJHWdQEZIsgjU7rPi8U=; b=r/CNF+34WzINaI+2m9WXR6whEHdxJQRiLxkQFUsSjcBNplHqSmsHxW+zrx+7ALsGiwHgLN a4pVUQcrVGp3/ZLRbeNtgR+oQZVzyDyzxf9ozxIcr+ZwLaJYBleOThSFt60q9CCPjqWWQJ 8pOnrung9XpWhdveHScclSE26Vd9HOgIR6cpMcuV+jkbqh86bEywp50WoFz9j8pRp7j12J K3Ks5+57wUQiRy+xjO10jndsDGyZqdbbJTastkXtC6lExCYpk7st/jlXtWDKQu/vWLV4LL 7i1YKakhHmD0Aqo2YbUZ960nNbPPUYnGdw6AFjaqYL2otD8NzEZGI5WaYrzZ1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737409211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1fkBU6A7tWcr4U5k16RhfJFYXJHWdQEZIsgjU7rPi8U=; b=hlveEUpdO05n1ecn05xPa5uXQIEPnalwYk3g6iJOldaWMVR4HuEkrIt9fdDFyXncv6H2qc vX/Lcu69IW8tcBmo0fB2ZqyVC9xCTvk8nODymqZWTbPf62/f51j5Kh9coH1IxorgdHs9J7 RFygB7zClGSrFQfC+q0HV1bK6YHh9Y1/ehl6SAQ7tKb7wc1w+gxr1DWb9YXIFplB8ZYNMu 5JTYShsQHyqrOw7d7No2l4pb6RxNrrUeWBNJ1/nZlP/SxhX6HMzyeawx5ujgM3AJjo/NhU qd8qXj/jrdqfzXh+qeOVd/bH9qa8wBMqYNMyQ9xZ4b4IErH3NNPP5fSTTiJDrg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737409211; a=rsa-sha256; cv=none; b=xz2zUsDPAahZzmAIoFu4r2G2ygM8BB1z3ZKymE8PWCJTwvqAYVZdfNNfa1W3+mkvZBgOXi EIDuViIL83kuS6EpqzsSBo9IwBKsrya2wMQ+yD3s/O6HmguiwtBwhX9o+ahUkt1OZ03SU+ 6uX0bs3ZcgLOlLkScYqRtTvf8bQjrfIPvMrgILnZd3QJV9DDCpl+7/IYZ3YSGgXd9TEsNF TASiZOmkoi8BPCL96R2irojiSNEo6SfcEtTUK8r5BQHNGLnqws8XyNJCpJq+xSn9V5pJhm 5fWaEy9rtHjZ58a34hDT7sJycZaZ3OH5LylzA9vIuvNkrx1q4TtWW33fqY3y0w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcNzb2Ry0zf6J; Mon, 20 Jan 2025 21:40:11 +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 50KLeBrq000500; Mon, 20 Jan 2025 21:40:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KLeB2n000490; Mon, 20 Jan 2025 21:40:11 GMT (envelope-from git) Date: Mon, 20 Jan 2025 21:40:11 GMT Message-Id: <202501202140.50KLeB2n000490@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: d521362f8f7e - main - netlink: fix 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d521362f8f7e74178eeea1b7e333ca02a440f3e5 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=d521362f8f7e74178eeea1b7e333ca02a440f3e5 commit d521362f8f7e74178eeea1b7e333ca02a440f3e5 Author: Gleb Smirnoff AuthorDate: 2025-01-20 21:38:02 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-20 21:38:02 +0000 netlink: fix build The commit checked in had a dependency on not yet reviewed changes. Revert them, but the main gist of the commit is not reverted. Fixes: f2a4eed3e13b6aeb9ddeef580d3b931cf22a14e3 --- sys/netlink/netlink_snl_generic.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/sys/netlink/netlink_snl_generic.h b/sys/netlink/netlink_snl_generic.h index 7dc8980e1c5c..acf483ac0243 100644 --- a/sys/netlink/netlink_snl_generic.h +++ b/sys/netlink/netlink_snl_generic.h @@ -126,16 +126,10 @@ _snl_get_genl_family_info(struct snl_state *ss, const char *family_name, memset(attrs, 0, sizeof(*attrs)); - if (__predict_false(!snl_init_writer(ss, &nw))) - return (false); - if (__predict_false(snl_create_genl_msg_request(&nw, GENL_ID_CTRL, - CTRL_CMD_GETFAMILY) == NULL)) - return (false); - if (__predict_false(!snl_add_msg_attr_string(&nw, - CTRL_ATTR_FAMILY_NAME, family_name))) - return (false); - hdr = snl_finalize_msg(&nw); - if (!snl_send_message(ss, hdr)) + snl_init_writer(ss, &nw); + snl_create_genl_msg_request(&nw, GENL_ID_CTRL, CTRL_CMD_GETFAMILY); + snl_add_msg_attr_string(&nw, CTRL_ATTR_FAMILY_NAME, family_name); + if ((hdr = snl_finalize_msg(&nw)) == NULL || !snl_send_message(ss, hdr)) return (false); hdr = snl_read_reply(ss, hdr->nlmsg_seq); From nobody Mon Jan 20 21:52:42 2025 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 4YcPG32L1Jz5l14C; Mon, 20 Jan 2025 21:52: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 4YcPG31T39z4HlQ; Mon, 20 Jan 2025 21:52:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737409963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fcR0m1u2fHEewNaNWjYfhteXS9AUlfZggYQHClpx2TU=; b=EnsEfVydTJlhaOglbWwLjnENwr+jZmUcxDT6dTRbMrkpe1tUSqGDbjHt+HvZSPFoomxKcx fa0LLWDTfhbYBPZ9oc9CQEs4DfV6k4dIiV/iVXlZy0MRtY7AziSPwBUyvSUb2zwmU8aTzu W4w4u5yDgaOQlMUE6m1135TqWQOsWXCMJjp6oinhUZ5EZZSaMfkXeHPT1CVqNYeYKsQLXd Xiea3Z+CtZ0LSRZS9rJq5tQUEHR4ur/CQMTjw0pPoVBMa1O8SlhwuKr0mJWdP2e95F1bDR RKtAm9OSmXwONDrl2cmGzYJEdzrG7Nt2NrvgkJy7dekJjw21DBdQdsEf1QBz6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737409963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fcR0m1u2fHEewNaNWjYfhteXS9AUlfZggYQHClpx2TU=; b=pE2wS5hTqYygiBf3byZ5aWdLeHUhOl81b0F+BGC4Xm6V6A8aBvQbqhn0W9mJKN7ARt7frB svYPRKrjba7u8DZb7lLeqBuc7xXpv9Yio3Iac6Jdjfreq6+Pyz3vStAiFLte8UhcGJL67c cddMlAaqyPYe07jZm5t4NEfzpojgVHVcuajkBZDTIAI8nnakfqUamOgWJz5GqnHDtPP5DY x3kZHyBqVmyBH6TEUQW1bjTxI7m/ncrAYU+R8FW+q/N6P7ARMoQlNrDh77P+xHNz+95y5j CEvoaycGqLMUHeuyW2MSTifV9pyfLPzG9KGydtatvgWi1kkm1MDJ7plSB9jEWw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737409963; a=rsa-sha256; cv=none; b=LSRl8XjH72ZozYny/02kTe74VvuojtjL8bwH96AKHIvxm5WU2/yKTZAhpYMTeOXrycQXxX qcpBF7r61lneukvGwwfUEZn9DXIg/NLwEAAm7ojpSaEVFppI/WTMOwASBGnX5hxK0BBdUc +NbOiJ87Z1FnM/xoorqUEemQAOiu8i+JuUOimmbd1p0kMptpbrJUSu284wVwWjg8zlvJ4Z L4vlesF+BcikMkdf99I+PURi31Q5wc1uG07T9TH22PkATRZY8nNYNOoE31aQGT0S4YRdKX vlZQymCOOAPFRr5ONZrpUpwjf00kmmPaMrY7G4fks8AyNSOeMnaCN4jG1eYpgA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcPG30JhSzfdC; Mon, 20 Jan 2025 21:52: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 50KLqgqW030399; Mon, 20 Jan 2025 21:52:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KLqg1C030396; Mon, 20 Jan 2025 21:52:42 GMT (envelope-from git) Date: Mon, 20 Jan 2025 21:52:42 GMT Message-Id: <202501202152.50KLqg1C030396@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: 709c18911ad7 - main - nfsd: Add support for the NFSv4.2 change_attr_type attribute 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: 709c18911ad70978d47198556c0fb1c0e703fb68 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=709c18911ad70978d47198556c0fb1c0e703fb68 commit 709c18911ad70978d47198556c0fb1c0e703fb68 Author: Rick Macklem AuthorDate: 2025-01-20 21:51:33 +0000 Commit: Rick Macklem CommitDate: 2025-01-20 21:51:33 +0000 nfsd: Add support for the NFSv4.2 change_attr_type attribute Richard Kojedzinszky reported an intermittent problem where the Linux NFSv4.2 client would sometimes not see changes done to a directory by another client, although the change attribute for the directory had changed. A test patch that added the change_attr_type attribute to the server and always returned NFS4_CHANGE_TYPE_VERSION_COUNTER_NOPNFS seems to have resolved the issue. Somewhat oddly, the Linux knfsd server does not support this attribute but does not seem to exhibit the stale caching problem. This patch uses the VFCF_FILEREVINC flag on a file system (UFS, ZFS) to return NFS4_CHANGE_TYPE_VERSION_COUNTER_NOPNFS. It also returns NFS4_CHANGE_TYPE_TIME_METADATA if VFCF_FILEREVCT is set, which may be useful for exported fuse file systems. PR: 284186 Reported by: Richard Kojedzinszky Tested by: Richard Kojedzinszky MFC after: 2 weeks --- sys/fs/nfs/nfs_commonsubs.c | 32 ++++++++++++++++++++++++++++++++ sys/fs/nfs/nfsproto.h | 11 ++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index fc01630f77f9..d4d97f4eb966 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -2303,6 +2303,23 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, if (compare && !(*retcmpp) && i != nfs_srvmaxio) *retcmpp = NFSERR_NOTSAME; break; + case NFSATTRBIT_CHANGEATTRTYPE: + NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); + if (compare) { + if (!(*retcmpp)) { + tuint = NFSV4CHANGETYPE_UNDEFINED; + if ((vp->v_mount->mnt_vfc->vfc_flags & + VFCF_FILEREVINC) != 0) + tuint = NFSV4CHANGETYPE_VERS_COUNTER_NOPNFS; + else if ((vp->v_mount->mnt_vfc->vfc_flags & + VFCF_FILEREVCT) != 0) + tuint = NFSV4CHANGETYPE_TIME_METADATA; + if (fxdr_unsigned(uint32_t, *tl) != tuint) + *retcmpp = NFSERR_NOTSAME; + } + } + attrsum += NFSX_UNSIGNED; + break; default: printf("EEK! nfsv4_loadattr unknown attr=%d\n", bitpos); @@ -3127,6 +3144,21 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp, *tl = 0; retnum += 2 * NFSX_UNSIGNED; break; + case NFSATTRBIT_CHANGEATTRTYPE: + NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4CHANGETYPE_UNDEFINED); + if (mp != NULL) { + if ((mp->mnt_vfc->vfc_flags & + VFCF_FILEREVINC) != 0) + *tl = txdr_unsigned( + NFSV4CHANGETYPE_VERS_COUNTER_NOPNFS); + else if ((mp->mnt_vfc->vfc_flags & + VFCF_FILEREVCT) != 0) + *tl = txdr_unsigned( + NFSV4CHANGETYPE_TIME_METADATA); + } + retnum += NFSX_UNSIGNED; + break; default: printf("EEK! Bad V4 attribute bitpos=%d\n", bitpos); } diff --git a/sys/fs/nfs/nfsproto.h b/sys/fs/nfs/nfsproto.h index ce7acf102d41..323746ebbb6c 100644 --- a/sys/fs/nfs/nfsproto.h +++ b/sys/fs/nfs/nfsproto.h @@ -1176,6 +1176,7 @@ struct nfsv3_sattr { NFSATTRBM_LAYOUTBLKSIZE | \ NFSATTRBM_LAYOUTALIGNMENT | \ NFSATTRBM_SUPPATTREXCLCREAT | \ + NFSATTRBM_CHANGEATTRTYPE | \ NFSATTRBM_XATTRSUPPORT) /* @@ -1221,7 +1222,8 @@ struct nfsv3_sattr { * NFSATTRBIT_NFSV42 - Attributes only supported by NFSv4.2. */ #define NFSATTRBIT_NFSV42_2 \ - (NFSATTRBM_XATTRSUPPORT | \ + (NFSATTRBM_CHANGEATTRTYPE | \ + NFSATTRBM_XATTRSUPPORT | \ NFSATTRBM_MODEUMASK) /* @@ -1657,4 +1659,11 @@ typedef struct nfsv4stateid nfsv4stateid_t; #define NFSV4SXATTR_CREATE 1 #define NFSV4SXATTR_REPLACE 2 +/* Values for ChangeAttrType (RFC-7862). */ +#define NFSV4CHANGETYPE_MONOTONIC_INCR 0 +#define NFSV4CHANGETYPE_VERS_COUNTER 1 +#define NFSV4CHANGETYPE_VERS_COUNTER_NOPNFS 2 +#define NFSV4CHANGETYPE_TIME_METADATA 3 +#define NFSV4CHANGETYPE_UNDEFINED 4 + #endif /* _NFS_NFSPROTO_H_ */ From nobody Mon Jan 20 23:47:38 2025 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 4YcRpf5mGrz5l8SS; Mon, 20 Jan 2025 23:47:38 +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 4YcRpf4rPvz3GfQ; Mon, 20 Jan 2025 23:47:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737416858; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hVup1r7b/fcWwG9Td+8a/46eodCLgXMimZf6mggKx8M=; b=YFybtysp3Yw5jxvZ+txcSkF/jQmp/2La0E+lwkktDllWd3r0f08Ri49jLTkMEaZD4o1z9b o0Q5uMEcoyRZUqQGYz+smPNN+uDEaC4hCKcEnYsAZloASrlGXXb+PITnTogx4LLamxxwpY ENfYg+pyHHqGBrfD7YDby4F+CJqkGkTb5KEPMA5iYcQ2z441Bja+hSDTYxNFjMC5Jb0qEx K60Qx/9wa16AW0EavA3ogZaKOuxXdb0mdJOxVxb12RHX7jkMQMw4NqFWGfHMRAnkIMZgMf B2bfC34j+xQSocgeGDk0k0NKmIFvqmF9b4eg5MNMXvixQGQQwbBW0P+pAFJBbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737416858; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hVup1r7b/fcWwG9Td+8a/46eodCLgXMimZf6mggKx8M=; b=btzSbTYLoRIXpGCgeJCmXnGazzYxkxr0oAlPosQKmkoBR6v+Ruqdr6Q/bkDcTgO3KoJLSK KbwPkHLgN4YRGFHVApsoyF873Q3Ep8QGNyMS4WYOURpKmpbnjOMgl6tFKPlbpJIapwduYQ 7ocpNgclrEwzAakbwyAJcgdjjUCXXMAUZMvc1JYV16EUOXeWYvnCv8XO/YfZqMS4jY3+Zq ipb3EfbDJSt0M5YbxXAkpMV/KrBdFDUS9KZh8R7+5tVEHzVkj1a4epRS68e+TPMW97Apzx yfjhdrcKZinYYtoovDOTSRkKSQz9rKjvXJoL/xMYIgJfTTS+OcYeBcxsOTXG7A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737416858; a=rsa-sha256; cv=none; b=wM2y8yFxy+hu9tiNQ3hmjlI5MPutZTZCI7/mD6RVwf92YcxtnvHDvAfIpc9o/xGBXcmQH9 6KAAkZDFJWPB9za1KvJIH1bcLDJISqaNfb8GgZ5jZGJCZoBnv/89+rypF+kNJW/Y02ay4e 2RNmPHDQWgJSApyRi99V0NtkY7LYL7BNyKr2k0e4XJfmW5LeYom8sHW1F1Kj1J0PxArJl7 2tMgPVVe+2vwy3D7crvfLL7lpwnaKiWzOO8shsQ3EeLGlqSSALe8WJpTArwqRr8gq3cfhB zZEk4/q4V87YsJb26pHruAsGTkzunBLGHYJscjKCgIr8ldGw1TYXq/HF+/yBkw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcRpf43QVzj48; Mon, 20 Jan 2025 23:47:38 +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 50KNlcj9038488; Mon, 20 Jan 2025 23:47:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KNlcNP038485; Mon, 20 Jan 2025 23:47:38 GMT (envelope-from git) Date: Mon, 20 Jan 2025 23:47:38 GMT Message-Id: <202501202347.50KNlcNP038485@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 86bfbaf1002c - main - sys: add MBIM (mobile broadband interface module) interface 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 86bfbaf1002c88b5c1a6d3ed261becedb533490b Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=86bfbaf1002c88b5c1a6d3ed261becedb533490b commit 86bfbaf1002c88b5c1a6d3ed261becedb533490b Author: Adrian Chadd AuthorDate: 2025-01-20 23:39:17 +0000 Commit: Adrian Chadd CommitDate: 2025-01-20 23:39:17 +0000 sys: add MBIM (mobile broadband interface module) interface type. This is part of the upcoming USB umb(4) work. Differential Revision: https://reviews.freebsd.org/D48167 Approved by: adrian, zlei Sponsored by: FreeBSD Foundation PR: kern/263783 Submitted by: Pierre Pronchery --- sys/net/if_types.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/net/if_types.h b/sys/net/if_types.h index b0692af69308..1d17e5c09813 100644 --- a/sys/net/if_types.h +++ b/sys/net/if_types.h @@ -254,6 +254,7 @@ typedef enum { IFT_PFLOG = 0xf6, /* PF packet filter logging */ IFT_PFSYNC = 0xf7, /* PF packet filter synchronization */ IFT_WIREGUARD = 0xf8, /* WireGuard tunnel */ + IFT_MBIM = 0xf9, /* Mobile Broadband Interface Model */ } ifType; /* From nobody Mon Jan 20 23:47:39 2025 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 4YcRpg6HgJz5l869; Mon, 20 Jan 2025 23:47: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 4YcRpg4MKqz3GcF; Mon, 20 Jan 2025 23:47:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737416859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qSYVB41Y4MDJO/CmBvGIMU+KjL8V3qRI4Y721E2KVs4=; b=IPH4uN5XeSEbuOBIpbhEExYtLNnq54xWRrDYWolwkeunLMt9ZcUsu/exXdSHgsv0B9vyRn P8mpV6Jk4YASdN3+tNFdHT0Ux0hcMS6rDm7gmXUCOS6gMmRB/OR476cgNx/3TStTQDtXU3 W5PjCaY+cpH1MOYq2a3UWmZ8IK7WyZ+4MpUOC2rktNhnbhDlLGZMv13yimVeA+l7upZCty K0yY/cTOq4iHhlk2nlIK4A4HIvphaKpoQB+YB/3WudwKInONV5qlmNFfTNirQGUtfzECPk HPr6q6HMxaQQGqs7kiW7bqGBR7Gaj8+SDOlbFDu3nzh1ryEWQXU8pzbjh/5ToQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737416859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qSYVB41Y4MDJO/CmBvGIMU+KjL8V3qRI4Y721E2KVs4=; b=DuSfM+glXScsrgSZbzsh+ajqheKntZ/lySo1mN80pUGCdg6ygyvQkeXvegv4LhVy0CHZI0 +f/Gdtjb9sztMBsJnhA+n2IuE3dxgIiLcsvncRief8ZY31CLqsqV8+kXnE1QKsyiYTyUc/ TXznSAjaTU4/7SHsTpQGV+McWdzhxcH9TS5ylHeaD5ViiKnp+k7CeEl5FBQbYFvsDiJAT7 Gz4DlFU4ZBNa2jaApRxraOg3VKvAOLu7UayH8l0KC7WDA89EOhhtWf+UCAUJbE/P1jUGFD MX70c1vWIuaYBNPHRMJOyL9uvMfW9WgDwJhO6vCOH1Uh1pFcHfSCyX/JWAobAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737416859; a=rsa-sha256; cv=none; b=i5VXNFji/YZes77fexmIXUnkCXN3KKeHttwLgWA6ElRIrRDj/QNo4kzvnMT7Lim8TW8Ni8 1uXHDPlLFETm9gqrotN+4qDT8Su6EuJ74yoT36HnG4IRX12h2FzBx+0hLXGMzQgP2274Vk 8ijQoiAyN/68eL8EWx742ENo8xhlnaLQBNrusVzNZsip5GsmH5364ANiiu9zF2y7quxgW1 qjoJK3vPB0riFOIrqO6C18cuRcexFxxLNY0IkFw4tOEFhRVe7nhoYyEsqUYPOmKo8FxE5F 0wObHy8oud6iKd2j/KdafGeSY4QKVC5BSzzJ2oWnz7YZcnmZUCr0IEdt9bq7lw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcRpg3wrszhwF; Mon, 20 Jan 2025 23:47: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 50KNldta038529; Mon, 20 Jan 2025 23:47:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KNldbq038526; Mon, 20 Jan 2025 23:47:39 GMT (envelope-from git) Date: Mon, 20 Jan 2025 23:47:39 GMT Message-Id: <202501202347.50KNldbq038526@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: e5f3620a3e12 - main - sys: add MBM device ioctl() values 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5f3620a3e12c0febab7e4125da526c59a5a195b Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=e5f3620a3e12c0febab7e4125da526c59a5a195b commit e5f3620a3e12c0febab7e4125da526c59a5a195b Author: Adrian Chadd AuthorDate: 2025-01-20 23:44:03 +0000 Commit: Adrian Chadd CommitDate: 2025-01-20 23:44:03 +0000 sys: add MBM device ioctl() values This is part of the upcoming USB umb(4) work. It implements the control ioctl(4)s that MBM devices will need to implement. Differential Revision: https://reviews.freebsd.org/D48167 Approved by: adrian, zlei Sponsored by: FreeBSD Foundation PR: kern/263783 Submitted by: Pierre Pronchery --- sys/sys/sockio.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/sys/sockio.h b/sys/sys/sockio.h index 824b77e57a17..cf612079c2f3 100644 --- a/sys/sys/sockio.h +++ b/sys/sys/sockio.h @@ -147,4 +147,8 @@ #define SIOCSIFCAPNV _IOW('i', 155, struct ifreq) /* set IF features */ #define SIOCGIFCAPNV _IOWR('i', 156, struct ifreq) /* get IF features */ +#define SIOCGUMBINFO _IOWR('i', 157, struct ifreq) /* get MBIM info */ +#define SIOCSUMBPARAM _IOW('i', 158, struct ifreq) /* set MBIM param */ +#define SIOCGUMBPARAM _IOWR('i', 159, struct ifreq) /* get MBIM param */ + #endif /* !_SYS_SOCKIO_H_ */ From nobody Mon Jan 20 23:47:40 2025 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 4YcRpj2XKBz5l8Lb; Mon, 20 Jan 2025 23:47: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 4YcRph5Pbdz3Gfc; Mon, 20 Jan 2025 23:47:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737416860; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qnSFL8tPQyfo72Gb2pIsEDzlTKW2jvx1zson7MAxwG8=; b=Zm6Q8co1jzctASbCcgVkdl/ZzQvgwQ/IEI59O6aq1SQEW4B10Augi3K7QDOI8so5veZ1zt 2BeKZuZ73TsoV5XgnbuBM6kLBQkTAMq02E5YlHbmTvpMYmaQlzxUFw3cmGZTSPUtT051ZX lnufApmhsmtHLpq1vuaCFsSzAqG/mqtYBMTwjp2wjnB9UsEWkeCUUVxS2Ak/h3N9fLukXS 4+/ZpBFpaePFAODzO3FKmQE7gguUR/lqHi8vmue+PjrW67gTaUvBpFuHWyMgQDqvSeleUF /6HMcHvCBAquPvXS9qbw7QatVtUcd87CbD+Ye8e3i9Ush1tMmYANDW1wwahRAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737416860; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qnSFL8tPQyfo72Gb2pIsEDzlTKW2jvx1zson7MAxwG8=; b=DudJ58pW58ks/ShusUlwdJEcKi47Djv6/rA5F8CuXfaghdAcnWvfiYzB1M+7LgxCzwmbWE tfUIps2puMfsSCgYzXTSf26DwxSz7KLfyfxInI22q1FJAG5/iQlaJDNvUVm71C5MhKLTWC z8r1fx5GEQoZ1O7hY6SZN6UEqp7mvPznPwS4hma7/RBRcqF6anlBaesbU0Ej1ZsF0PQUtF 8zWn1XeZCQ4ZLFTGAR93f9MyeZZ9EGOoN+CgHjMIdi05VKSKOqrh/MmyA8kEcOSZcjZFtV R/kIHh/Z0hWBHBMNXBIRxUjwcO1B5Bfk1UoJWqkYh7f9Oi41XOek+gAsWHQT5w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737416860; a=rsa-sha256; cv=none; b=Hg13GyNzLkD152b7IqHSJuyeH58Ce6eiCZHBUuAm4hKYnBKJ4YJB/Z8a8sBTwcXYy4rPHw rr3ve7JFMCR+Jt23NlurDYZfRgjkYC2xzVdMJsV/Z7Jp6+hvBSYG3TzdQbT9uHX1w+QKhZ N27lIfJgzuGTj5OPQldzTvxsw0YRr2rS8dsSFVCNo5tr8/+N+wSiAd35heYMEcCZfyR+q9 wDkzs6EeII94zNwQ7Vqs7UDab5VVV1hVAW6hvQe+GhMAJgZQFbkqAEfQokLXrHOr00CXAy 4NGjXmzpqkXyduV/Ub/woCDZRHV74GF5SxC2hlHem4j4e1xE2yZOHXN5HTGk7g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcRph4tPmzjPn; Mon, 20 Jan 2025 23:47: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 50KNletG038563; Mon, 20 Jan 2025 23:47:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50KNleC1038560; Mon, 20 Jan 2025 23:47:40 GMT (envelope-from git) Date: Mon, 20 Jan 2025 23:47:40 GMT Message-Id: <202501202347.50KNleC1038560@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 0f1bf1c22a0c - main - umb: Introduce the USB umb(4) network 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f1bf1c22a0c97e84a4db19197a75952487aa20b Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=0f1bf1c22a0c97e84a4db19197a75952487aa20b commit 0f1bf1c22a0c97e84a4db19197a75952487aa20b Author: Adrian Chadd AuthorDate: 2025-01-20 23:46:15 +0000 Commit: Adrian Chadd CommitDate: 2025-01-20 23:46:15 +0000 umb: Introduce the USB umb(4) network driver This includes the port of a driver originally from OpenBSD, later ported to NetBSD by the author: * The umb(4) kernel driver * The umbctl(8) companion tool This driver supports USB network devices implementing the Mobile Broadband Interface Model (MBIM), often found in modern (internal) USB models for 4G/LTE mobile broadband access. It is currently limited to IPv4. umbctl has to be used to display or set MBIM cellular modem interface parameters (4G/LTE). Differential Revision: https://reviews.freebsd.org/D48167 Approved by: adrian, zlei Sponsored by: FreeBSD Foundation PR: kern/263783 Submitted by: Pierre Pronchery --- sbin/Makefile | 1 + sbin/umbctl/Makefile | 8 + sbin/umbctl/umbctl.8 | 161 +++ sbin/umbctl/umbctl.c | 557 ++++++++ share/man/man4/Makefile | 1 + share/man/man4/umb.4 | 119 ++ sys/conf/files | 1 + sys/dev/usb/net/if_umb.c | 2930 ++++++++++++++++++++++++++++++++++++++++++ sys/dev/usb/net/if_umbreg.h | 443 +++++++ sys/dev/usb/net/mbim.h | 727 +++++++++++ sys/modules/usb/Makefile | 2 +- sys/modules/usb/umb/Makefile | 33 + 12 files changed, 4982 insertions(+), 1 deletion(-) diff --git a/sbin/Makefile b/sbin/Makefile index 790112b05f6f..5e5a8943c67a 100644 --- a/sbin/Makefile +++ b/sbin/Makefile @@ -63,6 +63,7 @@ SUBDIR=adjkerntz \ swapon \ sysctl \ tunefs \ + umbctl \ umount .if ${MK_INET} != "no" || ${MK_INET6} != "no" diff --git a/sbin/umbctl/Makefile b/sbin/umbctl/Makefile new file mode 100644 index 000000000000..35afb1bcfd4b --- /dev/null +++ b/sbin/umbctl/Makefile @@ -0,0 +1,8 @@ +CFLAGS+= -I${SRCTOP}/sys/dev/usb/net + +PROG= umbctl +MAN= umbctl.8 + +BINDIR= /sbin + +.include diff --git a/sbin/umbctl/umbctl.8 b/sbin/umbctl/umbctl.8 new file mode 100644 index 000000000000..55f8e315fabc --- /dev/null +++ b/sbin/umbctl/umbctl.8 @@ -0,0 +1,161 @@ +.\"- +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2018 by Pierre Pronchery +.\" +.\" 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(S) ``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(S) 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. +.\" +.\" From: pppoectl.8,v 1.30 2016/09/12 05:35:20 sevan Exp $ +.\" +.\" $NetBSD: umbctl.8,v 1.3 2020/03/22 07:45:02 khorben Exp $ +.\" +.\" last edit-date: [Fri Dec 20 18:20:00 2024] +.\" +.Dd December 20, 2024 +.Dt UMBCTL 8 +.Os +.Sh NAME +.Nm umbctl +.Nd display or set MBIM cellular modem interface parameters (4G/LTE) +.Sh SYNOPSIS +.Nm +.Op Fl v +.Ar ifname +.Op Ar parameter Op Ar value +.Ar ... +.Nm +.Op Fl v +.Fl f Ar config-file +.Ar ifname +.Sh DESCRIPTION +.Nm +supports the following options: +.Bl -tag -width "-f config_file" +.It Fl f Ar config-file +Parse +.Ar config-file +for +.Ar parameter Ns Op \&= Ns Ar value +pairs, one per line, as if they had been specified on the command line. +This allows the password or PIN codes to be not passed as command line +arguments. +Comments starting with # to the end of the current line are ignored. +.It Fl v +Enables verbose mode. +.El +.Pp +The +.Xr umb 4 +driver may require a number of additional arguments or optional +parameters besides the settings that can be adjusted with +.Xr ifconfig 8 . +These may be credentials or other tunable connectivity variables. +The +.Nm +utility can be used to display the current settings, or to adjust these +parameters as required. +.Pp +For whatever intent +.Nm +is being called, at least the parameter +.Ar ifname +needs to be specified, naming the interface for which the settings +are to be performed or displayed. +Use +.Xr ifconfig 8 +or +.Xr netstat 1 +to see which interfaces are available. +.Pp +If no other parameter is given, +.Nm +will just list the current status for +.Ar ifname +and exit. +.Pp +If any additional parameter is supplied, superuser privileges are +required, and the command works in +.Ql set +mode. +This is normally done quietly, unless the option +.Fl v +is also enabled, which will cause a final printout of the status as +described above once all other actions have been taken. +.Pp +The parameters currently supported include: +.Bl -tag -width "username=username" +.It Ar apn Ns \&= Ns Em access-point +Set the APN to +.Em access-point . +.It Ar username Ns \&= Ns Em username +Set the username to +.Em username . +.It Ar password Ns \&= Ns Em password +Set the password to +.Em password . +.It Ar pin Ns \&= Ns Em pin-code +Enter the PIN +.Em pin-code . +.It Ar puk Ns \&= Ns Em puk-code +Enter the PUK +.Em puk-code . +.It Ar roaming +Allow data connections when roaming. +.It Ar -roaming +Deny data connections when roaming. +.El +.Sh EXAMPLES +Display the settings for umb0: +.Bd -literal +# umbctl umb0 +umb0: state up, mode automatic, registration home network + provider "BSD-Net", dataclass LTE, signal good + phone number "+15554242", roaming "" (denied) + APN "", TX 50000000, RX 100000000 + firmware "MBIM_FW_V1.0", hardware "MBIM_HW_V1.0" +.Ed +.Pp +Configure the connection parameters for umb0 from the command line: +.Bd -literal +# umbctl umb0 apn operator.internet username mobile password mobile +.Ed +.Pp +Configure the connection parameters for umb0 from a file: +.Bd -literal +# umbctl -f /dev/stdin umb0 << EOF +pin=1234 +EOF +.Ed +.Sh SEE ALSO +.Xr netstat 1 , +.Xr umb 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +utility first appeared in +.Nx 9.0 , +and +.Fx 15.0 . +.Sh AUTHORS +The program was written by +.An Pierre Pronchery . diff --git a/sbin/umbctl/umbctl.c b/sbin/umbctl/umbctl.c new file mode 100644 index 000000000000..3d57b486ad80 --- /dev/null +++ b/sbin/umbctl/umbctl.c @@ -0,0 +1,557 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Original copyright (c) 2018 Pierre Pronchery (for the + * NetBSD Project) + * + * 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 DEVELOPERS ``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 DEVELOPERS 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. + * + * Copyright (c) 2022 ADISTA SAS (FreeBSD updates) + * + * Updates for FreeBSD by Pierre Pronchery + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - 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. + * - Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. + * + * $NetBSD: umbctl.c,v 1.4 2020/05/13 21:44:30 khorben Exp $ + */ + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mbim.h" +#include "if_umbreg.h" + +/* constants */ +static const struct umb_valdescr _umb_actstate[] = + MBIM_ACTIVATION_STATE_DESCRIPTIONS; + +static const struct umb_valdescr _umb_simstate[] = + MBIM_SIMSTATE_DESCRIPTIONS; + +static const struct umb_valdescr _umb_regstate[] = + MBIM_REGSTATE_DESCRIPTIONS; + +static const struct umb_valdescr _umb_pktstate[] = + MBIM_PKTSRV_STATE_DESCRIPTIONS; + +static const struct umb_valdescr _umb_dataclass[] = + MBIM_DATACLASS_DESCRIPTIONS; + +static const struct umb_valdescr _umb_state[] = + UMB_INTERNAL_STATE_DESCRIPTIONS; + +static const struct umb_valdescr _umb_pin_state[] = +{ + { UMB_PIN_REQUIRED, "PIN required"}, + { UMB_PIN_UNLOCKED, "PIN unlocked"}, + { UMB_PUK_REQUIRED, "PUK required"}, + { 0, NULL } +}; + +static const struct umb_valdescr _umb_regmode[] = +{ + { MBIM_REGMODE_UNKNOWN, "unknown" }, + { MBIM_REGMODE_AUTOMATIC, "automatic" }, + { MBIM_REGMODE_MANUAL, "manual" }, + { 0, NULL } +}; + +static const struct umb_valdescr _umb_ber[] = +{ + { UMB_BER_EXCELLENT, "excellent" }, + { UMB_BER_VERYGOOD, "very good" }, + { UMB_BER_GOOD, "good" }, + { UMB_BER_OK, "ok" }, + { UMB_BER_MEDIUM, "medium" }, + { UMB_BER_BAD, "bad" }, + { UMB_BER_VERYBAD, "very bad" }, + { UMB_BER_EXTREMELYBAD, "extremely bad" }, + { 0, NULL } +}; + + +/* prototypes */ +static int _char_to_utf16(const char * in, uint16_t * out, size_t outlen); +static int _error(int ret, char const * format, ...); +static int _umbctl(char const * ifname, int verbose, int argc, char * argv[]); +static int _umbctl_file(char const * ifname, char const * filename, + int verbose); +static void _umbctl_info(char const * ifname, struct umb_info * umbi); +static int _umbctl_ioctl(char const * ifname, int fd, unsigned long request, + struct ifreq * ifr); +static int _umbctl_set(char const * ifname, struct umb_parameter * umbp, + int argc, char * argv[]); +static int _umbctl_socket(void); +static int _usage(void); +static void _utf16_to_char(uint16_t * in, int inlen, char * out, size_t outlen); + + +/* functions */ +/* char_to_utf16 */ +/* this function is from OpenBSD's ifconfig(8) */ +static int _char_to_utf16(const char * in, uint16_t * out, size_t outlen) +{ + int n = 0; + uint16_t c; + + for (;;) { + c = *in++; + + if (c == '\0') { + /* + * NUL termination is not required, but zero out the + * residual buffer + */ + memset(out, 0, outlen); + return n; + } + if (outlen < sizeof(*out)) + return -1; + + *out++ = htole16(c); + n += sizeof(*out); + outlen -= sizeof(*out); + } +} + + +/* error */ +static int _error(int ret, char const * format, ...) +{ + va_list ap; + + fputs("umbctl: ", stderr); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + fputs("\n", stderr); + return ret; +} + + +/* umbctl */ +static int _umbctl(char const * ifname, int verbose, int argc, char * argv[]) +{ + int fd; + struct ifreq ifr; + struct umb_info umbi; + struct umb_parameter umbp; + + if((fd = _umbctl_socket()) < 0) + return 2; + memset(&ifr, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + if(argc != 0) + { + memset(&umbp, 0, sizeof(umbp)); + ifr.ifr_data = (caddr_t)&umbp; + if(_umbctl_ioctl(ifname, fd, SIOCGUMBPARAM, &ifr) != 0 + || _umbctl_set(ifname, &umbp, argc, argv) != 0 + || _umbctl_ioctl(ifname, fd, SIOCSUMBPARAM, + &ifr) != 0) + { + close(fd); + return 2; + } + } + if(argc == 0 || verbose > 0) + { + ifr.ifr_data = (caddr_t)&umbi; + if(_umbctl_ioctl(ifname, fd, SIOCGUMBINFO, &ifr) != 0) + { + close(fd); + return 3; + } + _umbctl_info(ifname, &umbi); + } + if(close(fd) != 0) + return _error(2, "%s: %s", ifname, strerror(errno)); + return 0; +} + + +/* umbctl_file */ +static int _file_parse(char const * ifname, struct umb_parameter * umbp, + char const * filename); + +static int _umbctl_file(char const * ifname, char const * filename, int verbose) +{ + int fd; + struct ifreq ifr; + struct umb_parameter umbp; + struct umb_info umbi; + + if((fd = _umbctl_socket()) < 0) + return 2; + memset(&ifr, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + ifr.ifr_data = (caddr_t)&umbp; + memset(&umbp, 0, sizeof(umbp)); + if(_umbctl_ioctl(ifname, fd, SIOCGUMBPARAM, &ifr) != 0 + || _file_parse(ifname, &umbp, filename) != 0 + || _umbctl_ioctl(ifname, fd, SIOCSUMBPARAM, &ifr) != 0) + { + close(fd); + return 2; + } + if(verbose > 0) + { + ifr.ifr_data = (caddr_t)&umbi; + if(_umbctl_ioctl(ifname, fd, SIOCGUMBINFO, &ifr) != 0) + { + close(fd); + return 3; + } + _umbctl_info(ifname, &umbi); + } + if(close(fd) != 0) + return _error(2, "%s: %s", ifname, strerror(errno)); + return 0; +} + +static int _file_parse(char const * ifname, struct umb_parameter * umbp, + char const * filename) +{ + int ret = 0; + FILE * fp; + char buf[512]; + size_t len; + int i; + int eof; + char * tokens[3] = { buf, NULL, NULL }; + char * p; + + if((fp = fopen(filename, "r")) == NULL) + return _error(2, "%s: %s", filename, strerror(errno)); + while(fgets(buf, sizeof(buf), fp) != NULL) + { + if(buf[0] == '#') + continue; + buf[sizeof(buf) - 1] = '\0'; + if((len = strlen(buf)) > 0) + { + if(buf[len - 1] != '\n') + { + ret = _error(2, "%s: %s", filename, + "Line too long"); + while((i = fgetc(fp)) != EOF && i != '\n'); + continue; + } + buf[len - 1] = '\0'; + } + if((p = strchr(buf, '=')) != NULL) + { + tokens[1] = p + 1; + *p = '\0'; + } else + tokens[1] = NULL; + ret |= _umbctl_set(ifname, umbp, (p != NULL) ? 2 : 1, tokens) + ? 2 : 0; + } + eof = feof(fp); + if(fclose(fp) != 0 || !eof) + return _error(2, "%s: %s", filename, strerror(errno)); + return ret; +} + + +/* umbctl_info */ +static void _umbctl_info(char const * ifname, struct umb_info * umbi) +{ + char provider[UMB_PROVIDERNAME_MAXLEN + 1]; + char pn[UMB_PHONENR_MAXLEN + 1]; + char roaming[UMB_ROAMINGTEXT_MAXLEN + 1]; + char apn[UMB_APN_MAXLEN + 1]; + char fwinfo[UMB_FWINFO_MAXLEN + 1]; + char hwinfo[UMB_HWINFO_MAXLEN + 1]; + + _utf16_to_char(umbi->provider, UMB_PROVIDERNAME_MAXLEN, + provider, sizeof(provider)); + _utf16_to_char(umbi->pn, UMB_PHONENR_MAXLEN, pn, sizeof(pn)); + _utf16_to_char(umbi->roamingtxt, UMB_ROAMINGTEXT_MAXLEN, + roaming, sizeof(roaming)); + _utf16_to_char(umbi->apn, UMB_APN_MAXLEN, apn, sizeof(apn)); + _utf16_to_char(umbi->fwinfo, UMB_FWINFO_MAXLEN, fwinfo, sizeof(fwinfo)); + _utf16_to_char(umbi->hwinfo, UMB_HWINFO_MAXLEN, hwinfo, sizeof(hwinfo)); + printf("%s: state %s, mode %s, registration %s\n" + "\tprovider \"%s\", dataclass %s, signal %s\n" + "\tphone number \"%s\", roaming \"%s\" (%s)\n" + "\tAPN \"%s\", TX %" PRIu64 ", RX %" PRIu64 "\n" + "\tfirmware \"%s\", hardware \"%s\"\n", + ifname, umb_val2descr(_umb_state, umbi->state), + umb_val2descr(_umb_regmode, umbi->regmode), + umb_val2descr(_umb_regstate, umbi->regstate), provider, + umb_val2descr(_umb_dataclass, umbi->cellclass), + umb_val2descr(_umb_ber, umbi->ber), pn, roaming, + umbi->enable_roaming ? "allowed" : "denied", + apn, umbi->uplink_speed, umbi->downlink_speed, + fwinfo, hwinfo); +} + + +/* umbctl_ioctl */ +static int _umbctl_ioctl(char const * ifname, int fd, unsigned long request, + struct ifreq * ifr) +{ + if(ioctl(fd, request, ifr) != 0) + return _error(-1, "%s: %s", ifname, strerror(errno)); + return 0; +} + + +/* umbctl_set */ +/* callbacks */ +static int _set_apn(char const *, struct umb_parameter *, char const *); +static int _set_username(char const *, struct umb_parameter *, char const *); +static int _set_password(char const *, struct umb_parameter *, char const *); +static int _set_pin(char const *, struct umb_parameter *, char const *); +static int _set_puk(char const *, struct umb_parameter *, char const *); +static int _set_roaming_allow(char const *, struct umb_parameter *, + char const *); +static int _set_roaming_deny(char const *, struct umb_parameter *, + char const *); + +static int _umbctl_set(char const * ifname, struct umb_parameter * umbp, + int argc, char * argv[]) +{ + struct + { + char const * name; + int (*callback)(char const *, + struct umb_parameter *, char const *); + int parameter; + } callbacks[] = + { + { "apn", _set_apn, 1 }, + { "username", _set_username, 1 }, + { "password", _set_password, 1 }, + { "pin", _set_pin, 1 }, + { "puk", _set_puk, 1 }, + { "roaming", _set_roaming_allow, 0 }, + { "-roaming", _set_roaming_deny, 0 }, + }; + int i; + size_t j; + + for(i = 0; i < argc; i++) + { + for(j = 0; j < sizeof(callbacks) / sizeof(*callbacks); j++) + if(strcmp(argv[i], callbacks[j].name) == 0) + { + if(callbacks[j].parameter && i + 1 == argc) + return _error(-1, "%s: Incomplete" + " parameter", argv[i]); + if(callbacks[j].callback(ifname, umbp, + callbacks[j].parameter + ? argv[i + 1] : NULL)) + return -1; + if(callbacks[j].parameter) + i++; + break; + } + if(j == sizeof(callbacks) / sizeof(*callbacks)) + return _error(-1, "%s: Unknown parameter", argv[i]); + } + return 0; +} + +static int _set_apn(char const * ifname, struct umb_parameter * umbp, + char const * apn) +{ + umbp->apnlen = _char_to_utf16(apn, umbp->apn, sizeof(umbp->apn)); + if(umbp->apnlen < 0 || (size_t)umbp->apnlen > sizeof(umbp->apn)) + return _error(-1, "%s: %s", ifname, "APN too long"); + return 0; +} + +static int _set_username(char const * ifname, struct umb_parameter * umbp, + char const * username) +{ + umbp->usernamelen = _char_to_utf16(username, umbp->username, + sizeof(umbp->username)); + if(umbp->usernamelen < 0 + || (size_t)umbp->usernamelen > sizeof(umbp->username)) + return _error(-1, "%s: %s", ifname, "Username too long"); + return 0; +} + +static int _set_password(char const * ifname, struct umb_parameter * umbp, + char const * password) +{ + umbp->passwordlen = _char_to_utf16(password, umbp->password, + sizeof(umbp->password)); + if(umbp->passwordlen < 0 + || (size_t)umbp->passwordlen > sizeof(umbp->password)) + return _error(-1, "%s: %s", ifname, "Password too long"); + return 0; +} + +static int _set_pin(char const * ifname, struct umb_parameter * umbp, + char const * pin) +{ + umbp->is_puk = 0; + umbp->op = MBIM_PIN_OP_ENTER; + umbp->pinlen = _char_to_utf16(pin, umbp->pin, sizeof(umbp->pin)); + if(umbp->pinlen < 0 || (size_t)umbp->pinlen + > sizeof(umbp->pin)) + return _error(-1, "%s: %s", ifname, "PIN code too long"); + return 0; +} + +static int _set_puk(char const * ifname, struct umb_parameter * umbp, + char const * puk) +{ + umbp->is_puk = 1; + umbp->op = MBIM_PIN_OP_ENTER; + umbp->pinlen = _char_to_utf16(puk, umbp->pin, sizeof(umbp->pin)); + if(umbp->pinlen < 0 || (size_t)umbp->pinlen > sizeof(umbp->pin)) + return _error(-1, "%s: %s", ifname, "PUK code too long"); + return 0; +} + +static int _set_roaming_allow(char const * ifname, struct umb_parameter * umbp, + char const * unused) +{ + (void) ifname; + (void) unused; + + umbp->roaming = 1; + return 0; +} + +static int _set_roaming_deny(char const * ifname, struct umb_parameter * umbp, + char const * unused) +{ + (void) ifname; + (void) unused; + + umbp->roaming = 0; + return 0; +} + + +/* umbctl_socket */ +static int _umbctl_socket(void) +{ + int fd; + + if((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) + return _error(-1, "socket: %s", strerror(errno)); + return fd; +} + + +/* usage */ +static int _usage(void) +{ + fputs("Usage: umbctl [-v] ifname [parameter [value]] [...]\n" +" umbctl -f config-file ifname\n", + stderr); + return 1; +} + + +/* utf16_to_char */ +static void _utf16_to_char(uint16_t * in, int inlen, char * out, size_t outlen) +{ + uint16_t c; + + while (outlen > 0) { + c = inlen > 0 ? htole16(*in) : 0; + if (c == 0 || --outlen == 0) { + /* always NUL terminate result */ + *out = '\0'; + break; + } + *out++ = isascii(c) ? (char)c : '?'; + in++; + inlen--; + } +} + + +/* main */ +int main(int argc, char * argv[]) +{ + int o; + char const * filename = NULL; + int verbose = 0; + + while((o = getopt(argc, argv, "f:gv")) != -1) + switch(o) + { + case 'f': + filename = optarg; + break; + case 'v': + verbose++; + break; + default: + return _usage(); + } + if(optind == argc) + return _usage(); + if(filename != NULL) + { + if(optind + 1 != argc) + return _usage(); + return _umbctl_file(argv[optind], filename, verbose); + } + return _umbctl(argv[optind], verbose, argc - optind - 1, + &argv[optind + 1]); +} diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index c03ba63c349f..9dc1c7f9bc12 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -1041,6 +1041,7 @@ MAN+= \ uled.4 \ ulpt.4 \ umass.4 \ + umb.4 \ umcs.4 \ umct.4 \ umodem.4 \ diff --git a/share/man/man4/umb.4 b/share/man/man4/umb.4 new file mode 100644 index 000000000000..b0d517095933 --- /dev/null +++ b/share/man/man4/umb.4 @@ -0,0 +1,119 @@ +.\"- +.\" SPDX-License-Identifier: 0BSD +.\" +.\" Copyright (c) 2016 genua mbH +.\" +.\" 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. +.\" +.\" $NetBSD: umb.4,v 1.4 2019/08/30 09:22:17 wiz Exp $ +.\" +.Dd August 24, 2019 +.Dt UMB 4 +.Os +.Sh NAME +.Nm umb +.Nd USB Mobile Broadband Interface Model (MBIM) +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device usb" +.Cd "device umb" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +umb_load="YES" +.Ed +.Pp +If neither of the above is done, the driver will automatically be loaded +by devd(8) when the device is connected. +.Sh DESCRIPTION +The +.Nm +driver provides support for USB MBIM devices. +.Pp +MBIM devices establish connections via cellular networks such as +GPRS, UMTS, and LTE. +They appear as a regular point-to-point network interface, +transporting raw IP frames. +.Pp +Required configuration parameters like PIN and APN have to be set +with +.Xr umbctl 8 . +Once the SIM card has been unlocked with the correct PIN, it +will remain in this state until the MBIM device is power-cycled. +In case the device is connected to an "always-on" USB port, +it may be possible to connect to a provider without entering the +PIN again even if the system was rebooted. +.Sh HARDWARE +The +.Nm +driver should support any USB device implementing MBIM, including +the following cellular modems: +.Pp +.Bl -bullet -compact +.It +Ericsson H5321gw and N5321gw +.It +Fibocom L831-EAU +.It +Medion Mobile S4222 (MediaTek OEM) +.It +Sierra Wireless EM7345 +.It +Sierra Wireless EM7455 +.It +Sierra Wireless EM8805 +.It +Sierra Wireless MC8305 +.El +.Sh SEE ALSO +.Xr intro 4 , +.Xr netintro 4 , +.Xr usb 4 , +.Xr ifconfig 8 , +.Xr umbctl 8 +.Rs +.%T "Universal Serial Bus Communications Class Subclass Specification for Mobile Broadband Interface Model" +.%U http://www.usb.org/developers/docs/devclass_docs/MBIM10Errata1_073013.zip +.Re +.Sh HISTORY +The +.Nm +device driver first appeared in +.Ox 6.0 , +.Nx 9.0 , +and +.Fx 15.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Gerhard Roth Aq Mt gerhard@openbsd.org +and ported from +.Ox +by +.An Pierre Pronchery Aq Mt khorben@defora.org . +.Sh CAVEATS +The +.Nm +driver does not support IPv6. +.Pp +Devices which fail to provide a conforming MBIM implementation will +probably be attached as some other driver, such as +.Xr u3g 4 . diff --git a/sys/conf/files b/sys/conf/files index a02174f3d954..5fd7b887581a 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3293,6 +3293,7 @@ dev/usb/net/if_muge.c optional muge dev/usb/net/if_rue.c optional rue dev/usb/net/if_smsc.c optional smsc dev/usb/net/if_udav.c optional udav +dev/usb/net/if_umb.c optional umb dev/usb/net/if_ure.c optional ure dev/usb/net/if_usie.c optional usie dev/usb/net/if_urndis.c optional urndis diff --git a/sys/dev/usb/net/if_umb.c b/sys/dev/usb/net/if_umb.c new file mode 100644 index 000000000000..9b2b504cfa6b --- /dev/null +++ b/sys/dev/usb/net/if_umb.c @@ -0,0 +1,2930 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Original copyright (c) 2016 genua mbH (OpenBSD version) + * + * 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. + * + * Copyright (c) 2022 ADISTA SAS (re-write for FreeBSD) + * + * Re-write for FreeBSD by Pierre Pronchery + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation *** 4136 LINES SKIPPED *** From nobody Tue Jan 21 01:50:59 2025 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 4YcVXz5yTyz5lJPC; Tue, 21 Jan 2025 01:50: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 4YcVXz3MVtz3c9F; Tue, 21 Jan 2025 01:50:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737424259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+f9N2m8ovKDQ/Q41MCrsr02trDasdNy2h7LnSeztS/Q=; b=nJJbOej0aSU0Zav98oROA2OOXjbeBSK1lpy4XsLEs552Vk/bXzKPfy9OiDhUWNEob2PjKe dnUaDpQc3S/WqYhFcxk3n+4q78Uz5turInVGz5YrQW/McFCXATxQkvsuLb5vTvZ7Aox5k5 cTil1SLqou1TE0yXJTcH0sTjP4qqlK5AMy6Pw3LLpvM+bfPtDQleVpoGlKY2wdyHr3quKj 8rpPKPZcz5eeBAPgFermneACxfilZLfncGzA4wRvTfe9a/0YJhO1YQBPfTrS/+/QAbBKTN 7qYMjWR2AuCWi/GHq1xZOxLSUwiamyFJTBMcFmnTj5HaC4zfhar1rywbGTo90A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737424259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+f9N2m8ovKDQ/Q41MCrsr02trDasdNy2h7LnSeztS/Q=; b=UcBNcjlYRqvZI8x0gzL7a84wQoC/dqJYQnTy2uQzZ40OPqh1CMIOzeHcDMGrSyuAkK6Buq /RX+vS8d605qD9K0cb0qKwWmQmXD6FvIM3JnGNq+uTfs4xvl2jdXD9ZuQ/n5fGJsKmcTci hBE9m52Cp6Lln9rmxCubHH0Tdb0I5wXsCrQrLmR9sO0QhqHp7I8FLsREFVn3j5RSb4em9J F7B4ZC3iOVwG4aIpz9BsSTF6+gvC+EO1AVXtAGXWW36KgkTct97LUpSxEAdLJp4yoegFZe X3VuAf76H3mo/tqnYtJQ5zDmVDDVeGqOuVyf4b4HM3FF3CGj7pKnakVzxdtWVg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737424259; a=rsa-sha256; cv=none; b=Li/NDznKPONSC5MDvSBR2n3sL4OM17lVhz0lTWGfW5aXnHL+s+U9Wm6/dTYIOb3AsTum09 I9wEg97S/RSqxyZlthS9VouGvwd7WdumD9sYAXvynthADN4rkmUx18fKYv9qZoR3lkKV/m KkG8RCUBqIXQCvfzOEkquPbHHXejoJNrzA9Obe6A44VXkE8/XLR020ez9sFDJsZ0zRUlpx ASlCIIoRd8ATfk1CJIAYsOQ6whIrjwccqVt9UBj7NEc5XCSGigueRYA3ffQVQlge8Ox6jB NRz8lh1PiuAc0tzgFHmDdVXYo4YCWfUnUTrVin88yJmPlzp2F30D7m7CYBC6Ng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcVXz2wdJzlqK; Tue, 21 Jan 2025 01:50: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 50L1ox4F074068; Tue, 21 Jan 2025 01:50:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50L1oxvM074065; Tue, 21 Jan 2025 01:50:59 GMT (envelope-from git) Date: Tue, 21 Jan 2025 01:50:59 GMT Message-Id: <202501210150.50L1oxvM074065@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: dd1d72961b8d - main - rtld-elf/rtld.c: fix typo 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dd1d72961b8d343b29480b74afcfe4292fd166af Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=dd1d72961b8d343b29480b74afcfe4292fd166af commit dd1d72961b8d343b29480b74afcfe4292fd166af Author: Konstantin Belousov AuthorDate: 2025-01-18 06:33:40 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-21 01:43:54 +0000 rtld-elf/rtld.c: fix typo in comment Discussed with: emaste, imp Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D48509 --- libexec/rtld-elf/rtld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 7dc9d93dac26..70230a8e0199 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -5301,7 +5301,7 @@ allocate_tls(Obj_Entry *objs, void *oldtcb, size_t tcbsize, size_t tcbalign) maxalign = MAX(tcbalign, tls_static_max_align); tls_init_align = MAX(obj_main->tlsalign, 1); - /* Compute fragmets sizes. */ + /* Compute fragments sizes. */ extra_size = tcbsize - TLS_TCB_SIZE; post_size = calculate_tls_post_size(tls_init_align); tls_block_size = tcbsize + post_size; From nobody Tue Jan 21 01:51:00 2025 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 4YcVY069ZGz5lJ0F; Tue, 21 Jan 2025 01:51: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 4YcVY04F33z3cLL; Tue, 21 Jan 2025 01:51:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737424260; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2ZNAnYAmYwuMBjcvWWsXKWG6/dfVMHU3qioh+YrCjc4=; b=d7pHxzLwoNfh1yVAkHUhRHhLGBnA1XI7FDdFUIOJ+Kf7g66wsC1SnRhnUDZz7IZdwzwiM/ 1+fZq44O58VXfv52SN+FRSLU309s4zLyoGLJYXEOCc6ZkPzEFPlYBIkvzleZscwDT6ImYP Td4Tv1Y8sZ028FhRD6/6xEj0QqaUT23R6auLCMyptE7pSFyBl3N8gwPMOT6p2JGzlA4ZDi 111VtIiyRr7AH+apPccuArL+RQUNcAg6El0GKJYyJDr8d5v9SI/DcacLhpliBM+z9Ef+sA J18W8XpMNKjhvUE4UDTKGgi5mC1qwldhVI9z4xJOUvUt2OTtNani44FYTYK9AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737424260; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2ZNAnYAmYwuMBjcvWWsXKWG6/dfVMHU3qioh+YrCjc4=; b=ZqwVCfNBw4uVcsK1v50RMZpioiXiWtHeZwL2IOBuiRZgPYzP9o3uOY8qiOa2m/wIkLHOoL p8C6FyNWwa4o/QTeqVUzsZCxKfF+aqEhgNUpuvhyF3sDGx1tZ3TDAAhbxv0vD2peqC9SpB TpG73d94NqVRApk0gHwFZ0VNdXT/rx8t0lzGeihpEDb4SDpohfNontf/TMFey5WFmlZdMv Q7aDp6pj3i+vMdI5hY662/oB4xfZfmWqgjkGf+Rddd+xk4q+QCh8Ja0unZha318MPsPwdj ETt6aVelxMtcYwb5SWoG6amGojBFcf4FY91jBuUjHyJLchfsWEQu+r3aWaUcBw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737424260; a=rsa-sha256; cv=none; b=Pb1akKn4WVhmZAyrYkuckVewmHmp4UOtGyePxuBzh+MfSHcBrwZyOHPQhvG9rI0cmlviLa 969v5AWGKzndwI2TYQ9uvxjx44l0OTl+SCD67gj9aya1TD1Ar+5hzajEOqtHaxO18Xfsbq FPTDS+0ox7lcvlQoU3o8WoeiEVu9mGfMpTwmEvOi+5RqABzHPd3g/HwysaGJ3ZpB2C8lbI hYrRRmLdAVzLQs9GRCrPsPjDEl7UJ06VH5vYeLlLwXcURPZJM+BTMbxQN7iRpKr2MAfhid Eqb4dx8gifXaz5g+dKSVic3ymqrSYBEXridsv+toRJNeZRdm7MPg6U2lxdKwqg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcVY03crZzlt3; Tue, 21 Jan 2025 01:51: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 50L1p0kF074109; Tue, 21 Jan 2025 01:51:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50L1p0cN074106; Tue, 21 Jan 2025 01:51:00 GMT (envelope-from git) Date: Tue, 21 Jan 2025 01:51:00 GMT Message-Id: <202501210151.50L1p0cN074106@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: 7e2f38311e62 - main - rtld-elf/rtld.c: apply clang-format 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: 7e2f38311e62b1a3ba4a023042f2dc36e27cdd06 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7e2f38311e62b1a3ba4a023042f2dc36e27cdd06 commit 7e2f38311e62b1a3ba4a023042f2dc36e27cdd06 Author: Konstantin Belousov AuthorDate: 2025-01-18 02:26:16 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-21 01:44:12 +0000 rtld-elf/rtld.c: apply clang-format Discussed with: emaste, imp Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D48509 --- libexec/rtld-elf/rtld.c | 5914 ++++++++++++++++++++++++----------------------- 1 file changed, 2993 insertions(+), 2921 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 70230a8e0199..8ec883227908 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -39,13 +39,13 @@ */ #include -#include +#include #include +#include #include #include #include #include -#include #include #include @@ -58,20 +58,19 @@ #include #include "debug.h" -#include "rtld.h" #include "libmap.h" +#include "notes.h" +#include "rtld.h" +#include "rtld_libc.h" +#include "rtld_malloc.h" #include "rtld_paths.h" -#include "rtld_tls.h" #include "rtld_printf.h" -#include "rtld_malloc.h" +#include "rtld_tls.h" #include "rtld_utrace.h" -#include "notes.h" -#include "rtld_libc.h" /* Types. */ typedef void (*func_ptr_type)(void); -typedef void * (*path_enum_proc) (const char *path, size_t len, void *arg); - +typedef void *(*path_enum_proc)(const char *path, size_t len, void *arg); /* Variables that cannot be static: */ extern struct r_debug r_debug; /* For GDB */ @@ -138,7 +137,7 @@ static void objlist_put_after(Objlist *, Obj_Entry *, Obj_Entry *); static void objlist_remove(Objlist *, Obj_Entry *); static int open_binary_fd(const char *argv0, bool search_in_path, const char **binpath_res); -static int parse_args(char* argv[], int argc, bool *use_pathp, int *fdp, +static int parse_args(char *argv[], int argc, bool *use_pathp, int *fdp, const char **argv0, bool *dir_ignore); static int parse_integer(const char *); static void *path_enumerate(const char *, path_enum_proc, const char *, void *); @@ -174,15 +173,15 @@ static void unlink_object(Obj_Entry *); static void unload_object(Obj_Entry *, RtldLockState *lockstate); static void unref_dag(Obj_Entry *); static void ref_dag(Obj_Entry *); -static char *origin_subst_one(Obj_Entry *, char *, const char *, - const char *, bool); +static char *origin_subst_one(Obj_Entry *, char *, const char *, const char *, + bool); static char *origin_subst(Obj_Entry *, const char *); static bool obj_resolve_origin(Obj_Entry *obj); static void preinit_main(void); -static int rtld_verify_versions(const Objlist *); -static int rtld_verify_object_versions(Obj_Entry *); +static int rtld_verify_versions(const Objlist *); +static int rtld_verify_object_versions(Obj_Entry *); static void object_add_name(Obj_Entry *, const char *); -static int object_match_name(const Obj_Entry *, const char *); +static int object_match_name(const Obj_Entry *, const char *); static void ld_utrace_log(int, void *, void *, size_t, int, const char *); static void rtld_fill_dl_phdr_info(const Obj_Entry *obj, struct dl_phdr_info *phdr_info); @@ -198,45 +197,49 @@ int __sys_openat(int, const char *, int, ...); /* * Data declarations. */ -struct r_debug r_debug __exported; /* for GDB; */ -static bool libmap_disable; /* Disable libmap */ -static bool ld_loadfltr; /* Immediate filters processing */ -static const char *libmap_override;/* Maps to use in addition to libmap.conf */ -static bool trust; /* False for setuid and setgid programs */ -static bool dangerous_ld_env; /* True if environment variables have been - used to affect the libraries loaded */ -bool ld_bind_not; /* Disable PLT update */ -static const char *ld_bind_now; /* Environment variable for immediate binding */ +struct r_debug r_debug __exported; /* for GDB; */ +static bool libmap_disable; /* Disable libmap */ +static bool ld_loadfltr; /* Immediate filters processing */ +static const char *libmap_override; /* Maps to use in addition to libmap.conf */ +static bool trust; /* False for setuid and setgid programs */ +static bool dangerous_ld_env; /* True if environment variables have been + used to affect the libraries loaded */ +bool ld_bind_not; /* Disable PLT update */ +static const char *ld_bind_now; /* Environment variable for immediate binding */ static const char *ld_debug; /* Environment variable for debugging */ static bool ld_dynamic_weak = true; /* True if non-weak definition overrides weak definition */ -static const char *ld_library_path;/* Environment variable for search path */ -static const char *ld_library_dirs;/* Environment variable for library descriptors */ -static const char *ld_preload; /* Environment variable for libraries to - load first */ -static const char *ld_preload_fds;/* Environment variable for libraries represented by - descriptors */ -static const char *ld_elf_hints_path; /* Environment variable for alternative hints path */ -static const char *ld_tracing; /* Called from ldd to print libs */ -static const char *ld_utrace; /* Use utrace() to log events. */ -static struct obj_entry_q obj_list; /* Queue of all loaded objects */ -static Obj_Entry *obj_main; /* The main program shared object */ -static Obj_Entry obj_rtld; /* The dynamic linker shared object */ -static unsigned int obj_count; /* Number of objects in obj_list */ -static unsigned int obj_loads; /* Number of loads of objects (gen count) */ -size_t ld_static_tls_extra = /* Static TLS extra space (bytes) */ - RTLD_STATIC_TLS_EXTRA; - -static Objlist list_global = /* Objects dlopened with RTLD_GLOBAL */ - STAILQ_HEAD_INITIALIZER(list_global); -static Objlist list_main = /* Objects loaded at program startup */ - STAILQ_HEAD_INITIALIZER(list_main); -static Objlist list_fini = /* Objects needing fini() calls */ - STAILQ_HEAD_INITIALIZER(list_fini); - -Elf_Sym sym_zero; /* For resolving undefined weak refs. */ - -#define GDB_STATE(s,m) r_debug.r_state = s; r_debug_state(&r_debug,m); +static const char *ld_library_path; /* Environment variable for search path */ +static const char + *ld_library_dirs; /* Environment variable for library descriptors */ +static const char *ld_preload; /* Environment variable for libraries to + load first */ +static const char *ld_preload_fds; /* Environment variable for libraries + represented by descriptors */ +static const char + *ld_elf_hints_path; /* Environment variable for alternative hints path */ +static const char *ld_tracing; /* Called from ldd to print libs */ +static const char *ld_utrace; /* Use utrace() to log events. */ +static struct obj_entry_q obj_list; /* Queue of all loaded objects */ +static Obj_Entry *obj_main; /* The main program shared object */ +static Obj_Entry obj_rtld; /* The dynamic linker shared object */ +static unsigned int obj_count; /* Number of objects in obj_list */ +static unsigned int obj_loads; /* Number of loads of objects (gen count) */ +size_t ld_static_tls_extra = /* Static TLS extra space (bytes) */ + RTLD_STATIC_TLS_EXTRA; + +static Objlist list_global = /* Objects dlopened with RTLD_GLOBAL */ + STAILQ_HEAD_INITIALIZER(list_global); +static Objlist list_main = /* Objects loaded at program startup */ + STAILQ_HEAD_INITIALIZER(list_main); +static Objlist list_fini = /* Objects needing fini() calls */ + STAILQ_HEAD_INITIALIZER(list_fini); + +Elf_Sym sym_zero; /* For resolving undefined weak refs. */ + +#define GDB_STATE(s, m) \ + r_debug.r_state = s; \ + r_debug_state(&r_debug, m); extern Elf_Dyn _DYNAMIC; #pragma weak _DYNAMIC @@ -251,7 +254,7 @@ void *dlvsym(void *, const char *, const char *) __exported; int dladdr(const void *, Dl_info *) __exported; void dllockinit(void *, void *(*)(void *), void (*)(void *), void (*)(void *), void (*)(void *), void (*)(void *), void (*)(void *)) __exported; -int dlinfo(void *, int , void *) __exported; +int dlinfo(void *, int, void *) __exported; int _dl_iterate_phdr_locked(__dl_iterate_hdr_callback, void *) __exported; int dl_iterate_phdr(__dl_iterate_hdr_callback, void *) __exported; int _rtld_addr_phdr(const void *, struct dl_phdr_info *) __exported; @@ -290,12 +293,12 @@ char **main_argv; /* * Globals to control TLS allocation. */ -size_t tls_last_offset; /* Static TLS offset of last module */ -size_t tls_last_size; /* Static TLS size of last module */ -size_t tls_static_space; /* Static TLS space allocated */ +size_t tls_last_offset; /* Static TLS offset of last module */ +size_t tls_last_size; /* Static TLS size of last module */ +size_t tls_static_space; /* Static TLS space allocated */ static size_t tls_static_max_align; -Elf_Addr tls_dtv_generation = 1; /* Used to detect when dtv size changes */ -int tls_max_index = 1; /* Largest module index allocated */ +Elf_Addr tls_dtv_generation = 1; /* Used to detect when dtv size changes */ +int tls_max_index = 1; /* Largest module index allocated */ static bool ld_library_path_rpath = false; bool ld_fast_sigblock = false; @@ -316,16 +319,16 @@ static void (*rtld_exit_ptr)(void); * the currently-loaded objects. Keep this as a macro since it calls * alloca and we want that to occur within the scope of the caller. */ -#define donelist_init(dlp) \ - ((dlp)->objs = alloca(obj_count * sizeof (dlp)->objs[0]), \ - assert((dlp)->objs != NULL), \ - (dlp)->num_alloc = obj_count, \ - (dlp)->num_used = 0) +#define donelist_init(dlp) \ + ((dlp)->objs = alloca(obj_count * sizeof(dlp)->objs[0]), \ + assert((dlp)->objs != NULL), (dlp)->num_alloc = obj_count, \ + (dlp)->num_used = 0) -#define LD_UTRACE(e, h, mb, ms, r, n) do { \ - if (ld_utrace != NULL) \ - ld_utrace_log(e, h, mb, ms, r, n); \ -} while (0) +#define LD_UTRACE(e, h, mb, ms, r, n) \ + do { \ + if (ld_utrace != NULL) \ + ld_utrace_log(e, h, mb, ms, r, n); \ + } while (0) static void ld_utrace_log(int event, void *handle, void *mapbase, size_t mapsize, @@ -347,19 +350,15 @@ ld_utrace_log(int event, void *handle, void *mapbase, size_t mapsize, } struct ld_env_var_desc { - const char * const n; + const char *const n; const char *val; - const bool unsecure:1; - const bool can_update:1; - const bool debug:1; - bool owned:1; + const bool unsecure : 1; + const bool can_update : 1; + const bool debug : 1; + bool owned : 1; }; -#define LD_ENV_DESC(var, unsec, ...) \ - [LD_##var] = { \ - .n = #var, \ - .unsecure = unsec, \ - __VA_ARGS__ \ - } +#define LD_ENV_DESC(var, unsec, ...) \ + [LD_##var] = { .n = #var, .unsecure = unsec, __VA_ARGS__ } static struct ld_env_var_desc ld_env_vars[] = { LD_ENV_DESC(BIND_NOW, false), @@ -494,506 +493,524 @@ rtld_trunc_page(uintptr_t x) func_ptr_type _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) { - Elf_Auxinfo *aux, *auxp, *auxpf, *aux_info[AT_COUNT]; - Objlist_Entry *entry; - Obj_Entry *last_interposer, *obj, *preload_tail; - const Elf_Phdr *phdr; - Objlist initlist; - RtldLockState lockstate; - struct stat st; - Elf_Addr *argcp; - char **argv, **env, **envp, *kexecpath; - const char *argv0, *binpath, *library_path_rpath, *static_tls_extra; - struct ld_env_var_desc *lvd; - caddr_t imgentry; - char buf[MAXPATHLEN]; - int argc, fd, i, mib[4], old_osrel, osrel, phnum, rtld_argc; - size_t sz; + Elf_Auxinfo *aux, *auxp, *auxpf, *aux_info[AT_COUNT]; + Objlist_Entry *entry; + Obj_Entry *last_interposer, *obj, *preload_tail; + const Elf_Phdr *phdr; + Objlist initlist; + RtldLockState lockstate; + struct stat st; + Elf_Addr *argcp; + char **argv, **env, **envp, *kexecpath; + const char *argv0, *binpath, *library_path_rpath, *static_tls_extra; + struct ld_env_var_desc *lvd; + caddr_t imgentry; + char buf[MAXPATHLEN]; + int argc, fd, i, mib[4], old_osrel, osrel, phnum, rtld_argc; + size_t sz; #ifdef __powerpc__ - int old_auxv_format = 1; + int old_auxv_format = 1; #endif - bool dir_enable, dir_ignore, direct_exec, explicit_fd, search_in_path; - - /* - * On entry, the dynamic linker itself has not been relocated yet. - * Be very careful not to reference any global data until after - * init_rtld has returned. It is OK to reference file-scope statics - * and string constants, and to call static and global functions. - */ - - /* Find the auxiliary vector on the stack. */ - argcp = sp; - argc = *sp++; - argv = (char **) sp; - sp += argc + 1; /* Skip over arguments and NULL terminator */ - env = (char **) sp; - while (*sp++ != 0) /* Skip over environment, and NULL terminator */ - ; - aux = (Elf_Auxinfo *) sp; - - /* Digest the auxiliary vector. */ - for (i = 0; i < AT_COUNT; i++) - aux_info[i] = NULL; - for (auxp = aux; auxp->a_type != AT_NULL; auxp++) { - if (auxp->a_type < AT_COUNT) - aux_info[auxp->a_type] = auxp; + bool dir_enable, dir_ignore, direct_exec, explicit_fd, search_in_path; + + /* + * On entry, the dynamic linker itself has not been relocated yet. + * Be very careful not to reference any global data until after + * init_rtld has returned. It is OK to reference file-scope statics + * and string constants, and to call static and global functions. + */ + + /* Find the auxiliary vector on the stack. */ + argcp = sp; + argc = *sp++; + argv = (char **)sp; + sp += argc + 1; /* Skip over arguments and NULL terminator */ + env = (char **)sp; + while (*sp++ != 0) /* Skip over environment, and NULL terminator */ + ; + aux = (Elf_Auxinfo *)sp; + + /* Digest the auxiliary vector. */ + for (i = 0; i < AT_COUNT; i++) + aux_info[i] = NULL; + for (auxp = aux; auxp->a_type != AT_NULL; auxp++) { + if (auxp->a_type < AT_COUNT) + aux_info[auxp->a_type] = auxp; #ifdef __powerpc__ - if (auxp->a_type == 23) /* AT_STACKPROT */ - old_auxv_format = 0; + if (auxp->a_type == 23) /* AT_STACKPROT */ + old_auxv_format = 0; #endif - } + } #ifdef __powerpc__ - if (old_auxv_format) { - /* Remap from old-style auxv numbers. */ - aux_info[23] = aux_info[21]; /* AT_STACKPROT */ - aux_info[21] = aux_info[19]; /* AT_PAGESIZESLEN */ - aux_info[19] = aux_info[17]; /* AT_NCPUS */ - aux_info[17] = aux_info[15]; /* AT_CANARYLEN */ - aux_info[15] = aux_info[13]; /* AT_EXECPATH */ - aux_info[13] = NULL; /* AT_GID */ - - aux_info[20] = aux_info[18]; /* AT_PAGESIZES */ - aux_info[18] = aux_info[16]; /* AT_OSRELDATE */ - aux_info[16] = aux_info[14]; /* AT_CANARY */ - aux_info[14] = NULL; /* AT_EGID */ - } + if (old_auxv_format) { + /* Remap from old-style auxv numbers. */ + aux_info[23] = aux_info[21]; /* AT_STACKPROT */ + aux_info[21] = aux_info[19]; /* AT_PAGESIZESLEN */ + aux_info[19] = aux_info[17]; /* AT_NCPUS */ + aux_info[17] = aux_info[15]; /* AT_CANARYLEN */ + aux_info[15] = aux_info[13]; /* AT_EXECPATH */ + aux_info[13] = NULL; /* AT_GID */ + + aux_info[20] = aux_info[18]; /* AT_PAGESIZES */ + aux_info[18] = aux_info[16]; /* AT_OSRELDATE */ + aux_info[16] = aux_info[14]; /* AT_CANARY */ + aux_info[14] = NULL; /* AT_EGID */ + } #endif - /* Initialize and relocate ourselves. */ - assert(aux_info[AT_BASE] != NULL); - init_rtld((caddr_t) aux_info[AT_BASE]->a_un.a_ptr, aux_info); - - dlerror_dflt_init(); - - __progname = obj_rtld.path; - argv0 = argv[0] != NULL ? argv[0] : "(null)"; - environ = env; - main_argc = argc; - main_argv = argv; - - if (aux_info[AT_BSDFLAGS] != NULL && - (aux_info[AT_BSDFLAGS]->a_un.a_val & ELF_BSDF_SIGFASTBLK) != 0) - ld_fast_sigblock = true; - - trust = !issetugid(); - direct_exec = false; - - md_abi_variant_hook(aux_info); - rtld_init_env_vars(env); - - fd = -1; - if (aux_info[AT_EXECFD] != NULL) { - fd = aux_info[AT_EXECFD]->a_un.a_val; - } else { - assert(aux_info[AT_PHDR] != NULL); - phdr = (const Elf_Phdr *)aux_info[AT_PHDR]->a_un.a_ptr; - if (phdr == obj_rtld.phdr) { - if (!trust) { - _rtld_error("Tainted process refusing to run binary %s", - argv0); - rtld_die(); - } - direct_exec = true; - - dbg("opening main program in direct exec mode"); - if (argc >= 2) { - rtld_argc = parse_args(argv, argc, &search_in_path, &fd, - &argv0, &dir_ignore); - explicit_fd = (fd != -1); - binpath = NULL; - if (!explicit_fd) - fd = open_binary_fd(argv0, search_in_path, &binpath); - if (fstat(fd, &st) == -1) { - _rtld_error("Failed to fstat FD %d (%s): %s", fd, - explicit_fd ? "user-provided descriptor" : argv0, - rtld_strerror(errno)); - rtld_die(); - } + /* Initialize and relocate ourselves. */ + assert(aux_info[AT_BASE] != NULL); + init_rtld((caddr_t)aux_info[AT_BASE]->a_un.a_ptr, aux_info); - /* - * Rough emulation of the permission checks done by - * execve(2), only Unix DACs are checked, ACLs are - * ignored. Preserve the semantic of disabling owner - * to execute if owner x bit is cleared, even if - * others x bit is enabled. - * mmap(2) does not allow to mmap with PROT_EXEC if - * binary' file comes from noexec mount. We cannot - * set a text reference on the binary. - */ - dir_enable = false; - if (st.st_uid == geteuid()) { - if ((st.st_mode & S_IXUSR) != 0) - dir_enable = true; - } else if (st.st_gid == getegid()) { - if ((st.st_mode & S_IXGRP) != 0) - dir_enable = true; - } else if ((st.st_mode & S_IXOTH) != 0) { - dir_enable = true; - } - if (!dir_enable && !dir_ignore) { - _rtld_error("No execute permission for binary %s", - argv0); - rtld_die(); - } + dlerror_dflt_init(); - /* - * For direct exec mode, argv[0] is the interpreter - * name, we must remove it and shift arguments left - * before invoking binary main. Since stack layout - * places environment pointers and aux vectors right - * after the terminating NULL, we must shift - * environment and aux as well. - */ - main_argc = argc - rtld_argc; - for (i = 0; i <= main_argc; i++) - argv[i] = argv[i + rtld_argc]; - *argcp -= rtld_argc; - environ = env = envp = argv + main_argc + 1; - dbg("move env from %p to %p", envp + rtld_argc, envp); - do { - *envp = *(envp + rtld_argc); - } while (*envp++ != NULL); - aux = auxp = (Elf_Auxinfo *)envp; - auxpf = (Elf_Auxinfo *)(envp + rtld_argc); - dbg("move aux from %p to %p", auxpf, aux); - /* XXXKIB insert place for AT_EXECPATH if not present */ - for (;; auxp++, auxpf++) { - *auxp = *auxpf; - if (auxp->a_type == AT_NULL) - break; - } - /* Since the auxiliary vector has moved, redigest it. */ - for (i = 0; i < AT_COUNT; i++) - aux_info[i] = NULL; - for (auxp = aux; auxp->a_type != AT_NULL; auxp++) { - if (auxp->a_type < AT_COUNT) - aux_info[auxp->a_type] = auxp; + __progname = obj_rtld.path; + argv0 = argv[0] != NULL ? argv[0] : "(null)"; + environ = env; + main_argc = argc; + main_argv = argv; + + if (aux_info[AT_BSDFLAGS] != NULL && + (aux_info[AT_BSDFLAGS]->a_un.a_val & ELF_BSDF_SIGFASTBLK) != 0) + ld_fast_sigblock = true; + + trust = !issetugid(); + direct_exec = false; + + md_abi_variant_hook(aux_info); + rtld_init_env_vars(env); + + fd = -1; + if (aux_info[AT_EXECFD] != NULL) { + fd = aux_info[AT_EXECFD]->a_un.a_val; + } else { + assert(aux_info[AT_PHDR] != NULL); + phdr = (const Elf_Phdr *)aux_info[AT_PHDR]->a_un.a_ptr; + if (phdr == obj_rtld.phdr) { + if (!trust) { + _rtld_error( + "Tainted process refusing to run binary %s", + argv0); + rtld_die(); + } + direct_exec = true; + + dbg("opening main program in direct exec mode"); + if (argc >= 2) { + rtld_argc = parse_args(argv, argc, + &search_in_path, &fd, &argv0, &dir_ignore); + explicit_fd = (fd != -1); + binpath = NULL; + if (!explicit_fd) + fd = open_binary_fd(argv0, + search_in_path, &binpath); + if (fstat(fd, &st) == -1) { + _rtld_error( + "Failed to fstat FD %d (%s): %s", + fd, + explicit_fd ? + "user-provided descriptor" : + argv0, + rtld_strerror(errno)); + rtld_die(); + } + + /* + * Rough emulation of the permission checks done + * by execve(2), only Unix DACs are checked, + * ACLs are ignored. Preserve the semantic of + * disabling owner to execute if owner x bit is + * cleared, even if others x bit is enabled. + * mmap(2) does not allow to mmap with PROT_EXEC + * if binary' file comes from noexec mount. We + * cannot set a text reference on the binary. + */ + dir_enable = false; + if (st.st_uid == geteuid()) { + if ((st.st_mode & S_IXUSR) != 0) + dir_enable = true; + } else if (st.st_gid == getegid()) { + if ((st.st_mode & S_IXGRP) != 0) + dir_enable = true; + } else if ((st.st_mode & S_IXOTH) != 0) { + dir_enable = true; + } + if (!dir_enable && !dir_ignore) { + _rtld_error( + "No execute permission for binary %s", + argv0); + rtld_die(); + } + + /* + * For direct exec mode, argv[0] is the + * interpreter name, we must remove it and shift + * arguments left before invoking binary main. + * Since stack layout places environment + * pointers and aux vectors right after the + * terminating NULL, we must shift environment + * and aux as well. + */ + main_argc = argc - rtld_argc; + for (i = 0; i <= main_argc; i++) + argv[i] = argv[i + rtld_argc]; + *argcp -= rtld_argc; + environ = env = envp = argv + main_argc + 1; + dbg("move env from %p to %p", envp + rtld_argc, + envp); + do { + *envp = *(envp + rtld_argc); + } while (*envp++ != NULL); + aux = auxp = (Elf_Auxinfo *)envp; + auxpf = (Elf_Auxinfo *)(envp + rtld_argc); + dbg("move aux from %p to %p", auxpf, aux); + /* XXXKIB insert place for AT_EXECPATH if not + * present */ + for (;; auxp++, auxpf++) { + *auxp = *auxpf; + if (auxp->a_type == AT_NULL) + break; + } + /* Since the auxiliary vector has moved, + * redigest it. */ + for (i = 0; i < AT_COUNT; i++) + aux_info[i] = NULL; + for (auxp = aux; auxp->a_type != AT_NULL; + auxp++) { + if (auxp->a_type < AT_COUNT) + aux_info[auxp->a_type] = auxp; + } + + /* Point AT_EXECPATH auxv and aux_info to the + * binary path. */ + if (binpath == NULL) { + aux_info[AT_EXECPATH] = NULL; + } else { + if (aux_info[AT_EXECPATH] == NULL) { + aux_info[AT_EXECPATH] = xmalloc( + sizeof(Elf_Auxinfo)); + aux_info[AT_EXECPATH]->a_type = + AT_EXECPATH; + } + aux_info[AT_EXECPATH]->a_un.a_ptr = + __DECONST(void *, binpath); + } + } else { + _rtld_error("No binary"); + rtld_die(); + } } + } - /* Point AT_EXECPATH auxv and aux_info to the binary path. */ - if (binpath == NULL) { - aux_info[AT_EXECPATH] = NULL; - } else { - if (aux_info[AT_EXECPATH] == NULL) { - aux_info[AT_EXECPATH] = xmalloc(sizeof(Elf_Auxinfo)); - aux_info[AT_EXECPATH]->a_type = AT_EXECPATH; - } - aux_info[AT_EXECPATH]->a_un.a_ptr = __DECONST(void *, - binpath); + ld_bind_now = ld_get_env_var(LD_BIND_NOW); + + /* + * If the process is tainted, then we un-set the dangerous environment + * variables. The process will be marked as tainted until setuid(2) + * is called. If any child process calls setuid(2) we do not want any + * future processes to honor the potentially un-safe variables. + */ + if (!trust) { + for (i = 0; i < (int)nitems(ld_env_vars); i++) { + lvd = &ld_env_vars[i]; + if (lvd->unsecure) + lvd->val = NULL; } - } else { - _rtld_error("No binary"); - rtld_die(); - } - } - } - - ld_bind_now = ld_get_env_var(LD_BIND_NOW); - - /* - * If the process is tainted, then we un-set the dangerous environment - * variables. The process will be marked as tainted until setuid(2) - * is called. If any child process calls setuid(2) we do not want any - * future processes to honor the potentially un-safe variables. - */ - if (!trust) { - for (i = 0; i < (int)nitems(ld_env_vars); i++) { - lvd = &ld_env_vars[i]; - if (lvd->unsecure) - lvd->val = NULL; - } - } - - ld_debug = ld_get_env_var(LD_DEBUG); - if (ld_bind_now == NULL) - ld_bind_not = ld_get_env_var(LD_BIND_NOT) != NULL; - ld_dynamic_weak = ld_get_env_var(LD_DYNAMIC_WEAK) == NULL; - libmap_disable = ld_get_env_var(LD_LIBMAP_DISABLE) != NULL; - libmap_override = ld_get_env_var(LD_LIBMAP); - ld_library_path = ld_get_env_var(LD_LIBRARY_PATH); - ld_library_dirs = ld_get_env_var(LD_LIBRARY_PATH_FDS); - ld_preload = ld_get_env_var(LD_PRELOAD); - ld_preload_fds = ld_get_env_var(LD_PRELOAD_FDS); - ld_elf_hints_path = ld_get_env_var(LD_ELF_HINTS_PATH); - ld_loadfltr = ld_get_env_var(LD_LOADFLTR) != NULL; - library_path_rpath = ld_get_env_var(LD_LIBRARY_PATH_RPATH); - if (library_path_rpath != NULL) { - if (library_path_rpath[0] == 'y' || - library_path_rpath[0] == 'Y' || - library_path_rpath[0] == '1') - ld_library_path_rpath = true; - else - ld_library_path_rpath = false; - } - static_tls_extra = ld_get_env_var(LD_STATIC_TLS_EXTRA); - if (static_tls_extra != NULL && static_tls_extra[0] != '\0') { - sz = parse_integer(static_tls_extra); - if (sz >= RTLD_STATIC_TLS_EXTRA && sz <= SIZE_T_MAX) - ld_static_tls_extra = sz; - } - dangerous_ld_env = libmap_disable || libmap_override != NULL || - ld_library_path != NULL || ld_preload != NULL || - ld_elf_hints_path != NULL || ld_loadfltr || !ld_dynamic_weak || - static_tls_extra != NULL; - ld_tracing = ld_get_env_var(LD_TRACE_LOADED_OBJECTS); - ld_utrace = ld_get_env_var(LD_UTRACE); - - set_ld_elf_hints_path(); - if (ld_debug != NULL && *ld_debug != '\0') - debug = 1; - dbg("%s is initialized, base address = %p", __progname, - (caddr_t) aux_info[AT_BASE]->a_un.a_ptr); - dbg("RTLD dynamic = %p", obj_rtld.dynamic); - dbg("RTLD pltgot = %p", obj_rtld.pltgot); - - dbg("initializing thread locks"); - lockdflt_init(); - - /* - * Load the main program, or process its program header if it is - * already loaded. - */ - if (fd != -1) { /* Load the main program. */ - dbg("loading main program"); - obj_main = map_object(fd, argv0, NULL); - close(fd); - if (obj_main == NULL) - rtld_die(); - max_stack_flags = obj_main->stack_flags; - } else { /* Main program already loaded. */ - dbg("processing main program's program header"); - assert(aux_info[AT_PHDR] != NULL); - phdr = (const Elf_Phdr *) aux_info[AT_PHDR]->a_un.a_ptr; - assert(aux_info[AT_PHNUM] != NULL); - phnum = aux_info[AT_PHNUM]->a_un.a_val; - assert(aux_info[AT_PHENT] != NULL); - assert(aux_info[AT_PHENT]->a_un.a_val == sizeof(Elf_Phdr)); - assert(aux_info[AT_ENTRY] != NULL); - imgentry = (caddr_t) aux_info[AT_ENTRY]->a_un.a_ptr; - if ((obj_main = digest_phdr(phdr, phnum, imgentry, argv0)) == NULL) - rtld_die(); - } - - if (aux_info[AT_EXECPATH] != NULL && fd == -1) { - kexecpath = aux_info[AT_EXECPATH]->a_un.a_ptr; - dbg("AT_EXECPATH %p %s", kexecpath, kexecpath); - if (kexecpath[0] == '/') - obj_main->path = kexecpath; - else if (getcwd(buf, sizeof(buf)) == NULL || - strlcat(buf, "/", sizeof(buf)) >= sizeof(buf) || - strlcat(buf, kexecpath, sizeof(buf)) >= sizeof(buf)) - obj_main->path = xstrdup(argv0); - else - obj_main->path = xstrdup(buf); - } else { - dbg("No AT_EXECPATH or direct exec"); - obj_main->path = xstrdup(argv0); - } - dbg("obj_main path %s", obj_main->path); - obj_main->mainprog = true; - - if (aux_info[AT_STACKPROT] != NULL && - aux_info[AT_STACKPROT]->a_un.a_val != 0) - stack_prot = aux_info[AT_STACKPROT]->a_un.a_val; + } + + ld_debug = ld_get_env_var(LD_DEBUG); + if (ld_bind_now == NULL) + ld_bind_not = ld_get_env_var(LD_BIND_NOT) != NULL; + ld_dynamic_weak = ld_get_env_var(LD_DYNAMIC_WEAK) == NULL; + libmap_disable = ld_get_env_var(LD_LIBMAP_DISABLE) != NULL; + libmap_override = ld_get_env_var(LD_LIBMAP); + ld_library_path = ld_get_env_var(LD_LIBRARY_PATH); + ld_library_dirs = ld_get_env_var(LD_LIBRARY_PATH_FDS); + ld_preload = ld_get_env_var(LD_PRELOAD); + ld_preload_fds = ld_get_env_var(LD_PRELOAD_FDS); + ld_elf_hints_path = ld_get_env_var(LD_ELF_HINTS_PATH); + ld_loadfltr = ld_get_env_var(LD_LOADFLTR) != NULL; + library_path_rpath = ld_get_env_var(LD_LIBRARY_PATH_RPATH); + if (library_path_rpath != NULL) { + if (library_path_rpath[0] == 'y' || + library_path_rpath[0] == 'Y' || + library_path_rpath[0] == '1') + ld_library_path_rpath = true; + else + ld_library_path_rpath = false; + } + static_tls_extra = ld_get_env_var(LD_STATIC_TLS_EXTRA); + if (static_tls_extra != NULL && static_tls_extra[0] != '\0') { + sz = parse_integer(static_tls_extra); + if (sz >= RTLD_STATIC_TLS_EXTRA && sz <= SIZE_T_MAX) + ld_static_tls_extra = sz; + } + dangerous_ld_env = libmap_disable || libmap_override != NULL || + ld_library_path != NULL || ld_preload != NULL || + ld_elf_hints_path != NULL || ld_loadfltr || !ld_dynamic_weak || + static_tls_extra != NULL; + ld_tracing = ld_get_env_var(LD_TRACE_LOADED_OBJECTS); + ld_utrace = ld_get_env_var(LD_UTRACE); + + set_ld_elf_hints_path(); + if (ld_debug != NULL && *ld_debug != '\0') + debug = 1; + dbg("%s is initialized, base address = %p", __progname, + (caddr_t)aux_info[AT_BASE]->a_un.a_ptr); + dbg("RTLD dynamic = %p", obj_rtld.dynamic); + dbg("RTLD pltgot = %p", obj_rtld.pltgot); + + dbg("initializing thread locks"); + lockdflt_init(); + + /* + * Load the main program, or process its program header if it is + * already loaded. + */ + if (fd != -1) { /* Load the main program. */ + dbg("loading main program"); + obj_main = map_object(fd, argv0, NULL); + close(fd); + if (obj_main == NULL) + rtld_die(); + max_stack_flags = obj_main->stack_flags; + } else { /* Main program already loaded. */ + dbg("processing main program's program header"); + assert(aux_info[AT_PHDR] != NULL); + phdr = (const Elf_Phdr *)aux_info[AT_PHDR]->a_un.a_ptr; + assert(aux_info[AT_PHNUM] != NULL); + phnum = aux_info[AT_PHNUM]->a_un.a_val; + assert(aux_info[AT_PHENT] != NULL); + assert(aux_info[AT_PHENT]->a_un.a_val == sizeof(Elf_Phdr)); + assert(aux_info[AT_ENTRY] != NULL); + imgentry = (caddr_t)aux_info[AT_ENTRY]->a_un.a_ptr; + if ((obj_main = digest_phdr(phdr, phnum, imgentry, argv0)) == + NULL) + rtld_die(); + } + + if (aux_info[AT_EXECPATH] != NULL && fd == -1) { + kexecpath = aux_info[AT_EXECPATH]->a_un.a_ptr; + dbg("AT_EXECPATH %p %s", kexecpath, kexecpath); + if (kexecpath[0] == '/') + obj_main->path = kexecpath; + else if (getcwd(buf, sizeof(buf)) == NULL || + strlcat(buf, "/", sizeof(buf)) >= sizeof(buf) || + strlcat(buf, kexecpath, sizeof(buf)) >= sizeof(buf)) + obj_main->path = xstrdup(argv0); + else + obj_main->path = xstrdup(buf); + } else { + dbg("No AT_EXECPATH or direct exec"); + obj_main->path = xstrdup(argv0); + } + dbg("obj_main path %s", obj_main->path); + obj_main->mainprog = true; + + if (aux_info[AT_STACKPROT] != NULL && + aux_info[AT_STACKPROT]->a_un.a_val != 0) + stack_prot = aux_info[AT_STACKPROT]->a_un.a_val; #ifndef COMPAT_libcompat - /* - * Get the actual dynamic linker pathname from the executable if - * possible. (It should always be possible.) That ensures that - * gdb will find the right dynamic linker even if a non-standard - * one is being used. - */ - if (obj_main->interp != NULL && - strcmp(obj_main->interp, obj_rtld.path) != 0) { - free(obj_rtld.path); - obj_rtld.path = xstrdup(obj_main->interp); - __progname = obj_rtld.path; - } + /* + * Get the actual dynamic linker pathname from the executable if + * possible. (It should always be possible.) That ensures that + * gdb will find the right dynamic linker even if a non-standard + * one is being used. + */ + if (obj_main->interp != NULL && + strcmp(obj_main->interp, obj_rtld.path) != 0) { + free(obj_rtld.path); + obj_rtld.path = xstrdup(obj_main->interp); + __progname = obj_rtld.path; + } #endif - if (!digest_dynamic(obj_main, 0)) - rtld_die(); - dbg("%s valid_hash_sysv %d valid_hash_gnu %d dynsymcount %d", - obj_main->path, obj_main->valid_hash_sysv, obj_main->valid_hash_gnu, - obj_main->dynsymcount); - - linkmap_add(obj_main); - linkmap_add(&obj_rtld); - - /* Link the main program into the list of objects. */ - TAILQ_INSERT_HEAD(&obj_list, obj_main, next); - obj_count++; - obj_loads++; - - /* Initialize a fake symbol for resolving undefined weak references. */ - sym_zero.st_info = ELF_ST_INFO(STB_GLOBAL, STT_NOTYPE); - sym_zero.st_shndx = SHN_UNDEF; - sym_zero.st_value = -(uintptr_t)obj_main->relocbase; - - if (!libmap_disable) - libmap_disable = (bool)lm_init(libmap_override); - - if (aux_info[AT_KPRELOAD] != NULL && - aux_info[AT_KPRELOAD]->a_un.a_ptr != NULL) { - dbg("loading kernel vdso"); - if (load_kpreload(aux_info[AT_KPRELOAD]->a_un.a_ptr) == -1) - rtld_die(); - } - - dbg("loading LD_PRELOAD_FDS libraries"); - if (load_preload_objects(ld_preload_fds, true) == -1) - rtld_die(); + if (!digest_dynamic(obj_main, 0)) + rtld_die(); + dbg("%s valid_hash_sysv %d valid_hash_gnu %d dynsymcount %d", + obj_main->path, obj_main->valid_hash_sysv, obj_main->valid_hash_gnu, + obj_main->dynsymcount); - dbg("loading LD_PRELOAD libraries"); - if (load_preload_objects(ld_preload, false) == -1) - rtld_die(); - preload_tail = globallist_curr(TAILQ_LAST(&obj_list, obj_entry_q)); + linkmap_add(obj_main); + linkmap_add(&obj_rtld); - dbg("loading needed objects"); - if (load_needed_objects(obj_main, ld_tracing != NULL ? RTLD_LO_TRACE : - 0) == -1) - rtld_die(); + /* Link the main program into the list of objects. */ + TAILQ_INSERT_HEAD(&obj_list, obj_main, next); + obj_count++; + obj_loads++; - /* Make a list of all objects loaded at startup. */ - last_interposer = obj_main; - TAILQ_FOREACH(obj, &obj_list, next) { - if (obj->marker) - continue; - if (obj->z_interpose && obj != obj_main) { - objlist_put_after(&list_main, last_interposer, obj); - last_interposer = obj; - } else { - objlist_push_tail(&list_main, obj); + /* Initialize a fake symbol for resolving undefined weak references. */ + sym_zero.st_info = ELF_ST_INFO(STB_GLOBAL, STT_NOTYPE); + sym_zero.st_shndx = SHN_UNDEF; + sym_zero.st_value = -(uintptr_t)obj_main->relocbase; + + if (!libmap_disable) + libmap_disable = (bool)lm_init(libmap_override); + + if (aux_info[AT_KPRELOAD] != NULL && + aux_info[AT_KPRELOAD]->a_un.a_ptr != NULL) { + dbg("loading kernel vdso"); + if (load_kpreload(aux_info[AT_KPRELOAD]->a_un.a_ptr) == -1) + rtld_die(); } - obj->refcount++; - } - dbg("checking for required versions"); - if (rtld_verify_versions(&list_main) == -1 && !ld_tracing) - rtld_die(); + dbg("loading LD_PRELOAD_FDS libraries"); + if (load_preload_objects(ld_preload_fds, true) == -1) *** 6242 LINES SKIPPED *** From nobody Tue Jan 21 01:51:01 2025 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 4YcVY21kWpz5lJct; Tue, 21 Jan 2025 01:51: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 4YcVY15Bvsz3cCg; Tue, 21 Jan 2025 01:51:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737424261; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=t9YAh+cgaVbz+1gPYklrfF95WDL+fnKa54BVv/1yNZ4=; b=cpLUwKzwEBOYoYfA0RWY+z4CWKrJljhD8I4u82E6Ys8B42rxfkBNokZJIItNNF0scIlyY+ AkaQO4L9yxqoliLx4w2pLmibrxa+mHqbnA/oDxsRhdadciLiv8929k4A98zEjcIbHX52YC KiCaOPGwzcwLuJMksNZn9hgptS3YHXeJpPmcnF/MN8yBQqSoD4VOCUU69KI1n9m348HFLT ulbrwpGP4IsUqOtQ4uHTxr5oYkshA3ElhZRGA/ZkKEehzdRR9hcTOkG3XDWQndWSv40T/s PEDc9SDdkNZ/OLLEEGzwYWvB5aGVjRduHLIq8aFdf0HwX+MYmcNr8gC4LHKfqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737424261; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=t9YAh+cgaVbz+1gPYklrfF95WDL+fnKa54BVv/1yNZ4=; b=LPphGY+rmrzP95ReuNzEqr1CCIjl7htUQKciR89eHvxPjVEvq51HnbM660zTXI/tHwfakm L/w7QBBUTa9fs+d9Ahv2LvtNLByVRU74eO75N0nvGsa1KhaLS+gJ8IwdDqbCakdNu3AUtb ttUDOehknrKsEbj1lIl5FaSDCYYDWFQHoJDD00hf6OSgCSOkAgvuCu4LD4H+twydXNdRAB zIALEkE/3POFK2ONJogwi4bmFnq94h/EeVFxF7FAyf6esKLEYSw3pCwwK7bOOE05wjsH9A Is6SeH4teHZE9vnX3wNTP1EnGXZF3tn1b1QQrMmqUDa/UmvbX4OubT81lGcH2A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737424261; a=rsa-sha256; cv=none; b=BruwLn3DGga7OisZsElz1T3fQnJsHzOeU/aDRFdIksvOd6/3/nBiggkcMviOyFwDgR+6bT k+nngNYX+lHYGdjOfhOiwgwmTaAJzq6Y4Z9MMSS+/Aj0O6/YaWjWITr/l2Ccu9HofvlwHO B2yrLvGHNgj7cGAGgvns5oJ3QeS/HEbSj9pOwll8Dc9tewgzSMKcYKTsVKv+vxzx8sz+3i IzLZ/jqLPpS1iTsqUnz41R9cN85q5zmW0P9/DAFp6pMtt7aivhe5DZ78KZJCNe35MePD/I fcJ1UJukT3CskqE/Rn8VdzCcvgB2tWbYa0zajSBSpOw5Ke9CfXnYwcREoswhjw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcVY14Yrtzlt4; Tue, 21 Jan 2025 01:51: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 50L1p1S3074143; Tue, 21 Jan 2025 01:51:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50L1p17X074140; Tue, 21 Jan 2025 01:51:01 GMT (envelope-from git) Date: Tue, 21 Jan 2025 01:51:01 GMT Message-Id: <202501210151.50L1p17X074140@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: bf3fbf74d12c - main - rtld obj_remap_relro(): unindent the loop body 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: bf3fbf74d12cc6dff54ed17acf4a680cc0c9cdee Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bf3fbf74d12cc6dff54ed17acf4a680cc0c9cdee commit bf3fbf74d12cc6dff54ed17acf4a680cc0c9cdee Author: Konstantin Belousov AuthorDate: 2025-01-18 23:23:28 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-21 01:44:22 +0000 rtld obj_remap_relro(): unindent the loop body Discussed with: emaste, imp Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D48509 --- libexec/rtld-elf/rtld.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 8ec883227908..169ec0200ea5 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -5987,20 +5987,18 @@ obj_remap_relro(Obj_Entry *obj, int prot) for (ph = obj->phdr; (const char *)ph < (const char *)obj->phdr + obj->phsize; ph++) { - switch (ph->p_type) { - case PT_GNU_RELRO: - relro_page = obj->relocbase + - rtld_trunc_page(ph->p_vaddr); - relro_size = rtld_round_page(ph->p_vaddr + - ph->p_memsz) - rtld_trunc_page(ph->p_vaddr); - if (mprotect(relro_page, relro_size, prot) == -1) { - _rtld_error( + if (ph->p_type != PT_GNU_RELRO) + continue; + relro_page = obj->relocbase + rtld_trunc_page(ph->p_vaddr); + relro_size = rtld_round_page(ph->p_vaddr + ph->p_memsz) - + rtld_trunc_page(ph->p_vaddr); + if (mprotect(relro_page, relro_size, prot) == -1) { + _rtld_error( "%s: Cannot set relro protection to %#x: %s", - obj->path, prot, rtld_strerror(errno)); - return (-1); - } - break; + obj->path, prot, rtld_strerror(errno)); + return (-1); } + break; } return (0); } From nobody Tue Jan 21 01:51:02 2025 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 4YcVY31T4tz5lJJp; Tue, 21 Jan 2025 01:51: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 4YcVY25cBkz3cJN; Tue, 21 Jan 2025 01:51:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737424262; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AnYizZl9gpO+RQwZQHlR5eBhQ+bZ5lb5qDAbeD163uA=; b=X6x80LmdKdUBPtcRJiav6EN/QnTmYSVVn+3ZSTZ7QEWTZGfqt+9Re4JdK/eZr4WWLrJWN3 2azubQmPEZV1VcDG5Uz0VXLRj55xYrmdGEKxu7vTRsXYKa5ffUHe7mD6sicgxpo5msvDd3 pbgn96/6EJrVSunJSaGtZifaxtJ+gs+M4u1/oplQBWSoHPfQnylk+z5nufWqLG4v53zdSi ABvvq6FGIOfzm+thzB9CMHrPEu6OGI5Qbol3SQjukRmyh8s/Qb2Eo0D9eF0C89xqjKS7J6 7Tbg+4TvAUxNswaxrbbZNf8e9BIVv8e0epwYTwRhWEMvV3FQsRbwn9hqPrtVOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737424262; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AnYizZl9gpO+RQwZQHlR5eBhQ+bZ5lb5qDAbeD163uA=; b=UGMLMORIRqSAplklV+dEirROw2JVLNL0UYCMdfNYDfEbEX/DI0zbS7zgJxQvVw5Xgc8nCj 9yUsxjTCTNyKHr6v6vJJj0X4HUoGVdk2psiJulaSFcxqClreHTlgN4dzD6nyMnRYrR7oOq mmmjL+wj3/X+2I0Wz1oBbvo5FKdUHyztAeOyyZ4f9IF7wTOjxMEfkVFQ2n1lgfXAso731e PORTgXwdqemhIBWzLKMFqFCtts7kOC7vaGlR/mGhJkOMOA6h/XVWfkVcUxqATS/wGBI3Pl oPg44vtk3DswrCQGI/nABjIHBk33TQz5FMfGEwUgyvFK29tg1u249q4sbtkMvA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737424262; a=rsa-sha256; cv=none; b=YH3RIr5FqscQYmc5plQiAtG/2frmwLh6mFdED6nLlfQevHF6zl7kZvac2ws0emmju5tx0g lfw0ivQNVq2t23zsjqJ/xXrgJWgEmZpRXXBjRjMkAhc6lsYDhGT+H05MbxrWaWZWAyprOX u25E9xH+qGBQr9otqHSv+P6ghpHLEmJL6QaPmkOH9pYQsZwd2anLQBcRVdLiV1Y1uLyGTP LogWWAICGUHbqeC6EjN+rZGRYN20Lt8X4O00CksGQpPN5CzVA9O+eD3z577H4bBg1MxfvX YR50h6ip0XMghdbt9K9V3B4PDq81qlN6cgWmZu9jkglFSwcnw0TnN37Ayb0pBQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcVY25BxDzlt5; Tue, 21 Jan 2025 01:51: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 50L1p2G3074177; Tue, 21 Jan 2025 01:51:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50L1p2lw074174; Tue, 21 Jan 2025 01:51:02 GMT (envelope-from git) Date: Tue, 21 Jan 2025 01:51:02 GMT Message-Id: <202501210151.50L1p2lw074174@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: 986c96b54b9e - main - rtld-elf/map_object.c: apply clang-format 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: 986c96b54b9ec1118d285b723f53c7451a4c0772 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=986c96b54b9ec1118d285b723f53c7451a4c0772 commit 986c96b54b9ec1118d285b723f53c7451a4c0772 Author: Konstantin Belousov AuthorDate: 2025-01-18 02:45:45 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-21 01:44:35 +0000 rtld-elf/map_object.c: apply clang-format Discussed with: emaste, imp Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D48509 --- libexec/rtld-elf/map_object.c | 653 ++++++++++++++++++++++-------------------- 1 file changed, 339 insertions(+), 314 deletions(-) diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c index 7dbab26f2c63..148b6dc4ca6e 100644 --- a/libexec/rtld-elf/map_object.c +++ b/libexec/rtld-elf/map_object.c @@ -62,274 +62,296 @@ phdr_in_zero_page(const Elf_Ehdr *hdr) Obj_Entry * map_object(int fd, const char *path, const struct stat *sb) { - Obj_Entry *obj; - Elf_Ehdr *hdr; - int i; - Elf_Phdr *phdr; - Elf_Phdr *phlimit; - Elf_Phdr **segs; - int nsegs; - Elf_Phdr *phdyn; - Elf_Phdr *phinterp; - Elf_Phdr *phtls; - caddr_t mapbase; - size_t mapsize; - Elf_Addr base_vaddr; - Elf_Addr base_vlimit; - caddr_t base_addr; - int base_flags; - Elf_Off data_offset; - Elf_Addr data_vaddr; - Elf_Addr data_vlimit; - caddr_t data_addr; - int data_prot; - int data_flags; - Elf_Addr clear_vaddr; - caddr_t clear_addr; - caddr_t clear_page; - Elf_Addr phdr_vaddr; - size_t nclear, phsize; - Elf_Addr bss_vaddr; - Elf_Addr bss_vlimit; - caddr_t bss_addr; - Elf_Word stack_flags; - Elf_Addr note_start; - Elf_Addr note_end; - char *note_map; - size_t note_map_len; - Elf_Addr text_end; - - hdr = get_elf_header(fd, path, sb, &phdr); - if (hdr == NULL) - return (NULL); + Obj_Entry *obj; + Elf_Ehdr *hdr; + int i; + Elf_Phdr *phdr; + Elf_Phdr *phlimit; + Elf_Phdr **segs; + int nsegs; + Elf_Phdr *phdyn; + Elf_Phdr *phinterp; + Elf_Phdr *phtls; + caddr_t mapbase; + size_t mapsize; + Elf_Addr base_vaddr; + Elf_Addr base_vlimit; + caddr_t base_addr; + int base_flags; + Elf_Off data_offset; + Elf_Addr data_vaddr; + Elf_Addr data_vlimit; + caddr_t data_addr; + int data_prot; + int data_flags; + Elf_Addr clear_vaddr; + caddr_t clear_addr; + caddr_t clear_page; + Elf_Addr phdr_vaddr; + size_t nclear, phsize; + Elf_Addr bss_vaddr; + Elf_Addr bss_vlimit; + caddr_t bss_addr; + Elf_Word stack_flags; + Elf_Addr note_start; + Elf_Addr note_end; + char *note_map; + size_t note_map_len; + Elf_Addr text_end; + + hdr = get_elf_header(fd, path, sb, &phdr); + if (hdr == NULL) + return (NULL); - /* - * Scan the program header entries, and save key information. - * We expect that the loadable segments are ordered by load address. - */ - phsize = hdr->e_phnum * sizeof(phdr[0]); - phlimit = phdr + hdr->e_phnum; - nsegs = -1; - phdyn = phinterp = phtls = NULL; - phdr_vaddr = 0; - note_start = 0; - note_end = 0; - note_map = NULL; - note_map_len = 0; - segs = alloca(sizeof(segs[0]) * hdr->e_phnum); - stack_flags = PF_X | PF_R | PF_W; - text_end = 0; - while (phdr < phlimit) { - switch (phdr->p_type) { - - case PT_INTERP: - phinterp = phdr; - break; - - case PT_LOAD: - segs[++nsegs] = phdr; - if ((segs[nsegs]->p_align & (page_size - 1)) != 0) { - _rtld_error("%s: PT_LOAD segment %d not page-aligned", - path, nsegs); - goto error; - } - if ((segs[nsegs]->p_flags & PF_X) == PF_X) { - text_end = MAX(text_end, - rtld_round_page(segs[nsegs]->p_vaddr + - segs[nsegs]->p_memsz)); - } - break; - - case PT_PHDR: - phdr_vaddr = phdr->p_vaddr; - phsize = phdr->p_memsz; - break; - - case PT_DYNAMIC: - phdyn = phdr; - break; - - case PT_TLS: - phtls = phdr; - break; - - case PT_GNU_STACK: - stack_flags = phdr->p_flags; - break; - - case PT_NOTE: - if (phdr->p_offset > page_size || - phdr->p_offset + phdr->p_filesz > page_size) { - note_map_len = rtld_round_page(phdr->p_offset + - phdr->p_filesz) - rtld_trunc_page(phdr->p_offset); - note_map = mmap(NULL, note_map_len, PROT_READ, - MAP_PRIVATE, fd, rtld_trunc_page(phdr->p_offset)); - if (note_map == MAP_FAILED) { - _rtld_error("%s: error mapping PT_NOTE (%d)", path, errno); - goto error; + /* + * Scan the program header entries, and save key information. + * We expect that the loadable segments are ordered by load address. + */ + phsize = hdr->e_phnum * sizeof(phdr[0]); + phlimit = phdr + hdr->e_phnum; + nsegs = -1; + phdyn = phinterp = phtls = NULL; + phdr_vaddr = 0; + note_start = 0; + note_end = 0; + note_map = NULL; + note_map_len = 0; + segs = alloca(sizeof(segs[0]) * hdr->e_phnum); + stack_flags = PF_X | PF_R | PF_W; + text_end = 0; + while (phdr < phlimit) { + switch (phdr->p_type) { + case PT_INTERP: + phinterp = phdr; + break; + + case PT_LOAD: + segs[++nsegs] = phdr; + if ((segs[nsegs]->p_align & (page_size - 1)) != 0) { + _rtld_error( + "%s: PT_LOAD segment %d not page-aligned", + path, nsegs); + goto error; + } + if ((segs[nsegs]->p_flags & PF_X) == PF_X) { + text_end = MAX(text_end, + rtld_round_page(segs[nsegs]->p_vaddr + + segs[nsegs]->p_memsz)); + } + break; + + case PT_PHDR: + phdr_vaddr = phdr->p_vaddr; + phsize = phdr->p_memsz; + break; + + case PT_DYNAMIC: + phdyn = phdr; + break; + + case PT_TLS: + phtls = phdr; + break; + + case PT_GNU_STACK: + stack_flags = phdr->p_flags; + break; + + case PT_NOTE: + if (phdr->p_offset > page_size || + phdr->p_offset + phdr->p_filesz > page_size) { + note_map_len = rtld_round_page(phdr->p_offset + + phdr->p_filesz) - + rtld_trunc_page(phdr->p_offset); + note_map = mmap(NULL, note_map_len, PROT_READ, + MAP_PRIVATE, fd, + rtld_trunc_page(phdr->p_offset)); + if (note_map == MAP_FAILED) { + _rtld_error( + "%s: error mapping PT_NOTE (%d)", + path, errno); + goto error; + } + note_start = (Elf_Addr)(note_map + + phdr->p_offset - + rtld_trunc_page(phdr->p_offset)); + } else { + note_start = (Elf_Addr)(char *)hdr + + phdr->p_offset; + } + note_end = note_start + phdr->p_filesz; + break; } - note_start = (Elf_Addr)(note_map + phdr->p_offset - - rtld_trunc_page(phdr->p_offset)); - } else { - note_start = (Elf_Addr)(char *)hdr + phdr->p_offset; - } - note_end = note_start + phdr->p_filesz; - break; - } - ++phdr; - } - if (phdyn == NULL) { - _rtld_error("%s: object is not dynamically-linked", path); - goto error; - } - - if (nsegs < 0) { - _rtld_error("%s: too few PT_LOAD segments", path); - goto error; - } - - /* - * Map the entire address space of the object, to stake out our - * contiguous region, and to establish the base address for relocation. - */ - base_vaddr = rtld_trunc_page(segs[0]->p_vaddr); - base_vlimit = rtld_round_page(segs[nsegs]->p_vaddr + segs[nsegs]->p_memsz); - mapsize = base_vlimit - base_vaddr; - base_addr = (caddr_t) base_vaddr; - base_flags = __getosreldate() >= P_OSREL_MAP_GUARD ? MAP_GUARD : - MAP_PRIVATE | MAP_ANON | MAP_NOCORE; - if (npagesizes > 1 && rtld_round_page(segs[0]->p_filesz) >= pagesizes[1]) - base_flags |= MAP_ALIGNED_SUPER; - if (base_vaddr != 0) - base_flags |= MAP_FIXED | MAP_EXCL; - - mapbase = mmap(base_addr, mapsize, PROT_NONE, base_flags, -1, 0); - if (mapbase == MAP_FAILED) { - _rtld_error("%s: mmap of entire address space failed: %s", - path, rtld_strerror(errno)); - goto error; - } - if (base_addr != NULL && mapbase != base_addr) { - _rtld_error("%s: mmap returned wrong address: wanted %p, got %p", - path, base_addr, mapbase); - goto error1; - } - - for (i = 0; i <= nsegs; i++) { - /* Overlay the segment onto the proper region. */ - data_offset = rtld_trunc_page(segs[i]->p_offset); - data_vaddr = rtld_trunc_page(segs[i]->p_vaddr); - data_vlimit = rtld_round_page(segs[i]->p_vaddr + segs[i]->p_filesz); - data_addr = mapbase + (data_vaddr - base_vaddr); - data_prot = convert_prot(segs[i]->p_flags); - data_flags = convert_flags(segs[i]->p_flags) | MAP_FIXED; - if (data_vlimit != data_vaddr && - mmap(data_addr, data_vlimit - data_vaddr, data_prot, - data_flags | MAP_PREFAULT_READ, fd, data_offset) == MAP_FAILED) { - _rtld_error("%s: mmap of data failed: %s", path, - rtld_strerror(errno)); - goto error1; + ++phdr; + } + if (phdyn == NULL) { + _rtld_error("%s: object is not dynamically-linked", path); + goto error; } - /* Do BSS setup */ - if (segs[i]->p_filesz != segs[i]->p_memsz) { + if (nsegs < 0) { + _rtld_error("%s: too few PT_LOAD segments", path); + goto error; + } - /* Clear any BSS in the last page of the segment. */ - clear_vaddr = segs[i]->p_vaddr + segs[i]->p_filesz; - clear_addr = mapbase + (clear_vaddr - base_vaddr); - clear_page = mapbase + (rtld_trunc_page(clear_vaddr) - base_vaddr); + /* + * Map the entire address space of the object, to stake out our + * contiguous region, and to establish the base address for relocation. + */ + base_vaddr = rtld_trunc_page(segs[0]->p_vaddr); + base_vlimit = rtld_round_page(segs[nsegs]->p_vaddr + + segs[nsegs]->p_memsz); + mapsize = base_vlimit - base_vaddr; + base_addr = (caddr_t)base_vaddr; + base_flags = __getosreldate() >= P_OSREL_MAP_GUARD ? + MAP_GUARD : MAP_PRIVATE | MAP_ANON | MAP_NOCORE; + if (npagesizes > 1 && rtld_round_page(segs[0]->p_filesz) >= + pagesizes[1]) + base_flags |= MAP_ALIGNED_SUPER; + if (base_vaddr != 0) + base_flags |= MAP_FIXED | MAP_EXCL; + + mapbase = mmap(base_addr, mapsize, PROT_NONE, base_flags, -1, 0); + if (mapbase == MAP_FAILED) { + _rtld_error("%s: mmap of entire address space failed: %s", + path, rtld_strerror(errno)); + goto error; + } + if (base_addr != NULL && mapbase != base_addr) { + _rtld_error( + "%s: mmap returned wrong address: wanted %p, got %p", + path, base_addr, mapbase); + goto error1; + } - if ((nclear = data_vlimit - clear_vaddr) > 0) { - /* Make sure the end of the segment is writable */ - if ((data_prot & PROT_WRITE) == 0 && -1 == - mprotect(clear_page, page_size, data_prot|PROT_WRITE)) { - _rtld_error("%s: mprotect failed: %s", path, - rtld_strerror(errno)); + for (i = 0; i <= nsegs; i++) { + /* Overlay the segment onto the proper region. */ + data_offset = rtld_trunc_page(segs[i]->p_offset); + data_vaddr = rtld_trunc_page(segs[i]->p_vaddr); + data_vlimit = rtld_round_page(segs[i]->p_vaddr + + segs[i]->p_filesz); + data_addr = mapbase + (data_vaddr - base_vaddr); + data_prot = convert_prot(segs[i]->p_flags); + data_flags = convert_flags(segs[i]->p_flags) | MAP_FIXED; + if (data_vlimit != data_vaddr && mmap(data_addr, + data_vlimit - data_vaddr, data_prot, data_flags | + MAP_PREFAULT_READ, fd, data_offset) == MAP_FAILED) { + _rtld_error("%s: mmap of data failed: %s", + path, rtld_strerror(errno)); goto error1; } - memset(clear_addr, 0, nclear); - - /* Reset the data protection back */ - if ((data_prot & PROT_WRITE) == 0) - mprotect(clear_page, page_size, data_prot); - } - - /* Overlay the BSS segment onto the proper region. */ - bss_vaddr = data_vlimit; - bss_vlimit = rtld_round_page(segs[i]->p_vaddr + segs[i]->p_memsz); - bss_addr = mapbase + (bss_vaddr - base_vaddr); - if (bss_vlimit > bss_vaddr) { /* There is something to do */ - if (mmap(bss_addr, bss_vlimit - bss_vaddr, data_prot, - data_flags | MAP_ANON, -1, 0) == MAP_FAILED) { - _rtld_error("%s: mmap of bss failed: %s", path, - rtld_strerror(errno)); - goto error1; + /* Do BSS setup */ + if (segs[i]->p_filesz != segs[i]->p_memsz) { + /* Clear any BSS in the last page of the segment. */ + clear_vaddr = segs[i]->p_vaddr + segs[i]->p_filesz; + clear_addr = mapbase + (clear_vaddr - base_vaddr); + clear_page = mapbase + (rtld_trunc_page(clear_vaddr) - + base_vaddr); + + if ((nclear = data_vlimit - clear_vaddr) > 0) { + /* + * Make sure the end of the segment is + * writable. + */ + if ((data_prot & PROT_WRITE) == 0 && + mprotect(clear_page, page_size, + data_prot | PROT_WRITE) == -1) { + _rtld_error("%s: mprotect failed: %s", + path, rtld_strerror(errno)); + goto error1; + } + + memset(clear_addr, 0, nclear); + + /* Reset the data protection back */ + if ((data_prot & PROT_WRITE) == 0) + mprotect(clear_page, page_size, + data_prot); + } + + /* Overlay the BSS segment onto the proper region. */ + bss_vaddr = data_vlimit; + bss_vlimit = rtld_round_page(segs[i]->p_vaddr + + segs[i]->p_memsz); + bss_addr = mapbase + (bss_vaddr - base_vaddr); + if (bss_vlimit > bss_vaddr) { + /* There is something to do */ + if (mmap(bss_addr, bss_vlimit - bss_vaddr, + data_prot, data_flags | MAP_ANON, -1, + 0) == MAP_FAILED) { + _rtld_error( + "%s: mmap of bss failed: %s", + path, rtld_strerror(errno)); + goto error1; + } + } + } + + if (phdr_vaddr == 0 && data_offset <= hdr->e_phoff && + data_vlimit - data_vaddr + data_offset >= + hdr->e_phoff + hdr->e_phnum * sizeof(Elf_Phdr)) { + phdr_vaddr = data_vaddr + hdr->e_phoff - data_offset; } - } } - if (phdr_vaddr == 0 && data_offset <= hdr->e_phoff && - (data_vlimit - data_vaddr + data_offset) >= - (hdr->e_phoff + hdr->e_phnum * sizeof (Elf_Phdr))) { - phdr_vaddr = data_vaddr + hdr->e_phoff - data_offset; + obj = obj_new(); + if (sb != NULL) { + obj->dev = sb->st_dev; + obj->ino = sb->st_ino; + } + obj->mapbase = mapbase; + obj->mapsize = mapsize; + obj->vaddrbase = base_vaddr; + obj->relocbase = mapbase - base_vaddr; + obj->dynamic = (const Elf_Dyn *)(obj->relocbase + phdyn->p_vaddr); + if (hdr->e_entry != 0) + obj->entry = (caddr_t)(obj->relocbase + hdr->e_entry); + if (phdr_vaddr != 0) { + obj->phdr = (const Elf_Phdr *)(obj->relocbase + phdr_vaddr); + } else { + obj->phdr = malloc(phsize); + if (obj->phdr == NULL) { + obj_free(obj); + _rtld_error("%s: cannot allocate program header", + path); + goto error1; + } + memcpy(__DECONST(char *, obj->phdr), (char *)hdr + hdr->e_phoff, + phsize); + obj->phdr_alloc = true; } - } - - obj = obj_new(); - if (sb != NULL) { - obj->dev = sb->st_dev; - obj->ino = sb->st_ino; - } - obj->mapbase = mapbase; - obj->mapsize = mapsize; - obj->vaddrbase = base_vaddr; - obj->relocbase = mapbase - base_vaddr; - obj->dynamic = (const Elf_Dyn *)(obj->relocbase + phdyn->p_vaddr); - if (hdr->e_entry != 0) - obj->entry = (caddr_t)(obj->relocbase + hdr->e_entry); - if (phdr_vaddr != 0) { - obj->phdr = (const Elf_Phdr *)(obj->relocbase + phdr_vaddr); - } else { - obj->phdr = malloc(phsize); - if (obj->phdr == NULL) { - obj_free(obj); - _rtld_error("%s: cannot allocate program header", path); - goto error1; + obj->phsize = phsize; + if (phinterp != NULL) + obj->interp = (const char *)(obj->relocbase + + phinterp->p_vaddr); + if (phtls != NULL) { + tls_dtv_generation++; + obj->tlsindex = ++tls_max_index; + obj->tlssize = phtls->p_memsz; + obj->tlsalign = phtls->p_align; + obj->tlspoffset = phtls->p_offset; + obj->tlsinitsize = phtls->p_filesz; + obj->tlsinit = mapbase + phtls->p_vaddr; } - memcpy(__DECONST(char *, obj->phdr), (char *)hdr + hdr->e_phoff, phsize); - obj->phdr_alloc = true; - } - obj->phsize = phsize; - if (phinterp != NULL) - obj->interp = (const char *)(obj->relocbase + phinterp->p_vaddr); - if (phtls != NULL) { - tls_dtv_generation++; - obj->tlsindex = ++tls_max_index; - obj->tlssize = phtls->p_memsz; - obj->tlsalign = phtls->p_align; - obj->tlspoffset = phtls->p_offset; - obj->tlsinitsize = phtls->p_filesz; - obj->tlsinit = mapbase + phtls->p_vaddr; - } - obj->stack_flags = stack_flags; - if (note_start < note_end) - digest_notes(obj, note_start, note_end); - if (note_map != NULL) - munmap(note_map, note_map_len); - munmap(hdr, page_size); - return (obj); + obj->stack_flags = stack_flags; + if (note_start < note_end) + digest_notes(obj, note_start, note_end); + if (note_map != NULL) + munmap(note_map, note_map_len); + munmap(hdr, page_size); + return (obj); error1: - munmap(mapbase, mapsize); + munmap(mapbase, mapsize); error: - if (note_map != NULL && note_map != MAP_FAILED) - munmap(note_map, note_map_len); - if (!phdr_in_zero_page(hdr)) - munmap(phdr, hdr->e_phnum * sizeof(phdr[0])); - munmap(hdr, page_size); - return (NULL); + if (note_map != NULL && note_map != MAP_FAILED) + munmap(note_map, note_map_len); + if (!phdr_in_zero_page(hdr)) + munmap(phdr, hdr->e_phnum * sizeof(phdr[0])); + munmap(hdr, page_size); + return (NULL); } bool @@ -359,7 +381,8 @@ check_elf_headers(const Elf_Ehdr *hdr, const char *path) } if (hdr->e_phentsize != sizeof(Elf_Phdr)) { _rtld_error( - "%s: invalid shared object: e_phentsize != sizeof(Elf_Phdr)", path); + "%s: invalid shared object: e_phentsize != sizeof(Elf_Phdr)", + path); return (false); } return (true); @@ -397,9 +420,8 @@ get_elf_header(int fd, const char *path, const struct stat *sbp, if (phdr_in_zero_page(hdr)) { phdr = (Elf_Phdr *)((char *)hdr + hdr->e_phoff); } else { - phdr = mmap(NULL, hdr->e_phnum * sizeof(phdr[0]), - PROT_READ, MAP_PRIVATE | MAP_PREFAULT_READ, fd, - hdr->e_phoff); + phdr = mmap(NULL, hdr->e_phnum * sizeof(phdr[0]), PROT_READ, + MAP_PRIVATE | MAP_PREFAULT_READ, fd, hdr->e_phoff); if (phdr == MAP_FAILED) { _rtld_error("%s: error mapping phdr: %s", path, rtld_strerror(errno)); @@ -417,55 +439,57 @@ error: void obj_free(Obj_Entry *obj) { - Objlist_Entry *elm; - - if (obj->tls_static) - free_tls_offset(obj); - while (obj->needed != NULL) { - Needed_Entry *needed = obj->needed; - obj->needed = needed->next; - free(needed); - } - while (!STAILQ_EMPTY(&obj->names)) { - Name_Entry *entry = STAILQ_FIRST(&obj->names); - STAILQ_REMOVE_HEAD(&obj->names, link); - free(entry); - } - while (!STAILQ_EMPTY(&obj->dldags)) { - elm = STAILQ_FIRST(&obj->dldags); - STAILQ_REMOVE_HEAD(&obj->dldags, link); - free(elm); - } - while (!STAILQ_EMPTY(&obj->dagmembers)) { - elm = STAILQ_FIRST(&obj->dagmembers); - STAILQ_REMOVE_HEAD(&obj->dagmembers, link); - free(elm); - } - if (obj->vertab) - free(obj->vertab); - if (obj->origin_path) - free(obj->origin_path); - if (obj->z_origin) - free(__DECONST(void*, obj->rpath)); - if (obj->priv) - free(obj->priv); - if (obj->path) - free(obj->path); - if (obj->phdr_alloc) - free(__DECONST(void *, obj->phdr)); - free(obj); + Objlist_Entry *elm; + + if (obj->tls_static) + free_tls_offset(obj); + while (obj->needed != NULL) { + Needed_Entry *needed = obj->needed; + + obj->needed = needed->next; + free(needed); + } + while (!STAILQ_EMPTY(&obj->names)) { + Name_Entry *entry = STAILQ_FIRST(&obj->names); + + STAILQ_REMOVE_HEAD(&obj->names, link); + free(entry); + } + while (!STAILQ_EMPTY(&obj->dldags)) { + elm = STAILQ_FIRST(&obj->dldags); + STAILQ_REMOVE_HEAD(&obj->dldags, link); + free(elm); + } + while (!STAILQ_EMPTY(&obj->dagmembers)) { + elm = STAILQ_FIRST(&obj->dagmembers); + STAILQ_REMOVE_HEAD(&obj->dagmembers, link); + free(elm); + } + if (obj->vertab) + free(obj->vertab); + if (obj->origin_path) + free(obj->origin_path); + if (obj->z_origin) + free(__DECONST(void *, obj->rpath)); + if (obj->priv) + free(obj->priv); + if (obj->path) + free(obj->path); + if (obj->phdr_alloc) + free(__DECONST(void *, obj->phdr)); + free(obj); } Obj_Entry * obj_new(void) { - Obj_Entry *obj; + Obj_Entry *obj; - obj = CNEW(Obj_Entry); - STAILQ_INIT(&obj->dldags); - STAILQ_INIT(&obj->dagmembers); - STAILQ_INIT(&obj->names); - return obj; + obj = CNEW(Obj_Entry); + STAILQ_INIT(&obj->dldags); + STAILQ_INIT(&obj->dagmembers); + STAILQ_INIT(&obj->names); + return (obj); } /* @@ -475,26 +499,27 @@ obj_new(void) int convert_prot(int elfflags) { - int prot = 0; - if (elfflags & PF_R) - prot |= PROT_READ; - if (elfflags & PF_W) - prot |= PROT_WRITE; - if (elfflags & PF_X) - prot |= PROT_EXEC; - return prot; + int prot = 0; + + if ((elfflags & PF_R) != 0) + prot |= PROT_READ; + if ((elfflags & PF_W) != 0) + prot |= PROT_WRITE; + if ((elfflags & PF_X) != 0) + prot |= PROT_EXEC; + return (prot); } static int convert_flags(int elfflags) { - int flags = MAP_PRIVATE; /* All mappings are private */ - - /* - * Readonly mappings are marked "MAP_NOCORE", because they can be - * reconstructed by a debugger. - */ - if (!(elfflags & PF_W)) - flags |= MAP_NOCORE; - return flags; + int flags = MAP_PRIVATE; /* All mappings are private */ + + /* + * Readonly mappings are marked "MAP_NOCORE", because they can be + * reconstructed by a debugger. + */ + if ((elfflags & PF_W) == 0) + flags |= MAP_NOCORE; + return (flags); } From nobody Tue Jan 21 01:51:03 2025 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 4YcVY44pFtz5lJLt; Tue, 21 Jan 2025 01:51: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 4YcVY36HMcz3cMs; Tue, 21 Jan 2025 01:51:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737424263; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZXK0FeAi7KfWenxfzqBhEYgwS3FoTNYVBi/CuPN2gHE=; b=T4yxuLMOa++SG9ZldY69etVUt7G6JI3tjHIFJ+VrTkSC9hTLofg6LrquHvQu7Opo4npEEK pv7qrYoxMeiIJUswhMGfBP0i7TQE4+7+W1DC3VkhHt8+VYBuCslZe6YV01/1SUlMrOX6+J Sb7iRX0NTXPIL8AIqKdm21JieuTRGhBTp0boB44ivHYJEUQuZPAdzk9SnIv7ohuEmXKt9O Itq2Q9tUqQhHWUqyEnsR4+siclq4Z8iloKujg5w8xptum6/zpT4Ex8EIGa0Px0uMdi/yTV /AcZVuLN8Y3j41jZTuLMeVkrUNJhrmyIiNDkXz5GV6KpcTzHzDwPgW2kdvt6nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737424263; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZXK0FeAi7KfWenxfzqBhEYgwS3FoTNYVBi/CuPN2gHE=; b=ebRwHFd/qiNGIgjQf7DCAuElnqDWA1vDhPo1HGvsSYtkE+PId8hR8BmrzIowmBnJvpgsPF dIczRYKp8lbo5n28HiBiQ+WS2ZorCs3TI5KC9AFHYDO0sOciHUwawAIO8XumQPSMi7rtc8 h3Vlow/ziUFjHTVrXEtQZ+9MiVncIVoqIY+Hn1m11nUicaqC8d8ufDkvsauovD1tSsvZUQ Ce3UNInEhPes2W07KQWYqjpmG7H9GJYVfMGUuxDYADjtacg0prnxl5t6/h77JRhVScmtKy vn2gTIaf9XkGxhMlcs0y/EOWJN4mFv4l1WB+vz29xABIsYRb/ETKMf9xb69gDQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737424263; a=rsa-sha256; cv=none; b=mhOg3eDHHCCH4bnAYO7s3oGUAB/lPGxBExL16iiob4brnns+Y8nwzgJhREEfZq5FD2QyzE rk0VyC79Ok4LriP9VnsG+lz8E69TdB+UtIMt4DblArnNa7SniQEfZBcs2im+InL8Yab68S HV0KitEFE87Oogf+wAAXMe/3YXWl8p+Jok4c0VhzjuApqQ9yVq13pY8UbyFMwZcp8ifVD7 d5GtRuGhPapYu7adP9lGgphnhJBvtncjGBjtJUvXeQ7Fxv5VrIK77aRayl6JWZHGpGg7Rk FWrjYCB8+L57WBO+XP8FdpkK8rRK+Iyit11Z3Q+H0P2M0++Vm1Kf0Xx3IfC3DQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcVY35sdyzmDB; Tue, 21 Jan 2025 01:51: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 50L1p33h074211; Tue, 21 Jan 2025 01:51:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50L1p3rS074208; Tue, 21 Jan 2025 01:51:03 GMT (envelope-from git) Date: Tue, 21 Jan 2025 01:51:03 GMT Message-Id: <202501210151.50L1p3rS074208@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: e3035c52f253 - main - rtld-elf/{amd64,i386}/reloc.c: remove unneeded #ifdef dbg 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: e3035c52f25356299abc8e08be9221032967554d Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e3035c52f25356299abc8e08be9221032967554d commit e3035c52f25356299abc8e08be9221032967554d Author: Konstantin Belousov AuthorDate: 2025-01-18 03:07:15 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-21 01:44:42 +0000 rtld-elf/{amd64,i386}/reloc.c: remove unneeded #ifdef dbg Discussed with: emaste, imp Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D48509 --- libexec/rtld-elf/amd64/reloc.c | 2 -- libexec/rtld-elf/i386/reloc.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/libexec/rtld-elf/amd64/reloc.c b/libexec/rtld-elf/amd64/reloc.c index 2e24d6287ea3..8183a306f7d2 100644 --- a/libexec/rtld-elf/amd64/reloc.c +++ b/libexec/rtld-elf/amd64/reloc.c @@ -405,9 +405,7 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const struct Struct_Obj_Entry *refobj __unused, const Elf_Rel *rel __unused) { -#ifdef dbg dbg("reloc_jmpslot: *%p = %p", where, (void *)target); -#endif if (!ld_bind_not) *where = target; return (target); diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c index c91239eb3989..24c754865504 100644 --- a/libexec/rtld-elf/i386/reloc.c +++ b/libexec/rtld-elf/i386/reloc.c @@ -358,9 +358,7 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *obj __unused, const Obj_Entry *refobj __unused, const Elf_Rel *rel __unused) { -#ifdef dbg dbg("reloc_jmpslot: *%p = %p", where, (void *)target); -#endif if (!ld_bind_not) *where = target; return (target); From nobody Tue Jan 21 01:51:04 2025 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 4YcVY549D4z5lJZd; Tue, 21 Jan 2025 01:51: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 4YcVY46x8hz3cZ2; Tue, 21 Jan 2025 01:51:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737424264; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KomR65yIQuKXtsid3RqeaoS3a4mu/EGwRt0vbY3mnrM=; b=PE0agOTlTb9PuhPuYzAtTOIbMELBuWF+CoW/mC4Fg7ac0oeRhK9IG5/mL9KtvOADuasSIO b7+yoIgm1BiZRu+kl8nKrqDxwtESxDLFiwetMAYL3RsiUEYbyBLBIWMgAmQJ+7vSVu0fMs s4KpjYbsK7Xo4xX4g6eHDP6/6ky+Gnj/5r/tXA7uAY9IC32PwCs0e68Z2swkfUAEZNkfbZ 4nMdXRI7RpgVjPjbm3yh+C2qf9tNv4X6vZ2cC5zG8ZN9xgr8w4Su8885X/07xTlcCWsw0V GhXSbZxoMFniYlKL9I4u2b5SMRegzJblKmM3L1WFydNhdUpE/0LqJIJ7XzQ/YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737424264; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KomR65yIQuKXtsid3RqeaoS3a4mu/EGwRt0vbY3mnrM=; b=rqkYP/zSaIXlYXgzgzUE/hDK3dX/JDWFCXpmufhJs4gQ6tzZiOhoCJuQaAntvVQB70/miU lQ4P16cIbFegzgwQx8VfcuABMHuLZTt2X+laWGo+lE6IG96lNxg1wf7JLdlQAb3MVweTiK XY4SdHq1zjQEGK69s4vKecRko/SKKGlO2lzvARPdvwqvLEsKYSL6JobWALJDpe6+qimrNX KfeFUJtRWVPYn6fKbCntEZK36a6hHnnwMoQVqYzdVTdkwWjU3aMc20hcgwItOtrIERBAMF mGqYjxMICfxE9KjzV3qJRGAV4kjh6aSIbJbeTdBS4G851qRsQBW4iTYVXgshUA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737424264; a=rsa-sha256; cv=none; b=g+RpRaCHrYAua/UHu8YoyKI9YNuZj+9YZRlZFDCPHVkWeUT99UklIa1mXXxnE/R0bl7gJW jIh5HJMszpNfHdZ+d3Q6ZDw90m/DoqQrG7g4DiJHI0lXx0wce7DjNbmRWgXXWORgLv7avq K+x0LnWlTX3lvVHtC2nimclXO6fxeSQPF37ymR1Koq7o2B4bjKrsbtE0FJvlhUeo1xjx9R M9384LRQ/pw5HRcNwhF+5CUe67XlO0RpyzxNksGzF1/PWydSKsXpqDnlOSkQYmLf3EUEx4 /dFOSv6CUfsibEM3gZc9cMSIxUwFbf7SvsF4xOuIznModWoWGDx3drMY16cBaA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcVY46QglzmDC; Tue, 21 Jan 2025 01:51: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 50L1p4lI075122; Tue, 21 Jan 2025 01:51:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50L1p4L5075109; Tue, 21 Jan 2025 01:51:04 GMT (envelope-from git) Date: Tue, 21 Jan 2025 01:51:04 GMT Message-Id: <202501210151.50L1p4L5075109@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: 3a85aa6a1d89 - main - rtld-elf/amd64/reloc.c: apply clang-format 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: 3a85aa6a1d8916082155867ce0545a07185e8924 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3a85aa6a1d8916082155867ce0545a07185e8924 commit 3a85aa6a1d8916082155867ce0545a07185e8924 Author: Konstantin Belousov AuthorDate: 2025-01-18 02:53:16 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-21 01:44:49 +0000 rtld-elf/amd64/reloc.c: apply clang-format Discussed with: emaste, imp Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D48509 --- libexec/rtld-elf/amd64/reloc.c | 347 +++++++++++++++++++++-------------------- 1 file changed, 180 insertions(+), 167 deletions(-) diff --git a/libexec/rtld-elf/amd64/reloc.c b/libexec/rtld-elf/amd64/reloc.c index 8183a306f7d2..b5750ac746b2 100644 --- a/libexec/rtld-elf/amd64/reloc.c +++ b/libexec/rtld-elf/amd64/reloc.c @@ -34,6 +34,7 @@ #define _WANT_P_OSREL #include #include + #include #include #include @@ -62,64 +63,68 @@ int do_copy_relocations(Obj_Entry *dstobj) { - const Elf_Rela *relalim; - const Elf_Rela *rela; - - assert(dstobj->mainprog); /* COPY relocations are invalid elsewhere */ - - relalim = (const Elf_Rela *)((const char *) dstobj->rela + dstobj->relasize); - for (rela = dstobj->rela; rela < relalim; rela++) { - if (ELF_R_TYPE(rela->r_info) == R_X86_64_COPY) { - void *dstaddr; - const Elf_Sym *dstsym; - const char *name; - size_t size; - const void *srcaddr; - const Elf_Sym *srcsym; - const Obj_Entry *srcobj, *defobj; - SymLook req; - int res; - - dstaddr = (void *)(dstobj->relocbase + rela->r_offset); - dstsym = dstobj->symtab + ELF_R_SYM(rela->r_info); - name = dstobj->strtab + dstsym->st_name; - size = dstsym->st_size; - symlook_init(&req, name); - req.ventry = fetch_ventry(dstobj, ELF_R_SYM(rela->r_info)); - req.flags = SYMLOOK_EARLY; - - for (srcobj = globallist_next(dstobj); srcobj != NULL; - srcobj = globallist_next(srcobj)) { - res = symlook_obj(&req, srcobj); - if (res == 0) { - srcsym = req.sym_out; - defobj = req.defobj_out; - break; - } - } + const Elf_Rela *relalim; + const Elf_Rela *rela; - if (srcobj == NULL) { - _rtld_error("Undefined symbol \"%s\" referenced from COPY" - " relocation in %s", name, dstobj->path); - return -1; - } + assert(dstobj->mainprog); /* COPY relocations are invalid elsewhere */ + + relalim = (const Elf_Rela *)((const char *)dstobj->rela + + dstobj->relasize); + for (rela = dstobj->rela; rela < relalim; rela++) { + if (ELF_R_TYPE(rela->r_info) == R_X86_64_COPY) { + void *dstaddr; + const Elf_Sym *dstsym; + const char *name; + size_t size; + const void *srcaddr; + const Elf_Sym *srcsym; + const Obj_Entry *srcobj, *defobj; + SymLook req; + int res; + + dstaddr = (void *)(dstobj->relocbase + rela->r_offset); + dstsym = dstobj->symtab + ELF_R_SYM(rela->r_info); + name = dstobj->strtab + dstsym->st_name; + size = dstsym->st_size; + symlook_init(&req, name); + req.ventry = fetch_ventry(dstobj, + ELF_R_SYM(rela->r_info)); + req.flags = SYMLOOK_EARLY; + + for (srcobj = globallist_next(dstobj); srcobj != NULL; + srcobj = globallist_next(srcobj)) { + res = symlook_obj(&req, srcobj); + if (res == 0) { + srcsym = req.sym_out; + defobj = req.defobj_out; + break; + } + } + + if (srcobj == NULL) { + _rtld_error( + "Undefined symbol \"%s\" referenced from COPY relocation in %s", + name, dstobj->path); + return (-1); + } - srcaddr = (const void *)(defobj->relocbase + srcsym->st_value); - memcpy(dstaddr, srcaddr, size); + srcaddr = (const void *)(defobj->relocbase + + srcsym->st_value); + memcpy(dstaddr, srcaddr, size); + } } - } - return 0; + return (0); } /* Initialize the special GOT entries. */ void init_pltgot(Obj_Entry *obj) { - if (obj->pltgot != NULL) { - obj->pltgot[1] = (Elf_Addr) obj; - obj->pltgot[2] = (Elf_Addr) &_rtld_bind_start; - } + if (obj->pltgot != NULL) { + obj->pltgot[1] = (Elf_Addr)obj; + obj->pltgot[2] = (Elf_Addr)&_rtld_bind_start; + } } /* Process the non-PLT relocations. */ @@ -150,8 +155,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, } else cache = NULL; - relalim = (const Elf_Rela *)((const char*)obj->rela + obj->relasize); - for (rela = obj->rela; rela < relalim; rela++) { + relalim = (const Elf_Rela *)((const char *)obj->rela + obj->relasize); + for (rela = obj->rela; rela < relalim; rela++) { /* * First, resolve symbol for relocations which * reference symbols. @@ -165,10 +170,11 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, case R_X86_64_DTPMOD64: case R_X86_64_DTPOFF64: case R_X86_64_DTPOFF32: - def = find_symdef(ELF_R_SYM(rela->r_info), obj, - &defobj, flags, cache, lockstate); + def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, + flags, cache, lockstate); if (def == NULL) goto done; + /* * If symbol is IFUNC, only perform relocation * when caller allowed it by passing @@ -228,19 +234,21 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, * binutils-2.6 tools sometimes generate it. */ *where32 = (Elf32_Addr)(unsigned long)(symval + - rela->r_addend - (Elf_Addr)where); + rela->r_addend - (Elf_Addr)where); break; /* missing: R_X86_64_GOT32 R_X86_64_PLT32 */ case R_X86_64_COPY: /* - * These are deferred until all other relocations have - * been done. All we do here is make sure that the COPY - * relocation is not in a shared library. They are - * allowed only in executable files. + * These are deferred until all other + * relocations have been done. All we do here + * is make sure that the COPY relocation is + * not in a shared library. They are allowed + * only in executable files. */ if (!obj->mainprog) { - _rtld_error("%s: Unexpected R_X86_64_COPY " - "relocation in shared library", obj->path); + _rtld_error( + "%s: Unexpected R_X86_64_COPY relocation in shared library", + obj->path); goto done; } break; @@ -257,10 +265,10 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, * of space, we generate an error. */ if (!defobj->tls_static) { - if (!allocate_tls_offset( - __DECONST(Obj_Entry *, defobj))) { - _rtld_error("%s: No space available " - "for static Thread Local Storage", + if (!allocate_tls_offset(__DECONST(Obj_Entry *, + defobj))) { + _rtld_error( + "%s: No space available for static Thread Local Storage", obj->path); goto done; } @@ -278,10 +286,10 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, * of space, we generate an error. */ if (!defobj->tls_static) { - if (!allocate_tls_offset( - __DECONST(Obj_Entry *, defobj))) { - _rtld_error("%s: No space available " - "for static Thread Local Storage", + if (!allocate_tls_offset(__DECONST(Obj_Entry *, + defobj))) { + _rtld_error( + "%s: No space available for static Thread Local Storage", obj->path); goto done; } @@ -312,9 +320,9 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, * R_X86_64_PC16, R_X86_64_8, R_X86_64_PC8 */ default: - _rtld_error("%s: Unsupported relocation type %u" - " in non-PLT relocations\n", obj->path, - (unsigned int)ELF_R_TYPE(rela->r_info)); + _rtld_error( + "%s: Unsupported relocation type %u in non-PLT relocations", + obj->path, (unsigned int)ELF_R_TYPE(rela->r_info)); goto done; } } @@ -328,82 +336,85 @@ done: int reloc_plt(Obj_Entry *obj, int flags __unused, RtldLockState *lockstate __unused) { - const Elf_Rela *relalim; - const Elf_Rela *rela; - - relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); - for (rela = obj->pltrela; rela < relalim; rela++) { - Elf_Addr *where; - - switch(ELF_R_TYPE(rela->r_info)) { - case R_X86_64_JMP_SLOT: - /* Relocate the GOT slot pointing into the PLT. */ - where = (Elf_Addr *)(obj->relocbase + rela->r_offset); - *where += (Elf_Addr)obj->relocbase; - break; - - case R_X86_64_IRELATIVE: - obj->irelative = true; - break; - - default: - _rtld_error("Unknown relocation type %x in PLT", - (unsigned int)ELF_R_TYPE(rela->r_info)); - return (-1); + const Elf_Rela *relalim; + const Elf_Rela *rela; + + relalim = (const Elf_Rela *)((const char *)obj->pltrela + + obj->pltrelasize); + for (rela = obj->pltrela; rela < relalim; rela++) { + Elf_Addr *where; + + switch (ELF_R_TYPE(rela->r_info)) { + case R_X86_64_JMP_SLOT: + /* Relocate the GOT slot pointing into the PLT. */ + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + *where += (Elf_Addr)obj->relocbase; + break; + + case R_X86_64_IRELATIVE: + obj->irelative = true; + break; + + default: + _rtld_error("Unknown relocation type %x in PLT", + (unsigned int)ELF_R_TYPE(rela->r_info)); + return (-1); + } } - } - return 0; + return (0); } /* Relocate the jump slots in an object. */ int reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockState *lockstate) { - const Elf_Rela *relalim; - const Elf_Rela *rela; - - if (obj->jmpslots_done) - return 0; - relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); - for (rela = obj->pltrela; rela < relalim; rela++) { - Elf_Addr *where, target; - const Elf_Sym *def; - const Obj_Entry *defobj; + const Elf_Rela *relalim; + const Elf_Rela *rela; - switch (ELF_R_TYPE(rela->r_info)) { - case R_X86_64_JMP_SLOT: - where = (Elf_Addr *)(obj->relocbase + rela->r_offset); - def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - SYMLOOK_IN_PLT | flags, NULL, lockstate); - if (def == NULL) - return (-1); - if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) { - obj->gnu_ifunc = true; - continue; - } - target = (Elf_Addr)(defobj->relocbase + def->st_value + rela->r_addend); - reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); - break; - - case R_X86_64_IRELATIVE: - break; - - default: - _rtld_error("Unknown relocation type %x in PLT", - (unsigned int)ELF_R_TYPE(rela->r_info)); - return (-1); + if (obj->jmpslots_done) + return (0); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + + obj->pltrelasize); + for (rela = obj->pltrela; rela < relalim; rela++) { + Elf_Addr *where, target; + const Elf_Sym *def; + const Obj_Entry *defobj; + + switch (ELF_R_TYPE(rela->r_info)) { + case R_X86_64_JMP_SLOT: + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + def = find_symdef(ELF_R_SYM(rela->r_info), obj, + &defobj, SYMLOOK_IN_PLT | flags, NULL, lockstate); + if (def == NULL) + return (-1); + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) { + obj->gnu_ifunc = true; + continue; + } + target = (Elf_Addr)(defobj->relocbase + def->st_value + + rela->r_addend); + reloc_jmpslot(where, target, defobj, obj, + (const Elf_Rel *)rela); + break; + + case R_X86_64_IRELATIVE: + break; + + default: + _rtld_error("Unknown relocation type %x in PLT", + (unsigned int)ELF_R_TYPE(rela->r_info)); + return (-1); + } } - } - obj->jmpslots_done = true; - return 0; + obj->jmpslots_done = true; + return (0); } /* Fixup the jump slot at "where" to transfer control to "target". */ Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, - const struct Struct_Obj_Entry *obj __unused, - const struct Struct_Obj_Entry *refobj __unused, - const Elf_Rel *rel __unused) + const struct Struct_Obj_Entry *obj __unused, + const struct Struct_Obj_Entry *refobj __unused, const Elf_Rel *rel __unused) { dbg("reloc_jmpslot: *%p = %p", where, (void *)target); if (!ld_bind_not) @@ -436,7 +447,7 @@ reloc_iresolve(Obj_Entry *obj, RtldLockState *lockstate) obj->irelative = false; relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); - for (rela = obj->pltrela; rela < relalim; rela++) { + for (rela = obj->pltrela; rela < relalim; rela++) { if (ELF_R_TYPE(rela->r_info) == R_X86_64_IRELATIVE) reloc_iresolve_one(obj, rela, lockstate); } @@ -453,7 +464,7 @@ reloc_iresolve_nonplt(Obj_Entry *obj, RtldLockState *lockstate) return (0); obj->irelative_nonplt = false; relalim = (const Elf_Rela *)((const char *)obj->rela + obj->relasize); - for (rela = obj->rela; rela < relalim; rela++) { + for (rela = obj->rela; rela < relalim; rela++) { if (ELF_R_TYPE(rela->r_info) == R_X86_64_IRELATIVE) reloc_iresolve_one(obj, rela, lockstate); } @@ -463,35 +474,37 @@ reloc_iresolve_nonplt(Obj_Entry *obj, RtldLockState *lockstate) int reloc_gnu_ifunc(Obj_Entry *obj, int flags, RtldLockState *lockstate) { - const Elf_Rela *relalim; - const Elf_Rela *rela; + const Elf_Rela *relalim; + const Elf_Rela *rela; - if (!obj->gnu_ifunc) - return (0); - relalim = (const Elf_Rela *)((const char *)obj->pltrela + obj->pltrelasize); - for (rela = obj->pltrela; rela < relalim; rela++) { - Elf_Addr *where, target; - const Elf_Sym *def; - const Obj_Entry *defobj; + if (!obj->gnu_ifunc) + return (0); + relalim = (const Elf_Rela *)((const char *)obj->pltrela + + obj->pltrelasize); + for (rela = obj->pltrela; rela < relalim; rela++) { + Elf_Addr *where, target; + const Elf_Sym *def; + const Obj_Entry *defobj; - switch (ELF_R_TYPE(rela->r_info)) { - case R_X86_64_JMP_SLOT: - where = (Elf_Addr *)(obj->relocbase + rela->r_offset); - def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - SYMLOOK_IN_PLT | flags, NULL, lockstate); - if (def == NULL) - return (-1); - if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC) - continue; - lock_release(rtld_bind_lock, lockstate); - target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); - wlock_acquire(rtld_bind_lock, lockstate); - reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); - break; + switch (ELF_R_TYPE(rela->r_info)) { + case R_X86_64_JMP_SLOT: + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, + SYMLOOK_IN_PLT | flags, NULL, lockstate); + if (def == NULL) + return (-1); + if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC) + continue; + lock_release(rtld_bind_lock, lockstate); + target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); + wlock_acquire(rtld_bind_lock, lockstate); + reloc_jmpslot(where, target, defobj, obj, + (const Elf_Rel *)rela); + break; + } } - } - obj->gnu_ifunc = false; - return (0); + obj->gnu_ifunc = false; + return (0); } uint32_t cpu_feature, cpu_feature2, cpu_stdext_feature, cpu_stdext_feature2; @@ -550,18 +563,18 @@ __tls_get_addr(tls_index *ti) } size_t -calculate_tls_offset(size_t prev_offset, size_t prev_size __unused, - size_t size, size_t align, size_t offset) +calculate_tls_offset(size_t prev_offset, size_t prev_size __unused, size_t size, + size_t align, size_t offset) { size_t res; - /* + /* * res is the smallest integer satisfying res - prev_offset >= size - * and (-res) % p_align = p_vaddr % p_align (= p_offset % p_align). + * and (-res) % p_align = p_vaddr % p_align (= p_offset % p_align). */ - res = prev_offset + size + align - 1; - res -= (res + offset) & (align - 1); - return (res); + res = prev_offset + size + align - 1; + res -= (res + offset) & (align - 1); + return (res); } size_t From nobody Tue Jan 21 01:51:05 2025 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 4YcVY63ZVkz5lJRx; Tue, 21 Jan 2025 01:51: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 4YcVY60VQmz3cM2; Tue, 21 Jan 2025 01:51:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737424266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9j+1UdRryTlhXZiB3CrlLA9HJxSunobOLaGC8LXbqLA=; b=DHLyfzNSL6qW+EaZXJQf0BjtjGXteHea/GsI5BVtf8PEGveLDLLXACZAGftikDcAA4mSed cwAkA1MfgRWkfYtkwidBlFGzKBY32mFHKt3HjwayFiCHVj3HMdv6tP3ksdqIYDBbyXbTky tr5BiXSTU/CTLLBojZ2kF/cQfKSxWHHnU5vAITt+n90EHiJyHkSklR6f+1VwAmxLb9lsie 0trkgqCQKEEGP+WfmP2Ka4sgJrPsFE+de1pDEYknSbMyw4Tc/VLfaaTCbHwLE35onXbH10 43C9KiG/xFudD0XiZs0qWtLAM4D+7aCztQKOTgfSyuounPeZKeFc8c36EQ275A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737424266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9j+1UdRryTlhXZiB3CrlLA9HJxSunobOLaGC8LXbqLA=; b=kkDVyLumecLNOuuv92uvbWWTmfducpZkoWi8K3L2esO01cNurjFljXh3xG0PtORr8+o1zg 4UtK0Q/RM/Io8xSjM/kUrYHC5eFggxQdxR8xREi4Gj026LdYkoH/Yv59GZjH4hnXJVqtra gkHIvxEIG8uHyCeBR1/Hoz+u0+FAGuOzakwbewDH0hq0odsj36FdOqXMSWA0KsxEpv/76T 0nSG4SJiklpjOScY7UbJwq2BE3zd0mW19f1Hq/PjNh7wuOownGnODCVZTNH47EbaNYPVBy JGXDgThAunrSgVB8mXLn9Ao6s14rC5AyQhQrq0pryTd+Rp14NAk0qmhqZEUCJg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737424266; a=rsa-sha256; cv=none; b=jkQYRWTMNROmRVB8W0J/0+WVvrcFUpThjV24BHytt8bW2z3PFMoHgSY2XffxmqVpzozuSl Tx3Qq+9ZSUROonw1rN6dAuuMpcYrWarMjxEHp2ULBI+PXD67PPDBXuMPhipI8qhYbgM0tv Zg0jPlRMMSOkzBJ9F9qKX4IDIYFBpACU/aswbVKoVBRVZwGnGqDixM+Mw0OLKFgMnqlV50 bLYMoAvVWVsZUruKv2+QbReeCEHDFM1GLtE+hBKMtJbSjMRAwtOEmdrKB4/0yyYvOJTGcG yz6uAY5xdyj+GozYHi/QwnAOq7A3OW8NRUaICTA9Iuvx1Re1sxfsOZHyE/G0qA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcVY600p9zlt6; Tue, 21 Jan 2025 01:51: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 50L1p5ZH075341; Tue, 21 Jan 2025 01:51:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50L1p5Pu075338; Tue, 21 Jan 2025 01:51:05 GMT (envelope-from git) Date: Tue, 21 Jan 2025 01:51:05 GMT Message-Id: <202501210151.50L1p5Pu075338@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: 78b5dadb58e2 - main - rtld-elf/i386/reloc.c: apply clang-format 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: 78b5dadb58e201e51a3a2eda5cf8cab6d31e0b62 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=78b5dadb58e201e51a3a2eda5cf8cab6d31e0b62 commit 78b5dadb58e201e51a3a2eda5cf8cab6d31e0b62 Author: Konstantin Belousov AuthorDate: 2025-01-18 02:58:05 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-21 01:44:58 +0000 rtld-elf/i386/reloc.c: apply clang-format Discussed with: emaste, imp Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D48509 --- libexec/rtld-elf/i386/reloc.c | 367 +++++++++++++++++++++--------------------- 1 file changed, 186 insertions(+), 181 deletions(-) diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c index 24c754865504..3d724bcacb6f 100644 --- a/libexec/rtld-elf/i386/reloc.c +++ b/libexec/rtld-elf/i386/reloc.c @@ -33,6 +33,7 @@ #include #include + #include #include @@ -60,64 +61,68 @@ int do_copy_relocations(Obj_Entry *dstobj) { - const Elf_Rel *rellim; - const Elf_Rel *rel; - - assert(dstobj->mainprog); /* COPY relocations are invalid elsewhere */ - - rellim = (const Elf_Rel *)((const char *)dstobj->rel + dstobj->relsize); - for (rel = dstobj->rel; rel < rellim; rel++) { - if (ELF_R_TYPE(rel->r_info) == R_386_COPY) { - void *dstaddr; - const Elf_Sym *dstsym; - const char *name; - size_t size; - const void *srcaddr; - const Elf_Sym *srcsym; - const Obj_Entry *srcobj, *defobj; - SymLook req; - int res; - - dstaddr = (void *)(dstobj->relocbase + rel->r_offset); - dstsym = dstobj->symtab + ELF_R_SYM(rel->r_info); - name = dstobj->strtab + dstsym->st_name; - size = dstsym->st_size; - symlook_init(&req, name); - req.ventry = fetch_ventry(dstobj, ELF_R_SYM(rel->r_info)); - req.flags = SYMLOOK_EARLY; - - for (srcobj = globallist_next(dstobj); srcobj != NULL; - srcobj = globallist_next(srcobj)) { - res = symlook_obj(&req, srcobj); - if (res == 0) { - srcsym = req.sym_out; - defobj = req.defobj_out; - break; - } - } + const Elf_Rel *rellim; + const Elf_Rel *rel; + + assert(dstobj->mainprog); /* COPY relocations are invalid elsewhere */ + + rellim = (const Elf_Rel *)((const char *)dstobj->rel + dstobj->relsize); + for (rel = dstobj->rel; rel < rellim; rel++) { + if (ELF_R_TYPE(rel->r_info) == R_386_COPY) { + void *dstaddr; + const Elf_Sym *dstsym; + const char *name; + size_t size; + const void *srcaddr; + const Elf_Sym *srcsym; + const Obj_Entry *srcobj, *defobj; + SymLook req; + int res; + + dstaddr = (void *)(dstobj->relocbase + rel->r_offset); + dstsym = dstobj->symtab + ELF_R_SYM(rel->r_info); + name = dstobj->strtab + dstsym->st_name; + size = dstsym->st_size; + symlook_init(&req, name); + req.ventry = fetch_ventry(dstobj, + ELF_R_SYM(rel->r_info)); + req.flags = SYMLOOK_EARLY; + + for (srcobj = globallist_next(dstobj); srcobj != NULL; + srcobj = globallist_next(srcobj)) { + res = symlook_obj(&req, srcobj); + if (res == 0) { + srcsym = req.sym_out; + defobj = req.defobj_out; + break; + } + } - if (srcobj == NULL) { - _rtld_error("Undefined symbol \"%s\" referenced from COPY" - " relocation in %s", name, dstobj->path); - return -1; - } + if (srcobj == NULL) { + _rtld_error( + "Undefined symbol \"%s\" referenced from COPY" + " relocation in %s", + name, dstobj->path); + return (-1); + } - srcaddr = (const void *)(defobj->relocbase + srcsym->st_value); - memcpy(dstaddr, srcaddr, size); + srcaddr = (const void *)(defobj->relocbase + + srcsym->st_value); + memcpy(dstaddr, srcaddr, size); + } } - } - return 0; + return (0); } /* Initialize the special GOT entries. */ void init_pltgot(Obj_Entry *obj) { - if (obj->pltgot != NULL) { - obj->pltgot[1] = (Elf_Addr) obj; - obj->pltgot[2] = (Elf_Addr) &_rtld_bind_start; - } + if (obj->pltgot != NULL) { + obj->pltgot[1] = (Elf_Addr)obj; + obj->pltgot[2] = (Elf_Addr)&_rtld_bind_start; + } } /* Process the non-PLT relocations. */ @@ -141,15 +146,16 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, if (obj != obj_rtld) { cache = calloc(obj->dynsymcount, sizeof(SymCache)); /* No need to check for NULL here */ - } else + } else { cache = NULL; + } /* Appease some compilers. */ symval = 0; def = NULL; rellim = (const Elf_Rel *)((const char *)obj->rel + obj->relsize); - for (rel = obj->rel; rel < rellim; rel++) { + for (rel = obj->rel; rel < rellim; rel++) { switch (ELF_R_TYPE(rel->r_info)) { case R_386_32: case R_386_PC32: @@ -171,8 +177,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, obj->non_plt_gnu_ifunc = true; continue; } - symval = (Elf_Addr)rtld_resolve_ifunc( - defobj, def); + symval = (Elf_Addr) + rtld_resolve_ifunc(defobj, def); break; case R_386_TLS_TPOFF: case R_386_TLS_TPOFF32: @@ -203,13 +209,13 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, *where += symval; break; case R_386_PC32: - /* - * I don't think the dynamic linker should ever - * see this type of relocation. But the - * binutils-2.6 tools sometimes generate it. - */ - *where += symval - (Elf_Addr)where; - break; + /* + * I don't think the dynamic linker should ever + * see this type of relocation. But the + * binutils-2.6 tools sometimes generate it. + */ + *where += symval - (Elf_Addr)where; + break; case R_386_COPY: /* * These are deferred until all other @@ -219,8 +225,9 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, * only in executable files. */ if (!obj->mainprog) { - _rtld_error("%s: Unexpected R_386_COPY " - "relocation in shared library", obj->path); + _rtld_error( + "%s: Unexpected R_386_COPY relocation in shared library", + obj->path); goto done; } break; @@ -243,8 +250,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, if (!defobj->tls_static) { if (!allocate_tls_offset( __DECONST(Obj_Entry *, defobj))) { - _rtld_error("%s: No space available " - "for static Thread Local Storage", + _rtld_error( + "%s: No space available for static Thread Local Storage", obj->path); goto done; } @@ -259,15 +266,15 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags, *where += (Elf_Addr)defobj->tlsindex; break; case R_386_TLS_DTPOFF32: - *where += (Elf_Addr) def->st_value; + *where += (Elf_Addr)def->st_value; break; case R_386_IRELATIVE: obj->irelative_nonplt = true; break; default: - _rtld_error("%s: Unsupported relocation type %d" - " in non-PLT relocations\n", obj->path, - ELF_R_TYPE(rel->r_info)); + _rtld_error( + "%s: Unsupported relocation type %d in non-PLT relocations", + obj->path, ELF_R_TYPE(rel->r_info)); goto done; } } @@ -281,82 +288,81 @@ done: int reloc_plt(Obj_Entry *obj, int flags __unused, RtldLockState *lockstate __unused) { - const Elf_Rel *rellim; - const Elf_Rel *rel; - - rellim = (const Elf_Rel *)((const char *)obj->pltrel + obj->pltrelsize); - for (rel = obj->pltrel; rel < rellim; rel++) { - Elf_Addr *where/*, val*/; - - switch (ELF_R_TYPE(rel->r_info)) { - case R_386_JMP_SLOT: - /* Relocate the GOT slot pointing into the PLT. */ - where = (Elf_Addr *)(obj->relocbase + rel->r_offset); - *where += (Elf_Addr)obj->relocbase; - break; - - case R_386_IRELATIVE: - obj->irelative = true; - break; - - default: - _rtld_error("Unknown relocation type %x in PLT", - ELF_R_TYPE(rel->r_info)); - return (-1); + const Elf_Rel *rellim; + const Elf_Rel *rel; + + rellim = (const Elf_Rel *)((const char *)obj->pltrel + obj->pltrelsize); + for (rel = obj->pltrel; rel < rellim; rel++) { + Elf_Addr *where; + + switch (ELF_R_TYPE(rel->r_info)) { + case R_386_JMP_SLOT: + /* Relocate the GOT slot pointing into the PLT. */ + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); + *where += (Elf_Addr)obj->relocbase; + break; + + case R_386_IRELATIVE: + obj->irelative = true; + break; + + default: + _rtld_error("Unknown relocation type %x in PLT", + ELF_R_TYPE(rel->r_info)); + return (-1); + } } - } - return 0; + return (0); } /* Relocate the jump slots in an object. */ int reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockState *lockstate) { - const Elf_Rel *rellim; - const Elf_Rel *rel; + const Elf_Rel *rellim; + const Elf_Rel *rel; - if (obj->jmpslots_done) - return 0; - rellim = (const Elf_Rel *)((const char *)obj->pltrel + obj->pltrelsize); - for (rel = obj->pltrel; rel < rellim; rel++) { - Elf_Addr *where, target; - const Elf_Sym *def; - const Obj_Entry *defobj; + if (obj->jmpslots_done) + return (0); + rellim = (const Elf_Rel *)((const char *)obj->pltrel + obj->pltrelsize); + for (rel = obj->pltrel; rel < rellim; rel++) { + Elf_Addr *where, target; + const Elf_Sym *def; + const Obj_Entry *defobj; + + switch (ELF_R_TYPE(rel->r_info)) { + case R_386_JMP_SLOT: + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); + def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, + SYMLOOK_IN_PLT | flags, NULL, lockstate); + if (def == NULL) + return (-1); + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) { + obj->gnu_ifunc = true; + continue; + } + target = (Elf_Addr)(defobj->relocbase + def->st_value); + reloc_jmpslot(where, target, defobj, obj, rel); + break; - switch (ELF_R_TYPE(rel->r_info)) { - case R_386_JMP_SLOT: - where = (Elf_Addr *)(obj->relocbase + rel->r_offset); - def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, - SYMLOOK_IN_PLT | flags, NULL, lockstate); - if (def == NULL) - return (-1); - if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) { - obj->gnu_ifunc = true; - continue; - } - target = (Elf_Addr)(defobj->relocbase + def->st_value); - reloc_jmpslot(where, target, defobj, obj, rel); - break; - - case R_386_IRELATIVE: - break; - - default: - _rtld_error("Unknown relocation type %x in PLT", - ELF_R_TYPE(rel->r_info)); - return (-1); + case R_386_IRELATIVE: + break; + + default: + _rtld_error("Unknown relocation type %x in PLT", + ELF_R_TYPE(rel->r_info)); + return (-1); + } } - } - obj->jmpslots_done = true; - return 0; + obj->jmpslots_done = true; + return (0); } /* Fixup the jump slot at "where" to transfer control to "target". */ Elf_Addr -reloc_jmpslot(Elf_Addr *where, Elf_Addr target, - const Obj_Entry *obj __unused, const Obj_Entry *refobj __unused, - const Elf_Rel *rel __unused) +reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *obj __unused, + const Obj_Entry *refobj __unused, const Elf_Rel *rel __unused) { dbg("reloc_jmpslot: *%p = %p", where, (void *)target); if (!ld_bind_not) @@ -365,8 +371,7 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, } static void -reloc_iresolve_one(Obj_Entry *obj, const Elf_Rel *rel, - RtldLockState *lockstate) +reloc_iresolve_one(Obj_Entry *obj, const Elf_Rel *rel, RtldLockState *lockstate) { Elf_Addr *where, target; @@ -387,7 +392,7 @@ reloc_iresolve(Obj_Entry *obj, RtldLockState *lockstate) return (0); obj->irelative = false; rellim = (const Elf_Rel *)((const char *)obj->pltrel + obj->pltrelsize); - for (rel = obj->pltrel; rel < rellim; rel++) { + for (rel = obj->pltrel; rel < rellim; rel++) { if (ELF_R_TYPE(rel->r_info) == R_386_IRELATIVE) reloc_iresolve_one(obj, rel, lockstate); } @@ -404,7 +409,7 @@ reloc_iresolve_nonplt(Obj_Entry *obj, RtldLockState *lockstate) return (0); obj->irelative_nonplt = false; rellim = (const Elf_Rel *)((const char *)obj->rel + obj->relsize); - for (rel = obj->rel; rel < rellim; rel++) { + for (rel = obj->rel; rel < rellim; rel++) { if (ELF_R_TYPE(rel->r_info) == R_386_IRELATIVE) reloc_iresolve_one(obj, rel, lockstate); } @@ -414,36 +419,36 @@ reloc_iresolve_nonplt(Obj_Entry *obj, RtldLockState *lockstate) int reloc_gnu_ifunc(Obj_Entry *obj, int flags, RtldLockState *lockstate) { - const Elf_Rel *rellim; - const Elf_Rel *rel; + const Elf_Rel *rellim; + const Elf_Rel *rel; - if (!obj->gnu_ifunc) - return (0); - rellim = (const Elf_Rel *)((const char *)obj->pltrel + obj->pltrelsize); - for (rel = obj->pltrel; rel < rellim; rel++) { - Elf_Addr *where, target; - const Elf_Sym *def; - const Obj_Entry *defobj; + if (!obj->gnu_ifunc) + return (0); + rellim = (const Elf_Rel *)((const char *)obj->pltrel + obj->pltrelsize); + for (rel = obj->pltrel; rel < rellim; rel++) { + Elf_Addr *where, target; + const Elf_Sym *def; + const Obj_Entry *defobj; - switch (ELF_R_TYPE(rel->r_info)) { - case R_386_JMP_SLOT: - where = (Elf_Addr *)(obj->relocbase + rel->r_offset); - def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, - SYMLOOK_IN_PLT | flags, NULL, lockstate); - if (def == NULL) - return (-1); - if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC) - continue; - lock_release(rtld_bind_lock, lockstate); - target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); - wlock_acquire(rtld_bind_lock, lockstate); - reloc_jmpslot(where, target, defobj, obj, rel); - break; + switch (ELF_R_TYPE(rel->r_info)) { + case R_386_JMP_SLOT: + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); + def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, + SYMLOOK_IN_PLT | flags, NULL, lockstate); + if (def == NULL) + return (-1); + if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC) + continue; + lock_release(rtld_bind_lock, lockstate); + target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); + wlock_acquire(rtld_bind_lock, lockstate); + reloc_jmpslot(where, target, defobj, obj, rel); + break; + } } - } - obj->gnu_ifunc = false; - return (0); + obj->gnu_ifunc = false; + return (0); } uint32_t cpu_feature, cpu_feature2, cpu_stdext_feature, cpu_stdext_feature2; @@ -451,14 +456,13 @@ uint32_t cpu_feature, cpu_feature2, cpu_stdext_feature, cpu_stdext_feature2; static void rtld_cpuid_count(int idx, int cnt, u_int *p) { - __asm __volatile( " pushl %%ebx\n" " cpuid\n" " movl %%ebx,%1\n" " popl %%ebx\n" - : "=a" (p[0]), "=r" (p[1]), "=c" (p[2]), "=d" (p[3]) - : "0" (idx), "2" (cnt)); + : "=a"(p[0]), "=r"(p[1]), "=c"(p[2]), "=d"(p[3]) + : "0"(idx), "2"(cnt)); } void @@ -482,7 +486,9 @@ ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused) " jmp 2f\n" "1: movl $0,%0\n" "2:\n" - : "=r" (cpuid_supported) : : "eax", "ecx"); + : "=r"(cpuid_supported) + : + : "eax", "ecx"); if (!cpuid_supported) return; @@ -501,21 +507,20 @@ ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused) void allocate_initial_tls(Obj_Entry *objs) { - void* tls; - - /* - * Fix the size of the static TLS block by using the maximum - * offset allocated so far and adding a bit for dynamic modules to - * use. - */ - tls_static_space = tls_last_offset + ld_static_tls_extra; - tls = allocate_tls(objs, NULL, TLS_TCB_SIZE, TLS_TCB_ALIGN); - _tcb_set(tls); + void *tls; + + /* + * Fix the size of the static TLS block by using the maximum + * offset allocated so far and adding a bit for dynamic modules to + * use. + */ + tls_static_space = tls_last_offset + ld_static_tls_extra; + tls = allocate_tls(objs, NULL, TLS_TCB_SIZE, TLS_TCB_ALIGN); + _tcb_set(tls); } /* GNU ABI */ -__attribute__((__regparm__(1))) -void * +__attribute__((__regparm__(1))) void * ___tls_get_addr(tls_index *ti) { uintptr_t **dtvp; @@ -535,18 +540,18 @@ __tls_get_addr(tls_index *ti) } size_t -calculate_tls_offset(size_t prev_offset, size_t prev_size __unused, - size_t size, size_t align, size_t offset) +calculate_tls_offset(size_t prev_offset, size_t prev_size __unused, size_t size, + size_t align, size_t offset) { size_t res; - /* + /* * res is the smallest integer satisfying res - prev_offset >= size - * and (-res) % p_align = p_vaddr % p_align (= p_offset % p_align). + * and (-res) % p_align = p_vaddr % p_align (= p_offset % p_align). */ - res = prev_offset + size + align - 1; - res -= (res + offset) & (align - 1); - return (res); + res = prev_offset + size + align - 1; + res -= (res + offset) & (align - 1); + return (res); } size_t From nobody Tue Jan 21 01:58:02 2025 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 4YcVj641CFz5lJvq; Tue, 21 Jan 2025 01:58: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 4YcVj63L92z3fx4; Tue, 21 Jan 2025 01:58:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737424682; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sAzsnMNYimhdbC0o5Q/97keE7bfftelv6BPRrYPX/7U=; b=AFblWa9+e+25AqRdCLJ2iln7PO8Jqmc/Nos8EX4OXfpKAiVugIdbM3PBNaunyKXvMbvuMw 0qoG17Vl7KSM+m/r8I3vYivExxIq7CajeaKexZxpW0zeAtyeoUrB6VMsi3ec7ZDmkXKM3z nWOB1YYcdHxPgHwTp0QEsH0IDIkmqTIAxmgaeQ0ikdEsgfgO2vqn2L+ZPdCsT52yR86IyX RnvVvP2sBw8RHjYBX7Zd2QcD5vbAx1EcjzybtWV3v9auXK4nAmV9H2BxI9tXBfRnoSoPrB kilFB5A4I/wVVH/WhZnW1VedDGvyQPATjjXfg4kkyvKWRVCOQUu0saB+yIhSWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737424682; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sAzsnMNYimhdbC0o5Q/97keE7bfftelv6BPRrYPX/7U=; b=POwBdLqCKzXR1Dk+L1RE+dZbFpy4zpCE9tdJ+31LXqPi+YiSA2FfW9RAHhGtod1ASeG4e/ nEwXqy3zdHcBT9ld8g3d0EH4E2QpRV27k4t6juFZvlmZnxzhzsgY6WEtok0viGfS/cPJlc Ys34kIt+BOlTJ8iXB+uYLEF59xdP3XkNEE8BPRO8Fvh5oOQvHArcUASVzea8X762BSMCs2 zST7cN35dXUS/xn4wcK/iZZ+yrNLDzK2m/EfjH4vnNTHGnwyfCYapKLdT/DIq9ySiFqJl1 W6s0tHrc0U6+lgFuCUraCOAzI/IeBxGpR1dqbpgEkhnS0ewkHEX/I9qOuPlVdQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737424682; a=rsa-sha256; cv=none; b=djGZUNvG/vBIUVI8qPAN/XG7InGzxONJ8PNJXCQimEuL7f3bTlUcv3rg/U2vLFFyrjo4CB NDxtFZ+XoaWwYGYV5tAXzaRP5Xe1tIvqcOeUgE4HQ7k9adRfiTlLMdzk166xKczY6l9EwH TJcAqGpmRj/xxeXy2gmVOxDLd9KysgmhnA6fpnH8s3V5XNUv0GUeZ9+uwyBk2QsxCCqsah 0/sly/yIgfDSryO6jtXhpz8fWVkpVnYWd5jdsb2JVoPG7tW5EjhwhUKd/nwNKC+fVeV1sa EzrQ7G7Sxrn6movvEBQdqgaIavvP1BZCU9kClQ2Dkxl/8aqPNalM1egoqAiKLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcVj62rWRzmhl; Tue, 21 Jan 2025 01:58: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 50L1w2bY082321; Tue, 21 Jan 2025 01:58:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50L1w2Q8082318; Tue, 21 Jan 2025 01:58:02 GMT (envelope-from git) Date: Tue, 21 Jan 2025 01:58:02 GMT Message-Id: <202501210158.50L1w2Q8082318@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: eaede4e41376 - main - git-blame-ignore-revs: list rtld-elf reformatting 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: eaede4e413769310d394955c2646c62c0c09b877 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=eaede4e413769310d394955c2646c62c0c09b877 commit eaede4e413769310d394955c2646c62c0c09b877 Author: Konstantin Belousov AuthorDate: 2025-01-21 01:57:21 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-21 01:57:21 +0000 git-blame-ignore-revs: list rtld-elf reformatting Sponsored by: The FreeBSD Foundation --- .git-blame-ignore-revs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 10738c9c633b..7a8f6bbe90b7 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -8,6 +8,11 @@ # # This file is sorted in git log order (newest commits first). +# reformat libexec/rtld-elf +7e2f38311e62b1a3ba4a023042f2dc36e27cdd06 +986c96b54b9ec1118d285b723f53c7451a4c0772 +3a85aa6a1d8916082155867ce0545a07185e8924 +78b5dadb58e201e51a3a2eda5cf8cab6d31e0b62 # whitespace fixes for sys/sys/kernel.h 5c623697d6011de63bc762560a648c09379e06d2 # style fixes for iflib From nobody Tue Jan 21 02:56:12 2025 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 4YcX0F367Fz5lN8n; Tue, 21 Jan 2025 02:56: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 4YcX0F2PkKz3lX3; Tue, 21 Jan 2025 02:56:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737428173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=58r7ZvMhFJqdopLf4UBEjog3mMOcPgOaAIihj7arZ3s=; b=YDqfbneLcm9eE8ObfnAU+11vhCS+f/fb5N5OUx3/FmWjcwARwBct2TLRya/jezuaTyJyyV srEtidkZv9kNbtpdZSdFg9l+b89PrN7z117qJw2uHN7J6qgBrFy0GHQZ/skAACmMEm8HT2 4no1rhB8ibjpFSRs7HdDiFks5mhuzl5ZPedhkbaVEMnKujSebChm9jxtm4wvneSS0h4afT Z/8I0yg6I0vvN2s3DUELToKo0nzfHdEMrRPDm5+peAnpthcNgut/7+bJMztRoriH/bhdHB jkQmQnfhdPKg8OE26K6JOUccgjPH4lGsJDZzyPXe5wvB6r1RKrziajD31b3YMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737428173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=58r7ZvMhFJqdopLf4UBEjog3mMOcPgOaAIihj7arZ3s=; b=MI0uBknj8yQ9Y5X2KtW/OoQW6A+zMiwJVjIhCkqPnKMbq+v/FzPnbQx2TjNQrnoq0BHNd8 rMh5ofqbOuhHy7AMPmTZBwXfuiRMIOykbU/PBPw4YrMoUkEEVbK6YKPklaXkdciY1LO6NQ 6tacw1H7oScCNcv9zfKG0bpfcm3FiSk6NHequ/ueg0MBIIZYxzUjaoKogqZVzaPWDUWASb ivAOb0Z+ggAV7ZhjaX5n4mQsJX5snn225KareaOJe0zr4egmJlMC3KONTQl1GOo0aPToxo 5rKHG1cO34CQLjIQxHQ8woytzr4/QcXH3zTClXWRixy4FW7MJDQf6dSqnrOE2A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737428173; a=rsa-sha256; cv=none; b=GWOGVuiMcYoKrV7cuVtX4MrT+oUVx0NPoobWDRJqTwhR1H/s6yHDJJ6lkeOLcBK1xcfVX9 +zSPmMvgws1wkswlBuTd/splGt+a4ppryA5iUFyBqcOdA3uiwpv43WVOFtgwqdHqATKYoO jSoMVQ0GwX9rZJO3+CuPqalRzveAFzmljS0Exf6ZCj86UQtCAsUmljp2iPfR4sT52QBWZC +p4rmw++PNHjwZcVcTpQ31Qs5TuZ6L3u3YTKQFSeP0QD+COmBR/ruuR6q5qa7H3DYFqiKF d4H6zZrTjAlQlZG0ZnJNUbWuZFvq3q+EjvXjymf1pQdAmxfm118STBWYE6hgtQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcX0F1z1QzpN1; Tue, 21 Jan 2025 02:56: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 50L2uDT0094202; Tue, 21 Jan 2025 02:56:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50L2uC2F094195; Tue, 21 Jan 2025 02:56:12 GMT (envelope-from git) Date: Tue, 21 Jan 2025 02:56:12 GMT Message-Id: <202501210256.50L2uC2F094195@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 18270a76e24e - main - contrib/spleen: Update to Spleen 2.1.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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 18270a76e24e7f17f533a7a683eed3327a3c135a Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=18270a76e24e7f17f533a7a683eed3327a3c135a commit 18270a76e24e7f17f533a7a683eed3327a3c135a Merge: eaede4e41376 e364562a4012 Author: Ed Maste AuthorDate: 2025-01-21 02:55:47 +0000 Commit: Ed Maste CommitDate: 2025-01-21 02:55:47 +0000 contrib/spleen: Update to Spleen 2.1.0 Merge commit 'e364562a4012d6d9cb334795b97e929cfa2a5dff' contrib/spleen/ChangeLog | 31 + contrib/spleen/LICENSE | 2 +- contrib/spleen/README.md | 69 +- contrib/spleen/spleen-12x24.bdf | 2368 ++- contrib/spleen/spleen-16x32.bdf | 19138 +++++++++++--------- contrib/spleen/spleen-32x64.bdf | 36002 +++++++++++++++++++++----------------- contrib/spleen/spleen-5x8.bdf | 8 +- contrib/spleen/spleen-6x12.bdf | 1456 +- contrib/spleen/spleen-8x16.bdf | 10156 ++++++----- 9 files changed, 39463 insertions(+), 29767 deletions(-) diff --cc contrib/spleen/README.md index ce2e6addc305,000000000000..a80773ec8420 mode 100644,000000..100644 --- a/contrib/spleen/README.md +++ b/contrib/spleen/README.md @@@ -1,257 -1,0 +1,270 @@@ +``` + + :::::::::::::::::::: + ::: ::: + _____ _______ __. ________ ________ ________. ::: + _) _//__ __/ __ / |.\ __ /.\ __ /.\ _. | ::: + .\____ /.\ )/ / || )/ | )/ | \| | ::: + | )/ | __/| \ _____| _____| | |_ ::: + |____ |_____| |_____/____\\ |____\\ | |____/ ::: + - -- -- \_____| -H7--------------------------- `----' ----- ::: - - + ::: ::: + :::::::::::::::::::: + +``` + +# Spleen + +Spleen is a monospaced bitmap font available in 6 sizes: + +- 5x8 +- 6x12 +- 8x16 +- 12x24 +- 16x32 +- 32x64 + +Each size is provided in the Glyph Bitmap Distribution Format (BDF), and +release tarballs contain the fonts in the following formats: `PCF`, `PSF` +(for the Linux console), `OTB`, `OTF`, `.dfont` for macOS users, and `FON` +for Windows users. + +All font sizes contain all ISO/IEC 8859-1 characters (Basic Latin and Latin-1 +Supplement Unicode block), Latin Extended-A characters, as well as Box Drawing, +Block Elements, and Braille Patterns Unicode blocks, except for the 5x8 and the +6x12 versions. + +Due to character size constraints, the 5x8 version only contains printable +ASCII characters, the Braille Patterns Unicode block, and light Box Drawing +characters. Please also note that there is no OpenType version for this size. + +As of Spleen 1.8.0, there is now a 6x12 version containing the same Unicode +blocks as the 5x8 version and the Latin-1 Supplement Unicode block. + +As of Spleen 2.0.0, the 8x16, 16x32 and 32x64 versions have full support for +Code page 437 (IBM PC). + +Spleen also has support for Powerline symbols out of the box. + +The font name is a reference to Baudelaire. + +## Screenshots + +The following screenshots show Spleen 16x32 displaying code and prose. + +![Spleen - Hello][1] + +![Spleen - L'etranger][2] + +ASCII characters for all sizes: + +Spleen 5x8: + +![Spleen - ASCII characters - 5x8][3] + +Spleen 6x12: + +![Spleen - ASCII characters - 6x12][4] + +Spleen 8x16: + +![Spleen - ASCII characters - 8x16][5] + +Spleen 12x24: + +![Spleen - ASCII characters - 12x24][6] + +Spleen 16x32: +![Spleen - ASCII characters - 16x32][7] + +Spleen 32x64: +![Spleen - ASCII characters - 32x64][8] + +## XLFD font names + +``` +-misc-spleen-medium-r-normal--8-80-72-72-c-50-iso10646-1 +-misc-spleen-medium-r-normal--12-120-72-72-c-60-iso10646-1 +-misc-spleen-medium-r-normal--16-160-72-72-c-80-iso10646-1 +-misc-spleen-medium-r-normal--24-240-72-72-c-120-iso10646-1 +-misc-spleen-medium-r-normal--32-320-72-72-c-160-iso10646-1 +-misc-spleen-medium-r-normal--64-640-72-72-c-320-iso10646-1 +``` + +## Packages + +Spleen packages are available for: + +- [OpenBSD][9] +- [NetBSD][10] +- [FreeBSD][11] +- [Arch Linux][12] +- [Void Linux][13] +- [Nix][14] +- [Debian][15] +- [Ubuntu][16] +- [MacPorts][17] ++- [Guix][18] ++- [Gentoo][19] ++- [Alpine Linux][20] + +## Manual installation + +### *BSD and Linux + +Clone the repository, convert the files to the Portable Compiled Format +(PCF) using **bdftopcf** and run **mkfontdir** in the directory. + +Alternatively, release tarballs provide PCF files for each size. + ++OTB versions are also available. ++ +### macOS + +macOS users should use the `.dfont` files provided in the release tarballs. + +### DOS + +DOS users should run the **SPLEEN.COM** executable provided in the release +tarballs to enable the font. + +This has been tested in DOSBox and FreeDOS on real hardware. + +### Windows + +Windows users should use the `.fon` or `.otf` files provided in the release +tarballs. + +## Usage + +### *BSD and Linux + +Update the font path to include **Spleen**: + + xset +fp /usr/local/share/fonts/spleen/ + +Update **.Xdefaults** and add one of the following directives: + + xterm*faceName: spleen:pixelsize=8:antialias=false + xterm*faceName: spleen:pixelsize=12:antialias=false + xterm*faceName: spleen:pixelsize=16:antialias=false + xterm*faceName: spleen:pixelsize=24:antialias=false + xterm*faceName: spleen:pixelsize=32:antialias=false + xterm*faceName: spleen:pixelsize=64:antialias=false + +Launch **xterm**. + +Ubuntu has bitmap fonts support disabled by default, instructions to enable - it are available [here][18]. ++it are available [here][21]. + +### Linux console + +Release tarballs provide PSF files for each size, `setfont` can be used +to load and set the desired font. + +### NetBSD console + +NetBSD has .fnt files for each size which can be loaded using wsfontload(8). + +For example, to load Spleen 16x32: + + wsfontload -N spleen-16x32 -w 16 -h 32 /usr/share/wscons/fonts/spleen-16x32.fnt + wsconsctl -dw font=spleen-16x32 + +### FreeBSD console + +The FreeBSD package contains .fnt files which can be loaded using +vidcontrol(1). + +For example, to load Spleen 16x32: + + vidcontrol -f /usr/local/share/fonts/spleen/spleen-16x32.fnt + +### OpenType versions + +Spleen release tarballs now contains OTF versions generated automatically - from the BDF files, using [bdf2sfd][19]. Each font has a different name, ++from the BDF files, using [bdf2sfd][22]. Each font has a different name, +allowing them to be installed alongside. + ++Please note that OTF versions should be used as last resort, always prefer ++bitmap versions if they are supported on your platform. ++ +They should be used in the exact size specified below, with anti-aliasing +disabled. + +- Spleen 6x12: 9 Pt (12 pixels) +- Spleen 8x16: 12 Pt (16 pixels) +- Spleen 12x24: 18 Pt (24 pixels) +- Spleen 16x32: 24 Pt (32 pixels) +- Spleen 32x64: 48 Pt (64 pixels) + +## License + +Spleen is released under the BSD 2-Clause license. See `LICENSE` file for +details. + +## Author + +Spleen is developed by Frederic Cambus. + +- Site: https://www.cambus.net + +## Resources + - - [Spleen - Monospaced bitmap fonts][20] (2018) - - [New console font Spleen made default][21] (2019) - - [NetBSD, CTWM, and Spleen][22] (2021) ++- [Spleen - Monospaced bitmap fonts][23] (2018) ++- [New console font Spleen made default][24] (2019) ++- [NetBSD, CTWM, and Spleen][25] (2021) ++- [Spleen 2.0.0 released with full CP437 support][26] (2023) + +GitHub: https://github.com/fcambus/spleen + +## Trivia + - - Spleen was imported in the OpenBSD src tree in [September 2018][23] - - Spleen is the default font for OpenBSD consoles since [January 2019][24] - - Spleen was imported in the NetBSD src tree in [March 2019][25] - - Spleen 12x24 was used in the Haiku [kernel debugger][26] (on high resolution ++- Spleen was imported in the OpenBSD src tree in [September 2018][27] ++- Spleen is the default font for OpenBSD consoles since [January 2019][28] ++- Spleen was imported in the NetBSD src tree in [March 2019][29] ++- Spleen 12x24 was used in the Haiku [kernel debugger][30] (on high resolution + displays) from May 2021 to June 2022 - - Spleen was imported in the FreeBSD base system in [May 2023][27] - - [msTERM][28], a Terminal program for MailStation devices uses Spleen 5x8 - - [FBInk][29], a library to print text & images to an eInk Linux framebuffer ++- Spleen was imported in the FreeBSD base system in [May 2023][31] ++- [msTERM][32], a Terminal program for MailStation devices uses Spleen 5x8 ++- [FBInk][33], a library to print text & images to an eInk Linux framebuffer + embeds Spleen 16x32 - - [U8g2][30], a monochrome graphics library for embedded devices includes ++- [U8g2][34], a monochrome graphics library for embedded devices includes + all Spleen sizes - - [Ansilove][31], an ANSI and ASCII art to PNG converter includes Spleen ++- [Ansilove][35], an ANSI and ASCII art to PNG converter includes Spleen + +[1]: https://www.cambus.net/content/2018/09/spleen-hello.png +[2]: https://www.cambus.net/content/2018/09/spleen-etranger.png +[3]: https://www.cambus.net/files/spleen/spleen-5x8.png +[4]: https://www.cambus.net/files/spleen/spleen-6x12.png +[5]: https://www.cambus.net/files/spleen/spleen-8x16.png +[6]: https://www.cambus.net/files/spleen/spleen-12x24.png +[7]: https://www.cambus.net/files/spleen/spleen-16x32.png +[8]: https://www.cambus.net/files/spleen/spleen-32x64.png +[9]: https://openports.pl/path/fonts/spleen +[10]: https://pkgsrc.se/fonts/spleen +[11]: https://www.freshports.org/x11-fonts/spleen/ +[12]: https://aur.archlinux.org/packages/spleen-font/ +[13]: https://github.com/void-linux/void-packages/tree/master/srcpkgs/font-spleen +[14]: https://github.com/NixOS/nixpkgs/tree/master/pkgs/data/fonts/spleen +[15]: https://packages.debian.org/search?keywords=spleen +[16]: https://packages.ubuntu.com/search?keywords=spleen +[17]: https://ports.macports.org/port/font-spleen/ - [18]: https://wiki.ubuntu.com/Fonts#Enabling_Bitmapped_Fonts - [19]: https://github.com/fcambus/bdf2sfd - [20]: https://www.cambus.net/spleen-monospaced-bitmap-fonts/ - [21]: https://undeadly.org/cgi?action=article;sid=20190110064857 - [22]: https://www.cambus.net/netbsd-ctwm-and-spleen/ - [23]: https://freshbsd.org/openbsd/src/commit/5raMrDMpYlPYW01H - [24]: https://freshbsd.org/openbsd/src/commit/MoBCxKiAlFajRvSm - [25]: https://freshbsd.org/netbsd/src/commit/TAJuMl9caBpVjGfB - [26]: https://git.haiku-os.org/haiku/commit/?id=29a109bd6c01ce71bb61177ee9ff0417e74c1e18 - [27]: https://cgit.freebsd.org/src/commit/?id=0d66206fff44 - [28]: https://github.com/jcs/msTERM - [29]: https://github.com/NiLuJe/FBInk - [30]: https://github.com/olikraus/u8g2/wiki/fntgrpspleen - [31]: https://www.ansilove.org ++[18]: https://packages.guix.gnu.org/packages/font-spleen/ ++[19]: https://packages.gentoo.org/packages/media-fonts/spleen ++[20]: https://pkgs.alpinelinux.org/packages?name=font-spleen ++[21]: https://wiki.ubuntu.com/Fonts#Enabling_Bitmapped_Fonts ++[22]: https://github.com/fcambus/bdf2sfd ++[23]: https://www.cambus.net/spleen-monospaced-bitmap-fonts/ ++[24]: https://undeadly.org/cgi?action=article;sid=20190110064857 ++[25]: https://www.cambus.net/netbsd-ctwm-and-spleen/ ++[26]: https://www.cambus.net/spleen-2.0.0-released-with-full-cp437-support/ ++[27]: https://freshbsd.org/openbsd/src/commit/5raMrDMpYlPYW01H ++[28]: https://freshbsd.org/openbsd/src/commit/MoBCxKiAlFajRvSm ++[29]: https://freshbsd.org/netbsd/src/commit/TAJuMl9caBpVjGfB ++[30]: https://git.haiku-os.org/haiku/commit/?id=29a109bd6c01ce71bb61177ee9ff0417e74c1e18 ++[31]: https://cgit.freebsd.org/src/commit/?id=0d66206fff44 ++[32]: https://github.com/jcs/msTERM ++[33]: https://github.com/NiLuJe/FBInk ++[34]: https://github.com/olikraus/u8g2/wiki/fntgrpspleen ++[35]: https://www.ansilove.org From nobody Tue Jan 21 10:35:48 2025 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 4YckBX5bjzz5ktjS; Tue, 21 Jan 2025 10:35: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 4YckBX5Lhtz3X1J; Tue, 21 Jan 2025 10:35:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737455748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mVEJ7qdt/MQPOkRHTcVtTewKCgjottrTxa/Y7uL8oc0=; b=aNS5SDlfJBO11VOrbUE9h6rIIV6QpWGEcUtlAmFTi7atWi8LbdVFMZQZDyf0qPAsDyovtT +JGyTvHxfWctdFb4bKE/rvQHsQeF1d3MApr3tfIEtfJWjzwd/+a81DWVEftpvx17Pe79sh FPhAgrVZYOlzSxu4bZtVb1E7R4jAqAEdhhyfSKQd2Mxnt/FhH/VjjOGB7t2TBJ9k5atxkF aspQI6VTSNfMa6Ll9a2xLsxxI3nKLJihTg01dMRv6a+syoF60nXANxGNPh87DCkwZJ8vzH SfN70RMWLcwx36VTXtn90+pwpY46JWGrbUjxdvpHu4x8jJUyP8CL0gmesuVRjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737455748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mVEJ7qdt/MQPOkRHTcVtTewKCgjottrTxa/Y7uL8oc0=; b=tojjjoEStOhBovfDxnFbJcpPLIQmRvvfzQHuAkmWYViYIhEzTV4plM3URyQyFqOpMhCsn3 A5P852zYtPDLQ6UlKnoAANM3yhU7qS7MkLZ0uLsT5e8zB1chSUfNuZbOnQezzf6SIzyqCy rDPeEorFqypuvvahZmmuy82VImkrI7WOTZn3rqhkSQ+aIn+lfAz8TSdbS7MROD5U6yk2fH /M4UWTYAj1SPAwkA55CB2kFwc99eTqu3jlmmODJophBuESMTNtIjXWhedabARn8qLZdTFd IpbKs3wGMCoSrB6s3KhQsAmIzMwSdRIjPecYHIb5PwX0uQdM6jCBk5dA9Q8HxA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737455748; a=rsa-sha256; cv=none; b=JGRq3NP9ACSgAZLecb/t6b5m1yuCz2Bf6TU91PqOr4g8LfYjn+hyxS0QUQ/L32uvL1NYCz D0hDiKgZTg32Z/jdUzHm4M8/PTmQbD9xJeupcqn1+g0ldvUz0KlymBKWBfhRCJiwpzW75r B3vqxyx7z099GaS9f2lQzYqUPHtxZyc6hq1tdblJX8YaHS+fS04YM+MvIDGUAX7Z4HsEr1 F6j0NLeWGAluJGyGbRqwRqkZdND0LExw156bEPP6++a/7ujsvqxeLtIfxWdAb5k4xb6AKE wUEVVdQ923TiQ8oBdE5bipXxBtDehlZSPbw/pEAFyPjbeEzJHsHjdWos1USfjw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YckBX4kV6z12lg; Tue, 21 Jan 2025 10:35: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 50LAZmxJ054836; Tue, 21 Jan 2025 10:35:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LAZmoH054833; Tue, 21 Jan 2025 10:35:48 GMT (envelope-from git) Date: Tue, 21 Jan 2025 10:35:48 GMT Message-Id: <202501211035.50LAZmoH054833@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ruslan Bukin Subject: git: 8f6b66a9d3f2 - main - riscv vmm: implement SBI RFNC extension. 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: br X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8f6b66a9d3f20d9f32259a7a83fbfb4364c4fafa Auto-Submitted: auto-generated The branch main has been updated by br: URL: https://cgit.FreeBSD.org/src/commit/?id=8f6b66a9d3f20d9f32259a7a83fbfb4364c4fafa commit 8f6b66a9d3f20d9f32259a7a83fbfb4364c4fafa Author: Ruslan Bukin AuthorDate: 2025-01-21 10:15:43 +0000 Commit: Ruslan Bukin CommitDate: 2025-01-21 10:35:19 +0000 riscv vmm: implement SBI RFNC extension. The RISC-V SBI (Supervisor Binary Interface) RFNC (fence) extension is used to provide a standardized mechanism for enforcing memory and I/O ordering between different execution contexts or cores in a system. Specifically, it allows supervisors (such as an operating system kernel) to request certain synchronization operations across CPUs or harts (hardware threads) via the SBI. Differential Revision: https://reviews.freebsd.org/D48441 --- sys/conf/files.riscv | 1 + sys/riscv/include/cpufunc.h | 15 ++++ sys/riscv/vmm/riscv.h | 22 +++++ sys/riscv/vmm/vmm_fence.c | 208 ++++++++++++++++++++++++++++++++++++++++++++ sys/riscv/vmm/vmm_fence.h | 43 +++++++++ sys/riscv/vmm/vmm_riscv.c | 9 ++ sys/riscv/vmm/vmm_sbi.c | 54 +++++++++--- 7 files changed, 339 insertions(+), 13 deletions(-) diff --git a/sys/conf/files.riscv b/sys/conf/files.riscv index 36eea03f29a1..e84f1367680f 100644 --- a/sys/conf/files.riscv +++ b/sys/conf/files.riscv @@ -86,6 +86,7 @@ riscv/riscv/vm_machdep.c standard riscv/vmm/vmm.c optional vmm riscv/vmm/vmm_aplic.c optional vmm riscv/vmm/vmm_dev_machdep.c optional vmm +riscv/vmm/vmm_fence.c optional vmm riscv/vmm/vmm_instruction_emul.c optional vmm riscv/vmm/vmm_riscv.c optional vmm riscv/vmm/vmm_sbi.c optional vmm diff --git a/sys/riscv/include/cpufunc.h b/sys/riscv/include/cpufunc.h index 8f5b87d24ce3..75b22632c546 100644 --- a/sys/riscv/include/cpufunc.h +++ b/sys/riscv/include/cpufunc.h @@ -104,6 +104,21 @@ sfence_vma_page(uintptr_t addr) __asm __volatile("sfence.vma %0" :: "r" (addr) : "memory"); } +static __inline void +sfence_vma_asid(uint64_t asid) +{ + + __asm __volatile("sfence.vma x0, %0" :: "r" (asid) : "memory"); +} + +static __inline void +sfence_vma_asid_page(uint64_t asid, uintptr_t addr) +{ + + __asm __volatile("sfence.vma %0, %1" :: "r" (addr), "r" (asid) + : "memory"); +} + #define rdcycle() csr_read64(cycle) #define rdtime() csr_read64(time) #define rdinstret() csr_read64(instret) diff --git a/sys/riscv/vmm/riscv.h b/sys/riscv/vmm/riscv.h index f3665d33a386..793c61534cee 100644 --- a/sys/riscv/vmm/riscv.h +++ b/sys/riscv/vmm/riscv.h @@ -67,6 +67,20 @@ struct hypcsr { uint64_t senvcfg; }; +enum vmm_fence_type { + VMM_RISCV_FENCE_INVALID = 0, + VMM_RISCV_FENCE_I, + VMM_RISCV_FENCE_VMA, + VMM_RISCV_FENCE_VMA_ASID, +}; + +struct vmm_fence { + enum vmm_fence_type type; + size_t start; + size_t size; + uint64_t asid; +}; + struct hypctx { struct hypregs host_regs; struct hypregs guest_regs; @@ -82,6 +96,14 @@ struct hypctx { int ipi_pending; int interrupts_pending; struct vtimer vtimer; + + struct vmm_fence *fence_queue; + struct mtx fence_queue_mtx; + int fence_queue_head; + int fence_queue_tail; +#define FENCE_REQ_I (1 << 0) +#define FENCE_REQ_VMA (1 << 1) + int fence_req; }; struct hyp { diff --git a/sys/riscv/vmm/vmm_fence.c b/sys/riscv/vmm/vmm_fence.c new file mode 100644 index 000000000000..6bba3f4b5dfe --- /dev/null +++ b/sys/riscv/vmm/vmm_fence.c @@ -0,0 +1,208 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2025 Ruslan Bukin + * + * This software was developed by the University of Cambridge Computer + * Laboratory (Department of Computer Science and Technology) under Innovate + * UK project 105694, "Digital Security by Design (DSbD) Technology Platform + * Prototype". + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +#include "riscv.h" +#include "vmm_fence.h" + +static bool +vmm_fence_dequeue(struct hypctx *hypctx, struct vmm_fence *new_fence) +{ + struct vmm_fence *queue; + struct vmm_fence *fence; + + mtx_lock_spin(&hypctx->fence_queue_mtx); + queue = hypctx->fence_queue; + fence = &queue[hypctx->fence_queue_head]; + if (fence->type != VMM_RISCV_FENCE_INVALID) { + *new_fence = *fence; + fence->type = VMM_RISCV_FENCE_INVALID; + hypctx->fence_queue_head = + (hypctx->fence_queue_head + 1) % VMM_FENCE_QUEUE_SIZE; + } else { + mtx_unlock_spin(&hypctx->fence_queue_mtx); + return (false); + } + mtx_unlock_spin(&hypctx->fence_queue_mtx); + + return (true); +} + +static bool +vmm_fence_enqueue(struct hypctx *hypctx, struct vmm_fence *new_fence) +{ + struct vmm_fence *queue; + struct vmm_fence *fence; + + mtx_lock_spin(&hypctx->fence_queue_mtx); + queue = hypctx->fence_queue; + fence = &queue[hypctx->fence_queue_tail]; + if (fence->type == VMM_RISCV_FENCE_INVALID) { + *fence = *new_fence; + hypctx->fence_queue_tail = + (hypctx->fence_queue_tail + 1) % VMM_FENCE_QUEUE_SIZE; + } else { + mtx_unlock_spin(&hypctx->fence_queue_mtx); + return (false); + } + mtx_unlock_spin(&hypctx->fence_queue_mtx); + + return (true); +} + +static void +vmm_fence_process_one(struct vmm_fence *fence) +{ + uint64_t va; + + KASSERT(fence->type == VMM_RISCV_FENCE_VMA || + fence->type == VMM_RISCV_FENCE_VMA_ASID, + ("%s: wrong fence type %d", __func__, fence->type)); + + switch (fence->type) { + case VMM_RISCV_FENCE_VMA: + for (va = fence->start; va < fence->start + fence->size; + va += PAGE_SIZE) + sfence_vma_page(va); + break; + case VMM_RISCV_FENCE_VMA_ASID: + if (fence->start == 0 && fence->size == 0) + sfence_vma_asid(fence->asid); + else + for (va = fence->start; va < fence->start + fence->size; + va += PAGE_SIZE) + sfence_vma_asid_page(fence->asid, va); + break; + default: + break; + } +} + +void +vmm_fence_process(struct hypctx *hypctx) +{ + struct vmm_fence fence; + int pending; + + pending = atomic_readandclear_32(&hypctx->fence_req); + + KASSERT((pending & ~(FENCE_REQ_I | FENCE_REQ_VMA)) == 0, + ("wrong fence bit mask")); + + if (pending & FENCE_REQ_I) + fence_i(); + + if (pending & FENCE_REQ_VMA) + sfence_vma(); + + while (vmm_fence_dequeue(hypctx, &fence) == true) + vmm_fence_process_one(&fence); +} + +void +vmm_fence_add(struct vm *vm, cpuset_t *cpus, struct vmm_fence *fence) +{ + struct hypctx *hypctx; + cpuset_t running_cpus; + struct vcpu *vcpu; + uint16_t maxcpus; + int hostcpu; + int state; + bool enq; + int i; + + CPU_ZERO(&running_cpus); + + maxcpus = vm_get_maxcpus(vm); + for (i = 0; i < maxcpus; i++) { + if (!CPU_ISSET(i, cpus)) + continue; + vcpu = vm_vcpu(vm, i); + hypctx = vcpu_get_cookie(vcpu); + + enq = false; + + /* No need to enqueue fences i and vma global. */ + switch (fence->type) { + case VMM_RISCV_FENCE_I: + atomic_set_32(&hypctx->fence_req, FENCE_REQ_I); + break; + case VMM_RISCV_FENCE_VMA: + if (fence->start == 0 && fence->size == 0) + atomic_set_32(&hypctx->fence_req, + FENCE_REQ_VMA); + else + enq = true; + break; + case VMM_RISCV_FENCE_VMA_ASID: + enq = true; + break; + default: + KASSERT(0, ("%s: wrong fence type %d", __func__, + fence->type)); + break; + } + + /* + * Try to enqueue. In case of failure use more conservative + * request. + */ + if (enq) + if (vmm_fence_enqueue(hypctx, fence) == false) + atomic_set_32(&hypctx->fence_req, + FENCE_REQ_VMA); + + mb(); + + state = vcpu_get_state(vcpu, &hostcpu); + if (state == VCPU_RUNNING) + CPU_SET(hostcpu, &running_cpus); + } + + /* + * Interrupt other cores. On reception of IPI they will leave guest. + * On entry back to the guest they will process fence request. + * + * If vcpu migrates to another cpu right here, it should process + * all fences on entry to the guest as well. + */ + if (!CPU_EMPTY(&running_cpus)) + smp_rendezvous_cpus(running_cpus, NULL, NULL, NULL, NULL); +} diff --git a/sys/riscv/vmm/vmm_fence.h b/sys/riscv/vmm/vmm_fence.h new file mode 100644 index 000000000000..05d4466fd634 --- /dev/null +++ b/sys/riscv/vmm/vmm_fence.h @@ -0,0 +1,43 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2025 Ruslan Bukin + * + * This software was developed by the University of Cambridge Computer + * Laboratory (Department of Computer Science and Technology) under Innovate + * UK project 105694, "Digital Security by Design (DSbD) Technology Platform + * Prototype". + * + * 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. + */ + +#ifndef _VMM_FENCE_H_ +#define _VMM_FENCE_H_ + +struct hypctx; + +#define VMM_FENCE_QUEUE_SIZE 128 + +void vmm_fence_process(struct hypctx *hypctx); +void vmm_fence_add(struct vm *vm, cpuset_t *cpus, struct vmm_fence *fence); + +#endif /* !_VMM_FENCE_H_ */ diff --git a/sys/riscv/vmm/vmm_riscv.c b/sys/riscv/vmm/vmm_riscv.c index 6ac945dfa1d0..78250ae7c440 100644 --- a/sys/riscv/vmm/vmm_riscv.c +++ b/sys/riscv/vmm/vmm_riscv.c @@ -68,6 +68,7 @@ #include "riscv.h" #include "vmm_aplic.h" +#include "vmm_fence.h" #include "vmm_stat.h" MALLOC_DEFINE(M_HYP, "RISC-V VMM HYP", "RISC-V VMM HYP"); @@ -212,6 +213,11 @@ vmmops_vcpu_init(void *vmi, struct vcpu *vcpu1, int vcpuid) hypctx->vcpu = vcpu1; hypctx->guest_scounteren = HCOUNTEREN_CY | HCOUNTEREN_TM; + /* Fence queue. */ + hypctx->fence_queue = mallocarray(VMM_FENCE_QUEUE_SIZE, + sizeof(struct vmm_fence), M_HYP, M_WAITOK | M_ZERO); + mtx_init(&hypctx->fence_queue_mtx, "fence queue", NULL, MTX_SPIN); + /* sstatus */ hypctx->guest_regs.hyp_sstatus = SSTATUS_SPP | SSTATUS_SPIE; hypctx->guest_regs.hyp_sstatus |= SSTATUS_FS_INITIAL; @@ -659,6 +665,7 @@ vmmops_run(void *vcpui, register_t pc, pmap_t pmap, struct vm_eventinfo *evinfo) riscv_set_active_vcpu(hypctx); aplic_flush_hwstate(hypctx); riscv_sync_interrupts(hypctx); + vmm_fence_process(hypctx); dprintf("%s: Entering guest VM, vsatp %lx, ss %lx hs %lx\n", __func__, csr_read(vsatp), hypctx->guest_regs.hyp_sstatus, @@ -740,6 +747,8 @@ vmmops_vcpu_cleanup(void *vcpui) aplic_cpucleanup(hypctx); + mtx_destroy(&hypctx->fence_queue_mtx); + free(hypctx->fence_queue, M_HYP); free(hypctx, M_HYP); } diff --git a/sys/riscv/vmm/vmm_sbi.c b/sys/riscv/vmm/vmm_sbi.c index 63dcf9b4a7ae..586eb7c4d41c 100644 --- a/sys/riscv/vmm/vmm_sbi.c +++ b/sys/riscv/vmm/vmm_sbi.c @@ -58,39 +58,65 @@ #include #include "riscv.h" +#include "vmm_fence.h" static int vmm_sbi_handle_rfnc(struct vcpu *vcpu, struct hypctx *hypctx) { - uint64_t hart_mask __unused; - uint64_t start __unused; - uint64_t size __unused; - uint64_t asid __unused; + struct vmm_fence fence; + uint64_t hart_mask; + uint64_t hart_mask_base; uint64_t func_id; + struct hyp *hyp; + uint16_t maxcpus; + cpuset_t cpus; + int vcpu_id; + int i; func_id = hypctx->guest_regs.hyp_a[6]; hart_mask = hypctx->guest_regs.hyp_a[0]; - start = hypctx->guest_regs.hyp_a[2]; - size = hypctx->guest_regs.hyp_a[3]; - asid = hypctx->guest_regs.hyp_a[4]; + hart_mask_base = hypctx->guest_regs.hyp_a[1]; - dprintf("%s: %ld hart_mask %lx start %lx size %lx\n", __func__, - func_id, hart_mask, start, size); + /* Construct vma_fence. */ - /* TODO: implement remote sfence. */ + fence.start = hypctx->guest_regs.hyp_a[2]; + fence.size = hypctx->guest_regs.hyp_a[3]; + fence.asid = hypctx->guest_regs.hyp_a[4]; switch (func_id) { case SBI_RFNC_REMOTE_FENCE_I: + fence.type = VMM_RISCV_FENCE_I; break; case SBI_RFNC_REMOTE_SFENCE_VMA: + fence.type = VMM_RISCV_FENCE_VMA; break; case SBI_RFNC_REMOTE_SFENCE_VMA_ASID: + fence.type = VMM_RISCV_FENCE_VMA_ASID; break; default: - break; + return (-1); + } + + /* Construct cpuset_t from the mask supplied. */ + + CPU_ZERO(&cpus); + hyp = hypctx->hyp; + maxcpus = vm_get_maxcpus(hyp->vm); + for (i = 0; i < maxcpus; i++) { + vcpu = vm_vcpu(hyp->vm, i); + if (vcpu == NULL) + continue; + vcpu_id = vcpu_vcpuid(vcpu); + if (hart_mask_base != -1UL) { + if (vcpu_id < hart_mask_base) + continue; + if (!(hart_mask & (1UL << (vcpu_id - hart_mask_base)))) + continue; + } + CPU_SET(i, &cpus); } - hypctx->guest_regs.hyp_a[0] = 0; + vmm_fence_add(hyp->vm, &cpus, &fence); return (0); } @@ -172,6 +198,7 @@ vmm_sbi_ecall(struct vcpu *vcpu, bool *retu) { int sbi_extension_id __unused; struct hypctx *hypctx; + int error; hypctx = riscv_get_active_vcpu(); sbi_extension_id = hypctx->guest_regs.hyp_a[7]; @@ -188,7 +215,8 @@ vmm_sbi_ecall(struct vcpu *vcpu, bool *retu) switch (sbi_extension_id) { case SBI_EXT_ID_RFNC: - vmm_sbi_handle_rfnc(vcpu, hypctx); + error = vmm_sbi_handle_rfnc(vcpu, hypctx); + hypctx->guest_regs.hyp_a[0] = error; break; case SBI_EXT_ID_TIME: vmm_sbi_handle_time(vcpu, hypctx); From nobody Tue Jan 21 12:03:56 2025 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 4Ycm8F0drSz5l0wS; Tue, 21 Jan 2025 12:03: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 4Ycm8F0HVVz3g5Y; Tue, 21 Jan 2025 12:03:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737461037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aDqMJ5CdBt8PUtb0phgtUySQ5WlgquXRjY4oGxIN0Kw=; b=lxQp7pkPNqu7TyxbO8iovDlGm9dTowP67s5ySaBSDnaFaZo8vT8GZs6lb2ha5UIgrK6pJJ 2jiexcKsY7zBS6eLoouexK+9EnnWSDg60qWEpJEUSoeXFcIJtSy6fgu54hxlHbuISxo8DP VLWN379yQW7f3H527US7JAufPaPcXOCcWPtdBT9c4/bF0Q5LVpB6fmphexcHbnW+r9kmuD eqJtcJdXdY3oBl/vor4uddfS814eXIlGFfqfeUfoqyA+Exq8Lew7xofm1yiIB6ZrT4ft2V SK0c9jDLvtNTlJyLqXkYqAxKF56paW0DhxSQz/jYSlCdLF3xV3tR1wi2Dp6F6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737461037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aDqMJ5CdBt8PUtb0phgtUySQ5WlgquXRjY4oGxIN0Kw=; b=d7q5HHTZ2+il6GEYn9AwfV+9ZfLfZLxr2aSbeZPd/hSeSraBJaDuqPa2Iko7Hopp1uViex DqwFysVBAM2GzypAPXfGMNxHphHgcbRSJUeUIWIoUj2dNQemMFJlhdjm/n3EgrWZizf22S SG5D9lz7qqCnTlcRnQZSwf5Dm7tEKpcpYsM3ywNgwxmiCO/cEKY1JXmhh5CbH4s42C1+6n f/TD5N2GTBPhmfNHA4sQTjwSqu5fxQoCVfGdUQ1RVhfw3UFsPazhqHJfKdS1vk1hsub+Un C2eLAyuXDAP9MLFES1OKUKjSZD2KliXaAFwVEQNuKcTP7ghKJVdjJlvfcjdA3w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737461037; a=rsa-sha256; cv=none; b=gIL3hB9OFA0GdxZF7b1oXhKQ14jhq27qZn3swsfrsGvS3IeC4d5f18cpCztKzRc/R51bQA Gh1e3H7H2c8pUj06niezDrfYI8LfybAkXGOEHvTNBtq22SFYsPQ7Ld/fsN3T8oWN2aaiKV g7frrG3yS3t3cNkWpuoB+4BI0VSrOlVOSk12rZFBJvBIbVZk4V7vp0FxM+7VBitqomCG7m J7q0Yqws5IwRJtRLc/lsezqpsEvnzbLjWFxfJQ8QOuRpS1Qgi++/Q+KGlCQXWzjFEqlZJ5 wj6E8PXKfXkd6dM3x7bcSqpVSyaMMYILLKMMeJqDtRsvZtupopcMCK3US7STDQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ycm8D6zlDz14wW; Tue, 21 Jan 2025 12:03: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 50LC3uDY023267; Tue, 21 Jan 2025 12:03:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LC3uWL023264; Tue, 21 Jan 2025 12:03:56 GMT (envelope-from git) Date: Tue, 21 Jan 2025 12:03:56 GMT Message-Id: <202501211203.50LC3uWL023264@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 27ef5d48c729 - main - sound: Unit test the pcm sample read and write macros 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 27ef5d48c729defb83a8822143dc71ab17f9d68b Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=27ef5d48c729defb83a8822143dc71ab17f9d68b commit 27ef5d48c729defb83a8822143dc71ab17f9d68b Author: Florian Walpen AuthorDate: 2025-01-21 11:58:05 +0000 Commit: Christos Margiolis CommitDate: 2025-01-21 12:00:36 +0000 sound: Unit test the pcm sample read and write macros Main goal is to have a unit test, with sample test data that is verified against the current macro implementation of pcm sample read and write functions. With a test in place, we can proceed on a planned refactoring of the sample read and write code, and confidently check the new code for regressions. Implementation of the unit test itself has to avoid any cast or conversion affected by endianness, to make the tests compatible with all machine architectures. MFC after: 1 week Reviewed by: christos, markj Differential Revision: https://reviews.freebsd.org/D48330 --- sys/dev/sound/pcm/sound.h | 128 +++++----- tests/sys/sound/Makefile | 4 + tests/sys/sound/pcm_read_write.c | 509 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 577 insertions(+), 64 deletions(-) diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index fe04898c17a5..019fe67ac892 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -147,70 +147,6 @@ struct snd_mixer; #define RANGE(var, low, high) (var) = \ (((var)<(low))? (low) : ((var)>(high))? (high) : (var)) -/* make figuring out what a format is easier. got AFMT_STEREO already */ -#define AFMT_32BIT (AFMT_S32_LE | AFMT_S32_BE | AFMT_U32_LE | AFMT_U32_BE) -#define AFMT_24BIT (AFMT_S24_LE | AFMT_S24_BE | AFMT_U24_LE | AFMT_U24_BE) -#define AFMT_16BIT (AFMT_S16_LE | AFMT_S16_BE | AFMT_U16_LE | AFMT_U16_BE) -#define AFMT_G711 (AFMT_MU_LAW | AFMT_A_LAW) -#define AFMT_8BIT (AFMT_G711 | AFMT_U8 | AFMT_S8) -#define AFMT_SIGNED (AFMT_S32_LE | AFMT_S32_BE | AFMT_S24_LE | AFMT_S24_BE | \ - AFMT_S16_LE | AFMT_S16_BE | AFMT_S8) -#define AFMT_BIGENDIAN (AFMT_S32_BE | AFMT_U32_BE | AFMT_S24_BE | AFMT_U24_BE | \ - AFMT_S16_BE | AFMT_U16_BE) - -#define AFMT_CONVERTIBLE (AFMT_8BIT | AFMT_16BIT | AFMT_24BIT | \ - AFMT_32BIT) - -/* Supported vchan mixing formats */ -#define AFMT_VCHAN (AFMT_CONVERTIBLE & ~AFMT_G711) - -#define AFMT_PASSTHROUGH AFMT_AC3 -#define AFMT_PASSTHROUGH_RATE 48000 -#define AFMT_PASSTHROUGH_CHANNEL 2 -#define AFMT_PASSTHROUGH_EXTCHANNEL 0 - -/* - * We're simply using unused, contiguous bits from various AFMT_ definitions. - * ~(0xb00ff7ff) - */ -#define AFMT_ENCODING_MASK 0xf00fffff -#define AFMT_CHANNEL_MASK 0x07f00000 -#define AFMT_CHANNEL_SHIFT 20 -#define AFMT_CHANNEL_MAX 0x7f -#define AFMT_EXTCHANNEL_MASK 0x08000000 -#define AFMT_EXTCHANNEL_SHIFT 27 -#define AFMT_EXTCHANNEL_MAX 1 - -#define AFMT_ENCODING(v) ((v) & AFMT_ENCODING_MASK) - -#define AFMT_EXTCHANNEL(v) (((v) & AFMT_EXTCHANNEL_MASK) >> \ - AFMT_EXTCHANNEL_SHIFT) - -#define AFMT_CHANNEL(v) (((v) & AFMT_CHANNEL_MASK) >> \ - AFMT_CHANNEL_SHIFT) - -#define AFMT_BIT(v) (((v) & AFMT_32BIT) ? 32 : \ - (((v) & AFMT_24BIT) ? 24 : \ - ((((v) & AFMT_16BIT) || \ - ((v) & AFMT_PASSTHROUGH)) ? 16 : 8))) - -#define AFMT_BPS(v) (AFMT_BIT(v) >> 3) -#define AFMT_ALIGN(v) (AFMT_BPS(v) * AFMT_CHANNEL(v)) - -#define SND_FORMAT(f, c, e) (AFMT_ENCODING(f) | \ - (((c) << AFMT_CHANNEL_SHIFT) & \ - AFMT_CHANNEL_MASK) | \ - (((e) << AFMT_EXTCHANNEL_SHIFT) & \ - AFMT_EXTCHANNEL_MASK)) - -#define AFMT_U8_NE AFMT_U8 -#define AFMT_S8_NE AFMT_S8 - -#define AFMT_SIGNED_NE (AFMT_S8_NE | AFMT_S16_NE | AFMT_S24_NE | AFMT_S32_NE) - -#define AFMT_NE (AFMT_SIGNED_NE | AFMT_U8_NE | AFMT_U16_NE | \ - AFMT_U24_NE | AFMT_U32_NE) - enum { SND_DEV_CTL = 0, /* Control port /dev/mixer */ SND_DEV_SEQ, /* Sequencer /dev/sequencer */ @@ -508,4 +444,68 @@ int sound_oss_card_info(oss_card_info *); #endif /* _KERNEL */ +/* make figuring out what a format is easier. got AFMT_STEREO already */ +#define AFMT_32BIT (AFMT_S32_LE | AFMT_S32_BE | AFMT_U32_LE | AFMT_U32_BE) +#define AFMT_24BIT (AFMT_S24_LE | AFMT_S24_BE | AFMT_U24_LE | AFMT_U24_BE) +#define AFMT_16BIT (AFMT_S16_LE | AFMT_S16_BE | AFMT_U16_LE | AFMT_U16_BE) +#define AFMT_G711 (AFMT_MU_LAW | AFMT_A_LAW) +#define AFMT_8BIT (AFMT_G711 | AFMT_U8 | AFMT_S8) +#define AFMT_SIGNED (AFMT_S32_LE | AFMT_S32_BE | AFMT_S24_LE | AFMT_S24_BE | \ + AFMT_S16_LE | AFMT_S16_BE | AFMT_S8) +#define AFMT_BIGENDIAN (AFMT_S32_BE | AFMT_U32_BE | AFMT_S24_BE | AFMT_U24_BE | \ + AFMT_S16_BE | AFMT_U16_BE) + +#define AFMT_CONVERTIBLE (AFMT_8BIT | AFMT_16BIT | AFMT_24BIT | \ + AFMT_32BIT) + +/* Supported vchan mixing formats */ +#define AFMT_VCHAN (AFMT_CONVERTIBLE & ~AFMT_G711) + +#define AFMT_PASSTHROUGH AFMT_AC3 +#define AFMT_PASSTHROUGH_RATE 48000 +#define AFMT_PASSTHROUGH_CHANNEL 2 +#define AFMT_PASSTHROUGH_EXTCHANNEL 0 + +/* + * We're simply using unused, contiguous bits from various AFMT_ definitions. + * ~(0xb00ff7ff) + */ +#define AFMT_ENCODING_MASK 0xf00fffff +#define AFMT_CHANNEL_MASK 0x07f00000 +#define AFMT_CHANNEL_SHIFT 20 +#define AFMT_CHANNEL_MAX 0x7f +#define AFMT_EXTCHANNEL_MASK 0x08000000 +#define AFMT_EXTCHANNEL_SHIFT 27 +#define AFMT_EXTCHANNEL_MAX 1 + +#define AFMT_ENCODING(v) ((v) & AFMT_ENCODING_MASK) + +#define AFMT_EXTCHANNEL(v) (((v) & AFMT_EXTCHANNEL_MASK) >> \ + AFMT_EXTCHANNEL_SHIFT) + +#define AFMT_CHANNEL(v) (((v) & AFMT_CHANNEL_MASK) >> \ + AFMT_CHANNEL_SHIFT) + +#define AFMT_BIT(v) (((v) & AFMT_32BIT) ? 32 : \ + (((v) & AFMT_24BIT) ? 24 : \ + ((((v) & AFMT_16BIT) || \ + ((v) & AFMT_PASSTHROUGH)) ? 16 : 8))) + +#define AFMT_BPS(v) (AFMT_BIT(v) >> 3) +#define AFMT_ALIGN(v) (AFMT_BPS(v) * AFMT_CHANNEL(v)) + +#define SND_FORMAT(f, c, e) (AFMT_ENCODING(f) | \ + (((c) << AFMT_CHANNEL_SHIFT) & \ + AFMT_CHANNEL_MASK) | \ + (((e) << AFMT_EXTCHANNEL_SHIFT) & \ + AFMT_EXTCHANNEL_MASK)) + +#define AFMT_U8_NE AFMT_U8 +#define AFMT_S8_NE AFMT_S8 + +#define AFMT_SIGNED_NE (AFMT_S8_NE | AFMT_S16_NE | AFMT_S24_NE | AFMT_S32_NE) + +#define AFMT_NE (AFMT_SIGNED_NE | AFMT_U8_NE | AFMT_U16_NE | \ + AFMT_U24_NE | AFMT_U32_NE) + #endif /* _OS_H_ */ diff --git a/tests/sys/sound/Makefile b/tests/sys/sound/Makefile index fb731fb8ab61..74a0765a0540 100644 --- a/tests/sys/sound/Makefile +++ b/tests/sys/sound/Makefile @@ -2,8 +2,12 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/sound +ATF_TESTS_C+= pcm_read_write ATF_TESTS_C+= sndstat +CFLAGS+= -I${SRCTOP}/sys LDFLAGS+= -lnv +CFLAGS.pcm_read_write.c+= -Wno-cast-align + .include diff --git a/tests/sys/sound/pcm_read_write.c b/tests/sys/sound/pcm_read_write.c new file mode 100644 index 000000000000..6bdc578615b5 --- /dev/null +++ b/tests/sys/sound/pcm_read_write.c @@ -0,0 +1,509 @@ +/*- + * Copyright (c) 2025 Florian Walpen + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +/* + * These tests exercise conversion functions of the sound module, used to read + * pcm samples from a buffer, and write pcm samples to a buffer. The test cases + * are non-exhaustive, but should detect systematic errors in conversion of the + * various sample formats supported. In particular, the test cases establish + * correctness independent of the machine's endianness, making them suitable to + * check for architecture-specific problems. + */ + +#include +#include + +#include +#include +#include + +#include +#include +#include + +/* Generic test data, with buffer content matching the sample values. */ +struct afmt_test_data { + const char *label; + uint8_t buffer[4]; + size_t size; + int format; + intpcm_t value; + _Static_assert((sizeof(intpcm_t) == 4), + "Test data assumes 32bit, adjust negative values to new size."); +} static const afmt_tests[] = { + /* 8 bit sample formats. */ + {"s8_1", {0x01, 0x00, 0x00, 0x00}, 1, AFMT_S8, 0x00000001}, + {"s8_2", {0x81, 0x00, 0x00, 0x00}, 1, AFMT_S8, 0xffffff81}, + {"u8_1", {0x01, 0x00, 0x00, 0x00}, 1, AFMT_U8, 0xffffff81}, + {"u8_2", {0x81, 0x00, 0x00, 0x00}, 1, AFMT_U8, 0x00000001}, + + /* 16 bit sample formats. */ + {"s16le_1", {0x01, 0x02, 0x00, 0x00}, 2, AFMT_S16_LE, 0x00000201}, + {"s16le_2", {0x81, 0x82, 0x00, 0x00}, 2, AFMT_S16_LE, 0xffff8281}, + {"s16be_1", {0x01, 0x02, 0x00, 0x00}, 2, AFMT_S16_BE, 0x00000102}, + {"s16be_2", {0x81, 0x82, 0x00, 0x00}, 2, AFMT_S16_BE, 0xffff8182}, + {"u16le_1", {0x01, 0x02, 0x00, 0x00}, 2, AFMT_U16_LE, 0xffff8201}, + {"u16le_2", {0x81, 0x82, 0x00, 0x00}, 2, AFMT_U16_LE, 0x00000281}, + {"u16be_1", {0x01, 0x02, 0x00, 0x00}, 2, AFMT_U16_BE, 0xffff8102}, + {"u16be_2", {0x81, 0x82, 0x00, 0x00}, 2, AFMT_U16_BE, 0x00000182}, + + /* 24 bit sample formats. */ + {"s24le_1", {0x01, 0x02, 0x03, 0x00}, 3, AFMT_S24_LE, 0x00030201}, + {"s24le_2", {0x81, 0x82, 0x83, 0x00}, 3, AFMT_S24_LE, 0xff838281}, + {"s24be_1", {0x01, 0x02, 0x03, 0x00}, 3, AFMT_S24_BE, 0x00010203}, + {"s24be_2", {0x81, 0x82, 0x83, 0x00}, 3, AFMT_S24_BE, 0xff818283}, + {"u24le_1", {0x01, 0x02, 0x03, 0x00}, 3, AFMT_U24_LE, 0xff830201}, + {"u24le_2", {0x81, 0x82, 0x83, 0x00}, 3, AFMT_U24_LE, 0x00038281}, + {"u24be_1", {0x01, 0x02, 0x03, 0x00}, 3, AFMT_U24_BE, 0xff810203}, + {"u24be_2", {0x81, 0x82, 0x83, 0x00}, 3, AFMT_U24_BE, 0x00018283}, + + /* 32 bit sample formats. */ + {"s32le_1", {0x01, 0x02, 0x03, 0x04}, 4, AFMT_S32_LE, 0x04030201}, + {"s32le_2", {0x81, 0x82, 0x83, 0x84}, 4, AFMT_S32_LE, 0x84838281}, + {"s32be_1", {0x01, 0x02, 0x03, 0x04}, 4, AFMT_S32_BE, 0x01020304}, + {"s32be_2", {0x81, 0x82, 0x83, 0x84}, 4, AFMT_S32_BE, 0x81828384}, + {"u32le_1", {0x01, 0x02, 0x03, 0x04}, 4, AFMT_U32_LE, 0x84030201}, + {"u32le_2", {0x81, 0x82, 0x83, 0x84}, 4, AFMT_U32_LE, 0x04838281}, + {"u32be_1", {0x01, 0x02, 0x03, 0x04}, 4, AFMT_U32_BE, 0x81020304}, + {"u32be_2", {0x81, 0x82, 0x83, 0x84}, 4, AFMT_U32_BE, 0x01828384}, + + /* u-law and A-law sample formats. */ + {"mulaw_1", {0x01, 0x00, 0x00, 0x00}, 1, AFMT_MU_LAW, 0xffffff87}, + {"mulaw_2", {0x81, 0x00, 0x00, 0x00}, 1, AFMT_MU_LAW, 0x00000079}, + {"alaw_1", {0x2a, 0x00, 0x00, 0x00}, 1, AFMT_A_LAW, 0xffffff83}, + {"alaw_2", {0xab, 0x00, 0x00, 0x00}, 1, AFMT_A_LAW, 0x00000079} +}; + +/* Normalize sample values in strictly correct (but slow) c. */ +static intpcm_t +local_normalize(intpcm_t value, int val_bits, int norm_bits) +{ + /* Avoid undefined or implementation defined behavior. */ + if (val_bits < norm_bits) + /* Multiply instead of left shift (value may be negative). */ + return (value * (1 << (norm_bits - val_bits))); + else if (val_bits > norm_bits) + /* Divide instead of right shift (value may be negative). */ + return (value / (1 << (val_bits - norm_bits))); + return value; +} + +/* Restrict magnitude of sample value to 24bit for 32bit calculations. */ +static intpcm_t +local_calc_limit(intpcm_t value, int val_bits) +{ + /* Avoid implementation defined behavior. */ + if (sizeof(intpcm32_t) == 32 && val_bits == 32) + /* Divide instead of right shift (value may be negative). */ + return (value / (1 << 8)); + return value; +} + +/* Lookup tables to read u-law and A-law sample formats. */ +static const uint8_t ulaw_to_u8[G711_TABLE_SIZE] = ULAW_TO_U8; +static const uint8_t alaw_to_u8[G711_TABLE_SIZE] = ALAW_TO_U8; + +/* Helper function to read one sample value from a buffer. */ +static intpcm_t +local_pcm_read(uint8_t *src, uint32_t format) +{ + intpcm_t value; + + switch (format) { + case AFMT_S8: + value = _PCM_READ_S8_NE(src); + break; + case AFMT_U8: + value = _PCM_READ_U8_NE(src); + break; + case AFMT_S16_LE: + value = _PCM_READ_S16_LE(src); + break; + case AFMT_S16_BE: + value = _PCM_READ_S16_BE(src); + break; + case AFMT_U16_LE: + value = _PCM_READ_U16_LE(src); + break; + case AFMT_U16_BE: + value = _PCM_READ_U16_BE(src); + break; + case AFMT_S24_LE: + value = _PCM_READ_S24_LE(src); + break; + case AFMT_S24_BE: + value = _PCM_READ_S24_BE(src); + break; + case AFMT_U24_LE: + value = _PCM_READ_U24_LE(src); + break; + case AFMT_U24_BE: + value = _PCM_READ_U24_BE(src); + break; + case AFMT_S32_LE: + value = _PCM_READ_S32_LE(src); + break; + case AFMT_S32_BE: + value = _PCM_READ_S32_BE(src); + break; + case AFMT_U32_LE: + value = _PCM_READ_U32_LE(src); + break; + case AFMT_U32_BE: + value = _PCM_READ_U32_BE(src); + break; + case AFMT_MU_LAW: + value = _G711_TO_INTPCM(ulaw_to_u8, *src); + break; + case AFMT_A_LAW: + value = _G711_TO_INTPCM(alaw_to_u8, *src); + break; + default: + value = 0; + } + + return (value); +} + +/* Helper function to read one sample value from a buffer for calculations. */ +static intpcm_t +local_pcm_read_calc(uint8_t *src, uint32_t format) +{ + intpcm_t value; + + switch (format) { + case AFMT_S8: + value = PCM_READ_S8_NE(src); + break; + case AFMT_U8: + value = PCM_READ_U8_NE(src); + break; + case AFMT_S16_LE: + value = PCM_READ_S16_LE(src); + break; + case AFMT_S16_BE: + value = PCM_READ_S16_BE(src); + break; + case AFMT_U16_LE: + value = PCM_READ_U16_LE(src); + break; + case AFMT_U16_BE: + value = PCM_READ_U16_BE(src); + break; + case AFMT_S24_LE: + value = PCM_READ_S24_LE(src); + break; + case AFMT_S24_BE: + value = PCM_READ_S24_BE(src); + break; + case AFMT_U24_LE: + value = PCM_READ_U24_LE(src); + break; + case AFMT_U24_BE: + value = PCM_READ_U24_BE(src); + break; + case AFMT_S32_LE: + value = PCM_READ_S32_LE(src); + break; + case AFMT_S32_BE: + value = PCM_READ_S32_BE(src); + break; + case AFMT_U32_LE: + value = PCM_READ_U32_LE(src); + break; + case AFMT_U32_BE: + value = PCM_READ_U32_BE(src); + break; + case AFMT_MU_LAW: + value = _G711_TO_INTPCM(ulaw_to_u8, *src); + break; + case AFMT_A_LAW: + value = _G711_TO_INTPCM(alaw_to_u8, *src); + break; + default: + value = 0; + } + + return (value); +} + +/* Helper function to read one normalized sample from a buffer. */ +static intpcm_t +local_pcm_read_norm(uint8_t *src, uint32_t format) +{ + intpcm_t value; + + value = local_pcm_read(src, format); + value <<= (32 - AFMT_BIT(format)); + return (value); +} + +/* Lookup tables to write u-law and A-law sample formats. */ +static const uint8_t u8_to_ulaw[G711_TABLE_SIZE] = U8_TO_ULAW; +static const uint8_t u8_to_alaw[G711_TABLE_SIZE] = U8_TO_ALAW; + +/* Helper function to write one sample value to a buffer. */ +static void +local_pcm_write(uint8_t *dst, intpcm_t value, uint32_t format) +{ + switch (format) { + case AFMT_S8: + _PCM_WRITE_S8_NE(dst, value); + break; + case AFMT_U8: + _PCM_WRITE_U8_NE(dst, value); + break; + case AFMT_S16_LE: + _PCM_WRITE_S16_LE(dst, value); + break; + case AFMT_S16_BE: + _PCM_WRITE_S16_BE(dst, value); + break; + case AFMT_U16_LE: + _PCM_WRITE_U16_LE(dst, value); + break; + case AFMT_U16_BE: + _PCM_WRITE_U16_BE(dst, value); + break; + case AFMT_S24_LE: + _PCM_WRITE_S24_LE(dst, value); + break; + case AFMT_S24_BE: + _PCM_WRITE_S24_BE(dst, value); + break; + case AFMT_U24_LE: + _PCM_WRITE_U24_LE(dst, value); + break; + case AFMT_U24_BE: + _PCM_WRITE_U24_BE(dst, value); + break; + case AFMT_S32_LE: + _PCM_WRITE_S32_LE(dst, value); + break; + case AFMT_S32_BE: + _PCM_WRITE_S32_BE(dst, value); + break; + case AFMT_U32_LE: + _PCM_WRITE_U32_LE(dst, value); + break; + case AFMT_U32_BE: + _PCM_WRITE_U32_BE(dst, value); + break; + case AFMT_MU_LAW: + *dst = _INTPCM_TO_G711(u8_to_ulaw, value); + break; + case AFMT_A_LAW: + *dst = _INTPCM_TO_G711(u8_to_alaw, value); + break; + default: + value = 0; + } +} + +/* Helper function to write one calculation sample value to a buffer. */ +static void +local_pcm_write_calc(uint8_t *dst, intpcm_t value, uint32_t format) +{ + switch (format) { + case AFMT_S8: + PCM_WRITE_S8_NE(dst, value); + break; + case AFMT_U8: + PCM_WRITE_U8_NE(dst, value); + break; + case AFMT_S16_LE: + PCM_WRITE_S16_LE(dst, value); + break; + case AFMT_S16_BE: + PCM_WRITE_S16_BE(dst, value); + break; + case AFMT_U16_LE: + PCM_WRITE_U16_LE(dst, value); + break; + case AFMT_U16_BE: + PCM_WRITE_U16_BE(dst, value); + break; + case AFMT_S24_LE: + PCM_WRITE_S24_LE(dst, value); + break; + case AFMT_S24_BE: + PCM_WRITE_S24_BE(dst, value); + break; + case AFMT_U24_LE: + PCM_WRITE_U24_LE(dst, value); + break; + case AFMT_U24_BE: + PCM_WRITE_U24_BE(dst, value); + break; + case AFMT_S32_LE: + PCM_WRITE_S32_LE(dst, value); + break; + case AFMT_S32_BE: + PCM_WRITE_S32_BE(dst, value); + break; + case AFMT_U32_LE: + PCM_WRITE_U32_LE(dst, value); + break; + case AFMT_U32_BE: + PCM_WRITE_U32_BE(dst, value); + break; + case AFMT_MU_LAW: + *dst = _INTPCM_TO_G711(u8_to_ulaw, value); + break; + case AFMT_A_LAW: + *dst = _INTPCM_TO_G711(u8_to_alaw, value); + break; + default: + value = 0; + } +} + +/* Helper function to write one normalized sample to a buffer. */ +static void +local_pcm_write_norm(uint8_t *dst, intpcm_t value, uint32_t format) +{ + local_pcm_write(dst, value >> (32 - AFMT_BIT(format)), format); +} + +ATF_TC(pcm_read); +ATF_TC_HEAD(pcm_read, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Read and verify different pcm sample formats."); +} +ATF_TC_BODY(pcm_read, tc) +{ + const struct afmt_test_data *test; + uint8_t src[4]; + intpcm_t expected, result; + size_t i; + + for (i = 0; i < nitems(afmt_tests); i++) { + test = &afmt_tests[i]; + + /* Copy byte representation, fill with distinctive pattern. */ + memset(src, 0x66, sizeof(src)); + memcpy(src, test->buffer, test->size); + + /* Read sample at format magnitude. */ + expected = test->value; + result = local_pcm_read(src, test->format); + ATF_CHECK_MSG(result == expected, + "pcm_read[\"%s\"].value: expected=0x%08x, result=0x%08x", + test->label, expected, result); + + /* Read sample at format magnitude, for calculations. */ + expected = local_calc_limit(test->value, test->size * 8); + result = local_pcm_read_calc(src, test->format); + ATF_CHECK_MSG(result == expected, + "pcm_read[\"%s\"].calc: expected=0x%08x, result=0x%08x", + test->label, expected, result); + + /* Read sample at full 32 bit magnitude. */ + expected = local_normalize(test->value, test->size * 8, 32); + result = local_pcm_read_norm(src, test->format); + ATF_CHECK_MSG(result == expected, + "pcm_read[\"%s\"].norm: expected=0x%08x, result=0x%08x", + test->label, expected, result); + } +} + +ATF_TC(pcm_write); +ATF_TC_HEAD(pcm_write, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Write and verify different pcm sample formats."); +} +ATF_TC_BODY(pcm_write, tc) +{ + const struct afmt_test_data *test; + uint8_t expected[4]; + uint8_t dst[4]; + intpcm_t value; + size_t i; + + for (i = 0; i < nitems(afmt_tests); i++) { + test = &afmt_tests[i]; + + /* Write sample of format specific magnitude. */ + memcpy(expected, test->buffer, sizeof(expected)); + memset(dst, 0x00, sizeof(dst)); + value = test->value; + local_pcm_write(dst, value, test->format); + ATF_CHECK_MSG(memcmp(dst, expected, sizeof(dst)) == 0, + "pcm_write[\"%s\"].value: " + "expected={0x%02x, 0x%02x, 0x%02x, 0x%02x}, " + "result={0x%02x, 0x%02x, 0x%02x, 0x%02x}, ", test->label, + expected[0], expected[1], expected[2], expected[3], + dst[0], dst[1], dst[2], dst[3]); + + /* Write sample of format specific, calculation magnitude. */ + memcpy(expected, test->buffer, sizeof(expected)); + memset(dst, 0x00, sizeof(dst)); + value = local_calc_limit(test->value, test->size * 8); + if (value != test->value) { + /* + * 32 bit sample was reduced to 24 bit resolution + * for calculation, least significant byte is lost. + */ + if (test->format & AFMT_BIGENDIAN) + expected[3] = 0x00; + else + expected[0] = 0x00; + } + local_pcm_write_calc(dst, value, test->format); + ATF_CHECK_MSG(memcmp(dst, expected, sizeof(dst)) == 0, + "pcm_write[\"%s\"].value: " + "expected={0x%02x, 0x%02x, 0x%02x, 0x%02x}, " + "result={0x%02x, 0x%02x, 0x%02x, 0x%02x}, ", test->label, + expected[0], expected[1], expected[2], expected[3], + dst[0], dst[1], dst[2], dst[3]); + + /* Write normalized sample of full 32 bit magnitude. */ + memcpy(expected, test->buffer, sizeof(expected)); + memset(dst, 0x00, sizeof(dst)); + value = local_normalize(test->value, test->size * 8, 32); + local_pcm_write_norm(dst, value, test->format); + ATF_CHECK_MSG(memcmp(dst, expected, sizeof(dst)) == 0, + "pcm_write[\"%s\"].norm: " + "expected={0x%02x, 0x%02x, 0x%02x, 0x%02x}, " + "result={0x%02x, 0x%02x, 0x%02x, 0x%02x}, ", test->label, + expected[0], expected[1], expected[2], expected[3], + dst[0], dst[1], dst[2], dst[3]); + } +} + +ATF_TC(pcm_format_bits); +ATF_TC_HEAD(pcm_format_bits, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify bit width of different pcm sample formats."); +} +ATF_TC_BODY(pcm_format_bits, tc) +{ + const struct afmt_test_data *test; + size_t bits; + size_t i; + + for (i = 0; i < nitems(afmt_tests); i++) { + test = &afmt_tests[i]; + + /* Check bit width determined for given sample format. */ + bits = AFMT_BIT(test->format); + ATF_CHECK_MSG(bits == test->size * 8, + "format_bits[%zu].size: expected=%zu, result=%zu", + i, test->size * 8, bits); + } +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, pcm_read); + ATF_TP_ADD_TC(tp, pcm_write); + ATF_TP_ADD_TC(tp, pcm_format_bits); + + return atf_no_error(); +} From nobody Tue Jan 21 12:03:58 2025 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 4Ycm8G20fwz5l0YJ; Tue, 21 Jan 2025 12:03: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 4Ycm8G1HLCz3fnn; Tue, 21 Jan 2025 12:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737461038; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GBv2/ylwt8Qoim/ayOUu9i2p39U94BQ2bZG+hab0LDw=; b=r08r8o7dWwcxUwysn23dhDB5fOm+QBmnYaD1d2LSnYb4VEo2PBrxZYO5m/BEH3XgbBFGsO Cp3TO1Bxz11eImhdqgWDjP5YxAUZh+RkPIHebfGdsnUpZ6lu3Sau0YtXlzpIXBazGM3BlD vstw95n1Ke2QK2IsBHCKTzgkmzd6tqZkT4aIJ5IxKshiGsHkSdsVRp3GY0Kb9QvSjmw6Qd iRdoxtZlCCFIl6fAAUJY9kTyNapGvMqIzbtx4Vq3hh8D/It/J4U10ykMuOZbOLQxufv12+ 6GuR+AGmtcOtNG03k8fEH8PqnYj7L1vAs456dKe8MUG+ZzsMAIKaYA759LDPvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737461038; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GBv2/ylwt8Qoim/ayOUu9i2p39U94BQ2bZG+hab0LDw=; b=xS1fbFLzPyNcPBbjhHGAneVCWSmrepJdLmqz/QeQdLMaczQQ8qiAoPdxi7QDY4Gb6ZPgFu 1wCfiOMW8FwjDS7kivGI9Db6NcHyc46e9W5grRmAIpBtI/3wGRYIttWwh3DOIH4i2W4U65 VHuPMibbOIc1olhoHfncjg875dF3YHLZVU6fasFojfVkgXpsfS8pY6ex3/mXIgSUGcp0JI 0odS4du6dKqxJeqUDhe1MPudcEbq2pKckfFFyQBarVTKl5gsEiQQ1ZB2DFFrtg3KW9Nbcz NUvOsFui8H7FyTuq5jejsANFAJVm/YPPLoxr20tKXwTLnxckj8N2y/NCafEvkQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737461038; a=rsa-sha256; cv=none; b=U4RIi2zej4YXLpq4yV3jGGwgto44F+509kGPHdU4+e69WpynBw0zuf9aL6fdb9OvuKfDC1 ne/RIeVpHuw1wu/NVciszrfdlr24Ti3YaX6DpUVrvVwchlrUQNjGCl8o/uer47+xprLeHh DmSd+IiSfrEpHatQkfetG0rLHoHySGiKD//CXMHX+slTO12ZKnmq9T04ppnTEffy6Epozc KqwSqPkUQf7w8cE/fRvlFS91TfxJHfCCaXPIqEudOQzsBswlOGyl5I00SFVy7dP/XFpkW/ aJ/YbDaT7/czFCSHwSk6TNbanM0EbwCOXROBmMDXOeILnJP9HqQEQFJfuclxJQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ycm8G0qW6z15KJ; Tue, 21 Jan 2025 12:03: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 50LC3wT0023301; Tue, 21 Jan 2025 12:03:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LC3wux023298; Tue, 21 Jan 2025 12:03:58 GMT (envelope-from git) Date: Tue, 21 Jan 2025 12:03:58 GMT Message-Id: <202501211203.50LC3wux023298@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 27b932e32fab - main - sound: Safely remove channel from list in one pass 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 27b932e32faba1137ff307d05b787d837ccadda8 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=27b932e32faba1137ff307d05b787d837ccadda8 commit 27b932e32faba1137ff307d05b787d837ccadda8 Author: Florian Walpen AuthorDate: 2025-01-21 11:59:12 +0000 Commit: Christos Margiolis CommitDate: 2025-01-21 12:00:52 +0000 sound: Safely remove channel from list in one pass The CHN_REMOVE_SAFE() macro did two traversals of the channel list to remove a channel, one to check whether the channel is an element of the list, and a second traversal through SLIST_REMOVE(). Reduce this to one traversal, while still preventing a NULL dereference in case the channel in question is not present in the list. While here, rename the macro arguments to something more descriptive. MFC after: 1 week Reviewed by: christos Differential Revision: https://reviews.freebsd.org/D48207 --- sys/dev/sound/pcm/channel.h | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h index 67f5019f4727..58fedd284ecb 100644 --- a/sys/dev/sound/pcm/channel.h +++ b/sys/dev/sound/pcm/channel.h @@ -175,6 +175,7 @@ struct pcm_channel { #define CHN_LINK(y) y.link #define CHN_EMPTY(x, y) SLIST_EMPTY(CHN_HEAD(x, y)) #define CHN_FIRST(x, y) SLIST_FIRST(CHN_HEAD(x, y)) +#define CHN_NEXT(elm, list) SLIST_NEXT((elm), CHN_LINK(list)) #define CHN_FOREACH(x, y, z) \ SLIST_FOREACH(x, CHN_HEAD(y, z), CHN_LINK(z)) @@ -188,8 +189,8 @@ struct pcm_channel { #define CHN_INSERT_AFTER(x, y, z) \ SLIST_INSERT_AFTER(x, y, CHN_LINK(z)) -#define CHN_REMOVE(x, y, z) \ - SLIST_REMOVE(CHN_HEAD(x, z), y, pcm_channel, CHN_LINK(z)) +#define CHN_REMOVE(holder, elm, list) \ + SLIST_REMOVE(CHN_HEAD(holder, list), elm, pcm_channel, CHN_LINK(list)) #define CHN_INSERT_HEAD_SAFE(x, y, z) do { \ struct pcm_channel *t = NULL; \ @@ -211,14 +212,18 @@ struct pcm_channel { CHN_INSERT_AFTER(x, y, z); \ } while (0) -#define CHN_REMOVE_SAFE(x, y, z) do { \ - struct pcm_channel *t = NULL; \ - CHN_FOREACH(t, x, z) { \ - if (t == y) \ - break; \ - } \ - if (t == y) \ - CHN_REMOVE(x, y, z); \ +#define CHN_REMOVE_SAFE(holder, elm, list) do { \ + if (CHN_FIRST(holder, list) == (elm)) { \ + SLIST_REMOVE_HEAD(CHN_HEAD(holder, list), CHN_LINK(list)); \ + } else { \ + struct pcm_channel *t = NULL; \ + CHN_FOREACH(t, holder, list) { \ + if (CHN_NEXT(t, list) == (elm)) { \ + SLIST_REMOVE_AFTER(t, CHN_LINK(list)); \ + break; \ + } \ + } \ + } \ } while (0) #define CHN_INSERT_SORT(w, x, y, z) do { \ From nobody Tue Jan 21 12:03:59 2025 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 4Ycm8J6s4vz5l0wT; Tue, 21 Jan 2025 12:04: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 4Ycm8J0tCHz3gBV; Tue, 21 Jan 2025 12:04:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737461040; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2w2b3uIaBTWLoGwIScIF9CRB7pn4JGymsrgwNmCEC2E=; b=SlPXTaJ+Qa9i539URS5hKerk1/IZ4b38dIrWcWddJntsiUvoKaWmprekKqMQnV2smnZobQ qKyIogPhN/EpWUkVrUGhBoJvzGfARt1bodUNLolQck1wGgJYrTtB0bzBOoVr11iWheN0CK joYjpNwLSTa/e1vqGaztEcZFkorijMAYf1/jcVQekj2yB8mEyzQUTXW+ZNROdSGGFvlsAX 1vMTzDc5VS0dTLoUU5T1gCceBnYOcdRO8naPseS+tmE2LP+NT3qYs4vNEAeaBi+JSRYDsT Dc32Q6RlY9NePrFP3dIuotH0l2Ic0PH+v7YKmZi1a2rXOgK6bAFV/rmLXCXMew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737461040; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2w2b3uIaBTWLoGwIScIF9CRB7pn4JGymsrgwNmCEC2E=; b=fNC37OFGk9MQsHnregfFXluTLKZhJb2xjPXMJHd6pe3hMfsWFVxQildFzMoTY3tUlUG1cq W5+RknGvBCJUWMZMP7dVBS7bG9Wql9nnp98spw4Te4W4aRIFCKP6huzwTT0sE5V0RklHAU fJoYFbkHdYRyyona4XMO0tlNNxAwfvGLATdzA4ckFlgNylkJbm169oic5sbUucJXJ0JO0m bz/rQu8XicxUhnNjlU4UkLU/5Z4nKUWfBAqabs/wjnB8moW1VLreKUIyQpX4VbRnKhBdrD /Crvgvf48pLPfmDm0XG2ATgQy+HTOafXd5JKzIKmxJ/GL9rwAsublLN0AJeQ4A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737461040; a=rsa-sha256; cv=none; b=VFyvtvw91sWPdK1zXLQgQSlJNYuAfhSScN03OhUHHRfgiBkRAQjFQfqG2SOfAnraqqBzYq F//QbWOGpUILtV2vFsORf41edX64/ipvlz5Xy+Gxja/kzsV/wT6fHz1vjKUTm9yNaEYTaw zgUR8L8yBWAz3bjnG/2tjwd/eylYOBRlfbSMUqT8qzBkDcZGj7pMtYzq69PFuqgChMnhMn pPHd7OG9sXxVVb4vD+YOe9ttdm8dok7H7T8mTV5hzT2FmNQccZILEEktpgmV4UyxmWj753 xGrk13bDJznTkeUgPFM6hyK8GvQEIms2prWENgxyBXDWlk/g6cGRB5Yqslb7Cg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ycm8H1S1Qz15KK; Tue, 21 Jan 2025 12:03: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 50LC3xVg023336; Tue, 21 Jan 2025 12:03:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LC3xJD023333; Tue, 21 Jan 2025 12:03:59 GMT (envelope-from git) Date: Tue, 21 Jan 2025 12:03:59 GMT Message-Id: <202501211203.50LC3xJD023333@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: ffcefe5310e0 - main - sound: Make CHN_REMOVE_SAFE() the default 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ffcefe5310e084415a2f292a00f4637d4059c40f Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=ffcefe5310e084415a2f292a00f4637d4059c40f commit ffcefe5310e084415a2f292a00f4637d4059c40f Author: Christos Margiolis AuthorDate: 2025-01-21 12:00:17 +0000 Commit: Christos Margiolis CommitDate: 2025-01-21 12:02:55 +0000 sound: Make CHN_REMOVE_SAFE() the default Commit 27b932e32fab ("sound: Safely remove channel from list in one pass") optimized CHN_REMOVE_SAFE() to perform almost equally to CHN_REMOVE(), so we can turn CHN_REMOVE_SAFE() into CHN_REMOVE() without fears of performance regressions, while also being more robust. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D48249 --- sys/dev/sound/pcm/channel.c | 2 +- sys/dev/sound/pcm/channel.h | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 925a82bb170f..4b0ca128391b 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -2291,7 +2291,7 @@ chn_trigger(struct pcm_channel *c, int go) break; case PCMTRIG_STOP: case PCMTRIG_ABORT: - CHN_REMOVE_SAFE(d, c, channels.pcm.busy); + CHN_REMOVE(d, c, channels.pcm.busy); PCM_UNLOCK(d); break; default: diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h index 58fedd284ecb..6eaad8cc2c0b 100644 --- a/sys/dev/sound/pcm/channel.h +++ b/sys/dev/sound/pcm/channel.h @@ -189,9 +189,6 @@ struct pcm_channel { #define CHN_INSERT_AFTER(x, y, z) \ SLIST_INSERT_AFTER(x, y, CHN_LINK(z)) -#define CHN_REMOVE(holder, elm, list) \ - SLIST_REMOVE(CHN_HEAD(holder, list), elm, pcm_channel, CHN_LINK(list)) - #define CHN_INSERT_HEAD_SAFE(x, y, z) do { \ struct pcm_channel *t = NULL; \ CHN_FOREACH(t, x, z) { \ @@ -212,7 +209,7 @@ struct pcm_channel { CHN_INSERT_AFTER(x, y, z); \ } while (0) -#define CHN_REMOVE_SAFE(holder, elm, list) do { \ +#define CHN_REMOVE(holder, elm, list) do { \ if (CHN_FIRST(holder, list) == (elm)) { \ SLIST_REMOVE_HEAD(CHN_HEAD(holder, list), CHN_LINK(list)); \ } else { \ From nobody Tue Jan 21 12:48:03 2025 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 4Ycn780M4Qz5l3QF; Tue, 21 Jan 2025 12:48: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 4Ycn7752DSz3pln; Tue, 21 Jan 2025 12:48:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737463683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Od/28+kR07tX4bFPuKP3BabpWv/VkyL4M9Z/3nm5HG0=; b=WdHHAYl/BNilLGAwNh/mxgbxEeqkKkNbekKvQvr7J1M9cAnWSfo6fYHieHJgD1jDzMYTwo WpwWOy/JeYpKmEBGrHV6uqlvRCt7dCepIrFz9XCo0UxzbB6WxyV76z4qwxZ/crsD4/00Xw I0gCRGtfonv8B8jTPba8E/Ei7J0Q4vHahovrPG36Vc6J1qzAMfRA5u3NkFobBebhKHdbxX MxJ6nLg+rf5F7RBhrjdt3aHuf1aLaKDdPIJqn+l2pF7XdgpXdMnxzgOOycfvWzP9C7qIxO SkBDUlfqd5zDFcfjM4iHqSFEpyVqzgGeHCjFLwaYbSXTGQmkkNRpyWNDosJq+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737463683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Od/28+kR07tX4bFPuKP3BabpWv/VkyL4M9Z/3nm5HG0=; b=V1hDIFM+nP5PX+3CIQjBQcC1EFp0TUoQvjbuuQfr5YsmXu2qnlAAb85qwaMU6yBQxk98M4 grcTR+iyMAL36ntAXgERfhh8m+gOy/gnT7Tl+rm7kDvcvgmjXN4J4Ba4JXNiSVssSgl/Tw k1Ht42aUjNKaHjo7gb6jmMDFBqEY00W8NgfEByrv5Z3Al2qVZsGh49BnnDF+p8kwyeOY66 5SIDMc581bl83EsBky/YEP7MKDBpKqRyv+vdYbZKGgFq9z6uxb23uwF6o/YvA2ZjeRC953 rlCEqay930cqDZCleQEs5vCpJtn3+zlN/qNxL/+svThrmngn81N3UafS/SYgrg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737463683; a=rsa-sha256; cv=none; b=iDBl/6fqbTxInkOgb1vS5wnmCHNvJaD2qINqsD8y5dcX5p9hzn5M/hPql4orwpqTWypTK8 k8gQBKhRwaSxy1ZytOuqGbazS35QktzI87rwHu5im64L8nTBbUehrdN5PZujkIWHmAojlU fRlUHmzxzIP4z/0vIDHD3S2Q9C1tm2fpNtXKsvK0904jtEg1ef3YPt4IlGARwBPQTv2VG9 UeqMmOHexUpDl9la3RwqOJagf+gLK5C6/GVoIoCiVIvUgPu1WYlm4R6fxcgkZcEpLPPih7 s61s9rmVerFNQJRj9mZSuB0mjjH/mq2zn9VbvHwGvCn0EoqAnL1TMSxcCiUmyg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ycn774clYz16Qw; Tue, 21 Jan 2025 12:48: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 50LCm3EY098511; Tue, 21 Jan 2025 12:48:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LCm3JW098508; Tue, 21 Jan 2025 12:48:03 GMT (envelope-from git) Date: Tue, 21 Jan 2025 12:48:03 GMT Message-Id: <202501211248.50LCm3JW098508@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 4b04f5d7e8a2 - main - install: Fix METALOG ouptut for numeric -o and -g args 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b04f5d7e8a2bb0488ad5804ecaf45cef5b1d46f Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=4b04f5d7e8a2bb0488ad5804ecaf45cef5b1d46f commit 4b04f5d7e8a2bb0488ad5804ecaf45cef5b1d46f Author: Ed Maste AuthorDate: 2025-01-17 19:14:22 +0000 Commit: Ed Maste CommitDate: 2025-01-21 12:47:48 +0000 install: Fix METALOG ouptut for numeric -o and -g args install's -o and -g flags both accept a name or a numeric argument. In -U -M (non-root METALOG) mode it always emitted uname= and gname= in the METALOG, but these are not appropriate for numeric IDs. If the -o and/or -u arguments parse as an ID, emit uid= and/or gid= respectively. Note that if an argument is valid as both a name and numeric ID we will prefer the name in normal (non -U -M) mode and the ID in -U -M mode. We don't want to require a passwd db in non-root mode, and entirely-numeric user or group names are a terrible idea so just accept this discrepancy. PR: 284119 Reviewed by: jlduran Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48504 --- usr.bin/xinstall/xinstall.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index d0fcda340034..02b3eeccf8a7 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -1432,10 +1432,22 @@ metadata_log(const char *path, const char *type, struct timespec *ts, p = buf; /* Print details. */ fprintf(metafp, ".%s%s type=%s", *p ? "/" : "", p, type); - if (owner) - fprintf(metafp, " uname=%s", owner); - if (group) - fprintf(metafp, " gname=%s", group); + if (owner) { + id_t id; + + if (parseid(owner, &id)) + fprintf(metafp, " uid=%jd", (intmax_t)id); + else + fprintf(metafp, " uname=%s", owner); + } + if (group) { + id_t id; + + if (parseid(group, &id)) + fprintf(metafp, " gid=%jd", (intmax_t)id); + else + fprintf(metafp, " gname=%s", group); + } fprintf(metafp, " mode=%#o", mode); if (slink) { strsnvis(buf, buflen, slink, VIS_CSTYLE, extra); From nobody Tue Jan 21 15:03:05 2025 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 4Ycr6x6Clxz5lCsS; Tue, 21 Jan 2025 15:03: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 4Ycr6x5J2Fz47Lt; Tue, 21 Jan 2025 15:03:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737471785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SObyVv2tYMTyiC8PI//TTmwYZYbAgVgcTJcOwkebbMk=; b=cWvuUj0QOJhjNdRhMOqnqafFhH9adozsGzMFSveOPouWsk02bvoexj1VeGUg40yjLs02EI BB8f8yWJw9Kcmn65vao0J4uNolNpzlXf0QNFXj1Ph+94PTXZuUa8in/Qtx/ZbYaDCMMPRG CbsrQYG8HiEkcNxMr2fVTwFSEGLgCq4ymopOP2UQWL445Bkq63u1YYTTw8VZvhDRmuGjDA dy/q50YE+Q9JZnXBgIl62d7TXb1Agw65IZUbpxmjuKU2HqcVsbpYuwXTVUftbQ1ZvnC6G1 22ld/8YY8o/IO/gUNxzHxZ1x+HEivuLxf35tSLwY7FBMp8Ckq0rJjDTkCfmkew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737471785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SObyVv2tYMTyiC8PI//TTmwYZYbAgVgcTJcOwkebbMk=; b=wLaQsvw58jdsWxKFXv8qfu3dLKsgUjdG6CVEeOJardtbW1+WTD6J/QdLpDxhTZ24jPjZO4 8eicHjNLPdziZXvtODHomFilr0cTnbNiSSnjKipgsriSBBswXth37xPMEVAjUshlIKuzrP j1D+FJgoBgopiWQTNY/ENEQG2JADt1ZnV5ZxNKbkvjBa8hpu7u2ocdqp5tUfgeeY+t+rmn PTTSCNiTsH7sfeFRmZlNBjYlYfSmM9/3iZ9XD49S0wt4qH5Wj6e0gsW6grXrH+5XNScabv IHsg9F3+4BSA0/R3vhRWorWYYLvqbQfl4WbkTfTDlPP+vbb11NKklm3b4VZdRw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737471785; a=rsa-sha256; cv=none; b=kIcawiUC8iiZLfHcgoNUqol7+I/2wSv+d+pEVjWjrbOCnq4rdT1sTYEIji2ynpV3g+hbl/ VrHPul2nQmbw1baxzoMkLGmnsfgaEHacx/ATd5L+Tk8oMgL5GfotmdZxANJuYpbj22gVDg qBP7ANR+XXU/E+2TbO/RKxqwDeq4ugARlJAIgFNOsfpgPLFu1kDR9ZVaBuMeA5EAt1bRD7 nULoqwh/3Xr7aZNeeF0iE+3kxtBI+6Kr3JZKaDUVF/Bz7Dt2ziw2NZk5Yt1X39vBy5cHhU nAH43vRiilby4EEGVG+sFwbDgISGvHw+PZlOtYYHKVXnB32pBuplKcnmjztN+A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ycr6x4bSFz19Y7; Tue, 21 Jan 2025 15:03: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 50LF35mb059089; Tue, 21 Jan 2025 15:03:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LF35JT059086; Tue, 21 Jan 2025 15:03:05 GMT (envelope-from git) Date: Tue, 21 Jan 2025 15:03:05 GMT Message-Id: <202501211503.50LF35JT059086@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 960c5bb0f6bf - main - if_vxlan(4): Invoke vxlan_stop event handler only when the interface is configured 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 960c5bb0f6bf44aeb09fa14fd0f82c2e82ebe2e2 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=960c5bb0f6bf44aeb09fa14fd0f82c2e82ebe2e2 commit 960c5bb0f6bf44aeb09fa14fd0f82c2e82ebe2e2 Author: Zhenlei Huang AuthorDate: 2025-01-21 15:02:13 +0000 Commit: Zhenlei Huang CommitDate: 2025-01-21 15:02:13 +0000 if_vxlan(4): Invoke vxlan_stop event handler only when the interface is configured It is harmless but pointless to invoke vxlan_stop event handler when the interface was not previously configured. This change will also prevent an assert panic from t4_vxlan_stop_handler(). Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D48494 --- sys/net/if_vxlan.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c index bb2de793550f..b7af304e3126 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -1813,6 +1813,7 @@ vxlan_teardown_locked(struct vxlan_softc *sc) { struct ifnet *ifp; struct vxlan_socket *vso; + bool running; sx_assert(&vxlan_sx, SA_XLOCKED); VXLAN_LOCK_WASSERT(sc); @@ -1820,6 +1821,7 @@ vxlan_teardown_locked(struct vxlan_softc *sc) ifp = sc->vxl_ifp; ifp->if_flags &= ~IFF_UP; + running = (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0; ifp->if_drv_flags &= ~IFF_DRV_RUNNING; callout_stop(&sc->vxl_callout); vso = sc->vxl_sock; @@ -1827,8 +1829,10 @@ vxlan_teardown_locked(struct vxlan_softc *sc) VXLAN_WUNLOCK(sc); if_link_state_change(ifp, LINK_STATE_DOWN); - EVENTHANDLER_INVOKE(vxlan_stop, ifp, sc->vxl_src_addr.in4.sin_family, - ntohs(sc->vxl_src_addr.in4.sin_port)); + if (running) + EVENTHANDLER_INVOKE(vxlan_stop, ifp, + sc->vxl_src_addr.in4.sin_family, + ntohs(sc->vxl_src_addr.in4.sin_port)); if (vso != NULL) { vxlan_socket_remove_softc(vso, sc); From nobody Tue Jan 21 15:41:40 2025 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 4YcrzS4fbtz5lFYj; Tue, 21 Jan 2025 15:41: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 4YcrzS3nGFz3D2f; Tue, 21 Jan 2025 15:41:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737474100; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zTrmjbpwjb4FL1JBLXpgUOAcAOIPcrtiZbsES4xUjvs=; b=k1N48mX+ta/pyqyoZh2VOiw8RnN1w+DtjoxizByxxPk430KNqdoNGmREeXKalTUJCTEqux HAmb59mdG38TRyZJ/YrJ/aTOQxDNHSYJ2V5kb4amYJggJQff4zCtB7FQvGLtwrMgoZSZuo mfduAfEz1gqT8qos6RuOM+Ur78GM8tQDY55x87otginIZ5nZhoVOBN3lYBJIMJvRS8HAGi iA90Zi6rJmfdI094oETouNofGWWslyJnbUuiH6RTQm34Y3qah9Qmw8Pggg0k0DVCTRK5LW Ilvn6a2au92B5za0njz2DROJK0MDE1lDEeYIDZBQ1whu06xgr/6KLTRlDIdf2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737474100; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zTrmjbpwjb4FL1JBLXpgUOAcAOIPcrtiZbsES4xUjvs=; b=aMFbMS+SEw0MtUE92bBgTJLJOFC4ZVwcVuo4ZG43AsgumGYyXr1YbStGBpN7Kdew00+zIK yeSo5n7o2w+xw/WucvfFzO/BnJUbS+kbLOm5klxCimfxCb+FyS1zZDv/2oK5l9AXHjSr8J EgD4FehBd7Y8KH8aem8w4t1mj3TBRY5+ws6nEZItY6EXfucFkJn61TliivRhLTEGF40sU3 luhbse1ZI3y49hhiOC8tC+hMGLftKrEQyaIyrdpLOBf8OkPM2l+HBOp9bqCRNdYzzJ4bU3 lkZcNS/oeYjhzJ8EkSvW5ahwSZlVFUzyjffd52g1YjGTOHbhjnBnHbcLjfvSMw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737474100; a=rsa-sha256; cv=none; b=Imc4Oa8UJ+dWfCVjtuc8pTojWECj25TEY1/vevapOoAfVtiTWI2K8YBteHjmYIjeFKAEqW I7VsTyLoODAkb+mMvbZcOUrGRc9bkb8EKuvb1+slKMU4N+m2H5hxNQtlbYfbwZEnsXyu6Z fnrIzJaxvzLzon3hy+/GiVDijUJxTN9NE4Dks8T4Ezn5gCyRyofNMkpAQSHA/WzVhUC5xA 6tidnsrkVjEKk5j7tglww/5WBbAArLJMgna8myxRrlM91c1pC5aYGxwt6W+/eOaTfHkffl FoniQ8YioMDOJ2Zg8KLfjPqyesPgscg0X0x7GRymwD7CQhZ/Kve1pkCgf6wfUw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcrzS3Jfcz1Brb; Tue, 21 Jan 2025 15:41: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 50LFfeOq028829; Tue, 21 Jan 2025 15:41:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LFfe8b028826; Tue, 21 Jan 2025 15:41:40 GMT (envelope-from git) Date: Tue, 21 Jan 2025 15:41:40 GMT Message-Id: <202501211541.50LFfe8b028826@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: 010ee8215f5c - main - setfib.2: Note that the number of FIBs can be adjusted after boot 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: 010ee8215f5c899e23250828402af5b7bb354328 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=010ee8215f5c899e23250828402af5b7bb354328 commit 010ee8215f5c899e23250828402af5b7bb354328 Author: Mark Johnston AuthorDate: 2025-01-21 15:39:50 +0000 Commit: Mark Johnston CommitDate: 2025-01-21 15:39:50 +0000 setfib.2: Note that the number of FIBs can be adjusted after boot Reviewed by: zlei, imp MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D48545 --- lib/libsys/setfib.2 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/libsys/setfib.2 b/lib/libsys/setfib.2 index 32e2f64910cb..57e83c0d1adb 100644 --- a/lib/libsys/setfib.2 +++ b/lib/libsys/setfib.2 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 19, 2012 +.Dd January 10, 2025 .Dt SETFIB 2 .Os .Sh NAME @@ -55,15 +55,20 @@ The system maximum is set in the kernel configuration file with .Pp or in .Pa /boot/loader.conf +or +.Pa /etc/sysctl.conf with .Pp .Dl net.fibs= Ns Qq Em N .Pp where .Em N -is an integer. -This maximum is capped at 65536 due to the implementation storing -the fib number in a 16-bit field in the +is an integer smaller than 65536. +Note that the number of FIBs may be increased after booting, but cannot be +reduced. +.Pp +The maximum of 65536 is due to the implementation storing +the FIB number in a 16-bit field in the .Xr mbuf 9 packet header, however it is not suggested that one use such a large number as memory is allocated for every FIB regardless of whether it is used, and From nobody Tue Jan 21 16:03:06 2025 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 4YcsSB2Rztz5lGn0; Tue, 21 Jan 2025 16:03: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 4YcsSB1r7Lz3H7r; Tue, 21 Jan 2025 16:03:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737475386; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qi2GGd4Ayorf1PBBVAEupKMFRk3sbNzB9kN5300gxrI=; b=BeYE/3q8oFy5nvCaf8LRqtMabnxsH9+pOU1Yc0xyocEpFHUXATAvDtCcHaONmj2faHX0HY b0YYbJpPVhns6WgxCYQayEldsSHCY4W6YMkM7QBIRIFIWxEV96E/s2cF73GfmjCQCSWEd8 S4u+QdWXgiU0cw4CfB83ME4eFt9gbhK+ZubsVd/fe3BXQ4oLYGYRop/DySopNhRk3bJR4D yO26BQQYf7oKO33ZmwEaF2qEr06Ww2rQmHecqqX+hzVIuS+Uu9Mxqh7SGMrvsyivTfo5Yv KJkE7Bosnmgo2fbzn38NZaWGn/KTwNWYkvHYLRyeFVtB7cL9KJybv363BbM7FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737475386; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qi2GGd4Ayorf1PBBVAEupKMFRk3sbNzB9kN5300gxrI=; b=OXVHVqk9dQTjhHRL9zayg6bD7nXPNPVLHVtRSTYbc+XXtV4Yjxt1sfjLrIKkoURgRIlEOL Dkg5YfiWKZ1MGLVy55stiLVzyxGHpo6dSvbNix/KY0ufP0q8UGUqfeDFrjGX9U8XFO62t0 XgIda+7dQdrLbGFVLFOR9Pw3rYpvQrs3WoU9nsVL9wMzbuchtPyTDCUBjN7WUcJJwxwTl1 I3jhChBBdt7A7/602Q6IacMP6TELC93yEXaE/roLdGFyPdXg3J9cwojA/e05a/SRzaDzYp NYmPwB8WcEBiRepcBLxMrQeV9XcUORYMXZT0o7M/Xi7It7go6lP5SjfPZgZLmw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737475386; a=rsa-sha256; cv=none; b=nYpoc/k/OHdecW7i44T1vZmGIgvjZwj6Wdi2iSM1xRhMmpRoujyt6/IhQdOPXQZ+gJRnl8 Yi2tfsVHqbguilFY8rpKDWzjJhLKGKQ3KqeHc0kb7dNa3pKqTDUBawJtZ6sYvninrnc+oo 8XmoznbnnoqwqaEeXso0vzHQX4LIxRjz/edQ0D3Hh6OfmhC/8QOeQdTl2NKLrk4zK2V719 C6UyVCN5yKtt8mK7W8r5JvTAGlA40cN6Snd0aPK13gIxE9gvaUSb1WjAe+do00OKgPw1MD XILcjlYXECVEnxCRhyFZLazPuDMPPnySrInuxaVjAyNLWRKJjJwaq9oCfcjP5g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcsSB1HBkz1CXJ; Tue, 21 Jan 2025 16:03: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 50LG36LU071604; Tue, 21 Jan 2025 16:03:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LG36Di071601; Tue, 21 Jan 2025 16:03:06 GMT (envelope-from git) Date: Tue, 21 Jan 2025 16:03:06 GMT Message-Id: <202501211603.50LG36Di071601@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c19f1ad1c252 - main - pci_host_generic: Use SYS_RES_MEMORY for the parent of I/O resource ranges 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c19f1ad1c252f434146c7210155d805b2ed0ff95 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c19f1ad1c252f434146c7210155d805b2ed0ff95 commit c19f1ad1c252f434146c7210155d805b2ed0ff95 Author: John Baldwin AuthorDate: 2025-01-21 15:51:53 +0000 Commit: John Baldwin CommitDate: 2025-01-21 16:02:34 +0000 pci_host_generic: Use SYS_RES_MEMORY for the parent of I/O resource ranges When a SYS_RES_IOPORT resource crosses a pci_host_generic bridge, it is translated into a memory access for an associated range, so use SYS_RES_MEMORY for the resource allocated from the parent. Tested by: markj Differential Revision: https://reviews.freebsd.org/D44207 --- sys/dev/pci/pci_host_generic.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c index 884ab25548ce..49b131cd2299 100644 --- a/sys/dev/pci/pci_host_generic.c +++ b/sys/dev/pci/pci_host_generic.c @@ -91,7 +91,7 @@ pci_host_generic_core_attach(device_t dev) const char *range_descr; char buf[64]; int domain, error; - int flags, rid, tuple, type; + int flags, rid, tuple; sc = device_get_softc(dev); sc->dev = dev; @@ -187,19 +187,16 @@ pci_host_generic_core_attach(device_t dev) sc->has_pmem = true; range_descr = "prefetch"; flags = RF_PREFETCHABLE; - type = SYS_RES_MEMORY; rm = &sc->pmem_rman; break; case FLAG_TYPE_MEM: range_descr = "memory"; flags = 0; - type = SYS_RES_MEMORY; rm = &sc->mem_rman; break; case FLAG_TYPE_IO: range_descr = "I/O port"; flags = 0; - type = SYS_RES_IOPORT; rm = &sc->io_rman; break; default: @@ -209,7 +206,8 @@ pci_host_generic_core_attach(device_t dev) device_printf(dev, "PCI addr: 0x%jx, CPU addr: 0x%jx, Size: 0x%jx, Type: %s\n", pci_base, phys_base, size, range_descr); - error = bus_set_resource(dev, type, rid, phys_base, size); + error = bus_set_resource(dev, SYS_RES_MEMORY, rid, phys_base, + size); if (error != 0) { device_printf(dev, "failed to set resource for range %d: %d\n", tuple, @@ -217,8 +215,8 @@ pci_host_generic_core_attach(device_t dev) continue; } sc->ranges[tuple].rid = rid; - sc->ranges[tuple].res = bus_alloc_resource_any(dev, type, &rid, - RF_ACTIVE | RF_UNMAPPED | flags); + sc->ranges[tuple].res = bus_alloc_resource_any(dev, + SYS_RES_MEMORY, &rid, RF_ACTIVE | RF_UNMAPPED | flags); if (sc->ranges[tuple].res == NULL) { device_printf(dev, "failed to allocate resource for range %d\n", tuple); @@ -253,7 +251,7 @@ int pci_host_generic_core_detach(device_t dev) { struct generic_pcie_core_softc *sc; - int error, rid, tuple, type; + int error, rid, tuple; sc = device_get_softc(dev); @@ -272,18 +270,15 @@ pci_host_generic_core_detach(device_t dev) switch (FLAG_TYPE(sc->ranges[tuple].flags)) { case FLAG_TYPE_PMEM: case FLAG_TYPE_MEM: - type = SYS_RES_MEMORY; - break; case FLAG_TYPE_IO: - type = SYS_RES_IOPORT; break; default: continue; } if (sc->ranges[tuple].res != NULL) - bus_release_resource(dev, type, rid, + bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->ranges[tuple].res); - bus_delete_resource(dev, type, rid); + bus_delete_resource(dev, SYS_RES_MEMORY, rid); } rman_fini(&sc->io_rman); rman_fini(&sc->mem_rman); From nobody Tue Jan 21 19:27:38 2025 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 4Ycy0C00Z2z5lVPP; Tue, 21 Jan 2025 19:27: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 4Ycy0B6FYrz3Zkd; Tue, 21 Jan 2025 19:27:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737487658; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CmuHlSt3+Th9gkjLZwncPYitYXnrbWmw4/c7Xhu9b20=; b=OzJIOkHq3vcQXff/5iRbgHGJHiihnULIPu2wMK749Upch/zEqbUyUOgCMyr7XBFSpwJo5X atJNCf8K75Pu0If1NmrGGL9EmdAro+u7IUKNY3E5TtZjC47sZuiY2lLGJp4Yi8ANBHgtbu YeR9Q4sewbT6sSKAM0DvvxNQSn8ZqJ0x+KvN3xhMmkrMskjWZNbQ1bP53aKMkrX2jegIgC 54AxR5DdTRehCeN0C2umf8sZ9jgDZXZ+opXSE/ihI4F83C9GJP0ujT7CjGpwUO5fVvMwac jkm6vTLAvsI0qrkfwNbqE/WPor37dwuSj4O8JCxtXL1aPykLT65SG7xOAI1wIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737487658; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CmuHlSt3+Th9gkjLZwncPYitYXnrbWmw4/c7Xhu9b20=; b=rLphjs/o2e6+eH/wqu4j4k0kKkPAA9yToHJxTx292VhkbU4WyiJWoH7lEqS+a8/PGJUQ+K 4WHJ+XAK5M+KJVIXVANTjq2O01kyxCMxKXaQv2dP9mvSoBIKDN8Uii1XSK84CMxaihA+Uz GlqmI2sHt4DHZCjWoMPSn//+8kNTF/GgOtgdVz5e/UbYaoldkEtIpvXir9yTB5Gbgn7I7Q 5Wa4WN3R6JNCtrc3a/Y10N9qMPP+Obpnk4Jtg6S5skGgrthsy/dGerO/k9KnbU+3XG0+ow tuiygwGsHA8Mu3dr2+qVQuqZBz9UBDtCPR1wf39kAQci5179J+zA5Pp37n/YFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737487658; a=rsa-sha256; cv=none; b=QL+RsrhMtx7+2d9QJL6yQmrGwap5UWOiuzaL0mBj+Mz45G09HRIV3O2x5hqbpMnN/PjPxB +RHrRyKZf0tzHhK3GXIgTa6VO9OKNGrshtTsesK26Ow62F+O5nuGexBNfmimha6MFk/RKW zPlXdEnuFhTXts3v+mNbnlf2ZR9MwKwdykgz2WEyH4cd+X6G6k1mj5yAcnDOTG7zFGRBgZ nRps0QTad2o8y06y4wllXSPyJU0tBv7XV8woMsSLk5zy9DrcGTBFgbiTWva4iJPjciciG1 knWm9xbRExiAqHYrDG144eMw9utagvi+43UcV8dmyjDNdVFnC6fMQezo/8D7cA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ycy0B5lxDz4vG; Tue, 21 Jan 2025 19:27:38 +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 50LJRcL7045421; Tue, 21 Jan 2025 19:27:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LJRcOS045418; Tue, 21 Jan 2025 19:27:38 GMT (envelope-from git) Date: Tue, 21 Jan 2025 19:27:38 GMT Message-Id: <202501211927.50LJRcOS045418@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: 347eb42dbcb3 - main - bsdinstall/zfsboot: Remove unused global variable 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: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 347eb42dbcb352f3266e716a2101898fe054bdba Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=347eb42dbcb352f3266e716a2101898fe054bdba commit 347eb42dbcb352f3266e716a2101898fe054bdba Author: Alexander Ziaee AuthorDate: 2024-12-14 23:02:55 +0000 Commit: Alexander Ziaee CommitDate: 2025-01-21 19:26:53 +0000 bsdinstall/zfsboot: Remove unused global variable In an AMA session on the FreeBSD Discord, it was revealed that no logic remains calling GPART_BOOTCODE_PARTONLY. It was removed in aa2a0e0fc311 for FreeBSD 12. git grep shows no other references. No functional change intended. MFC after: 2 weeks Fixes: aa2a0e0fc311 (Enable new UEFI+GELI support) Reported by: Antranig Vartanian Reviewed by: emaste, mhorne Approved by: emaste, mhorne (src) Approved by: mhorne, carlavilla (mentors) Differential Revision: https://reviews.freebsd.org/D48086 --- usr.sbin/bsdinstall/scripts/zfsboot | 1 - 1 file changed, 1 deletion(-) diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot index 6f2244a918bc..bfb863f5e7c8 100755 --- a/usr.sbin/bsdinstall/scripts/zfsboot +++ b/usr.sbin/bsdinstall/scripts/zfsboot @@ -206,7 +206,6 @@ GPART_ADD_ALIGN_LABEL='gpart add %s -l %s -t %s "%s"' GPART_ADD_ALIGN_LABEL_WITH_SIZE='gpart add %s -l %s -t %s -s %s "%s"' GPART_BOOTCODE='gpart bootcode -b "%s" "%s"' GPART_BOOTCODE_PART='gpart bootcode -b "%s" -p "%s" -i %s "%s"' -GPART_BOOTCODE_PARTONLY='gpart bootcode -p "%s" -i %s "%s"' GPART_CREATE='gpart create -s %s "%s"' GPART_DESTROY_F='gpart destroy -F "%s"' GPART_SET_ACTIVE='gpart set -a active -i %s "%s"' From nobody Tue Jan 21 20:43:20 2025 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 4YczgX3mTlz5lZM2; Tue, 21 Jan 2025 20:43: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 4YczgX2j4Hz3mlQ; Tue, 21 Jan 2025 20:43:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737492200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VVEq9vlSvQIOsg9OLWcT0ZCfLue7l6+yfeNiay8dDnQ=; b=CFvD8QRXX0IoUFB8OcEAYlhm78eXQOSn87/DJUiTQ4GAkj8lohbqO71TJO4efQBVw+MPKR Ul9CLWCfToDuHq6C1dzyAgOYDTldgfa8fda5+1CvnHEP6McJsrUsG/inHTsSXeIFqnAvFZ oVnge/I6m+fLG+3eSNNG/OvqJlR3RRw4otCQ19WSjuvPlN15uF3shtTNkPYO0glECNYlQ8 MfhIaxEcCDopnaci5YW2axepnUd5pu5IzG0yqFKt19jrX4N/OtHzHdD8GtcCWG4v5D6IhL bmun5U602+OSM8/5Xd+2NPyQDc/Jp/CFUPC7uCduYdd6RZBKQAqnWpFZFvzXGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737492200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VVEq9vlSvQIOsg9OLWcT0ZCfLue7l6+yfeNiay8dDnQ=; b=Qno1p4RhrPMm1BfdP51YD+zNLu8GMWGTXZ5pu94fdXy+L5scCSM4q+6jC3CCflxQk4sC0/ v1MauwIHxTq8plEemce9j+kunF0F9f1ajoH7shU6MDBy358mVOlQbxt7QrV1dOzBTCjfBo hnFWVlw2/4n0bDn53PgIS0W7kkR2/EbeJdI+9btqW+meRgrpe6CSdFLkd3SWH/z9F7xiOk hnuJXBrTsrf9cQT8iKtnpTbtCRCJOsHAUqWGoC17saP2OZu45C2PU9rfc3nWHU+tTe+tuG gAU3gpizhiSHsspeYYcENCgdun3JYcc8F63yNRAe1tAo/t70fvM2YQ20fueEvA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737492200; a=rsa-sha256; cv=none; b=RwOk5X1krcUI98jn/dc6rA+MndZn/BHnlReSD5giyIq5TMgd5ZXjLydpcEgpxU+Tiel8AR 4xOWajf1UXeu+3Fox7jT8FmeNAaxGQ6TpPGdZDmXV/3CVElFaRgzOGG3ukC8bcp2mgh218 2LyoJIRSx+1OsXwwRIczbEcIfuFsK65IWk1ZmMgPk2+ykUp3l3LstsP4jPrdsQf+K0KAnG BHaQu0DKOLj8DSZAwMuegJr0mB/Dy01WPip96XXjkAaWEy8GHSLxFTPrBRSxImRxWV9IfD K6hv5EZ9hRZ1tZfKiHwECnrc1bBPp6EICXN3mk4T16VaZO8NnDaEr4EkFjOcEw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YczgX24xyz6ty; Tue, 21 Jan 2025 20:43: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 50LKhKvk093307; Tue, 21 Jan 2025 20:43:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LKhKtD093304; Tue, 21 Jan 2025 20:43:20 GMT (envelope-from git) Date: Tue, 21 Jan 2025 20:43:20 GMT Message-Id: <202501212043.50LKhKtD093304@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: 8d5d97372361 - main - kldstat.8: Polish options 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: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8d5d97372361aadb3d6cdfc5f5d1f8edcaa825aa Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=8d5d97372361aadb3d6cdfc5f5d1f8edcaa825aa commit 8d5d97372361aadb3d6cdfc5f5d1f8edcaa825aa Author: Alexander Ziaee AuthorDate: 2025-01-21 19:55:27 +0000 Commit: Alexander Ziaee CommitDate: 2025-01-21 19:55:27 +0000 kldstat.8: Polish options + Align and alphabetize options + -q: s/Only/Quietly/ for search + Tag SPDX MFC after: 3 days Reviewed by: gbe, carlavilla, mhorne Approved by: carlavilla, mhorne (mentors) Differential Revision: https://reviews.freebsd.org/D48325 --- sbin/kldstat/kldstat.8 | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/sbin/kldstat/kldstat.8 b/sbin/kldstat/kldstat.8 index f7e7552625e3..09094da3741d 100644 --- a/sbin/kldstat/kldstat.8 +++ b/sbin/kldstat/kldstat.8 @@ -1,4 +1,6 @@ .\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 1997 Doug Rabson .\" All rights reserved. .\" @@ -23,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 19, 2016 +.Dd January 4, 2025 .Dt KLDSTAT 8 .Os .Sh NAME @@ -48,22 +50,22 @@ utility displays the status of any files dynamically linked into the kernel. .Pp The following options are available: -.Bl -tag -width indentXX +.Bl -tag -width "-n filename" +.It Fl d +Show the module specific data (as int, unsigned int and unsigned long) .It Fl h Display the size field in a human-readable form, using unit suffixes instead of hex values. -.It Fl v -Be more verbose. -.It Fl d -Show the module specific data (as int, unsigned int and unsigned long) .It Fl i Ar id Display the status of only the file with this ID. +.It Fl m Ar modname +Display the status of only the module with this modname. .It Fl n Ar filename Display the status of only the file with this filename. .It Fl q -Only check if file is loaded or compiled into the kernel. -.It Fl m Ar modname -Display the status of only the module with this modname. +Quietly check if file is loaded or compiled into the kernel. +.It Fl v +Be more verbose. .El .Sh EXIT STATUS .Ex -std From nobody Tue Jan 21 21:15:31 2025 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 4Yd0Nh3rcYz5lcBt; Tue, 21 Jan 2025 21:15:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yd0Nh1c0Hz3qQn; Tue, 21 Jan 2025 21:15:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737494132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nex7ERAPsnqsJ5fY65h0aM4VsjcgjGQ1orxqKkEAhv0=; b=dGSkqNasWImJSC5FkAFCYiTzAVW5qCJkBT4D4IGANkvIlU/fuYyzfohObBXaWxi3c00QTD OGsbZKy9fcNdofDZcnnfu4X/9BcnMlMn0JDoQCMNXOrxLRH/yPs7qP2yotgVMgGmwq/X3C Am6QXy4QVvH3cvRcQtucdzeDPrud2f7iyzukBaoh7JwKFogNyPeeTiLDTiuMAfJ5t9GXZP 4L1huu5OFg+bLEUDDQ+CzTZFaVgO/X7QRz05usEMBM/T7jtrUAtvOE7C1blHw6XK3HUI0U WkzD3IB1l5D+AIIeXKjjJLlGA0hr1NQMvvbTRKqZctSjROvJWq3/kfh4Pf9FAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737494132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nex7ERAPsnqsJ5fY65h0aM4VsjcgjGQ1orxqKkEAhv0=; b=cSR5FjsZGbRFHJe4KYCX3Z3H9eBNkSrgyPzZs98SZ+tKh5vo5vbz2AB5p8vB1pcWW0KgDo cjqBUlQ9kXfD4h6CZ9ERcSWjIUHCswSzXLdN2Uhz59W4QebP6evBBFT4V02t8Ew77cQXcd SA8VXsub55wkEi+6QBdEH1d/oDYfqvShLmS41avQsiMqzsS7TM4YRpEFiQZ6PJC+Ecve/f yG/DUJ2qwvktAOANL7/ufKUqeFCZeSCqODM+Ed6aCtP60ck6c0sehKo/JKNyfZwM7ifzpN Bv8qez4dq6P2nFSj3NNZdauZ/PHOFOtAgCJp1PlsvJyI5kdkcmtr8d/mJvM5lg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737494132; a=rsa-sha256; cv=none; b=a+uonwTTONSP75721uOdXWKI57bGidv7HmD3IBx9GjMxPNJzND7pw+paiTxiQgEp753XRt slYBTCQ1ufE4hsgZMpDv7/WmgvQ1nJpUeBbPrRgJGov6PLXCZF+E2oofNfMUTiP4ajsXAi jIJoqAmmySY+iiQtL/vqgkqk2Wz9YKd0CxDnEx+O4biBiHEO28r3UlBMcobWJXgQ1Ab9bI 5iAhoGQtbGx7bdQy0PW2P5DPgnZpt201RcSn0AyQXx5HlztUKPLjoJzAlw5k+aQbckwHFq HOr2qj4KXiB8WDYAamxCOUooCfErqy3AOOX/Gc1ON++L9MdqhPBD9/rYbizA9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yd0Ng5gSlz7gJ; Tue, 21 Jan 2025 21:15: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 50LLFVAu051071; Tue, 21 Jan 2025 21:15:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LLFVft051068; Tue, 21 Jan 2025 21:15:31 GMT (envelope-from git) Date: Tue, 21 Jan 2025 21:15:31 GMT Message-Id: <202501212115.50LLFVft051068@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Juraj Lutter Subject: git: c8b89c11a118 - main - periodic: set _localbase for periodic scripts from within periodic.conf 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: otis X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c8b89c11a1181e900acb638cfde7a55e92553175 Auto-Submitted: auto-generated The branch main has been updated by otis: URL: https://cgit.FreeBSD.org/src/commit/?id=c8b89c11a1181e900acb638cfde7a55e92553175 commit c8b89c11a1181e900acb638cfde7a55e92553175 Author: Juraj Lutter AuthorDate: 2024-11-08 13:38:19 +0000 Commit: Juraj Lutter CommitDate: 2025-01-21 21:14:41 +0000 periodic: set _localbase for periodic scripts from within periodic.conf Set _localbase variable from within /etc/defaults/periodic.conf for use by periodic scripts. This fixes e5d7100c09, no other functional changes intended. Reported by: gahr, otis Reviewed by: markj, gahr MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D47486 --- usr.sbin/periodic/periodic.conf | 9 +++++++++ usr.sbin/periodic/periodic.sh | 12 ++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/usr.sbin/periodic/periodic.conf b/usr.sbin/periodic/periodic.conf index 3bb34d827564..7066c7b49fd1 100644 --- a/usr.sbin/periodic/periodic.conf +++ b/usr.sbin/periodic/periodic.conf @@ -15,6 +15,15 @@ # # +_set_localbase() { + _localbase=`/sbin/sysctl -n user.localbase 2> /dev/null` + # Set default value of _localbase if not previously set + : ${_localbase:="/usr/local"} +} + +# Set _localbase with fallback to /usr/local +_set_localbase + # What files override these defaults ? periodic_conf_files="/etc/periodic.conf /etc/periodic.conf.local ${_localbase}/etc/periodic.conf" diff --git a/usr.sbin/periodic/periodic.sh b/usr.sbin/periodic/periodic.sh index 09727a840eff..a310f04864da 100644 --- a/usr.sbin/periodic/periodic.sh +++ b/usr.sbin/periodic/periodic.sh @@ -29,14 +29,6 @@ if [ $# -lt 1 ] ; then usage fi -_localbase=`/sbin/sysctl -n user.localbase 2> /dev/null` -# Set default value of _localbase if not previously set -: ${_localbase:="/usr/local"} - -# Use a deterministic path to match the preset from /etc/crontab in case -# periodic is run interactively. -export PATH=/sbin:/bin:/usr/sbin:/usr/bin:${_localbase}/sbin:${_localbase}/bin - # If possible, check the global system configuration file, # to see if there are additional dirs to check if [ -r /etc/defaults/periodic.conf ]; then @@ -44,6 +36,10 @@ if [ -r /etc/defaults/periodic.conf ]; then source_periodic_confs fi +# Use a deterministic path to match the preset from /etc/crontab in case +# periodic is run interactively. +export PATH=/sbin:/bin:/usr/sbin:/usr/bin:${_localbase}/sbin:${_localbase}/bin + host=`hostname` export host From nobody Tue Jan 21 21:25:38 2025 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 4Yd0cL5B7Xz5lcqN; Tue, 21 Jan 2025 21:25:38 +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 4Yd0cL4Szhz3ryp; Tue, 21 Jan 2025 21:25:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737494738; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AseAioaMigpkDnk1wu6YOhLqDLDuayvuoy6JzfQztxA=; b=Wer7qcqi8WwxtzLj23XS2webYRbii8PuuEl8+51sLiBY6dxg4b2g89njFSIsfpTlXsU6h+ CcK/2ExK8kI7XAPTJzIm3Fo8Pi0ln9ZRQ9MB1bwFeqffvnXh76TxWeN8bvdH7AZFI7/2Wu ACRxYJQKMNCOSXY/3T0of+JDYfTMd4pGiJzG3omq6DYsDMAXYj6ZJFnGqlcd+SODXmLY1Z aOHQ9o/Ac9x8w3H0uxNU2GI/YXVG1JAfC5eotN15WnUMfZKNHMArnwCCXzcq2PNSVS7lDF DBta/4MZrvtRpGG4GGdfIAZPnwrJ39XHa8TXV7mG+oFBllhaPHgpUk3OEl7OkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737494738; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AseAioaMigpkDnk1wu6YOhLqDLDuayvuoy6JzfQztxA=; b=GP1VkjES8MZYjrAl3E4m3E8uzG/CufrbMs8lr+Gd/WBJJZC6QSRSa7pHwszfK9W+87W3mn f+tu6y3xixxm/2otWcwc0fERN43ZnCGr8m57v4lA55FoSX6QAPZT5ainSF16hqfg5jiowE iObIrZuT5iBXDk8X0OiJschFDQyoIptPha7ykxlslkrnrBktBMiMASpD/WP7hB61CC0Dz0 bigtkT1hbuWeceiksZj9j3z2bRHHaSr6hdubZXyF74y5e+RLrPck63CXdTkD2vRDkaArKn jwuRPlXaVWPc+jHoSvA6hwHi19zP0Z9IeaoUjWty+nFUsTSlUwz8bcUGYis/qQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737494738; a=rsa-sha256; cv=none; b=D7Eri/SE0j/j9lFaY0N1zWB7ESMAV/weIW97A8uBXqdoVOjPLayBHb3/35Sdfi4999UEDb 2VkteNUyKkShsJ8mR/g14PV1o2aLtJZLxF2xDrWehKg91FJPY0XnB4YziyFarFbtBepCJD Q8ubNYFuaF5GJ4CyoKXPykNeVyKnO7d4DMN6XDaBUDGWEgj5CnQ3chIDW7aXTd7kbYNS1g 57j4pVVVpktkAYgCexcGpfB8akq3ZSfcZbNHrXtC9ZG+ezsU2ucJf/2snid7rr9r9An9oz oGz735dBpz0Y8zCr66ZPPRhi86Cm58w2jiOuDnzOExApKfhnY1lLGEBdBtGXyA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yd0cL3f98z82g; Tue, 21 Jan 2025 21:25:38 +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 50LLPcSW070689; Tue, 21 Jan 2025 21:25:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LLPcfk070686; Tue, 21 Jan 2025 21:25:38 GMT (envelope-from git) Date: Tue, 21 Jan 2025 21:25:38 GMT Message-Id: <202501212125.50LLPcfk070686@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: 0fb33e049ac0 - main - bsd.cpu.mk: Add _CPUFLAGS to CXXFLAGS as well 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: 0fb33e049ac01ebe85a0bc2af670d4ac82df59c8 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0fb33e049ac01ebe85a0bc2af670d4ac82df59c8 commit 0fb33e049ac01ebe85a0bc2af670d4ac82df59c8 Author: Norikatsu Shigemura AuthorDate: 2025-01-20 20:53:19 +0000 Commit: Warner Losh CommitDate: 2025-01-21 21:24:10 +0000 bsd.cpu.mk: Add _CPUFLAGS to CXXFLAGS as well PR: 180365 Reviewed by: imp Sponsored by: Netflix --- share/mk/bsd.cpu.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk index 29eb4662dcdd..a2d4304f6245 100644 --- a/share/mk/bsd.cpu.mk +++ b/share/mk/bsd.cpu.mk @@ -350,6 +350,7 @@ CFLAGS += -march=rv64imafdc -mabi=lp64d .if !defined(NO_CPU_CFLAGS) CFLAGS += ${_CPUCFLAGS} +CXXFLAGS += ${_CPUCFLAGS} .endif # From nobody Tue Jan 21 21:25:39 2025 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 4Yd0cM4jcmz5lcbS; Tue, 21 Jan 2025 21:25: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 4Yd0cM45PSz3s42; Tue, 21 Jan 2025 21:25:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737494739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GTVsTOXUB7/WOIaRfL28/8JyFKNcOE6ypJcwHi3sjXg=; b=mGWiIQvOpDyEkcoqmpUJTAyLRettXMQk/IqGmAImkFHgaBtz9IkPFsNc5PdjL+jhaS1IOO fg44OzSOa9hKsnI+y+VxBVRHg/tNPIaeq9Y2nV7fFCINjY1GYEulZNgsmtKkwECVaopiqg hNTEtubEWUytkzFNLDl283CsJP7CT9/z4EUBhZusZYXrbQZvoDhq5sVxijZOYjxkwDXGn4 pQ/3S+nKKGrpz7dUzFqlzLmrOSrTLxXzavyRNiDo6YfRX4zPiY32GUC1xSgkQPdMMbhtte 1Xo8CTBlqfhmSXowl08ZYe5BrHsCzhByHMSXamtTLcxb6CFEqMp+WeUBX+fCrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737494739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GTVsTOXUB7/WOIaRfL28/8JyFKNcOE6ypJcwHi3sjXg=; b=d05xef4YjwSmAxkRDhOoNxwoVjC038JdsmQ54mWyrpXEllx3j926x4CWOFIOfyskjsyqYE fpvURloECgjCSJ6nrdMmNzDKgm6Gue4fewRJJDLsHD7k/+4dkF5SAL02DiYheer6X+bD/a 9mAQgqcW8mO2eDyEWFxwau/VsJsgsVgbnRWmhq+SOoo0MPKh9fMcxNbcTLLJ/c0p9kmYHV GPaQnukE5i6RFzCTGYd1mNvYZoBFisO+QVLaIell9syFl2oYq1cJYyz+ndHTHWB3HwgfzO Rz0Qv8YtUGHa7y8qnVjsppR8sFWqOlxLVDR6gLEKolMYRv5ZfpCztV1rQfG6Ww== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737494739; a=rsa-sha256; cv=none; b=k8P5nTK9Z66zfdDfVfpbtsAns+1mQ1GNwGMWw59Mxgm9nAg6pwdZQZrqTK74oIhRYs1730 VO04rXLG9PRans7/4AWvyn+9WuuA6LeXhCOxkGHjuFnyQCNjgj4QPsd7Cn5dCmxOX3rH6Z b8TVfU5XLa68Ft6l4abvlMbLKb8tjGYWyQlVoDk/hsvSMzFui/pTGiSOxgRGc0PU3QwcZN /SVzcSUX6D5ejQKXFYAU/Lvj15bistCPJUk9DPntYlTMsFCfwUKljKGStxVBYyGYcezvGe aafI0hpuZhz5Fbcs9xkPRKuMwIUvrc6sq2P4mvXJv8BrcOIgIPZEGhYHD65qog== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yd0cM3Yxqz86v; Tue, 21 Jan 2025 21:25: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 50LLPdMv070724; Tue, 21 Jan 2025 21:25:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LLPdxa070720; Tue, 21 Jan 2025 21:25:39 GMT (envelope-from git) Date: Tue, 21 Jan 2025 21:25:39 GMT Message-Id: <202501212125.50LLPdxa070720@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: cc6d72cfccf0 - main - bsd.cpu.mk: Remove xscale reference 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: cc6d72cfccf0ffe0dc16fce6442813184d77503c Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=cc6d72cfccf0ffe0dc16fce6442813184d77503c commit cc6d72cfccf0ffe0dc16fce6442813184d77503c Author: Warner Losh AuthorDate: 2025-01-20 20:56:55 +0000 Commit: Warner Losh CommitDate: 2025-01-21 21:24:10 +0000 bsd.cpu.mk: Remove xscale reference We've retired all the armv5te support, so we don't need this here anymore. Sponsored by: Netflix --- share/mk/bsd.cpu.mk | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk index a2d4304f6245..f6599a0ad802 100644 --- a/share/mk/bsd.cpu.mk +++ b/share/mk/bsd.cpu.mk @@ -98,11 +98,7 @@ _CPUCFLAGS = -march=${CPUTYPE} . elif ${MACHINE_CPUARCH} == "amd64" _CPUCFLAGS = -march=${CPUTYPE} . elif ${MACHINE_CPUARCH} == "arm" -. if ${CPUTYPE} == "xscale" -#XXX: gcc doesn't seem to like -mcpu=xscale, and dies while rebuilding itself -#_CPUCFLAGS = -mcpu=xscale -_CPUCFLAGS = -march=armv5te -D__XSCALE__ -. elif ${CPUTYPE:M*soft*} != "" +. if ${CPUTYPE:M*soft*} != "" _CPUCFLAGS = -mfloat-abi=softfp . elif ${CPUTYPE} == "cortexa" _CPUCFLAGS = -march=armv7 -mfpu=vfp From nobody Tue Jan 21 21:50:04 2025 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 4Yd18X5sCtz5lf1s; Tue, 21 Jan 2025 21:50: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 4Yd18X53Tvz41Rq; Tue, 21 Jan 2025 21:50:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737496204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LAcbvx8p7DU0tZ6ijKPpFGTPM444KSNuawN2Tnn0ei0=; b=AEj7LBQvZ5elwdzOc7z9rfD9tw6R6rCQkvE6ABbkH7V/NmeQureLrRFZQzHtfMseiJtF23 22GW9Wx+mFCZVnMgvc5z0yc2NnZP38+B8d9QHtle6rp5cUuJF+R8c/8/DgzfJYeuctG4Dy kER3cDhc+6OlcE9p6lxeIZMbeTsoJzeYuF6H0jYEApKyle577wwOdA8tvgLD53V+sy+VtM jT6SZsILLI/bHkCujwScYk3dDJETrfTvSfoD9l2I3amM9knRXTZXGIEPsCIGOmVQBLvxhG DgauKaonsUMSIvVfZOIoE0KpchCqi4Sd7cKJJ9A2sB5YHynYK5y39LaovF9Opg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737496204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LAcbvx8p7DU0tZ6ijKPpFGTPM444KSNuawN2Tnn0ei0=; b=yziUcI4d8/ACteLwJtAQYjJDfnRxTkuaWu+9PoJpqg/TQxgvU739Zb9XG0092rxumSKIea DFNFa60iz4nI9DS2T7hZB02LaMtJ8bQAcsmrMGKAFLwDuhadCljRgXnrnkYcqpFy0bOtth aex+EPDtYSp2hoUFJtB6a91vrwAltW3TCh/0osZmuagrOju2YVmSn/H7RHzSWM1cHyhPEa Ymnl5YzhDOx4cZ2ABabIsDNKNEVKzS5FP9wp9MVbSnP4/L2iEe+EV8iM2jZzETMHIW3/KC lWSFAY1lMFYrpVJpFHdqXgqYW2gKtsq8496qq6y/UxVzHJio/VWPNYYw3dLb3g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737496204; a=rsa-sha256; cv=none; b=bRzEn/VOLuuwj8aOSsNyIcENuVSnIVaduALZyI4XQDqgzqJ2V8Obiimqs6NqiE+tbL76N1 SkEc8e38C9L7Rl4+P7eGiBnusr78lSH0QWfkng8V2PISv3AZsiGrfy0HHMvu59X7oNvYR6 Bhsv3GrDEWyWR+HVGtnzJg9tFxvX4BiVvyHho8vMn1GXGCUzo7mN5sDi7AEq/oStiLcrnX WRianNAyyaCBrNz8QYBhVXWkAU0MItn6LDD2DxXzQXAJ//qN6N9PB4Ajm2Mc+6Bcln/HFY zQcwRjgCWfflY8JdQt6oXs7LV11ZU1hjTefKqToEPjJP1axq/4dKI2DIQ1JbSQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yd18X4GWJz8ln; Tue, 21 Jan 2025 21:50: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 50LLo479011193; Tue, 21 Jan 2025 21:50:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LLo4pt011189; Tue, 21 Jan 2025 21:50:04 GMT (envelope-from git) Date: Tue, 21 Jan 2025 21:50:04 GMT Message-Id: <202501212150.50LLo4pt011189@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: 81b076e43aa6 - main - fibs tests: Fix test failures and simplify 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: 81b076e43aa63ac255996093233ab3560a23977e Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=81b076e43aa63ac255996093233ab3560a23977e commit 81b076e43aa63ac255996093233ab3560a23977e Author: Mark Johnston AuthorDate: 2025-01-21 21:44:25 +0000 Commit: Mark Johnston CommitDate: 2025-01-21 21:44:25 +0000 fibs tests: Fix test failures and simplify The tests previously expected the invoker to pass a list of FIBs to use. However, they now run in separate VNET jails, so we can simply expand the FIB array as needed in each test. Modify each test to simply set net.fibs as needed and grab FIB numbers starting at 1. A number of tests were also broken by commit 9206c7996198 ("usr.bin/netstat: -n should not print symbolic names"), so fix those. Reviewed by: asomers Fixes: 9206c7996198 ("usr.bin/netstat: -n should not print symbolic names") MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D48585 --- tests/sys/netinet/fibs_test.sh | 43 ++++++++++++------------------------------ 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/tests/sys/netinet/fibs_test.sh b/tests/sys/netinet/fibs_test.sh index 5c1a918abb2c..a57d999496fc 100644 --- a/tests/sys/netinet/fibs_test.sh +++ b/tests/sys/netinet/fibs_test.sh @@ -30,9 +30,6 @@ # Authors: Alan Somers (Spectra Logic Corporation) # -# All of the tests in this file requires the test-suite config variable "fibs" -# to be defined to a space-delimited list of FIBs that may be used for testing. - # arpresolve should check the interface fib for routes to a target when # creating an ARP table entry. This is a regression for kern/167947, where # arpresolve only checked the default route. @@ -48,7 +45,6 @@ arpresolve_checks_interface_fib_head() { atf_set "descr" "arpresolve should check the interface fib, not the default fib, for routes" atf_set "require.user" "root" - atf_set "require.config" "fibs" atf_set "require.progs" "nping" } arpresolve_checks_interface_fib_body() @@ -100,7 +96,6 @@ loopback_and_network_routes_on_nondefault_fib_head() { atf_set "descr" "When creating and deleting loopback IPv4 routes, use the interface's fib" atf_set "require.user" "root" - atf_set "require.config" "fibs" } loopback_and_network_routes_on_nondefault_fib_body() @@ -157,7 +152,6 @@ loopback_and_network_routes_on_nondefault_fib_inet6_head() { atf_set "descr" "When creating and deleting loopback IPv6 routes, use the interface's fib" atf_set "require.user" "root" - atf_set "require.config" "fibs" } loopback_and_network_routes_on_nondefault_fib_inet6_body() @@ -216,7 +210,6 @@ default_route_with_multiple_fibs_on_same_subnet_head() { atf_set "descr" "Multiple interfaces on the same subnet but with different fibs can both have default IPv4 routes" atf_set "require.user" "root" - atf_set "require.config" "fibs" } default_route_with_multiple_fibs_on_same_subnet_body() @@ -247,9 +240,9 @@ default_route_with_multiple_fibs_on_same_subnet_body() # Verify that the default route exists for both fibs, with their # respective interfaces. - atf_check -o match:"^default.*${TAP0}$" \ + atf_check -o match:"^0\.0\.0\.0.*${TAP0}$" \ setfib ${FIB0} netstat -rn -f inet - atf_check -o match:"^default.*${TAP1}$" \ + atf_check -o match:"^0\.0\.0\.0.*${TAP1}$" \ setfib ${FIB1} netstat -rn -f inet } @@ -263,7 +256,6 @@ default_route_with_multiple_fibs_on_same_subnet_inet6_head() { atf_set "descr" "Multiple interfaces on the same subnet but with different fibs can both have default IPv6 routes" atf_set "require.user" "root" - atf_set "require.config" "fibs" } default_route_with_multiple_fibs_on_same_subnet_inet6_body() @@ -294,9 +286,9 @@ default_route_with_multiple_fibs_on_same_subnet_inet6_body() # Verify that the default route exists for both fibs, with their # respective interfaces. - atf_check -o match:"^default.*${TAP0}$" \ + atf_check -o match:"^::/0.*${TAP0}$" \ setfib ${FIB0} netstat -rn -f inet6 - atf_check -o match:"^default.*${TAP1}$" \ + atf_check -o match:"^::/0.*${TAP1}$" \ setfib ${FIB1} netstat -rn -f inet6 } @@ -315,7 +307,6 @@ same_ip_multiple_ifaces_fib0_head() { atf_set "descr" "Can remove an IPv4 alias from an interface when the same IPv4 is also assigned to another interface." atf_set "require.user" "root" - atf_set "require.config" "fibs" } same_ip_multiple_ifaces_fib0_body() { @@ -358,7 +349,6 @@ same_ip_multiple_ifaces_head() { atf_set "descr" "Can remove an IPv4 alias from an interface when the same address is also assigned to another interface, on non-default FIBs." atf_set "require.user" "root" - atf_set "require.config" "fibs" } same_ip_multiple_ifaces_body() { @@ -404,7 +394,6 @@ same_ip_multiple_ifaces_inet6_head() { atf_set "descr" "Can remove an IPv6 alias from an interface when the same address is also assigned to another interface, on non-default FIBs." atf_set "require.user" "root" - atf_set "require.config" "fibs" } same_ip_multiple_ifaces_inet6_body() { @@ -446,7 +435,7 @@ slaac_on_nondefault_fib6_head() { atf_set "descr" "SLAAC correctly installs routes on non-default FIBs" atf_set "require.user" "root" - atf_set "require.config" "fibs" "allow_sysctl_side_effects" + atf_set "require.config" "allow_sysctl_side_effects" } slaac_on_nondefault_fib6_body() { @@ -490,7 +479,7 @@ slaac_on_nondefault_fib6_body() atf_check -o match:"${SUBNET}:/${MASK}.*\.*$EPAIRB" \ netstat -rnf inet6 -F $FIB1 # Check default route - atf_check -o match:"default.*\.*$EPAIRB" \ + atf_check -o match:"^::/0.*\.*$EPAIRB" \ netstat -rnf inet6 -F $FIB1 # Check that none of the above routes appeared on other routes @@ -533,7 +522,6 @@ subnet_route_with_multiple_fibs_on_same_subnet_head() { atf_set "descr" "Multiple FIBs can have IPv4 subnet routes for the same subnet" atf_set "require.user" "root" - atf_set "require.config" "fibs" } subnet_route_with_multiple_fibs_on_same_subnet_body() @@ -570,7 +558,6 @@ subnet_route_with_multiple_fibs_on_same_subnet_inet6_head() { atf_set "descr" "Multiple FIBs can have IPv6 subnet routes for the same subnet" atf_set "require.user" "root" - atf_set "require.config" "fibs" } subnet_route_with_multiple_fibs_on_same_subnet_inet6_body() @@ -620,7 +607,6 @@ udp_dontroute_head() { atf_set "descr" "Source address selection for UDP packets with SO_DONTROUTE on non-default FIBs works" atf_set "require.user" "root" - atf_set "require.config" "fibs" } udp_dontroute_body() @@ -671,7 +657,6 @@ udp_dontroute6_head() { atf_set "descr" "Source address selection for UDP IPv6 packets with SO_DONTROUTE on non-default FIBs works" atf_set "require.user" "root" - atf_set "require.config" "fibs" } udp_dontroute6_body() @@ -748,15 +733,13 @@ get_fibs() { NUMFIBS=$1 net_fibs=`sysctl -n net.fibs` + if [ $net_fibs -lt $(($NUMFIBS + 1)) ]; then + atf_check -o ignore sysctl net.fibs=$(($NUMFIBS + 1)) + net_fibs=`sysctl -n net.fibs` + fi i=0 while [ $i -lt "$NUMFIBS" ]; do - fib=`atf_config_get "fibs" | \ - awk -v i=$(( i + 1 )) '{print $i}'` - echo "fib is ${fib}" - eval FIB${i}=${fib} - if [ "$fib" -ge "$net_fibs" ]; then - atf_skip "The ${i}th configured fib is ${fib}, which is not less than net.fibs, which is ${net_fibs}" - fi + eval FIB${i}=$(($i + 1)) i=$(( $i + 1 )) done } @@ -816,9 +799,7 @@ setup_iface() local ADDR=$4 local MASK=$5 local FLAGS=$6 - echo setfib ${FIB} \ - ifconfig $IFACE ${PROTO} ${ADDR}/${MASK} fib $FIB $FLAGS - setfib ${FIB} ifconfig $IFACE ${PROTO} ${ADDR}/${MASK} fib $FIB $FLAGS + atf_check setfib ${FIB} ifconfig $IFACE ${PROTO} ${ADDR}/${MASK} fib $FIB $FLAGS } # Create a tap(4) interface, configure it, and register it for cleanup. From nobody Tue Jan 21 22:05:06 2025 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 4Yd1Tv1TW2z5lfZB; Tue, 21 Jan 2025 22:05: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 4Yd1Tv0ZFbz43df; Tue, 21 Jan 2025 22:05:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737497107; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3fP2omkemoH+HkM1zeLt1WndhGxcpZHGbhJXSo6xjas=; b=RtUvYVzWvb7a5z1B6kf9GvVYhQ0/FCpOy0+25Ln5nlg4ctQpLMQqJPxdBqEEXfkJb4fqln INCyGrdlfge7KxNauao3FyikNgkETf/Quyxe6WW/vc/NZrW/aoWm8Z45tD4pvisrR508kL be0cuiIOo/debH9yPBzFogeXgwJv65BeNvis6os+iDFxr2KJjiJHwNbS5pYIdDnd7CGi44 2LfoZlku6qVJWaw/cCqmGJ/garPknoU6YWdACRuumcDZ1fZapqT6UFzyVmCd4vDPpZ3jpj sGEYHVaw8ITYzHRMw1QwTELnnN6MyDi2OFxBcykZozFJfNBfhuOZ4NIzFdA3Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737497107; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3fP2omkemoH+HkM1zeLt1WndhGxcpZHGbhJXSo6xjas=; b=JZtEht6S+FL+cyrSB5FWeoNmY+z6OWSdivH4re6Mg5V5dTyxxyH1uF4G+Jhj4dAE7003jK U657Zi3GS2wkW/m+KJC6c+7C/Onezrd6oyW05rifuLl9OPWiuU0hoJfX0ZHlRR/cljn3wZ z+44pTTjyrfx6npdzjchQb/jkkNq8gP2h1auQrfMloeI77Sd0hrxIj94nVopLfqJ51PaAW C6t2eap7NkhlEJFFpZlesg1w/n8M6WOytq/ov5ilzmQl1sDHb2jsDMlhs5OyjIkxaQPeKG o0fXoWnZ+K8b7WTC+exl+GU/rljd/V4evgoWpQxw4lCpyKQ0dKmJqLgy/Ta94w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737497107; a=rsa-sha256; cv=none; b=m/gcsAaKg6FIyiOw/GKZ2cOpYjaYpiEMhla2aNeYEoY4GJXOyh28fe2hwqvuQ/RMtGdxLt GT6A07hj/wk3vvsS7WIhbU3iIfqZrEEJEU/kIVPBnHKUM5+8JAE9tKnY5OCia6bn3CCvP7 5H8FzkLQ3vH3sGsMvzA2kxak0aT3W/2L4N1xjCmP8tt+zy+uCtCmvjphD+Xha4I1sAzrai zWxj0T5fJuUXS00jLUGUoIlprRZgHA5ZEwDTd1AJKP55wP6OuFSBJpoXFO+3cmHVQ109kn 7noKfsbI+Eja9+iov6p8v1TfyBjPqIUDNY7Zy4gwv5rJSgTkEPhYDPlHIANDoA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yd1Tv07skz8sB; Tue, 21 Jan 2025 22:05: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 50LM56RC046769; Tue, 21 Jan 2025 22:05:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LM56Kj046766; Tue, 21 Jan 2025 22:05:06 GMT (envelope-from git) Date: Tue, 21 Jan 2025 22:05:06 GMT Message-Id: <202501212205.50LM56Kj046766@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: 6d48eafa334f - main - checkstyle9.pl: don't require Signed-off-by for committers 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: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6d48eafa334f102009dbca9d191c6bbf52855551 Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=6d48eafa334f102009dbca9d191c6bbf52855551 commit 6d48eafa334f102009dbca9d191c6bbf52855551 Author: Brooks Davis AuthorDate: 2025-01-21 20:47:29 +0000 Commit: Brooks Davis CommitDate: 2025-01-21 22:02:56 +0000 checkstyle9.pl: don't require Signed-off-by for committers Silence the warning about Signed-off-by: lines if the Author: is using a FreeBSD.org address. We don't require the lines in direct FreeBSD commits so the warning is just noise in this case. Reviwed by: imp, emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/1577 --- tools/build/checkstyle9.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/build/checkstyle9.pl b/tools/build/checkstyle9.pl index 50ff1e9bd680..5854cf613e01 100755 --- a/tools/build/checkstyle9.pl +++ b/tools/build/checkstyle9.pl @@ -1254,6 +1254,7 @@ sub process { my $in_header_lines = $file ? 0 : 1; my $in_commit_log = 0; #Scanning lines before patch my $has_sob = 0; + my $author_is_committer = 0; my $non_utf8_charset = 0; our @report = (); @@ -1454,6 +1455,10 @@ sub process { ERROR("Real email adress is needed\n" . $herecurr); } + if ($line =~ /^Author: .*[a-z-0-9]\@freebsd\.org/i) { + $author_is_committer = 1 + } + #check the patch for a signoff: if ($line =~ /^\s*signed-off-by:/i) { # This is a signoff, if ugly, so do not double report. @@ -2654,7 +2659,7 @@ sub process { } - if ($has_sob == 0) { + if ($has_sob == 0 && $author_is_committer == 0) { WARN("Missing Signed-off-by: line"); } From nobody Tue Jan 21 22:46:18 2025 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 4Yd2PR253Kz5lj70; Tue, 21 Jan 2025 22:46: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 4Yd2PR1kSMz3DxQ; Tue, 21 Jan 2025 22:46:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737499579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GflHxWABUXxZt60/n+m7i3rFdBSnqhNFT4ossm2dcRA=; b=nyHOtVDS2isR8ke5uRWuxSXJOW36MBZxPsnp1S80HG3C99azU6b2sB94jQ6tiz+C49AkmG C92RiASvcQw8HJJhzbVg8X4/yazAT+GpJqYYATo9DSqqvCkU8hcq2BUpzxfYJG549WEx+O 7cnQbLOJXdwZt2it/Q3UZB6+KfkH/MSJteXviVy13J87vgVSdEIuld8emKGunqvSvywG36 OyAuhMqG8qO2d1KDXWGGgy0HyvIb1NU4MGpdZ9DSZzajECQ/6QO/BiJBPJd8h/CNM/oEfp ZcfqFjGAoshFuG09hrgx2GORYb9Lx8E5mp5L9ygNZl1Qw4AdO59Tfb+RzElRvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737499579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GflHxWABUXxZt60/n+m7i3rFdBSnqhNFT4ossm2dcRA=; b=g7sqhOw08byexHEKgFeMsUNhy+R9f1JfC/lzVH6pPU4fnQcuvMEGmKdMufZO19EmpiH028 zTESqv+hq3Vcscya8+jj8lhT9UQMElvspgvr+J38a52YV2b7kTgMGsSUT/ZEFEgYsRaxSB 147LrKxk0mlnaHq6Xcv/M2ILDkt34Jtno1eeOugPbpAtIHKgqTG/5kdf+1J+qrSdCxBPAH 2W9Gj4z2PP/bt/0np6Vz2BBh6s3DXSgYNI4ScS3N83kxndvjvNs9sjuiW9x+BMqYgWTlLM rnBVRKn+HtITZaDWRWVmz9QwCGzpDVXnAcj/puFy6ZxzkIDcouGOxl+9Uv1xxQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737499579; a=rsa-sha256; cv=none; b=SFLEXQu8KrixFYxZpzWnorIHylflZUWJiY0F4OVaadYuQHgaUThe+upo48IL9tEdW3hd1J C8mgcHKb7W0mXRy/hwztztN9+pekuDNlQAly2/Pu7hsXd8uGA5uIfX1GSOd5G/c1iViAOJ a0XYPIiO1w/HpW2LP5O02lJy0FcAjNCl29MYzUZIAWk5HyFet7/YjVk7qKyAFGahRhkxKs ppihbp3q/ne3YdVx8roZAm52+6oL6M7ZmQnE06Gan+OlwfACDG2N78+hecyHx6ukXNjHUx Oz62mrTkx9xYDEbMBzCxEgovUwHOOcF66SPD4SPxXT5uXTOBwo5p2IcfYOQ5ag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yd2PR0vcPzBMc; Tue, 21 Jan 2025 22:46: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 50LMkIKi021860; Tue, 21 Jan 2025 22: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 50LMkIrk021857; Tue, 21 Jan 2025 22:46:18 GMT (envelope-from git) Date: Tue, 21 Jan 2025 22:46:18 GMT Message-Id: <202501212246.50LMkIrk021857@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: c669b08bd834 - main - vm_phys: reduce touching of page->pool fields 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: dougm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c669b08bd834553ec056e3987693f247b2ec0433 Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=c669b08bd834553ec056e3987693f247b2ec0433 commit c669b08bd834553ec056e3987693f247b2ec0433 Author: Doug Moore AuthorDate: 2025-01-21 22:35:25 +0000 Commit: Doug Moore CommitDate: 2025-01-21 22:35:25 +0000 vm_phys: reduce touching of page->pool fields Change the usage of the pool field in vm_page structs. Currently, every page belongs to a pool, and the pool field identifies that pool, whether the page is allocated or free. With this change, the pool field of the first page of a free block is used by the buddy allocator to identify its pool, but the buddy allocator makes no guarantees about the pool field value for allocated pages. The buddy allocator requires that a pool parameter be passed as part of freeing memory. A function that allocates memory may use the pool field of a page to record what pool to pass as that parameter when the memory is freed, but might not need to do so for every allocated page. Suggested by: alc Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D45409 --- sys/vm/vm_kern.c | 2 +- sys/vm/vm_page.c | 97 ++++++++++++++++++++++-------------------- sys/vm/vm_phys.c | 123 ++++++++++++++++++++++++++++------------------------- sys/vm/vm_phys.h | 6 +-- sys/vm/vm_reserv.c | 35 ++++++++------- 5 files changed, 140 insertions(+), 123 deletions(-) diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 86ab2529e27f..2b85dbde1dd6 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -953,7 +953,7 @@ kmem_bootstrap_free(vm_offset_t start, vm_size_t size) vmd = vm_pagequeue_domain(m); vm_domain_free_lock(vmd); - vm_phys_free_pages(m, 0); + vm_phys_free_pages(m, m->pool, 0); vm_domain_free_unlock(vmd); vm_domain_freecnt_inc(vmd, 1); diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index ba22c7f97f2f..961b32da6599 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -572,6 +572,7 @@ vm_page_startup(vm_offset_t vaddr) #if defined(__i386__) && defined(VM_PHYSSEG_DENSE) long ii; #endif + int pool; #ifdef VM_FREEPOOL_LAZYINIT int lazyinit; #endif @@ -651,6 +652,8 @@ vm_page_startup(vm_offset_t vaddr) dump_add_page(pa); pa += PAGE_SIZE; } +#else + (void)pa; #endif /* * Compute the number of pages of memory that will be available for @@ -755,9 +758,12 @@ vm_page_startup(vm_offset_t vaddr) */ vm_phys_init(); + pool = VM_FREEPOOL_DEFAULT; #ifdef VM_FREEPOOL_LAZYINIT lazyinit = 1; TUNABLE_INT_FETCH("debug.vm.lazy_page_init", &lazyinit); + if (lazyinit) + pool = VM_FREEPOOL_LAZYINIT; #endif /* @@ -777,48 +783,27 @@ vm_page_startup(vm_offset_t vaddr) seg = &vm_phys_segs[segind]; /* - * If lazy vm_page initialization is not enabled, simply - * initialize all of the pages in the segment. Otherwise, we - * only initialize: - * 1. Pages not covered by phys_avail[], since they might be - * freed to the allocator at some future point, e.g., by - * kmem_bootstrap_free(). - * 2. The first page of each run of free pages handed to the - * vm_phys allocator, which in turn defers initialization - * of pages until they are needed. - * This avoids blocking the boot process for long periods, which - * may be relevant for VMs (which ought to boot as quickly as - * possible) and/or systems with large amounts of physical - * memory. + * Initialize pages not covered by phys_avail[], since they + * might be freed to the allocator at some future point, e.g., + * by kmem_bootstrap_free(). */ -#ifdef VM_FREEPOOL_LAZYINIT - if (lazyinit) { - startp = seg->start; - for (i = 0; phys_avail[i + 1] != 0; i += 2) { - if (startp >= seg->end) - break; - - if (phys_avail[i + 1] < startp) - continue; - if (phys_avail[i] <= startp) { - startp = phys_avail[i + 1]; - continue; - } - - m = vm_phys_seg_paddr_to_vm_page(seg, startp); - for (endp = MIN(phys_avail[i], seg->end); - startp < endp; startp += PAGE_SIZE, m++) { - vm_page_init_page(m, startp, segind, - VM_FREEPOOL_DEFAULT); - } + startp = seg->start; + for (i = 0; phys_avail[i + 1] != 0; i += 2) { + if (startp >= seg->end) + break; + if (phys_avail[i + 1] < startp) + continue; + if (phys_avail[i] <= startp) { + startp = phys_avail[i + 1]; + continue; } - } else -#endif - for (m = seg->first_page, pa = seg->start; - pa < seg->end; m++, pa += PAGE_SIZE) { - vm_page_init_page(m, pa, segind, + m = vm_phys_seg_paddr_to_vm_page(seg, startp); + for (endp = MIN(phys_avail[i], seg->end); + startp < endp; startp += PAGE_SIZE, m++) { + vm_page_init_page(m, startp, segind, VM_FREEPOOL_DEFAULT); } + } /* * Add the segment's pages that are covered by one of @@ -835,16 +820,30 @@ vm_page_startup(vm_offset_t vaddr) if (pagecount == 0) continue; + /* + * If lazy vm_page initialization is not enabled, simply + * initialize all of the pages in the segment covered by + * phys_avail. Otherwise, initialize only the first + * page of each run of free pages handed to the vm_phys + * allocator, which in turn defers initialization of + * pages until they are needed. + * + * This avoids blocking the boot process for long + * periods, which may be relevant for VMs (which ought + * to boot as quickly as possible) and/or systems with + * large amounts of physical memory. + */ m = vm_phys_seg_paddr_to_vm_page(seg, startp); -#ifdef VM_FREEPOOL_LAZYINIT - if (lazyinit) { - vm_page_init_page(m, startp, segind, - VM_FREEPOOL_LAZYINIT); + vm_page_init_page(m, startp, segind, pool); + if (pool == VM_FREEPOOL_DEFAULT) { + for (int j = 1; j < pagecount; j++) { + vm_page_init_page(&m[j], + startp + ptoa(j), segind, pool); + } } -#endif vmd = VM_DOMAIN(seg->domain); vm_domain_free_lock(vmd); - vm_phys_enqueue_contig(m, pagecount); + vm_phys_enqueue_contig(m, pool, pagecount); vm_domain_free_unlock(vmd); vm_domain_freecnt_inc(vmd, pagecount); vm_cnt.v_page_count += (u_int)pagecount; @@ -2341,6 +2340,7 @@ found: m->flags = flags; m->a.flags = 0; m->oflags = (object->flags & OBJ_UNMANAGED) != 0 ? VPO_UNMANAGED : 0; + m->pool = VM_FREEPOOL_DEFAULT; if ((req & (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)) == 0) m->busy_lock = VPB_CURTHREAD_EXCLUSIVE; else if ((req & VM_ALLOC_SBUSY) != 0) @@ -2558,6 +2558,7 @@ vm_page_alloc_contig_domain(vm_object_t object, vm_pindex_t pindex, int domain, m->ref_count = 1; m->a.act_count = 0; m->oflags = oflags; + m->pool = VM_FREEPOOL_DEFAULT; if (vm_page_iter_insert(&pages, m, object, pindex, mpred)) { if ((req & VM_ALLOC_WIRED) != 0) vm_wire_sub(npages); @@ -2655,6 +2656,7 @@ found: m->flags = (m->flags & PG_ZERO) | flags; m->a.flags = 0; m->oflags = VPO_UNMANAGED; + m->pool = VM_FREEPOOL_DIRECT; m->busy_lock = VPB_UNBUSIED; if ((req & VM_ALLOC_WIRED) != 0) { vm_wire_add(1); @@ -2803,6 +2805,7 @@ vm_page_alloc_noobj_contig_domain(int domain, int req, u_long npages, m->ref_count = 1; m->a.act_count = 0; m->oflags = VPO_UNMANAGED; + m->pool = VM_FREEPOOL_DIRECT; /* * Zero the page before updating any mappings since the page is @@ -2881,7 +2884,7 @@ vm_page_zone_release(void *arg, void **store, int cnt) vm_domain_free_lock(vmd); for (i = 0; i < cnt; i++) { m = (vm_page_t)store[i]; - vm_phys_free_pages(m, 0); + vm_phys_free_pages(m, pgcache->pool, 0); } vm_domain_free_unlock(vmd); vm_domain_freecnt_inc(vmd, cnt); @@ -3266,7 +3269,7 @@ unlock: do { MPASS(vm_page_domain(m) == domain); SLIST_REMOVE_HEAD(&free, plinks.s.ss); - vm_phys_free_pages(m, 0); + vm_phys_free_pages(m, m->pool, 0); cnt++; } while ((m = SLIST_FIRST(&free)) != NULL); vm_domain_free_unlock(vmd); @@ -4271,7 +4274,7 @@ vm_page_free_toq(vm_page_t m) return; } vm_domain_free_lock(vmd); - vm_phys_free_pages(m, 0); + vm_phys_free_pages(m, m->pool, 0); vm_domain_free_unlock(vmd); vm_domain_freecnt_inc(vmd, 1); } diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c index cf1ed5818b2f..a8b40b004d86 100644 --- a/sys/vm/vm_phys.c +++ b/sys/vm/vm_phys.c @@ -187,7 +187,7 @@ SYSCTL_INT(_vm, OID_AUTO, ndomains, CTLFLAG_RD, static void _vm_phys_create_seg(vm_paddr_t start, vm_paddr_t end, int domain); static void vm_phys_create_seg(vm_paddr_t start, vm_paddr_t end); static void vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, - int order, int tail); + int order, int pool, int tail); static bool __diagused vm_phys_pool_valid(int pool) @@ -391,10 +391,12 @@ sysctl_vm_phys_locality(SYSCTL_HANDLER_ARGS) #endif static void -vm_freelist_add(struct vm_freelist *fl, vm_page_t m, int order, int tail) +vm_freelist_add(struct vm_freelist *fl, vm_page_t m, int order, int pool, + int tail) { m->order = order; + m->pool = pool; if (tail) TAILQ_INSERT_TAIL(&fl[order].pl, m, listq); else @@ -687,7 +689,7 @@ vm_phys_register_domains(int ndomains __numa_used, */ static __inline void vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, int order, - int tail) + int pool, int tail) { vm_page_t m_buddy; @@ -697,19 +699,20 @@ vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, int order, KASSERT(m_buddy->order == VM_NFREEORDER, ("vm_phys_split_pages: page %p has unexpected order %d", m_buddy, m_buddy->order)); - vm_freelist_add(fl, m_buddy, oind, tail); + vm_freelist_add(fl, m_buddy, oind, pool, tail); } } static void -vm_phys_enq_chunk(struct vm_freelist *fl, vm_page_t m, int order, int tail) +vm_phys_enq_chunk(struct vm_freelist *fl, vm_page_t m, int order, int pool, + int tail) { KASSERT(order >= 0 && order < VM_NFREEORDER, ("%s: invalid order %d", __func__, order)); - vm_freelist_add(fl, m, order, tail); + vm_freelist_add(fl, m, order, pool, tail); #ifdef VM_FREEPOOL_LAZYINIT - if (__predict_false(m->pool == VM_FREEPOOL_LAZYINIT)) { + if (__predict_false(pool == VM_FREEPOOL_LAZYINIT)) { vm_page_t m_next; vm_paddr_t pa; int npages; @@ -738,7 +741,8 @@ vm_phys_enq_chunk(struct vm_freelist *fl, vm_page_t m, int order, int tail) * The physical page m's buddy must not be free. */ static void -vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail) +vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool, + int tail) { int order; @@ -754,7 +758,7 @@ vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail) order = ilog2(npages); KASSERT(order < VM_NFREEORDER, ("%s: order %d is out of range", __func__, order)); - vm_phys_enq_chunk(fl, m, order, tail); + vm_phys_enq_chunk(fl, m, order, pool, tail); m += 1 << order; npages -= 1 << order; } @@ -774,7 +778,8 @@ vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail) * parameter m. Otherwise, the physical page m's buddy must not be free. */ static vm_page_t -vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail) +vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool, + int tail) { int order; @@ -788,7 +793,7 @@ vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail) ("vm_phys_enq_range: page %p has unexpected order %d", m, m->order)); order = ffs(npages) - 1; - vm_phys_enq_chunk(fl, m, order, tail); + vm_phys_enq_chunk(fl, m, order, pool, tail); m += 1 << order; npages -= 1 << order; } @@ -796,33 +801,30 @@ vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail) } /* - * Set the pool for a contiguous, power of two-sized set of physical pages. + * Complete initialization of a contiguous, power of two-sized set of physical + * pages. * * If the pages currently belong to the lazy init pool, then the corresponding * page structures must be initialized. In this case it is assumed that the * first page in the run has already been initialized. */ static void -vm_phys_set_pool(int pool, vm_page_t m, int order) +vm_phys_finish_init(vm_page_t m, int order) { #ifdef VM_FREEPOOL_LAZYINIT if (__predict_false(m->pool == VM_FREEPOOL_LAZYINIT)) { vm_paddr_t pa; int segind; - m->pool = pool; - TSENTER(); pa = m->phys_addr + PAGE_SIZE; segind = m->segind; for (vm_page_t m_tmp = m + 1; m_tmp < &m[1 << order]; m_tmp++, pa += PAGE_SIZE) - vm_page_init_page(m_tmp, pa, segind, pool); + vm_page_init_page(m_tmp, pa, segind, VM_NFREEPOOL); TSEXIT(); - } else + } #endif - for (vm_page_t m_tmp = m; m_tmp < &m[1 << order]; m_tmp++) - m_tmp->pool = pool; } /* @@ -833,7 +835,8 @@ vm_phys_set_pool(int pool, vm_page_t m, int order) * The returned pages may not be physically contiguous. However, in contrast * to performing multiple, back-to-back calls to vm_phys_alloc_pages(..., 0), * calling this function once to allocate the desired number of pages will - * avoid wasted time in vm_phys_split_pages(). + * avoid wasted time in vm_phys_split_pages(). The allocated pages have no + * valid pool field set. * * The free page queues for the specified domain must be locked. */ @@ -869,7 +872,8 @@ vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[]) * Return excess pages to fl. Its order * [0, oind) queues are empty. */ - vm_phys_enq_range(m, avail - i, fl, 1); + vm_phys_enq_range(m, avail - i, fl, + pool, 1); return (npages); } } @@ -881,7 +885,7 @@ vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[]) while ((m = TAILQ_FIRST(&alt[oind].pl)) != NULL) { vm_freelist_rem(alt, m, oind); - vm_phys_set_pool(pool, m, oind); + vm_phys_finish_init(m, oind); avail = i + (1 << oind); end = imin(npages, avail); while (i < end) @@ -893,7 +897,7 @@ vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[]) * are empty. */ vm_phys_enq_range(m, avail - i, - fl, 1); + fl, pool, 1); return (npages); } } @@ -940,7 +944,7 @@ vm_phys_alloc_freelist_pages(int domain, int freelist, int pool, int order) if (m != NULL) { vm_freelist_rem(fl, m, oind); /* The order [order, oind) queues are empty. */ - vm_phys_split_pages(m, oind, fl, order, 1); + vm_phys_split_pages(m, oind, fl, order, pool, 1); return (m); } } @@ -957,9 +961,9 @@ vm_phys_alloc_freelist_pages(int domain, int freelist, int pool, int order) m = TAILQ_FIRST(&alt[oind].pl); if (m != NULL) { vm_freelist_rem(alt, m, oind); - vm_phys_set_pool(pool, m, oind); + vm_phys_finish_init(m, oind); /* The order [order, oind) queues are empty. */ - vm_phys_split_pages(m, oind, fl, order, 1); + vm_phys_split_pages(m, oind, fl, order, pool, 1); return (m); } } @@ -1198,11 +1202,12 @@ vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_paddr_t end) /* * Free a contiguous, power of two-sized set of physical pages. + * The pool field in the first page determines the destination pool. * * The free page queues must be locked. */ void -vm_phys_free_pages(vm_page_t m, int order) +vm_phys_free_pages(vm_page_t m, int pool, int order) { struct vm_freelist *fl; struct vm_phys_seg *seg; @@ -1210,13 +1215,12 @@ vm_phys_free_pages(vm_page_t m, int order) vm_page_t m_buddy; KASSERT(m->order == VM_NFREEORDER, - ("vm_phys_free_pages: page %p has unexpected order %d", - m, m->order)); - KASSERT(vm_phys_pool_valid(m->pool), - ("vm_phys_free_pages: page %p has unexpected pool %d", - m, m->pool)); + ("%s: page %p has unexpected order %d", + __func__, m, m->order)); + KASSERT(vm_phys_pool_valid(pool), + ("%s: unexpected pool param %d", __func__, pool)); KASSERT(order < VM_NFREEORDER, - ("vm_phys_free_pages: order %d is out of range", order)); + ("%s: order %d is out of range", __func__, order)); seg = &vm_phys_segs[m->segind]; vm_domain_free_assert_locked(VM_DOMAIN(seg->domain)); if (order < VM_NFREEORDER - 1) { @@ -1230,15 +1234,14 @@ vm_phys_free_pages(vm_page_t m, int order) break; fl = (*seg->free_queues)[m_buddy->pool]; vm_freelist_rem(fl, m_buddy, order); - if (m_buddy->pool != m->pool) - vm_phys_set_pool(m->pool, m_buddy, order); + vm_phys_finish_init(m_buddy, order); order++; pa &= ~(((vm_paddr_t)1 << (PAGE_SHIFT + order)) - 1); m = vm_phys_seg_paddr_to_vm_page(seg, pa); } while (order < VM_NFREEORDER - 1); } - fl = (*seg->free_queues)[m->pool]; - vm_freelist_add(fl, m, order, 1); + fl = (*seg->free_queues)[pool]; + vm_freelist_add(fl, m, order, pool, 1); } #ifdef VM_FREEPOOL_LAZYINIT @@ -1290,12 +1293,13 @@ vm_phys_lazy_init_domain(int domain, bool locked) VM_ALLOC_NORMAL, 1 << oind); if (unlocked) vm_domain_free_unlock(vmd); - vm_phys_set_pool(VM_FREEPOOL_DEFAULT, m, oind); + vm_phys_finish_init(m, oind); if (unlocked) { vm_domain_freecnt_inc(vmd, 1 << oind); vm_domain_free_lock(vmd); } - vm_phys_free_pages(m, oind); + vm_phys_free_pages(m, VM_FREEPOOL_DEFAULT, + oind); } } } @@ -1344,12 +1348,12 @@ SYSINIT(vm_phys_lazy_init, SI_SUB_SMP, SI_ORDER_ANY, vm_phys_lazy_sysinit, /* * Free a contiguous, arbitrarily sized set of physical pages, without - * merging across set boundaries. + * merging across set boundaries. Assumes no pages have a valid pool field. * * The free page queues must be locked. */ void -vm_phys_enqueue_contig(vm_page_t m, u_long npages) +vm_phys_enqueue_contig(vm_page_t m, int pool, u_long npages) { struct vm_freelist *fl; struct vm_phys_seg *seg; @@ -1363,14 +1367,15 @@ vm_phys_enqueue_contig(vm_page_t m, u_long npages) */ vm_domain_free_assert_locked(vm_pagequeue_domain(m)); seg = &vm_phys_segs[m->segind]; - fl = (*seg->free_queues)[m->pool]; + fl = (*seg->free_queues)[pool]; m_end = m + npages; /* Free blocks of increasing size. */ lo = atop(VM_PAGE_TO_PHYS(m)); if (m < m_end && (diff = lo ^ (lo + npages - 1)) != 0) { order = min(ilog2(diff), VM_NFREEORDER - 1); - m = vm_phys_enq_range(m, roundup2(lo, 1 << order) - lo, fl, 1); + m = vm_phys_enq_range(m, roundup2(lo, 1 << order) - lo, fl, + pool, 1); } /* Free blocks of maximum size. */ @@ -1379,20 +1384,22 @@ vm_phys_enqueue_contig(vm_page_t m, u_long npages) KASSERT(seg == &vm_phys_segs[m->segind], ("%s: page range [%p,%p) spans multiple segments", __func__, m_end - npages, m)); - vm_phys_enq_chunk(fl, m, order, 1); + vm_phys_enq_chunk(fl, m, order, pool, 1); m += 1 << order; } /* Free blocks of diminishing size. */ - vm_phys_enq_beg(m, m_end - m, fl, 1); + vm_phys_enq_beg(m, m_end - m, fl, pool, 1); } /* * Free a contiguous, arbitrarily sized set of physical pages. + * Assumes that every page but the first has no valid pool field. + * Uses the pool value in the first page if valid, otherwise default. * * The free page queues must be locked. */ void -vm_phys_free_contig(vm_page_t m, u_long npages) +vm_phys_free_contig(vm_page_t m, int pool, u_long npages) { vm_paddr_t lo; vm_page_t m_start, m_end; @@ -1416,11 +1423,11 @@ vm_phys_free_contig(vm_page_t m, u_long npages) * end of the range last. */ if (m_start < m_end) - vm_phys_enqueue_contig(m_start, m_end - m_start); + vm_phys_enqueue_contig(m_start, pool, m_end - m_start); if (order_start < max_order) - vm_phys_free_pages(m, order_start); + vm_phys_free_pages(m, pool, order_start); if (order_end < max_order) - vm_phys_free_pages(m_end, order_end); + vm_phys_free_pages(m_end, pool, order_end); } /* @@ -1474,15 +1481,15 @@ vm_phys_unfree_page(vm_paddr_t pa) struct vm_phys_seg *seg; vm_paddr_t pa_half; vm_page_t m, m_set, m_tmp; - int order; + int order, pool; seg = vm_phys_paddr_to_seg(pa); vm_domain_free_assert_locked(VM_DOMAIN(seg->domain)); +#ifdef VM_FREEPOOL_LAZYINIT /* * The pages on the free lists must be initialized. */ -#ifdef VM_FREEPOOL_LAZYINIT vm_phys_lazy_init_domain(seg->domain, true); #endif @@ -1515,7 +1522,8 @@ vm_phys_unfree_page(vm_paddr_t pa) * is larger than a page, shrink "m_set" by returning the half * of "m_set" that does not contain "m" to the free lists. */ - fl = (*seg->free_queues)[m_set->pool]; + pool = m_set->pool; + fl = (*seg->free_queues)[pool]; order = m_set->order; vm_freelist_rem(fl, m_set, order); while (order > 0) { @@ -1527,7 +1535,7 @@ vm_phys_unfree_page(vm_paddr_t pa) m_tmp = m_set; m_set = vm_phys_seg_paddr_to_vm_page(seg, pa_half); } - vm_freelist_add(fl, m_tmp, order, 0); + vm_freelist_add(fl, m_tmp, order, pool, 0); } KASSERT(m_set == m, ("vm_phys_unfree_page: fatal inconsistency")); return (true); @@ -1668,7 +1676,8 @@ vm_phys_find_queues_contig( * alignment of the first physical page in the set. If the given value * "boundary" is non-zero, then the set of physical pages cannot cross * any physical address boundary that is a multiple of that value. Both - * "alignment" and "boundary" must be a power of two. + * "alignment" and "boundary" must be a power of two. Sets the pool + * field to DEFAULT in the first allocated page. */ vm_page_t vm_phys_alloc_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, @@ -1727,12 +1736,12 @@ vm_phys_alloc_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, fl = (*queues)[m->pool]; oind = m->order; vm_freelist_rem(fl, m, oind); - if (m->pool != VM_FREEPOOL_DEFAULT) - vm_phys_set_pool(VM_FREEPOOL_DEFAULT, m, oind); + vm_phys_finish_init(m, oind); } /* Return excess pages to the free lists. */ fl = (*queues)[VM_FREEPOOL_DEFAULT]; - vm_phys_enq_range(&m_run[npages], m - &m_run[npages], fl, 0); + vm_phys_enq_range(&m_run[npages], m - &m_run[npages], fl, + VM_FREEPOOL_DEFAULT, 0); /* Return page verified to satisfy conditions of request. */ pa_start = VM_PAGE_TO_PHYS(m_run); diff --git a/sys/vm/vm_phys.h b/sys/vm/vm_phys.h index 43d94a9420f2..046fe26b476d 100644 --- a/sys/vm/vm_phys.h +++ b/sys/vm/vm_phys.h @@ -64,15 +64,15 @@ vm_page_t vm_phys_alloc_contig(int domain, u_long npages, vm_paddr_t low, int vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[]); vm_page_t vm_phys_alloc_pages(int domain, int pool, int order); int vm_phys_domain_match(int prefer, vm_paddr_t low, vm_paddr_t high); -void vm_phys_enqueue_contig(vm_page_t m, u_long npages); +void vm_phys_enqueue_contig(vm_page_t m, int pool, u_long npages); int vm_phys_fictitious_reg_range(vm_paddr_t start, vm_paddr_t end, vm_memattr_t memattr); void vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_paddr_t end); vm_page_t vm_phys_fictitious_to_vm_page(vm_paddr_t pa); int vm_phys_find_range(vm_page_t bounds[], int segind, int domain, u_long npages, vm_paddr_t low, vm_paddr_t high); -void vm_phys_free_contig(vm_page_t m, u_long npages); -void vm_phys_free_pages(vm_page_t m, int order); +void vm_phys_free_contig(vm_page_t m, int pool, u_long npages); +void vm_phys_free_pages(vm_page_t m, int pool, int order); void vm_phys_init(void); vm_page_t vm_phys_paddr_to_vm_page(vm_paddr_t pa); vm_page_t vm_phys_seg_paddr_to_vm_page(struct vm_phys_seg *seg, vm_paddr_t pa); diff --git a/sys/vm/vm_reserv.c b/sys/vm/vm_reserv.c index ad513962d50d..0bedca54d3da 100644 --- a/sys/vm/vm_reserv.c +++ b/sys/vm/vm_reserv.c @@ -480,7 +480,8 @@ vm_reserv_depopulate(vm_reserv_t rv, int index) if (rv->popcnt == 0) { vm_reserv_remove(rv); vm_domain_free_lock(vmd); - vm_phys_free_pages(rv->pages, VM_LEVEL_0_ORDER); + vm_phys_free_pages(rv->pages, VM_FREEPOOL_DEFAULT, + VM_LEVEL_0_ORDER); vm_domain_free_unlock(vmd); counter_u64_add(vm_reserv_freed, 1); } @@ -943,7 +944,7 @@ static void vm_reserv_break(vm_reserv_t rv) { vm_page_t m; - int hi, lo, pos; + int pool, pos, pos0, pos1; vm_reserv_assert_locked(rv); CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", @@ -954,23 +955,27 @@ vm_reserv_break(vm_reserv_t rv) for (; m < rv->pages + VM_LEVEL_0_NPAGES; m += VM_SUBLEVEL_0_NPAGES) #endif m->psind = 0; - hi = lo = -1; - pos = 0; - for (;;) { - bit_ff_at(rv->popmap, pos, VM_LEVEL_0_NPAGES, lo != hi, &pos); - if (lo == hi) { - if (pos == -1) - break; - lo = pos; - continue; - } + pool = VM_FREEPOOL_DIRECT; + pos0 = bit_test(rv->popmap, 0) ? -1 : 0; + pos1 = -1 - pos0; + for (pos = 0; pos < VM_LEVEL_0_NPAGES; ) { + /* Find the first different bit after pos. */ + bit_ff_at(rv->popmap, pos + 1, VM_LEVEL_0_NPAGES, + pos1 < pos0, &pos); if (pos == -1) pos = VM_LEVEL_0_NPAGES; - hi = pos; + if (pos0 < pos1) { + /* Set pool for pages from pos1 to pos. */ + pos0 = pos1; + while (pos0 < pos) + rv->pages[pos0++].pool = pool; + continue; + } + /* Free unused pages from pos0 to pos. */ + pos1 = pos; vm_domain_free_lock(VM_DOMAIN(rv->domain)); - vm_phys_enqueue_contig(&rv->pages[lo], hi - lo); + vm_phys_enqueue_contig(&rv->pages[pos0], pool, pos1 - pos0); vm_domain_free_unlock(VM_DOMAIN(rv->domain)); - lo = hi; } bit_nclear(rv->popmap, 0, VM_LEVEL_0_NPAGES - 1); rv->popcnt = 0; From nobody Tue Jan 21 23:15:48 2025 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 4Yd33T4q5Yz5lkJs; Tue, 21 Jan 2025 23:15:49 +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 4Yd33T2BWcz3Hvg; Tue, 21 Jan 2025 23:15:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737501349; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iLjkm56FroNDfUw7UiarxNAYl3x4kQ72ZFkmpfxPZUA=; b=TzkfVVhYIcTVuLA6ogldogL/ttHWkYvxhEmEMrFQ5U/oLK1ykdROsuNtprpwQtT6MLlarx WyGVzJzrQyZm92EcVS9mwSC7yI5nD+TpZ8URmq1wE8A1T+MJQchpLkVPdjvYWS8h92yM+8 MmmqI+pz/84mYEWlDwuxwvzIMLn8eyYzIX12PzyZD0pyQrt93Ip2TjP4iHHa+CB9de/Ciw 535o/L53mQZGGDpiDV4qms2xutOqQNV33tt2igC43y2O79xNA7lVqFLAF2fcR4gMCi19V/ KykomDqA5piNgFgjYIny/eaQ/hP/tBjN2fJHRz8RgH11HA26VuMq2sQuY8Lxng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737501349; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iLjkm56FroNDfUw7UiarxNAYl3x4kQ72ZFkmpfxPZUA=; b=XtoNhwKtkk8OcyUwi55JFKO5XumkFurw5CWq27YE2FJKhB8qRlnbok45+DyU/X51jgrkQy mdpILMUYV2qZQ58YPrMKQJrYzKZb5Kriom+PKs3iwdWCNe6v007a5+mlIPHb4NFkBZYrAB VIet/M8Dst5l9VqTbF9fZeKPDdNqelvuPlXtRC8AygwEvczAaLOPnrKj9/KX4YBun/GBiR BDWurjVMTNfBcmteKWHNuCSU9OosMvHiPG6q3p3wGM9VUrObySawE6riZFPBH0PVTE9zYi 8dHGYD9AHRNS6ntZf5eNP5xQvi7zGfHHWbCSDKboSlBvkkOf4pl1nsSmORURKw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737501349; a=rsa-sha256; cv=none; b=VYtBqVG2mmso0tUq+x/vHeL7hbe8tfUqNs6a7BEc2kb5mn/1rixKjO9yxouOKPlKuHi+Wy +f0IDr7eoOWcDprXqnKiRkdrxsvsqSzp56dWxxdVkZVa6VaWcjYoze9XaVQ1VR3mPxWrc7 5vEnrvUVRaCnTuFxoTQ3vAMZxnXTFCu9zPiPBZDsxRLOUgO+N/4gszTDADSp4K/7hFcfUX 17My95B3m5quXfEhuHTsLzYjfjmSBPX4enD27aYrJqasgj5nvA7OIm4SKeRMYNcNc+7O5j mh97kKFE2U4QPmEMYgNnAOydGDQHVm6+J0O+wPq6L6ywUWl37hGvyZlRfBcCwg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yd33T0qmZzB6d; Tue, 21 Jan 2025 23:15:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50LNFmWk078531; Tue, 21 Jan 2025 23:15:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LNFmKa078528; Tue, 21 Jan 2025 23:15:48 GMT (envelope-from git) Date: Tue, 21 Jan 2025 23:15:48 GMT Message-Id: <202501212315.50LNFmKa078528@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 58f77309c4e0 - main - Add machdep.cpu_idle_max_stop_state tunable 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: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 58f77309c4e0d3373705582e9ca7649fe74dd267 Auto-Submitted: auto-generated The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=58f77309c4e0d3373705582e9ca7649fe74dd267 commit 58f77309c4e0d3373705582e9ca7649fe74dd267 Author: Timothy Pearson AuthorDate: 2025-01-20 20:03:55 +0000 Commit: Justin Hibbits CommitDate: 2025-01-21 23:14:40 +0000 Add machdep.cpu_idle_max_stop_state tunable Multiple idle and deep sleep states are supported on Power7+ platforms, with each state having a characteristic latency and effect on system real-time performance. Add a tunable to allow a maximum sleep state (maximum theoretical sleep-related latency) to be set, in order to better support specific latency-sensitive applications / real time workloads. Signed-off-by: Timothy Pearson --- sys/powerpc/powerpc/cpu.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/sys/powerpc/powerpc/cpu.c b/sys/powerpc/powerpc/cpu.c index f73ed25c8924..4b8da50cf642 100644 --- a/sys/powerpc/powerpc/cpu.c +++ b/sys/powerpc/powerpc/cpu.c @@ -95,6 +95,9 @@ static void cpu_idle_booke(sbintime_t); static void cpu_idle_e500mc(sbintime_t sbt); #endif #if defined(__powerpc64__) && defined(AIM) +static int cpu_idle_max_stop_state = 2; +SYSCTL_INT(_machdep, OID_AUTO, cpu_idle_max_stop_state, + CTLFLAG_RW, &cpu_idle_max_stop_state, 0, ""); static void cpu_idle_powerx(sbintime_t); static void cpu_idle_power9(sbintime_t); #endif @@ -815,6 +818,22 @@ cpu_idle_booke(sbintime_t sbt) static void cpu_idle_powerx(sbintime_t sbt) { + int max_stop_state = cpu_idle_max_stop_state; + + /* Limit maximum stop state to valid values */ + if (max_stop_state < 0) { + /* Don't nap at all, busy wait instead */ + cpu_idle_max_stop_state = -1; + return; + } + if (max_stop_state > 1) { + /* POWER8 and below only support the one stop state, + * i.e. 'nap' + */ + max_stop_state = 1; + cpu_idle_max_stop_state = max_stop_state; + } + /* Sleeping when running on one cpu gives no advantages - avoid it */ if (smp_started == 0) return; @@ -837,9 +856,28 @@ static void cpu_idle_power9(sbintime_t sbt) { register_t msr; + int max_stop_state = cpu_idle_max_stop_state; - msr = mfmsr(); + /* Limit maximum stop state to valid values */ + if (max_stop_state < 0) { + /* Don't stop at all, busy wait instead */ + cpu_idle_max_stop_state = -1; + return; + } + + /* Set maximum transition level to 3, for deepest lossless sleep. + * On POWER9 this is automatically downgraded to the next supported + * stop state (stop2), but other CPUs may support stop3. + */ + if (max_stop_state > 3) { + /* Stop states greater than 3 require register state save and + * restore functionality that is not yet implemented + */ + max_stop_state = 3; + cpu_idle_max_stop_state = max_stop_state; + } + msr = mfmsr(); /* Suspend external interrupts until stop instruction completes. */ mtmsr(msr & ~PSL_EE); /* Set the stop state to lowest latency, wake up to next instruction */ From nobody Tue Jan 21 23:15:50 2025 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 4Yd33V2jLNz5lk4p; Tue, 21 Jan 2025 23:15: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 4Yd33V22P9z3J1Y; Tue, 21 Jan 2025 23:15:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737501350; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fYhT1diWU0VyJpemecRy8fRy2Qi21gyn7Koi/h0WKTQ=; b=Yg70DsIjFu/aeSd453zVW2Z+ces1pHYp8+pPCaoR4eu+my4KMl+fx6o68epPg/qNxmwIC8 MNoha3zlnx+N503kSZ1NZTrTGuaVhCHerfLBercPPl0ZxNfCwgT3SYOh5rwDUQ0rHnY/+m YckeC1JDyKNz3DhCtEfYEbEcNOV7N/IMPtgjotPI8Mqq9e55OP0v6jV3d5fMvK2+A4p2/O DT7W5XxaYqGznkJmi6vYWoeY2wIdwGLUo42gra1fYsT1IQvJECKp02VFYooQKVjnLA7uwm 5PG1jzAqMgr7mHOKrl+8/M1+7xmr525Snf+vKHLG/McsmM9jzRv9RmJ9E8B72A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737501350; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fYhT1diWU0VyJpemecRy8fRy2Qi21gyn7Koi/h0WKTQ=; b=T8Oq2U8cIYNXAbcpztlOqTpwcsrTfIJ3okZU4LWcOVAQFFlZOyUmUQk93/ytRSfb08V8Uc r/HY7BXlxF7+mkCiEGlCa0fw13wTrG2s4b2SRwI4sKMh8laQXokWhcvm6TYOwqKFbMHIRU CirQ9CmVGgEpqA0CZULg/s5LTEohiEQpL5tos6K8bhMC7I7n8CLi3lPGZ+lbgbsrVMu6RG Myo4+AENe5dg3q9SZPtlwPdCAlv0ynQzOWiaFEDa/Srv+FgXPpoEbS68rmtLKKbgj0LARm ce0ukA7FED6rCVT79jry1sjNsiFg/LTHOivwPJrYA9Jf9NyosnKi1+fYAAv4oA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737501350; a=rsa-sha256; cv=none; b=UYvkJCEqv9A+pYIbR2VAAfgw9+EFIata0MgF4udzGQUM72HpPIFH1ruPNfpzUV0+Xx/1D/ AoUNVaYQCHYj9yVxGDhOYF3efypdaHcX6KoPCUnqk+xefiwQyVhgFltJ5OaFZDYXyDLT7l Gz5rHRtXr4Yf7hdEPStF1MbUoMh1H1Vyp6Qjz0damS92jZ+TBOUpUsNIsHVihLGAIq8FFs PfRsGq4r8dFre7IsXmqL+18zBbuAZzTE+13cJ8/gdLCF4hLjYO50gMCl1d5pQOjKuyqoeL VBhWI2LaGUpSj3+6iNMKH7nI9mAEQN69xuPgPGCRZyf+LXdMbJDyN25krkx5Yg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yd33V0rngzBvh; Tue, 21 Jan 2025 23:15: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 50LNFo0B078567; Tue, 21 Jan 2025 23:15:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LNFo5Z078564; Tue, 21 Jan 2025 23:15:50 GMT (envelope-from git) Date: Tue, 21 Jan 2025 23:15:50 GMT Message-Id: <202501212315.50LNFo5Z078564@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 6f0c2938e895 - main - Fix latency spikes on return from stop on POWER9+ 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: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6f0c2938e895bd3ddb14f44acf36dba3c6156a3f Auto-Submitted: auto-generated The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=6f0c2938e895bd3ddb14f44acf36dba3c6156a3f commit 6f0c2938e895bd3ddb14f44acf36dba3c6156a3f Author: Timothy Pearson AuthorDate: 2025-01-20 20:03:40 +0000 Commit: Justin Hibbits CommitDate: 2025-01-21 23:14:41 +0000 Fix latency spikes on return from stop on POWER9+ On POWER9 and higher platforms, cpu_idle_power9() directly control the external interrupt enable lines when entering / exiting stop states. This does not provide needed information to the rest of the kernel regarding the core going into a stop state, and results in random, significant latency spikes (>200ms) due to the stopped core not receiving wakeup interrupts in a deterministic manner. Bring cpu_idle_power9() in line with cpu_idle_powerx() by using spinlock entry / exit to control the interrupt state vs. direct MSR read / write. Signed-off-by: Timothy Pearson --- sys/powerpc/powerpc/cpu.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/sys/powerpc/powerpc/cpu.c b/sys/powerpc/powerpc/cpu.c index 4b8da50cf642..37eb01e2b74f 100644 --- a/sys/powerpc/powerpc/cpu.c +++ b/sys/powerpc/powerpc/cpu.c @@ -855,7 +855,6 @@ cpu_idle_powerx(sbintime_t sbt) static void cpu_idle_power9(sbintime_t sbt) { - register_t msr; int max_stop_state = cpu_idle_max_stop_state; /* Limit maximum stop state to valid values */ @@ -877,20 +876,30 @@ cpu_idle_power9(sbintime_t sbt) cpu_idle_max_stop_state = max_stop_state; } - msr = mfmsr(); - /* Suspend external interrupts until stop instruction completes. */ - mtmsr(msr & ~PSL_EE); + /* + * Enter spinlock and suspend external interrupts until the stop + * instruction completes. + */ + spinlock_enter(); + + /* Final scheduler checks before core shutdown */ + if (sched_runnable()) { + /* Exit spinlock and re-enable external interrupts */ + spinlock_exit(); + return; + } + /* Set the stop state to lowest latency, wake up to next instruction */ - /* Set maximum transition level to 2, for deepest lossless sleep. */ - mtspr(SPR_PSSCR, (2 << PSSCR_MTL_S) | (0 << PSSCR_RL_S)); - /* "stop" instruction (PowerISA 3.0) */ + mtspr(SPR_PSSCR, (max_stop_state << PSSCR_MTL_S) | (0 << PSSCR_RL_S)); + + /* Shut down core using "stop" instruction (PowerISA 3.0) */ __asm __volatile (".long 0x4c0002e4"); + /* * Re-enable external interrupts to capture the interrupt that caused - * the wake up. + * the wake up. Exit spinlock. */ - mtmsr(msr); - + spinlock_exit(); } #endif From nobody Wed Jan 22 07:35:42 2025 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 4YdG8G6fdxz5l4Nk; Wed, 22 Jan 2025 07:35: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 4YdG8G5mDSz46P4; Wed, 22 Jan 2025 07:35:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737531342; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SPPhfP0Mry8g8mUJdUFPl61q8esfSyV2pX2/bFrxKOo=; b=ye10E9zSZse6jUpFvHQiEaUlEPMz2w7iLk57ZuQqrSXqDc93eFFSmdezmXBR3ac7G9a7RG v4+8+oS5shNDOB8i3Lyl+7RG/72U+M2fMuQFR4ikydSCY5lMJ01S+oT9qWsXpBiNHQ7yeL YldxHSsd2DZfzqYWWM71b6YWh1AkpjKwehKKd02c89KtmQr6ZvV+Q6axzLZ4KyXJzu+OoK N3yEM9mEb94fBZV2EwRHRMRJwFcWyD89jTp+ELkCQxYJlCZgQDK/mrgTARJPTuPwp4NqO5 h18S60MRnWMWPX2TV3//IKqEh45RaR3F9SQH6nC0NlRbOAw946NQ5pVgFHIDww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737531342; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SPPhfP0Mry8g8mUJdUFPl61q8esfSyV2pX2/bFrxKOo=; b=Qp2UGsOpnIU5fGcoiZpDm6xmFNUKZZ7uZUpJi6aAYePAT05clW5zu6llB4YnBZEfYwsfeC 4nd4TIBV63u+eM2PAKiCLcb+zWVV0Vtahk30YCn7jqoUyV/2A+PGEgjTq1phDrT8dqUBP+ dgGoBWMj48LTc3lcFWJYXvqSzAi5g7fXylG1tTHmS2wSEL1Ov4gcKLI9dbBzwwbTmycR22 5A2Np1lRDzM7wMMweuG6QSDegto6gmzHPbGzy4pOOOWmDVBqLcxLxQ7aR8Axpfx6c09bOD PB6eKXNN2+46tRrZcO5kT7tHwu7Le0DtnCDeJjjIoNeMyM3PhzmSd7aFPFUxfw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737531342; a=rsa-sha256; cv=none; b=ZPJCB/V999lSHfjnwXNnIjfpLgyfgcwLOcchsVgf5cSQFTuZmEEQ8/M3b7VUqYgex1Sp1Q d53iLNUqRUX0Cmrvp4pN+i8OQoQuKP062QEnf9IC5KDhxwJr9NbfE+p5MuAn2qTB8+GWnC d7KCqpR6kYcrfFqkuU40aIUsXDcdNjepPQZVpFhlv/j56gjGGzV8ehdJB2KC7qfMGb1oUs OKIKMgA+LInHlVI/UtnoVv00X2wYx/RMAyvWhu9AkcFpyZGzXjzr36ufZgupYWmHtXRlkn yu+VZJFZuvUS+AajrDykcpAwciyET8XNpDuapheYhrGWSZJD2XOWS7uKg+dZzA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YdG8G5Jk3zk6W; Wed, 22 Jan 2025 07:35: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 50M7Zg13014499; Wed, 22 Jan 2025 07:35:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50M7ZgwU014496; Wed, 22 Jan 2025 07:35:42 GMT (envelope-from git) Date: Wed, 22 Jan 2025 07:35:42 GMT Message-Id: <202501220735.50M7ZgwU014496@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 6ba2f08cea8c - main - ls: --group-directories requires stat information 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: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6ba2f08cea8cd5c801b78eb8842f7f96bf2d255c Auto-Submitted: auto-generated The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=6ba2f08cea8cd5c801b78eb8842f7f96bf2d255c commit 6ba2f08cea8cd5c801b78eb8842f7f96bf2d255c Author: Piotr Paweł Stefaniak AuthorDate: 2025-01-21 22:47:30 +0000 Commit: Piotr Paweł Stefaniak CommitDate: 2025-01-22 07:29:29 +0000 ls: --group-directories requires stat information Fixes: 8b92977857f8 --- bin/ls/ls.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/ls/ls.c b/bin/ls/ls.c index ca0fb9877b7e..b3d0a508d714 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -547,12 +547,12 @@ main(int argc, char *argv[]) #endif /* - * If not -F, -i, -l, -s, -S or -t options, don't require stat - * information, unless in color mode in which case we do - * need this to determine which colors to display. + * If not -F, -i, -l, -s, -S, -t or --group-directories options, + * don't require stat information, unless in color mode in which case + * we do need this to determine which colors to display. */ if (!f_inode && !f_longform && !f_size && !f_timesort && - !f_sizesort && !f_type + !f_sizesort && !f_type && f_groupdir == GRP_NONE #ifdef COLORLS && !f_color #endif From nobody Wed Jan 22 12:13:11 2025 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 4YdNJR6C3zz5lNsk; Wed, 22 Jan 2025 12:13: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 4YdNJR5NTlz3K4H; Wed, 22 Jan 2025 12:13:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737547991; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=t8NBRVPcg5O7G+zp0MZ0HfXI6jOUW8V+1pcGb8dukSA=; b=NKcSdFV1UL6g1DcBxtLEYVSKbcKg2n5Ztw78ZMaqN8ILcRnODdlAytHqEy9v4xz/DrjkdE F2dToxd/ZShIyKn+zaoBi4B1iVvy9+zdVYADNiYK/HymsHO7H8rP89MBPjGqK5Q/6i3Mbk DKq19WZ2bzta3sgkA8M3YzCVVNCKz5ZrqMqWg1k05T4obpIjM5hoL2gcs/EY/7NY7LX2Zk 8QTha1kua3uDNPhbjPvLQEsPw9rSozrRjyJl34tilWTQLiD/q7OeExWVOSv0vYNFsZAtHS ONW82oz4dN96PUC4dOnBsGEQ5kyhtNOi3HtCYp3eommKxf6JYaTGKF7gURuJWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737547991; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=t8NBRVPcg5O7G+zp0MZ0HfXI6jOUW8V+1pcGb8dukSA=; b=h09/Mg+PNx5ISN4S5we8viPmvNOCobCh3HGExU0QRskwOfY5dKiCMIR44LtfturYTPMnra XSyDnrrMHPaqfgGv9JzMcljheCNjx9yY99s820ouS0rgDjza9kmCNY6nuGB768T0d4gsid wsTjMdpddWOSDU2qxa5WCwoIJCyqv0692diXHT3xLDIUUUScZktiVjqE8ddQbvTi+paPDb YpuGL7mtZJZroIAknKACNkA91YSzyfTruVZqyTcoRgUMnshOUAPA57IxCfX8tBX+azWrjx kPKogVRDmt4eYqMSjime49xCJQvTtnIOjMpPREbyPTSGrR8GBzGPSLVlP58yTg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737547991; a=rsa-sha256; cv=none; b=XD4l9Jdlb8bPqBRgQdJz/qBaCUZ0NwTkLTuPYDT7L2P7uBk1/zK14aPc2R0FST+KboB0pf 0/Hc6emMqeiZjNEPqcYaJmioXz1zs7SPsffIADjRdOgDlZUWTiLkpHum/cLRByt6tM12Cb iH+LPnezyac34DChA74Izf39HvMrWdI4Z9NQn4Wz8jvaAlqW5LTr58BmByWnC399jQe56+ CeGvBbAamALcvjME2mRX8sKEqXty7j5MLsaqvaPnf84y1W5BsxUsDq5iGbdtiZTj45Te8e fzkVAw6ayFsOi6Tcf2RyDM16n5HUtnGy7M2S/FZvB7akkCgZ68O/2aEqS3sp9w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YdNJR4sPJzsgK; Wed, 22 Jan 2025 12:13:11 +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 50MCDB6v039729; Wed, 22 Jan 2025 12:13:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50MCDBWt039726; Wed, 22 Jan 2025 12:13:11 GMT (envelope-from git) Date: Wed, 22 Jan 2025 12:13:11 GMT Message-Id: <202501221213.50MCDBWt039726@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: f6631da0b581 - main - sound tests: Fix gcc 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6631da0b581b28c2bfeea1199b52013bb46aa41 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=f6631da0b581b28c2bfeea1199b52013bb46aa41 commit f6631da0b581b28c2bfeea1199b52013bb46aa41 Author: Christos Margiolis AuthorDate: 2025-01-22 12:09:54 +0000 Commit: Christos Margiolis CommitDate: 2025-01-22 12:12:59 +0000 sound tests: Fix gcc build /workspace/src/tests/sys/sound/pcm_read_write.c:36:1: error: 'static' is not at beginning of declaration [-Werror=old-style-declaration] 36 | } static const afmt_tests[] = { | ^ Reported by: CI Fixes: 27ef5d48c729 ("sound: Unit test the pcm sample read and write macros") Sponsored by: The FreeBSD Foundation MFC after: 1 week --- tests/sys/sound/pcm_read_write.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sys/sound/pcm_read_write.c b/tests/sys/sound/pcm_read_write.c index 6bdc578615b5..e40ce52b67cc 100644 --- a/tests/sys/sound/pcm_read_write.c +++ b/tests/sys/sound/pcm_read_write.c @@ -25,7 +25,7 @@ #include /* Generic test data, with buffer content matching the sample values. */ -struct afmt_test_data { +static struct afmt_test_data { const char *label; uint8_t buffer[4]; size_t size; @@ -33,7 +33,7 @@ struct afmt_test_data { intpcm_t value; _Static_assert((sizeof(intpcm_t) == 4), "Test data assumes 32bit, adjust negative values to new size."); -} static const afmt_tests[] = { +} const afmt_tests[] = { /* 8 bit sample formats. */ {"s8_1", {0x01, 0x00, 0x00, 0x00}, 1, AFMT_S8, 0x00000001}, {"s8_2", {0x81, 0x00, 0x00, 0x00}, 1, AFMT_S8, 0xffffff81}, From nobody Wed Jan 22 12:59:12 2025 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 4YdPKX6wWhz5lS3y; Wed, 22 Jan 2025 12:59: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 4YdPKX6B7Lz3PX6; Wed, 22 Jan 2025 12:59:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737550752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2o5QXKNhznFcsb0/44W4IFw938dvcnHkniFe9lhAJ5c=; b=USw+GGZD2hWlawDfllPoyeYHkN2MDnyOYPkYVo8FdgHiIojmEOSeqj2WQPAbrYuqA3yLHq EzQD11rtxh4T7UB6pMdczzcNB8qx9Adgop1TDKbSZBxRktW2rQGhKPaM3SDDVDKHGWDV2g pmy6ebO/q1MxP68ITLa9bFeGFp+q3LTQDiSKI9uIHIZKuFCm74GhB7ZbPlN0YyxTAodgP/ 9ThvyA9zd9DDnQeC6BXrlrb//fZRNNzMyXowfnR4M8J6rE7u+oIugJwTfZkfpmM1nPb2ao /iOAXMjLMFbCFxQBrKrOzSNglnPniiGNHGMR514LLVTsu6IZjZlJHyHaY0fVBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737550752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2o5QXKNhznFcsb0/44W4IFw938dvcnHkniFe9lhAJ5c=; b=iFcwf22IXIn9uFexGK/sL4ewFuJuXhBdL0b7FarWi1L67HuZv0NsDRJZda0cJpi1EJ3gEY ltpjz+WCMgIFxvsa4mtxTaREIlaP9ObhkuH1qSsfHOzWWWSDVWBlcQ19v8xKFAxbVij5WX H/QZzWvGa8QVy0ygJPPlm582aQnGuqMaLi6SDvmhOjS5ofsnY3eS17K+5kxBTP2KQnPkwP rFkrU/CzAY3acZtB+Sz19ki5Efct+QLtXpK89plVYs50fU402VEUPT3rOuabrN7IVoNLED q3HTmiDDm3s1fBx5Mcg2G+7RuzZwUWu4wzBkGBj9u/CkT2am8TTxvWhZBjAa4w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737550752; a=rsa-sha256; cv=none; b=Vf3MOmNBpqo1xZZ438boPXgHzm9POWO54NIZQ6Rcyjhly3sZNmFj/eGls2lqBxcxyh1UMy OzbiYelDMH1GkfSQyQHlvB1czZLG8oeKTjQpRrxQ3y2j05lNeZkGodgyzQPvP66igQoJoL IUfeL9WZzOlXAK79n2qEEuGe/qkLq7mGHrmTptPWv6k1YBjvXiXNlUFbFe08dydu0QWU6Z 2DdgiwtW0DMEX/DnwpY4wFkoVu9SvNU4A0w2ZMcXSqtw2G0mOeuYr/Euswe1faGnawx8qU oQv+xW8In6r/7hDZKLIubvjQ5lj3sHAIV+6SYn6j6yucCp8CJ0R4rOkIAlX4gA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YdPKX57HnztS3; Wed, 22 Jan 2025 12:59: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 50MCxCPk015558; Wed, 22 Jan 2025 12:59:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50MCxC6u015555; Wed, 22 Jan 2025 12:59:12 GMT (envelope-from git) Date: Wed, 22 Jan 2025 12:59:12 GMT Message-Id: <202501221259.50MCxC6u015555@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bojan =?utf-8?Q?Novkovi=C4=87?= Subject: git: b9951017bab3 - main - amd64/fpu: Track supervisor state XSAVE components 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: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b9951017bab396e24042e85632e2cc34ee0329ff Auto-Submitted: auto-generated The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=b9951017bab396e24042e85632e2cc34ee0329ff commit b9951017bab396e24042e85632e2cc34ee0329ff Author: Bojan Novković AuthorDate: 2025-01-15 16:41:24 +0000 Commit: Bojan Novković CommitDate: 2025-01-22 12:58:34 +0000 amd64/fpu: Track supervisor state XSAVE components The amd64/fpu.c xsave_* routines track supported XSAVE components and features. However, they only track supported user state components, and there is currently no way for a consumer to check whether the CPU supports a supervisor state component. Fix this by saving the supported supervisor state components, enumerated by CPUID function 0DH, sub-function 1, in a separate mask. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D48466 --- sys/amd64/amd64/fpu.c | 38 ++++++++++++++++++++++++-------------- sys/x86/include/fpu.h | 5 +++-- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index 591bd196ca7d..79d1722268b7 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -164,6 +164,7 @@ SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD, int use_xsave; /* non-static for cpu_switch.S */ uint64_t xsave_mask; /* the same */ +static uint64_t xsave_mask_supervisor; static uint64_t xsave_extensions; static uma_zone_t fpu_save_area_zone; static struct savefpu *fpu_initialstate; @@ -324,6 +325,7 @@ fpuinit_bsp1(void) ctx_switch_xsave[3] |= 0x10; restore_wp(old_wp); } + xsave_mask_supervisor = ((uint64_t)cp[3] << 32) | cp[2]; } /* @@ -421,7 +423,7 @@ fpuinitstate(void *arg __unused) XSAVE_AREA_ALIGN - 1, 0); fpu_initialstate = uma_zalloc(fpu_save_area_zone, M_WAITOK | M_ZERO); if (use_xsave) { - max_ext_n = flsl(xsave_mask); + max_ext_n = flsl(xsave_mask | xsave_mask_supervisor); xsave_area_desc = malloc(max_ext_n * sizeof(struct xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO); } @@ -1293,19 +1295,25 @@ fpu_save_area_reset(struct savefpu *fsa) } static __inline void -xsave_extfeature_check(uint64_t feature) +xsave_extfeature_check(uint64_t feature, bool supervisor) { + uint64_t mask; + mask = supervisor ? xsave_mask_supervisor : xsave_mask; KASSERT((feature & (feature - 1)) == 0, ("%s: invalid XFEATURE 0x%lx", __func__, feature)); - KASSERT(feature < flsl(xsave_mask), - ("%s: unsupported XFEATURE 0x%lx", __func__, feature)); + KASSERT(ilog2(feature) <= ilog2(mask), + ("%s: unsupported %s XFEATURE 0x%lx", __func__, + supervisor ? "supervisor" : "user", feature)); } static __inline void -xsave_extstate_bv_check(uint64_t xstate_bv) +xsave_extstate_bv_check(uint64_t xstate_bv, bool supervisor) { - KASSERT(xstate_bv != 0 && ilog2(xstate_bv) < flsl(xsave_mask), + uint64_t mask; + + mask = supervisor ? xsave_mask_supervisor : xsave_mask; + KASSERT(xstate_bv != 0 && ilog2(xstate_bv) <= ilog2(mask), ("%s: invalid XSTATE_BV 0x%lx", __func__, xstate_bv)); } @@ -1317,11 +1325,13 @@ bool xsave_extfeature_supported(uint64_t feature, bool supervisor) { int idx; + uint64_t mask; KASSERT(use_xsave, ("%s: XSAVE not supported", __func__)); - xsave_extfeature_check(feature); + xsave_extfeature_check(feature, supervisor); - if ((xsave_mask & feature) == 0) + mask = supervisor ? xsave_mask_supervisor : xsave_mask; + if ((mask & feature) == 0) return (false); idx = ilog2(feature); return (((xsave_area_desc[idx].flags & CPUID_EXTSTATE_SUPERVISOR) != 0) == @@ -1345,15 +1355,15 @@ xsave_extension_supported(uint64_t extension) */ size_t xsave_area_offset(uint64_t xstate_bv, uint64_t feature, - bool compact) + bool compact, bool supervisor) { int i, idx; size_t offs; struct xsave_area_elm_descr *xep; KASSERT(use_xsave, ("%s: XSAVE not supported", __func__)); - xsave_extstate_bv_check(xstate_bv); - xsave_extfeature_check(feature); + xsave_extstate_bv_check(xstate_bv, supervisor); + xsave_extfeature_check(feature, supervisor); idx = ilog2(feature); if (!compact) @@ -1376,16 +1386,16 @@ xsave_area_offset(uint64_t xstate_bv, uint64_t feature, * 'xstate_bv' and extended region format ('compact'). */ size_t -xsave_area_size(uint64_t xstate_bv, bool compact) +xsave_area_size(uint64_t xstate_bv, bool compact, bool supervisor) { int last_idx; KASSERT(use_xsave, ("%s: XSAVE not supported", __func__)); - xsave_extstate_bv_check(xstate_bv); + xsave_extstate_bv_check(xstate_bv, supervisor); last_idx = ilog2(xstate_bv); - return (xsave_area_offset(xstate_bv, (uint64_t)1 << last_idx, compact) + + return (xsave_area_offset(xstate_bv, (uint64_t)1 << last_idx, compact, supervisor) + xsave_area_desc[last_idx].size); } diff --git a/sys/x86/include/fpu.h b/sys/x86/include/fpu.h index 9d2e43f6386e..c94e058498f6 100644 --- a/sys/x86/include/fpu.h +++ b/sys/x86/include/fpu.h @@ -222,8 +222,9 @@ struct savefpu_ymm { bool xsave_extfeature_supported(uint64_t feature, bool supervisor); bool xsave_extension_supported(uint64_t extension); size_t xsave_area_hdr_offset(void); -size_t xsave_area_offset(uint64_t xstate_bv, uint64_t feature, bool compact); -size_t xsave_area_size(uint64_t xstate_bv, bool compact); +size_t xsave_area_offset(uint64_t xstate_bv, uint64_t feature, bool compact, + bool supervisor); +size_t xsave_area_size(uint64_t xstate_bv, bool compact, bool supervisor); #endif #endif /* !_X86_FPU_H_ */ From nobody Wed Jan 22 14:21:24 2025 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 4YdR8N44Rjz5lXB5; Wed, 22 Jan 2025 14:21: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 4YdR8N3HBRz3WlJ; Wed, 22 Jan 2025 14:21:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737555684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KBUJrbvNscnpZniSYRK/0bGO6J3/SYQ9TKBLhLSLCDo=; b=icuUDBDU+06SL7P3dZuUyViAOXGemHdjodj+tgVWT9/eyNbFRlG3r21KedFUGKJJe85t8c M9VrWc1r480KnjhEILNMg1xlWxo5BH+GDHdw1XcXnXz53wlh2U+g19f/6dbRtfUYMDVWMn ysSJwbZunVP+HyYszH9fGN6uVrGVElVrAUhx/mlJpUn9OaMvBbuDRcHFFx0aQOeWXptZT8 SOnWz+nAon/4jqg4c28m8ovt3DTePnso0jujWZkgCBx9BJaKUjAe5P3mVfIcPtQo5Vm5Bu WGbzbhE4jun2wfQFAbFesLJbkiFrdqqhLKCa3xz1M8MhgO5DQJLM1lokJVr2tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737555684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KBUJrbvNscnpZniSYRK/0bGO6J3/SYQ9TKBLhLSLCDo=; b=t7sfnjbNTWvetWO3ItYE9ZEs6CLOS1qB763LdONJrCYeUMIuH/ZicOAsgRGAj3WCGHvvR2 vsICGtxPxbdXYLkrK86CkFEt3O1uUHW9x7DA7HlwgcXIhRz6tqQu7PenebXP4N3PYCssIy ArAJZrEduUhUGR094l7eVeGV2mER6ryLPcrZwYHZkh0ZrJijuFiLgPEAA4ljm2nfQAJoNq r/IACKs/pDWcMN73bYRYpPmf9kOncZCQykB6U+ixc7sHMB5/386oVpkJOZS0OXfKiMun/a LxWUFIBwq6yc3PWwpLvXZbxcOSu75B84YGz98QaTT/sh1ADEyobld300g3N5jw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737555684; a=rsa-sha256; cv=none; b=lHDSAgWoFDS7VvY2qBuQoRwHwiY5yaJGIrzrTi5wIsoSNtqcr4fOXNGdqGteMqicY9s0Gn Nju9E+YlETcHACxOuzujn/JHHtTten1ffxc5/itO0GOlVXbeAcBKx0V+73dJ1veDwfRI5C gIg01wx3hJVC1vcPTDwdIhi9Zbvynp/bB5kBc2vlEcFW1cmAg6VGsiTDEMuDNIzfBpZLE+ SztwY9XUjqoopR8xsOYxECTFwP7eKaQYZ5V26FMs59Hg0nFu5rLDpJ1OkhfYP8UkIr8RDJ z+YQCL5Xw8j4oxFi64QEFQ8MSVh05tB5WmP3OxJm8yQHI8HOVaecN3U2USGKVA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YdR8N2tNZzwHr; Wed, 22 Jan 2025 14:21: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 50MELO2u079690; Wed, 22 Jan 2025 14:21:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50MELOxb079687; Wed, 22 Jan 2025 14:21:24 GMT (envelope-from git) Date: Wed, 22 Jan 2025 14:21:24 GMT Message-Id: <202501221421.50MELOxb079687@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: 6e6a67e98652 - main - dtrace tests: Avoid hard-coding paths to required programs 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: 6e6a67e98652e1477973d031b27ce085d7f200c2 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6e6a67e98652e1477973d031b27ce085d7f200c2 commit 6e6a67e98652e1477973d031b27ce085d7f200c2 Author: Mark Johnston AuthorDate: 2025-01-22 14:20:33 +0000 Commit: Mark Johnston CommitDate: 2025-01-22 14:20:33 +0000 dtrace tests: Avoid hard-coding paths to required programs MFC after: 1 week Sponsored by: Innovate UK --- cddl/usr.sbin/dtrace/tests/dtrace.test.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cddl/usr.sbin/dtrace/tests/dtrace.test.mk b/cddl/usr.sbin/dtrace/tests/dtrace.test.mk index 001dc6253f82..da7c3a440be0 100644 --- a/cddl/usr.sbin/dtrace/tests/dtrace.test.mk +++ b/cddl/usr.sbin/dtrace/tests/dtrace.test.mk @@ -12,7 +12,7 @@ ${TESTGROUP}EXEPACKAGE= ${PACKAGE} TESTWRAPPER= t_dtrace_contrib ATF_TESTS_SH+= ${TESTWRAPPER} -TEST_METADATA.t_dtrace_contrib+= required_files="/usr/local/bin/ksh /usr/local/bin/jq /usr/local/bin/perl /usr/local/bin/xmllint" +TEST_METADATA.t_dtrace_contrib+= required_progs="ksh jq perl xmllint" TEST_METADATA.t_dtrace_contrib+= required_user="root" GENTEST?= ${.CURDIR:H:H}/tools/gentest.sh From nobody Wed Jan 22 14:41:33 2025 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 4YdRbd5PyKz5lYdZ; Wed, 22 Jan 2025 14:41: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 4YdRbd4jBqz3YMb; Wed, 22 Jan 2025 14:41:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737556893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1OjnYNBnvHA+9Oont+QYdQRBmIwOnKTrCHEOXUeDAYY=; b=bpHEb4Cb2A1LNZKP2bZO3ydPrpoWRI+hSnrWLya3BPHHEDE8AZM6sXQvmHSK/2mvz6Nv3l JewOdBifayGvIyd2mfgzU56mb8G7VMRiWDsnS7aeXYt7c0C//BQd5V4gurxZqitW+bqPqn vOQ469/dqb+GccO0RO4I6ZXqsoaQmOuN1UlcxyCc9gHp4wASPm2FB65tEtYeEue/bgPlP2 z3jYoDSjpViFzPaLf6acqOjVBLMP00z+CiW3SBPgf+IJyIVU/1W394athR48DGY4B8Z63Q s44RJjdaC36F3l5HsSMhRuAgdPMHrmRng18cJORPihGSwSlvoaxKT+0vImjqRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737556893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1OjnYNBnvHA+9Oont+QYdQRBmIwOnKTrCHEOXUeDAYY=; b=sIs4SUG3ED6Cfy/kXpuKeoeObIE1UfM+w7PaA6v17X9VAkFdd/vqXWt1ydT93OHbwmNhGJ bfnsqwrm6YH02TQeKIcF427Pdyq4LaVhAkLiPJiurewgVvrwGnT0QwyD+fX+/FR/v56wZD zD3AUwW44J0ZdjPnZCPB7y3OGprRvfBFD4AC7dgzRdPjjYHtJ2wXNKPlnprTkDrL6yKMNq NeHeaKH5wVr1RXHgCrkClzzHtLHWRZsoJ5Ncb15VSixVV2v1y+y9zqC8gvfuovoc3a6dO6 6crGlhdsV1MVsWeoWUDq64L13SUTn+CcY2a6Jb9ZA+Ddzn+vg3S8Zk0A1EEp/w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737556893; a=rsa-sha256; cv=none; b=pcyKZH7WwAr1pgcfeOY9U4E5r2tYdXE1NndI4PHswG17axC9Ujh3wl1u2Mf5SYe3Y2qNcp 1xE+d8nY90b2KBUxltFe7yNH/bhKsxsjP4N2qwS1nLxM9a96Ajz+BPBf51F5iDB8N+efu2 /Z49hCz0EI5/A1yCbrXuh0OnJRzMxdfUXt6KgZScGFm94Q+s35um4ILbyfcrkQZCFo/z8t ffvL74juVJGZjVZSRc+0GmqPWD8+ftRh4rO9FipxR42HnrEtfB3UJGYg+3CBZ1TXdDIIou U8+bJLgRPA/rJIG3/qniahtfhbfgsbzkk2jNjU8norurqDRyAwQ309DXYI277w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YdRbd4Cx7zx1V; Wed, 22 Jan 2025 14:41: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 50MEfXRg012906; Wed, 22 Jan 2025 14:41:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50MEfXZS012902; Wed, 22 Jan 2025 14:41:33 GMT (envelope-from git) Date: Wed, 22 Jan 2025 14:41:33 GMT Message-Id: <202501221441.50MEfXZS012902@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: 8ce6b4f2c48e - main - dtrace: Fix the definition of pc_t 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: 8ce6b4f2c48eca758fac90b58924f9b2e38fbc49 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8ce6b4f2c48eca758fac90b58924f9b2e38fbc49 commit 8ce6b4f2c48eca758fac90b58924f9b2e38fbc49 Author: Mark Johnston AuthorDate: 2025-01-22 14:34:29 +0000 Commit: Mark Johnston CommitDate: 2025-01-22 14:40:50 +0000 dtrace: Fix the definition of pc_t This type is used only to store PC values corresponding to a thread stack trace, so a pointer type is not quite right. Switch to vm_offset_t, as in struct stack, to simplify a port of DTrace to CHERI. No functional change intended. MFC after: 1 week Sponsored by: Innovate UK --- sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h index 45201447024e..cfb97c71f262 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h @@ -51,7 +51,7 @@ extern "C" { #include #ifndef illumos -typedef uintptr_t pc_t; +typedef vm_offset_t pc_t; typedef u_long greg_t; #endif From nobody Wed Jan 22 14:41:34 2025 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 4YdRbg1Nryz5lYW2; Wed, 22 Jan 2025 14:41: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 4YdRbf5Zjkz3YPy; Wed, 22 Jan 2025 14:41:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737556894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vGb4OebYglr4Ed4wB9h7J2gVYu765DDSNHAkUGe+Tio=; b=Kh/lh9TAgpIrpu0dBZdgDvCLr2ojRtB/6+kzymi80imRVRc6Qgt8WvkRClhfNhnD9Cwq9l QOCyzqch7zG2U28Ij5P612ip7PJ8B9jKSx+WI3cVIX3YcccN84m/iAlzwrUiSvFc9y88ll T4DecRsfNsSlyI6tYCKbsYaCTlzaZkJqzFqAn4+lfqKh9ibOKnQQNpCTeNJG1FoFVV/Do2 RMPpOGxlId6E3jImLn7bte079RsOyyxU8hKrYxe0h56iJSqAYzLHOpu41igzu4pws2nhNf tGdWSAKeqNEFZO2wImPq8meLTgx8SD4P72zinBR761tRRqCYck+kFQPh5ojcow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737556894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vGb4OebYglr4Ed4wB9h7J2gVYu765DDSNHAkUGe+Tio=; b=gNtLFYytBs29i9AXOKat3CBw+vLrd68eNXFeIM8cSsyPg2kSDl5wKkx504a84nslaNYwuI kqckRFtMOdPjQT1WdeF+HB2TZa4DaEfkmyOLEwk1kszli7iEi4ritNyAWF+6FqypeVforJ 5EnHMZ/SMw1y1IhDGf0aSCwxgX4O853MVF2dweaVSvMFdYciZotgcJcx68S6KVq4wB48Bi vSnHL4hxdXH+GPiLb3Gd+HmBOMR1oK7YclQZ0pofCyfZSXLoB7xu4GtAqKjcgj4dhhDXQz 1hgugxuX59S1+tU5FraqoP50ZRreM7x3Zmw8Op/R9OUg0p8Q1IPB/3Y+tx+nwQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737556894; a=rsa-sha256; cv=none; b=HunXGl2XlUxZUqpN/FMxJiikv6zpYH9dEAl2sdHw/Jkz341Xp+LgxTFz9CqsADKwd2CT12 ajX1YbwmbOUyqDWH0oCN+Imrm85BoRfKJFVaAKcQ8SDp/l4to4aNnTuU5xtaDDEDyQMOMp 3/7pyKFm07JN12qf/BFWDnw0cmJS10MUWAO2L3rqHm57CYbYVCqjlYLgfzsi4digFN1iDq tnqo1k8hCxcKxx2rOZpuDdXJWTeg2K2vEOmamKH2bZIkc9jRePPbf0Ru8g1y06ELOFg09s W6SzSOszhgSs8pgNmX0Kd7vYx2yiVuwTUXS+cphuYoJ0RuPpiAAD6rdqRCdzzQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YdRbf51XQzwkF; Wed, 22 Jan 2025 14:41: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 50MEfY4s012940; Wed, 22 Jan 2025 14:41:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50MEfYaU012937; Wed, 22 Jan 2025 14:41:34 GMT (envelope-from git) Date: Wed, 22 Jan 2025 14:41:34 GMT Message-Id: <202501221441.50MEfYaU012937@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: 61c4ac2df7b2 - main - libdtrace: Use C99 designated initializers for dt_idops_t 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: 61c4ac2df7b2b866c8ee5e944aedc96aa79bd315 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=61c4ac2df7b2b866c8ee5e944aedc96aa79bd315 commit 61c4ac2df7b2b866c8ee5e944aedc96aa79bd315 Author: Mark Johnston AuthorDate: 2025-01-22 14:37:55 +0000 Commit: Mark Johnston CommitDate: 2025-01-22 14:40:54 +0000 libdtrace: Use C99 designated initializers for dt_idops_t No functional change intended. MFC after: 1 week Sponsored by: Innovate UK --- .../opensolaris/lib/libdtrace/common/dt_ident.c | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c index 5ff772be041d..d03347d0e7c1 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c @@ -577,51 +577,51 @@ dt_idsize_none(dt_ident_t *idp) } const dt_idops_t dt_idops_assc = { - dt_idcook_assc, - dt_iddtor_sign, - dt_idsize_none, + .di_cook = dt_idcook_assc, + .di_dtor = dt_iddtor_sign, + .di_size = dt_idsize_none, }; const dt_idops_t dt_idops_func = { - dt_idcook_func, - dt_iddtor_sign, - dt_idsize_none, + .di_cook = dt_idcook_func, + .di_dtor = dt_iddtor_sign, + .di_size = dt_idsize_none, }; const dt_idops_t dt_idops_args = { - dt_idcook_args, - dt_iddtor_none, - dt_idsize_none, + .di_cook = dt_idcook_args, + .di_dtor = dt_iddtor_none, + .di_size = dt_idsize_none, }; const dt_idops_t dt_idops_regs = { - dt_idcook_regs, - dt_iddtor_free, - dt_idsize_none, + .di_cook = dt_idcook_regs, + .di_dtor = dt_iddtor_free, + .di_size = dt_idsize_none, }; const dt_idops_t dt_idops_type = { - dt_idcook_type, - dt_iddtor_free, - dt_idsize_type, + .di_cook = dt_idcook_type, + .di_dtor = dt_iddtor_free, + .di_size = dt_idsize_type, }; const dt_idops_t dt_idops_thaw = { - dt_idcook_thaw, - dt_iddtor_free, - dt_idsize_type, + .di_cook = dt_idcook_thaw, + .di_dtor = dt_iddtor_free, + .di_size = dt_idsize_type, }; const dt_idops_t dt_idops_inline = { - dt_idcook_inline, - dt_iddtor_inline, - dt_idsize_type, + .di_cook = dt_idcook_inline, + .di_dtor = dt_iddtor_inline, + .di_size = dt_idsize_type, }; const dt_idops_t dt_idops_probe = { - dt_idcook_thaw, - dt_iddtor_probe, - dt_idsize_none, + .di_cook = dt_idcook_thaw, + .di_dtor = dt_iddtor_probe, + .di_size = dt_idsize_none, }; static void From nobody Wed Jan 22 15:15:58 2025 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 4YdSML2YzSz5lbKc; Wed, 22 Jan 2025 15:15: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 4YdSML1X3Cz3cgC; Wed, 22 Jan 2025 15:15:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737558958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LSndFPKLDOXZorww5tysFEXMl344rykSkNrBVHNPmw4=; b=C887eOTg46UfhW5+QDS4Gu43Atr6oMljCIntChBa7apD3XcZlw7WGsDgVUWskno1dOrzQn Jos4fcDgtidxqMbqWUxOrIFBDpwK2cwQRIoPv8mr0WLLoJ/WWdMHZI6EDFrjJc2D5kSt+Z o+PvRbSdwilCxC+ieJ0ujS8RnUGAHw18PI/9ffNRyMogpfwPsfvbiKm6sLcinNBl9dIuzl sJnZxwKajRtZRGnUf4YQim1SK4Gb+qyXiBc9OcWpcE1urcHMcfPf58L6d/vQTjhkJafdDz oO5m3Y9/JVT3lgdtxjiteRnGjSMKDxylFSN+NY/jBI9d7LAEyjP7BKsty+3pig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737558958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LSndFPKLDOXZorww5tysFEXMl344rykSkNrBVHNPmw4=; b=NiK4M8vFvN2EFKJ2EGR7d9inGLd9ctc7YnGnU190EFbdqWJVyW+PeB/Uo4r7Fcy3FKadAH VCOlMgfCJ3QKZsHKw3f+s/7uHi89rLooS+/K21t2dyYFbiDem+KxK672kX9zETZNuYyTtt 2boW49rhLAjQKhtzHpaQsyg5dk4DMY0uijy7cXq3zpdTaX4m61nA0UvHeRLM5Duz61uNck B72QSbKzMsK4PDQxV64rA/XOf0BDA2tNj1zA1YzqfsXh1I5JDKtlK0MN7FfSLcVxoUQ/Th /FqPffKtTw+B8sW/BgVBqotqPq68RJKPcDB6vAk7YOutQNCPqCq3R7+XiUABKw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737558958; a=rsa-sha256; cv=none; b=xfMpT58M8nGD8SD+XPYoNQJ9P/XoTNbsR8Z06Ssvp7flD6bDx1LcpDikelr+KceGhOB4vB S43qm5Lyl9UsRIHiBXA/ilWkJevV6ePooZjp6jaqDH64vwYCrth6qr+6usek/vG48V2jlf mcOb4QJT7JEtN/YPCv3o0W/zuAPcIIXWhPpvH6CJnMKdnCkAEPz77soxqvruCB7WbnSU8F fyCfqapf1CA4wMyJ3VmkuGy9ESP/aT4MSIyCOhtOW0oNchF9TQkXo3W9YbVEUqADJNbbPV gVuDXhoxcq58x23NEuogH3GLa3dQ5ziviXyLupoMMN0deMYlCyQdKQnLK7VAyg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YdSML0rbkzy5h; Wed, 22 Jan 2025 15:15: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 50MFFwek077480; Wed, 22 Jan 2025 15:15:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50MFFwso077477; Wed, 22 Jan 2025 15:15:58 GMT (envelope-from git) Date: Wed, 22 Jan 2025 15:15:58 GMT Message-Id: <202501221515.50MFFwso077477@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bojan =?utf-8?Q?Novkovi=C4=87?= Subject: git: f0d036cf6655 - main - amd64/fpu: Fix build for NODEBUG kernels 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: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0d036cf665520cead4970b4337d72b077ed5eea Auto-Submitted: auto-generated The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=f0d036cf665520cead4970b4337d72b077ed5eea commit f0d036cf665520cead4970b4337d72b077ed5eea Author: Bojan Novković AuthorDate: 2025-01-22 15:02:17 +0000 Commit: Bojan Novković CommitDate: 2025-01-22 15:15:32 +0000 amd64/fpu: Fix build for NODEBUG kernels Fixes: b995101 Reported by: Michael Butler (imb@protected-networks.net) --- sys/amd64/amd64/fpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index 79d1722268b7..48bfaa53c7b4 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -1297,6 +1297,7 @@ fpu_save_area_reset(struct savefpu *fsa) static __inline void xsave_extfeature_check(uint64_t feature, bool supervisor) { +#ifdef INVARIANTS uint64_t mask; mask = supervisor ? xsave_mask_supervisor : xsave_mask; @@ -1305,16 +1306,19 @@ xsave_extfeature_check(uint64_t feature, bool supervisor) KASSERT(ilog2(feature) <= ilog2(mask), ("%s: unsupported %s XFEATURE 0x%lx", __func__, supervisor ? "supervisor" : "user", feature)); +#endif } static __inline void xsave_extstate_bv_check(uint64_t xstate_bv, bool supervisor) { +#ifdef INVARIANTS uint64_t mask; mask = supervisor ? xsave_mask_supervisor : xsave_mask; KASSERT(xstate_bv != 0 && ilog2(xstate_bv) <= ilog2(mask), ("%s: invalid XSTATE_BV 0x%lx", __func__, xstate_bv)); +#endif } /* From nobody Wed Jan 22 15:26:39 2025 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 4YdSbg701xz5lc3Z; Wed, 22 Jan 2025 15:26: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 4YdSbg5yKYz3f9N; Wed, 22 Jan 2025 15:26:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737559599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kyX0uVVAcBsFe49utK2kJnoNFVl8rKFL1ZuFblPEzcA=; b=EPsra4sJsJaU1B97eJnihyXoWww8vPOI8XfDp4hcN0kVqUIf0CTUadv62CiZzaJS8WP+Uh 8lSt5iztFkTWBG8zHMolQcuuz4ltxOGzQirTuCZmbTVL/3Ggai2p4Z+s2v8iL4l+3Pv5KJ l0A7FK3qrHyXTM4u/KMw9puCU1dgPYjDPqoYtamAJVQf5pTluwzuQC4GIJ06fSaLAQmgGP bErG0zmzomTFaeBXezVLPDwVXKJWfyC7hbhRMgRET/N8TsLclWl4Ss1zNNWGr9L+v72fhQ IRgJ2OBxIX36ye1R/FyaIUJqXkoDXZOh+tQvxA+hLcUUt/0R65spzLwc08fRfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737559599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kyX0uVVAcBsFe49utK2kJnoNFVl8rKFL1ZuFblPEzcA=; b=nppYW5WxvPGiGDu0RDSgYRjRt3X2vEiNV+cldlQ/Gfzl91SKDyaICmL1hqUYgTAev2rD+m VHLlmLv7TCEt5I7pd+W/l5UEIzUKSLaRNvqXtyXHZSblTO7X+nIxKbypdBbkAsr32q+3W/ kdRFqqitHLYAoHsgiMuVSZ9JAftClyYRyieD/duEjhC/5tW5YUqGoRUCAyEX+c5VyDkfJ1 O9Upn9SaaH5IKK+ZN0XIFXGoqHvJxSdgzw6gCeN3CHJ/hZeGRuegCVwdgtJOfTgd6Ngx4o 6ItrdPGinZ7v/jLvH2v5zwvmQ5N3H1Xf9NAlXUh1Vi+XwBedSjdmeJl46Dsi6g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737559599; a=rsa-sha256; cv=none; b=PHerYXLrR6RNQ5H2ETO+c34rzVeLdD33R6uE+pAxwNSRjRLaF0GT6RLMAJpK7I+qDHDS3N 3QCcYXKcE6tetmdalAQjLvdOHZLPahCUYC3Oug/zPNBc2ih3EapI2zQfwj/UpDZhc/7+Ai XPNg6y5cUMYbO1757z1jzq669xD60Z1kdsr/vjzejxtUmezLaZcN/iFamQGP8ZlqduF/aH RjptGqvJJQ0oL2ecvb3arB2Kc1aMABWHNZJJ4kDR00ifi2uZwqZ39Y3XZfcxQBXu2Cc5GH VXr+UvkdD58YWH/sTu3T2RQ8a6G4ipjfGNGfoGK7DNGozzjVhOxlXfgu+6VfHg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YdSbg5L1jzy1T; Wed, 22 Jan 2025 15:26: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 50MFQdWR096170; Wed, 22 Jan 2025 15:26:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50MFQdF4096167; Wed, 22 Jan 2025 15:26:39 GMT (envelope-from git) Date: Wed, 22 Jan 2025 15:26:39 GMT Message-Id: <202501221526.50MFQdF4096167@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: 8384a19adc88 - main - dtrace/arm64: Simplify variable declarations in the invop handler 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: 8384a19adc88ef31794f5aed1d8c5621b7dff8c9 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8384a19adc88ef31794f5aed1d8c5621b7dff8c9 commit 8384a19adc88ef31794f5aed1d8c5621b7dff8c9 Author: Mark Johnston AuthorDate: 2025-01-22 15:15:18 +0000 Commit: Mark Johnston CommitDate: 2025-01-22 15:26:30 +0000 dtrace/arm64: Simplify variable declarations in the invop handler Remove some unused variables and reduce the scope of some others. No functional change intended. MFC after: 1 week Sponsored by: Innovate UK --- sys/cddl/dev/dtrace/aarch64/dtrace_subr.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c b/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c index b4dae1cba539..20418e3a475b 100644 --- a/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c +++ b/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c @@ -262,17 +262,15 @@ dtrace_store64(uint64_t *addr, struct trapframe *frame, u_int reg) static int dtrace_invop_start(struct trapframe *frame) { - int data, invop, reg, update_sp; - register_t arg1, arg2; - register_t *sp; - int offs; - int tmp; - int i; + int data, invop, tmp; invop = dtrace_invop(frame->tf_elr, frame, frame->tf_x[0]); tmp = (invop & LDP_STP_MASK); if (tmp == STP_64 || tmp == LDP_64) { + register_t arg1, arg2, *sp; + int offs; + sp = (register_t *)frame->tf_sp; data = invop; arg1 = (data >> ARG1_SHIFT) & ARG1_MASK; From nobody Wed Jan 22 15:40:03 2025 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 4YdSv872W0z5lclt; Wed, 22 Jan 2025 15:40:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.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 4YdSv86D9sz3h7k; Wed, 22 Jan 2025 15:40:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737560404; h=from:from:reply-to:subject: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=CLPZTFkUF3yjB9dL2HNBMRTORWXaNbGoRWrAxeBNVdU=; b=vZdbNxCG2I/SdqZqdN3jsxmoh3lTtOBGwtsV2PRSroyAyiqABpqo62oVvRhAb3QW977CwT 3sewH8qSaGHzYhLVQmDSWBvCprTUrOHo3pNtERWcA4a+wCzHDEh4EF0TXgSJnNR+1hFd9Z xRrHnXULnFPuerpME4idlf95THtJXSPTHKWYTcygy30aVjrdRiVDAWPot1kGrjx47kyY9e N9tKYIFcRQy+JyFVRT1DVHuxLr9o5D/9bG96hVnO9swC4CvJ0YZ8A97Y20Dj3VeffPqdAZ RAgJDD2kR8bgvW8OPNoxHrlDVh2QjPVXyUpMZlPWepwZfhVw8kKGZ3R/T4zvRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737560404; h=from:from:reply-to:subject: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=CLPZTFkUF3yjB9dL2HNBMRTORWXaNbGoRWrAxeBNVdU=; b=cUEo0+VOTCyo8r0PhH0UJpRYhsIbJFyKYj9kQ0WqT9kMckFjiki3eUoDGXYMIC0vlEOKck y7z6IZpeE5D2XTLgLrLQcCH8aPIH6Fv1RJr13J//Z5KgWptBinr7RH8Er0Un3E4jiQEyks 2GMjAct5pNz1qJpirPFDlbV9SF4R8m9om2UAEbibnAQ4vF4Dg/vALBJo3GMWfQngUHT2qh TAk0urzI9lA+ExwkzEq7ScT1jns2WCWfkH1tV/17d49m6hYNXIxvKvJV0hssRCwqgypI7j 9+x8sMltO38ilxkULloh6K9yHZ8BXW63ZyYjGRLRtyJi4h3QHvJPQeoAd68Pbg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737560404; a=rsa-sha256; cv=none; b=uO7vLN9lUgxqWhsptjg4rn23/d0V/DjFhp3dcVvuAAtk5FJE6ofuoZ8TlGubbVUT2N7Ha3 027vaYDMU58wZJmoaFXCvnuWWUrr3JxXe98Yl9ESuZpT0oAXWjcqsoc9RNKV2byXxD4Ya8 3v75qC4urrP0Aabt59ZHXe6TWuGljYPqUoGZb/RNRT4GIOf40EiRjLzPuKTwim2JCYDdUr HfQCUWu4qgRaOkzNmAz3cz34G53vhSQtvgkBurSyKdHfJm+S833iQiihI+G74qBNtU1Cuy li4OJW2F4NOj+rcQHxtvhVd1an9Hralx5U0eNhcUwpFPdXusS1IEuqd46O0P7Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from [IPV6:2601:5c0:4200:b830:d5db:419f:2286:1c0d] (unknown [IPv6:2601:5c0:4200:b830:d5db:419f:2286:1c0d]) (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 4YdSv843xpz13TT; Wed, 22 Jan 2025 15:40:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Wed, 22 Jan 2025 10:40:03 -0500 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: b9951017bab3 - main - amd64/fpu: Track supervisor state XSAVE components Content-Language: en-US To: =?UTF-8?Q?Bojan_Novkovi=C4=87?= , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202501221259.50MCxC6u015555@gitrepo.freebsd.org> From: John Baldwin In-Reply-To: <202501221259.50MCxC6u015555@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/22/25 07:59, Bojan Novković wrote: > The branch main has been updated by bnovkov: > > URL: https://cgit.FreeBSD.org/src/commit/?id=b9951017bab396e24042e85632e2cc34ee0329ff > > commit b9951017bab396e24042e85632e2cc34ee0329ff > Author: Bojan Novković > AuthorDate: 2025-01-15 16:41:24 +0000 > Commit: Bojan Novković > CommitDate: 2025-01-22 12:58:34 +0000 > > amd64/fpu: Track supervisor state XSAVE components > > The amd64/fpu.c xsave_* routines track supported XSAVE components and > features. However, they only track supported user state components, and > there is currently no way for a consumer to check whether the CPU > supports a supervisor state component. Fix this by saving the supported > supervisor state components, enumerated by CPUID function 0DH, > sub-function 1, in a separate mask. > > Reviewed by: kib > Differential Revision: https://reviews.freebsd.org/D48466 Note that if we add support for supervisor state components we need to be careful to scrub those components from the XSAVE state stored in process core dumps or used with ptrace (e.g. zeroring those regions). This is something Linux does. -- John Baldwin From nobody Wed Jan 22 17:04:56 2025 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 4YdVn42jHPz5klFW; Wed, 22 Jan 2025 17:04: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 4YdVn429x8z3rtg; Wed, 22 Jan 2025 17:04:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737565496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=L7ML7f4SX/M1I0gCnCyKFvsZTwS2jiNkbPTtBl4rfrk=; b=rt6pDZJ6YexNjyhdpdypv1Zz7Tye7zewy73Xz6spmq37WmsIDakx5yn8XhygfpyCTd5bdI jPuPH0i1DmliZ6K/FOK5FD/0XeSaCGJ3qZd9w/BmFw6PTyy1YE81IexYacsOtWJ4Rr1p/N skUNdUqVoexPoM9eJcwMATxxOMa++fuj3jKhpXGfbTt2SUBIS3TsE0YpA7zJeunp4kUzdY wxuT8Ua8Q6yehioClc6WC4bmykWtVU6R4oAOSePOE2nOwhwdUOJ3NLy4XteDxdrCKYNQue 5dXkttoNFg7TMzooysy0cC9+BfCMznHKWX6rGfizB++Ht99f63veviZ90Dod+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737565496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=L7ML7f4SX/M1I0gCnCyKFvsZTwS2jiNkbPTtBl4rfrk=; b=YExFZ/WDFB/TSnr27RYsOa9C9aXkQHnszctG89zDSRnHpp+j8kFbK0Z1d69LOaW7cx9KMJ /vNzpz0S0FsRZGpu9mh5wL9lZ076TzsD/1q58iyDLDoJx9RTI33CNpU/oqdQxDdcWjKfzi LTVRpi/O52bIaDxvffVbB8hJKD+Esmi4yF34w+PvvTiRa9JjYlZWYvgn1VIrAQenHdJ7kg U6fSjw1rozc2qXjLsJxUO5MWJX2tnWDWS8OhP6adlGgKrn+/ikTTzKtMfNJET6VchxrxRR 33sudDQxlRZ9AbHiM6CMcA2hS/hvl6OFi2a8Eqk8hWwuezPJKHykyCUvT98nNQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737565496; a=rsa-sha256; cv=none; b=jlrg9QU1OH96ZCCo56bujIUibBRRVlhglfmJV0DxH8Y2evUYnFirUiuK7a9MD50n8iH6qF UuE7QlL/HNvfB/HhYqugo5zEhQyPVwnC+9fnXvGHe26uK57b1zY+0ZZV3ENf2u2AbO3nPJ owMp6UvD+1YxqJXMq9O7EAPshK2dg8EbLEH3vBk7QSt4I6Ws39L6Fd8oh27eWo5MC9X+Ds jlf+upmJCvz/o/coLi90p5ZmDaAbSSgO2ysEvxQL5r4OILStG9ImQtCy2mf/HOHOb4AvFf pV2NHISlQB3BjR4v2vL5P7W7mnyxHEfBNoEpgqBwhM1rsEXMfvj9CVvO9k79Gw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YdVn414lkz11wt; Wed, 22 Jan 2025 17:04: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 50MH4uol083295; Wed, 22 Jan 2025 17:04:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50MH4uiV083292; Wed, 22 Jan 2025 17:04:56 GMT (envelope-from git) Date: Wed, 22 Jan 2025 17:04:56 GMT Message-Id: <202501221704.50MH4uiV083292@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: 723425f83727 - main - Deprecate publickey(5) stuff 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: 723425f837270dd3b22098168ae9464a1ebe38c6 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=723425f837270dd3b22098168ae9464a1ebe38c6 commit 723425f837270dd3b22098168ae9464a1ebe38c6 Author: Emmanuel Vadot AuthorDate: 2025-01-22 16:56:58 +0000 Commit: Emmanuel Vadot CommitDate: 2025-01-22 17:03:45 +0000 Deprecate publickey(5) stuff This uses DES and it's likely that nobody uses that in 2025. If somebody uses this we help them by deprecating and removing this. Reviewed by: bapt, emaste Differential Revision: https://reviews.freebsd.org/D30682 --- usr.bin/chkey/chkey.1 | 5 +++++ usr.bin/chkey/chkey.c | 1 + usr.bin/keylogin/keylogin.1 | 5 +++++ usr.bin/keylogin/keylogin.c | 1 + usr.bin/keylogout/keylogout.1 | 5 +++++ usr.bin/keylogout/keylogout.c | 1 + usr.bin/newkey/newkey.8 | 5 +++++ usr.bin/newkey/newkey.c | 1 + usr.sbin/keyserv/keyserv.8 | 5 +++++ usr.sbin/keyserv/keyserv.c | 1 + 10 files changed, 30 insertions(+) diff --git a/usr.bin/chkey/chkey.1 b/usr.bin/chkey/chkey.1 index 39a0022199cb..556d6c281d21 100644 --- a/usr.bin/chkey/chkey.1 +++ b/usr.bin/chkey/chkey.1 @@ -25,3 +25,8 @@ database. .Xr publickey 5 , .Xr keyserv 8 , .Xr newkey 8 +.Sh HISTORY +The +.Nm +utility was removed from +.Fx 15.0 . diff --git a/usr.bin/chkey/chkey.c b/usr.bin/chkey/chkey.c index 8309237990f1..24cb3ec3b0b5 100644 --- a/usr.bin/chkey/chkey.c +++ b/usr.bin/chkey/chkey.c @@ -90,6 +90,7 @@ main(int argc, char **argv) char *cryptpw; #endif + fprintf(stderr, "chkey is deprecated and removed from FreeBSD 15.\n"); while ((ch = getopt(argc, argv, "f")) != -1) switch(ch) { case 'f': diff --git a/usr.bin/keylogin/keylogin.1 b/usr.bin/keylogin/keylogin.1 index 0c89268c7f18..550d670afbe7 100644 --- a/usr.bin/keylogin/keylogin.1 +++ b/usr.bin/keylogin/keylogin.1 @@ -30,3 +30,8 @@ to be used by any secure network services, such as NFS. .Xr publickey 5 , .Xr keyserv 8 , .Xr newkey 8 +.Sh HISTORY +The +.Nm +utility was removed from +.Fx 15.0 . diff --git a/usr.bin/keylogin/keylogin.c b/usr.bin/keylogin/keylogin.c index be38937ea239..c64afa4846bc 100644 --- a/usr.bin/keylogin/keylogin.c +++ b/usr.bin/keylogin/keylogin.c @@ -51,6 +51,7 @@ main(void) char fullname[MAXNETNAMELEN + 1]; struct key_netstarg netst; + fprintf(stderr, "keylogin is deprecated and removed from FreeBSD 15.\n"); if (!getnetname(fullname)) { fprintf(stderr, "netname lookup failed -- make sure the "); fprintf(stderr, "system domain name is set.\n"); diff --git a/usr.bin/keylogout/keylogout.1 b/usr.bin/keylogout/keylogout.1 index 52b2340d3ad0..348d7e380ea0 100644 --- a/usr.bin/keylogout/keylogout.1 +++ b/usr.bin/keylogout/keylogout.1 @@ -42,3 +42,8 @@ This will break secure NFS if it is done on a server. .Xr publickey 5 , .Xr keyserv 8 , .Xr newkey 8 +.Sh HISTORY +The +.Nm +utility was removed from +.Fx 15.0 . diff --git a/usr.bin/keylogout/keylogout.c b/usr.bin/keylogout/keylogout.c index 03eeee0f6417..faad41462340 100644 --- a/usr.bin/keylogout/keylogout.c +++ b/usr.bin/keylogout/keylogout.c @@ -47,6 +47,7 @@ main(int argc, char **argv) { static char secret[HEXKEYBYTES + 1]; + fprintf(stderr, "keylogin is deprecated and removed from FreeBSD 15.\n"); if (geteuid() == 0) { if ((argc != 2 ) || (strcmp(argv[1], "-f") != 0)) { fprintf(stderr, diff --git a/usr.bin/newkey/newkey.8 b/usr.bin/newkey/newkey.8 index b197067fff66..c92a4b8ff208 100644 --- a/usr.bin/newkey/newkey.8 +++ b/usr.bin/newkey/newkey.8 @@ -52,6 +52,11 @@ password of the given username. .Xr keylogin 1 , .Xr publickey 5 , .Xr keyserv 8 +.Sh HISTORY +The +.Nm +utility was removed from +.Fx 15.0 . .Sh NOTES The Network Information Service .Pq NIS diff --git a/usr.bin/newkey/newkey.c b/usr.bin/newkey/newkey.c index 32f449c237b2..ddeaee6914d4 100644 --- a/usr.bin/newkey/newkey.c +++ b/usr.bin/newkey/newkey.c @@ -99,6 +99,7 @@ main(int argc, char *argv[]) struct hostent *h; #endif + fprintf(stderr, "newkey is deprecated and removed from FreeBSD 15.\n"); if (argc != 3 || !(strcmp(argv[1], "-u") == 0 || strcmp(argv[1], "-h") == 0)) { usage(); diff --git a/usr.sbin/keyserv/keyserv.8 b/usr.sbin/keyserv/keyserv.8 index f067c421a333..ca396ef644c9 100644 --- a/usr.sbin/keyserv/keyserv.8 +++ b/usr.sbin/keyserv/keyserv.8 @@ -79,3 +79,8 @@ Display status of DES support (enabled/disabled). .Xr keylogin 1 , .Xr keylogout 1 , .Xr publickey 5 +.Sh HISTORY +The +.Nm +utility was removed from +.Fx 15.0 . diff --git a/usr.sbin/keyserv/keyserv.c b/usr.sbin/keyserv/keyserv.c index 080798ad84bd..fd8d23d2e9f1 100644 --- a/usr.sbin/keyserv/keyserv.c +++ b/usr.sbin/keyserv/keyserv.c @@ -108,6 +108,7 @@ main(int argc, char *argv[]) register SVCXPRT *transp; struct netconfig *nconf = NULL; + fprintf(stderr, "keyserv is deprecated and removed from FreeBSD 15.\n"); __key_encryptsession_pk_LOCAL = &key_encrypt_pk_2_svc_prog; __key_decryptsession_pk_LOCAL = &key_decrypt_pk_2_svc_prog; __key_gendes_LOCAL = &key_gen_1_svc_prog; From nobody Wed Jan 22 17:04:57 2025 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 4YdVn541KGz5klHs; Wed, 22 Jan 2025 17:04: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 4YdVn52hf3z3rnG; Wed, 22 Jan 2025 17:04:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737565497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=crVOunZJCxQGy1TZaVXrqUnAHkza3o83fpI67F/0E1g=; b=Aw8U945t1OlJVmjNAiLeYLm0MXDyunZqXRgnQOKHEFSv2U0ZYm9cKHppj22SFNfSae0fV3 wZ0HDx5G76G2GqWRDlL9pjcbXHvQYwB9ZPaGvMACwSSSeh9mvbVcmpi3sTnsU56RkH8TNV 887WLy7ZEN2ZGdS2aZ25pGJOL/9J8xsirOYjwvui1022ohlfxri0rvfUEOx9DjDqwkpeaj ejAipxWiQIcEWU7NCVkOtPO599B5og/csc5vTIVwAdHoqoIz4VIWUU3CFsSR/g7fNOrA8B VWcdCmrNbLMKOtmGatReY4ym1/ozCzj0tNjJGyWBjEk6SKK9SPtgnIirUu4MIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737565497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=crVOunZJCxQGy1TZaVXrqUnAHkza3o83fpI67F/0E1g=; b=qJZzoVUCrYVPTCdOqbFrQ/2Q+pmirCHTHpmyRSS3rs7K78SVUOymass/c3d5BMvD0MxqFK dzCvc+pKnhepSv1W8Nwd68/+Ge34O2vVg7MiMtwliSmN/gAnfjIFk6BDa2pi/5AsZnF7qA 1QkQjQXxzTWrkE0qf8o31BZwuxptz2CGFMuE94s2PwfCUVm15TPHgVM+MHuPVozaqjjJRC Qot7IIiSoxa6yRXW1XXri4bZLsgNYkBiEcPFCe2Vw60OotHi9DWLw1GTNDigRprESbmFzA l/pmw6YI4EDfb/g4UcvUZhXcmNLYV2Xr/C1JR9uO6+9ww1T+mzyP0rlh74OH3Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737565497; a=rsa-sha256; cv=none; b=ku+eIZsd7AJ+K/XTqRKdpcrsrB0GIqpWbHzaAig66+xLwnojDlp+C5/63RIfb9NjWtGyTk ZgUAWpySTeAJhpvzbw5cYDkEsM1UiBrVNfodEbEF58WrJ/XMr6BAaLzy53460i6T+jyuaP w3UlDnlt+zoencyM2YyUHGrgxtdEXlY20aE47pgP5qCvzB74r5yiCby8UGrl1uiW6puNC0 EZnNDChfh6O6BnbPaHO8W7m4WPkqHh05rtNR+4Wv80Qe3T5HQVF498+K2Tyf9DT4l8PjaF H12/Dqt7Nsrn66EfHGWGpBu+kCLRScPyFndTN6i/gqWEnrRbBHVz1pl1BfKg2A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YdVn522Nhz11L2; Wed, 22 Jan 2025 17:04: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 50MH4vuS083330; Wed, 22 Jan 2025 17:04:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50MH4vBJ083327; Wed, 22 Jan 2025 17:04:57 GMT (envelope-from git) Date: Wed, 22 Jan 2025 17:04:57 GMT Message-Id: <202501221704.50MH4vBJ083327@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: 9dcb984251b3 - main - Remove publickey(5) stuff 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: 9dcb984251b35ab1959bcaafcb3f129c8ae2f25b Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=9dcb984251b35ab1959bcaafcb3f129c8ae2f25b commit 9dcb984251b35ab1959bcaafcb3f129c8ae2f25b Author: Emmanuel Vadot AuthorDate: 2025-01-22 17:00:09 +0000 Commit: Emmanuel Vadot CommitDate: 2025-01-22 17:04:26 +0000 Remove publickey(5) stuff This uses DES and it's likely that nobody uses that in 2025. If somebody uses this we help them by deprecating and removing this. Reviewed by: bapt, emaste Differential Revision: https://reviews.freebsd.org/D30683 --- ObsoleteFiles.inc | 12 + lib/libc/rpc/Makefile.inc | 2 +- usr.bin/Makefile | 4 - usr.bin/chkey/Makefile | 13 - usr.bin/chkey/Makefile.depend | 16 - usr.bin/chkey/Makefile.depend.options | 7 - usr.bin/chkey/chkey.1 | 32 -- usr.bin/chkey/chkey.c | 267 ------------ usr.bin/keylogin/Makefile | 5 - usr.bin/keylogin/Makefile.depend | 18 - usr.bin/keylogin/keylogin.1 | 37 -- usr.bin/keylogin/keylogin.c | 81 ---- usr.bin/keylogout/Makefile | 3 - usr.bin/keylogout/Makefile.depend | 17 - usr.bin/keylogout/keylogout.1 | 49 --- usr.bin/keylogout/keylogout.c | 68 --- usr.bin/newkey/Makefile | 11 - usr.bin/newkey/Makefile.depend | 20 - usr.bin/newkey/extern.h | 45 -- usr.bin/newkey/generic.c | 124 ------ usr.bin/newkey/newkey.8 | 66 --- usr.bin/newkey/newkey.c | 228 ---------- usr.bin/newkey/update.c | 332 --------------- usr.sbin/Makefile | 1 - usr.sbin/keyserv/Makefile | 23 -- usr.sbin/keyserv/Makefile.depend | 20 - usr.sbin/keyserv/crypt_server.c | 265 ------------ usr.sbin/keyserv/keyserv.8 | 86 ---- usr.sbin/keyserv/keyserv.c | 753 ---------------------------------- usr.sbin/keyserv/keyserv.h | 16 - usr.sbin/keyserv/setkey.c | 497 ---------------------- 31 files changed, 13 insertions(+), 3105 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index c05a0d37c727..afb71c46a459 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,18 @@ # xargs -n1 | sort | uniq -d; # done +# 20250122: Remove publickey(5) stuff +OLD_FILES+=usr/bin/chkey +OLD_FILES+=usr/bin/keylogin +OLD_FILES+=usr/bin/keylogout +OLD_FILES+=usr/sbin/keyserv +OLD_FILES+=usr/bin/newkey +OLD_FILES+=usr/share/man/man1/chkey.1.gz +OLD_FILES+=usr/share/man/man1/keylogin.1.gz +OLD_FILES+=usr/share/man/man1/keylogin.1.gz +OLD_FILES+=usr/share/man/man5/publickey.5.gz +OLD_FILES+=usr/share/man/man8/keyserv.1.gz + # 20241206: Remove Altera DE4 drivers OLD_FILES+=usr/share/man/man4/altera_atse.4.gz OLD_FILES+=usr/share/man/man4/altera_avgen.4.gz diff --git a/lib/libc/rpc/Makefile.inc b/lib/libc/rpc/Makefile.inc index 021b7390ca54..5ee4ffc256a2 100644 --- a/lib/libc/rpc/Makefile.inc +++ b/lib/libc/rpc/Makefile.inc @@ -47,7 +47,7 @@ MAN+= bindresvport.3 des_crypt.3 getnetconfig.3 getnetpath.3 getrpcent.3 \ rpc_clnt_create.3 rpc_svc_calls.3 rpc_svc_create.3 rpc_svc_err.3 \ rpc_svc_reg.3 rpc_xdr.3 rpcbind.3 publickey.3 rpc_secure.3 \ rtime.3 -MAN+= publickey.5 rpc.5 netconfig.5 +MAN+= rpc.5 netconfig.5 MLINKS+= bindresvport.3 bindresvport_sa.3 \ des_crypt.3 ecb_crypt.3 \ des_crypt.3 cbc_crypt.3 \ diff --git a/usr.bin/Makefile b/usr.bin/Makefile index 9baa90aab499..bca7896e5a17 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -61,8 +61,6 @@ SUBDIR= alias \ ipcs \ join \ jot \ - keylogin \ - keylogout \ killall \ ktrace \ ktrdump \ @@ -236,8 +234,6 @@ SUBDIR.${MK_NIS}+= ypcat SUBDIR.${MK_NIS}+= ypmatch SUBDIR.${MK_NIS}+= ypwhich SUBDIR.${MK_OPENSSH}+= ssh-copy-id -SUBDIR.${MK_OPENSSL}+= chkey -SUBDIR.${MK_OPENSSL}+= newkey SUBDIR.${MK_QUOTAS}+= quota SUBDIR.${MK_SENDMAIL}+= vacation SUBDIR.${MK_TALK}+= talk diff --git a/usr.bin/chkey/Makefile b/usr.bin/chkey/Makefile deleted file mode 100644 index 4b734787c0a3..000000000000 --- a/usr.bin/chkey/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -.include - -.PATH: ${SRCTOP}/usr.bin/newkey - -PROG= chkey -SRCS= chkey.c generic.c update.c -CFLAGS+= -I${SRCTOP}/usr.bin/newkey -.if ${MK_NIS} != "no" -CFLAGS+= -DYP -.endif -LIBADD+= rpcsvc mp - -.include diff --git a/usr.bin/chkey/Makefile.depend b/usr.bin/chkey/Makefile.depend deleted file mode 100644 index 341f44c61163..000000000000 --- a/usr.bin/chkey/Makefile.depend +++ /dev/null @@ -1,16 +0,0 @@ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - include \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - secure/lib/libcrypto \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/usr.bin/chkey/Makefile.depend.options b/usr.bin/chkey/Makefile.depend.options deleted file mode 100644 index da5bb6f2ea36..000000000000 --- a/usr.bin/chkey/Makefile.depend.options +++ /dev/null @@ -1,7 +0,0 @@ -# This file is not autogenerated - take care! - -DIRDEPS_OPTIONS= NIS - -DIRDEPS.NIS.yes= lib/libmp - -.include diff --git a/usr.bin/chkey/chkey.1 b/usr.bin/chkey/chkey.1 deleted file mode 100644 index 556d6c281d21..000000000000 --- a/usr.bin/chkey/chkey.1 +++ /dev/null @@ -1,32 +0,0 @@ -.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved. -.\" -.Dd July 5, 1989 -.Dt CHKEY 1 -.Os -.Sh NAME -.Nm chkey -.Nd change your encryption key -.Sh SYNOPSIS -.Nm -.Sh DEPRECATION NOTICE -.Nm -is deprecated and is not available as of -.Fx 15.0. -.Sh DESCRIPTION -The -.Nm -utility prompts the user for their login password, -and uses it to encrypt a new encryption key -for the user to be stored in the -.Xr publickey 5 -database. -.Sh "SEE ALSO" -.Xr keylogin 1 , -.Xr publickey 5 , -.Xr keyserv 8 , -.Xr newkey 8 -.Sh HISTORY -The -.Nm -utility was removed from -.Fx 15.0 . diff --git a/usr.bin/chkey/chkey.c b/usr.bin/chkey/chkey.c deleted file mode 100644 index 24cb3ec3b0b5..000000000000 --- a/usr.bin/chkey/chkey.c +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user or with the express written consent of - * Sun Microsystems, Inc. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -#include -/* - * Copyright (C) 1986, Sun Microsystems, Inc. - */ - -/* - * Command to change one's public key in the public key database - */ -#include -#include -#ifdef YP -#include -#include -#else -#define YPOP_STORE 4 -#endif -#include -#include -#include -#include -#include -#include -#include - -#include "extern.h" - -#ifdef YPPASSWD -struct passwd *ypgetpwuid(uid_t); -#endif - -#ifdef YP -static char *domain; -static char PKMAP[] = "publickey.byname"; -#else -static char PKFILE[] = "/etc/publickey"; -#endif /* YP */ -static char ROOTKEY[] = "/etc/.rootkey"; - -static void usage(void) __dead2; -extern int yp_update(char *, char *, int, char *, size_t, char *, size_t); - -int -main(int argc, char **argv) -{ - char name[MAXNETNAMELEN+1]; - char public[HEXKEYBYTES + 1]; - char secret[HEXKEYBYTES + 1]; - char crypt1[HEXKEYBYTES + KEYCHECKSUMSIZE + 1]; - char crypt2[HEXKEYBYTES + KEYCHECKSUMSIZE + 1]; - int status; - char *pass; - struct passwd *pw; - uid_t uid; - int force = 0; - int ch; -#ifdef YP - char *master; -#endif -#ifdef YPPASSWD - char *cryptpw; -#endif - - fprintf(stderr, "chkey is deprecated and removed from FreeBSD 15.\n"); - while ((ch = getopt(argc, argv, "f")) != -1) - switch(ch) { - case 'f': - force = 1; - break; - default: - usage(); - } - argc -= optind; - argv += optind; - - if (argc != 0) - usage(); - -#ifdef YP - (void)yp_get_default_domain(&domain); - if (yp_master(domain, PKMAP, &master) != 0) - errx(1, "can't find master of publickey database"); -#endif - uid = getuid() /*geteuid()*/; - if (uid == 0) { - if (host2netname(name, NULL, NULL) == 0) - errx(1, "cannot convert hostname to netname"); - } else { - if (user2netname(name, uid, NULL) == 0) - errx(1, "cannot convert username to netname"); - } - (void)printf("Generating new key for %s.\n", name); - - if (!force) { - if (uid != 0) { -#ifdef YPPASSWD - pw = ypgetpwuid(uid); -#else - pw = getpwuid(uid); -#endif - if (pw == NULL) { -#ifdef YPPASSWD - errx(1, - "no NIS password entry found: can't change key"); -#else - errx(1, - "no password entry found: can't change key"); -#endif - } - } else { - pw = getpwuid(0); - if (pw == NULL) - errx(1, "no password entry found: can't change key"); - } - } - pass = getpass("Password:"); -#ifdef YPPASSWD - if (!force) { - cryptpw = crypt(pass, pw->pw_passwd); - if (cryptpw == NULL || strcmp(cryptpw, pw->pw_passwd) != 0) - errx(1, "invalid password"); - } -#else - force = 1; /* Make this mandatory */ -#endif - genkeys(public, secret, pass); - - memcpy(crypt1, secret, HEXKEYBYTES); - memcpy(crypt1 + HEXKEYBYTES, secret, KEYCHECKSUMSIZE); - crypt1[HEXKEYBYTES + KEYCHECKSUMSIZE] = 0; - xencrypt(crypt1, pass); - - if (force) { - memcpy(crypt2, crypt1, HEXKEYBYTES + KEYCHECKSUMSIZE + 1); - xdecrypt(crypt2, getpass("Retype password:")); - if (memcmp(crypt2, crypt2 + HEXKEYBYTES, KEYCHECKSUMSIZE) != 0 - || memcmp(crypt2, secret, HEXKEYBYTES) != 0) - errx(1, "password incorrect"); - } - -#ifdef YP - (void)printf("Sending key change request to %s...\n", master); -#endif - status = setpublicmap(name, public, crypt1); - if (status != 0) { -#ifdef YP - errx(1, "unable to update NIS database (%u): %s", - status, yperr_string(status)); -#else - errx(1, "unable to update publickey database"); -#endif - } - - if (uid == 0) { - /* - * Root users store their key in /etc/$ROOTKEY so - * that they can auto reboot without having to be - * around to type a password. Storing this in a file - * is rather dubious: it should really be in the EEPROM - * so it does not go over the net. - */ - int fd; - - fd = open(ROOTKEY, O_WRONLY|O_TRUNC|O_CREAT, 0); - if (fd < 0) { - warn("%s", ROOTKEY); - } else { - char newline = '\n'; - - if (write(fd, secret, strlen(secret)) < 0 || - write(fd, &newline, sizeof(newline)) < 0) - warn("%s: write", ROOTKEY); - } - close(fd); - } - - if (key_setsecret(secret) < 0) - errx(1, "unable to login with new secret key"); - (void)printf("Done.\n"); - exit(0); - /* NOTREACHED */ -} - -static void -usage(void) -{ - (void)fprintf(stderr, "usage: chkey [-f]\n"); - exit(1); - /* NOTREACHED */ -} - - -/* - * Set the entry in the public key file - */ -int -setpublicmap(char *name, char *public, char *secret) -{ - char pkent[1024]; - - (void)sprintf(pkent,"%s:%s", public, secret); -#ifdef YP - return (yp_update(domain, PKMAP, YPOP_STORE, - name, strlen(name), pkent, strlen(pkent))); -#else - return (localupdate(name, PKFILE, YPOP_STORE, - strlen(name), name, strlen(pkent), pkent)); -#endif -} - -#ifdef YPPASSWD -struct passwd * -ypgetpwuid(uid_t uid) -{ - char uidstr[10]; - char *val; - int vallen; - static struct passwd pw; - char *p; - - (void)sprintf(uidstr, "%d", uid); - if (yp_match(domain, "passwd.byuid", uidstr, strlen(uidstr), - &val, &vallen) != 0) { - return (NULL); - } - p = strchr(val, ':'); - if (p == NULL) { - return (NULL); - } - pw.pw_passwd = p + 1; - p = strchr(pw.pw_passwd, ':'); - if (p == NULL) { - return (NULL); - } - *p = 0; - return (&pw); -} -#endif /* YPPASSWD */ diff --git a/usr.bin/keylogin/Makefile b/usr.bin/keylogin/Makefile deleted file mode 100644 index 7a267e4c5a72..000000000000 --- a/usr.bin/keylogin/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -PROG= keylogin - -LIBADD= rpcsvc - -.include diff --git a/usr.bin/keylogin/Makefile.depend b/usr.bin/keylogin/Makefile.depend deleted file mode 100644 index 352a225b19c6..000000000000 --- a/usr.bin/keylogin/Makefile.depend +++ /dev/null @@ -1,18 +0,0 @@ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - include \ - include/rpc \ - include/rpcsvc \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - lib/librpcsvc \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/usr.bin/keylogin/keylogin.1 b/usr.bin/keylogin/keylogin.1 deleted file mode 100644 index 550d670afbe7..000000000000 --- a/usr.bin/keylogin/keylogin.1 +++ /dev/null @@ -1,37 +0,0 @@ -.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved. -.\" -.Dd September 9, 1987 -.Dt KEYLOGIN 1 -.Os -.Sh NAME -.Nm keylogin -.Nd decrypt and store secret key -.Sh SYNOPSIS -.Nm -.Sh DEPRECATION NOTICE -.Nm -is deprecated and is not available as of -.Fx 15.0. -.Sh DESCRIPTION -The -.Nm -utility prompts the user for their login password, and uses it to decrypt -the user's secret key stored in the -.Xr publickey 5 -database. -Once decrypted, the user's key is stored by the local -key server process -.Xr keyserv 8 -to be used by any secure network services, such as NFS. -.Sh SEE ALSO -.Xr chkey 1 , -.Xr keylogout 1 , -.Xr login 1 , -.Xr publickey 5 , -.Xr keyserv 8 , -.Xr newkey 8 -.Sh HISTORY -The -.Nm -utility was removed from -.Fx 15.0 . diff --git a/usr.bin/keylogin/keylogin.c b/usr.bin/keylogin/keylogin.c deleted file mode 100644 index c64afa4846bc..000000000000 --- a/usr.bin/keylogin/keylogin.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user or with the express written consent of - * Sun Microsystems, Inc. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#include -/* - * Copyright (C) 1986, Sun Microsystems, Inc. - */ - -/* - * Set secret key on local machine - */ -#include -#include -#include -#include -#include -#include -#include - -extern int key_setnet(struct key_netstarg *); - -int -main(void) -{ - char fullname[MAXNETNAMELEN + 1]; - struct key_netstarg netst; - - fprintf(stderr, "keylogin is deprecated and removed from FreeBSD 15.\n"); - if (!getnetname(fullname)) { - fprintf(stderr, "netname lookup failed -- make sure the "); - fprintf(stderr, "system domain name is set.\n"); - exit(1); - } - - if (! getsecretkey(fullname, (char *)&(netst.st_priv_key), - getpass("Password:"))) { - fprintf(stderr, "Can't find %s's secret key\n", fullname); - exit(1); - } - if (netst.st_priv_key[0] == 0) { - fprintf(stderr, "Password incorrect for %s\n", fullname); - exit(1); - } - - netst.st_pub_key[0] = 0; - netst.st_netname = strdup(fullname); - - if (key_setnet(&netst) < 0) { - fprintf(stderr, "Could not set %s's secret key\n", fullname); - fprintf(stderr, "Maybe the keyserver is down?\n"); - exit(1); - } - exit(0); - /* NOTREACHED */ -} diff --git a/usr.bin/keylogout/Makefile b/usr.bin/keylogout/Makefile deleted file mode 100644 index 244d6d2d0be7..000000000000 --- a/usr.bin/keylogout/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -PROG= keylogout - -.include diff --git a/usr.bin/keylogout/Makefile.depend b/usr.bin/keylogout/Makefile.depend deleted file mode 100644 index a2d89550fa2b..000000000000 --- a/usr.bin/keylogout/Makefile.depend +++ /dev/null @@ -1,17 +0,0 @@ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - include \ - include/rpc \ - include/rpcsvc \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/usr.bin/keylogout/keylogout.1 b/usr.bin/keylogout/keylogout.1 deleted file mode 100644 index 348d7e380ea0..000000000000 --- a/usr.bin/keylogout/keylogout.1 +++ /dev/null @@ -1,49 +0,0 @@ -.Dd April 15, 1989 -.Dt KEYLOGOUT 1 -.Os -.Sh NAME -.Nm keylogout -.Nd delete stored secret key -.Sh SYNOPSIS -.Nm -.Op Fl f -.Sh DEPRECATION NOTICE -.Nm -is deprecated and is not available as of -.Fx 15.0. -.Sh DESCRIPTION -The -.Nm -utility deletes the key stored by the key server process -.Xr keyserv 8 -to be used by any secure network services, such as NFS. -Further access to the key is revoked, -however current session keys may remain valid till they expire, -or are refreshed. -This option will cause any background jobs that need secure RPC -services to fail, and any scheduled -.Nm at -jobs that need the key to fail. -Also since only one copy is kept on a machine of the key, -it is a bad idea to place this in your -.Pa .logout -file since it will affect other sessions on the same machine. -.Pp -The following option is available: -.Bl -tag -width indent -.It Fl f -Forget the rootkey. -This will break secure NFS if it is done on a server. -.El -.Sh SEE ALSO -.Xr chkey 1 , -.Xr keylogin 1 , -.Xr login 1 , -.Xr publickey 5 , -.Xr keyserv 8 , -.Xr newkey 8 -.Sh HISTORY -The -.Nm -utility was removed from -.Fx 15.0 . diff --git a/usr.bin/keylogout/keylogout.c b/usr.bin/keylogout/keylogout.c deleted file mode 100644 index faad41462340..000000000000 --- a/usr.bin/keylogout/keylogout.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user or with the express written consent of - * Sun Microsystems, Inc. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (C) 1986, Sun Microsystems, Inc. - */ - -#include -/* - * unset the secret key on local machine - */ - -#include -#include -#include -#include -#include - -int -main(int argc, char **argv) -{ - static char secret[HEXKEYBYTES + 1]; - - fprintf(stderr, "keylogin is deprecated and removed from FreeBSD 15.\n"); - if (geteuid() == 0) { - if ((argc != 2 ) || (strcmp(argv[1], "-f") != 0)) { - fprintf(stderr, -"keylogout by root would break all servers that use secure rpc!\n"); - fprintf(stderr, -"root may use keylogout -f to do this (at your own risk)!\n"); - exit(1); - } - } - - if (key_setsecret(secret) < 0) { - fprintf(stderr, "Could not unset your secret key.\n"); - fprintf(stderr, "Maybe the keyserver is down?\n"); - exit(1); - } - exit(0); - /* NOTREACHED */ -} diff --git a/usr.bin/newkey/Makefile b/usr.bin/newkey/Makefile deleted file mode 100644 index a081774288ac..000000000000 --- a/usr.bin/newkey/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -.include - -PROG= newkey -SRCS= newkey.c generic.c update.c -.if ${MK_NIS} != "no" -CFLAGS+= -DYP -.endif -MAN= newkey.8 -LIBADD= rpcsvc mp - -.include diff --git a/usr.bin/newkey/Makefile.depend b/usr.bin/newkey/Makefile.depend deleted file mode 100644 index 67fb1e963614..000000000000 --- a/usr.bin/newkey/Makefile.depend +++ /dev/null @@ -1,20 +0,0 @@ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - include \ - include/rpc \ - include/rpcsvc \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - lib/libmp \ - lib/librpcsvc \ - secure/lib/libcrypto \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/usr.bin/newkey/extern.h b/usr.bin/newkey/extern.h deleted file mode 100644 index 2e8573b4c78c..000000000000 --- a/usr.bin/newkey/extern.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user or with the express written consent of - * Sun Microsystems, Inc. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -#ifdef YP -#define MAXMAPNAMELEN 256 -#else -#define YPOP_CHANGE 1 /* change, do not add */ -#define YPOP_INSERT 2 /* add, do not change */ -#define YPOP_DELETE 3 /* delete this entry */ -#define YPOP_STORE 4 /* add, or change */ -#endif - -void genkeys(char *, char *, char *); -int setpublicmap(char *, char *, char *); -int mapupdate(char *, char *, u_int, u_int, char *, u_int, char *); -void xencrypt(char *, char *); -void xdecrypt(char *, char *); -int localupdate(char *, char *, u_int, u_int, char *, u_int, char *); diff --git a/usr.bin/newkey/generic.c b/usr.bin/newkey/generic.c deleted file mode 100644 index faf2247376b0..000000000000 --- a/usr.bin/newkey/generic.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user or with the express written consent of - * Sun Microsystems, Inc. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * Copyright (C) 1986, Sun Microsystems, Inc. - */ - -#include -#include - -#include -#include - -#include -#include -#include - -#include "extern.h" - -static void adjust(char[HEXKEYBYTES + 1], char *); -static void getseed(char *, int, unsigned char *); - -/* - * Generate a seed - */ -static void -getseed(char *seed, int seedsize, unsigned char *pass) -{ - int i; - - for (i = 0; i < seedsize; i++) { - seed[i] = (arc4random() & 0xff) ^ pass[i % 8]; - } -} - -/* - * Generate a random public/secret key pair - */ -void -genkeys(char *public, char *secret, char *pass) -{ - unsigned int i; - -# define BASEBITS (8*sizeof (short) - 1) -# define BASE (1 << BASEBITS) - - MINT *pk = mp_itom(0); - MINT *sk = mp_itom(0); - MINT *tmp; - MINT *base = mp_itom((short)BASE); - MINT *root = mp_itom(PROOT); - MINT *modulus = mp_xtom(HEXMODULUS); - short r; - unsigned short seed[KEYSIZE/BASEBITS + 1]; - char *xkey; - - getseed((char *)seed, sizeof (seed), (u_char *)pass); - for (i = 0; i < KEYSIZE/BASEBITS + 1; i++) { - r = seed[i] % BASE; - tmp = mp_itom(r); *** 2395 LINES SKIPPED *** From nobody Wed Jan 22 18:39:22 2025 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 4YdXt26dpKz5krwd; Wed, 22 Jan 2025 18:39: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 4YdXt25vVQz42bg; Wed, 22 Jan 2025 18:39:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737571162; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8H+GfHAYT+zWBTypsxba60HSD746WdFAXLrwYNUrRew=; b=f7ZtcjtgQpmWhx46b7K4r7nd1DFzHhMvDRGEUbUO3w72eo4izMXJgsMnkrHB1eMeUVNhof zbi2kv93eW1JORaKQdDCTqE7i7Vso+p6b2PZVzUCFcWDH8Zdw9QpALhE+m7SZueMnvdevc KWx5EL8t2SgLRakkh5mcfi5WnPILO8jTFucjNUsvDX4OCYGebh6YAZWsabWaka34Nln67X YYdh6NNCc5YAk9fKhhrmlMwP+SNdWp0/ywCKjnpjVIlQLmdylM5Bad4KdVxci00M2NELQk rswaMuZCKemsm7MRZu5Ylc7kW9l+94QHqFv7ifDieurzpyDW25CQ5CM+qQQA+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737571162; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8H+GfHAYT+zWBTypsxba60HSD746WdFAXLrwYNUrRew=; b=CR1rZVQeOuidC6LzUx0xN05lXRO11S9MZ2vHwwkl91w7Q6wNvgqNP+EihPtRP5Y50+wPQz 9gKXeSVMrcyMJZndjsO2tE4i8PywgQ7PriHswYQTOqCuuSXeBNBIFnw+wVsXedKN21Hne9 4pBh6fJLEOAI1k6UgsF8GqAsQU6IuSNyyI+NpoOs9nc9KhKyMXPQ2/P48fL8ZEQ/z1pk4D REJX1wsKWYingS/XRhWcNTTxYgpyZDlhgZt5a0/kKVTA517Z71AVpRW3l4wsPnaSxxgzAW 0KkDnOCTIOyfOIDc+hp47p2HqKz54Be0n8qfvoNkq57JDdl8ucGqXPyakbwnaA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737571162; a=rsa-sha256; cv=none; b=Bwm9WwULrXK/nl4p4e95ZGQL29+GxuMZXAvme2VNZaJ/1t1ij/89AdHQTjIFb1NQx426QF CEQvPWm94Y23JCqy2OKqrjFqNLL9Xk3yuQA8k/laFwjMVl5DAax04FLMjn7ZCQqIT7YzAn fYsA/kMNjT7xOtKGDH5qH5MQyW9exVlxCk1RDoC/igsOkSjRPx6HPoDJrFigXf3323o3fQ O8NJVvZpYxbuH2Q2udCfc1PnOOoARnTzzqRb1aGTjrC7vtY24ZhP7OjJ5RYqqMT0N19t96 WvcrOcj/rK8PUTsSN5dUdDFlPaUri7t1IQwK3qAhxYNIIoWLPUEu39WLMfa4Xw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YdXt24zLKz14Cx; Wed, 22 Jan 2025 18:39: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 50MIdMeK053065; Wed, 22 Jan 2025 18:39:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50MIdMIx053062; Wed, 22 Jan 2025 18:39:22 GMT (envelope-from git) Date: Wed, 22 Jan 2025 18:39:22 GMT Message-Id: <202501221839.50MIdMIx053062@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Leidinger Subject: git: 2a44cccd404d - main - Add option to clear caller-used registers on function 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: netchild X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2a44cccd404d94c273c78e279df3fdc5531d25a2 Auto-Submitted: auto-generated The branch main has been updated by netchild: URL: https://cgit.FreeBSD.org/src/commit/?id=2a44cccd404d94c273c78e279df3fdc5531d25a2 commit 2a44cccd404d94c273c78e279df3fdc5531d25a2 Author: Alexander Leidinger AuthorDate: 2025-01-11 12:48:50 +0000 Commit: Alexander Leidinger CommitDate: 2025-01-22 18:33:23 +0000 Add option to clear caller-used registers on function return. The WITH_ZEROREGS option for src.conf will zero caller-used register contents just before returning from a function, ensuring that temporary values are not leaked beyond the function boundary. This means that register contents are less likely to be available for side channel attacks and information exposures. It reduces all except 1 of the simple "write-what-where" ROP gadgets in /lib: grep "Gadget found" /tmp/before_lib* | wc -l 197 grep "Gadget found" /tmp/after_lib* | wc -l 1 grep "Gadget found" /tmp/after_lib* /tmp/after_libbsdxml.so.4.txt: [+] Gadget found: 0x1b3f1 mov qword ptr [rdi], rcx ; pop rbp ; ret To reproduce: for lib in *.so.*; do echo $lib: ROPgadget --ropchain --binary /tmp/be_mount.Sx87/lib/$lib | sed -n '/Step 1/,/Step 2/p' >! /tmp/before_$lib.txt ROPgadget --ropchain --binary $lib | sed -n '/Step 1/,/Step 2/p' >! /tmp/after_$lib.txt done Additionally, in some cases this reduces the number of all ROP gadgets (quick check with /libs only): libalias.so.7: reduction 10.000% libavl.so.2: reduction 13.900% libbsdxml.so.4: reduction 37.500% libc.so.7: reduction 10.000% libc++.so.1: reduction 14.800% libcam.so.7: reduction 50.700% libcap_netdb.so.1: reduction 5.800% libcasper.so.1: reduction 14.600% libcrypto.so.30: reduction 7.500% libdtrace.so.2: reduction 3.900% libelf.so.2: reduction 15.800% libgcc_s.so.1: reduction 32.700% libibverbs.so.1: reduction 5.300% libicp.so.3: reduction 2.100% libipt.so.0: reduction 28.200% libirdma.so.1: reduction 1.600% libkiconv.so.4: reduction 0% libm.so.5: reduction 21.900% libmd.so.6: reduction 0% libmd.so.7: reduction 3.100% libncursesw.so.9: reduction 11.200% libnvpair.so.2: reduction 40.200% libpcap.so.8: reduction 11.400% libpjdlog.so.0: reduction 27.400% libsbuf.so.6: reduction 2.900% libspl.so.2: reduction 42.300% libsys.so.7: reduction 2.700% libthr.so.3: reduction 21.000% libuutil.so.2: reduction 13.100% libz.so.6: reduction 5.600% libzpool.so.2: reduction 15.100% In some cases it adds some ROP gadgets despite removing the simple ROP gadgets: lib80211.so.1: reduction -32.700% libbe.so.1: reduction -22.300% libbegemot.so.4: reduction -20.500% libcap_dns.so.2: reduction -58.000% libcap_fileargs.so.1: reduction -28.200% libcap_grp.so.1: reduction -54.000% libcap_net.so.1: reduction -28.800% libcap_pwd.so.1: reduction -38.800% libcap_sysctl.so.2: reduction -71.100% libcap_syslog.so.1: reduction -15.000% libcrypt.so.5: reduction -14.600% libctf.so.2: reduction -.300% libcxxrt.so.1: reduction -14.000% libdevstat.so.7: reduction -1.600% libedit.so.8: reduction -4.200% libgeom.so.5: reduction -16.500% libicp_rescue.so.3: reduction -2.300% libipsec.so.4: reduction -31.800% libjail.so.1: reduction -21.700% libkvm.so.7: reduction -5.300% libmlx5.so.1: reduction -6.300% libmt.so.5: reduction -23.000% libnv.so.1: reduction -.400% librss.so.1: reduction -3.800% librt.so.1: reduction -24.000% libssp.so.0: reduction -21.100% libstats.so.0: reduction -9.000% libtinfow.so.9: reduction -3.500% libtpool.so.2: reduction -36.500% libufs.so.8: reduction -11.900% libulog.so.0: reduction -67.400% libumem.so.2: reduction -2.000% libutil.so.9: reduction -7.200% libxo.so.0: reduction -9.000% libzdb.so.2: reduction -11.700% libzfs_core.so.2: reduction -17.700% libzfs.so.4: reduction -.300% libzfsbootenv.so.1: reduction -26.900% libzutil.so.2: reduction -5.600% To reproduce: for lib in *.so.*; do echo -n $lib: before="$(ROPgadget --nosys --nojop --binary /tmp/be_mount.Sx87/lib/$lib | tail -n1 | cut -d : -f 2)" after="$(ROPgadget --nosys --nojop --binary $lib | tail -n1 | cut -d : -f 2)" echo " reduction" $(bc -S 3 -e "(1-${after}/${before})*100")% done >/tmp/reduction.txt Most of the time the size difference is very small (<1% for >50% of the files and >10% for only 2 files): lib80211.so.1: size change .100% libalias.so.7: size change 0% libavl.so.2: size change 0% libbe.so.1: size change .100% libbegemot.so.4: size change .100% libbsdxml.so.4: size change 0% libc.so.7: size change 1.200% libc++.so.1: size change 1.600% libcam.so.7: size change 1.900% libcap_dns.so.2: size change .100% libcap_fileargs.so.1: size change .100% libcap_grp.so.1: size change .100% libcap_net.so.1: size change .100% libcap_netdb.so.1: size change .100% libcap_pwd.so.1: size change .100% libcap_sysctl.so.2: size change .100% libcap_syslog.so.1: size change .100% libcasper.so.1: size change 0% libcrypt.so.5: size change 3.900% libcrypto.so.30: size change 1.400% libctf.so.2: size change .100% libcxxrt.so.1: size change .100% libdevstat.so.7: size change 15.400% exceptional libdtrace.so.2: size change .600% libedit.so.8: size change 1.800% libelf.so.2: size change .100% libgcc_s.so.1: size change 3.000% libgeom.so.5: size change 0% libibverbs.so.1: size change .100% libicp_rescue.so.3: size change .100% libicp.so.3: size change 1.500% libipsec.so.4: size change .100% libipt.so.0: size change 3.100% libirdma.so.1: size change .100% libjail.so.1: size change .100% libkiconv.so.4: size change .100% libkvm.so.7: size change .100% libm.so.5: size change 1.700% libmd.so.6: size change 0% libmd.so.7: size change .100% libmlx5.so.1: size change 0% libmt.so.5: size change .100% libncursesw.so.9: size change 1.900% libnv.so.1: size change 4.300% libnvpair.so.2: size change 4.300% libpcap.so.8: size change 1.200% libpjdlog.so.0: size change .100% librss.so.1: size change .200% librt.so.1: size change .100% libsbuf.so.6: size change .100% libspl.so.2: size change 0% libssp.so.0: size change .100% libstats.so.0: size change .100% libsys.so.7: size change .100% libthr.so.3: size change 2.400% libtinfow.so.9: size change 1.600% libtpool.so.2: size change .100% libufs.so.8: size change .100% libulog.so.0: size change .100% libumem.so.2: size change 54.300% exceptional libutil.so.9: size change .100% libuutil.so.2: size change .100% libxo.so.0: size change .100% libz.so.6: size change .100% libzdb.so.2: size change .300% libzfs_core.so.2: size change .100% libzfs.so.4: size change 2.000% libzfsbootenv.so.1: size change .100% libzpool.so.2: size change 1.200% libzutil.so.2: size change 0% --- share/man/man5/src.conf.5 | 7 ++++++- share/mk/bsd.compiler.mk | 6 ++++++ share/mk/bsd.lib.mk | 9 +++++++++ share/mk/bsd.opts.mk | 3 ++- share/mk/bsd.prog.mk | 9 +++++++++ stand/defs.mk | 1 + tools/build/options/WITHOUT_ZEROREGS | 2 ++ tools/build/options/WITH_ZEROREGS | 4 ++++ 8 files changed, 39 insertions(+), 2 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 88df18b3142e..4d48edff3c80 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,5 +1,5 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. -.Dd November 22, 2024 +.Dd January 22, 2025 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1856,6 +1856,11 @@ Build without support for the IEEE 802.1X protocol and without support for EAP-PEAP, EAP-TLS, EAP-LEAP, and EAP-TTLS protocols (usable only via 802.1X). +.It Va WITH_ZEROREGS +Build the basesystem with code to zero caller-used register contents +on function return. +This prevents leaking temporary values for side channel attacks. +Additionally this reduces the number of usable ROP gadgets for attackers. .It Va WITHOUT_ZFS Do not build the ZFS file system kernel module, libraries such as .Xr libbe 3 , diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk index fd236b2e6b8f..bf6ef3956d7d 100644 --- a/share/mk/bsd.compiler.mk +++ b/share/mk/bsd.compiler.mk @@ -24,6 +24,7 @@ # - retpoline: supports the retpoline speculative execution vulnerability # mitigation. # - init-all: supports stack variable initialization. +# - zeroregs: supports zeroing used registers on return # - aarch64-sha512: supports the AArch64 sha512 intrinsic functions. # # When bootstrapping on macOS, 'apple-clang' will be set in COMPILER_FEATURES @@ -263,6 +264,11 @@ ${X_}COMPILER_FEATURES+= compressed-debug ${X_}COMPILER_FEATURES+= fileprefixmap .endif +.if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 150000) || \ + (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 110000) +${X_}COMPILER_FEATURES+= zeroregs +.endif + .if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 130000) || \ (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 90000) # AArch64 sha512 intrinsics are supported (and have been tested) in diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index d669dccdc268..cf4140d0b3e6 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -118,6 +118,15 @@ CXXFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-cl .endif .endif +# Zero used registers on return (mitigate some ROP) +.if ${MK_ZEROREGS} != "no" +.if ${COMPILER_FEATURES:Mzeroregs} +ZEROREG_TYPE?= used +CFLAGS+= -fzero-call-used-regs=${ZEROREG_TYPE} +CXXFLAGS+= -fzero-call-used-regs=${ZEROREG_TYPE} +.endif +.endif + # bsd.sanitizer.mk is not installed, so don't require it (e.g. for ports). .sinclude "bsd.sanitizer.mk" diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index c05de9b079ce..f79c5bc61a20 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -81,7 +81,8 @@ __DEFAULT_NO_OPTIONS = \ RETPOLINE \ STALE_STAGED \ UBSAN \ - UNDEFINED_VERSION + UNDEFINED_VERSION \ + ZEROREGS __DEFAULT_DEPENDENT_OPTIONS = \ MAKE_CHECK_USE_SANDBOX/TESTS \ diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 89534b21d0e7..1894a8b938d0 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -90,6 +90,15 @@ CXXFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-cl .endif .endif +# Zero used registers on return (mitigate some ROP) +.if ${MK_ZEROREGS} != "no" +.if ${COMPILER_FEATURES:Mzeroregs} +ZEROREG_TYPE?= used +CFLAGS+= -fzero-call-used-regs=${ZEROREG_TYPE} +CXXFLAGS+= -fzero-call-used-regs=${ZEROREG_TYPE} +.endif +.endif + # bsd.sanitizer.mk is not installed, so don't require it (e.g. for ports). .sinclude "bsd.sanitizer.mk" diff --git a/stand/defs.mk b/stand/defs.mk index fa3c89a4c3cc..f39966f2ca8e 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -11,6 +11,7 @@ FORTIFY_SOURCE= 0 MK_CTF= no MK_SSP= no MK_PIE= no +MK_ZEROREGS= no MAN= .if !defined(PIC) NO_PIC= diff --git a/tools/build/options/WITHOUT_ZEROREGS b/tools/build/options/WITHOUT_ZEROREGS new file mode 100644 index 000000000000..edaf5fd8d6c9 --- /dev/null +++ b/tools/build/options/WITHOUT_ZEROREGS @@ -0,0 +1,2 @@ +Do not build build the basesystem with code to zero caller-used register +contents on function return. diff --git a/tools/build/options/WITH_ZEROREGS b/tools/build/options/WITH_ZEROREGS new file mode 100644 index 000000000000..1fc4b856bd50 --- /dev/null +++ b/tools/build/options/WITH_ZEROREGS @@ -0,0 +1,4 @@ +Build the basesystem with code to zero caller-used register contents +on function return. +This prevents leaking temporary values for side channel attacks. +Additionally this reduces the number of usable ROP gadgets for attackers. From nobody Wed Jan 22 18:44:16 2025 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 4YdY064tWmz5ksst; Wed, 22 Jan 2025 18:44:38 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.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 4YdY064BLcz43Tr; Wed, 22 Jan 2025 18:44:38 +0000 (UTC) (envelope-from netchild@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737571478; 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: in-reply-to:in-reply-to:references:references; bh=LRhwfuYyTHiK00ldykZ381Gf5UKmRa8SH1fOC0b0hmU=; b=sg3r97S8mRC0d3kVdw7DWGQlLkwVGQSYaaRt61zdadIdSM0ONabKR7Wq08V4LusaLFCQeE B71Hk9N3laI3kTpuvQLOn6mwp17ejdbjH0mTZnTmfExat2FDu1B3+0XURGhxGXdSl4iS+Y NiRw9QaPWvjPC9lKai+h2wRuED3iKX5LDsNswxI6rYi993enORt5qE3spV6sK2xyCCbcrj rMkX3mlm/+Li67DvDrgBVi1edFDKABBD/2mvCPnA0ZpL2z97lGptOKROZ3cKh5TD/YFu+F Edop6jn8Zd5TLGtowMeGcGsly1OyMQKtWud8+Ru+3Z4mLXkQiK0y+l3pWwlSVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737571478; 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: in-reply-to:in-reply-to:references:references; bh=LRhwfuYyTHiK00ldykZ381Gf5UKmRa8SH1fOC0b0hmU=; b=RAY/SLisDhOSePIB1rpXa+w9lqXhp3gwq7Y9ylPl9dmeKogF9zbHkc6bNJckLp+70iZXIM zGnfmLnwjqeIZEmkcnVrdKTrdbaSjM9PgJGgETjINidSrZFgYCt/BaIAZqEa17aZLk/hBJ FpjHwXbdkvdMya0l1CigI2AKRe5daZW3/gjf8XLyt8UVpBBpqyASlDFawbSJE1RtTAyhpL sxYqw32nUKI3qIcEkl9WCrOmsmXBMu4Y+YcWB0YCIKCmxBzJGKLQ+YTZV0RJW1QKR/GFvJ bUgFKNffEq5+u58lpBNFGQTWEkUsMYuTjKtVBouC/5e9Vi9da4sr0ICkus6pYA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737571478; a=rsa-sha256; cv=none; b=DfTQ9FgBy3qPmSPlFesl3O0vUCFT9q7Fr8UTbw8vBHdJn2RR2S/jzCXVGpha5GxlBIXaVY sYZPiZpAdmqDk8k2dmRIwixvvYcuybQB/bN119bVYkfVxec7THAvM6SMlpYeVJxOaSvxrJ IlZ+qn4AfARu0q71xWRz/wsz+Rrw8192t4Cr3KapX4zt+dToILrY9C8kUAoPmSMQXNZsSf EgpSB56fQGgNEix+eciHCqEMQLn2JVhWVXrSKD/bwHEiZICH+npLogJAviScLLdJcElBLj IZltYe/qbbgdke7HGLNOmgq4xtaYNX+FGnWXtB8T2TJjMfY1qgnsKsmyF/33lQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from outgoing.leidinger.net (p5b16583a.dip0.t-ipconnect.de [91.22.88.58]) (using TLSv1.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 ECDSA (prime256v1) client-digest SHA256) (Client CN "outgoing.leidinger.net", Issuer "E5" (verified OK)) (Authenticated sender: netchild) by smtp.freebsd.org (Postfix) with ESMTPSA id 4YdY062hfqz17nd; Wed, 22 Jan 2025 18:44:38 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from webmail.leidinger.net (roundcube.Leidinger.net [192.168.1.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: alexander@leidinger.net) by outgoing.leidinger.net (Postfix) with ESMTPSA id 4CDC140A; Wed, 22 Jan 2025 19:44:33 +0100 (CET) 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 Date: Wed, 22 Jan 2025 19:44:16 +0100 From: Alexander Leidinger To: src-committers@freebsd.org Cc: dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 2a44cccd404d - main - Add option to clear caller-used registers on function return. In-Reply-To: <202501221839.50MIdMIx053062@gitrepo.freebsd.org> References: <202501221839.50MIdMIx053062@gitrepo.freebsd.org> Message-ID: <431de0037dc3f00fbcb596b9cbf2a942@FreeBSD.org> Organization: FreeBSD Content-Type: multipart/signed; protocol="application/pgp-signature"; boundary="=_ca047571fc92c6478f3a074d575502de"; micalg=pgp-sha256 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --=_ca047571fc92c6478f3a074d575502de Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Am 2025-01-22 19:39, schrieb Alexander Leidinger: > The branch main has been updated by netchild: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=2a44cccd404d94c273c78e279df3fdc5531d25a2 > > commit 2a44cccd404d94c273c78e279df3fdc5531d25a2 > Author: Alexander Leidinger > AuthorDate: 2025-01-11 12:48:50 +0000 > Commit: Alexander Leidinger > CommitDate: 2025-01-22 18:33:23 +0000 > > Add option to clear caller-used registers on function return. I forgot to add: https://reviews.freebsd.org/D48427 Bye, Alexander. -- http://www.Leidinger.net Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF http://www.FreeBSD.org netchild@FreeBSD.org : PGP 0x8F31830F9F2772BF --=_ca047571fc92c6478f3a074d575502de Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc; size=833 Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEER9UlYXp1PSd08nWXEg2wmwP42IYFAmeRPJAACgkQEg2wmwP4 2IbQ5g//TRQD8VjX9JsW/Fkc3NFiSJAAss9OkhadL1yCUexoiNDqn75rZ/bwyVFP WPwO/FMvC6z8yorO+J0WzFueSMm96lKL57OIUextE6B7QLF8hgL1q8kLITPN7L9z 66WOGvl+tHnKgsLkJZFh9HJHLsPBEWiYKiB2cuuCbtRlstA2DY/z5b2BcMyshRHj t4ahT8g5wu1kTH/i9h/3HEPy6Llte5rZqNfpMkttz8qFcss34cBM7ODk2qxq4kIu 6B03ogDE3YueoBGNk1wl1f05thLfYQifnpYd8ZfGJ1C7xV/foDIP1pdACXyZDsGy pOGiuxXLPePWJfAxdriSgV6btGJY6rN0MMgBLmgMw3p0wiy+TvH1eG43aPQqY8mZ m8PEPa0XDQxBSbrF6uk0kuRJbCRMI/ngEW9t7MU4d1wdI+9bqkWjeo69A+kLdjMo jabcrfgX9hhVcPrHyGdEVhCCstBbBON3iVB8QZvQtGsTOPgQAK2ZauL5g7Ro7VX9 xyD+TTZfiaksdJaQ7nqq5rj2TcGQnuxtcAwDV43x8WoPEEsCzvmPWDBnRave7lUZ BQnqvI60dAG5gs9pszvzDtxbNozbjL0+IKF1hQiBibp4DQma8VqzFddPUbzr7LgO RiFoDW+h1pmMTNhoDkziHOkqQVkWtOC0Zvf0ZuUoOnsnmVGAK98= =p8Ko -----END PGP SIGNATURE----- --=_ca047571fc92c6478f3a074d575502de-- From nobody Wed Jan 22 19:58:27 2025 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 4YdZdJ02J1z5kyVP; Wed, 22 Jan 2025 19:58: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 4YdZdH6WsWz3CPH; Wed, 22 Jan 2025 19:58:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737575907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=McfUsPJsLpYBQKi4myEfqQ1sRv6eOWyMRce2ZRTXzok=; b=nbytcHBkBqtHu+e4sICmsWJ27694mSRf5ROYadt9DcSzQgM1/Mgll9w1429MQGlMsTTlJ2 iR0CTuNYdnXpgg1MfUJAwrEqKs8mi5AULYeM712LoTFJbRMJQslKS6TVb+ETFlNurk+4Tz MGlPq3FVvGYaj0bVIcq6xtJsb8tz/4oH9huLJCXd4wiq88x2izfc6M07xw4PiaFeHuvkvZ ky2Vxf/1saCfouSn0yywa9Hu5XViLx6gJMMTMh3kon90CprIdFfK4hw97PV4yqXj94RTPi 7buOvPpIl7XgzfP03L8sUFpLzDP/nNMa//1iwzgo1X6Fg8dJiHDlrZPMG14Wjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737575907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=McfUsPJsLpYBQKi4myEfqQ1sRv6eOWyMRce2ZRTXzok=; b=rzJdLZT4sH3DYqnfwsGpfxow9ZlubVhRxmYbAGwik8Q9kXLYIHFmPQRI7Hfwz3l+16dn8L 2C6TzDgU+j9Jig1iJu87i8sVbADQeDnKsHv7WH/HstUsQfKX+HzDRdGzJo1jQUsxl3l6YV ti7W1ZUWxYDxr9nLKQRcYQGZe2pL68aj4g7JYSAwYZfbjMOSndsC9B7Yq6Z3Dt/3IQX61y EkD8nfIE/fFPsdzkfKL7F1pEjoQObI/n0jKtSvB34ZotpgtlZI827SE5rh9db14UCaaTGi 1F3R+EDhUFCRmmkvTGKCT62yZ0vv85rj2WuYB/qQMCVs3e/9RYlqFsl4mO/VIA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737575907; a=rsa-sha256; cv=none; b=G1xra2iylhMZOD86CYWZI3Pq+70bJvi8Ov6MTRlBZIGpQqpzL8wI92m5/Ctw/76kzUwql8 3UIZ2nccwzM2o5YTlxdRmbGhz4YN9eUuUXZLiIqz/Ba/lvV3xaULJzqozEyioVGmEMCvtU /GRwEOsuHfQU4YaLXaSksJim7qrObgyxEXFjK/CTxq29EED2X+Md/IbkQ6/7w3zptJ1q5J ZxzrefblwaHUyssyvjk+/onCwqak9rDActf2HYCn23XYCZ71MsdwsEABtPoHj0sLY5h0T+ gxJsqb25aNn5kyM/3db02YsbvBknI6wT5chOg+HXRm9oAVdNZSw0GLx/eXLgVg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YdZdH5mTkz15W0; Wed, 22 Jan 2025 19:58: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 50MJwRck002082; Wed, 22 Jan 2025 19:58:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50MJwRHi002079; Wed, 22 Jan 2025 19:58:27 GMT (envelope-from git) Date: Wed, 22 Jan 2025 19:58:27 GMT Message-Id: <202501221958.50MJwRHi002079@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 237e9b7f5e90 - main - ctld: Trim trailing whitespace 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 237e9b7f5e90debb31ae7fd1e0a288e302659bfd Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=237e9b7f5e90debb31ae7fd1e0a288e302659bfd commit 237e9b7f5e90debb31ae7fd1e0a288e302659bfd Author: John Baldwin AuthorDate: 2025-01-18 17:19:41 +0000 Commit: John Baldwin CommitDate: 2025-01-22 19:57:46 +0000 ctld: Trim trailing whitespace Sponsored by: Chelsio Communications --- usr.sbin/ctld/ctld.c | 6 +++--- usr.sbin/ctld/parse.y | 2 +- usr.sbin/ctld/uclparse.c | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index 497e0f6e7600..3136a5d4b7cb 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -945,7 +945,7 @@ isns_register(struct isns *isns, struct isns *oldisns) error = gethostname(hostname, sizeof(hostname)); if (error != 0) log_err(1, "gethostname"); - + if (oldisns == NULL || TAILQ_EMPTY(&oldisns->i_conf->conf_targets)) oldisns = isns; isns_do_deregister(oldisns, s, hostname); @@ -973,7 +973,7 @@ isns_check(struct isns *isns) error = gethostname(hostname, sizeof(hostname)); if (error != 0) log_err(1, "gethostname"); - + res = isns_do_check(isns, s, hostname); if (res < 0) { isns_do_deregister(isns, s, hostname); @@ -1000,7 +1000,7 @@ isns_deregister(struct isns *isns) error = gethostname(hostname, sizeof(hostname)); if (error != 0) log_err(1, "gethostname"); - + isns_do_deregister(isns, s, hostname); close(s); set_timeout(0, false); diff --git a/usr.sbin/ctld/parse.y b/usr.sbin/ctld/parse.y index d8274b623d3a..128a5b4ea042 100644 --- a/usr.sbin/ctld/parse.y +++ b/usr.sbin/ctld/parse.y @@ -115,7 +115,7 @@ debug: DEBUG STR free($2); return (1); } - + conf->conf_debug = tmp; } ; diff --git a/usr.sbin/ctld/uclparse.c b/usr.sbin/ctld/uclparse.c index e9e42bdf953e..b93142ede8a4 100644 --- a/usr.sbin/ctld/uclparse.c +++ b/usr.sbin/ctld/uclparse.c @@ -111,7 +111,7 @@ uclparse_chap_mutual(struct auth_group *auth_group, const ucl_object_t *obj) log_warnx("chap-mutual section in auth-group \"%s\" is missing " "\"mutual-user\" string key", auth_group->ag_name); return (1); - } + } mutual_secret = ucl_object_find_key(obj, "mutual-secret"); if (!secret || secret->type != UCL_STRING) { @@ -317,7 +317,7 @@ uclparse_toplevel(const ucl_object_t *top) log_warnx("\"isns-period\" property value is not integer"); return (1); } - } + } if (!strcmp(key, "isns-timeout")) { if (obj->type == UCL_INT) @@ -462,7 +462,7 @@ uclparse_auth_group(const char *name, const ucl_object_t *top) it2 = NULL; while ((tmp = ucl_iterate_object(obj, &it2, true))) { const char *value = ucl_object_tostring(tmp); - + an = auth_name_new(auth_group, value); if (an == NULL) return (1); @@ -547,7 +547,7 @@ uclparse_portal_group(const char *name, const ucl_object_t *top) while ((tmp = ucl_iterate_object(obj, &it2, true))) { if (portal_group_add_listen( - portal_group, + portal_group, ucl_object_tostring(tmp), false) != 0) return (1); @@ -757,7 +757,7 @@ uclparse_target(const char *name, const ucl_object_t *top) target->t_auth_group = auth_group_new(conf, NULL); if (target->t_auth_group == NULL) return (1); - + target->t_auth_group->ag_target = target; } error = auth_group_set_type(target->t_auth_group, @@ -982,7 +982,7 @@ uclparse_conf(struct conf *newconf, const char *path) { struct ucl_parser *parser; ucl_object_t *top; - int error; + int error; conf = newconf; parser = ucl_parser_new(0); From nobody Wed Jan 22 21:30:04 2025 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 4Ydcg03mypz5l4y3; Wed, 22 Jan 2025 21:30: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 4Ydcg038Vnz3PcD; Wed, 22 Jan 2025 21:30:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737581404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m7SLI3WXJYZMO5YsOZtHqtCnNmvKDzwo1l1JuboW51M=; b=k1x6r1EaZsd0njuxHPNEFRRgandA/bMloavOa0XYyU1MVY5+t8BOQQVvtgwfiIsIZPP8qE uVKfs3BeVa9Oql3ZhhfStLfbUcLRNMz6TGjDcfmDaAZR4Bv3HfdBbeeNxflwh+tH35Rgrm q+TEbxXez1Y8KEWpT4YiNmr/cnvi+YmTd6epIy8aVThhh1fGMWZc/6b3wPrnNZTj3n+wWV xhl4e5LsTmdPFoTM15EHxNLa5xLumdgvXNf5EV6J4EZMvfPBl3pjLgafvlgbgm10sLPytj fziSxe8Spt8WzPMxMzo8ppy38aZNnvJ/E+19CFLc7Q45e43cGNid7p3uGC7aOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737581404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m7SLI3WXJYZMO5YsOZtHqtCnNmvKDzwo1l1JuboW51M=; b=ByE7k8GcH79NisdlVzQFMxWWp9yJJPuRjlVK0WDv2QX5cX5/Yy0GoyJyjcilGB5kU1TZIE 3JQMrtKrgw8fIbmo71UHoAjklWbyVTtuGOoqOt8ezCQtIy1paqxkjnlYLyN2fjrnWjYUOB b5iBImjye2D2b4aMPRQ9XUWmohkP3sqOKMUGKs1XJl3ewEk50Z2nMYwZ5iTBqfvdBPXyxZ iyjgqKYHAY8ReqSD4agVzPwB/q3nbVdDarmVu52J9nFLo/P/zuDckgkHEopDigg6fdr071 So91RlGe9xAXY1g/83yzJi3EwgOS+wZ+WHOTStpa47yf01dyDq5Aw5G3mC5ZJg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737581404; a=rsa-sha256; cv=none; b=FmNncUC5umhqeXcC24ctrk4thEpWdUyMbRlXc52bHzzUZaTcYF/C6991HTPhqlL8kqa/dk CfGvwhD0R31wO7RKbZGeltrG2jviNcv8Cx2KuS6hwGfJtA8chFtQKKmQK43wWAO3dN7+8t HKjtEIPAb769owEfcqwniBQn2d/oONz1vE+ihLFYQo+HmR2VA85LojpGKiHuHUj10kZ9BR FCoEo6eCDZkepeINzTFdaY3DAvyhYdbtRud+jVPd3m2bhzygtGEApIaGi37rc/1lKZuov+ s6avkkzNUoNpAI4r/06yCLuJ2693pmO8jTnxmWILMOm5orqhsMx4VLihGCqKNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ydcg02V6Dz182g; Wed, 22 Jan 2025 21:30: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 50MLU4nu074705; Wed, 22 Jan 2025 21:30:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50MLU4n7074700; Wed, 22 Jan 2025 21:30:04 GMT (envelope-from git) Date: Wed, 22 Jan 2025 21:30:04 GMT Message-Id: <202501222130.50MLU4n7074700@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: 1e734f15c709 - main - dtrace: Build systrace_freebsd32 only if COMPAT_FREEBSD32 is configured 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: 1e734f15c7099408f45d3b1ea433868d0468916f Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1e734f15c7099408f45d3b1ea433868d0468916f commit 1e734f15c7099408f45d3b1ea433868d0468916f Author: Mark Johnston AuthorDate: 2025-01-22 21:26:07 +0000 Commit: Mark Johnston CommitDate: 2025-01-22 21:26:07 +0000 dtrace: Build systrace_freebsd32 only if COMPAT_FREEBSD32 is configured MFC after: 1 week Sponsored by: Innovate UK --- sys/modules/dtrace/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/modules/dtrace/Makefile b/sys/modules/dtrace/Makefile index 9a67f517fc5c..3a3769b8b4b5 100644 --- a/sys/modules/dtrace/Makefile +++ b/sys/modules/dtrace/Makefile @@ -27,8 +27,10 @@ SUBDIR+= fasttrap .if ${MACHINE_CPUARCH} == "amd64" || \ ${MACHINE_CPUARCH} == "aarch64" || \ ${MACHINE_ARCH} == "powerpc64" +.if !empty(COMPAT_FREEBSD32_ENABLED) SUBDIR+= systrace_freebsd32 .endif +.endif .if ${MACHINE_CPUARCH} != "powerpc" || ${MACHINE_ARCH} == "powerpc64" SUBDIR+= sdt .endif From nobody Wed Jan 22 21:47:13 2025 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 4Ydd2p03Bcz5l6h9; Wed, 22 Jan 2025 21: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 4Ydd2n6NsPz3Rs5; Wed, 22 Jan 2025 21:47:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737582433; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I7ECSpQEF5zpNdvTCnW9hFsVTELux5whSC+jdxjsacs=; b=NfkiSEhmjHjTdw1kJP4piaLOIC5JfBT51sZj/RDsSBuHodww+fc8uNH+s7A8t3NnTwm0t3 r7rYgWu2GXTWiPCgPneTzqV9lU3a4E4CJZKKGOEz4ZETe1g2h1oUrEU1wZh27aoWPOmT/q SGoI4T716i04h1Xx++Nexv+yXjgwdVNJkeAcQzBJb5znUaS9OPEiEgdzwmGTdbsGX0LP5t UhoHp3uEAuYm8B7jvjBBNj+sBaKluhACi6jOy75sOW3uAPiwkAzFv7uXPVVTnQd8a1I8xB T/2RsQZ06A/c/jkQ9T70xOOaWlF/7woDx7KaznXejtXStTIBqiqJk7/716CHAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737582433; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I7ECSpQEF5zpNdvTCnW9hFsVTELux5whSC+jdxjsacs=; b=cN1z0DbklP+FWysb5gEF8wC0ZTsCL4BoF6HqaWMR4bxs+Vp8V39T9lmrWHNJiOu2pcgoEa zWoALKPcKrCXJ00C5//0dKs1Y+HePlvl2td2ooUKUK98523JFhbdIkcj/X6HJLqnLnIWGR ER0Dzc3TLVpOfhbDKq7ldkUr/ccgTz0dFksDkRM58BtCchjH2PDu0qOm41qp1qnfqLY4+j mM8Y6UA1iPqb1JB67+VCjyjd9PNVCPVCztGr+4bIwV+HFPfZ91mTFDu8RrI9ohK2ixB3Wy vizaFE3mFK9DD8YQNIuzJSMHGruMSCetheodTtmyIpfp0yLcDGlI3F5gzrI2jQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737582433; a=rsa-sha256; cv=none; b=A2ReGi7LFcrQ4svbldoDejlV6Icc+fF5r4rj5t67a2O77GmSB1kqbp9Be/WyL9c2EWxK3U xJ3zoohq06aGylZ7NMxVVhcZDgxT1r57MaVLbqLt1iAxTsLyWI/f8zZg+4MunRJUOzMjUg XqMB/rvU7fcVjgBNYeO0AmZzSbPRLyo5O6KhBXgnCL94coACK7PE2zxrVQgPwWcIZrj30R D7HAPjfc5fGZwewLPo6xScKfCbYRATtYRAd8AlUI+iCQkRpUdpn60bLjyEB5AuPJCUzoAt GgRvJPArFQ69i7TL4tMk/KP+bSjY1JEJ1S/RlEDmhDNUke/aDgR0Dt1V1ZdTPQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ydd2n5xS3z17yy; Wed, 22 Jan 2025 21:47: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 50MLlDfe009044; Wed, 22 Jan 2025 21:47:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50MLlDkL009041; Wed, 22 Jan 2025 21:47:13 GMT (envelope-from git) Date: Wed, 22 Jan 2025 21:47:13 GMT Message-Id: <202501222147.50MLlDkL009041@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 40fc36ff2c1d - main - rtwn: fix RTL8192EU power-down / power-up hanging 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40fc36ff2c1d14f8ea7237e8f9487ab2f25de86b Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=40fc36ff2c1d14f8ea7237e8f9487ab2f25de86b commit 40fc36ff2c1d14f8ea7237e8f9487ab2f25de86b Author: Adrian Chadd AuthorDate: 2025-01-11 14:55:28 +0000 Commit: Adrian Chadd CommitDate: 2025-01-22 21:46:57 +0000 rtwn: fix RTL8192EU power-down / power-up hanging The RTL8192EU NIC (on older USB 2/USB 3 ports, not on newer USB 3 ports, that still needs to be fixed!) will attach, scan, associate fine. However, restarting wpa_supplicant results in the NIC hanging until you disconnect it. It turns out early in the power_on sequence - BUT only after a power_off - the NIC would suddenly stop responding to any USB transfers. It doesn't require the MCU to be available for USB transfers - the hardware itself does that - so something had to be going very sideways. I traced it down to these steps during the power_off sequence. They don't exist in the Linux rtl8xxxu driver, and there are commits earlier in their RTL8192EU bring-up that suggest the author was facing similar power sequencing / re-sequencing issues. This likely won't fix the actual channel programming / power sequencing / deafness issues on later USB-3 ports. There are other commits / fixes in the rtl8xxxu driver related to RTL8192EU bring-up that we don't have. Differential Revision: https://reviews.freebsd.org/D48428 Obtained from: Linux rtl8xxxu driver --- sys/dev/rtwn/rtl8192e/r92e_init.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/rtwn/rtl8192e/r92e_init.c b/sys/dev/rtwn/rtl8192e/r92e_init.c index 925221bdabb1..077c64626f8c 100644 --- a/sys/dev/rtwn/rtl8192e/r92e_init.c +++ b/sys/dev/rtwn/rtl8192e/r92e_init.c @@ -368,6 +368,7 @@ r92e_power_off(struct rtwn_softc *sc) return; } +#if 0 /* SOP option to disable BG/MB. */ rtwn_setbits_1_shift(sc, R92C_APS_FSMCO, 0xff, R92C_APS_FSMCO_SOP_RCK, 3); @@ -377,12 +378,15 @@ r92e_power_off(struct rtwn_softc *sc) /* Disable small LDO. */ rtwn_setbits_1(sc, R92C_SPS0_CTRL, 0x1, 0); +#endif /* Enable WL suspend. */ rtwn_setbits_1_shift(sc, R92C_APS_FSMCO, R92C_APS_FSMCO_AFSM_PCIE, R92C_APS_FSMCO_AFSM_HSUS, 1); +#if 0 /* Enable SW LPS. */ rtwn_setbits_1_shift(sc, R92C_APS_FSMCO, 0, R92C_APS_FSMCO_APFM_RSM, 1); +#endif } From nobody Wed Jan 22 21:47:14 2025 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 4Ydd2q0WShz5l6c6; Wed, 22 Jan 2025 21:47: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 4Ydd2p734bz3RY1; Wed, 22 Jan 2025 21: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=1737582435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TK0pwdqMeILTqMAAxMm1YLC9//nDDkiTm7rpk4GuVv4=; b=vhm9j6TINPDsm+H0zvedoyktdTMlmzGsyV6eC/yeq4wdXDxwhZ86TkPZxe4Fbz6iLEL+lx jaKjgiiW51IVgYEK/DO70pOYwE5NQS+aLlvx7rlPS+Vu1Z5xCFZ4ZDSxL5a6ElaLNVmsUk a2VfXpi9FtaYf/7yd0k/fCTOAWiM58CHLp1jVARiXBBEML71Ku6Ux4K6Qehck0zz66rwXK Y8MlQqru4yupvUK8byjC9Dcj/zFD7g5Ih0kx8orN7hMYpxjTDJMtTttUrhJblVSBvAAmMI OsKPfHCeubqCkcZqS8LAXDagcOoDsQJUKdPCbYFzSdh7G5UoJ52DhHNx+jmJOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737582435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TK0pwdqMeILTqMAAxMm1YLC9//nDDkiTm7rpk4GuVv4=; b=tD7Ss5t5b1J3zQfYvFZ0J7lESvppwfhhWIJE9093cKluwrQAmeLzi0Ljp4MLzPD+HDn3F8 Wv6ZzyF/EBf4dY7aGHWkv3jsYEf8WsfpwwIfPM1ihxBUgcKIp7L4jWqjzfNjlSKV/OR7dy jwDkoDNwnGqTr8DW2aPn5sPR9ob9mryv1Cpu+spggdEqsU00NpiWaq9grp8gK00TaXP2sn YcnuLHAY8XdEO7NQM20aeGO5f8H7Q21LcezSGR8nCLKkra3nY5hWFTVmblrTmGQS9KFqA1 5SOrerx9AJ53MqW8M7A00EMZ5Zb8HYlhO11Jlfq+ooxvwmb7su02+I3DO9fSKg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737582435; a=rsa-sha256; cv=none; b=wcdVzdK/M5NukCJG9AdSXio877YbRmCV7zFWU/3EmPf/ehJWpTcXa8/vCu5troYvccsKPx 4wT8m9/ntjh8/ArKiIrTllHzO9eTR/9JyxQRhmLPUCaOFxkHQkCvEsP9yUMfKFosXAnZTW RmyPRkbH4dc63/9lqjkTq5uChg4qHf9DHYlHLxyBDEu4PEOC7tIO+THGwLo18yVzJ43ogo Xa564bSnQnNb0dHPFuXiqJ5u/ScO51q5CNIekjIkqgw+J8+JgRunkbcokvoZ3Ed6C2xf5M 26/SvT5F3i+NpNd2bNDIB+j9AhXQGPQJK4dGVNt8uSvZdHRxpOIeWd6PurWWQw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ydd2p6Ywqz18Xg; Wed, 22 Jan 2025 21: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 50MLlEXx009076; Wed, 22 Jan 2025 21: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 50MLlE27009073; Wed, 22 Jan 2025 21:47:14 GMT (envelope-from git) Date: Wed, 22 Jan 2025 21:47:14 GMT Message-Id: <202501222147.50MLlE27009073@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 5f9a2eec337c - main - rtwn: bring the RTL8192EU RF read/write routines in line with rtl8xxxu 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5f9a2eec337c9cfdbfa800aff8875f5424e847e8 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=5f9a2eec337c9cfdbfa800aff8875f5424e847e8 commit 5f9a2eec337c9cfdbfa800aff8875f5424e847e8 Author: Adrian Chadd AuthorDate: 2025-01-19 01:08:32 +0000 Commit: Adrian Chadd CommitDate: 2025-01-22 21:46:57 +0000 rtwn: bring the RTL8192EU RF read/write routines in line with rtl8xxxu The Linux rtl8xxxu driver has more delays in the RF read and write path. It looks like for writes it's ensuring the hardware is out of power save and that the transition has properly occured. And it looks for reads that it wants a delay after some bit setting, likely some shifting into the RF register space is occuring with a bit set/clear to trigger a load. See rtl8xxxu_write_rfreg() and rtl8xxxu_read_rfreg() for more information. Differential Revision: https://reviews.freebsd.org/D48512 Obtained from: Linux rtl8xxxu --- sys/dev/rtwn/rtl8192e/r92e_rf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/rtwn/rtl8192e/r92e_rf.c b/sys/dev/rtwn/rtl8192e/r92e_rf.c index 8e05a827262b..478945d13c85 100644 --- a/sys/dev/rtwn/rtl8192e/r92e_rf.c +++ b/sys/dev/rtwn/rtl8192e/r92e_rf.c @@ -64,7 +64,9 @@ r92e_rf_read(struct rtwn_softc *sc, int chain, uint8_t addr) RW(val, R92C_HSSI_PARAM2_READ_ADDR, addr) & ~R92C_HSSI_PARAM2_READ_EDGE); + rtwn_delay(sc, 10); rtwn_bb_setbits(sc, R92C_HSSI_PARAM2(0), R92C_HSSI_PARAM2_READ_EDGE, 0); + rtwn_delay(sc, 100); rtwn_bb_setbits(sc, R92C_HSSI_PARAM2(0), 0, R92C_HSSI_PARAM2_READ_EDGE); rtwn_delay(sc, 20); @@ -82,5 +84,6 @@ r92e_rf_write(struct rtwn_softc *sc, int chain, uint8_t addr, uint32_t val) rtwn_bb_setbits(sc, 0x818, 0x20000, 0); rtwn_bb_write(sc, R92C_LSSI_PARAM(chain), SM(R88E_LSSI_PARAM_ADDR, addr) | SM(R92C_LSSI_PARAM_DATA, val)); + rtwn_delay(sc, 1); rtwn_bb_setbits(sc, 0x818, 0, 0x20000); } From nobody Wed Jan 22 21:47:15 2025 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 4Ydd2r33ssz5l6L7; Wed, 22 Jan 2025 21:47: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 4Ydd2r12wpz3Rs9; Wed, 22 Jan 2025 21:47:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737582436; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Y+eyoehiscLNblr88X601EZ95lLrWbaQXQx07ljs3Zo=; b=f71Bjtmj2T5Yjf8+MUq1/6E4WXNXYGygY7jXjTlHRUS5ACsvgWz21R4wpCiz6bJKDIUD6M 6gT7O/vEGPQ5BKvV7T6i4JWwdyJ8sbpfOnAnNvw56DhM+Bcm3KFFHY56yaKLTqq/tEMQAF NQMtSVr23iAQwgGpCRcxuDIxz+tot3OLFBVrdAaQCH1UMktdf90zCLa6zKNG7CTrtQsu8o 0ZMQL6KbDo+zh0vcpgiPm8YHAKy/9bIohspi5gl7inKKupI5QXcS1zmGjDB4aN8INcp/Ul yarIF6XcxabT5AWt4jyBlK3rFnZEG6+wh+e9j5x+BAZiF5ITDoxOHHVuoAy8+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737582436; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Y+eyoehiscLNblr88X601EZ95lLrWbaQXQx07ljs3Zo=; b=QWoBp5PI9p9mCFZGi+mhDTuSDqkajiN0SsdrZYKX3fQaWxx9wW0UPGPPc1YbAzmYZlqC5w HibAEznAmcBiiKslObipjd4j05Sjn+Lat3STPQ+U5sm63VP9jdv/XnvnFjeO8s2mnefsfc iJlTGESw73ie8tX35+YIeNFus7nnpcD10VAEjbDMhy85bwmCQCvHiI2JBGxfsfGORm0SBi U1Tp8kIYBueRa3Q0Vdq1aMfr6mW6r4iDRHt0mtvkQp64NNcYoVcShIzP/tBh6Ie0zaeUR3 iJFnBg5bs2Rm8CCR4otfuczY632HSXgjobA/dFKuUj7yvDaVQKwibHbaQyo/EA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737582436; a=rsa-sha256; cv=none; b=LUwbVjXobuAOe367etSn117hjQvDbyxWSX8JJrh90xhrMdaaWVJC19E66RuwUhAHvIKpY3 FAzF7U8yV67vWaoQB8gqmomSC36LbBFfh8CC3/WEYecpPspWtg7SFtPG2zB5/0CnL30aGy vw1AqZqBT+nM/56/FxWwLCu/GFBy7SS2y5l6jGxDJiG4A2/jw1jwxQaUpxp+iqH9gm+MUH P4b+Gi9POQ9nmA0ZcpmBR4vlAR58ce/wg3liEbAkfGl1LetwPhkOh98o9x0m82GVQZBT+d 1wiiID0FFnKpMGiOIITwyklbfGOCf5Dq4TU1bK/lRQv2JcxcFHWBC0a+WV9X7Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ydd2r0NnTz18lV; Wed, 22 Jan 2025 21:47: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 50MLlFIM009108; Wed, 22 Jan 2025 21:47:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50MLlFNa009105; Wed, 22 Jan 2025 21:47:15 GMT (envelope-from git) Date: Wed, 22 Jan 2025 21:47:15 GMT Message-Id: <202501222147.50MLlFNa009105@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 043d6a24b290 - main - rtwn: add workaround sleep in r92e_set_chan() 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 043d6a24b29030989fdf2b79c5ff90391f859225 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=043d6a24b29030989fdf2b79c5ff90391f859225 commit 043d6a24b29030989fdf2b79c5ff90391f859225 Author: Adrian Chadd AuthorDate: 2025-01-19 20:16:55 +0000 Commit: Adrian Chadd CommitDate: 2025-01-22 21:46:57 +0000 rtwn: add workaround sleep in r92e_set_chan() It /looks/ like there's some weirdness in initial frame send after the chip programming / channel change. Linux rtl8xxxu has no sleeps here, instead it just retries the auth frame a few times. My guess is there's some sequencing going on here between finishing the programming, doing a calibration run and then sending the initial frame. Instead of doing sleeps on every write during the RF channel change, this 10ms sleep at the end is enough to reliably associate in my test environment (12-core intel laptop, USB-3 port.) It's not required for an earlier 2-core haswell laptop w/ USB-3. See the PR for more information. PR: kern/247528 Differential Revision: https://reviews.freebsd.org/D48517 --- sys/dev/rtwn/rtl8192e/r92e_chan.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/sys/dev/rtwn/rtl8192e/r92e_chan.c b/sys/dev/rtwn/rtl8192e/r92e_chan.c index 4c7121a80c89..4cf17433d257 100644 --- a/sys/dev/rtwn/rtl8192e/r92e_chan.c +++ b/sys/dev/rtwn/rtl8192e/r92e_chan.c @@ -252,4 +252,28 @@ r92e_set_chan(struct rtwn_softc *sc, struct ieee80211_channel *c) /* Set Tx power for this new channel. */ r92e_set_txpower(sc, c); + + /* + * Work around some timing issues with RTL8192EU on faster + * CPUs / USB-3 ports by sleeping for 10ms. + * + * Without this delay the initial frame send during authentication + * doesn't occur. + * + * My (adrian) guess is that there's a race condition between + * everything being programmed into the hardware and the first + * send. Notably, TXPAUSE isn't 0x0 after rf init, + * which the rtl8xxxu driver has a commit to address (c6015bf3ff1ff) + * - wifi: rtl8xxxu: fixing transmission failure for rtl8192eu + * + * Although it's hard to do due to locking constraints, reading + * TXPAUSE during scan / association shows it's non-zero, which + * needs to be looked at in more depth. + * + * Linux doesn't have a delay here, however it does try multiple + * times to send an authentication frame. + * + * See PR/247528 for more info. + */ + rtwn_delay(sc, 10000); } From nobody Thu Jan 23 03:12:52 2025 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 4YdmGX2w1Dz5lVhd; Thu, 23 Jan 2025 03:12: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 4YdmGX1mq1z45lB; Thu, 23 Jan 2025 03:12:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737601972; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2gLejA5rLogLpmI7G/XuuUqKQe+rNfb9zDx9fL5t7r4=; b=eZrGgVwxo9vi81a9aqXXjShi7V8xFJjHu1N8WVCJF9jBnKO4VZZpm4dAH1TlxttorlRCwo YYqccD9avFWJCHzvnxVNlWB+2uFLrbKgD/hYqBM/97j1LXldHgDS3L8vzhI3iXJy7szSD8 PUnBHdIieLwUPH1wZ81fDwTg1I/OiwF85BSXhuxWUXEAOgHtZIXcg+NyJWhvdLYX8ai70x jgi6YrVwgAJ13/4R/TY+0jDtbjvjDe3n/ZlDw0NJGAkrk/6fRnrKjO5wYkBEFAoV+cyADA rjN8twshHITuYDAh480ayID9sjeNaYP6mY7I/Fk+VcDWirHf8NjIWfd9QB3ZZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737601972; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2gLejA5rLogLpmI7G/XuuUqKQe+rNfb9zDx9fL5t7r4=; b=OCdY0dwTGzdxXKcqmr9AkcD562CQoWwGvvBldJwOrOLxiEj2/RRzrtxr8s79GWmbUo9Yd0 +70BkyVg5mtgE320RRknDA/01aXHCLBhH6diGVdgnxn6GJJwXkO239lkjl4l8gsD9EA0vg hQgRcYbYX+kkXe+z9W542iPE7TVq5LKOK9qh+aFgAwpPZp/uYlnXgMHsCoFodmCvnws23q 8b8ABJXBRQ2zISpphvdzO8zPQdP0a9yQqEi7p8EL8ORabFnUWyqiOqTd6lruh49CVDjQsN q91otbf9C/PoVDK5seHYQ/BX8Dg9pA2kHWuSRSlu1+toDZxPY2iOf2jceqs3mw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737601972; a=rsa-sha256; cv=none; b=yhxZ7gpOYKsz2Uel8vzxWTPJ6BejuYF7SXmqHOeLzImyq0iHv0pvBpNCUnwr3Kddb4KbvR QWVFTWxH0E7MPvFHs7ByX5XIUk6mf+zLPmtaOpuNkPTtMMwH8KVs7Dpo6CeH0wNXSWnqZ6 Bu62RNuwvNxBWG7+Ra1ypDQNrbs2zjXgWa8OEOO+c0BqzNINPphIgMzhEUQWNFCD8A+cVY zzj5pWR2bjpRB1CtDmzl7nAvSiocrxcTXCskwYqfIaQvOXdyS/ORT6DolBkj/7f7/ZOx2A 6b5Q/GoxZUdlXeQ1JsyLqbzep3n6C65mBY2wU7QWcoYinidcrSCwBx2myPyrXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YdmGX1C0Nz5NX; Thu, 23 Jan 2025 03:12: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 50N3CqPW025247; Thu, 23 Jan 2025 03:12:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50N3CqB2025244; Thu, 23 Jan 2025 03:12:52 GMT (envelope-from git) Date: Thu, 23 Jan 2025 03:12:52 GMT Message-Id: <202501230312.50N3CqB2025244@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Simon J. Gerraty" Subject: git: f486ebb5e36b - main - libsecureboot/README.rst clarify use of gpg 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: sjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f486ebb5e36b0dada882cfa1592cee110da2afb2 Auto-Submitted: auto-generated The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f486ebb5e36b0dada882cfa1592cee110da2afb2 commit f486ebb5e36b0dada882cfa1592cee110da2afb2 Author: Simon J. Gerraty AuthorDate: 2025-01-23 03:10:10 +0000 Commit: Simon J. Gerraty CommitDate: 2025-01-23 03:10:10 +0000 libsecureboot/README.rst clarify use of gpg Clarify some language and provide an example of gpg use to generate a detached signature. --- lib/libsecureboot/README.rst | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/libsecureboot/README.rst b/lib/libsecureboot/README.rst index 85b949db58cc..f1d3c5679d35 100644 --- a/lib/libsecureboot/README.rst +++ b/lib/libsecureboot/README.rst @@ -1,7 +1,8 @@ libsecureboot ************* -This library depends one way or another on verifying digital signatures. +This library depends one way or another on verifying detached digital +signatures. To do that, the necessary trust anchors need to be available. The simplest (and most attractive for an embedded system) is to @@ -16,7 +17,7 @@ provide access to the necessary trust anchors. That signing server is freely available - see http://www.crufty.net/sjg/docs/signing-server.htm -X.509 certificates chains offer a lot of flexibility over time and are +X.509 certificate chains offer a lot of flexibility over time and are a great solution for an embedded vendor like Juniper or even FreeBSD.org, but are probably overkill for personal or small site use. @@ -74,8 +75,12 @@ header. Signatures ---------- -We expect ascii armored (``.asc``) detached signatures. -Eg. signature for ``manifest`` would be in ``manifest.asc`` +We expect ascii armored (``.asc``) detached signatures +Eg.:: + + gpg -a --detach-sign manifest + +should produce the expected signature in ``manifest.asc`` We only support version 4 signatures using RSA (the default for ``gpg``). @@ -108,6 +113,10 @@ Ie. client sends a hash which during signing gets hashed again. So for Junos we define VE_ECDSA_HASH_AGAIN which causes ``verify_ec`` to hash again. +Later I added a FakeHash class to the signing server so we could +generate signatures compatible with our previous RSA scheme and +others. + Otherwise our EC DSA and RSA signatures are the default used by OpenSSL - an original design goal was that a customer could verify our signatures using nothing but an ``openssl`` binary. From nobody Thu Jan 23 07:26:26 2025 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 4Ydsv65j9fz5lmGB; Thu, 23 Jan 2025 07:26:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ydsv64jr9z3WTY; Thu, 23 Jan 2025 07:26:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737617186; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=G89szDB2sKXjcIWx4W6qbYKsZf9mj5JQeDR3YMmP6sQ=; b=vQANES/EZY3TZMFJxkxjTc3xMEl267vejT+s3yI/dYbgL5pV907qdyJtz8mfridxSFy57A e2NNWk7lvQf1l3t8A89ZUXDdGFahMqdqoX5afE+Pk9l4UUoXFkeCaeWtv+vRpUQwnlVkv7 B5MQ5ffv7MD5rsY8h+SsSIkTyiDsCqSa8PLOUuvoN0JVW81Q2ZBJ5I5MxokJW0HSO7cj69 gy4iSoaIzBQaTqMWZvxgQGSbxn3BfE81fyMtzKH9J5brhydY8Vy5goTn3dzPW8YaN6aixQ IGjqUE5p2fOxWmngV44KgMI1kvaRv4b2FfArh3UCzMkQoopzqe53HvmJ4X6H8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737617186; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=G89szDB2sKXjcIWx4W6qbYKsZf9mj5JQeDR3YMmP6sQ=; b=OADEfEahZtlUKsBsMGWf9dTaf3Smes72+yExm1QPX/T7vbmcCEQdkZAFvffiXcHUHCeTqW ddwrDVUnYnet7jdmb4qSLcT3sBDma25ZWN1OpvkJxLkxiPNFH7HUypdsaZUloEFvMeTws+ /ST5KMtlZMmMhSmOun6i1r6gudaChNAJEz4JDCkanuQjPzDMYtZOophjGR+BsOLDMDZaSG yF1M+cC0uDRWtPzUjRx1A4fWN1Qrp9tKH4WzCv3i59Tlta+Ie9GmLmegaakEOiXQecfrnJ c3nWwU0HrDh+s1Bi5UrC1ziQ8NzCniHqjgKqqBgWS4VRNorRTZHf/2qpBPz6Ow== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737617186; a=rsa-sha256; cv=none; b=FtrpvTV+N7iFPYdJBUzU3R/8U3YZ7/l2OsOZNPdPayEy2n4OFN2Yc4g5Ccze8N0upHuM/E 9MG9Eex6n+4fjIvKQpM9mBnlHeq8T30y40UZM0xuobhdFXtbOcFmUylT5t2anKwCfvrNJy uc7KdQx+knKgRHwNFCZTSf0LlEYxx2GCVxHRAMJjelFxcZrYRQJgOpjubmRcoot6eIGCS5 /BT83uws37siCBVJna/ipoWMEKnlGbmDjYKSrcosnfgCmbP4xw6dxku2qJdEwW6I9+hFVL r/nQB/kDZyDfGLYU3XwlB9bP+geKh8/3oIQcOrh5AnOGZmmBnXDUgPaQi6RIMQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ydsv64HXCzCvY; Thu, 23 Jan 2025 07:26: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 50N7QQ0P095176; Thu, 23 Jan 2025 07:26:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50N7QQnw095172; Thu, 23 Jan 2025 07:26:26 GMT (envelope-from git) Date: Thu, 23 Jan 2025 07:26:26 GMT Message-Id: <202501230726.50N7QQnw095172@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 0ee3e29e1d9e - main - sysctl: Fix usage() and SYNOPSIS section of man page 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0ee3e29e1d9ee3ed22441c0d580d2d1e57a1d9e3 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=0ee3e29e1d9ee3ed22441c0d580d2d1e57a1d9e3 commit 0ee3e29e1d9ee3ed22441c0d580d2d1e57a1d9e3 Author: Zhenlei Huang AuthorDate: 2025-01-23 07:24:15 +0000 Commit: Zhenlei Huang CommitDate: 2025-01-23 07:24:15 +0000 sysctl: Fix usage() and SYNOPSIS section of man page I forgot to update the usage() and SYNOPSIS section of man page when adding the two options -J and -V. While here, fix the options sort order in SYNOPSIS section. Fixes: 5ec83c660aca sysctl: Add flags to filter jail prison and vnet variables MFC after: 1 day --- sbin/sysctl/sysctl.8 | 6 +++--- sbin/sysctl/sysctl.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8 index 792ebf6c4e9d..8cffb180ca67 100644 --- a/sbin/sysctl/sysctl.8 +++ b/sbin/sysctl/sysctl.8 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 29, 2024 +.Dd January 23, 2025 .Dt SYSCTL 8 .Os .Sh NAME @@ -36,13 +36,13 @@ .Nd get or set kernel state .Sh SYNOPSIS .Nm -.Op Fl bdeFhilNnoTtqWx +.Op Fl bdeFhiJlNnoqTtVWx .Op Fl B Ar bufsize .Op Fl f Ar filename .Ar name Ns Op = Ns Ar value Ns Op , Ns Ar value .Ar ... .Nm -.Op Fl bdeFhlNnoTtqWx +.Op Fl bdeFhJlNnoqTtVWx .Op Fl B Ar bufsize .Fl a .Sh DESCRIPTION diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 1a9cb0a13254..ef5d0508e5c3 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -121,8 +121,8 @@ usage(void) { (void)fprintf(stderr, "%s\n%s\n", - "usage: sysctl [-bdeFhilNnoqTtWx] [ -B ] [-f filename] name[=value] ...", - " sysctl [-bdeFhlNnoqTtWx] [ -B ] -a"); + "usage: sysctl [-bdeFhiJlNnoqTtVWx] [ -B ] [-f filename] name[=value] ...", + " sysctl [-bdeFhJlNnoqTtVWx] [ -B ] -a"); exit(1); } From nobody Thu Jan 23 08:01:53 2025 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 4Ydth15KmPz5lp10; Thu, 23 Jan 2025 08:01:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ydth14gp0z3fCN; Thu, 23 Jan 2025 08:01:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737619313; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PQ65zFx+BlCrtbfcmE8EWFnHAGrPonFhTCM4N/LYeTM=; b=AMDrCf12dSkiEWVkR/03BVZlTJXyQtOj+GHJ4WMImhuu7aHeGUgMan23bW67Xi/pR1LRmb 2lzOw4mhq29VeJ/OBNFniv+m46AOrCA/Q+s+3jRV6BYbbbAHQQwFRJf8g97aZcLPvQqoNH AiLCHp1hHfxBBd5nkl8NkpMln4bGbCmD59kWGM7NaAheoL1mXSHbAhLexNAXQiWCPSSKjD +9CsSe5yWpJZfMHH6zUylxOOFW2qWle/7OpbLGBLrMyBZFBB/cKi4B8PF8qHzQAU1jsurR mfjeXAZhToUpMA1P69Lvp0vMWuc3F2lz3Wj5WkaYpjls9YDvRT6oCsUeRBptAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737619313; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PQ65zFx+BlCrtbfcmE8EWFnHAGrPonFhTCM4N/LYeTM=; b=GyiEuR7OMKoHR1QTAOQJHyQFLctN8zCiI0f8PwAu4oxnArw5d7vGBzvzZMLgZMkJQA80dv VU2UFH7Is7vnyOR5esfpiWpPMqutpuga1n2PkitueYjpyZ5gGlSy4O0XQHyIVZ6NDBkk5t GUIICl9xLdbqZPcP8/53u+24osiNmmndv41RmGqJlBdfgvCCLqgmGnef53LBQnEcMXUUIz 8PYkov4riRuT92wZl5LZJmrarvPPdYd0mPcHMK5dAx8wZYQuOw/tn7FVySVUgQFk1N2EZ3 Tp3ygxGYUSHEOcX8barDoWFwgWf0VVTnPhutjKS/IP9LLnTBC5SjzitEaMgS9Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737619313; a=rsa-sha256; cv=none; b=i2EXw6q+ptR8CJ+PgJbyuAhms1RL1XrC7m4vC65q8tW/4VTWD14U1u0FqqtbiNN4lDHcbe Rbl2a8OTIa3r09w4liIWYPBHEdnPsLSgaGH9Vv6Euk6WVdXoNEZRwS3l1VlEC62gD2bfzU ku//eaQwPjUVJrZ2SXjH3CBRIOnfApGGTmZULdJqYQLF/IT35S0x1SLyTMn5dqU8csRVGP Sa46zRozAdROscr9fZ3BJRUdZDq7Kce6fWkCim8Y8gppIrria1BWYhKU5wSF1L577OQmnP 43F+14qrhqqTYUXo/XQ3pzj3XSIpPdZFeSnvIrifXWvwL5gaun7xFpQTJ/XIhA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ydth14Gl1zDW0; Thu, 23 Jan 2025 08:01: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 50N81rLp067097; Thu, 23 Jan 2025 08:01:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50N81reA067094; Thu, 23 Jan 2025 08:01:53 GMT (envelope-from git) Date: Thu, 23 Jan 2025 08:01:53 GMT Message-Id: <202501230801.50N81reA067094@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: c294ecb25b5f - main - sysctl: Sort options 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c294ecb25b5f3553b5c84b630869bb05724c9629 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=c294ecb25b5f3553b5c84b630869bb05724c9629 commit c294ecb25b5f3553b5c84b630869bb05724c9629 Author: Zhenlei Huang AuthorDate: 2025-01-23 08:01:04 +0000 Commit: Zhenlei Huang CommitDate: 2025-01-23 08:01:04 +0000 sysctl: Sort options No functional change intended. MFC after: 1 day --- sbin/sysctl/sysctl.8 | 16 ++++++++-------- sbin/sysctl/sysctl.c | 26 +++++++++++++------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8 index 8cffb180ca67..b6a06e2c3bab 100644 --- a/sbin/sysctl/sysctl.8 +++ b/sbin/sysctl/sysctl.8 @@ -68,10 +68,6 @@ opaque or excluded from listing via the flag. This option is ignored if one or more variable names are specified on the command line. -.It Fl b -Force the value of the variable(s) to be output in raw, binary format. -No names are printed and no terminating newlines are output. -This is mostly useful with a single variable. .It Fl B Ar bufsize Set the buffer size to read from the .Nm @@ -81,6 +77,10 @@ This is necessary for a .Nm that has variable length, and the probe value of 0 is a valid length, such as .Va kern.arandom . +.It Fl b +Force the value of the variable(s) to be output in raw, binary format. +No names are printed and no terminating newlines are output. +This is mostly useful with a single variable. .It Fl d Print the description of the variable instead of its value. .It Fl e @@ -94,15 +94,15 @@ This option is ignored if either or .Fl n is specified, or a variable is being set. +.It Fl F +Print the format of the variable. +This is additional information to describe the type of the variable and +most useful with struct types such as clockinfo, timeval, and loadavg. .It Fl f Ar filename Specify a file which contains a pair of name and value in each line. .Nm reads and processes the specified file first and then processes the name and value pairs in the command line argument. -.It Fl F -Print the format of the variable. -This is additional information to describe the type of the variable and -most useful with struct types such as clockinfo, timeval, and loadavg. .It Fl h Format output for human, rather than machine, readability. .It Fl i diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index ef5d0508e5c3..d3a3c64057d3 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -136,7 +136,7 @@ main(int argc, char **argv) setbuf(stdout,0); setbuf(stderr,0); - while ((ch = getopt(argc, argv, "AabB:def:FhiJlNnoqtTVwWxX")) != -1) { + while ((ch = getopt(argc, argv, "AaB:bdeFf:hiJlNnoqTtVWwXx")) != -1) { switch (ch) { case 'A': /* compatibility */ @@ -145,24 +145,24 @@ main(int argc, char **argv) case 'a': aflag = 1; break; - case 'b': - bflag = 1; - break; case 'B': Bflag = strtol(optarg, NULL, 0); break; + case 'b': + bflag = 1; + break; case 'd': dflag = 1; break; case 'e': eflag = 1; break; - case 'f': - conffile = optarg; - break; case 'F': Fflag = true; break; + case 'f': + conffile = optarg; + break; case 'h': hflag = 1; break; @@ -187,22 +187,22 @@ main(int argc, char **argv) case 'q': qflag = 1; break; - case 't': - tflag = 1; - break; case 'T': Tflag = 1; break; + case 't': + tflag = 1; + break; case 'V': Vflag = true; break; + case 'W': + Wflag = 1; + break; case 'w': /* compatibility */ /* ignored */ break; - case 'W': - Wflag = 1; - break; case 'X': /* compatibility */ aflag = xflag = 1; From nobody Thu Jan 23 12:39:08 2025 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 4Yf0qx00Zjz5kt8m; Thu, 23 Jan 2025 12:39: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 4Yf0qw6W5vz3THB; Thu, 23 Jan 2025 12:39:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737635948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fcFDUvsYdwL04dfvo+JPneBiLnLz/QNU5Whhyypa8GE=; b=YFEv0+/AZSQq8a8qAOrneARndfori8GfBUkoirKl2SHUSuATd/vZkpoVu8QyAY2inq1vsO R9v8Gua4XivgRxt2LnY6+Yu+3msYu1icvDmgQmbwSJVKFHHRMi9k1R2j2iWJ8zFqgT70v2 LfST62GMeSGyt8J2UuxaA2wlL3N44zWdrRsJDYrOQRyTxKg4it+i1XWaGmVAlfEwFrAyNt mz3A1ry/gJeVexEJKnWJC1QJI2ByN8tyPXUawgdOiA6hLGvutu95kx+bY2cd8TkX3L9Y1W xAWh86uThq/ogiD48gySBKE09A89F4NwiaEklNuSRUQXoLkguHFdYcg8uaJD5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737635948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fcFDUvsYdwL04dfvo+JPneBiLnLz/QNU5Whhyypa8GE=; b=t0wD4kfG9Mke5z0P74wo61/p74X49F865iNXn96gHcuxwA3KksAiN0WCsBe9+fLIk+WsJV cBDgA3Ok8etwoqOluR31oWzRnEVFzFrBE4FTavW2EmejpfTjA5oU9fIWUY9po7ZL9aIDKR P/Sr677/2krmx4DfE34yRum1SEl8Ko7pvg+s2uVikJr88nJHdUL+r7do4o2TSg35uFSuUL BcoF+qSQabLwYvCeyR1iUq5bxQ6V72Ljii0jrtd2l4MwLB1vXAGZ0gWMIoix/RoSZV5MAB QbesSMWNuKi+KRBIDrosDpSG7NWnQAIQSJAxk45kZquUTH/NCHUmSEu98M8pCw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737635948; a=rsa-sha256; cv=none; b=GssApfCfSrWiT9HSnqvc509sCqV8F+w9V7hKFTotbWzgRKBI4sovlqDkKYD0i5mTImD20K ruqmB9P0aiwe/AqpFidnKXjs4n0mStdDwGQGqdXZeOR/GBvt5hf/0Y+VQOAvJiv2IAeBr4 R507Z+tMxh/kQ8Fpy7POT49DDnf2jNE4dchEswODZBZU9H92GRjDKm3NoE1/cZC/5grFDm pluqy169wiCcPrwrVLLCrrFVvq5kBgKJDJ7M3aXEPBb8PpBJl376FN/Y/UYx3H2ai/W7TG KMElHwWBqVTOhboNiiXL2KETr883ML5EdyxBmVdCkT4l6IbnRIrDRij5aA7s9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf0qw62wdzflx; Thu, 23 Jan 2025 12:39: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 50NCd8Qh076958; Thu, 23 Jan 2025 12:39:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NCd8Qi076955; Thu, 23 Jan 2025 12:39:08 GMT (envelope-from git) Date: Thu, 23 Jan 2025 12:39:08 GMT Message-Id: <202501231239.50NCd8Qi076955@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: e02b579b5379 - main - sound tests: Fix 32bit calculation detection in pcm_read_write 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e02b579b537998495b06d02be6aa07f03db3a42a Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=e02b579b537998495b06d02be6aa07f03db3a42a commit e02b579b537998495b06d02be6aa07f03db3a42a Author: Florian Walpen AuthorDate: 2025-01-23 12:38:00 +0000 Commit: Christos Margiolis CommitDate: 2025-01-23 12:38:00 +0000 sound tests: Fix 32bit calculation detection in pcm_read_write Fix a mistake in the pcm_read_write test that would result in not properly detecting 32bit calculation on 32bit architectures like i386. As a consequence, the wrong values would be checked, thus failing the test. Reported by: CI Fixes: 27ef5d48c729 ("sound: Unit test the pcm sample read and write macros") MFC after: 1 week Reviewed by: christos Differential Revision: https://reviews.freebsd.org/D48617 --- tests/sys/sound/pcm_read_write.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/sys/sound/pcm_read_write.c b/tests/sys/sound/pcm_read_write.c index e40ce52b67cc..7ef310a35c25 100644 --- a/tests/sys/sound/pcm_read_write.c +++ b/tests/sys/sound/pcm_read_write.c @@ -95,8 +95,14 @@ local_normalize(intpcm_t value, int val_bits, int norm_bits) static intpcm_t local_calc_limit(intpcm_t value, int val_bits) { - /* Avoid implementation defined behavior. */ - if (sizeof(intpcm32_t) == 32 && val_bits == 32) + /* + * When intpcm32_t is defined to be 32bit, calculations for mixing and + * volume changes use 32bit integers instead of 64bit. To get some + * headroom for calculations, 32bit sample values are restricted to + * 24bit magnitude in that case. Also avoid implementation defined + * behavior here. + */ + if (sizeof(intpcm32_t) == (32 / 8) && val_bits == 32) /* Divide instead of right shift (value may be negative). */ return (value / (1 << 8)); return value; @@ -456,7 +462,7 @@ ATF_TC_BODY(pcm_write, tc) } local_pcm_write_calc(dst, value, test->format); ATF_CHECK_MSG(memcmp(dst, expected, sizeof(dst)) == 0, - "pcm_write[\"%s\"].value: " + "pcm_write[\"%s\"].calc: " "expected={0x%02x, 0x%02x, 0x%02x, 0x%02x}, " "result={0x%02x, 0x%02x, 0x%02x, 0x%02x}, ", test->label, expected[0], expected[1], expected[2], expected[3], From nobody Thu Jan 23 12:58:31 2025 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 4Yf1GH4ln8z5kvQS; Thu, 23 Jan 2025 12:58: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 4Yf1GH3pmtz3VwM; Thu, 23 Jan 2025 12:58:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737637111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OYGwskPS6Sye15IhwBXXX9pIAuzDe4DWMcsugCsEUtQ=; b=WhUEBessWl4xE8kJ1rTXnEfh9Wd5bD/qRp4E4YsM/5YfiuvHNuVsaekS6LFnjFXNLMKcOs vNjyCnvEDldtq93Z900ntvpJ8EpEu7Gg1iURBYMA57XCZMWir++9+cQWFl0J2ClAzb+Yo9 3tJTgIWdqEHLdqylzwxifyvdfRiTRgquQ3h6jydwf3oNf9seozGQNYkJkmDEtHCdFXq4B+ fro5z0HAcHEvE90hjwFQNlsByigUacMDpjeEicqKu+MWNdi6+ayeK+ztI2fdEpujLhVRGU wnOLIvqUxpRyuh0tre+FBp8wu5V6R90X+s3XyzxTlD1+9CkoY1USQ9i534tPMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737637111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OYGwskPS6Sye15IhwBXXX9pIAuzDe4DWMcsugCsEUtQ=; b=J5jv1ZgtrOHcf/UHeG68wGcMP57dvBCfM5mwdoIER+H1/3cyEttGuawzVvZHVux7L5lMcu ABxZqN0oyi2zBog7aqb/UuPiJXRvQMTvydLYt4NId/fYsEpjtxKOhsiMi4zfnEm3l79PcK s5M57X3k2MNO/gUcMHVf5hxLMuGuIJL76TuAu7MIN25LMx2VRdwpS4sPZUXhaofNs8Se9t IvK1Xy8o0V4/Z4v7SYChIzHnM9/l17eenVHEnFOBTl+hDOUohpPooy9yl7DykqkQm+hJ9d Y0LRYQU/apdgCXJzmBG7QsVjMtYEgeDqzKxJXIvPbQelFxyGKuP6CzLIb8yFpg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737637111; a=rsa-sha256; cv=none; b=M4jh2PkLmaZ7gLxY7M0zDTdxosDQtWE01hXuq3o/znPzEi8S2UQSLQ9j7lVaTs8jk3BF/L zRDw65bB+GWU6Y2Mdt+Me/8xsDVWQWbXTOX227DYOF0BUlCQ6fs9CV6pxlhV3I1TD4tHCQ gCiqKpSHqLtQpCVgg0p0MWqDdrkoLQqUIys74y7Ec/v7unPGJxOwfbL5S/V76CpeTDlvgV DRtVsjvdLOp/geQkQsWvov3ff7Ptf2QLEfbHoaXJkpD9cldFryOHNmEEO2vvbIZ8R/t7C9 wuajtog4gHa+F854YoDF9upFkTUyhGj8re142wRSfDffHtXrRTUgLsp6bfFNUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf1GH3LBbzgRd; Thu, 23 Jan 2025 12:58: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 50NCwV1I014336; Thu, 23 Jan 2025 12:58:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NCwVRh014333; Thu, 23 Jan 2025 12:58:31 GMT (envelope-from git) Date: Thu, 23 Jan 2025 12:58:31 GMT Message-Id: <202501231258.50NCwVRh014333@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: 697c1568b75a - main - pf: fix IPv6 route lookup for nat64 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: 697c1568b75a0053e422782dd7c0d9d1e28a67e8 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=697c1568b75a0053e422782dd7c0d9d1e28a67e8 commit 697c1568b75a0053e422782dd7c0d9d1e28a67e8 Author: Kristof Provost AuthorDate: 2025-01-23 09:53:55 +0000 Commit: Kristof Provost CommitDate: 2025-01-23 12:53:18 +0000 pf: fix IPv6 route lookup for nat64 The route lookup in pf_route6() (for the nat64 case) had the src/dst for bcopy() swapped around, so any nat64 setup that passed via a gateway on the IPv6 side was broken. Fix this, add 'const' to make this error actually fail to compile and add a test case. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 6 ++--- tests/sys/netpfil/pf/nat64.sh | 63 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 3b9c71296a2b..83eca735d2bb 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -8961,7 +8961,7 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, if (ifp == NULL && (pd->af != pd->naf)) { /* We're in the AFTO case. Do a route lookup. */ - struct nhop_object *nh; + const struct nhop_object *nh; nh = fib4_lookup(M_GETFIB(*m), ip->ip_dst, 0, NHR_NONE, 0); if (nh) { ifp = nh->nh_ifp; @@ -9220,14 +9220,14 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } if (ifp == NULL && (pd->af != pd->naf)) { - struct nhop_object *nh; + const struct nhop_object *nh; nh = fib6_lookup(M_GETFIB(*m), &ip6->ip6_dst, 0, NHR_NONE, 0); if (nh) { ifp = nh->nh_ifp; /* Use the gateway if needed. */ if (nh->nh_flags & NHF_GATEWAY) - bcopy(&dst.sin6_addr, &nh->gw6_sa.sin6_addr, + bcopy(&nh->gw6_sa.sin6_addr, &dst.sin6_addr, sizeof(dst.sin6_addr)); else dst.sin6_addr = ip6->ip6_dst; diff --git a/tests/sys/netpfil/pf/nat64.sh b/tests/sys/netpfil/pf/nat64.sh index 79fa0c99a311..913f90480e5d 100644 --- a/tests/sys/netpfil/pf/nat64.sh +++ b/tests/sys/netpfil/pf/nat64.sh @@ -609,6 +609,68 @@ dummynet_cleanup() pft_cleanup } +atf_test_case "gateway6" "cleanup" +gateway6_head() +{ + atf_set descr 'NAT64 with a routing hop on the v6 side' + atf_set require.user root +} + +gateway6_body() +{ + pft_init + + epair_lan_link=$(vnet_mkepair) + epair_link=$(vnet_mkepair) + epair=$(vnet_mkepair) + + ifconfig ${epair}a inet6 2001:db8:1::2/64 up no_dad + route -6 add default 2001:db8:1::1 + + vnet_mkjail lan_rtr ${epair}b ${epair_lan_link}a + jexec lan_rtr ifconfig ${epair}b inet6 2001:db8:1::1/64 up no_dad + jexec lan_rtr ifconfig ${epair_lan_link}a inet6 2001:db8::2/64 up no_dad + jexec lan_rtr route -6 add default 2001:db8::1 + jexec lan_rtr sysctl net.inet6.ip6.forwarding=1 + + vnet_mkjail rtr ${epair_lan_link}b ${epair_link}a + jexec rtr ifconfig ${epair_lan_link}b inet6 2001:db8::1/64 up no_dad + jexec rtr ifconfig ${epair_link}a 192.0.2.1/24 up + jexec rtr route -6 add default 2001:db8::2 + + vnet_mkjail dst ${epair_link}b + jexec dst ifconfig ${epair_link}b 192.0.2.2/24 up + jexec dst route add default 192.0.2.1 + + # Sanity checks + atf_check -s exit:0 -o ignore \ + ping6 -c 1 2001:db8:1::1 + atf_check -s exit:0 -o ignore \ + ping6 -c 1 2001:db8::1 + atf_check -s exit:0 -o ignore \ + jexec dst ping -c 1 192.0.2.1 + + jexec rtr pfctl -e + pft_set_rules rtr \ + "set reassemble yes" \ + "set state-policy if-bound" \ + "pass in on ${epair_lan_link}b inet6 from any to 64:ff9b::/96 af-to inet from (${epair_link}a)" + + # One ping + atf_check -s exit:0 -o ignore \ + ping6 -c 1 64:ff9b::192.0.2.2 + + # Make sure packets make it even when state is established + atf_check -s exit:0 \ + -o match:'5 packets transmitted, 5 packets received, 0.0% packet loss' \ + ping6 -c 5 64:ff9b::192.0.2.2 +} + +gateway6_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "icmp_echo" @@ -624,4 +686,5 @@ atf_init_test_cases() atf_add_test_case "table_range" atf_add_test_case "table_round_robin" atf_add_test_case "dummynet" + atf_add_test_case "gateway6" } From nobody Thu Jan 23 15:31:41 2025 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 4Yf4g12qMCz5l5bM; Thu, 23 Jan 2025 15:31: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 4Yf4g11v6rz3nvj; Thu, 23 Jan 2025 15:31:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737646301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vXWUdyw6tHjtPP9AL4BqHtl0DB7Y2/70w/zoLXR1ABI=; b=byIgjBuol7eP+Ab3VVkLeygqhD+U9hTOVbz24hShHp10m5VRZ3p0r9a2NYOo/x0ogvRVQ+ quZCBsF/+VbQkVfBfJSZv2+pEVWU5aV3JFiR7EA9Rj/bhg4Pq+mkLqWP3bEEBnU5yahBlK TGN074ZSCBwbZjMPTvlTJnDNYgQCSjAR+77mjK4/+h2VytgsJiw+8FY2KxLLX1QqiszEzJ n5qKqIq/xzuJ8NmcQhaH6U/ys7OnOQY+IlfofWfxhGTEqo+dFSzFIDLuR1l5NMXrWFKkNN /ypL53PBb4Ez/CvEmE6efW5Twdv361D7JLgSKmqmkYXYTZnnJyY0oFyAJd4jYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737646301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vXWUdyw6tHjtPP9AL4BqHtl0DB7Y2/70w/zoLXR1ABI=; b=tY416ebV7ZH6Tt2i95LZv1IJzA1WlhKH52hiN2M4jTl3O6znorBr8RErSaH6VnF7NZ9SKs E4m9uZSBdtr2/b0+cQVmR/UZx485NHtyiEX3tCItsyK1GneiksBewADjyZ+XBaAiHq1EtO 9tmEB/TR3hWKTO4EvEnLN1QwA9eLUTdfP9F2h6uDb/8x6Af/r2OdEJTnfrvdHAzt0K0B++ TzvGDVSD+PpuBQdK3BItR6DVDpjvNjSVVMYwpRF+5/eegGh648kVIl/QbsBr3cWaY8KTyu 42JemqDG1HaU0QPkW9x25wXLZmO6nq+eVowhb2m758/Tozi3JCoyUZ8NSs9UFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737646301; a=rsa-sha256; cv=none; b=kR+wrkKqgAvGTjLPRc2vL2pjd45lmZTnCw3PikqTM8SPfM5Eb1WB8CTwYPE2dwpivlYhla krnzkoCqR/pXzAazoUPhFCpd6y3bw1cUzmzypCtL3yQ660m7c+MgDDpMJlrNWpTCrjcgVh 1t16BdIctlsWaQ/pvmyPUvxf0Hwc8gJ4SAiX8gRGPi5yvWRC3zbuPgPT25634NgewVVDFb SS9VqCn9F/Vygc2080BoIIE91hmSfsjzeXCuIbCRTLYDqw2QB1LB9+MzyR/gOQMXK7Kzbo Cy3BHQBO0IyUYhQl5t0D+YXfSkf0/9JCV6/PrY46VZ0b25TvC3Jt454knCtVjw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf4g11V10zlT5; Thu, 23 Jan 2025 15:31: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 50NFVf1d011891; Thu, 23 Jan 2025 15:31:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NFVf9a011888; Thu, 23 Jan 2025 15:31:41 GMT (envelope-from git) Date: Thu, 23 Jan 2025 15:31:41 GMT Message-Id: <202501231531.50NFVf9a011888@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 916f6e6dd3a9 - main - gvinum.8: Update deprecation warning to note that this is removed in 15.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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 916f6e6dd3a95145c70e1c2c55467dd4979a0118 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=916f6e6dd3a95145c70e1c2c55467dd4979a0118 commit 916f6e6dd3a95145c70e1c2c55467dd4979a0118 Author: John Baldwin AuthorDate: 2025-01-23 15:27:44 +0000 Commit: John Baldwin CommitDate: 2025-01-23 15:27:44 +0000 gvinum.8: Update deprecation warning to note that this is removed in 15.0 Reviewed by: emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D48592 --- sbin/gvinum/gvinum.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/gvinum/gvinum.8 b/sbin/gvinum/gvinum.8 index 28e4cd7d76db..e861681203c6 100644 --- a/sbin/gvinum/gvinum.8 +++ b/sbin/gvinum/gvinum.8 @@ -26,7 +26,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 28, 2021 +.Dd January 23, 2025 .Dt GVINUM 8 .Os .Sh NAME @@ -36,7 +36,7 @@ .Nm and associated .Xr geom 4 -kernel support is deprecated, and may not be available in +kernel support is deprecated, and is not be available in .Fx 15.0 and later. Users are advised to migrate to From nobody Thu Jan 23 15:31:42 2025 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 4Yf4g23vmlz5l5by; Thu, 23 Jan 2025 15:31: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 4Yf4g22d76z3nyk; Thu, 23 Jan 2025 15:31:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737646302; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cVmoBfQZbcN4qQTbgMbDZMcJUGMCm47CjVTCjpZm9Cc=; b=Z+Hfmm0rqHXM+EFsd3kb6C/sCLUHtpJzxpqkvU2BA88Hx+N9dHXNklQhFP4tY0xb2B+nb4 +GEktzWPJA+tPvZf5isVbxV/hoUTEwX3D6z6St9OuZmvVsbs1qZbptvjdAPDGpo6uR6XfP 6dQiGFro7QdfUBfVlVWhR/Su8XogSiOcu7RY1jt93oTmvW9Mu3RUewKJHKbO5Q1hFI1TSC NxMkqh2lWfIl0ZCY0zdiSP5fOLvZXe1zYoBY0sVPKGp8o3Mp+rpQfbRHcK619PpAq/D5bY ipsSD2u47XgS7uHdv2CgC+K+M09dfI4lEwNfp0Tphh/PVXg516iULTLZcju1rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737646302; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cVmoBfQZbcN4qQTbgMbDZMcJUGMCm47CjVTCjpZm9Cc=; b=I2Wu3EvDTD22H8az20t06P5kFftmGQM7mzV4hbwz9oOINlM7rscqmg7Q822utKLse+Jikg un/DK/0OX3NFZGNP+wl+X2y9G5pLOXMr9/3kB86f6ojqpvqGbyfG1426ngXqoaqdzouqfP p2ThZwFU5EZzATEo0L/MkJqEvaPyNY38UDepTLxlpzGTYHkKrUHAHic5BB1BKrMuC4iVm+ 0gPr9fvlKC+FY2nBrqEz2z8mwZh+P2rP5OQkNKRATvHD6tce+dnXW1WAWI8ZZF2pZO4dmV 1333i1GgUluUBya7RxAXeMiH0l4eTELuCMRAisMg9Daij2cYKBPVXuz6BtAgQQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737646302; a=rsa-sha256; cv=none; b=JM9oVqCchFNlvdlMGD99kkxel62ynFUITt4LQbARF34XRNwJfQaIvRmCVZhxNkSFTHV5lx Hdkkr0cvOrQ5xqbqiXdkfP5YQOnDl3NF581ek56eqOy/YaLgJLbr5a7++RlwyArxs5tjwV JBaJRqWFha6wEwxYIjXDxRHmH/b+HpelLXZD8mVWeQ/pjkniYFfZW439z0iKCOUyQo/+CX PI6U0rHqy/p4QmA9e5Iffpxd8rHBZqlIIdymPXuLbA0UHt6ecg1ZN4H0y1yCG5ztaKw5+c zOiLq7qgCz89OJNZyHSOWAcfSvX67bnSkZfoisuRiMsj3WQrpEbDaElWsUofhg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf4g225JSzlhg; Thu, 23 Jan 2025 15:31: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 50NFVgCK011931; Thu, 23 Jan 2025 15:31:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NFVgaj011928; Thu, 23 Jan 2025 15:31:42 GMT (envelope-from git) Date: Thu, 23 Jan 2025 15:31:42 GMT Message-Id: <202501231531.50NFVgaj011928@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 86116ab256c4 - main - ccdconfig.8: Refer to graid(8) and zfs(8) instead of gvinum(8) 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 86116ab256c476191e2fc1fffd79f94382960362 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=86116ab256c476191e2fc1fffd79f94382960362 commit 86116ab256c476191e2fc1fffd79f94382960362 Author: John Baldwin AuthorDate: 2025-01-23 15:28:27 +0000 Commit: John Baldwin CommitDate: 2025-01-23 15:28:27 +0000 ccdconfig.8: Refer to graid(8) and zfs(8) instead of gvinum(8) Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D48536 --- sbin/ccdconfig/ccdconfig.8 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sbin/ccdconfig/ccdconfig.8 b/sbin/ccdconfig/ccdconfig.8 index 085d83cab7a2..55cda5b2b356 100644 --- a/sbin/ccdconfig/ccdconfig.8 +++ b/sbin/ccdconfig/ccdconfig.8 @@ -199,15 +199,16 @@ If you need more than this you should look into external hardware RAID SCSI boxes, RAID controllers (see GENERIC), or software RAID systems such as -.Xr geom 8 -and -.Xr gvinum 8 . +.Xr graid 8 +or +.Xr zfs 8 . .Sh SEE ALSO .Xr dd 1 , .Xr ccd 4 , .Xr gpart 8 , -.Xr gvinum 8 , -.Xr rc 8 +.Xr graid 8 , +.Xr rc 8 , +.Xr zfs 8 .Sh HISTORY The .Nm From nobody Thu Jan 23 16:07:05 2025 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 4Yf5Rs2Y9Xz5l7M4; Thu, 23 Jan 2025 16:07: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 4Yf5Rs1w4bz3rBp; Thu, 23 Jan 2025 16:07:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737648425; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kX+s0TdMvHBTGYYCWl6aHJ9nDX9Wum0bvhMc9RIJb58=; b=cjZwmENx6F8JsWTurDJ7NJ7r1NB0auB56+yQvxX4iT5ImFvmoYlY17KPv/SpJRD8VXq1Sz 8qYjk8vgGaNAsMj4wfCEsf6b3fZkCZ9Xibldpz0z2ZnKyMlLkbYQTeuJcbRRIaqInTKXc1 GVBviZ8ZZgoZHp+OdE4XeT7Jce8vRkMCtcAyMX3iSLVH6SrS1TEfA++Z6JH4E8zFB/InoM Gzf0wzeQuI4H8HfW6Q8sM3DluD8CS9Fu3j8VRPhJqQJRbEageIHdlytKw3j7Ej5K2bV4Rg nmGyOyb8N+G1GShQIHdreDbJZNGXb2atDmr/F7adXq4f/9mdmnlnJmg1VX2yDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737648425; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kX+s0TdMvHBTGYYCWl6aHJ9nDX9Wum0bvhMc9RIJb58=; b=jud4S8b4hxCjU3oG1qHmKNLNXbgeEwXqIMXKHwCp6Dkd3YTqt1nTO2om5SVlI+0ZKLAQwP +KavNOlUjaeZzDYCySpT+bUFqLHfkIyY2hqPq7b2KysEYK3JHMTrkt3JMmVejKF5wCtiLc MTggatS8Yn8vfc/c2EqMKnWKln0ZHbU+19VphCTneLe8S/ivI7RpzEkYdn/cxZxWrcNKFy H0SSy3meVEfiPXMIF5IzJRJneTEM1+1SRRDLGI38znUl8ePCS4K0j6dxRDidUNiEp4emef 0SgWuIc0p5Iykcgo3M77MsZUJ0i2JaNFXoh2FB4G2bdOJxTbAcs1wSh/KtNGEg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737648425; a=rsa-sha256; cv=none; b=npUQxKoADC/gQQKoJlVTNL6SgPylQ1NgHqIx0QIfoZbIWJyqurGBgib1Ri8QqCTxB6Yd5+ R7Pef6XjmUbaYiCLl7AS96angRTqwq+kJ9N4SlAEpOUIFc4I+rb8trD5Hw6mJxmwcB8Hmn JQy0kdyFWbsUz+GoaZWZzpAC5g99xIbqMlduJ8m2nvzEWeeODLD9UbK5PG8K0xPiKGPVxC YnflYDgGneQvHKUKJfpDqJzOIYMQn0JKyXSWiK+6m+Z/Gpddf9eM4Xt9O3YpxVoUteXeT+ UzVoFo7nYOKfIVefZZx+jRzkN3MmscwXE46gx1jKMxV9hv/8iXmnSBWd84Xv7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf5Rs1G0Vzmgq; Thu, 23 Jan 2025 16:07: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 50NG75uw071400; Thu, 23 Jan 2025 16:07:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NG75lb071397; Thu, 23 Jan 2025 16:07:05 GMT (envelope-from git) Date: Thu, 23 Jan 2025 16:07:05 GMT Message-Id: <202501231607.50NG75lb071397@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 07423969869c - main - src.conf.5: Update xref for SSP description 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 07423969869c2034d1e70439ae5d70ddd390bf17 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=07423969869c2034d1e70439ae5d70ddd390bf17 commit 07423969869c2034d1e70439ae5d70ddd390bf17 Author: Ed Maste AuthorDate: 2025-01-23 14:02:31 +0000 Commit: Ed Maste CommitDate: 2025-01-23 16:06:11 +0000 src.conf.5: Update xref for SSP description SSP is currently documented in migitations.7. Fixes: 297bb39b6f0f ("mitigations.7: move SSP documentation from security.7 to here") Reviewed by: kevans Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48620 --- tools/build/options/WITHOUT_SSP | 2 +- tools/build/options/WITH_SSP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build/options/WITHOUT_SSP b/tools/build/options/WITHOUT_SSP index 7a773fe1e5aa..160da71bf9c2 100644 --- a/tools/build/options/WITHOUT_SSP +++ b/tools/build/options/WITHOUT_SSP @@ -1,4 +1,4 @@ Do not build world with stack smashing protection. See -.Xr security 7 +.Xr mitigations 7 for more information. diff --git a/tools/build/options/WITH_SSP b/tools/build/options/WITH_SSP index 4f06a73d4173..910fdc9b3b1a 100644 --- a/tools/build/options/WITH_SSP +++ b/tools/build/options/WITH_SSP @@ -1,4 +1,4 @@ Build world with stack smashing protection. See -.Xr security 7 +.Xr mitigations 7 for more information. From nobody Thu Jan 23 16:21:03 2025 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 4Yf5m01CB6z5l8KG; Thu, 23 Jan 2025 16:21: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 4Yf5m00xzPz3sLr; Thu, 23 Jan 2025 16:21:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737649264; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NmD1yis2khBzGGPYFv3C3lnJNlMXa7KkROOA4SslquU=; b=HcyR1b0DBAeac4+GvcE3yPcY1GaT8DkMg4Srb4rFL2manIs9hC2La850L85LmvCbElE8VZ moS0QLj2vccaTyMQUGHrj+V8lWSD7aDfjXAagR4GDviokpj5baDUA4sD8mDS5H65Zk6FRr stge7YERTcKg+Svly5zl1Dt/5oL0Gt9i0KaQ6DQZCE/4mKTaZddwC0agtf86JUE9fiHFI1 1tT1vKfp6OoU20HfTt3YaVd6FuzJeHbyIitNv3zzvI/Fg5fU7Q+FzRcXS53npzc3c3JRjv t6DcMFY6SPFG9FxD/W6sgLRo6L9wGY09HyGT9DgzAt7F9yskUvxwKHh1jNWLvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737649264; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NmD1yis2khBzGGPYFv3C3lnJNlMXa7KkROOA4SslquU=; b=GbSbK92AjUj8mt692HhblKTXNhE0mFTcpw31hTX49BDZnWszKs08Xy4uHLzFEixx/dCdlu IzungpDWc7ZuaidI2q7BODVnjC+7se7g/rR6rRd0uWsvRQFHuVzcaXY2Zuwbe4AygnQzdU gJmzq+duZk0bvTXfqIK7db6OhuH+xbNRMzDKr6Zu9AwXoOcpmsDZWIkupjxp6/5HwNFwOp k8h0Myv0gzyV95+5daNHm1MiMm/G/A8Hn8VPd+ax8zqURUpPfrpqIV6DYFaQQxOJjZv9gj n8jO0mN+8tZd7a/SdHvQxLqVUmbPn1bP3wf4UKhDX5Vw/yRGQqrUxA8IA0hphA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737649264; a=rsa-sha256; cv=none; b=VHkxtUyKLaB5H2WXz7LZIqYZuKfRZ9vZt6qCkd/nIpXeCoDcmlkHQUQ9/tR5U5s3PqyQPr EiEMxqpvaM6/GXyGvXCc7IY53Y0g0Kxyopulp3WeVvnTTCSRSbIUwhWCvcGy2xqvsOe8wY u6I9Yg9qUQ5s/QbxDq/Tpep1yx94p816rQaNVboTQOuQCJds9k0LP4O/AmJGjvedxTUnK7 jJ5EElPurYWL/o2onR1MId/vyHoc2IoHCVWMprFPDevkYKWRO8d1uDEMvFpRg+bp82hAEx 6HJDxN2OE5SV9z1DM6Mip4EysCj5c03pE4DHrJg5JyXjE/ha4evb6SVcHJrrgw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf5m00Y58zmkj; Thu, 23 Jan 2025 16:21: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 50NGL4m2001027; Thu, 23 Jan 2025 16:21:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NGL3Iu001024; Thu, 23 Jan 2025 16:21:03 GMT (envelope-from git) Date: Thu, 23 Jan 2025 16:21:03 GMT Message-Id: <202501231621.50NGL3Iu001024@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: f87bb5967670 - main - gvinum: Remove kernel 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f87bb5967670914f2f6d9ab4c732ab083a61b4c8 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=f87bb5967670914f2f6d9ab4c732ab083a61b4c8 commit f87bb5967670914f2f6d9ab4c732ab083a61b4c8 Author: John Baldwin AuthorDate: 2025-01-23 15:32:41 +0000 Commit: John Baldwin CommitDate: 2025-01-23 16:20:42 +0000 gvinum: Remove kernel support Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D48541 --- sys/conf/NOTES | 1 - sys/conf/files | 15 - sys/geom/vinum/geom_vinum.c | 1044 --------------------------- sys/geom/vinum/geom_vinum.h | 163 ----- sys/geom/vinum/geom_vinum_create.c | 608 ---------------- sys/geom/vinum/geom_vinum_drive.c | 351 ---------- sys/geom/vinum/geom_vinum_events.c | 282 -------- sys/geom/vinum/geom_vinum_init.c | 388 ----------- sys/geom/vinum/geom_vinum_list.c | 500 ------------- sys/geom/vinum/geom_vinum_move.c | 189 ----- sys/geom/vinum/geom_vinum_plex.c | 1045 ---------------------------- sys/geom/vinum/geom_vinum_raid5.c | 662 ------------------ sys/geom/vinum/geom_vinum_raid5.h | 55 -- sys/geom/vinum/geom_vinum_rename.c | 261 ------- sys/geom/vinum/geom_vinum_rm.c | 387 ----------- sys/geom/vinum/geom_vinum_share.c | 723 ------------------- sys/geom/vinum/geom_vinum_share.h | 67 -- sys/geom/vinum/geom_vinum_state.c | 534 -------------- sys/geom/vinum/geom_vinum_subr.c | 1277 ---------------------------------- sys/geom/vinum/geom_vinum_var.h | 393 ----------- sys/geom/vinum/geom_vinum_volume.c | 163 ----- sys/modules/geom/Makefile | 1 - sys/modules/geom/geom_vinum/Makefile | 10 - 23 files changed, 9119 deletions(-) diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 181bd351b460..aedb89e49b67 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -177,7 +177,6 @@ options GEOM_RAID3 # RAID3 functionality. options GEOM_SHSEC # Shared secret. options GEOM_STRIPE # Disk striping. options GEOM_UZIP # Read-only compressed disks -options GEOM_VINUM # Vinum logical volume manager options GEOM_VIRSTOR # Virtual storage. options GEOM_ZERO # Performance testing helper. diff --git a/sys/conf/files b/sys/conf/files index 5fd7b887581a..496f1617a67a 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3714,21 +3714,6 @@ geom/uzip/g_uzip_wrkthr.c optional geom_uzip geom/uzip/g_uzip_zlib.c optional geom_uzip geom/uzip/g_uzip_zstd.c optional geom_uzip zstdio \ compile-with "${NORMAL_C} -I$S/contrib/zstd/lib/freebsd" -geom/vinum/geom_vinum.c optional geom_vinum -geom/vinum/geom_vinum_create.c optional geom_vinum -geom/vinum/geom_vinum_drive.c optional geom_vinum -geom/vinum/geom_vinum_plex.c optional geom_vinum -geom/vinum/geom_vinum_volume.c optional geom_vinum -geom/vinum/geom_vinum_subr.c optional geom_vinum -geom/vinum/geom_vinum_raid5.c optional geom_vinum -geom/vinum/geom_vinum_share.c optional geom_vinum -geom/vinum/geom_vinum_list.c optional geom_vinum -geom/vinum/geom_vinum_rm.c optional geom_vinum -geom/vinum/geom_vinum_init.c optional geom_vinum -geom/vinum/geom_vinum_state.c optional geom_vinum -geom/vinum/geom_vinum_rename.c optional geom_vinum -geom/vinum/geom_vinum_move.c optional geom_vinum -geom/vinum/geom_vinum_events.c optional geom_vinum geom/virstor/binstream.c optional geom_virstor geom/virstor/g_virstor.c optional geom_virstor geom/virstor/g_virstor_md.c optional geom_virstor diff --git a/sys/geom/vinum/geom_vinum.c b/sys/geom/vinum/geom_vinum.c deleted file mode 100644 index 5c66216aaf3e..000000000000 --- a/sys/geom/vinum/geom_vinum.c +++ /dev/null @@ -1,1044 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2004, 2007 Lukas Ertl - * Copyright (c) 2007, 2009 Ulf Lilleengen - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -SYSCTL_DECL(_kern_geom); -static SYSCTL_NODE(_kern_geom, OID_AUTO, vinum, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, - "GEOM_VINUM stuff"); -u_int g_vinum_debug = 0; -SYSCTL_UINT(_kern_geom_vinum, OID_AUTO, debug, CTLFLAG_RWTUN, &g_vinum_debug, 0, - "Debug level"); - -static int gv_create(struct g_geom *, struct gctl_req *); -static void gv_attach(struct gv_softc *, struct gctl_req *); -static void gv_detach(struct gv_softc *, struct gctl_req *); -static void gv_parityop(struct gv_softc *, struct gctl_req *); - -static void -gv_orphan(struct g_consumer *cp) -{ - struct g_geom *gp; - struct gv_softc *sc; - struct gv_drive *d; - - g_topology_assert(); - - KASSERT(cp != NULL, ("gv_orphan: null cp")); - gp = cp->geom; - KASSERT(gp != NULL, ("gv_orphan: null gp")); - sc = gp->softc; - KASSERT(sc != NULL, ("gv_orphan: null sc")); - d = cp->private; - KASSERT(d != NULL, ("gv_orphan: null d")); - - g_trace(G_T_TOPOLOGY, "gv_orphan(%s)", gp->name); - - gv_post_event(sc, GV_EVENT_DRIVE_LOST, d, NULL, 0, 0); -} - -void -gv_start(struct bio *bp) -{ - struct g_geom *gp; - struct gv_softc *sc; - - gp = bp->bio_to->geom; - sc = gp->softc; - - switch (bp->bio_cmd) { - case BIO_READ: - case BIO_WRITE: - case BIO_DELETE: - break; - case BIO_GETATTR: - default: - g_io_deliver(bp, EOPNOTSUPP); - return; - } - mtx_lock(&sc->bqueue_mtx); - bioq_disksort(sc->bqueue_down, bp); - wakeup(sc); - mtx_unlock(&sc->bqueue_mtx); -} - -void -gv_done(struct bio *bp) -{ - struct g_geom *gp; - struct gv_softc *sc; - - KASSERT(bp != NULL, ("NULL bp")); - - gp = bp->bio_from->geom; - sc = gp->softc; - - mtx_lock(&sc->bqueue_mtx); - bioq_disksort(sc->bqueue_up, bp); - wakeup(sc); - mtx_unlock(&sc->bqueue_mtx); -} - -int -gv_access(struct g_provider *pp, int dr, int dw, int de) -{ - struct g_geom *gp; - struct gv_softc *sc; - struct gv_drive *d, *d2; - int error; - - gp = pp->geom; - sc = gp->softc; - /* - * We want to modify the read count with the write count in case we have - * plexes in a RAID-5 organization. - */ - dr += dw; - - LIST_FOREACH(d, &sc->drives, drive) { - if (d->consumer == NULL) - continue; - error = g_access(d->consumer, dr, dw, de); - if (error) { - LIST_FOREACH(d2, &sc->drives, drive) { - if (d == d2) - break; - g_access(d2->consumer, -dr, -dw, -de); - } - G_VINUM_DEBUG(0, "g_access '%s' failed: %d", d->name, - error); - return (error); - } - } - return (0); -} - -static void -gv_init(struct g_class *mp) -{ - struct g_geom *gp; - struct gv_softc *sc; - - g_trace(G_T_TOPOLOGY, "gv_init(%p)", mp); - - gp = g_new_geomf(mp, "VINUM"); - gp->spoiled = gv_orphan; - gp->orphan = gv_orphan; - gp->access = gv_access; - gp->start = gv_start; - gp->softc = g_malloc(sizeof(struct gv_softc), M_WAITOK | M_ZERO); - sc = gp->softc; - sc->geom = gp; - sc->bqueue_down = g_malloc(sizeof(struct bio_queue_head), - M_WAITOK | M_ZERO); - sc->bqueue_up = g_malloc(sizeof(struct bio_queue_head), - M_WAITOK | M_ZERO); - bioq_init(sc->bqueue_down); - bioq_init(sc->bqueue_up); - LIST_INIT(&sc->drives); - LIST_INIT(&sc->subdisks); - LIST_INIT(&sc->plexes); - LIST_INIT(&sc->volumes); - TAILQ_INIT(&sc->equeue); - mtx_init(&sc->config_mtx, "gv_config", NULL, MTX_DEF); - mtx_init(&sc->equeue_mtx, "gv_equeue", NULL, MTX_DEF); - mtx_init(&sc->bqueue_mtx, "gv_bqueue", NULL, MTX_DEF); - kproc_create(gv_worker, sc, &sc->worker, 0, 0, "gv_worker"); -} - -static int -gv_unload(struct gctl_req *req, struct g_class *mp, struct g_geom *gp) -{ - struct gv_softc *sc; - - g_trace(G_T_TOPOLOGY, "gv_unload(%p)", mp); - - g_topology_assert(); - sc = gp->softc; - - if (sc != NULL) { - gv_worker_exit(sc); - gp->softc = NULL; - g_wither_geom(gp, ENXIO); - } - - return (0); -} - -/* Handle userland request of attaching object. */ -static void -gv_attach(struct gv_softc *sc, struct gctl_req *req) -{ - struct gv_volume *v; - struct gv_plex *p; - struct gv_sd *s; - off_t *offset; - int *rename, type_child, type_parent; - char *child, *parent; - - child = gctl_get_param(req, "child", NULL); - if (child == NULL) { - gctl_error(req, "no child given"); - return; - } - parent = gctl_get_param(req, "parent", NULL); - if (parent == NULL) { - gctl_error(req, "no parent given"); - return; - } - offset = gctl_get_paraml(req, "offset", sizeof(*offset)); - if (offset == NULL) { - gctl_error(req, "no offset given"); - return; - } - rename = gctl_get_paraml(req, "rename", sizeof(*rename)); - if (rename == NULL) { - gctl_error(req, "no rename flag given"); - return; - } - - type_child = gv_object_type(sc, child); - type_parent = gv_object_type(sc, parent); - - switch (type_child) { - case GV_TYPE_PLEX: - if (type_parent != GV_TYPE_VOL) { - gctl_error(req, "no such volume to attach to"); - return; - } - v = gv_find_vol(sc, parent); - p = gv_find_plex(sc, child); - gv_post_event(sc, GV_EVENT_ATTACH_PLEX, p, v, *offset, *rename); - break; - case GV_TYPE_SD: - if (type_parent != GV_TYPE_PLEX) { - gctl_error(req, "no such plex to attach to"); - return; - } - p = gv_find_plex(sc, parent); - s = gv_find_sd(sc, child); - gv_post_event(sc, GV_EVENT_ATTACH_SD, s, p, *offset, *rename); - break; - default: - gctl_error(req, "invalid child type"); - break; - } -} - -/* Handle userland request of detaching object. */ -static void -gv_detach(struct gv_softc *sc, struct gctl_req *req) -{ - struct gv_plex *p; - struct gv_sd *s; - int *flags, type; - char *object; - - object = gctl_get_param(req, "object", NULL); - if (object == NULL) { - gctl_error(req, "no argument given"); - return; - } - - flags = gctl_get_paraml(req, "flags", sizeof(*flags)); - type = gv_object_type(sc, object); - switch (type) { - case GV_TYPE_PLEX: - p = gv_find_plex(sc, object); - gv_post_event(sc, GV_EVENT_DETACH_PLEX, p, NULL, *flags, 0); - break; - case GV_TYPE_SD: - s = gv_find_sd(sc, object); - gv_post_event(sc, GV_EVENT_DETACH_SD, s, NULL, *flags, 0); - break; - default: - gctl_error(req, "invalid object type"); - break; - } -} - -/* Handle userland requests for creating new objects. */ -static int -gv_create(struct g_geom *gp, struct gctl_req *req) -{ - struct gv_softc *sc; - struct gv_drive *d, *d2; - struct gv_plex *p, *p2; - struct gv_sd *s, *s2; - struct gv_volume *v, *v2; - struct g_provider *pp; - int i, *drives, *flags, *plexes, *subdisks, *volumes; - char buf[20]; - - g_topology_assert(); - - sc = gp->softc; - - /* Find out how many of each object have been passed in. */ - volumes = gctl_get_paraml(req, "volumes", sizeof(*volumes)); - plexes = gctl_get_paraml(req, "plexes", sizeof(*plexes)); - subdisks = gctl_get_paraml(req, "subdisks", sizeof(*subdisks)); - drives = gctl_get_paraml(req, "drives", sizeof(*drives)); - if (volumes == NULL || plexes == NULL || subdisks == NULL || - drives == NULL) { - gctl_error(req, "number of objects not given"); - return (-1); - } - flags = gctl_get_paraml(req, "flags", sizeof(*flags)); - if (flags == NULL) { - gctl_error(req, "flags not given"); - return (-1); - } - - /* First, handle drive definitions ... */ - for (i = 0; i < *drives; i++) { - snprintf(buf, sizeof(buf), "drive%d", i); - d2 = gctl_get_paraml(req, buf, sizeof(*d2)); - if (d2 == NULL) { - gctl_error(req, "no drive definition given"); - return (-1); - } - /* - * Make sure that the device specified in the drive config is - * an active GEOM provider. - */ - pp = g_provider_by_name(d2->device); - if (pp == NULL) { - gctl_error(req, "%s: device not found", d2->device); - goto error; - } - if (gv_find_drive(sc, d2->name) != NULL) { - /* Ignore error. */ - if (*flags & GV_FLAG_F) - continue; - gctl_error(req, "drive '%s' already exists", d2->name); - goto error; - } - if (gv_find_drive_device(sc, d2->device) != NULL) { - gctl_error(req, "device '%s' already configured in " - "gvinum", d2->device); - goto error; - } - - d = g_malloc(sizeof(*d), M_WAITOK | M_ZERO); - bcopy(d2, d, sizeof(*d)); - - gv_post_event(sc, GV_EVENT_CREATE_DRIVE, d, NULL, 0, 0); - } - - /* ... then volume definitions ... */ - for (i = 0; i < *volumes; i++) { - snprintf(buf, sizeof(buf), "volume%d", i); - v2 = gctl_get_paraml(req, buf, sizeof(*v2)); - if (v2 == NULL) { - gctl_error(req, "no volume definition given"); - return (-1); - } - if (gv_find_vol(sc, v2->name) != NULL) { - /* Ignore error. */ - if (*flags & GV_FLAG_F) - continue; - gctl_error(req, "volume '%s' already exists", v2->name); - goto error; - } - - v = g_malloc(sizeof(*v), M_WAITOK | M_ZERO); - bcopy(v2, v, sizeof(*v)); - - gv_post_event(sc, GV_EVENT_CREATE_VOLUME, v, NULL, 0, 0); - } - - /* ... then plex definitions ... */ - for (i = 0; i < *plexes; i++) { - snprintf(buf, sizeof(buf), "plex%d", i); - p2 = gctl_get_paraml(req, buf, sizeof(*p2)); - if (p2 == NULL) { - gctl_error(req, "no plex definition given"); - return (-1); - } - if (gv_find_plex(sc, p2->name) != NULL) { - /* Ignore error. */ - if (*flags & GV_FLAG_F) - continue; - gctl_error(req, "plex '%s' already exists", p2->name); - goto error; - } - - p = g_malloc(sizeof(*p), M_WAITOK | M_ZERO); - bcopy(p2, p, sizeof(*p)); - - gv_post_event(sc, GV_EVENT_CREATE_PLEX, p, NULL, 0, 0); - } - - /* ... and, finally, subdisk definitions. */ - for (i = 0; i < *subdisks; i++) { - snprintf(buf, sizeof(buf), "sd%d", i); - s2 = gctl_get_paraml(req, buf, sizeof(*s2)); - if (s2 == NULL) { - gctl_error(req, "no subdisk definition given"); - return (-1); - } - if (gv_find_sd(sc, s2->name) != NULL) { - /* Ignore error. */ - if (*flags & GV_FLAG_F) - continue; - gctl_error(req, "sd '%s' already exists", s2->name); - goto error; - } - - s = g_malloc(sizeof(*s), M_WAITOK | M_ZERO); - bcopy(s2, s, sizeof(*s)); - - gv_post_event(sc, GV_EVENT_CREATE_SD, s, NULL, 0, 0); - } - -error: - gv_post_event(sc, GV_EVENT_SETUP_OBJECTS, sc, NULL, 0, 0); - gv_post_event(sc, GV_EVENT_SAVE_CONFIG, sc, NULL, 0, 0); - - return (0); -} - -static void -gv_config(struct gctl_req *req, struct g_class *mp, char const *verb) -{ - struct g_geom *gp; - struct gv_softc *sc; - struct sbuf *sb; - char *comment; - - g_topology_assert(); - - gp = LIST_FIRST(&mp->geom); - sc = gp->softc; - - if (!strcmp(verb, "attach")) { - gv_attach(sc, req); - - } else if (!strcmp(verb, "concat")) { - gv_concat(gp, req); - - } else if (!strcmp(verb, "detach")) { - gv_detach(sc, req); - - } else if (!strcmp(verb, "list")) { - gv_list(gp, req); - - /* Save our configuration back to disk. */ - } else if (!strcmp(verb, "saveconfig")) { - gv_post_event(sc, GV_EVENT_SAVE_CONFIG, sc, NULL, 0, 0); - - /* Return configuration in string form. */ - } else if (!strcmp(verb, "getconfig")) { - comment = gctl_get_param(req, "comment", NULL); - if (comment == NULL) { - gctl_error(req, "no comment parameter given"); - return; - } - sb = sbuf_new(NULL, NULL, GV_CFG_LEN, SBUF_FIXEDLEN); - gv_format_config(sc, sb, 0, comment); - sbuf_finish(sb); - gctl_set_param(req, "config", sbuf_data(sb), sbuf_len(sb) + 1); - sbuf_delete(sb); - - } else if (!strcmp(verb, "create")) { - gv_create(gp, req); - - } else if (!strcmp(verb, "mirror")) { - gv_mirror(gp, req); - - } else if (!strcmp(verb, "move")) { - gv_move(gp, req); - - } else if (!strcmp(verb, "raid5")) { - gv_raid5(gp, req); - - } else if (!strcmp(verb, "rebuildparity") || - !strcmp(verb, "checkparity")) { - gv_parityop(sc, req); - - } else if (!strcmp(verb, "remove")) { - gv_remove(gp, req); - - } else if (!strcmp(verb, "rename")) { - gv_rename(gp, req); - - } else if (!strcmp(verb, "resetconfig")) { - gv_post_event(sc, GV_EVENT_RESET_CONFIG, sc, NULL, 0, 0); - - } else if (!strcmp(verb, "start")) { - gv_start_obj(gp, req); - - } else if (!strcmp(verb, "stripe")) { - gv_stripe(gp, req); - - } else if (!strcmp(verb, "setstate")) { - gv_setstate(gp, req); - } else - gctl_error(req, "Unknown verb parameter"); -} - -static void -gv_parityop(struct gv_softc *sc, struct gctl_req *req) -{ - struct gv_plex *p; - int *flags, *rebuild, type; - char *plex; - - plex = gctl_get_param(req, "plex", NULL); - if (plex == NULL) { - gctl_error(req, "no plex given"); - return; - } - - flags = gctl_get_paraml(req, "flags", sizeof(*flags)); - if (flags == NULL) { - gctl_error(req, "no flags given"); - return; - } - - rebuild = gctl_get_paraml(req, "rebuild", sizeof(*rebuild)); - if (rebuild == NULL) { - gctl_error(req, "no operation given"); - return; - } - - type = gv_object_type(sc, plex); - if (type != GV_TYPE_PLEX) { - gctl_error(req, "'%s' is not a plex", plex); - return; - } - p = gv_find_plex(sc, plex); - - if (p->state != GV_PLEX_UP) { - gctl_error(req, "plex %s is not completely accessible", - p->name); - return; - } - - if (p->org != GV_PLEX_RAID5) { - gctl_error(req, "plex %s is not a RAID5 plex", p->name); - return; - } - - /* Put it in the event queue. */ - /* XXX: The state of the plex might have changed when this event is - * picked up ... We should perhaps check this afterwards. */ - if (*rebuild) - gv_post_event(sc, GV_EVENT_PARITY_REBUILD, p, NULL, 0, 0); - else - gv_post_event(sc, GV_EVENT_PARITY_CHECK, p, NULL, 0, 0); -} - -static struct g_geom * -gv_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) -{ - struct g_geom *gp; - struct g_consumer *cp; - struct gv_softc *sc; - struct gv_hdr vhdr; - int error; - - g_topology_assert(); - g_trace(G_T_TOPOLOGY, "gv_taste(%s, %s)", mp->name, pp->name); - - gp = LIST_FIRST(&mp->geom); - if (gp == NULL) { - G_VINUM_DEBUG(0, "error: tasting, but not initialized?"); - return (NULL); - } - sc = gp->softc; - - cp = g_new_consumer(gp); - cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; - if (g_attach(cp, pp) != 0) { - g_destroy_consumer(cp); - return (NULL); - } - if (g_access(cp, 1, 0, 0) != 0) { - g_detach(cp); - g_destroy_consumer(cp); - return (NULL); - } - g_topology_unlock(); - - error = gv_read_header(cp, &vhdr); - - g_topology_lock(); - g_access(cp, -1, 0, 0); - g_detach(cp); - g_destroy_consumer(cp); - - /* Check if what we've been given is a valid vinum drive. */ - if (!error) - gv_post_event(sc, GV_EVENT_DRIVE_TASTED, pp, NULL, 0, 0); - - return (NULL); -} - -void -gv_worker(void *arg) -{ - struct g_provider *pp; - struct gv_softc *sc; - struct gv_event *ev; - struct gv_volume *v; - struct gv_plex *p; - struct gv_sd *s; - struct gv_drive *d; - struct bio *bp; - int newstate, flags, err, rename; - char *newname; - off_t offset; - - sc = arg; - KASSERT(sc != NULL, ("NULL sc")); - for (;;) { - /* Look at the events first... */ - ev = gv_get_event(sc); - if (ev != NULL) { - gv_remove_event(sc, ev); - - switch (ev->type) { - case GV_EVENT_DRIVE_TASTED: - G_VINUM_DEBUG(2, "event 'drive tasted'"); - pp = ev->arg1; - gv_drive_tasted(sc, pp); - break; - - case GV_EVENT_DRIVE_LOST: - G_VINUM_DEBUG(2, "event 'drive lost'"); - d = ev->arg1; - gv_drive_lost(sc, d); - break; - - case GV_EVENT_CREATE_DRIVE: - G_VINUM_DEBUG(2, "event 'create drive'"); - d = ev->arg1; - gv_create_drive(sc, d); - break; - - case GV_EVENT_CREATE_VOLUME: - G_VINUM_DEBUG(2, "event 'create volume'"); - v = ev->arg1; - gv_create_volume(sc, v); - break; - - case GV_EVENT_CREATE_PLEX: - G_VINUM_DEBUG(2, "event 'create plex'"); - p = ev->arg1; - gv_create_plex(sc, p); - break; - - case GV_EVENT_CREATE_SD: - G_VINUM_DEBUG(2, "event 'create sd'"); - s = ev->arg1; - gv_create_sd(sc, s); - break; - - case GV_EVENT_RM_DRIVE: - G_VINUM_DEBUG(2, "event 'remove drive'"); - d = ev->arg1; - flags = ev->arg3; - gv_rm_drive(sc, d, flags); - /*gv_setup_objects(sc);*/ - break; - - case GV_EVENT_RM_VOLUME: - G_VINUM_DEBUG(2, "event 'remove volume'"); - v = ev->arg1; - gv_rm_vol(sc, v); - /*gv_setup_objects(sc);*/ - break; - - case GV_EVENT_RM_PLEX: - G_VINUM_DEBUG(2, "event 'remove plex'"); - p = ev->arg1; - gv_rm_plex(sc, p); - /*gv_setup_objects(sc);*/ - break; - - case GV_EVENT_RM_SD: - G_VINUM_DEBUG(2, "event 'remove sd'"); - s = ev->arg1; - gv_rm_sd(sc, s); - /*gv_setup_objects(sc);*/ - break; - - case GV_EVENT_SAVE_CONFIG: - G_VINUM_DEBUG(2, "event 'save config'"); - gv_save_config(sc); - break; - - case GV_EVENT_SET_SD_STATE: - G_VINUM_DEBUG(2, "event 'setstate sd'"); - s = ev->arg1; - newstate = ev->arg3; - flags = ev->arg4; - err = gv_set_sd_state(s, newstate, flags); - if (err) - G_VINUM_DEBUG(0, "error setting subdisk" - " state: error code %d", err); - break; - - case GV_EVENT_SET_DRIVE_STATE: - G_VINUM_DEBUG(2, "event 'setstate drive'"); - d = ev->arg1; - newstate = ev->arg3; - flags = ev->arg4; - err = gv_set_drive_state(d, newstate, flags); - if (err) - G_VINUM_DEBUG(0, "error setting drive " - "state: error code %d", err); - break; - - case GV_EVENT_SET_VOL_STATE: - G_VINUM_DEBUG(2, "event 'setstate volume'"); - v = ev->arg1; - newstate = ev->arg3; - flags = ev->arg4; - err = gv_set_vol_state(v, newstate, flags); - if (err) - G_VINUM_DEBUG(0, "error setting volume " - "state: error code %d", err); - break; - - case GV_EVENT_SET_PLEX_STATE: - G_VINUM_DEBUG(2, "event 'setstate plex'"); - p = ev->arg1; - newstate = ev->arg3; - flags = ev->arg4; - err = gv_set_plex_state(p, newstate, flags); - if (err) - G_VINUM_DEBUG(0, "error setting plex " - "state: error code %d", err); - break; - - case GV_EVENT_SETUP_OBJECTS: - G_VINUM_DEBUG(2, "event 'setup objects'"); - gv_setup_objects(sc); - break; - - case GV_EVENT_RESET_CONFIG: - G_VINUM_DEBUG(2, "event 'resetconfig'"); - err = gv_resetconfig(sc); - if (err) - G_VINUM_DEBUG(0, "error resetting " - "config: error code %d", err); - break; - - case GV_EVENT_PARITY_REBUILD: - /* - * Start the rebuild. The gv_plex_done will - * handle issuing of the remaining rebuild bio's - * until it's finished. - */ - G_VINUM_DEBUG(2, "event 'rebuild'"); - p = ev->arg1; - if (p->state != GV_PLEX_UP) { - G_VINUM_DEBUG(0, "plex %s is not " - "completely accessible", p->name); - break; - } - if (p->flags & GV_PLEX_SYNCING || - p->flags & GV_PLEX_REBUILDING || - p->flags & GV_PLEX_GROWING) { - G_VINUM_DEBUG(0, "plex %s is busy with " - "syncing or parity build", p->name); - break; - } - p->synced = 0; - p->flags |= GV_PLEX_REBUILDING; - g_topology_assert_not(); - g_topology_lock(); - err = gv_access(p->vol_sc->provider, 1, 1, 0); - if (err) { - G_VINUM_DEBUG(0, "unable to access " - "provider"); - break; - } - g_topology_unlock(); - gv_parity_request(p, GV_BIO_CHECK | - GV_BIO_PARITY, 0); - break; - - case GV_EVENT_PARITY_CHECK: - /* Start parity check. */ - G_VINUM_DEBUG(2, "event 'check'"); - p = ev->arg1; - if (p->state != GV_PLEX_UP) { - G_VINUM_DEBUG(0, "plex %s is not " - "completely accessible", p->name); - break; - } - if (p->flags & GV_PLEX_SYNCING || - p->flags & GV_PLEX_REBUILDING || - p->flags & GV_PLEX_GROWING) { - G_VINUM_DEBUG(0, "plex %s is busy with " - "syncing or parity build", p->name); - break; - } - p->synced = 0; - g_topology_assert_not(); - g_topology_lock(); - err = gv_access(p->vol_sc->provider, 1, 1, 0); - if (err) { - G_VINUM_DEBUG(0, "unable to access " - "provider"); - break; - } - g_topology_unlock(); - gv_parity_request(p, GV_BIO_CHECK, 0); - break; - - case GV_EVENT_START_PLEX: - G_VINUM_DEBUG(2, "event 'start' plex"); - p = ev->arg1; - gv_start_plex(p); - break; - - case GV_EVENT_START_VOLUME: - G_VINUM_DEBUG(2, "event 'start' volume"); - v = ev->arg1; - gv_start_vol(v); - break; - - case GV_EVENT_ATTACH_PLEX: - G_VINUM_DEBUG(2, "event 'attach' plex"); - p = ev->arg1; - v = ev->arg2; - rename = ev->arg4; - err = gv_attach_plex(p, v, rename); - if (err) - G_VINUM_DEBUG(0, "error attaching %s to" - " %s: error code %d", p->name, - v->name, err); - break; - - case GV_EVENT_ATTACH_SD: - G_VINUM_DEBUG(2, "event 'attach' sd"); - s = ev->arg1; - p = ev->arg2; - offset = ev->arg3; - rename = ev->arg4; - err = gv_attach_sd(s, p, offset, rename); - if (err) - G_VINUM_DEBUG(0, "error attaching %s to" - " %s: error code %d", s->name, - p->name, err); - break; - - case GV_EVENT_DETACH_PLEX: - G_VINUM_DEBUG(2, "event 'detach' plex"); - p = ev->arg1; - flags = ev->arg3; - err = gv_detach_plex(p, flags); - if (err) - G_VINUM_DEBUG(0, "error detaching %s: " - "error code %d", p->name, err); - break; - - case GV_EVENT_DETACH_SD: - G_VINUM_DEBUG(2, "event 'detach' sd"); - s = ev->arg1; - flags = ev->arg3; - err = gv_detach_sd(s, flags); - if (err) - G_VINUM_DEBUG(0, "error detaching %s: " - "error code %d", s->name, err); - break; - - case GV_EVENT_RENAME_VOL: - G_VINUM_DEBUG(2, "event 'rename' volume"); - v = ev->arg1; - newname = ev->arg2; - flags = ev->arg3; - err = gv_rename_vol(sc, v, newname, flags); - if (err) - G_VINUM_DEBUG(0, "error renaming %s to " - "%s: error code %d", v->name, - newname, err); *** 8325 LINES SKIPPED *** From nobody Thu Jan 23 16:21:05 2025 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 4Yf5m12pM4z5l8bZ; Thu, 23 Jan 2025 16:21: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 4Yf5m127jmz3sQZ; Thu, 23 Jan 2025 16:21:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737649265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=r/mvTWwhlcdTaCX9O9e3SfnxPqK1mjyhYDQfOc9G7HM=; b=Bh6Cf4a/IA4jm80GaDfnwgYJ3Z88jtV8YhXKk9OGHXceW4TW79Iov+Rv4clUVE+JO5hi/F RxVD/5fXM8aBUHqYFMxfPnrT9TgTBnthAHVE4dwWdVyqVmGTM3S6s7KU5ddPRMPSIuWLKq K58Kgo8hxj6QMwQMYO5xn4EPIE4xxa5KeWerNrMYiyITOf1DvIJdaNWKjpgteh+1s86h9f Lj+f39w2Yak9b+jHJNjuHwTU3an8n+Hc5F6yxK89zdRSPzkCrr6NjvM4sI5CmTxVtUrJFl 3uU2I4rrN6FbB7kgPbfc17fsxFl/RrAZrr1xwpJG7EQiF+fIncBXiR4xu/jukg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737649265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=r/mvTWwhlcdTaCX9O9e3SfnxPqK1mjyhYDQfOc9G7HM=; b=f2TMQGUtiDTve6L8XwXt8nrL47QIxPoT68VlTipIyavoXCREMRjGxA5mlf6Zj4KFEoUpXA MJyfqDhMRKj9e2Hiw1H8izpQ/kQtkFQVEjal++UvKwT8333RSkDFF/G78f1qf9bsST6UBa bdEzfSkyqj2SELihEX22ryR5G2tWzZMETuRVff1MaTyBdoMtHPAmVH0h8t0l165eU0DPs7 U9P9h0PKqqxlHComW92T7ByjeKQkMIAYN97zEn3C1WhnTYI87zPE50FdtzHkGZ0BpZpgxQ JE7CF9ae2joTiSwauclAzbzop+6gzDJ9WUUr4MVx5odC8Khwr7YXzZtUU+iT1Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737649265; a=rsa-sha256; cv=none; b=juhbO9UNBFZVIulH7xm+IeP7Xg8ey2IX6Cyly6kbBQ5bGSt5TygNxb4UpwOA3i71n9WDv0 gB2zw6KjKdS++w6Fu1Lr2dD6JITZl8UMYcHkDlD6NWznBsGlUnmlZNCn8Xl4R3bJvxbyGN mJo5nbiNHDy8rRDJuR9U9YmyxaQpsxbDZrlYzjQb4pFcgyGwI35BXOplZhgPEXaWGAoIGJ zPPMa+eeC2Cg8+FcWeWcuoDXbw/rnKIUiH8zR9OIQGmO+a+FuBLY60z11IdGkJrlImSBEl Iqm37mXaN/+8q0sDmKSrl27xyZsBjZD3pWE7MjQyCD/dj9sfchmSn37cZjSg/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf5m11kQ1zmSc; Thu, 23 Jan 2025 16:21: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 50NGL5bL001060; Thu, 23 Jan 2025 16:21:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NGL5Td001057; Thu, 23 Jan 2025 16:21:05 GMT (envelope-from git) Date: Thu, 23 Jan 2025 16:21:05 GMT Message-Id: <202501231621.50NGL5Td001057@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: e51036fbf3f8 - main - gvinum(8): Remove userland tool for managing vinum volumes 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e51036fbf3f896e8802ed0a5ef06ae1bcd7c0737 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e51036fbf3f896e8802ed0a5ef06ae1bcd7c0737 commit e51036fbf3f896e8802ed0a5ef06ae1bcd7c0737 Author: John Baldwin AuthorDate: 2025-01-23 15:32:49 +0000 Commit: John Baldwin CommitDate: 2025-01-23 16:20:43 +0000 gvinum(8): Remove userland tool for managing vinum volumes Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D48542 --- ObsoleteFiles.inc | 4 + sbin/Makefile | 1 - sbin/geom/core/geom.8 | 3 - sbin/gvinum/Makefile | 13 - sbin/gvinum/Makefile.depend | 18 - sbin/gvinum/gvinum.8 | 460 ---------- sbin/gvinum/gvinum.c | 1450 ------------------------------- sbin/gvinum/gvinum.h | 41 - targets/pseudo/userland/Makefile.depend | 1 - 9 files changed, 4 insertions(+), 1987 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index afb71c46a459..eea25cc2e489 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20250123: Remove gvinum(8) +OLD_FILES+=sbin/gvinum +OLD_FILES+=usr/share/man/man8/gvinum.8.gz + # 20250122: Remove publickey(5) stuff OLD_FILES+=usr/bin/chkey OLD_FILES+=usr/bin/keylogin diff --git a/sbin/Makefile b/sbin/Makefile index 5e5a8943c67a..ef953e80ba1e 100644 --- a/sbin/Makefile +++ b/sbin/Makefile @@ -24,7 +24,6 @@ SUBDIR=adjkerntz \ geom \ ggate \ growfs \ - gvinum \ ifconfig \ init \ kldconfig \ diff --git a/sbin/geom/core/geom.8 b/sbin/geom/core/geom.8 index 7f0f0b2911b3..b864b3b238f5 100644 --- a/sbin/geom/core/geom.8 +++ b/sbin/geom/core/geom.8 @@ -168,8 +168,6 @@ STRIPE .It UNION .It -VINUM (deprecated) -.It VIRSTOR .El .Sh ENVIRONMENT @@ -221,7 +219,6 @@ geom md unload .Xr gshsec 8 , .Xr gstripe 8 , .Xr gunion 8 , -.Xr gvinum 8 , .Xr gvirstor 8 .Sh HISTORY The diff --git a/sbin/gvinum/Makefile b/sbin/gvinum/Makefile deleted file mode 100644 index 7e7066964514..000000000000 --- a/sbin/gvinum/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -PACKAGE=geom -PROG= gvinum -SRCS= gvinum.c gvinum.h geom_vinum_share.c -MAN= gvinum.8 - -WARNS?= 2 -CFLAGS+= -I${SRCTOP}/sys -I${SYSROOT:U${DESTDIR}}/${INCLUDEDIR}/edit - -LIBADD= edit geom - -.PATH: ${SRCTOP}/sys/geom/vinum - -.include diff --git a/sbin/gvinum/Makefile.depend b/sbin/gvinum/Makefile.depend deleted file mode 100644 index 8d1c78126db9..000000000000 --- a/sbin/gvinum/Makefile.depend +++ /dev/null @@ -1,18 +0,0 @@ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - include \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - lib/libedit \ - lib/libedit/readline \ - lib/libgeom \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/sbin/gvinum/gvinum.8 b/sbin/gvinum/gvinum.8 deleted file mode 100644 index e861681203c6..000000000000 --- a/sbin/gvinum/gvinum.8 +++ /dev/null @@ -1,460 +0,0 @@ -.\" Copyright (c) 2005 Chris Jones -.\" All rights reserved. -.\" -.\" This software was developed for the FreeBSD Project by Chris Jones -.\" thanks to the support of Google's Summer of Code program and -.\" mentoring by Lukas Ertl. -.\" -.\" 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 January 23, 2025 -.Dt GVINUM 8 -.Os -.Sh NAME -.Nm gvinum -.Nd Logical Volume Manager control program -.Sh DEPRECATION NOTICE -.Nm -and associated -.Xr geom 4 -kernel support is deprecated, and is not be available in -.Fx 15.0 -and later. -Users are advised to migrate to -.Xr gconcat 8 , -.Xr gmirror 8 , -.Xr gstripe 8 , -.Xr graid 8 , -or -.Xr zfs 8 . -More information is available at -.Pa https://wiki.freebsd.org/DeprecationPlan/gvinum . -.Sh SYNOPSIS -.Nm -.Op Ar command -.Op Fl options -.Sh COMMANDS -.Bl -tag -width indent -.It Ic attach Ar plex volume Op Cm rename -.It Ic attach Ar subdisk plex Oo Ar offset Oc Op Cm rename -Attach a plex to a volume, or a subdisk to a plex. -If offset is specified, the subdisk will be attached to the given offset within -the plex. -If rename is specified, the subdisk or plex will change name according to the -object it attaches to. -.It Ic checkparity Oo Fl f Oc Ar plex -Check the parity blocks of a RAID-5 plex. -The parity check will start at the -beginning of the plex if the -.Fl f -flag is specified, or otherwise at the location of the parity check pointer, -the first location at which plex's parity is incorrect. -All subdisks in the -plex must be up for a parity check. -.It Ic concat Oo Fl fv Oc Oo Fl n Ar name Oc Ar drives -Create a concatenated volume from the specified drives. -If no name is specified, a unique name will be set by -.Ic gvinum . -.It Ic create Oo Fl f Oc Op Ar description-file -Create a volume as described in -.Ar description-file . -If no -.Ar description-file -provided, opens an editor and provides the current -.Nm -configuration for editing. -The -.Fl f -flag will make gvinum ignore any errors regarding creating objects that already -exists. -However, in contrast to vinum, objects that are not properly named in the -.Ar description-file -will not be created when the -.Fl f -flag is given. -.It Ic detach Oo Fl f Oc Op Ar plex | subdisk -Detach a plex or subdisk from the volume or plex to which it is -attached. -.It Ic grow Ar plex device -Grow a plex by creating a gvinum drive and subdisk on device and attach it to -the plex. -If required by the plex organization, it will be put into the growable state. -.It Ic help -Provides a synopsis of -.Nm -commands and arguments. -.It Ic l | list Oo Fl rvV Oc Op Ar volume | plex | subdisk -.It Ic ld Oo Fl rvV Oc Op Ar drive ... -.It Ic ls Oo Fl rvV Oc Op Ar subdisk ... -.It Ic lp Oo Fl rvV Oc Op Ar plex ... -.It Ic lv Oo Fl rvV Oc Op Ar volume ... -List information about the relevant object(s). -The -.Fl r -flag provides recursive display, showing each object's subordinate objects in -proper relation. -The -.Fl v -and -.Fl V -flags provide progressively more detailed output. -.It Ic mirror Oo Fl fsv Oc Oo Fl n Ar name Oc Ar drives -Create a mirrored volume from the specified drives. -It requires at least a multiple of 2 drives. -If no name is specified, a unique name will be set by gvinum. -If the -.Fl s -flag is specified, a striped mirror will be created, and thus requires a -multiple of 4 drives. -.It Ic move | mv Fl f Ar drive subdisk Op Ar ... -Move the subdisk(s) to the specified drive. -The -.Fl f -flag is required, as all data on the indicated subdisk(s) will be destroyed as -part of the move. -This can currently only be done when the subdisk is -not being accessed. -.Pp -If a single subdisk is moved, and it forms a part of a RAID-5 plex, the moved -subdisks will need to be set to the -.Dq stale -state, and the plex will require a -.Ic start -command. -If multiple subdisk(s) is moved, and form part of a RAID-5 plex, the -moved disk(s) will need to be set to the -.Dq up -state and the plex will require a -.Ic rebuildparity -command. -If the subdisk(s) form part of a plex that is mirrored with other -plexes, the plex will require restarting and will sync once restarted. -Moving -more than one subdisk in a RAID-5 plex or subdisks from both sides of a -mirrored plex volume will destroy data. -Note that parity rebuilds and syncing -must be started manually after a move. -.It Ic printconfig -Write a copy of the current configuration to standard output. -.It Ic quit -Exit -.Nm -when running in interactive mode. -Normally this would be done by entering the -EOF character. -.It Ic raid5 Oo Fl fv Oc Oo Fl s Ar stripesize Oc Oo Fl n Ar name Oc Ar drives -Create a RAID-5 volume from the specified drives. -If no name is specified, a unique name will be set by -.Ic gvinum . -This organization requires at least three drives. -.It Ic rename Oo Fl r Oc Ar drive | subdisk | plex | volume newname -Change the name of the specified object. -The -.Fl r -flag will recursively rename subordinate objects. -.Pp -Note that device nodes will not be renamed until -.Nm -is restarted. -.It Ic rebuildparity Oo Fl f Oc Ar plex -Rebuild the parity blocks of a RAID-5 plex. -The parity rebuild will start at -the beginning of the plex if the -.Fl f -flag is specified, or otherwise at the location of the parity check pointer. -All subdisks in the plex must be up for a parity check. -.It Ic resetconfig Oo Fl f Oc -Reset the complete -.Nm -configuration. -.It Ic rm Oo Fl r Oc Ar volume | plex | subdisk -Remove an object and, if -.Fl r -is specified, its subordinate objects. -.It Ic saveconfig -Save -.Nm -configuration to disk after configuration failures. -.It Ic setstate Oo Fl f Oc Ar state volume | plex | subdisk | drive -Set state without influencing other objects, for diagnostic purposes -only. -The -.Fl f -flag forces state changes regardless of whether they are legal. -.It Ic start -Read configuration from all vinum drives. -.It Ic start Oo Fl S Ar size Oc Ar volume | plex | subdisk -Allow the system to access the objects. -If necessary, plexes will be synced and rebuilt. -If a subdisk was added to a running RAID-5 or striped plex, gvinum will -expand into this subdisk and grow the whole RAID-5 array. -This can be done without unmounting your filesystem. -The -.Fl S -flag is currently ignored. -.It Ic stop Oo Fl f Oc Op Ar volume | plex | subdisk -Terminate access to the objects, or stop -.Nm -if no parameters are specified. -.It Ic stripe Oo Fl fv Oc Oo Fl n Ar name Oc Ar drives -Create a striped volume from the specified drives. -If no name is specified, a unique name will be set by -.Ic gvinum . -This organization requires at least two drives. -.El -.Sh DESCRIPTION -The -.Nm -utility communicates with the kernel component of the GVinum logical volume -manager. -It is designed either for interactive use, when started without -command line arguments, or to execute a single command if the command is -supplied on the command line. -In interactive mode, -.Nm -maintains a command line history. -.Sh OPTIONS -The -.Nm -commands may be followed by an option. -.Bl -tag -width indent -.It Fl f -The -.Fl f -.Pq Dq force -option overrides safety checks. -It should be used with extreme caution. -This -option is required in order to use the -.Ic move -command. -.It Fl r -The -.Fl r -.Pq Dq recursive -option applies the command recursively to subordinate objects. -For example, in -conjunction with the -.Ic lv -command, the -.Fl r -option will also show information about the plexes and subdisks belonging to -the volume. -It is also used by the -.Ic rename -command to indicate that subordinate objects such as subdisks should be renamed -to match the object(s) specified and by the -.Ic rm -command to delete plexes belonging to a volume and so on. -.It Fl v -The -.Fl v -.Pq Dq verbose -option provides more detailed output. -.It Fl V -The -.Fl V -.Pq Dq "very verbose" -option provides even more detailed output than -.Fl v . -.El -.Sh ENVIRONMENT -.Bl -tag -width ".Ev EDITOR" -.It Ev EDITOR -The name of the editor to use for editing configuration files, by -default -.Xr vi 1 -is invoked. -.El -.Sh FILES -.Bl -tag -width ".Pa /dev/gvinum/plex" -.It Pa /dev/gvinum -directory with device nodes for -.Nm -objects -.El -.Sh EXAMPLES -To create a mirror on disks /dev/ada1 and /dev/ada2, create a filesystem, -mount, unmount and then stop -.Ic gvinum : -.Pp -.Dl "gvinum mirror /dev/ada1 /dev/ada2" -.Dl "newfs /dev/gvinum/gvinumvolume0" -.Dl "mount /dev/gvinum/gvinumvolume0 /mnt" -.Dl "..." -.Dl "unmount /mnt" -.Dl "gvinum stop" -.Pp -To create a striped mirror on disks /dev/ada1 /dev/ada2 /dev/ada3 and -/dev/ada4 named "data" and create a filesystem: -.Pp -.Dl "gvinum mirror -s -n data /dev/ada1 /dev/ada2 /dev/ada3 /dev/ada4" -.Dl "newfs /dev/gvinum/data" -.Pp -To create a raid5 array on disks /dev/ada1 /dev/ada2 and /dev/ada3, -with stripesize 493k you can use the raid5 command: -.Pp -.Dl "gvinum raid5 -s 493k /dev/ada1 /dev/ada2 /dev/ada3" -.Pp -Then the volume will be created automatically. -Afterwards, you have to initialize the volume: -.Pp -.Dl "gvinum start myraid5vol" -.Pp -The initialization will start, and the states will be updated when it's -finished. -The list command will give you information about its progress. -.Pp -Imagine that one of the drives fails, and the output of 'printconfig' looks -something like this: -.Pp -.Dl "drive gvinumdrive1 device /dev/ada2" -.Dl "drive gvinumdrive2 device /dev/???" -.Dl "drive gvinumdrive0 device /dev/ada1" -.Dl "volume myraid5vol" -.Dl "plex name myraid5vol.p0 org raid5 986s vol myraid5vol" -.Dl "sd name myraid5vol.p0.s2 drive gvinumdrive2 len 32538s driveoffset 265s" -.Dl "plex myraid5vol.p0 plexoffset 1972s" -.Dl "sd name myraid5vol.p0.s1 drive gvinumdrive1 len 32538s driveoffset 265s" -.Dl "plex myraid5vol.p0 plexoffset 986s" -.Dl "sd name myraid5vol.p0.s0 drive gvinumdrive0 len 32538s driveoffset 265s" -.Dl "plex myraid5vol.p0 plexoffset 0s" -.Pp -Create a new drive with this configuration: -.Pp -.Dl "drive gdrive4 device /dev/ada4" -.Pp -Then move the stale subdisk to the new drive: -.Pp -.Dl "gvinum move gdrive4 myraid5vol.p0.s2" -.Pp -Then, initiate the rebuild: -.Pp -.Dl "gvinum start myraid5vol.p0" -.Pp -The plex will go up from degraded mode after the rebuild is finished. -The plex can still be used while the rebuild is in progress, although requests -might be delayed. -.Pp -Given the configuration as in the previous example, growing a RAID-5 or STRIPED -array is accomplished by using the grow command: -.Pp -.Dl "gvinum grow myraid5vol.p0 /dev/ada4" -.Pp -If everything went ok, the plex state should now be set to growable. -You can then start the growing with the -.Ic start -command: -.Pp -.Dl "gvinum start myraid5vol.p0" -.Pp -As with rebuilding, you can watch the progress using the -.Ic list -command. -.Pp -For a more advanced usage and detailed explanation of gvinum, the -handbook is recommended. -.Sh SEE ALSO -.Xr geom 4 , -.Xr geom 8 -.Sh HISTORY -The -.Nm -utility first appeared in -.Fx 5.3 . -The -.Nm vinum -utility, on which -.Nm -is based, was written by -.An "Greg Lehey" . -.Pp -The -.Nm -utility -was written by -.An "Lukas Ertl" . -The -.Ic move -and -.Ic rename -commands and -documentation were added by -.An "Chris Jones" -through the 2005 Google Summer -of Code program. -A partial rewrite of gvinum was done by -.An "Lukas Ertl" -and -.An "Ulf Lilleengen" -through the 2007 Google Summer of Code program. -The documentation have been updated to reflect the new functionality. -.Sh AUTHORS -.An Lukas Ertl Aq Mt le@FreeBSD.org -.An Chris Jones Aq Mt soc-cjones@FreeBSD.org -.An Ulf Lilleengen Aq Mt lulf@FreeBSD.org -.Sh BUGS -Currently, -.Nm -does not rename devices in -.Pa /dev/gvinum -until reloaded. -.Pp -The -.Fl S -initsize flag to -.Ic start -is ignored. -.Pp -Moving subdisks that are not part of a mirrored or RAID-5 volume will -destroy data. -It is perhaps a bug to permit this. -.Pp -Plexes in which subdisks have been moved do not automatically sync or -rebuild parity. -This may leave data unprotected and is perhaps unwise. -.Pp -Currently, -.Nm -does not yet fully implement all of the functions found in -.Nm vinum . -Specifically, the following commands from -.Nm vinum -are not supported: -.Bl -tag -width indent -.It Ic debug -Cause the volume manager to enter the kernel debugger. -.It Ic debug Ar flags -Set debugging flags. -.It Ic dumpconfig Op Ar drive ... -List the configuration information stored on the specified drives, or all -drives in the system if no drive names are specified. -.It Ic info Op Fl vV -List information about volume manager state. -.It Ic label Ar volume -Create a volume label. -.It Ic resetstats Oo Fl r Oc Op Ar volume | plex | subdisk -Reset statistics counters for the specified objects, or for all objects if none -are specified. -.It Ic setdaemon Op Ar value -Set daemon configuration. -.El diff --git a/sbin/gvinum/gvinum.c b/sbin/gvinum/gvinum.c deleted file mode 100644 index c391f5d61c65..000000000000 --- a/sbin/gvinum/gvinum.c +++ /dev/null @@ -1,1450 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2004 Lukas Ertl - * Copyright (c) 2005 Chris Jones - * Copyright (c) 2007 Ulf Lilleengen - * All rights reserved. - * - * Portions of this software were developed for the FreeBSD Project - * by Chris Jones thanks to the support of Google's Summer of Code - * program and mentoring by Lukas Ertl. - * - * 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 -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "gvinum.h" - -static void gvinum_attach(int, char * const *); -static void gvinum_concat(int, char * const *); -static void gvinum_create(int, char * const *); -static void gvinum_detach(int, char * const *); -static void gvinum_grow(int, char * const *); -static void gvinum_help(void); -static void gvinum_list(int, char * const *); -static void gvinum_move(int, char * const *); -static void gvinum_mirror(int, char * const *); -static void gvinum_parityop(int, char * const * , int); -static void gvinum_printconfig(int, char * const *); -static void gvinum_raid5(int, char * const *); -static void gvinum_rename(int, char * const *); -static void gvinum_resetconfig(int, char * const *); -static void gvinum_rm(int, char * const *); -static void gvinum_saveconfig(void); -static void gvinum_setstate(int, char * const *); -static void gvinum_start(int, char * const *); -static void gvinum_stop(int, char * const *); -static void gvinum_stripe(int, char * const *); -static void parseline(int, char * const *); -static void printconfig(FILE *, const char *); - -static char *create_drive(const char *); -static void create_volume(int, char * const * , const char *); -static char *find_name(const char *, int, int); -static const char *find_pattern(char *, const char *); -static void copy_device(struct gv_drive *, const char *); -#define find_drive() \ - find_name("gvinumdrive", GV_TYPE_DRIVE, GV_MAXDRIVENAME) - -int -main(int argc, char **argv) -{ - int tokens; - char buffer[BUFSIZ], *inputline, *token[GV_MAXARGS]; - - /* Load the module if necessary. */ - if (modfind(GVINUMMOD) < 0) { - if (kldload(GVINUMKLD) < 0 && modfind(GVINUMMOD) < 0) - err(1, GVINUMKLD ": Kernel module not available"); - } - - /* Arguments given on the command line. */ - if (argc > 1) { - argc--; - argv++; - parseline(argc, argv); - - /* Interactive mode. */ - } else { - for (;;) { - inputline = readline("gvinum -> "); - if (inputline == NULL) { - if (ferror(stdin)) { - err(1, "can't read input"); - } else { - printf("\n"); - exit(0); - } - } else if (*inputline) { - add_history(inputline); - strcpy(buffer, inputline); - free(inputline); - tokens = gv_tokenize(buffer, token, GV_MAXARGS); - if (tokens) - parseline(tokens, token); - } - } - } - exit(0); -} - -/* Attach a plex to a volume or a subdisk to a plex. */ -static void -gvinum_attach(int argc, char * const *argv) -{ - struct gctl_req *req; - const char *errstr; - int rename; - off_t offset; - - rename = 0; - offset = -1; - if (argc < 3) { - warnx("usage:\tattach [rename] " - "[]\n" - "\tattach [rename]"); - return; - } - if (argc > 3) { - if (!strcmp(argv[3], "rename")) { - rename = 1; - if (argc == 5) - offset = strtol(argv[4], NULL, 0); - } else - offset = strtol(argv[3], NULL, 0); - } - req = gctl_get_handle(); - gctl_ro_param(req, "class", -1, "VINUM"); - gctl_ro_param(req, "verb", -1, "attach"); - gctl_ro_param(req, "child", -1, argv[1]); - gctl_ro_param(req, "parent", -1, argv[2]); - gctl_ro_param(req, "offset", sizeof(off_t), &offset); - gctl_ro_param(req, "rename", sizeof(int), &rename); - errstr = gctl_issue(req); - if (errstr != NULL) - warnx("attach failed: %s", errstr); - gctl_free(req); -} - -static void -gvinum_create(int argc, char * const *argv) -{ - struct gctl_req *req; - struct gv_drive *d; - struct gv_plex *p; - struct gv_sd *s; - struct gv_volume *v; - FILE *tmp; - int drives, errors, fd, flags, i, line, plexes, plex_in_volume; - int sd_in_plex, status, subdisks, tokens, undeffd, volumes; - const char *errstr; - char buf[BUFSIZ], buf1[BUFSIZ], commandline[BUFSIZ], *sdname; - const char *ed; - char original[BUFSIZ], tmpfile[20], *token[GV_MAXARGS]; - char plex[GV_MAXPLEXNAME], volume[GV_MAXVOLNAME]; - - tmp = NULL; - flags = 0; - for (i = 1; i < argc; i++) { - /* Force flag used to ignore already created drives. */ - if (!strcmp(argv[i], "-f")) { - flags |= GV_FLAG_F; - /* Else it must be a file. */ - } else { - if ((tmp = fopen(argv[i], "r")) == NULL) { - warn("can't open '%s' for reading", argv[i]); - return; - } - } - } - - /* We didn't get a file. */ - if (tmp == NULL) { - snprintf(tmpfile, sizeof(tmpfile), "/tmp/gvinum.XXXXXX"); - - if ((fd = mkstemp(tmpfile)) == -1) { - warn("temporary file not accessible"); - return; - } - if ((tmp = fdopen(fd, "w")) == NULL) { - warn("can't open '%s' for writing", tmpfile); - return; - } - printconfig(tmp, "# "); - fclose(tmp); - - ed = getenv("EDITOR"); - if (ed == NULL) - ed = _PATH_VI; - - snprintf(commandline, sizeof(commandline), "%s %s", ed, - tmpfile); - status = system(commandline); - if (status != 0) { - warn("couldn't exec %s; status: %d", ed, status); - return; - } - - if ((tmp = fopen(tmpfile, "r")) == NULL) { - warn("can't open '%s' for reading", tmpfile); - return; - } - } - - req = gctl_get_handle(); - gctl_ro_param(req, "class", -1, "VINUM"); - gctl_ro_param(req, "verb", -1, "create"); - gctl_ro_param(req, "flags", sizeof(int), &flags); - - drives = volumes = plexes = subdisks = 0; - plex_in_volume = sd_in_plex = undeffd = 0; - plex[0] = '\0'; - errors = 0; - line = 1; - while ((fgets(buf, BUFSIZ, tmp)) != NULL) { - - /* Skip empty lines and comments. */ - if (*buf == '\0' || *buf == '#') { - line++; - continue; - } - - /* Kill off the newline. */ - buf[strlen(buf) - 1] = '\0'; - - /* - * Copy the original input line in case we need it for error - * output. - */ - strlcpy(original, buf, sizeof(original)); - - tokens = gv_tokenize(buf, token, GV_MAXARGS); - if (tokens <= 0) { - line++; - continue; - } - - /* Volume definition. */ - if (!strcmp(token[0], "volume")) { - v = gv_new_volume(tokens, token); - if (v == NULL) { - warnx("line %d: invalid volume definition", - line); - warnx("line %d: '%s'", line, original); - errors++; - line++; - continue; - } - - /* Reset plex count for this volume. */ - plex_in_volume = 0; - - /* - * Set default volume name for following plex - * definitions. - */ - strlcpy(volume, v->name, sizeof(volume)); - - snprintf(buf1, sizeof(buf1), "volume%d", volumes); - gctl_ro_param(req, buf1, sizeof(*v), v); - volumes++; - - /* Plex definition. */ - } else if (!strcmp(token[0], "plex")) { - p = gv_new_plex(tokens, token); - if (p == NULL) { - warnx("line %d: invalid plex definition", line); - warnx("line %d: '%s'", line, original); - errors++; - line++; - continue; - } - - /* Reset subdisk count for this plex. */ - sd_in_plex = 0; - - /* Default name. */ - if (strlen(p->name) == 0) { - snprintf(p->name, sizeof(p->name), "%s.p%d", - volume, plex_in_volume++); - } - - /* Default volume. */ - if (strlen(p->volume) == 0) { - snprintf(p->volume, sizeof(p->volume), "%s", - volume); - } - - /* - * Set default plex name for following subdisk - * definitions. - */ - strlcpy(plex, p->name, sizeof(plex)); - - snprintf(buf1, sizeof(buf1), "plex%d", plexes); - gctl_ro_param(req, buf1, sizeof(*p), p); - plexes++; - - /* Subdisk definition. */ - } else if (!strcmp(token[0], "sd")) { - s = gv_new_sd(tokens, token); - if (s == NULL) { - warnx("line %d: invalid subdisk " - "definition:", line); - warnx("line %d: '%s'", line, original); - errors++; - line++; - continue; - } - - /* Default name. */ - if (strlen(s->name) == 0) { - if (strlen(plex) == 0) { - sdname = find_name("gvinumsubdisk.p", - GV_TYPE_SD, GV_MAXSDNAME); - snprintf(s->name, sizeof(s->name), - "%s.s%d", sdname, undeffd++); - free(sdname); - } else { - snprintf(s->name, sizeof(s->name), - "%s.s%d",plex, sd_in_plex++); - } - } - - /* Default plex. */ - if (strlen(s->plex) == 0) - snprintf(s->plex, sizeof(s->plex), "%s", plex); - - snprintf(buf1, sizeof(buf1), "sd%d", subdisks); - gctl_ro_param(req, buf1, sizeof(*s), s); - subdisks++; - - /* Subdisk definition. */ - } else if (!strcmp(token[0], "drive")) { - d = gv_new_drive(tokens, token); - if (d == NULL) { - warnx("line %d: invalid drive definition:", - line); - warnx("line %d: '%s'", line, original); - errors++; - line++; - continue; - } - - snprintf(buf1, sizeof(buf1), "drive%d", drives); - gctl_ro_param(req, buf1, sizeof(*d), d); - drives++; - - /* Everything else is bogus. */ - } else { - warnx("line %d: invalid definition:", line); - warnx("line %d: '%s'", line, original); - errors++; - } - line++; - } - - fclose(tmp); - unlink(tmpfile); - - if (!errors && (volumes || plexes || subdisks || drives)) { - gctl_ro_param(req, "volumes", sizeof(int), &volumes); - gctl_ro_param(req, "plexes", sizeof(int), &plexes); - gctl_ro_param(req, "subdisks", sizeof(int), &subdisks); - gctl_ro_param(req, "drives", sizeof(int), &drives); *** 1112 LINES SKIPPED *** From nobody Thu Jan 23 16:21:06 2025 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 4Yf5m25BKCz5l8KL; Thu, 23 Jan 2025 16:21: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 4Yf5m22nj1z3snt; Thu, 23 Jan 2025 16:21:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737649266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cdwRJ15mmupKNV2CWa8LYt/RqDvWRysb6itBIJsHwJc=; b=s2kBPZk1ATXZVXZPe1/jNzygagKm1QYS9oSJb1RI3d9zhyO5vP8cWvqtLSgmPb+MsQIsGb d5OoGppmbiAKimvsZqjhm4wR93kB87o6lf1zWjvTdRp9aSemPU912Z4mdES5wxoru0w4yg g5xNJddGdh+holZ7QRMZLfYhG6yvVLbDJh/8isBVlU3hml1tKcewxJ24EyQUcGvhaKeTHj ss43C+6JI8r+EDHkwE+4xK4gf+whw0cSKBqfHB3vh+kzEACIzfWsN+lMgzi4JAozV+X2+4 WHAl8afjy/PqFrK8+lqpzV4ulUNfxGRzazACwQHUtfPUBDWgutpCeESCJXwGiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737649266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cdwRJ15mmupKNV2CWa8LYt/RqDvWRysb6itBIJsHwJc=; b=WKhbGFC6sASZfn/2EL2uj5DkJN/aHk39OUNifiQJMmdvZqPQXieme0Ke4nt8RBhKENWC0t ZUVJYCO3g1d3Xr9N+/puIFaOZESZsLlOGAiN4y3ViQ41z1rCs7h3c47s2viZa6ApakE76g DZKHBG8SZmdkOKIU5pMA2PujwpzphurUSSzLT+7pre8Ji6HcZHvO6aJZlQWU+K/Pl3XoS6 UKVMloJQXKOaaIkun65zmkN+aWm+sJRK7wLBp7zL+oNOYkbUD9+bm1KRdNPQZnci5Qr5Mn ucaFhe+fY5ik43hf8CKZ5cAAbCZdbz8HOpEXX0/vdPgemLRqh3OJHnyoBVHHOQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737649266; a=rsa-sha256; cv=none; b=thyu7kTj5CCQvXTs/WaEmI9yFgHXKqI5wBggMEceZ5ludEuWCRE4iIlgvvlFEjFvq9flaT GA5Zyw0CmJ7EvQ2WBomEnXYoNzTbgsnzJboe+XP6b5YqfC/z+izmJcpE7nEv7KwT6WTwUE mD15k/itbzU3t243jxVUDhIDj/amRfOsK2RsBrupeTbsU02vm7kXTHzH4E9sSdIGp3SXug 4Sl+IAeXwmj21aXOlzKb7wP2lsLF1AKN/L/TnXlpFJNBjVoIgxREVI2NhPog9KUhc5WgXc jvZcptBTGBwf79Zj49Q2qeqh8h7TBX0ZpjqjKJ4a8y2F+db4J068pll0kBaFuw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf5m22FDjzmkk; Thu, 23 Jan 2025 16:21: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 50NGL6ib001093; Thu, 23 Jan 2025 16:21:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NGL62S001090; Thu, 23 Jan 2025 16:21:06 GMT (envelope-from git) Date: Thu, 23 Jan 2025 16:21:06 GMT Message-Id: <202501231621.50NGL62S001090@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 2b12e6676a00 - main - fdisk: Remove support for vinum volumes 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2b12e6676a00a9360844d39516692753bf776e94 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2b12e6676a00a9360844d39516692753bf776e94 commit 2b12e6676a00a9360844d39516692753bf776e94 Author: John Baldwin AuthorDate: 2025-01-23 15:33:10 +0000 Commit: John Baldwin CommitDate: 2025-01-23 16:20:43 +0000 fdisk: Remove support for vinum volumes Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D48537 --- sbin/fdisk/fdisk.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index a2e1cdb76c6a..925cc68932d7 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -1472,7 +1472,6 @@ sanitize_partition(struct dos_partition *partp) * The following choices are considered: * /dev/ad0s1a => /dev/ad0 * /dev/da0a => /dev/da0 - * /dev/vinum/root => /dev/vinum/root * A ".eli" part is removed if it exists (see geli(8)). * A ".journal" ending is removed if it exists (see gjournal(8)). */ @@ -1489,7 +1488,7 @@ get_rootdisk(void) if (statfs("/", &rootfs) == -1) err(1, "statfs(\"/\")"); - if ((rv = regcomp(&re, "^(/dev/[a-z/]+[0-9]*)([sp][0-9]+)?[a-h]?(\\.journal)?$", + if ((rv = regcomp(&re, "^(/dev/[a-z/]+[0-9]+)([sp][0-9]+)?[a-h]?(\\.journal)?$", REG_EXTENDED)) != 0) errx(1, "regcomp() failed (%d)", rv); strlcpy(dev, rootfs.f_mntfromname, sizeof (dev)); From nobody Thu Jan 23 16:21:07 2025 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 4Yf5m35Sh6z5l8RM; Thu, 23 Jan 2025 16:21: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 4Yf5m33Wphz3slZ; Thu, 23 Jan 2025 16:21:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737649267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=f7Gj+hEhjPN/j+YhZWOHWfa8Oj7vWQV/RfRt+zBpqJs=; b=uUNqowIMGNIio84IlsPVPH/i4l10ZSXxYiOeHgp/v/pWfFZxYOqgNb9QnHjF1DqVOmNeZE X9zj9nXzu8Pt3Q8u8ZUjC8oATuJcrbHrnh9kIwtIRjOTcIFAuNFu45DC/2OTh6vLmhLH8O kdgRjJaQZX27QddX7Tj+5ZCTmtOCZGPuRAAZ7uqhFvIcIti/ypTJsSoKVyB2E1aXA5acbK Li8bPt9V1HTeja3q2z5GKDWd69gaXkHar/4X4cidV+1FZhUXKMI94jwaADKyrWPntx9sLV BX4wtbNIdI7OnBWUz/X6PoN1bsaOeUKlm3r6s0/dUuaOkSER3oi5+QwvG24JnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737649267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=f7Gj+hEhjPN/j+YhZWOHWfa8Oj7vWQV/RfRt+zBpqJs=; b=cWHbnXSK8VbbhRR2AQu/xv/B2NEotV7NUODI8h3nsI01Esr7fm3Ml9k34VUATB8Z8RusOX qxVKu5hdYbvkt0IcsSD7Hyzl1f2oY4lbVaU3iy2WuzPTLoVu0J6OzvA3vzPAJ0Mm8UXD1y sEXR58CjqJYE4H0CD42FkoLJUeNbgxZX/5fF0bkPYt9NLQrAe22Lwyeq+FbN28SPPaeaED uR0qAcY2eV14OhjGjEltx3yy5efF2b/pEwYVe51JLc6XTeYOjP6+mS8Th4vGfuj+L5lxLp w7C+mIsKtAWEXKCUCntcDgSJLo5EGce2zmqyUyf3uOIxilfTVBODfeq8dQZb1g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737649267; a=rsa-sha256; cv=none; b=YyzqGTCfe9wFnqjGhYlU/Cx/mZQ7OVxEqOMkdPDrxSDZ2FZ5pCdQmweTV8/iu2EDCwiYq2 SQq1JmWhPqC8Iljr4UktQaATaXwE2hkPMLPDFxNzH6+snwDo6FVRXouy8G89uBP28th35F 1uElSlhDJnwmQ5U85ZRcwVOrvZelag6m3QS9F5Hhb7rzzDFE/1SsnA5+y8D1731JpyFkzk tKVRNsquAAy+Gc23UAN6S5v53vVq8l/WYyQfuZE0YdyYerWHJYd3GWp2b6oJWV9eoqAlmG 2wmI6KUMeRKn5tspMn2Eeyv5djlcDLhwHaoMls6igRK/Z04ktGq4giEBbDtHHg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf5m32rpVzm0H; Thu, 23 Jan 2025 16:21: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 50NGL76t001136; Thu, 23 Jan 2025 16:21:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NGL7we001133; Thu, 23 Jan 2025 16:21:07 GMT (envelope-from git) Date: Thu, 23 Jan 2025 16:21:07 GMT Message-Id: <202501231621.50NGL7we001133@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 719747125bbb - main - ffsinfo: Remove support for vinum volumes 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 719747125bbbc91039ead3177a4360f502c8b1e0 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=719747125bbbc91039ead3177a4360f502c8b1e0 commit 719747125bbbc91039ead3177a4360f502c8b1e0 Author: John Baldwin AuthorDate: 2025-01-23 15:33:21 +0000 Commit: John Baldwin CommitDate: 2025-01-23 16:20:43 +0000 ffsinfo: Remove support for vinum volumes Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D48538 --- sbin/ffsinfo/ffsinfo.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/sbin/ffsinfo/ffsinfo.c b/sbin/ffsinfo/ffsinfo.c index f2b25e582bda..842d5c20bad0 100644 --- a/sbin/ffsinfo/ffsinfo.c +++ b/sbin/ffsinfo/ffsinfo.c @@ -186,27 +186,18 @@ main(int argc, char **argv) * No path prefix was given, so try in this order: * /dev/r%s * /dev/%s - * /dev/vinum/r%s - * /dev/vinum/%s. * - * FreeBSD now doesn't distinguish between raw and block + * FreeBSD now doesn't distinguish between raw and block * devices any longer, but it should still work this way. */ - len = strlen(device) + strlen(_PATH_DEV) + 2 + strlen("vinum/"); + len = strlen(device) + strlen(_PATH_DEV) + 2; special = (char *)malloc(len); if (special == NULL) errx(1, "malloc failed"); snprintf(special, len, "%sr%s", _PATH_DEV, device); if (stat(special, &st) == -1) { + /* For now this is the 'last resort' */ snprintf(special, len, "%s%s", _PATH_DEV, device); - if (stat(special, &st) == -1) { - snprintf(special, len, "%svinum/r%s", - _PATH_DEV, device); - if (stat(special, &st) == -1) - /* For now this is the 'last resort' */ - snprintf(special, len, "%svinum/%s", - _PATH_DEV, device); - } } device = special; } From nobody Thu Jan 23 16:21:08 2025 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 4Yf5m5176Rz5l8cp; Thu, 23 Jan 2025 16:21: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 4Yf5m45fRKz3slm; Thu, 23 Jan 2025 16:21:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737649268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pPJdRF8nMsbKbV/AjEocOdokri4EOaKy9ghCQfMYPqM=; b=GAWegc8WUSJy4Rh/ErpSd/5P/EsOsivnIXCyFb+4+T4FwRqpAIfOAGhKCqpe3jipfZdH8C 5q6HEGhCRs1MaZjX+LH2Nsw+ot2sk/AX+GQEqe4OqzqgRXyklaTEClyG0x0jdAzy/P6fHU odnXlLNjQna+CDtmGjMurw+842iNRNKPDK9McstT9yhGWFJUgPDwV8a8kEGa5YKF5JySPN /h3QDq1KfqPTDRGk0lAdaqvB4ydeXksClQtHEp16HUmwUNzjkzS4N2HzIu4EBzGvvb44sU GJVnuQPAbYoSR1hmQXvDSABtqipqlnbxhdV57+jPyY736Sy8eTjD9WkVmjHiGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737649268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pPJdRF8nMsbKbV/AjEocOdokri4EOaKy9ghCQfMYPqM=; b=YlQNgOk7ftRd2siqu0T7XmcAZu3nIvJNP92SVstjsi8btuodVszsIAxWypvsOEl/GMoqhS gMHiHIEZsGJimK6P+BV+yTDyn4PL9EZ0bZAF+akvbuDV52dFls77rW2h7S21OcMJYu9436 8gUjY6RuCT+KRcc2fJIxC0OHsWRqku/6ZdnyWLqn9YqblIrplN/QPZNiykYrcUvKwjT+R2 0dAgdQhghUX9CX7TpHRycKOCpUmCcpw0b2UlwwmVb5VHVH07sVGyMB/a4Kth8D/HJDPyUo qlz1kfr+BN1Qz0Nrus6hAhj2ySLSLiDrtXNgfWHTRHLnzzP9h+/kBug6dExYZQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737649268; a=rsa-sha256; cv=none; b=wTqnxzQKV5T+SMPdsZw6ulOR2AtpPwimleVzg+mnQc5BMxSc0VjAs1813AxNaWti38LqG6 AQYqT2ddN1ZbZSzgx96jOUZ+qt4zR5CLfkIdcbfRcVy6IqMjB0d289CxZdPm2DBgKjljQU gqQOGx7IQkIrfbKQO/C6SmqbNtg317ODkXsdx+UutwaJ2kLwYKeLsu0/oM470yhxgUGlZv D2FcW6qyXw2n/SDz7A+0qXF5/qFJxarjCHyb6VZ4gkmbhZ0RcooSbxna4SmPjjYXsizffH 0jxFvSxm6R8MVBbG33SrRD3nqEmxWTnhdWBSR5XabqbHgVfbbh2Q2dwhkK/rVA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf5m43X7lzmfZ; Thu, 23 Jan 2025 16:21: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 50NGL8LR001168; Thu, 23 Jan 2025 16:21:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NGL84t001165; Thu, 23 Jan 2025 16:21:08 GMT (envelope-from git) Date: Thu, 23 Jan 2025 16:21:08 GMT Message-Id: <202501231621.50NGL84t001165@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 63d7fcf2a0f4 - main - bsdlabel.8: Don't document how to create vinum partitions 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 63d7fcf2a0f48ea2510e46bb1347dbdd107fde69 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=63d7fcf2a0f48ea2510e46bb1347dbdd107fde69 commit 63d7fcf2a0f48ea2510e46bb1347dbdd107fde69 Author: John Baldwin AuthorDate: 2025-01-23 16:19:09 +0000 Commit: John Baldwin CommitDate: 2025-01-23 16:20:43 +0000 bsdlabel.8: Don't document how to create vinum partitions Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D48539 --- sbin/bsdlabel/bsdlabel.8 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sbin/bsdlabel/bsdlabel.8 b/sbin/bsdlabel/bsdlabel.8 index dcf8c7ccace7..abea59756aea 100644 --- a/sbin/bsdlabel/bsdlabel.8 +++ b/sbin/bsdlabel/bsdlabel.8 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 25, 2024 +.Dd January 23, 2025 .Dt BSDLABEL 8 .Os .Sh NAME @@ -324,8 +324,6 @@ file systems and .Xr ccd 4 partitions, use type .Cm 4.2BSD . -For Vinum drives, use type -.Cm vinum . Other common types are .Cm swap and From nobody Thu Jan 23 16:21:09 2025 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 4Yf5m60kDSz5l8KM; Thu, 23 Jan 2025 16:21: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 4Yf5m559x6z3sZC; Thu, 23 Jan 2025 16:21:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737649269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tkJ8TbVrF8biIfwJCXAnkDUSQsrVFQxGinNM4LS8/I4=; b=gnNzTPwwfBD3oTP87/x/K15n4dDmgXjs4madxQ+QfDENzKI5DZS9+S+Kk6whKh4rxM/dcD Z2rEs1/60/TOD8RtSE/nXcTYFCvHIlrJPUTPxkvNRFf2Di9s9mXLUgGXX+nKTcm7e/1Ld9 gCiGYCXVbLE/qnojoIIsBFRvGkNz9xFLYLRl+LrJW4OXfGNFjxJha5DbG6LoOWt4uH5q7S LnJ6/tVTHSjUxjELxB0mt4aYNEE7T45MCFMe5MSc13n4YSxDbMVzh5NSde8h1ZJ+hmPwMx Du0QUBApfDcq27dPjqI6o3stQoDTknHWwrgdo0RE6VTkSdZWjfjkKsEI9QZFtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737649269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tkJ8TbVrF8biIfwJCXAnkDUSQsrVFQxGinNM4LS8/I4=; b=C/XTZDNDhQKv+6tnf1SR8mxbCyWCjHHTv2E/QBSUorJcEwXICk9FeVO3Utl0pnoGusUgSs A1LAM9HjORFGgc1OQvBixVyoJrksxIIIR4SKeaNoTCAtmTRkr5br1q+LHzi2yY2Nh8P5ep SQD8ZDss6SDPYA6ageB4GcjWqa5uTekrVHU/FWRpIu1QF5vEUjOhKAAM2UkvCZi6S2KuXr cpBtu/rRcFF7glhUyQXS9kYm/7iImyoV7Y+2NBW4W2QFREkktPg3tvApjYn+RhIGPAPp94 daQ++8Xnxy4RnOkFZQmiVGRFkXRCq2PLpqHGth7Ro53D0tIV4Mwdn4HpsU93pw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737649269; a=rsa-sha256; cv=none; b=FScG2HCP3plp2LQWdFMpbo+2VLK9m+dy1qLww8cuK+kRL2LlYJ7nyV4YWG7oJGwx9TV/9C 1rQqYgCH78mEtmAoL8QFAgCiyLzY0Ok6xBY044GBMlXvJBRcANnAfM4WclALRNHgpeTo4t TF92Ni29i0oLABJy1aU/yx86zmwG0iUvX9N9Z8gIWaQdFuJ1Dc842JzN8SvQl6IhuEAPFi ml/a569dKKoBsdc1rTVxuE0fuSUq4JyfZZJbgq9fqn4oJWO2VSog+YJg4HJPVAWYOVfZuF dm/gU1d2ZXUfYFm0TLKHSxxCbf+EvZr70nhNfcQ9KiZ0FK3yap1TP5IwJW2MAA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf5m54mwhzm0J; Thu, 23 Jan 2025 16:21: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 50NGL9ca001200; Thu, 23 Jan 2025 16:21:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NGL9Be001197; Thu, 23 Jan 2025 16:21:09 GMT (envelope-from git) Date: Thu, 23 Jan 2025 16:21:09 GMT Message-Id: <202501231621.50NGL9Be001197@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 8432ddac21b3 - main - ccdconfig.8: Bump Dd for gvinum removal 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8432ddac21b3da5fa45b4f934e90e80deaa9cabf Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8432ddac21b3da5fa45b4f934e90e80deaa9cabf commit 8432ddac21b3da5fa45b4f934e90e80deaa9cabf Author: John Baldwin AuthorDate: 2025-01-23 16:20:01 +0000 Commit: John Baldwin CommitDate: 2025-01-23 16:20:43 +0000 ccdconfig.8: Bump Dd for gvinum removal --- sbin/ccdconfig/ccdconfig.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/ccdconfig/ccdconfig.8 b/sbin/ccdconfig/ccdconfig.8 index 55cda5b2b356..52bbfef20af6 100644 --- a/sbin/ccdconfig/ccdconfig.8 +++ b/sbin/ccdconfig/ccdconfig.8 @@ -27,7 +27,7 @@ .\" .\" $NetBSD: ccdconfig.8,v 1.4 1996/02/28 01:01:17 thorpej Exp $ .\" -.Dd March 22, 2024 +.Dd January 23, 2025 .Dt CCDCONFIG 8 .Os .Sh NAME From nobody Thu Jan 23 16:32:42 2025 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 4Yf61Q4Dw0z5l95K; Thu, 23 Jan 2025 16:32: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 4Yf61Q25Lhz3vlx; Thu, 23 Jan 2025 16:32:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737649962; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zZqq5zRIXmBnDS8CaY2/R2ZQRtQdF1Y8IE3uRGKIxzE=; b=lz9mzXygSDrm9a76AD0Cs7bkzzn6t2fc+U57rmv/MqkAi7qCpVp/T4sSLSlmW8W/J9elyl IFyTvzdTerSNPyXHyPsbi4mmIlb6g0jnYMpbl+QrcOtDDi4B280U8+CzYYRorx9F6VmQM3 4Mglb549ycOU1NbP6B18+GgR7wzkTpOhtvL9lUU5kvVZt8Y76jUUyxN5KXZDcmqyvOiBgg REQO0vbJuyzx5ubytmw6pPHAg6Dnwj2ubdDBHs5Q6O/gd1Vr3xbMIP4rpUz/szw9krNgLC ZjoByJgAkRDZh3J3A7cfhpUTzyG6pvqQr8YPkzLqQP0eQBW1vuzMoFa1XD0hjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737649962; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zZqq5zRIXmBnDS8CaY2/R2ZQRtQdF1Y8IE3uRGKIxzE=; b=cWpfRsEyQslb8fD+b5jVxBlFyjetQlltqC/ZkD6jTh3W2zKgagl7yjKDEmP1eqJQHr7zjL fHSV8e3al7OVujDldCLM6ndi7Rvj+vrkQhOSUcFiXU0xJvF/Xg3T/XbKtmcAj+c9Xv7Hpf ocg5+zQqhAL5sUAX9VLvn+gw/3qZhofy7+EVmPxYhzgBnZbVbC56OA3d8xO7hhkKs3kcWF OyXeMNWJEyU+6vXsffR6613lMLsI6CSyrvsXLNFTqzWBKIFNgvMzjnWx9f7pDjP+6mrY5X 1Mvhwof1fhmSevtVC570rt6XeVDFZTb8yRpWwIW0ZGv92IyscbpIW9/cPK7ShA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737649962; a=rsa-sha256; cv=none; b=OR1MlaqYnMRBqZVSkLH/PlZuEUEWaOB6cmKP68sAwkHTGc2PTC2csV/yUVI2SQhQrGfSnw 48EuCFJerPcL5HoUPKu5P11ACwpdB7Rg/StWcB7GkC/j5G3rvjvPQUfK9FrqfZ+IFjE9t3 GikxyM9M+/5w6KP4gNDCexZYclEd6JreMJI5A995iAsZLg2gP+o0tMUKcU+13NRamMFIHF C36JGu96sMjaJIHh01iO1N3nKI9nhnd9u+0Dx2h+MAM+Y2HnVv7R9ZsT5SBO1fW2AMmUXb O94oSg0SnpgD7C+la+r65yX0bNY6g+28bKlfBhy9o++g/J7M0oA0TPdSi1WPxQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf61Q1TmJzn8v; Thu, 23 Jan 2025 16:32: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 50NGWgCP026143; Thu, 23 Jan 2025 16:32:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NGWgHd026140; Thu, 23 Jan 2025 16:32:42 GMT (envelope-from git) Date: Thu, 23 Jan 2025 16:32:42 GMT Message-Id: <202501231632.50NGWgHd026140@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: 0e4167514fe3 - main - development.7: Add example for just kernel modules 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: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e4167514fe3894b288457f9c1edd8fb3237dfb8 Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=0e4167514fe3894b288457f9c1edd8fb3237dfb8 commit 0e4167514fe3894b288457f9c1edd8fb3237dfb8 Author: Alexander Ziaee AuthorDate: 2025-01-17 22:56:59 +0000 Commit: Alexander Ziaee CommitDate: 2025-01-23 16:32:03 +0000 development.7: Add example for just kernel modules Reported by: christos Reviewed by: carlavilla, christos Accepted by: christos (src), carlavilla (mentor) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D48507 --- share/man/man7/development.7 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/share/man/man7/development.7 b/share/man/man7/development.7 index eb5a57a464fc..1b875fb14bda 100644 --- a/share/man/man7/development.7 +++ b/share/man/man7/development.7 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 7, 2024 +.Dd January 19, 2025 .Dt DEVELOPMENT 7 .Os .Sh NAME @@ -152,6 +152,13 @@ cd src/bin/ls make clean all install .Ed .Pp +Rebuild and reinstall a single loadable kernel module, in this case +.Xr sound 4 : +.Bd -literal -offset indent +cd src/sys/modules/sound +make all install clean cleandepend KMODDIR=/boot/kernel +.Ed +.Pp Quickly rebuild and reinstall the kernel, only recompiling the files changed since last build; note that this will only work if the full kernel build has been completed in the past, not on a fresh source tree: From nobody Thu Jan 23 16:59:58 2025 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 4Yf6ct202bz5lC06; Thu, 23 Jan 2025 16:59: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 4Yf6ct1Vl7z40V5; Thu, 23 Jan 2025 16:59:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737651598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8zKQcFNeq/Mntua+AZEA9vLoCllQw/M8MXnEAPi6Xts=; b=B5raekGqhQAPjM14Muqzj+JY9cuf3P+oOuMbOw+mFtf2jVLlpgjZwqZ/ZpZYr+2dR9d30Q C5QwdiZ0FXMRH/C9G1Xe8r+ZsgiAESaSG1O6Vn6lsTaQzvkR+VdO8QSYVUHw2l/IkCbOmB XAbNnNdnrR4ml7bNSoSfOkPg7n1ULuPU1wZR0NUP+MfktCC8gUVg18qDV3+BUy/xpR3+4o RlBlY6Ur4acHXMSNucALCJxh+3zUYiNyYd70ErQ/E9oqQ/a1Hiodu1/wPLZ2rGNvfQmNfm waeeHrz6NNhQwjMlUjEWdLEx/99jesRgbKMPKUjEmxXuggXxgznqxjuskVGmLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737651598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8zKQcFNeq/Mntua+AZEA9vLoCllQw/M8MXnEAPi6Xts=; b=BCzsGT8SNz4xil/zAxjYuxhOV3HI61AeTHJaxJAzE+YKU/YUToir23eHvb3klkgcTVEVb9 j9O9gxKIz4WK6ye1yQg/wJFVRdrpJX/g3wSRwl2ZhHoK2zoL4o0ALd70wQHhjZ/6FFRZRJ 3faKOFIX7+hnzDZyrmeIGkiPaszF99P1nogxKFsaEHWukCl1gce8AwEOtfeOk56F+SqpBA kO+fp1o15OmV2c4vA4zM9X/hkKTg6VfimjiLqOY1LcHc8axnqSk/a9DTKBQy+I5H3JFbn9 JYwqcF3OpeOh9MO7zRwj1YSjHSPS/i4c5DX0JzFLYlOVaQmOuMckhpdARtv0WQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737651598; a=rsa-sha256; cv=none; b=kiiOXXOkCv2fpUwmP3Wn6xror0mtAgR43QLShlT6el4DVnGLxbiCT3RBWwBQnGpz+Hc8wh uer4QPzG3YXad+1LhLDqATMBUufI2YGwa0S33CTJVWLy2V18d+Q2uqfxTiysZSj8o1Dub8 7tuSc4R6Q9kzDEzIrVhpZHzB+R10417pEuuG0hASaDM4sb4On8trD9D/oHqfZ1OBPXaBkH Jcp+ZciO7nB+wEcCIaUUB/CfY+UyyY0UMOUBTChBUATv4o1K3vE0nM+UBl46AbBT7oujf8 9st0/HhgxVCUIBc6+ZH8psbNyD1IeNDvQmsxfWJ1eY4yUc4wHp0nA6+9tmxiPQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf6ct13bZznCn; Thu, 23 Jan 2025 16:59: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 50NGxw45065510; Thu, 23 Jan 2025 16:59:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NGxwM0065507; Thu, 23 Jan 2025 16:59:58 GMT (envelope-from git) Date: Thu, 23 Jan 2025 16:59:58 GMT Message-Id: <202501231659.50NGxwM0065507@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: 18c47eab727c - main - Revert "vm_phys: reduce touching of page->pool fields". Pho reports, and I have verified, that it sometimes crashes the kernel on the mmap41.sh stress test. 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: dougm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 18c47eab727c6ac6505cca981175b2a7a6e9630b Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=18c47eab727c6ac6505cca981175b2a7a6e9630b commit 18c47eab727c6ac6505cca981175b2a7a6e9630b Author: Doug Moore AuthorDate: 2025-01-23 16:57:23 +0000 Commit: Doug Moore CommitDate: 2025-01-23 16:57:23 +0000 Revert "vm_phys: reduce touching of page->pool fields". Pho reports, and I have verified, that it sometimes crashes the kernel on the mmap41.sh stress test. This reverts commit c669b08bd834553ec056e3987693f247b2ec0433. --- sys/vm/vm_kern.c | 2 +- sys/vm/vm_page.c | 97 ++++++++++++++++++++---------------------- sys/vm/vm_phys.c | 123 +++++++++++++++++++++++++---------------------------- sys/vm/vm_phys.h | 6 +-- sys/vm/vm_reserv.c | 35 +++++++-------- 5 files changed, 123 insertions(+), 140 deletions(-) diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 2b85dbde1dd6..86ab2529e27f 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -953,7 +953,7 @@ kmem_bootstrap_free(vm_offset_t start, vm_size_t size) vmd = vm_pagequeue_domain(m); vm_domain_free_lock(vmd); - vm_phys_free_pages(m, m->pool, 0); + vm_phys_free_pages(m, 0); vm_domain_free_unlock(vmd); vm_domain_freecnt_inc(vmd, 1); diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 961b32da6599..ba22c7f97f2f 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -572,7 +572,6 @@ vm_page_startup(vm_offset_t vaddr) #if defined(__i386__) && defined(VM_PHYSSEG_DENSE) long ii; #endif - int pool; #ifdef VM_FREEPOOL_LAZYINIT int lazyinit; #endif @@ -652,8 +651,6 @@ vm_page_startup(vm_offset_t vaddr) dump_add_page(pa); pa += PAGE_SIZE; } -#else - (void)pa; #endif /* * Compute the number of pages of memory that will be available for @@ -758,12 +755,9 @@ vm_page_startup(vm_offset_t vaddr) */ vm_phys_init(); - pool = VM_FREEPOOL_DEFAULT; #ifdef VM_FREEPOOL_LAZYINIT lazyinit = 1; TUNABLE_INT_FETCH("debug.vm.lazy_page_init", &lazyinit); - if (lazyinit) - pool = VM_FREEPOOL_LAZYINIT; #endif /* @@ -783,27 +777,48 @@ vm_page_startup(vm_offset_t vaddr) seg = &vm_phys_segs[segind]; /* - * Initialize pages not covered by phys_avail[], since they - * might be freed to the allocator at some future point, e.g., - * by kmem_bootstrap_free(). + * If lazy vm_page initialization is not enabled, simply + * initialize all of the pages in the segment. Otherwise, we + * only initialize: + * 1. Pages not covered by phys_avail[], since they might be + * freed to the allocator at some future point, e.g., by + * kmem_bootstrap_free(). + * 2. The first page of each run of free pages handed to the + * vm_phys allocator, which in turn defers initialization + * of pages until they are needed. + * This avoids blocking the boot process for long periods, which + * may be relevant for VMs (which ought to boot as quickly as + * possible) and/or systems with large amounts of physical + * memory. */ - startp = seg->start; - for (i = 0; phys_avail[i + 1] != 0; i += 2) { - if (startp >= seg->end) - break; - if (phys_avail[i + 1] < startp) - continue; - if (phys_avail[i] <= startp) { - startp = phys_avail[i + 1]; - continue; +#ifdef VM_FREEPOOL_LAZYINIT + if (lazyinit) { + startp = seg->start; + for (i = 0; phys_avail[i + 1] != 0; i += 2) { + if (startp >= seg->end) + break; + + if (phys_avail[i + 1] < startp) + continue; + if (phys_avail[i] <= startp) { + startp = phys_avail[i + 1]; + continue; + } + + m = vm_phys_seg_paddr_to_vm_page(seg, startp); + for (endp = MIN(phys_avail[i], seg->end); + startp < endp; startp += PAGE_SIZE, m++) { + vm_page_init_page(m, startp, segind, + VM_FREEPOOL_DEFAULT); + } } - m = vm_phys_seg_paddr_to_vm_page(seg, startp); - for (endp = MIN(phys_avail[i], seg->end); - startp < endp; startp += PAGE_SIZE, m++) { - vm_page_init_page(m, startp, segind, + } else +#endif + for (m = seg->first_page, pa = seg->start; + pa < seg->end; m++, pa += PAGE_SIZE) { + vm_page_init_page(m, pa, segind, VM_FREEPOOL_DEFAULT); } - } /* * Add the segment's pages that are covered by one of @@ -820,30 +835,16 @@ vm_page_startup(vm_offset_t vaddr) if (pagecount == 0) continue; - /* - * If lazy vm_page initialization is not enabled, simply - * initialize all of the pages in the segment covered by - * phys_avail. Otherwise, initialize only the first - * page of each run of free pages handed to the vm_phys - * allocator, which in turn defers initialization of - * pages until they are needed. - * - * This avoids blocking the boot process for long - * periods, which may be relevant for VMs (which ought - * to boot as quickly as possible) and/or systems with - * large amounts of physical memory. - */ m = vm_phys_seg_paddr_to_vm_page(seg, startp); - vm_page_init_page(m, startp, segind, pool); - if (pool == VM_FREEPOOL_DEFAULT) { - for (int j = 1; j < pagecount; j++) { - vm_page_init_page(&m[j], - startp + ptoa(j), segind, pool); - } +#ifdef VM_FREEPOOL_LAZYINIT + if (lazyinit) { + vm_page_init_page(m, startp, segind, + VM_FREEPOOL_LAZYINIT); } +#endif vmd = VM_DOMAIN(seg->domain); vm_domain_free_lock(vmd); - vm_phys_enqueue_contig(m, pool, pagecount); + vm_phys_enqueue_contig(m, pagecount); vm_domain_free_unlock(vmd); vm_domain_freecnt_inc(vmd, pagecount); vm_cnt.v_page_count += (u_int)pagecount; @@ -2340,7 +2341,6 @@ found: m->flags = flags; m->a.flags = 0; m->oflags = (object->flags & OBJ_UNMANAGED) != 0 ? VPO_UNMANAGED : 0; - m->pool = VM_FREEPOOL_DEFAULT; if ((req & (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)) == 0) m->busy_lock = VPB_CURTHREAD_EXCLUSIVE; else if ((req & VM_ALLOC_SBUSY) != 0) @@ -2558,7 +2558,6 @@ vm_page_alloc_contig_domain(vm_object_t object, vm_pindex_t pindex, int domain, m->ref_count = 1; m->a.act_count = 0; m->oflags = oflags; - m->pool = VM_FREEPOOL_DEFAULT; if (vm_page_iter_insert(&pages, m, object, pindex, mpred)) { if ((req & VM_ALLOC_WIRED) != 0) vm_wire_sub(npages); @@ -2656,7 +2655,6 @@ found: m->flags = (m->flags & PG_ZERO) | flags; m->a.flags = 0; m->oflags = VPO_UNMANAGED; - m->pool = VM_FREEPOOL_DIRECT; m->busy_lock = VPB_UNBUSIED; if ((req & VM_ALLOC_WIRED) != 0) { vm_wire_add(1); @@ -2805,7 +2803,6 @@ vm_page_alloc_noobj_contig_domain(int domain, int req, u_long npages, m->ref_count = 1; m->a.act_count = 0; m->oflags = VPO_UNMANAGED; - m->pool = VM_FREEPOOL_DIRECT; /* * Zero the page before updating any mappings since the page is @@ -2884,7 +2881,7 @@ vm_page_zone_release(void *arg, void **store, int cnt) vm_domain_free_lock(vmd); for (i = 0; i < cnt; i++) { m = (vm_page_t)store[i]; - vm_phys_free_pages(m, pgcache->pool, 0); + vm_phys_free_pages(m, 0); } vm_domain_free_unlock(vmd); vm_domain_freecnt_inc(vmd, cnt); @@ -3269,7 +3266,7 @@ unlock: do { MPASS(vm_page_domain(m) == domain); SLIST_REMOVE_HEAD(&free, plinks.s.ss); - vm_phys_free_pages(m, m->pool, 0); + vm_phys_free_pages(m, 0); cnt++; } while ((m = SLIST_FIRST(&free)) != NULL); vm_domain_free_unlock(vmd); @@ -4274,7 +4271,7 @@ vm_page_free_toq(vm_page_t m) return; } vm_domain_free_lock(vmd); - vm_phys_free_pages(m, m->pool, 0); + vm_phys_free_pages(m, 0); vm_domain_free_unlock(vmd); vm_domain_freecnt_inc(vmd, 1); } diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c index a8b40b004d86..cf1ed5818b2f 100644 --- a/sys/vm/vm_phys.c +++ b/sys/vm/vm_phys.c @@ -187,7 +187,7 @@ SYSCTL_INT(_vm, OID_AUTO, ndomains, CTLFLAG_RD, static void _vm_phys_create_seg(vm_paddr_t start, vm_paddr_t end, int domain); static void vm_phys_create_seg(vm_paddr_t start, vm_paddr_t end); static void vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, - int order, int pool, int tail); + int order, int tail); static bool __diagused vm_phys_pool_valid(int pool) @@ -391,12 +391,10 @@ sysctl_vm_phys_locality(SYSCTL_HANDLER_ARGS) #endif static void -vm_freelist_add(struct vm_freelist *fl, vm_page_t m, int order, int pool, - int tail) +vm_freelist_add(struct vm_freelist *fl, vm_page_t m, int order, int tail) { m->order = order; - m->pool = pool; if (tail) TAILQ_INSERT_TAIL(&fl[order].pl, m, listq); else @@ -689,7 +687,7 @@ vm_phys_register_domains(int ndomains __numa_used, */ static __inline void vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, int order, - int pool, int tail) + int tail) { vm_page_t m_buddy; @@ -699,20 +697,19 @@ vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, int order, KASSERT(m_buddy->order == VM_NFREEORDER, ("vm_phys_split_pages: page %p has unexpected order %d", m_buddy, m_buddy->order)); - vm_freelist_add(fl, m_buddy, oind, pool, tail); + vm_freelist_add(fl, m_buddy, oind, tail); } } static void -vm_phys_enq_chunk(struct vm_freelist *fl, vm_page_t m, int order, int pool, - int tail) +vm_phys_enq_chunk(struct vm_freelist *fl, vm_page_t m, int order, int tail) { KASSERT(order >= 0 && order < VM_NFREEORDER, ("%s: invalid order %d", __func__, order)); - vm_freelist_add(fl, m, order, pool, tail); + vm_freelist_add(fl, m, order, tail); #ifdef VM_FREEPOOL_LAZYINIT - if (__predict_false(pool == VM_FREEPOOL_LAZYINIT)) { + if (__predict_false(m->pool == VM_FREEPOOL_LAZYINIT)) { vm_page_t m_next; vm_paddr_t pa; int npages; @@ -741,8 +738,7 @@ vm_phys_enq_chunk(struct vm_freelist *fl, vm_page_t m, int order, int pool, * The physical page m's buddy must not be free. */ static void -vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool, - int tail) +vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail) { int order; @@ -758,7 +754,7 @@ vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool, order = ilog2(npages); KASSERT(order < VM_NFREEORDER, ("%s: order %d is out of range", __func__, order)); - vm_phys_enq_chunk(fl, m, order, pool, tail); + vm_phys_enq_chunk(fl, m, order, tail); m += 1 << order; npages -= 1 << order; } @@ -778,8 +774,7 @@ vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool, * parameter m. Otherwise, the physical page m's buddy must not be free. */ static vm_page_t -vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool, - int tail) +vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail) { int order; @@ -793,7 +788,7 @@ vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool, ("vm_phys_enq_range: page %p has unexpected order %d", m, m->order)); order = ffs(npages) - 1; - vm_phys_enq_chunk(fl, m, order, pool, tail); + vm_phys_enq_chunk(fl, m, order, tail); m += 1 << order; npages -= 1 << order; } @@ -801,30 +796,33 @@ vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool, } /* - * Complete initialization of a contiguous, power of two-sized set of physical - * pages. + * Set the pool for a contiguous, power of two-sized set of physical pages. * * If the pages currently belong to the lazy init pool, then the corresponding * page structures must be initialized. In this case it is assumed that the * first page in the run has already been initialized. */ static void -vm_phys_finish_init(vm_page_t m, int order) +vm_phys_set_pool(int pool, vm_page_t m, int order) { #ifdef VM_FREEPOOL_LAZYINIT if (__predict_false(m->pool == VM_FREEPOOL_LAZYINIT)) { vm_paddr_t pa; int segind; + m->pool = pool; + TSENTER(); pa = m->phys_addr + PAGE_SIZE; segind = m->segind; for (vm_page_t m_tmp = m + 1; m_tmp < &m[1 << order]; m_tmp++, pa += PAGE_SIZE) - vm_page_init_page(m_tmp, pa, segind, VM_NFREEPOOL); + vm_page_init_page(m_tmp, pa, segind, pool); TSEXIT(); - } + } else #endif + for (vm_page_t m_tmp = m; m_tmp < &m[1 << order]; m_tmp++) + m_tmp->pool = pool; } /* @@ -835,8 +833,7 @@ vm_phys_finish_init(vm_page_t m, int order) * The returned pages may not be physically contiguous. However, in contrast * to performing multiple, back-to-back calls to vm_phys_alloc_pages(..., 0), * calling this function once to allocate the desired number of pages will - * avoid wasted time in vm_phys_split_pages(). The allocated pages have no - * valid pool field set. + * avoid wasted time in vm_phys_split_pages(). * * The free page queues for the specified domain must be locked. */ @@ -872,8 +869,7 @@ vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[]) * Return excess pages to fl. Its order * [0, oind) queues are empty. */ - vm_phys_enq_range(m, avail - i, fl, - pool, 1); + vm_phys_enq_range(m, avail - i, fl, 1); return (npages); } } @@ -885,7 +881,7 @@ vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[]) while ((m = TAILQ_FIRST(&alt[oind].pl)) != NULL) { vm_freelist_rem(alt, m, oind); - vm_phys_finish_init(m, oind); + vm_phys_set_pool(pool, m, oind); avail = i + (1 << oind); end = imin(npages, avail); while (i < end) @@ -897,7 +893,7 @@ vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[]) * are empty. */ vm_phys_enq_range(m, avail - i, - fl, pool, 1); + fl, 1); return (npages); } } @@ -944,7 +940,7 @@ vm_phys_alloc_freelist_pages(int domain, int freelist, int pool, int order) if (m != NULL) { vm_freelist_rem(fl, m, oind); /* The order [order, oind) queues are empty. */ - vm_phys_split_pages(m, oind, fl, order, pool, 1); + vm_phys_split_pages(m, oind, fl, order, 1); return (m); } } @@ -961,9 +957,9 @@ vm_phys_alloc_freelist_pages(int domain, int freelist, int pool, int order) m = TAILQ_FIRST(&alt[oind].pl); if (m != NULL) { vm_freelist_rem(alt, m, oind); - vm_phys_finish_init(m, oind); + vm_phys_set_pool(pool, m, oind); /* The order [order, oind) queues are empty. */ - vm_phys_split_pages(m, oind, fl, order, pool, 1); + vm_phys_split_pages(m, oind, fl, order, 1); return (m); } } @@ -1202,12 +1198,11 @@ vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_paddr_t end) /* * Free a contiguous, power of two-sized set of physical pages. - * The pool field in the first page determines the destination pool. * * The free page queues must be locked. */ void -vm_phys_free_pages(vm_page_t m, int pool, int order) +vm_phys_free_pages(vm_page_t m, int order) { struct vm_freelist *fl; struct vm_phys_seg *seg; @@ -1215,12 +1210,13 @@ vm_phys_free_pages(vm_page_t m, int pool, int order) vm_page_t m_buddy; KASSERT(m->order == VM_NFREEORDER, - ("%s: page %p has unexpected order %d", - __func__, m, m->order)); - KASSERT(vm_phys_pool_valid(pool), - ("%s: unexpected pool param %d", __func__, pool)); + ("vm_phys_free_pages: page %p has unexpected order %d", + m, m->order)); + KASSERT(vm_phys_pool_valid(m->pool), + ("vm_phys_free_pages: page %p has unexpected pool %d", + m, m->pool)); KASSERT(order < VM_NFREEORDER, - ("%s: order %d is out of range", __func__, order)); + ("vm_phys_free_pages: order %d is out of range", order)); seg = &vm_phys_segs[m->segind]; vm_domain_free_assert_locked(VM_DOMAIN(seg->domain)); if (order < VM_NFREEORDER - 1) { @@ -1234,14 +1230,15 @@ vm_phys_free_pages(vm_page_t m, int pool, int order) break; fl = (*seg->free_queues)[m_buddy->pool]; vm_freelist_rem(fl, m_buddy, order); - vm_phys_finish_init(m_buddy, order); + if (m_buddy->pool != m->pool) + vm_phys_set_pool(m->pool, m_buddy, order); order++; pa &= ~(((vm_paddr_t)1 << (PAGE_SHIFT + order)) - 1); m = vm_phys_seg_paddr_to_vm_page(seg, pa); } while (order < VM_NFREEORDER - 1); } - fl = (*seg->free_queues)[pool]; - vm_freelist_add(fl, m, order, pool, 1); + fl = (*seg->free_queues)[m->pool]; + vm_freelist_add(fl, m, order, 1); } #ifdef VM_FREEPOOL_LAZYINIT @@ -1293,13 +1290,12 @@ vm_phys_lazy_init_domain(int domain, bool locked) VM_ALLOC_NORMAL, 1 << oind); if (unlocked) vm_domain_free_unlock(vmd); - vm_phys_finish_init(m, oind); + vm_phys_set_pool(VM_FREEPOOL_DEFAULT, m, oind); if (unlocked) { vm_domain_freecnt_inc(vmd, 1 << oind); vm_domain_free_lock(vmd); } - vm_phys_free_pages(m, VM_FREEPOOL_DEFAULT, - oind); + vm_phys_free_pages(m, oind); } } } @@ -1348,12 +1344,12 @@ SYSINIT(vm_phys_lazy_init, SI_SUB_SMP, SI_ORDER_ANY, vm_phys_lazy_sysinit, /* * Free a contiguous, arbitrarily sized set of physical pages, without - * merging across set boundaries. Assumes no pages have a valid pool field. + * merging across set boundaries. * * The free page queues must be locked. */ void -vm_phys_enqueue_contig(vm_page_t m, int pool, u_long npages) +vm_phys_enqueue_contig(vm_page_t m, u_long npages) { struct vm_freelist *fl; struct vm_phys_seg *seg; @@ -1367,15 +1363,14 @@ vm_phys_enqueue_contig(vm_page_t m, int pool, u_long npages) */ vm_domain_free_assert_locked(vm_pagequeue_domain(m)); seg = &vm_phys_segs[m->segind]; - fl = (*seg->free_queues)[pool]; + fl = (*seg->free_queues)[m->pool]; m_end = m + npages; /* Free blocks of increasing size. */ lo = atop(VM_PAGE_TO_PHYS(m)); if (m < m_end && (diff = lo ^ (lo + npages - 1)) != 0) { order = min(ilog2(diff), VM_NFREEORDER - 1); - m = vm_phys_enq_range(m, roundup2(lo, 1 << order) - lo, fl, - pool, 1); + m = vm_phys_enq_range(m, roundup2(lo, 1 << order) - lo, fl, 1); } /* Free blocks of maximum size. */ @@ -1384,22 +1379,20 @@ vm_phys_enqueue_contig(vm_page_t m, int pool, u_long npages) KASSERT(seg == &vm_phys_segs[m->segind], ("%s: page range [%p,%p) spans multiple segments", __func__, m_end - npages, m)); - vm_phys_enq_chunk(fl, m, order, pool, 1); + vm_phys_enq_chunk(fl, m, order, 1); m += 1 << order; } /* Free blocks of diminishing size. */ - vm_phys_enq_beg(m, m_end - m, fl, pool, 1); + vm_phys_enq_beg(m, m_end - m, fl, 1); } /* * Free a contiguous, arbitrarily sized set of physical pages. - * Assumes that every page but the first has no valid pool field. - * Uses the pool value in the first page if valid, otherwise default. * * The free page queues must be locked. */ void -vm_phys_free_contig(vm_page_t m, int pool, u_long npages) +vm_phys_free_contig(vm_page_t m, u_long npages) { vm_paddr_t lo; vm_page_t m_start, m_end; @@ -1423,11 +1416,11 @@ vm_phys_free_contig(vm_page_t m, int pool, u_long npages) * end of the range last. */ if (m_start < m_end) - vm_phys_enqueue_contig(m_start, pool, m_end - m_start); + vm_phys_enqueue_contig(m_start, m_end - m_start); if (order_start < max_order) - vm_phys_free_pages(m, pool, order_start); + vm_phys_free_pages(m, order_start); if (order_end < max_order) - vm_phys_free_pages(m_end, pool, order_end); + vm_phys_free_pages(m_end, order_end); } /* @@ -1481,15 +1474,15 @@ vm_phys_unfree_page(vm_paddr_t pa) struct vm_phys_seg *seg; vm_paddr_t pa_half; vm_page_t m, m_set, m_tmp; - int order, pool; + int order; seg = vm_phys_paddr_to_seg(pa); vm_domain_free_assert_locked(VM_DOMAIN(seg->domain)); -#ifdef VM_FREEPOOL_LAZYINIT /* * The pages on the free lists must be initialized. */ +#ifdef VM_FREEPOOL_LAZYINIT vm_phys_lazy_init_domain(seg->domain, true); #endif @@ -1522,8 +1515,7 @@ vm_phys_unfree_page(vm_paddr_t pa) * is larger than a page, shrink "m_set" by returning the half * of "m_set" that does not contain "m" to the free lists. */ - pool = m_set->pool; - fl = (*seg->free_queues)[pool]; + fl = (*seg->free_queues)[m_set->pool]; order = m_set->order; vm_freelist_rem(fl, m_set, order); while (order > 0) { @@ -1535,7 +1527,7 @@ vm_phys_unfree_page(vm_paddr_t pa) m_tmp = m_set; m_set = vm_phys_seg_paddr_to_vm_page(seg, pa_half); } - vm_freelist_add(fl, m_tmp, order, pool, 0); + vm_freelist_add(fl, m_tmp, order, 0); } KASSERT(m_set == m, ("vm_phys_unfree_page: fatal inconsistency")); return (true); @@ -1676,8 +1668,7 @@ vm_phys_find_queues_contig( * alignment of the first physical page in the set. If the given value * "boundary" is non-zero, then the set of physical pages cannot cross * any physical address boundary that is a multiple of that value. Both - * "alignment" and "boundary" must be a power of two. Sets the pool - * field to DEFAULT in the first allocated page. + * "alignment" and "boundary" must be a power of two. */ vm_page_t vm_phys_alloc_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, @@ -1736,12 +1727,12 @@ vm_phys_alloc_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, fl = (*queues)[m->pool]; oind = m->order; vm_freelist_rem(fl, m, oind); - vm_phys_finish_init(m, oind); + if (m->pool != VM_FREEPOOL_DEFAULT) + vm_phys_set_pool(VM_FREEPOOL_DEFAULT, m, oind); } /* Return excess pages to the free lists. */ fl = (*queues)[VM_FREEPOOL_DEFAULT]; - vm_phys_enq_range(&m_run[npages], m - &m_run[npages], fl, - VM_FREEPOOL_DEFAULT, 0); + vm_phys_enq_range(&m_run[npages], m - &m_run[npages], fl, 0); /* Return page verified to satisfy conditions of request. */ pa_start = VM_PAGE_TO_PHYS(m_run); diff --git a/sys/vm/vm_phys.h b/sys/vm/vm_phys.h index 046fe26b476d..43d94a9420f2 100644 --- a/sys/vm/vm_phys.h +++ b/sys/vm/vm_phys.h @@ -64,15 +64,15 @@ vm_page_t vm_phys_alloc_contig(int domain, u_long npages, vm_paddr_t low, int vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[]); vm_page_t vm_phys_alloc_pages(int domain, int pool, int order); int vm_phys_domain_match(int prefer, vm_paddr_t low, vm_paddr_t high); -void vm_phys_enqueue_contig(vm_page_t m, int pool, u_long npages); +void vm_phys_enqueue_contig(vm_page_t m, u_long npages); int vm_phys_fictitious_reg_range(vm_paddr_t start, vm_paddr_t end, vm_memattr_t memattr); void vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_paddr_t end); vm_page_t vm_phys_fictitious_to_vm_page(vm_paddr_t pa); int vm_phys_find_range(vm_page_t bounds[], int segind, int domain, u_long npages, vm_paddr_t low, vm_paddr_t high); -void vm_phys_free_contig(vm_page_t m, int pool, u_long npages); -void vm_phys_free_pages(vm_page_t m, int pool, int order); +void vm_phys_free_contig(vm_page_t m, u_long npages); +void vm_phys_free_pages(vm_page_t m, int order); void vm_phys_init(void); vm_page_t vm_phys_paddr_to_vm_page(vm_paddr_t pa); vm_page_t vm_phys_seg_paddr_to_vm_page(struct vm_phys_seg *seg, vm_paddr_t pa); diff --git a/sys/vm/vm_reserv.c b/sys/vm/vm_reserv.c index 0bedca54d3da..ad513962d50d 100644 --- a/sys/vm/vm_reserv.c +++ b/sys/vm/vm_reserv.c @@ -480,8 +480,7 @@ vm_reserv_depopulate(vm_reserv_t rv, int index) if (rv->popcnt == 0) { vm_reserv_remove(rv); vm_domain_free_lock(vmd); - vm_phys_free_pages(rv->pages, VM_FREEPOOL_DEFAULT, - VM_LEVEL_0_ORDER); + vm_phys_free_pages(rv->pages, VM_LEVEL_0_ORDER); vm_domain_free_unlock(vmd); counter_u64_add(vm_reserv_freed, 1); } @@ -944,7 +943,7 @@ static void vm_reserv_break(vm_reserv_t rv) { vm_page_t m; - int pool, pos, pos0, pos1; + int hi, lo, pos; vm_reserv_assert_locked(rv); CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", @@ -955,27 +954,23 @@ vm_reserv_break(vm_reserv_t rv) for (; m < rv->pages + VM_LEVEL_0_NPAGES; m += VM_SUBLEVEL_0_NPAGES) #endif m->psind = 0; - pool = VM_FREEPOOL_DIRECT; - pos0 = bit_test(rv->popmap, 0) ? -1 : 0; - pos1 = -1 - pos0; - for (pos = 0; pos < VM_LEVEL_0_NPAGES; ) { - /* Find the first different bit after pos. */ - bit_ff_at(rv->popmap, pos + 1, VM_LEVEL_0_NPAGES, - pos1 < pos0, &pos); - if (pos == -1) - pos = VM_LEVEL_0_NPAGES; - if (pos0 < pos1) { - /* Set pool for pages from pos1 to pos. */ - pos0 = pos1; - while (pos0 < pos) - rv->pages[pos0++].pool = pool; + hi = lo = -1; + pos = 0; + for (;;) { + bit_ff_at(rv->popmap, pos, VM_LEVEL_0_NPAGES, lo != hi, &pos); + if (lo == hi) { + if (pos == -1) + break; + lo = pos; continue; } - /* Free unused pages from pos0 to pos. */ - pos1 = pos; + if (pos == -1) + pos = VM_LEVEL_0_NPAGES; + hi = pos; vm_domain_free_lock(VM_DOMAIN(rv->domain)); - vm_phys_enqueue_contig(&rv->pages[pos0], pool, pos1 - pos0); + vm_phys_enqueue_contig(&rv->pages[lo], hi - lo); vm_domain_free_unlock(VM_DOMAIN(rv->domain)); + lo = hi; } bit_nclear(rv->popmap, 0, VM_LEVEL_0_NPAGES - 1); rv->popcnt = 0; From nobody Thu Jan 23 17:12:27 2025 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 4Yf6vH4bMYz5lCwh; Thu, 23 Jan 2025 17:12: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 4Yf6vH4Jddz42Kg; Thu, 23 Jan 2025 17:12:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737652347; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xe3ANYWFAWv5ZEPXUDftgxz6Ec9g57TkO5Df+Un1yqc=; b=fMb3/JHaVNn4zRDg66T8fHHdIHa/L6+degBZENyXM92HIF6QwslMwBPjT+5TzeaFj2HnvR sgRnrd0VBxRyFYX99R6of++XiNbtUl0b9bwbiw9q+lbWXU/HA8dDOCKYnMp23kRfJ42lFt s/DJQ0I5fzIxgPFXzlp8+8LfHZaWgP33Ob028KjKbf9BYtzBuPnDRCkh7pYwqr/VQbiRJD LLhVr/lMPkKLOLT0xVPR1a2fRc7GCyolPBH7+v4pkijzrCSXHkmh/bM9HM0OQJGzRDPf4H 8ivUhdkAbISA6RkY03Ck+1Ss/B+PpNC7RNAk1iVz+LkKOMxVcGNYKFlF9R1OYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737652347; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xe3ANYWFAWv5ZEPXUDftgxz6Ec9g57TkO5Df+Un1yqc=; b=DtXS2uNcxLlgpb4zcXJPEpTWZbCMn0Hu4e0DFqDetO6E8bF30eG2UoDeVegomC+TGjjNx+ kW4EpMPqMDVs+USJlxjbiOKTcOgAaTYdgvNrg3JZpqpJn2jlKe04pyWaC0k41i4+5TeHnV TknqK+lMmiDsn+EZxO7mIui1ONFBwQeLbW5YCTqWwv40Tx6CgcbQ80H6Agr15r0KX9KGS9 ejfeSGLO+fHNyJMxcTQqp1CRRz2dePfLcMDOfX2IGUZfeKe9eBfkGvrKK0qySKlU+loCyp RCFcqi0vF7yXNqMANv7EpbOVYASirZpQLIsfMK7ZEu0OLYauo2SkzZ2AOrhilw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737652347; a=rsa-sha256; cv=none; b=Hi7qIYFQE13eZVMp1udc0j/1tvE0wCGPBsW0AjYxzGDw0MyY3cbp9vlxQWQ6Tlw8IeYGsG QcK6WsGbd02pz55u/6LikPqjVbUjRetkd9KTON6OK44xu2SrpTTTs16WlauKtzZ8CnT1au wRRAUpk/OH70Vvz98wWin1f9pS64WEz4IQSiPJV2CbMdJJ/ggtNV60nIJ0ejY90bhW7xdO oAySgML3GnxxeH8fF7CJAI6H+dD93LrUp2QxbKg/qj3V7SUAkOzb7piHmlLjXtiPp+9L8g 2DGv1+B+WL1mQ5rd2P5Yk1/0EqK1aeYN+kcdrBUNIKh2t4vN47Qle8tuFDnE+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf6vH3f20zpDH; Thu, 23 Jan 2025 17:12: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 50NHCRSA000267; Thu, 23 Jan 2025 17:12:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHCRFW000247; Thu, 23 Jan 2025 17:12:27 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:12:27 GMT Message-Id: <202501231712.50NHCRFW000247@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: 7cbb6b6e28db - main - inpcb: Close some SO_REUSEPORT_LB races, part 2 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: 7cbb6b6e28db33095a1cf7a8887921a5ec969824 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7cbb6b6e28db33095a1cf7a8887921a5ec969824 commit 7cbb6b6e28db33095a1cf7a8887921a5ec969824 Author: Mark Johnston AuthorDate: 2025-01-23 17:00:11 +0000 Commit: Mark Johnston CommitDate: 2025-01-23 17:12:10 +0000 inpcb: Close some SO_REUSEPORT_LB races, part 2 Suppose a thread is adds a socket to an existing TCP lbgroup that is actively accepting connections. It has to do the following operations: 1. set SO_REUSEPORT_LB on the socket 2. bind() the socket to the shared address/port 3. call listen() Step 2 makes the inpcb visible to incoming connection requests. However, at this point the inpcb cannot accept new connections. If in_pcblookup() matches it, the remote end will see ECONNREFUSED even when other listening sockets are present in the lbgroup. This means that dynamically adding inpcbs to an lbgroup (e.g., by starting up new workers) can trigger spurious connection failures for no good reason. (A similar problem exists when removing inpcbs from an lbgroup, but that is harder to fix and is not addressed by this patch; see the review for a bit more commentary.) Fix this by augmenting each lbgroup with a linked list of inpcbs that are pending a listen() call. When adding an inpcb to an lbgroup, keep the inpcb on this list if listen() hasn't been called, so it is not yet visible to the lookup path. Then, add a new in_pcblisten() routine which makes the inpcb visible within the lbgroup now that it's safe to let it handle new connections. Add a regression test which verifies that we don't get spurious connection errors while adding sockets to an LB group. Reviewed by: glebius MFC after: 1 month Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D48544 --- sys/kern/uipc_domain.c | 2 +- sys/netinet/in_pcb.c | 131 ++++++++++++++++++++-------- sys/netinet/in_pcb.h | 7 +- sys/netinet/tcp_usrreq.c | 4 + sys/sys/socketvar.h | 2 + tests/sys/netinet/Makefile | 2 + tests/sys/netinet/so_reuseport_lb_test.c | 143 +++++++++++++++++++++++++++++++ 7 files changed, 252 insertions(+), 39 deletions(-) diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index 43bdd44a09bf..c5296f12ba94 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -109,7 +109,7 @@ pr_disconnect_notsupp(struct socket *so) return (EOPNOTSUPP); } -static int +int pr_listen_notsupp(struct socket *so, int backlog, struct thread *td) { return (EOPNOTSUPP); diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 11bc68a3915a..c50e39f20c16 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -263,6 +263,7 @@ in_pcblbgroup_alloc(struct ucred *cred, u_char vflag, uint16_t port, grp = malloc(bytes, M_PCB, M_ZERO | M_NOWAIT); if (grp == NULL) return (NULL); + LIST_INIT(&grp->il_pending); grp->il_cred = crhold(cred); grp->il_vflag = vflag; grp->il_lport = port; @@ -285,11 +286,45 @@ in_pcblbgroup_free_deferred(epoch_context_t ctx) static void in_pcblbgroup_free(struct inpcblbgroup *grp) { + KASSERT(LIST_EMPTY(&grp->il_pending), + ("local group %p still has pending inps", grp)); CK_LIST_REMOVE(grp, il_list); NET_EPOCH_CALL(in_pcblbgroup_free_deferred, &grp->il_epoch_ctx); } +static struct inpcblbgroup * +in_pcblbgroup_find(struct inpcb *inp) +{ + struct inpcbinfo *pcbinfo; + struct inpcblbgroup *grp; + struct inpcblbgrouphead *hdr; + + INP_LOCK_ASSERT(inp); + + pcbinfo = inp->inp_pcbinfo; + INP_HASH_LOCK_ASSERT(pcbinfo); + KASSERT((inp->inp_flags & INP_INLBGROUP) != 0, + ("inpcb %p is not in a load balance group", inp)); + + hdr = &pcbinfo->ipi_lbgrouphashbase[ + INP_PCBPORTHASH(inp->inp_lport, pcbinfo->ipi_lbgrouphashmask)]; + CK_LIST_FOREACH(grp, hdr, il_list) { + struct inpcb *inp1; + + for (unsigned int i = 0; i < grp->il_inpcnt; i++) { + if (inp == grp->il_inp[i]) + goto found; + } + LIST_FOREACH(inp1, &grp->il_pending, inp_lbgroup_list) { + if (inp == inp1) + goto found; + } + } +found: + return (grp); +} + static void in_pcblbgroup_insert(struct inpcblbgroup *grp, struct inpcb *inp) { @@ -298,14 +333,24 @@ in_pcblbgroup_insert(struct inpcblbgroup *grp, struct inpcb *inp) grp->il_inpcnt)); INP_WLOCK_ASSERT(inp); - inp->inp_flags |= INP_INLBGROUP; - grp->il_inp[grp->il_inpcnt] = inp; + if (inp->inp_socket->so_proto->pr_listen != pr_listen_notsupp && + !SOLISTENING(inp->inp_socket)) { + /* + * If this is a TCP socket, it should not be visible to lbgroup + * lookups until listen() has been called. + */ + LIST_INSERT_HEAD(&grp->il_pending, inp, inp_lbgroup_list); + } else { + grp->il_inp[grp->il_inpcnt] = inp; - /* - * Synchronize with in_pcblookup_lbgroup(): make sure that we don't - * expose a null slot to the lookup path. - */ - atomic_store_rel_int(&grp->il_inpcnt, grp->il_inpcnt + 1); + /* + * Synchronize with in_pcblookup_lbgroup(): make sure that we + * don't expose a null slot to the lookup path. + */ + atomic_store_rel_int(&grp->il_inpcnt, grp->il_inpcnt + 1); + } + + inp->inp_flags |= INP_INLBGROUP; } static struct inpcblbgroup * @@ -329,6 +374,8 @@ in_pcblbgroup_resize(struct inpcblbgrouphead *hdr, grp->il_inp[i] = old_grp->il_inp[i]; grp->il_inpcnt = old_grp->il_inpcnt; CK_LIST_INSERT_HEAD(hdr, grp, il_list); + LIST_SWAP(&old_grp->il_pending, &grp->il_pending, inpcb, + inp_lbgroup_list); in_pcblbgroup_free(old_grp); return (grp); } @@ -412,6 +459,7 @@ in_pcbremlbgrouphash(struct inpcb *inp) struct inpcbinfo *pcbinfo; struct inpcblbgrouphead *hdr; struct inpcblbgroup *grp; + struct inpcb *inp1; int i; pcbinfo = inp->inp_pcbinfo; @@ -427,13 +475,11 @@ in_pcbremlbgrouphash(struct inpcb *inp) if (grp->il_inp[i] != inp) continue; - if (grp->il_inpcnt == 1) { + if (grp->il_inpcnt == 1 && + LIST_EMPTY(&grp->il_pending)) { /* We are the last, free this local group. */ in_pcblbgroup_free(grp); } else { - KASSERT(grp->il_inpcnt >= 2, - ("invalid local group count %d", - grp->il_inpcnt)); grp->il_inp[i] = grp->il_inp[grp->il_inpcnt - 1]; @@ -446,17 +492,22 @@ in_pcbremlbgrouphash(struct inpcb *inp) inp->inp_flags &= ~INP_INLBGROUP; return; } + LIST_FOREACH(inp1, &grp->il_pending, inp_lbgroup_list) { + if (inp == inp1) { + LIST_REMOVE(inp, inp_lbgroup_list); + inp->inp_flags &= ~INP_INLBGROUP; + return; + } + } } - KASSERT(0, ("%s: did not find %p", __func__, inp)); + __assert_unreachable(); } int in_pcblbgroup_numa(struct inpcb *inp, int arg) { struct inpcbinfo *pcbinfo; - struct inpcblbgrouphead *hdr; - struct inpcblbgroup *grp; - int err, i; + int error; uint8_t numa_domain; switch (arg) { @@ -472,33 +523,20 @@ in_pcblbgroup_numa(struct inpcb *inp, int arg) numa_domain = arg; } - err = 0; pcbinfo = inp->inp_pcbinfo; INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK(pcbinfo); - hdr = &pcbinfo->ipi_lbgrouphashbase[ - INP_PCBPORTHASH(inp->inp_lport, pcbinfo->ipi_lbgrouphashmask)]; - CK_LIST_FOREACH(grp, hdr, il_list) { - for (i = 0; i < grp->il_inpcnt; ++i) { - if (grp->il_inp[i] != inp) - continue; - - if (grp->il_numa_domain == numa_domain) { - goto abort_with_hash_wlock; - } - - /* Remove it from the old group. */ - in_pcbremlbgrouphash(inp); - - /* Add it to the new group based on numa domain. */ - in_pcbinslbgrouphash(inp, numa_domain); - goto abort_with_hash_wlock; - } + if (in_pcblbgroup_find(inp) != NULL) { + /* Remove it from the old group. */ + in_pcbremlbgrouphash(inp); + /* Add it to the new group based on numa domain. */ + in_pcbinslbgrouphash(inp, numa_domain); + error = 0; + } else { + error = ENOENT; } - err = ENOENT; -abort_with_hash_wlock: INP_HASH_WUNLOCK(pcbinfo); - return (err); + return (error); } /* Make sure it is safe to use hashinit(9) on CK_LIST. */ @@ -1437,6 +1475,25 @@ in_pcbdisconnect(struct inpcb *inp) } #endif /* INET */ +void +in_pcblisten(struct inpcb *inp) +{ + struct inpcblbgroup *grp; + + INP_WLOCK_ASSERT(inp); + + if ((inp->inp_flags & INP_INLBGROUP) != 0) { + struct inpcbinfo *pcbinfo; + + pcbinfo = inp->inp_pcbinfo; + INP_HASH_WLOCK(pcbinfo); + grp = in_pcblbgroup_find(inp); + LIST_REMOVE(inp, inp_lbgroup_list); + in_pcblbgroup_insert(grp, inp); + INP_HASH_WUNLOCK(pcbinfo); + } +} + /* * inpcb hash lookups are protected by SMR section. * diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 0cf5ca017963..f00629266c58 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -167,7 +167,10 @@ struct inpcbpolicy; struct m_snd_tag; struct inpcb { /* Cache line #1 (amd64) */ - CK_LIST_ENTRY(inpcb) inp_hash_exact; /* hash table linkage */ + union { + CK_LIST_ENTRY(inpcb) inp_hash_exact; /* hash table linkage */ + LIST_ENTRY(inpcb) inp_lbgroup_list; /* lb group list */ + }; CK_LIST_ENTRY(inpcb) inp_hash_wild; /* hash table linkage */ struct rwlock inp_lock; /* Cache line #2 (amd64) */ @@ -428,6 +431,7 @@ SYSUNINIT(prot##_inpcbstorage_uninit, SI_SUB_PROTO_DOMAIN, \ */ struct inpcblbgroup { CK_LIST_ENTRY(inpcblbgroup) il_list; + LIST_HEAD(, inpcb) il_pending; /* PCBs waiting for listen() */ struct epoch_context il_epoch_ctx; struct ucred *il_cred; uint16_t il_lport; /* (c) */ @@ -671,6 +675,7 @@ int in_pcbinshash(struct inpcb *); int in_pcbladdr(struct inpcb *, struct in_addr *, struct in_addr *, struct ucred *); int in_pcblbgroup_numa(struct inpcb *, int arg); +void in_pcblisten(struct inpcb *); struct inpcb * in_pcblookup(struct inpcbinfo *, struct in_addr, u_int, struct in_addr, u_int, int, struct ifnet *); diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index acc3e2ea2942..3e73e448a9f7 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -391,6 +391,8 @@ tcp_usr_listen(struct socket *so, int backlog, struct thread *td) } SOCK_UNLOCK(so); + if (error == 0) + in_pcblisten(inp); if (tp->t_flags & TF_FASTOPEN) tp->t_tfo_pending = tcp_fastopen_alloc_counter(); @@ -448,6 +450,8 @@ tcp6_usr_listen(struct socket *so, int backlog, struct thread *td) } SOCK_UNLOCK(so); + if (error == 0) + in_pcblisten(inp); if (tp->t_flags & TF_FASTOPEN) tp->t_tfo_pending = tcp_fastopen_alloc_counter(); diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index fda8d23f5649..e818fd3fc757 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -596,6 +596,8 @@ SYSCTL_DECL(_net_inet_accf); int accept_filt_generic_mod_event(module_t mod, int event, void *data); #endif +int pr_listen_notsupp(struct socket *so, int backlog, struct thread *td); + #endif /* _KERNEL */ /* diff --git a/tests/sys/netinet/Makefile b/tests/sys/netinet/Makefile index 9fac7152e137..6faaf8ac1df1 100644 --- a/tests/sys/netinet/Makefile +++ b/tests/sys/netinet/Makefile @@ -27,6 +27,8 @@ ATF_TESTS_SH= arp \ ATF_TESTS_PYTEST+= carp.py ATF_TESTS_PYTEST+= igmp.py +LIBADD.so_reuseport_lb_test= pthread + # Some of the arp tests look for log messages in the dmesg buffer, so run them # serially to avoid problems with interleaved output. TEST_METADATA.arp+= is_exclusive="true" diff --git a/tests/sys/netinet/so_reuseport_lb_test.c b/tests/sys/netinet/so_reuseport_lb_test.c index 64fe0b53618d..3ce09fcf5794 100644 --- a/tests/sys/netinet/so_reuseport_lb_test.c +++ b/tests/sys/netinet/so_reuseport_lb_test.c @@ -28,12 +28,16 @@ */ #include +#include #include #include +#include #include #include +#include +#include #include #include @@ -235,10 +239,149 @@ ATF_TC_BODY(basic_ipv6, tc) } } +struct concurrent_add_softc { + struct sockaddr_storage ss; + int socks[128]; + int kq; +}; + +static void * +listener(void *arg) +{ + for (struct concurrent_add_softc *sc = arg;;) { + struct kevent kev; + ssize_t n; + int error, count, cs, s; + uint8_t b; + + count = kevent(sc->kq, NULL, 0, &kev, 1, NULL); + ATF_REQUIRE_MSG(count == 1, + "kevent() failed: %s", strerror(errno)); + + s = (int)kev.ident; + cs = accept(s, NULL, NULL); + ATF_REQUIRE_MSG(cs >= 0, + "accept() failed: %s", strerror(errno)); + + b = 'M'; + n = write(cs, &b, sizeof(b)); + ATF_REQUIRE_MSG(n >= 0, "write() failed: %s", strerror(errno)); + ATF_REQUIRE(n == 1); + + error = close(cs); + ATF_REQUIRE_MSG(error == 0 || errno == ECONNRESET, + "close() failed: %s", strerror(errno)); + } +} + +static void * +connector(void *arg) +{ + for (struct concurrent_add_softc *sc = arg;;) { + ssize_t n; + int error, s; + uint8_t b; + + s = socket(sc->ss.ss_family, SOCK_STREAM, 0); + ATF_REQUIRE_MSG(s >= 0, "socket() failed: %s", strerror(errno)); + + error = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (int[]){1}, + sizeof(int)); + + error = connect(s, (struct sockaddr *)&sc->ss, sc->ss.ss_len); + ATF_REQUIRE_MSG(error == 0, "connect() failed: %s", + strerror(errno)); + + n = read(s, &b, sizeof(b)); + ATF_REQUIRE_MSG(n >= 0, "read() failed: %s", + strerror(errno)); + ATF_REQUIRE(n == 1); + ATF_REQUIRE(b == 'M'); + error = close(s); + ATF_REQUIRE_MSG(error == 0, + "close() failed: %s", strerror(errno)); + } +} + +/* + * Run three threads. One accepts connections from listening sockets on a + * kqueue, while the other makes connections. The third thread slowly adds + * sockets to the LB group. This is meant to help flush out race conditions. + */ +ATF_TC_WITHOUT_HEAD(concurrent_add); +ATF_TC_BODY(concurrent_add, tc) +{ + struct concurrent_add_softc sc; + struct sockaddr_in *sin; + pthread_t threads[4]; + int error; + + sc.kq = kqueue(); + ATF_REQUIRE_MSG(sc.kq >= 0, "kqueue() failed: %s", strerror(errno)); + + error = pthread_create(&threads[0], NULL, listener, &sc); + ATF_REQUIRE_MSG(error == 0, "pthread_create() failed: %s", + strerror(error)); + + sin = (struct sockaddr_in *)&sc.ss; + memset(sin, 0, sizeof(*sin)); + sin->sin_len = sizeof(*sin); + sin->sin_family = AF_INET; + sin->sin_port = htons(0); + sin->sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + for (size_t i = 0; i < nitems(sc.socks); i++) { + struct kevent kev; + int s; + + sc.socks[i] = s = socket(AF_INET, SOCK_STREAM, 0); + ATF_REQUIRE_MSG(s >= 0, "socket() failed: %s", strerror(errno)); + + error = setsockopt(s, SOL_SOCKET, SO_REUSEPORT_LB, (int[]){1}, + sizeof(int)); + ATF_REQUIRE_MSG(error == 0, + "setsockopt(SO_REUSEPORT_LB) failed: %s", strerror(errno)); + + error = bind(s, (struct sockaddr *)sin, sizeof(*sin)); + ATF_REQUIRE_MSG(error == 0, "bind() failed: %s", + strerror(errno)); + + error = listen(s, 5); + ATF_REQUIRE_MSG(error == 0, "listen() failed: %s", + strerror(errno)); + + EV_SET(&kev, s, EVFILT_READ, EV_ADD | EV_ENABLE, 0, 0, 0); + error = kevent(sc.kq, &kev, 1, NULL, 0, NULL); + ATF_REQUIRE_MSG(error == 0, "kevent() failed: %s", + strerror(errno)); + + if (i == 0) { + socklen_t slen = sizeof(sc.ss); + + error = getsockname(sc.socks[i], + (struct sockaddr *)&sc.ss, &slen); + ATF_REQUIRE_MSG(error == 0, "getsockname() failed: %s", + strerror(errno)); + ATF_REQUIRE(sc.ss.ss_family == AF_INET); + + for (size_t j = 1; j < nitems(threads); j++) { + error = pthread_create(&threads[j], NULL, + connector, &sc); + ATF_REQUIRE_MSG(error == 0, + "pthread_create() failed: %s", + strerror(error)); + } + } + + usleep(20000); + } +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, basic_ipv4); ATF_TP_ADD_TC(tp, basic_ipv6); + ATF_TP_ADD_TC(tp, concurrent_add); return (atf_no_error()); } From nobody Thu Jan 23 17:27:20 2025 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 4Yf7DS6JpCz5lDH4; Thu, 23 Jan 2025 17:27: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 4Yf7DS5r5mz43Fb; Thu, 23 Jan 2025 17:27:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653240; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tKxWLL/wrDAnK8vXafmJ7RTzIqv6E+kHBkPWWEoh0G8=; b=Qs7y2DwOf/lzSCYAUdVIUMQ7hijXIgLyvu8wZ38ijhGRiQnyKS7ikE+QcwMzcMbHf60o0o T1ytzctE10OvKtqQPOimdTQgjAAKJC2X9vylRgPXJkrf1TKV38/ABpffe30gN/0DqYt8yO FnXFBWn1XCPrLjGANxcG4nXIMirg2i7UYuwArgFxEkA89d7p1cqvqWimJPCW33RzP3fb64 zQ83nXVND0sYxHNL7Wb8NQzAQUu/i86eyIKjDLdWbiFEaUZk+j/mBp77H1aOnqEJQ0v0Ho MxHD79X07vz/cZsu/alumyBhPdmoyW2P+cuSEIGuygAYR8OCUHmeHsSEfrlCmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653240; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tKxWLL/wrDAnK8vXafmJ7RTzIqv6E+kHBkPWWEoh0G8=; b=urp7Eh2GYip3gP21wx+uczkdAzzL1V+iJaO3IvPkHhvHjzg69sWsiOdCOCeF6+mRTDoHUX IcYUP7XEkkdHRLZJ9KMUddHhGjgSJOx7bAliQdBNDYxpIaZF2nGp55W3pppscS/JEXO6W3 ulqkr1J3qRoDGy65nhF772cI1mNsE3lK0YV6nEPFttqax3TJFpMTriPvAaEfD1oJ0uJAbF JBOMqxq0RLyNPNr7DiNiL+uhsU00n/V/09de1otmTcd1T6Jj66YCjzKVGKui4luAaUDZSM bIz20idDBXbSnoETWGXofo//DwrQBLPMyc4ovm6Nj12yikEjdyJUKUl4yeqmrQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653240; a=rsa-sha256; cv=none; b=Hw+ixL2VfF2zh2AEOav+kMVdpBAcbExV8IrSaNbKLNSMuP8U1I3Pg8NxtjYZh7N1lg5EPW FxK0loYOuEnJbbhhNiWk7oVLzfyZw2pVBNUE5eHPkXpwlBENBI/bpPBUYU1euZQ3lU/zBp zRD7PfGrD4+oPTO1eIkHY6XwNjCMsuJHnj31n30sJ9pPN5pHdvoYWGj9hCBtXUrbdmsx+p DP6g0nVPHM7iWMgK8fTd1LJBp6CUPrW3/hFpnZ0QGUdVvCunZT6XcXkeC7bqdKZLywd6cO KKYzxXace+j6e34pu0x0cPSqeyqOCGxHwEZk1ygu2oZDEhs10I2yXzoWebyvmw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7DS5Q5rzpYm; Thu, 23 Jan 2025 17:27: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 50NHRKsi022246; Thu, 23 Jan 2025 17:27:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRKUY022243; Thu, 23 Jan 2025 17:27:20 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:20 GMT Message-Id: <202501231727.50NHRKUY022243@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: 23f025e24b6e - main - scmi: Fix the scmi_shmem module name 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: 23f025e24b6e5d47aecb9a6d061f7b17c34c1aa5 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=23f025e24b6e5d47aecb9a6d061f7b17c34c1aa5 commit 23f025e24b6e5d47aecb9a6d061f7b17c34c1aa5 Author: Andrew Turner AuthorDate: 2025-01-10 14:25:32 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:24 +0000 scmi: Fix the scmi_shmem module name This fixes the "module scmi already present" message on boot. Sponsored by: Arm Ltd --- sys/dev/firmware/arm/scmi_shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/firmware/arm/scmi_shmem.c b/sys/dev/firmware/arm/scmi_shmem.c index 4a5516abfb4b..9bab4bc4004e 100644 --- a/sys/dev/firmware/arm/scmi_shmem.c +++ b/sys/dev/firmware/arm/scmi_shmem.c @@ -326,4 +326,4 @@ DEFINE_CLASS_1(shmem, shmem_driver, shmem_methods, sizeof(struct shmem_softc), EARLY_DRIVER_MODULE(shmem, mmio_sram, shmem_driver, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); -MODULE_VERSION(scmi, 1); +MODULE_VERSION(scmi_shmem, 1); From nobody Thu Jan 23 17:27:21 2025 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 4Yf7DV2pgXz5lDH5; Thu, 23 Jan 2025 17:27: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 4Yf7DV05sfz43LX; Thu, 23 Jan 2025 17:27:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653242; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=57qQaFJdG+hWw2SHHIqTZatjX+YRif4pY9hBWHoV1ac=; b=WY/UfxbY5aims2wmBzW42Qz0ER2V9mjDCZvvDvR6VlID3RzZ3fYUILZZ6j/2IrZg83Ozis 62KXCxS8qK5IeRVEkrPch6NslVR4LNb8iFDmnsvCOdzN16GEmcdE9Bdfve29rF5HwB7+Ks aAt0sS3GA6F4ALntqiA1gzJ8OElCICwRqMkRKmWkns2He4QCVh0CWGkMqC3Bxlb2rwywMG KXgQMGCmHSC8t9Y/zs6VngOSCU6grFS/qw0qpNXfF4Aq4pyAEnpPTbN4sRvqIcMpWZiYpL /DJHDh+PTIOokW1MSr8S5CbnDyaG3ydyJTJSMo6KaxyGF6Bkht09NB39gN7dgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653242; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=57qQaFJdG+hWw2SHHIqTZatjX+YRif4pY9hBWHoV1ac=; b=Vdk4fSHy2KGSlsWnM77P3CEoCnpHjE5qB85wyVP8WH6oGq92DBvOXNEINj+n/uNYfV7Jd2 Vzamm6xDH18BIZ4N1qMYEXOn8HBPHPU3NuKCp5PsdGKvp4DzvTa9zhJqbLbRfwJ9EmEOri i3+oezGZTI1HpGUrt8q52OIBLjgPvRmNPEn1nmM2xz+EQYEHqe88IhOExJrOgAhrhoTIxt NRdK1HR9oGv3uVcw7xVVuUeCCkS7khnGaekfjRoivN8HkfKzosgtGC+a1PBGB+edFXxMFv 9HfuvlLy3FeFJeib+6DT+Exy0UFOg+4Z35cZUEBk14VSof8B5W3gNcTl0VHyOw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653242; a=rsa-sha256; cv=none; b=p+isWFcjhVaOY0dvqkW2cGj2MjdMzbFefjyF/PA3VsG1brUufx5ySV3ozcXPqDQwI8ewYL Q39IUoxdiZIxBThMWHWQI5vaYIc+KWv4YfUEbPoMmcRo44r6iTBz2AjN7zQqS3wV+AiLi1 ImUjEAWoYW4thWEZnVASi7ta9oWEye00CvMTieZuHmKWXNDr/k2pd/SXy3LWJeSTwbq90d 5OiGF85JSWvx8hxqxYnwZL0Po+t9h7Ulj7ehSOm62zul71Aw7YuNjz01DX+Mi7UZqBUGF8 cAHm4oTiopqYpvXeTSF9voI+17LY9xKdYPkek+gsN5Ql/+mBQNcKdNObcDkOpg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7DT6dw5zpF5; Thu, 23 Jan 2025 17:27: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 50NHRLQn022279; Thu, 23 Jan 2025 17:27:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRLUK022276; Thu, 23 Jan 2025 17:27:21 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:21 GMT Message-Id: <202501231727.50NHRLUK022276@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: 80defb51b2bc - main - depend-cleanup: Add a regex for files that moved 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: 80defb51b2bcaee74458355d7eef734d18bfc9e2 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=80defb51b2bcaee74458355d7eef734d18bfc9e2 commit 80defb51b2bcaee74458355d7eef734d18bfc9e2 Author: Andrew Turner AuthorDate: 2025-01-23 17:10:29 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:25 +0000 depend-cleanup: Add a regex for files that moved When a file is moved or copied to a new directory the depend-cleanup script may incorrectly remove the .depend file as the generated regex will pass. Fix this by passing in a new regex for the arm64 files that have the same name as a generic implementation we were previously using. While here add memchr.S. It has moved from a generated file to one in the source tree with the same name. Reviewed by: emaste Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D48519 --- tools/build/depend-cleanup.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh index b7695370f1dd..8e2968b3061b 100755 --- a/tools/build/depend-cleanup.sh +++ b/tools/build/depend-cleanup.sh @@ -252,10 +252,10 @@ if [ $MACHINE_ARCH = aarch64 ]; then clean_dep lib/libc strcspn c # 20250110 89b3872376cb add optimized strpbrk & strsep implementations - clean_dep lib/libc strpbrk c + clean_dep lib/libc strpbrk c "libc.string.strpbrk.c" # 20250110 79287d783c72 strcat enable use of SIMD - clean_dep lib/libc strcat c + clean_dep lib/libc strcat c "libc.string.strcat.c" # 20250110 756b7fc80837 add strlcpy SIMD implementation clean_dep lib/libc strlcpy c @@ -268,10 +268,11 @@ if [ $MACHINE_ARCH = aarch64 ]; then clean_dep lib/libc memccpy c # 20250110 3dc5429158cf add strncat SIMD implementation - clean_dep lib/libc strncat c + clean_dep lib/libc strncat c "libc.string.strncat.c" # 20250110 bea89d038ac5 add strlcat SIMD implementation, and move memchr - clean_dep lib/libc strlcat c + clean_dep lib/libc strlcat c "libc.string.strlcat.c" + clean_dep lib/libc memchr S "[[:space:]]memchr.S" run rm -f "$OBJTOP"/lib/libc/memchr.S # 20250110 3863fec1ce2d add strlen SIMD implementation @@ -279,8 +280,8 @@ if [ $MACHINE_ARCH = aarch64 ]; then run rm -f "$OBJTOP"/lib/libc/strlen.S # 20250110 79e01e7e643c add bcopy & bzero wrapper - clean_dep lib/libc bcopy c - clean_dep lib/libc bzero c + clean_dep lib/libc bcopy c "libc.string.bcopy.c" + clean_dep lib/libc bzero c "libc.string.bzero.c" # 20250110 f2c98669fc1b add ASIMD-enhanced timingsafe_bcmp implementation clean_dep lib/libc timingsafe_bcmp c From nobody Thu Jan 23 17:27:25 2025 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 4Yf7DZ024Cz5lDTg; Thu, 23 Jan 2025 17:27:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yf7DY1zx2z43W8; Thu, 23 Jan 2025 17:27:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=suombRB3Vr/ARADGzGFG36wxk+VCCa/Jls1L3B6J+pU=; b=WqstHFWTievKDt/6026vO3q5x+v0MlqWcgV6bhjfj3qafCsPqY0f6mmtkKErR76suPC7Qa B6xr6ocJ0GjLPJu35pxjEYTHafci0ihBUfXfIsBoHfj9E/GIaKOTEktlraEbCbilJwORB6 WJg1teZmnHzAzY344iNtc/FGC/hKkxdolym5jGs+A6ZNzE8pUeEczmDvpxeAk0k8otaV/x v7vSvzPWRBYhSUdRasMA4fqxmRZiZW1y6+EGKDA5BmQQZKxlyEEyFu9ZYqff6BgQKOO4wE 8GPLFAwOGnsqUBCPTBaWEicWSwiyXY2sOV+LbTkCdGEP+1dXy55plP+6Jvb3YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=suombRB3Vr/ARADGzGFG36wxk+VCCa/Jls1L3B6J+pU=; b=wbr+nnAJo4dTpU63+S6k+b4tabdZZrNfQLerzLAOD3YtO8qBjo06EYNZXXYvLGxfengYq4 r/JbCh6e6kFlLMWJCZ4vquVGYNEYCTeJlU2pLPIPkn6ppM5oZeQtbj71+2NrGp4bf1qS0W YbPwwr8vQUZPqWrdyCtESUz4HbaewlPTR0XZyYuzrPFIfzy9jJkVfrpHTHMKh9YTpyvzy1 ZbHM4t59g2CiJoIzjGxiA0SaU1/T/vJzYkVG0YCYSM+5RdTIu1XiRbrzIcWDugw0IviUrH KOsX+V+fdKDqp/hR/lCG3jS07erOqlc0LFsnXsL8ChqUY9Bv7edzPSL/NsnFtw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653245; a=rsa-sha256; cv=none; b=xcyPWwfeUHClQgzvXuA+Lvn1AmvwqEVmCn+Tt4E19xC8IB6V+uVV0rRXHP1bqb+9Xj4HrF Z0jtB92py+bafwE9iC1lfNVwu4WdRo1ufT4vEK+7kG6XGqABncrsYxHTJeHykjkd5O4KCj /81uNLY10Wb4/7zWkEPoAg04Wk1zTADt4sp1tx6IRVBkkVReapO9hOlSRS9PYZFwoxt7x3 G/LO/Ps0darGBItoK4n0dkDmx8tebGqp8W/0ee0xOrR3IbK5NdCbnrgWoLYV12ExzJxUi/ 4ldAUoyIsU9g+WWl9VaOXrPf8TIxmp3dHPfoct9OUU5ZKnz10r4BzZIKuU7dkw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7DY1bYfzpjy; Thu, 23 Jan 2025 17:27: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 50NHRP9d022386; Thu, 23 Jan 2025 17:27:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRPfH022383; Thu, 23 Jan 2025 17:27:25 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:25 GMT Message-Id: <202501231727.50NHRPfH022383@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: 4e3831c66d00 - main - arm64: fix ID_AA64ISAR2_WFxT_IMPL 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4e3831c66d00db6b2aae17bea200ba9dc7720cad Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=4e3831c66d00db6b2aae17bea200ba9dc7720cad commit 4e3831c66d00db6b2aae17bea200ba9dc7720cad Author: Harry Moulton AuthorDate: 2025-01-23 12:23:09 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:25 +0000 arm64: fix ID_AA64ISAR2_WFxT_IMPL value Bits 3:0 of ID_AA64ISAR2_EL1 are reserved for FEAT_WFxT in ARMv8.7, with bit 1 used to determine whether the feature is supported. The macro, ID_AA64ISAR2_WFxT_IMPL can be used to check if this bit is set, however it is currently incorrectly set to check bit 0. This has now been corrected. Reviewed by: andrew Sponsored by: Arm Ltd Signed-off-by: Harry Moulton Differential Revision: https://reviews.freebsd.org/D48577 --- sys/arm64/include/armreg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index e955f3f4a5c0..d586d3568bd7 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -1124,7 +1124,7 @@ #define ID_AA64ISAR2_WFxT_MASK (UL(0xf) << ID_AA64ISAR2_WFxT_SHIFT) #define ID_AA64ISAR2_WFxT_VAL(x) ((x) & ID_AA64ISAR2_WFxT_MASK) #define ID_AA64ISAR2_WFxT_NONE (UL(0x0) << ID_AA64ISAR2_WFxT_SHIFT) -#define ID_AA64ISAR2_WFxT_IMPL (UL(0x1) << ID_AA64ISAR2_WFxT_SHIFT) +#define ID_AA64ISAR2_WFxT_IMPL (UL(0x2) << ID_AA64ISAR2_WFxT_SHIFT) #define ID_AA64ISAR2_RPRES_SHIFT 4 #define ID_AA64ISAR2_RPRES_WIDTH 4 #define ID_AA64ISAR2_RPRES_MASK (UL(0xf) << ID_AA64ISAR2_RPRES_SHIFT) From nobody Thu Jan 23 17:27:22 2025 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 4Yf7DW3yMWz5lDKy; Thu, 23 Jan 2025 17:27: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 4Yf7DW0jQxz43Sd; Thu, 23 Jan 2025 17:27:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653243; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PjpFMXlJildRisZnN+U4nrAYOWZ5Jh/fo1A47qyf4ec=; b=gGuSPuzR7xodxEC4wsJG1iFcocDeTznImSn4iq8Bzl7fZEeGwVbyTV3VcE+eDOk9+8XExS PsHHmE+Eq+Y7hQIq9KxbysYD0373J+IJb3j6LEYH4/9HbFLumTBs63bBH45GqWDvSmXTv7 33W4Bd9HKAiHmdUEj8OcjlEswGUcRWmUxYdIWksBzDbnwQEWFFjVDog8vwJ+XSOhA2REub W9WljiQa9tOVG2iMmKXkywzD8QlHY8gb1HIblAzvT3yg3f5X9Zuf9xZzYsA9IajfULWW6d 18t5vM8ZM/xbt7DKSK7VDjFC167wbTsfgnLYpzsRJltJoMgZWjqRh+CvyE3t5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653243; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PjpFMXlJildRisZnN+U4nrAYOWZ5Jh/fo1A47qyf4ec=; b=CHJuhp7QiCaJaDjCMdIgJQnsyV12PDWdSBhcPvWrtyzwxfGiUzW3CT2Lyx7j+Q52WRMH2T jkTO3drPkC+uS/wi32iJ+nZCiQTVPMPUjMGS6RvUIY3yhK0CWroTivvEh8S21WqsTENHAJ TiD+O/7PDtJ5OG97YWCxKpxo+HZzgAMIP86xGB+PuOc+DPhxoyqNzWNVGj0Td4wEF1j9qZ m2tSJILoeEDLkYnHkno1zK/kEe6N8sqOxKDZR8XyzVKGOWI72wWAYzXLDLdznpe0MRd/ed 2nkeatP26qcWK0bAvO4MO1G57YAPNWDQ+zcI5Y4sKBS7pPhX4YOlYwB35qk7Tw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653243; a=rsa-sha256; cv=none; b=RN9UzDbafIuLFGqchiz+L2M9UaX1Jfpk5H+685f3s2lqxQ/QdnTZgAit4IiGpQiZd8XzrT LWkIavQ/TVBDMD1+Rfjl+OxLhupoLMivNWp0u0rXWJQee/n0k2NVy1KLafnfZieDVzLvMR x3Px5vdie0oJMGSz36cu3pvl1o66l5awqGP1TKluuUXESYpXsfdQCBirQr0VSxt9YOeGik jjBkGRPNrjE4QIvWHcxlAuqsk2mMqnL+YyZ2aeXwFbc3t2PBUjJ6oopmm/cVzDz52rBjEc oAefu947pGCt0h5wNJsTxdMo0ps10r9Jvv5gSqcj5AFV1ogcBr8RzvxtreWLhw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7DW0B7CzpWd; Thu, 23 Jan 2025 17:27: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 50NHRMfP022312; Thu, 23 Jan 2025 17:27:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRMAn022309; Thu, 23 Jan 2025 17:27:22 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:22 GMT Message-Id: <202501231727.50NHRMAn022309@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: 7eb3273a7b58 - main - stand/efi: Use hex values to get the uart 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7eb3273a7b5854bcd4b1ff727d50e22774122987 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=7eb3273a7b5854bcd4b1ff727d50e22774122987 commit 7eb3273a7b5854bcd4b1ff727d50e22774122987 Author: Andrew Turner AuthorDate: 2025-01-23 17:10:54 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:25 +0000 stand/efi: Use hex values to get the uart type To keep the SPCR uart type to name map aligned always use the hex value as an index in the types array. Reviewed by: manu, imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D48525 --- stand/efi/loader/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index 213089961704..6dcdb4cb3334 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -798,10 +798,10 @@ static const char * acpi_uart_type(UINT8 t) { static const char *types[] = { - [0] = "ns8250", /* Full 16550 */ - [1] = "ns8250", /* DBGP Rev 1 16550 subset */ - [3] = "pl011", /* Arm PL011 */ - [5] = "ns8250", /* Nvidia 16550 */ + [0x00] = "ns8250", /* Full 16550 */ + [0x01] = "ns8250", /* DBGP Rev 1 16550 subset */ + [0x03] = "pl011", /* Arm PL011 */ + [0x05] = "ns8250", /* Nvidia 16550 */ [0x12] = "ns8250", /* 16550 defined in SerialPort */ }; From nobody Thu Jan 23 17:27:24 2025 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 4Yf7DY03V8z5lDWb; Thu, 23 Jan 2025 17:27: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 4Yf7DX1Nn6z43Ss; Thu, 23 Jan 2025 17:27:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ihmISmaq9iLNNGSKQ5bGKDgCg4Z7VvjPNPurETercsw=; b=VtCbbeOEcjDUgIbMraf7lhsG+5WU24cqSBO9j9gvTBB5auqPZnUe/1mrCYDWBL1zPx6lvw q4eXHjm4MDIuSFq8EisjIgQDuCcbNm0V9vZzZxey96UXRi7D/hDNa1Sv7hca0LihXTm44b cpj3CSY3ivB86EIOZVuhgRCYBV7F3c4l4We+nQ0wwQiKussj5nXgD0rwl/IMXhPTDk4TS5 3qJdRzifGLXVdKWGBO4vTVznDYp4K3yKgYOeFMy2wKYuoZunqV2a6oTZMWYv7e98B6RczG Eyw0Pl8McDiBZOZkYc6rze6wRBx1MiUIZvWfQZUh+nUVBrxpi1dPCrOzk9LuMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ihmISmaq9iLNNGSKQ5bGKDgCg4Z7VvjPNPurETercsw=; b=XGv5BdwA82u55ksOE8ZUzeGzfi6H6eg1s6uL9EaE6mT3Y6RArajmFpKFbQIGla2lhMQBt8 9fgE1/jqhV+9CTkCoJmdp3gFPY0c9FQf/hlPzYCq6odYsiCym0fncTyi52aC/y/hUZ9Qvy pg2U6gaDny9//b5fpZxSlix9kVb/M4vK5fFqMJbucPXR4h8c44gPKsfukex1ctHcyZ2JLE qaC1JYzVmZrjGOJwALoYdczH3i2mvTasYhs8hKtzat0b8bRI39Kg0qZoVROUAF9QvKnk/3 NNXoz88q8fJMUeg+lfSPYG0epd841Iwb5W1x32A0SnIR9rk3sks8paXzNZW6kg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653244; a=rsa-sha256; cv=none; b=E4Ue8VwZlKkPOUiv3z6w0o8PRBCFRQP9lGG4eC2VbOQZdiZjUL3QFZkVhOGzg26LaQWEC3 iTf4OBqxbvkdYkXILV0q40ri1tMQOfyv82IbZw+Y/wzK6AhU2S/uMfY6agxc+LrKIcZUjd /TX/RqBMdRHJ2Sur/3i2a1uKMZm+UbV4SjGcNtr1dVFieEpwit4yGbG75upJenj6oQs70c xpqW9Rvy4vwDWOrwzcMnNbm0Dn1RUNa4Ngu0zLSYcHQ06giNJC/cxvO/UquXU2gmQcK1pG ZGA9fe7zl4TlYuz6qhiTWuFjtLvt0qDQfSQYBYd3kmFwS4XwC0/BL0Jw//gCIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7DX0ySfzp0q; Thu, 23 Jan 2025 17:27: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 50NHROPd022346; Thu, 23 Jan 2025 17:27:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRO8b022343; Thu, 23 Jan 2025 17:27:24 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:24 GMT Message-Id: <202501231727.50NHRO8b022343@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: 038457dde93c - main - stand/efi: Add more pl011-like uarts 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: 038457dde93c395cee7746f1f2a484056ab60703 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=038457dde93c395cee7746f1f2a484056ab60703 commit 038457dde93c395cee7746f1f2a484056ab60703 Author: Andrew Turner AuthorDate: 2025-01-23 17:11:04 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:25 +0000 stand/efi: Add more pl011-like uarts The Arm SBSA uarts are handled by the pl011 driver. Add them to the list of pl011 uarts. Reviewed by: manu, imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D48526 --- stand/efi/loader/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index 6dcdb4cb3334..76e02e461aa8 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -802,6 +802,8 @@ acpi_uart_type(UINT8 t) [0x01] = "ns8250", /* DBGP Rev 1 16550 subset */ [0x03] = "pl011", /* Arm PL011 */ [0x05] = "ns8250", /* Nvidia 16550 */ + [0x0d] = "pl011", /* Arm SBSA 32-bit width */ + [0x0e] = "pl011", /* Arm SBSA generic */ [0x12] = "ns8250", /* 16550 defined in SerialPort */ }; From nobody Thu Jan 23 17:27:26 2025 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 4Yf7DZ5NGpz5lDDM; Thu, 23 Jan 2025 17:27:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yf7DZ3MHhz43TT; Thu, 23 Jan 2025 17:27:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653246; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZAo0DJrD0DfdVdzIaa/kW9bF1i1hprreaIq2eSDRyqo=; b=OxSb2pUj4V0PknA1ZCjVUzvz0DAcr5ry4nDwjAzKUcUx97gSWGCyJ/UodBTYSYK6QTYz2g 37DBzEn9aeVGhzWOSV9BG6YT1Mw/S9D0Ovrla+i91/MlYUJYlJZKDR3G+XIJfAWIRJEpJ6 mj4E5etyOWR+c1R1ez/AovZ40zXK3xW378WVT492hAoI9B+jukoDVrdK8ZRAkC0tt4Ycqh 43lgXjPbZjOcBha1GeLLn5pQorbpdncWHMu7Q/KT1RyPUNHmpjerwlaoTfMmVfgA7QF+dG tsu8M4YT8pSZ23HU3qOT6IA/zacqfjsVJDfuJq4bOf829tAyNoafyEVIdkTrOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653246; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZAo0DJrD0DfdVdzIaa/kW9bF1i1hprreaIq2eSDRyqo=; b=ES1q1cu6Zp+dU0rqSLo7xscldotA72bwHxBxx9luWUvV0mzoPKeTIMwai+tejZ5RrAfgRf EKRlLIgbP0dl5ZpQYTXh8x7Ep1h6VWhuMmqwjtFdWQAEIOqqindLCqBpE9/kLM6acw9qC/ oGghtYQBJUhU6mL9TBMO/UEV4gXroAGPfmNvN9svu+mmsf2rwQNIr5Kpo8LgViRGoBruMW Pq00/ecLLXwbgB6B7pAOQyuCBQ+AJ1CVHW8NKDWw08PYsHkuV0QOX8BedJZsSRbcQmm6x/ entkPG6L5Pv+c7eY9ZFXyhnVbXvJhukmx+JFc0CW8vVwnb4YbIj7cy4ZGKTPgg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653246; a=rsa-sha256; cv=none; b=AeU5EnU530ybwQdi8iK0MVyZsByavj3LnFF91J3kFvWUl2CmgCsHeWJ/REyWrbS04shvtu IJPDRy/B4RJVNrizhBF3jAiyGmx5JUVR5JUNHKx2p98zn/20yZfCiJxGcCTU3Z2bXnhJnP s1kgC6AT1TA/43QOgYtm//SV4EkKVZzYtyXtbrOAjw5GbeCfApjWsQzeRwJDXVrC5NixpS EJqPZPgowIu40fTw3B3sWaQumVEsbSXmAb4+nnb8RTN1wj0hrlZ3DQVGWHjRwm+vn88U0n 5AmHxeq851nM5hGRH+EO5yTI89Vh5H6cVseghmVYwp5OJ7ccevnIP34Zn6SAIQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7DZ2wybznrF; Thu, 23 Jan 2025 17:27: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 50NHRQJE022420; Thu, 23 Jan 2025 17:27:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRQDB022417; Thu, 23 Jan 2025 17:27:26 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:26 GMT Message-Id: <202501231727.50NHRQDB022417@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: aa1279d817a7 - main - arm64: add HWCAP for FEAT_WFxT 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: aa1279d817a75d0ada3178f596d7ea984ebfe184 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=aa1279d817a75d0ada3178f596d7ea984ebfe184 commit aa1279d817a75d0ada3178f596d7ea984ebfe184 Author: Harry Moulton AuthorDate: 2025-01-23 12:26:23 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:25 +0000 arm64: add HWCAP for FEAT_WFxT Add the HWCAP for ARMv8.7 FEAT_WFxT. Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D48578 Signed-off-by: Harry Moulton --- sys/arm64/arm64/identcpu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index 646d10d5ae1a..d430dc649e0b 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -1048,6 +1048,11 @@ static const struct mrs_field_value id_aa64isar2_wfxt[] = { MRS_FIELD_VALUE_END, }; +static const struct mrs_field_hwcap id_aa64isar2_wfxt_caps[] = { + MRS_HWCAP(2, HWCAP2_WFXT, ID_AA64ISAR2_WFxT_IMPL), + MRS_HWCAP_END +}; + static const struct mrs_field id_aa64isar2_fields[] = { MRS_FIELD(ID_AA64ISAR2, PAC_frac, false, MRS_LOWER, 0, id_aa64isar2_pac_frac), @@ -1059,7 +1064,8 @@ static const struct mrs_field id_aa64isar2_fields[] = { id_aa64isar2_gpa3, id_aa64isar2_gpa3_caps), MRS_FIELD_HWCAP(ID_AA64ISAR2, RPRES, false, MRS_LOWER, MRS_USERSPACE, id_aa64isar2_rpres, id_aa64isar2_rpres_caps), - MRS_FIELD(ID_AA64ISAR2, WFxT, false, MRS_LOWER, 0, id_aa64isar2_wfxt), + MRS_FIELD_HWCAP(ID_AA64ISAR2, WFxT, false, MRS_LOWER, 0, + id_aa64isar2_wfxt, id_aa64isar2_wfxt_caps), MRS_FIELD_END, }; From nobody Thu Jan 23 17:27:27 2025 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 4Yf7Dc1Z7vz5lDWd; Thu, 23 Jan 2025 17:27: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 4Yf7Db4Pc8z43R0; Thu, 23 Jan 2025 17:27:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HxfipjERwRnVh/++WHeSYkZxmA8spQ1sQkLYCMRCybg=; b=mtBAZRVY13oDGR8y8NO3dYCEWBI+x+5++WPzPMBLBsAsn7r1PNqtV9H1wz5DhFKna96zpz 6MhrqDhBlnYoIVBJGKDBQuAASG2zpRoc9kmvLnf0AUZZPCbmSEwZ/pTNKfglSE50WN2Wqd pmi5uxR1h2cz+tGUEvwuoGVB/rsnEib3J24d5Q1ibkd91gDOoyceioPN4ACbS+4ftaChYa wiVuUTzGelPwtIp1BsRqMoAS5ild4MpGJAAucnwhADluXw7AfW8s330pMlIznHSdcURyrf btwyLQWGRXqxOyUjCJwvIl1D47gRKEM0vpe7+w6KBwy6Q3CIZUp72A2qbFTxmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HxfipjERwRnVh/++WHeSYkZxmA8spQ1sQkLYCMRCybg=; b=RlsBW+JLDINUDDvxOcr+H+5Rm/yIydeBon87kPbdWVxfbfPENvVYbQEl/l6wOUwGd7+ryK 6VCp5PJ3+xSL4zC4288ofhOOzIrBZ6bN0RqkNtyCD2IIwAFXUC+sHbx+dfBBJhav+biH0O LtaYbtQfRUuXBEePuG6iyETUIzOisJXMYh7Ee8rZGnCskJPF4mvTV0m2SMedFqM178qCc1 qrz13MFFLGeNtknXBgmVXgo9Avg1Pf1yIcUfDrWODeHOxSlOhio1vVwVeRkxQnrWAgthW6 vU9DiZddCqOeBsG3evH9KG8C+5stzAN0k+s+Mh5bha38gIbo/x0pv8Qj+MWN4Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653247; a=rsa-sha256; cv=none; b=ZdFVBrcAZxObr2DPVwOIufMIPUz2+tNxiGXT/yz6y6diK11BmfuRzZbtiWdIupo5BNyoP4 DrL3sOTUh4HKUHOVg94IXwp9KvXGLBqejBSstEyVqaTC83DkbV8FF64C8BMLxF9lHU99j8 6TvJw+iJUBsubc01FXV47Vks0rxt1KdZsIXa95kztpzsPojtd/7FgvKNGBGq9oQJTEfuCl iAqMgVK5EcX+anEvbQ/sOtkbu6oXH172s1NmUoCvJoyPCA27E6TZ7WC/Wkc8ztQKIEwSh6 mp7cr/t0wxb+P2RQIwcaH7V8p/ZcU36filu5AFfsDjVUjv6B/GzBL7XKdmLovw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7Db3mswzpBH; Thu, 23 Jan 2025 17:27: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 50NHRRxX022453; Thu, 23 Jan 2025 17:27:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRRQX022450; Thu, 23 Jan 2025 17:27:27 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:27 GMT Message-Id: <202501231727.50NHRRQX022450@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: e1c77d783206 - main - arm64: add inline functions for FEAT_WFxT instructions 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: e1c77d783206bceee1f8d5fcbb0b3df214b4b282 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=e1c77d783206bceee1f8d5fcbb0b3df214b4b282 commit e1c77d783206bceee1f8d5fcbb0b3df214b4b282 Author: Harry Moulton AuthorDate: 2025-01-23 12:27:28 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:25 +0000 arm64: add inline functions for FEAT_WFxT instructions This adds inline functions for WFET/WFIT instructions introduced with ARMv8.7 FEAT_WFxT. These instructions allow for regular WFE/WFI instructions to be bound by a timeout. Once the value of CNTVCT_EL0 reaches, or exceeds, that of the timeout value, the WFE/WFI state will be exited and the PE will continue. These instructions are implemented as inline functions, with a write to the corresponding system register acting as an alias for the two instructions. Writing to these registers is only valid on ARMv8.7 and above, therefore the use of these functions must be guarded by a feature check. Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D48579 Signed-off-by: Harry Moulton --- sys/arm64/include/cpufunc.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sys/arm64/include/cpufunc.h b/sys/arm64/include/cpufunc.h index ba712f48b262..c948799eb7b9 100644 --- a/sys/arm64/include/cpufunc.h +++ b/sys/arm64/include/cpufunc.h @@ -160,6 +160,26 @@ invalidate_local_icache(void) "isb \n"); } +static __inline void +wfet(uint64_t val) +{ + __asm __volatile( + "msr s0_3_c1_c0_0, %0\n" + : + : "r" ((val)) + : "memory"); +} + +static __inline void +wfit(uint64_t val) +{ + __asm __volatile( + "msr s0_3_c1_c0_1, %0\n" + : + : "r" ((val)) + : "memory"); +} + extern bool icache_aliasing; extern bool icache_vmid; From nobody Thu Jan 23 17:27:28 2025 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 4Yf7Dd23Xgz5lDDN; Thu, 23 Jan 2025 17:27:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yf7Dc5Pz6z43fb; Thu, 23 Jan 2025 17:27:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653248; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jgCFgZGdpmaroX601qUfNSBmoEgHIJ5u6uf+beXZKvw=; b=P/Rss7LMH9Hv+KgBVfkoyDQO2IXsotv6hfa/gWmpgDYIeKkrztDMDzMvz9cT0WyclelYHJ 6opSa9xhbhdghyRmCUWsgFDRLQENjKc+scvfdiMqY9+BD/gOfh85gTksQpf1Qubg7dmvL3 qHpz7MZ9ZAejEWAut06Pq4TWNdJ9AD8QjByRAbwTlFydjCrw1o9+stRJXa/LDIM+PjTjd9 p4wiyVvUQHiSkZlesdE0uFrPDy6+XHFjWdBfWpLfrfp4zzG0eul2lUld3wmSedCg0W6Qx6 4wx+TWtzORT83Ni6akCEPqEcjC73lubD7IywvmVIzLp0ucErSxS3TaDoNejadQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653248; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jgCFgZGdpmaroX601qUfNSBmoEgHIJ5u6uf+beXZKvw=; b=sNSEjAtKDjnbRXlg2EjzBkhYr2VyqHLqu0+dEN5+76Wpq7tH7zQ4CUQ/VTIUu3eiFnBG88 /CcIokdRsy1fnATjKawWvm9rsHonXXZRdoPSsbKV/Jrd2Xs7aZiTLSLJobIJcxqU7EekTX lzYoD+kowCGZb39KaZYgnQ66XT6ZPL04r/gEhgWURJm4zBHPTJEuifUEX2FjFkXBndniPy Ydzr7ub/T42cVrXsAAe0DhaSx9Yn3wEKQ/qDcQJsKkufzJsgjHTePbpEr0aoussp8uMyrw F8fElbjOAFPqt0RYFApmQfbBsbz0Ll5ZnS5lQQxUUGtlLcimBs8V8lzJKEFGig== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653248; a=rsa-sha256; cv=none; b=dEROk4C6rltG4XDwaIftkyfzrypPmamV6JNPhXgQkgZlaQ8prPhaLIcePXyx8azP/HQPQh N4xDEKRDo/G/OSwsJwVEcRdt0Y4h7tcK/Sa5UIHCfFvo9M/924pkaxkwMq71x6nikpWsgw J7Q1C7s36SRjm5aS2hQ1wbYxsonLw5PcHStoqaMl5D0bYPjfYQkbkUTysskKI2I2Rbr5uq wNGZd+MVFgn5Zlc4jEgsdSUYvAmV2XoLKxYthen3peWy9+7RfzeoX7K4FEpfGrDdMfIOvl LVuh9AwOlNGgqTmsCnfSf43B0hMnNtYw0gzlzKuOU+hMrE9F7W4yqHV1KSak3Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7Dc4kX9zpBJ; Thu, 23 Jan 2025 17:27: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 50NHRSl1022486; Thu, 23 Jan 2025 17:27:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRSjq022483; Thu, 23 Jan 2025 17:27:28 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:28 GMT Message-Id: <202501231727.50NHRSjq022483@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: 4d1acfb132a5 - main - arm64: add HCRX_EL2 register 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: 4d1acfb132a5e6f31fc7786ea22c3239c2573b8c Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=4d1acfb132a5e6f31fc7786ea22c3239c2573b8c commit 4d1acfb132a5e6f31fc7786ea22c3239c2573b8c Author: Harry Moulton AuthorDate: 2025-01-23 12:28:28 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:26 +0000 arm64: add HCRX_EL2 register HCRX_EL2 is the Extended Hypervisor Configuration Register introduced with FEAT_HCX in ARMv8.7. All fields in this register are used for features in ARMv8.7 and above. Initially zero the register, incase firmware has not properly configured it. Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D48583 Signed-off-by: Harry Moulton --- sys/arm64/arm64/locore.S | 19 ++++++++++++++++--- sys/arm64/include/hypervisor.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index e721092455e8..f3b846eee412 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -351,7 +351,6 @@ LENTRY(enter_kernel_el) isb mrs x4, hcr_el2 - /* Load the Virtualization Process ID Register */ mrs x2, midr_el1 msr vpidr_el2, x2 @@ -400,6 +399,20 @@ LENTRY(enter_kernel_el) /* Set the return PSTATE */ msr spsr_el2, x5 + /* + * Configure the Extended Hypervisor register. This is only valid if + * FEAT_HCX is enabled. + */ + mrs x2, id_aa64mmfr1_el1 + ubfx x2, x2, #ID_AA64MMFR1_HCX_SHIFT, #ID_AA64MMFR1_HCX_WIDTH + cbz x2, 2f + + /* Extended Hypervisor Configuration */ + mov x2, xzr + msr HCRX_EL2_REG, x2 + isb +2: + /* Don't trap to EL2 for CP15 traps */ msr hstr_el2, xzr @@ -414,13 +427,13 @@ LENTRY(enter_kernel_el) /* Extract GIC bits from the register */ ubfx x2, x2, #ID_AA64PFR0_GIC_SHIFT, #ID_AA64PFR0_GIC_BITS /* GIC[3:0] != 0000 - GIC CPU interface via special regs. supported */ - cbz x2, 2f + cbz x2, 3f mrs x2, icc_sre_el2 orr x2, x2, #ICC_SRE_EL2_EN /* Enable access from insecure EL1 */ orr x2, x2, #ICC_SRE_EL2_SRE /* Enable system registers */ msr icc_sre_el2, x2 -2: +3: /* Set the address to return to our return address */ msr elr_el2, x30 diff --git a/sys/arm64/include/hypervisor.h b/sys/arm64/include/hypervisor.h index e3bdd83e8a29..15fc36014626 100644 --- a/sys/arm64/include/hypervisor.h +++ b/sys/arm64/include/hypervisor.h @@ -132,6 +132,41 @@ #define HCR_TWEDEn (UL(0x1) << 59) #define HCR_TWEDEL_MASK (UL(0xf) << 60) +/* HCRX_EL2 - Extended Hypervisor Configuration Register */ +#define HCRX_EL2_REG MRS_REG_ALT_NAME(HCRX_EL2) +#define HCRX_EL2_op0 3 +#define HCRX_EL2_op1 4 +#define HCRX_EL2_CRn 1 +#define HCRX_EL2_CRm 2 +#define HCRX_EL2_op2 2 + +#define HCRX_EnAS0 (UL(0x1) << 0) +#define HCRX_EnALS (UL(0x1) << 1) +#define HCRX_EnASR (UL(0x1) << 2) +#define HCRX_FnXS (UL(0x1) << 3) +#define HCRX_FGTnXS (UL(0x1) << 4) +#define HCRX_SMPME (UL(0x1) << 5) +#define HCRX_TALLINT (UL(0x1) << 6) +#define HCRX_VINMI (UL(0x1) << 7) +#define HCRX_VFNMI (UL(0x1) << 8) +#define HCRX_CMOW (UL(0x1) << 9) +#define HCRX_MCE2 (UL(0x1) << 10) +#define HCRX_MSCEn (UL(0x1) << 11) +/* Bits 12 & 13 are reserved */ +#define HCRX_TCR2En (UL(0x1) << 14) +#define HCRX_SCTLR2En (UL(0x1) << 15) +#define HCRX_PTTWI (UL(0x1) << 16) +#define HCRX_D128En (UL(0x1) << 17) +#define HCRX_EnSNERR (UL(0x1) << 18) +#define HCRX_TMEA (UL(0x1) << 19) +#define HCRX_EnSDERR (UL(0x1) << 20) +#define HCRX_EnIDCP128 (UL(0x1) << 21) +#define HCRX_GCSEn (UL(0x1) << 22) +#define HCRX_EnFPM (UL(0x1) << 23) +#define HCRX_PACMEn (UL(0x1) << 24) +/* Bit 25 is reserved */ +#define HCRX_SRMASKEn (UL(0x1) << 26) + /* HPFAR_EL2 - Hypervisor IPA Fault Address Register */ #define HPFAR_EL2_FIPA_SHIFT 4 #define HPFAR_EL2_FIPA_MASK 0xfffffffff0 From nobody Thu Jan 23 17:27:29 2025 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 4Yf7Df5BcSz5lDH9; Thu, 23 Jan 2025 17:27: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 4Yf7Dd65Jfz43fn; Thu, 23 Jan 2025 17:27:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ENJuHxh5VZRJwsG5Eo9Mi7JkXdD6gJpz8FZ+F0Y9Yrk=; b=dA5aNymWFqSl+/cLNKKhO3TJcmpsJb+zndyWdbS5mypdP4kh67qnM+EJ7Bkl2XKIq4ROu4 GgQN3TSdQtxTM/0Ob5wGsYbJ/l4jVKT8i+JL3f2vJeKpGZbthchB2fTCzcvSFSOnt4cfwm /tefV0nBSOR8sw+TetEvp0InIEfdRjazGinBw9lKVIvi9FwiuVPRJKgj8eZGPcOeLa98AC 2uX9OS6L9ujkV0B5hWNcBDW9Jb0+WQ1XGjsoqJe4PQP4+oMLzplPqX1neCuAVrVSBUZ6na u59Ni6wC010jglOYSTFybU3WoOvi14xuiHf7Ri6OgwoNb626vTqydRP0Fw9b0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ENJuHxh5VZRJwsG5Eo9Mi7JkXdD6gJpz8FZ+F0Y9Yrk=; b=niUlQpHMZ3sx91dguoNCgD6zk8UTdN55PHhRMN/C00UES5toBCUsvIlQnmDGUY0Di+Wttl zN+WrclyImMnp92IsDoKB2iOwh2ySA6ZcDgqfWGJjKk6Sh6bDMtszMZbHjA26Tp2ubRcQp xlhNKLFSpD4PP4h0BvCKLmSb1pvohNEeNvkc92bpnSW8xlmw0C28h21Tw8MtPyWyQVAe9y 6ISy4dQ2Wb8IQpgbfS5GUINjpk43PKOvebuIHf0El+ShBbbyNoaW/ZWiY/l+dp0xIxMNqD XqsuADTc6iq13XffELoudLcl0gWl6bRpgM9c6lqoIMCK+Kr7nZ0mqZxH4npFuQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653249; a=rsa-sha256; cv=none; b=U21ZWZ3noulq4Kjy5OD2hUg4pB9wo8To/cl+soUwm2XlyvTKfRYdergy07J9rssacVbVtU 1wddRd09ytHroaN9Dh2U85qr9wv0gp1UcizJksbFhxW4gczcH2J/BT7ppODRdnPgCx2/CG Z9eyTps+hl6OZQHGrBA7tfB18PvmRzzCkhIlFLzR4UExDyL7t8hM56xYgfbyByCOhLhZUY Uwwzru9iWVUJ4Vxese4LCjEJiPhg4Cj6F+uxs7wkheshB5f1eceqojww8crItf79+Iw7sO cWEQV46drUqZAJndxQtUu+3RyMUyazWrvdWxGhaUQ5SpfzOmcfIULu33EzB87A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7Dd5fkDzpF6; Thu, 23 Jan 2025 17:27: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 50NHRT3p022520; Thu, 23 Jan 2025 17:27:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRTTa022516; Thu, 23 Jan 2025 17:27:29 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:29 GMT Message-Id: <202501231727.50NHRTTa022516@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: 00b77e631bff - main - scmi: Fix token bitmask 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: 00b77e631bff6104c6327e9920dfac98bb47697b Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=00b77e631bff6104c6327e9920dfac98bb47697b commit 00b77e631bff6104c6327e9920dfac98bb47697b Author: Cristian Marussi AuthorDate: 2025-01-23 12:44:31 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:26 +0000 scmi: Fix token bitmask By the SCMI specification the message sequence number field is 10-bit long. Fix accordingly the used bitmask. Fixes: d220b1cf02ce ("scmi: Extend and refactor SCMI shmem support") Tested on: Arm Morello Board Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47418 Signed-off-by: Cristian Marussi --- sys/dev/firmware/arm/scmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/firmware/arm/scmi.c b/sys/dev/firmware/arm/scmi.c index 82c06e969926..c2585d8d9637 100644 --- a/sys/dev/firmware/arm/scmi.c +++ b/sys/dev/firmware/arm/scmi.c @@ -55,7 +55,7 @@ #define SCMI_MAX_TOKEN 1024 #define SCMI_HDR_TOKEN_S 18 -#define SCMI_HDR_TOKEN_BF (0x3fff) +#define SCMI_HDR_TOKEN_BF (0x3ff) #define SCMI_HDR_TOKEN_M (SCMI_HDR_TOKEN_BF << SCMI_HDR_TOKEN_S) #define SCMI_HDR_PROTOCOL_ID_S 10 From nobody Thu Jan 23 17:27:36 2025 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 4Yf7Dn1l5Cz5lDYd; Thu, 23 Jan 2025 17:27:37 +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 4Yf7Dm2r2vz43gp; Thu, 23 Jan 2025 17:27:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vU2yUHa+ePCct8czLydXqH1SU6DKVil0MNCdMDRfLQs=; b=yieXUp4To6rbST1ykTf+KOX6V3Dt2ABxb+G2Cz0CZhVT4nkuz1yu+G8sKagw5BohJnfITT LTYvWOy1Mxa2uivAtsrCF1e0021QJOVzZd9gSRHEDybs/7I9iMmti3OlQNGWT+jpgAxjvc /IVU74tEbIayPeKLQ22WSPwP+lUsgjJpR44YRVs4PQtrdyjsf7hk31rHk3SaYrk1vh2/Bw 09dwfmzucDFM/N7L9YI58ZAy3GKrt3fq/heUz700op6V1e7pyEKlp3n/pn7qezYqP1LhPT OkhBo2IBIueYRFEs/3Dem596YIQYepVOwEoCpkuPzRPj+U00QtwPAdIWcxfFTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vU2yUHa+ePCct8czLydXqH1SU6DKVil0MNCdMDRfLQs=; b=cpH4bFlwyr6iLqvSSwKf8+C+WdrRJgx02xxbzxLCZCVxPyWbevWj23/9YjFJBga08vBZGB /0RqI+za1Vy5GKnyPonC5WNOyXbsPd4Z/zMQyPYJVXG63Oq0p+0sY95kwVX6wkac6VenoC clUKJgBdnMLctI9X1iYS0PfbwWIjep9h8OjmPmzSQYUjimHfpQLKE+KX8zb+x7o21oRb3R 1I1+eeX8ypL/eMzccNKUpjsseMVzcZZC0WPhBOyu5Aw9rhf+HH/2KoAMEPZ4Y0PmShxYBQ VzEc9nOBN4moo0zru8D/PaDhiNFL6Ie1LwlCwUiBFQs6Rr01tCeqefrdTxRoZw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653256; a=rsa-sha256; cv=none; b=Y7HLREFMjosBdweJSEIBeFoJcHdzizAGl66tgki+cPIod1CQcqIiqMFu+rJ3p1UYPP6lP4 PhcQ4UlJgo74XKbmWRHV8FktX0WP08iAudFWZWwDx8f/bxEjcDNDrYtP6cocgzffUBmwAo VgEpbn2mFRe1UqOxfTNbDKFzAihjV3o8XGdSitc0/No9jye6X7nlNvvqNGNihXKK8XfueT PMQ5c8dQnRseOzRJML1V5Cf3S++rq1sBEXY0E66mWuJUdLWQf3HXLYhhiBJL3rH4foglvq +5zNV2cA4WkMvQExcHP8TjlUhiYmCIxKXoh8LSA5FjjxDUHYL5Dirla58jeddA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7Dm2QkNzp0v; Thu, 23 Jan 2025 17:27:36 +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 50NHRaMQ022738; Thu, 23 Jan 2025 17:27:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRabp022734; Thu, 23 Jan 2025 17:27:36 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:36 GMT Message-Id: <202501231727.50NHRabp022734@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: c508841dfc59 - main - scmi: Add scmi_token_reserve helper 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: c508841dfc5923ef81ed8ea61da364fb20616bbf Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=c508841dfc5923ef81ed8ea61da364fb20616bbf commit c508841dfc5923ef81ed8ea61da364fb20616bbf Author: Cristian Marussi AuthorDate: 2025-01-23 13:24:06 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:27 +0000 scmi: Add scmi_token_reserve helper During normal operation, the SCMI stack, upon each transmission attempt, takes care to automatically pick an appropriate, monotonically increasing, sequence number to fill-in the token field in the egressing message. This does not cope well with the alternative scenario in which, instead, a complete and fully formed message is provided upfront: in such a case the SCMI stack will have to use the already provided sequence number, embedded in the message, to track such transaction. Add a method to attempt to reserve a specific sequence number to be used when a fully firmed (raw) message is handled. Tested on: Arm Morello Board Reviewed by: andrew Sponsored by: Arm Ltd Pull Request: https://reviews.freebsd.org/D47424 Signed-off-by: Cristian Marussi --- sys/dev/firmware/arm/scmi.c | 48 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/sys/dev/firmware/arm/scmi.c b/sys/dev/firmware/arm/scmi.c index 8104f4e10429..c24768a5668a 100644 --- a/sys/dev/firmware/arm/scmi.c +++ b/sys/dev/firmware/arm/scmi.c @@ -93,6 +93,7 @@ struct scmi_req { bool timed_out; bool use_polling; bool done; + bool is_raw; struct mtx mtx; LIST_ENTRY(scmi_req) next; int protocol_id; @@ -139,6 +140,7 @@ static void scmi_req_free_unlocked(struct scmi_softc *, static void scmi_req_get(struct scmi_softc *, struct scmi_req *); static void scmi_req_put(struct scmi_softc *, struct scmi_req *); static int scmi_token_pick(struct scmi_softc *); +static int scmi_token_reserve(struct scmi_softc *, uint16_t); static void scmi_token_release_unlocked(struct scmi_softc *, int); static int scmi_req_track_inflight(struct scmi_softc *, struct scmi_req *); @@ -376,6 +378,7 @@ scmi_req_free_unlocked(struct scmi_softc *sc, enum scmi_chan ch_idx, mtx_lock_spin(&rp->mtx); req->timed_out = false; req->done = false; + req->is_raw = false; refcount_init(&req->cnt, 0); LIST_INSERT_HEAD(&rp->head, req, next); mtx_unlock_spin(&rp->mtx); @@ -424,7 +427,6 @@ scmi_token_pick(struct scmi_softc *sc) */ next_msg_id = sc->trs->next_id++ & SCMI_HDR_TOKEN_BF; token = BIT_FFS_AT(SCMI_MAX_TOKEN, &sc->trs->avail_tokens, next_msg_id); - /* TODO Account for wrap-arounds and holes */ if (token != 0) BIT_CLR(SCMI_MAX_TOKEN, token - 1, &sc->trs->avail_tokens); mtx_unlock_spin(&sc->trs->mtx); @@ -440,6 +442,28 @@ scmi_token_pick(struct scmi_softc *sc) return ((int)(token - 1)); } +static int +scmi_token_reserve(struct scmi_softc *sc, uint16_t candidate) +{ + int token = -EBUSY, retries = 3; + + do { + mtx_lock_spin(&sc->trs->mtx); + if (BIT_ISSET(SCMI_MAX_TOKEN, candidate, &sc->trs->avail_tokens)) { + BIT_CLR(SCMI_MAX_TOKEN, candidate, &sc->trs->avail_tokens); + token = candidate; + sc->trs->next_id++; + } + mtx_unlock_spin(&sc->trs->mtx); + if (token == candidate || retries-- == 0) + break; + + pause("scmi_tk_reserve", hz); + } while (1); + + return (token); +} + static void scmi_token_release_unlocked(struct scmi_softc *sc, int token) { @@ -450,19 +474,23 @@ scmi_token_release_unlocked(struct scmi_softc *sc, int token) static int scmi_finalize_req(struct scmi_softc *sc, struct scmi_req *req) { - uint32_t header = 0; + if (!req->is_raw) + req->token = scmi_token_pick(sc); + else + req->token = scmi_token_reserve(sc, SCMI_MSG_TOKEN(req->msg.hdr)); - req->token = scmi_token_pick(sc); if (req->token < 0) return (EBUSY); - header = req->message_id; - header |= SCMI_MSG_TYPE_CMD << SCMI_HDR_MESSAGE_TYPE_S; - header |= req->protocol_id << SCMI_HDR_PROTOCOL_ID_S; - header |= req->token << SCMI_HDR_TOKEN_S; + if (!req->is_raw) { + req->msg.hdr = req->message_id; + req->msg.hdr |= SCMI_MSG_TYPE_CMD << SCMI_HDR_MESSAGE_TYPE_S; + req->msg.hdr |= req->protocol_id << SCMI_HDR_PROTOCOL_ID_S; + req->msg.hdr |= req->token << SCMI_HDR_TOKEN_S; + } - req->header = htole32(header); - req->msg.hdr = htole32(header); + /* Save requested header */ + req->header = req->msg.hdr; return (0); } @@ -670,6 +698,8 @@ scmi_msg_get(device_t dev, int tx_payld_sz, int rx_payld_sz) if (req == NULL) return (NULL); + req->is_raw = true; + return (&req->msg); } From nobody Thu Jan 23 17:27:30 2025 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 4Yf7Dg1KJ8z5lDTh; Thu, 23 Jan 2025 17:27: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 4Yf7Df6wy6z43VS; Thu, 23 Jan 2025 17:27:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=R/uWVTTbXF1H8L8cExaPB905oE+Ssz1kc3b80Xa3ahA=; b=v+pXFmpv2mVHGbPzVQbiP4/B1/gilJuHfkNVQviXfMExIWSJNOOmwuZA7j8VDpEcKKrUCR gvBujiwSWX9QwTJmcPyoeeSFhCc6BYAjozbc9savrnxyTqXJQYDBQ11w01JIwlGnHV4Gvf PKCYLALEbRyR494AO8oSyP6p4sAIfEZQCMoINvAL4tvKNTyWP4E1S5BPNrCi4neHDfnxy1 xCoD1k3gM1toBbNepUpZjRVEzEWlKskoUk/JI0HCVkgBY7gTWcqVzUfynB6vFYjRq6P/cc b+ByBKOl0VJRGZkSOrFcQ9KwoHXCR1xhKubV4XoIkRS7I/low9btj2JG7FtIHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=R/uWVTTbXF1H8L8cExaPB905oE+Ssz1kc3b80Xa3ahA=; b=rL5UqVZzZasjQ1rej1LqQPpRix6Fo5etYDes4SRx9x1Wg7oPOpYas6NYbACaEmzdkTHl+2 v5PTygDnfeHP34uvHG+Eob+CLlBTKw9TUL0J94QHqsBVWMIIm1x7zfvzVYflkeVzxfJ9DR 6ryhCwapgena9rZdRzDz6JzU6vQdlAbW7towzbR0Phg2LEdaUJmGXP80BRlAK4CZQD1QVT xkLwy0VElKEghceg2ATo45CjNbBzf53Ch5RSP5MHvN816SlxxjE/UOaRmCv6Vpz8kETsFg bUk/MNcBX1GLph04SE2LXCxdBmdPPmJh4fNJ8Uffd8IFTX7Oh4n4+LteVojFZw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653251; a=rsa-sha256; cv=none; b=rYrBASr2J+DRvs9OVhoUPkgkMT35SBCuloWK4HbB7q2I2kZNxhGDuULraJytHTKANUhkIB JsDI3gyNEtGn1X92fknSTHiRaH/BNDdQZied65DkHl2ExOJdOGGeg3swI83kuzpgtyXr7I XpGho/GPvLVWJAaQVfTAJ3lZU38YHb2Yz3DO33Ygtgo9BgJflBJ+m9nqAxdhnbD0Ak+d24 SBg8tn7ORRtTyFZcynhYTaHK/UMy2kAlroKd6+p99ZVSM6HEXoYooi5/T3zs6Qni+SfAKY f7Egxg47gFS8fyJAnNAT7HqXAjZmG6ScLjBb/a5yXSzZxYiefpamAkV8gggdDA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7Df6M53zp0r; Thu, 23 Jan 2025 17:27: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 50NHRUqK022559; Thu, 23 Jan 2025 17:27:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRU2H022556; Thu, 23 Jan 2025 17:27:30 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:30 GMT Message-Id: <202501231727.50NHRU2H022556@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: c56e586f0f02 - main - scmi: Fix race on timed out transmissions 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: c56e586f0f029fec4a0fee844f83ff62da20e4b6 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=c56e586f0f029fec4a0fee844f83ff62da20e4b6 commit c56e586f0f029fec4a0fee844f83ff62da20e4b6 Author: Cristian Marussi AuthorDate: 2025-01-23 12:46:38 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:26 +0000 scmi: Fix race on timed out transmissions When a waited-for outstanding request is determined to have timed out, mark such request immediately as such, so as to avoid any possible race on the IRQ path with code path evaluating that same timed out condition. Tested on: Arm Morello Board Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47419 Signed-off-by: Cristian Marussi --- sys/dev/firmware/arm/scmi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/dev/firmware/arm/scmi.c b/sys/dev/firmware/arm/scmi.c index c2585d8d9637..37496136c828 100644 --- a/sys/dev/firmware/arm/scmi.c +++ b/sys/dev/firmware/arm/scmi.c @@ -545,6 +545,7 @@ scmi_wait_for_response(struct scmi_softc *sc, struct scmi_req *req, void **out) */ mtx_lock_spin(&req->mtx); needs_drop = (ret == 0) && !req->done; + req->timed_out = ret != 0; mtx_unlock_spin(&req->mtx); if (needs_drop) scmi_req_drop_inflight(sc, req); @@ -560,6 +561,7 @@ scmi_wait_for_response(struct scmi_softc *sc, struct scmi_req *req, void **out) mtx_lock_spin(&req->mtx); if (ret != 0 && req->done) ret = 0; + req->timed_out = ret != 0; mtx_unlock_spin(&req->mtx); } @@ -569,9 +571,6 @@ scmi_wait_for_response(struct scmi_softc *sc, struct scmi_req *req, void **out) ret = req->msg.payld[0]; *out = &req->msg.payld[SCMI_MSG_HDR_SIZE]; } else { - mtx_lock_spin(&req->mtx); - req->timed_out = true; - mtx_unlock_spin(&req->mtx); device_printf(sc->dev, "Request for token 0x%X timed-out.\n", req->token); } From nobody Thu Jan 23 17:27:32 2025 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 4Yf7Dj64Qjz5lD8K; Thu, 23 Jan 2025 17:27: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 4Yf7Dj0Zxkz43SC; Thu, 23 Jan 2025 17:27:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=V1vBVrDwFi07KvxblE3WaQLORnBUVv5kZzS8nT20Ejg=; b=P/XIW9WI/JVJ4zZuGLAIekTEpsHl8MtAgo5QiXhCocJunLV1x1QssjQ+saVUhzWa13TRom 2Oa4S3C8PjgjYB0GY7yBCavcLRcV37BCEPMC/magse3Jyp6uN4Wj803cH8j+M5PSWrmWX2 Px9fqPFfdL+I6YmfTk6+WwgLDskWquq591jhzjSALiWihbPFqb/10vzAg626k54uZRO3AM HSPbEOHQtt26jlCNXEVt25u7e/hXdYGAWlnYssiK0lV07nlQ6Er3Tb5AZjI7FOlSdAOXSb Q+TVhzkg2E3f6CDeZZqtupg3xE1r/h7kgYGlN0PGSH75866weiiRnm2HeNG3oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=V1vBVrDwFi07KvxblE3WaQLORnBUVv5kZzS8nT20Ejg=; b=G3H0KAkKbxgbEuVKdJ9wVv+Sh+3umK+zOJFdNOKLwGouc7p74UpgtuCOZlDYPRtCNsO/BE bS8JOLWt0+ARkX/Dj3KyPB/zp+7xm6al6Fhf1NNzkg8Ai5ZeIokU/4RdFC4qcWI5AtgXu1 XoujEW43LWeJiAsOUW1l51FtixWnv5uL98f92qHPu9HOHbfGhl1JcfE5Ht7xcT5RCyZZfk 2shf50PtzjBLHQjCSDXn1zTf5IcPZ7Lv41zSaj9DXjLB15BgEaa63ZZWrhKD/IemHY59Np Q6LJVoALJ+vB6ndJRHPgkh/dJ+83A5Cg3rChZW+OMLx401unUCgl1UNOuVDB8Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653253; a=rsa-sha256; cv=none; b=x6tDcP29xTYP92tDSO0UIGOQoeQvCMOC5J5zZxDZ2cfr3RymSh4hUKdOBQp8aSKMzwiX2Q sGqDWiiNUi/OvEQq8KDkN+Ye9eA/Jhbc+gQwMuYTYBtByDRWDT7o2os9mA1s+xFFL103Q8 CDKPZT3QHdh50DOHp3ylyOwpdMaHRRuDb6+BfyqsuaxWAnRFKaHpUZP2UwiiDJkHJPQAUx 7/brG4kG81XXtVclttfDDjT3vh4kPeHiYLDwo8LPhcHOZTAGwUxFepcma/tniAXZ4s909y DHOHWhwtYpLaa3IvBhuPDu61OpvzDRWDGOLjnpiZ9t4D76B/Mg1eEGuz5S/+mQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7Dj0Bbfzp0s; Thu, 23 Jan 2025 17:27: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 50NHRWgS022629; Thu, 23 Jan 2025 17:27:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRWt4022626; Thu, 23 Jan 2025 17:27:32 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:32 GMT Message-Id: <202501231727.50NHRWt4022626@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: f02162394925 - main - scmi: Redefine max message payload 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0216239492579022982d94e04090f1333fee5a5 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=f0216239492579022982d94e04090f1333fee5a5 commit f0216239492579022982d94e04090f1333fee5a5 Author: Cristian Marussi AuthorDate: 2025-01-23 12:49:41 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:26 +0000 scmi: Redefine max message payload size The defined maximum payload size should not include header and status field. Fix the definition accordingly, so that it matches the definitions as can be found in the Linux SCMI stack. The semantic of this define is important since it will then be possible to override such values from devicetree, like in Linux. Tested on: Arm Morello Board Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47421 Signed-off-by: Cristian Marussi --- sys/dev/firmware/arm/scmi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/firmware/arm/scmi.h b/sys/dev/firmware/arm/scmi.h index 5ad7b0db3f5f..73b49f099ad8 100644 --- a/sys/dev/firmware/arm/scmi.h +++ b/sys/dev/firmware/arm/scmi.h @@ -36,8 +36,8 @@ #define SCMI_MAX_MSG 32 #define SCMI_MAX_MSG_PAYLD_SIZE 128 -#define SCMI_MAX_MSG_REPLY_SIZE (SCMI_MAX_MSG_PAYLD_SIZE - sizeof(uint32_t)) -#define SCMI_MAX_MSG_SIZE (SCMI_MAX_MSG_PAYLD_SIZE + sizeof(uint32_t)) +#define SCMI_MAX_MSG_REPLY_SIZE (SCMI_MAX_MSG_PAYLD_SIZE + sizeof(uint32_t)) +#define SCMI_MAX_MSG_SIZE (SCMI_MAX_MSG_REPLY_SIZE + sizeof(uint32_t)) enum scmi_chan { SCMI_CHAN_A2P, From nobody Thu Jan 23 17:27:31 2025 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 4Yf7Dh1sF5z5lDHB; Thu, 23 Jan 2025 17:27:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yf7Dh0Ct5z43S3; Thu, 23 Jan 2025 17:27:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nWxMESMBPAA/syNsiQLA5Ha9w9DjN1ePshmBVcAd2K0=; b=KT/ZvQqvSnOFDi2Bz+DhEIgZMjzGJ8t5dUxDuiySLKZfTXXNeROdLQ9CN+Xqt5N1b8ONL1 UmXy8Cg3xYhTj+2GhEc8ZL7md47ABuh7Aszg+JobuKASEcfT2CP2hFSCSU5UkBdCsHpycR U9uERDf5zm+LFl3c+YyQGOCGCge99u8JmPvcCIW7sSBCg2oxplYB8eXcdnwpb7tHfIYJsd qdg5Bduv6akiGO9x1NanmNvyyVhV/+GtMRHH9SWp9thdRLECUmxmvIa3YzUSB66Bhy1iyD XokYEOtqzTr3V3esTy89RMPPPHMK0B1w2fl0O2lIaWVWfjj+bXHSY6VRKcpgMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nWxMESMBPAA/syNsiQLA5Ha9w9DjN1ePshmBVcAd2K0=; b=lOybuI+Mgr9NbTpLJMRxg8zfuOZVdooBgow8BwNqDaH8U7qKJ7eT9H+eoNOLBOUbCEl3Ik 3Cvc/FgDxwE+JrZZTKGE1vIYMI2MZDRjOPxWnK1Dz0YYSbdgFDULs4j3iciQRCkrEqwWWT T8TBDLzt7JvK+DySf6XNfivaqcDZ2EE+HT3o60d0b47LN+IrJjVzK7OPr/R7vW2CTwdgrg +LNjYz1uGs+1nnwdZLshypaWDgpoRo/TSnsV8/TIa0INDUFxXNvcnroSOdlJxWbHtES62c UGJkyYnSx3GSBN1W8nQ1GiPV8IFnYhPeiNUKqetGuFEweLlZEwE8TpkPmKYJ1A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653252; a=rsa-sha256; cv=none; b=fpnYcZ9g/N6JWIZdKh8LxCRejo21c8mX5BYxIOVEBEaUse1Y0LnDj7CHsvdW3IgGlfxEjp WaVQN2WYCp2AI8os0m6dQvOSDo1WdqxtC17dooX9wQ3O8VDeaMlgPsLIZGhqcwhFQlAWLK w2VxbwCwXzwNHjvdlCL7giIgvCix/iHSY05gir7v8BA03rPCugsFxpM2yWgc1fHJ5b1xw0 P2X9UsUT6d19QB8bdQcyQF+ikc+ImjE9vYsXUHH1VRX7oq93/tBunEezsHZ2jMNQiQeIUD 7v8nmxck5K+obpsdTkQqKx8/NQjtv7zdeMrFZbol7rVlLp04IU8aj5nDHVCpZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7Dg6l9zzpk0; Thu, 23 Jan 2025 17:27: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 50NHRVsK022595; Thu, 23 Jan 2025 17:27:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRVig022592; Thu, 23 Jan 2025 17:27:31 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:31 GMT Message-Id: <202501231727.50NHRVig022592@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: 9342829d578e - main - scmi: Make transports report the effective length of the received messages 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: 9342829d578e26f10a5cbc26e2b9e66cfd9864c4 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=9342829d578e26f10a5cbc26e2b9e66cfd9864c4 commit 9342829d578e26f10a5cbc26e2b9e66cfd9864c4 Author: Cristian Marussi AuthorDate: 2025-01-23 12:49:02 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:26 +0000 scmi: Make transports report the effective length of the received messages Once a message is received that fits into the RX buffer, update the msg.rx_len field with the effective length of the message received. Tested on: Arm Morello Board Reviewed by: andrew Sponsored by: Arm Ltd Pull Request: https://reviews.freebsd.org/D47420 Signed-off-by: Cristian Marussi --- sys/dev/firmware/arm/scmi.c | 10 ++++++---- sys/dev/firmware/arm/scmi.h | 2 +- sys/dev/firmware/arm/scmi_mailbox.c | 10 +++++----- sys/dev/firmware/arm/scmi_shmem.c | 22 +++++++++------------- sys/dev/firmware/arm/scmi_shmem.h | 6 +++--- sys/dev/firmware/arm/scmi_smc.c | 4 ++-- sys/dev/firmware/arm/scmi_virtio.c | 5 ++--- 7 files changed, 28 insertions(+), 31 deletions(-) diff --git a/sys/dev/firmware/arm/scmi.c b/sys/dev/firmware/arm/scmi.c index 37496136c828..00a229762414 100644 --- a/sys/dev/firmware/arm/scmi.c +++ b/sys/dev/firmware/arm/scmi.c @@ -146,7 +146,8 @@ static struct scmi_req *scmi_req_lookup_inflight(struct scmi_softc *, uint32_t); static int scmi_wait_for_response(struct scmi_softc *, struct scmi_req *, void **); -static void scmi_process_response(struct scmi_softc *, uint32_t); +static void scmi_process_response(struct scmi_softc *, uint32_t, + unsigned int); int scmi_attach(device_t dev) @@ -469,7 +470,7 @@ scmi_req_lookup_inflight(struct scmi_softc *sc, uint32_t hdr) } static void -scmi_process_response(struct scmi_softc *sc, uint32_t hdr) +scmi_process_response(struct scmi_softc *sc, uint32_t hdr, uint32_t rx_len) { bool timed_out = false; struct scmi_req *req; @@ -484,6 +485,7 @@ scmi_process_response(struct scmi_softc *sc, uint32_t hdr) mtx_lock_spin(&req->mtx); req->done = true; + req->msg.rx_len = rx_len; if (!req->timed_out) { /* * Consider the case in which a polled message is picked @@ -512,7 +514,7 @@ scmi_process_response(struct scmi_softc *sc, uint32_t hdr) } void -scmi_rx_irq_callback(device_t dev, void *chan, uint32_t hdr) +scmi_rx_irq_callback(device_t dev, void *chan, uint32_t hdr, uint32_t rx_len) { struct scmi_softc *sc; @@ -524,7 +526,7 @@ scmi_rx_irq_callback(device_t dev, void *chan, uint32_t hdr) return; } - scmi_process_response(sc, hdr); + scmi_process_response(sc, hdr, rx_len); } static int diff --git a/sys/dev/firmware/arm/scmi.h b/sys/dev/firmware/arm/scmi.h index 345ae6eeb03a..5ad7b0db3f5f 100644 --- a/sys/dev/firmware/arm/scmi.h +++ b/sys/dev/firmware/arm/scmi.h @@ -75,7 +75,7 @@ void *scmi_buf_get(device_t dev, uint8_t protocol_id, uint8_t message_id, int tx_payd_sz, int rx_payld_sz); void scmi_buf_put(device_t dev, void *buf); int scmi_request(device_t dev, void *in, void **); -void scmi_rx_irq_callback(device_t dev, void *chan, uint32_t hdr); +void scmi_rx_irq_callback(device_t dev, void *chan, uint32_t hdr, uint32_t rx_len); DECLARE_CLASS(scmi_driver); diff --git a/sys/dev/firmware/arm/scmi_mailbox.c b/sys/dev/firmware/arm/scmi_mailbox.c index 858b81f68845..d7b642b69b85 100644 --- a/sys/dev/firmware/arm/scmi_mailbox.c +++ b/sys/dev/firmware/arm/scmi_mailbox.c @@ -70,14 +70,14 @@ static void scmi_mailbox_a2p_callback(void *arg) { struct scmi_mailbox_softc *sc; - uint32_t msg_header; + uint32_t msg_header, rx_len; int ret; sc = arg; - ret = scmi_shmem_read_msg_header(sc->a2p_dev, &msg_header); + ret = scmi_shmem_read_msg_header(sc->a2p_dev, &msg_header, &rx_len); if (ret == 0) - scmi_rx_irq_callback(sc->base.dev, sc->a2p_dev, msg_header); + scmi_rx_irq_callback(sc->base.dev, sc->a2p_dev, msg_header, rx_len); } static int @@ -154,7 +154,7 @@ scmi_mailbox_poll_msg(device_t dev, struct scmi_msg *msg, unsigned int tmo_ms) sc = device_get_softc(dev); do { - if (scmi_shmem_poll_msg(sc->a2p_dev, &msg->hdr)) + if (scmi_shmem_poll_msg(sc->a2p_dev, &msg->hdr, &msg->rx_len)) break; DELAY(SCMI_MBOX_POLL_INTERVAL_MS * 1000); } while (tmo_loops--); @@ -171,7 +171,7 @@ scmi_mailbox_collect_reply(device_t dev, struct scmi_msg *msg) sc = device_get_softc(dev); ret = scmi_shmem_read_msg_payload(sc->a2p_dev, - msg->payld, msg->rx_len - SCMI_MSG_HDR_SIZE); + msg->payld, msg->rx_len - SCMI_MSG_HDR_SIZE, msg->rx_len); return (ret); } diff --git a/sys/dev/firmware/arm/scmi_shmem.c b/sys/dev/firmware/arm/scmi_shmem.c index 9bab4bc4004e..a63d96b64cb5 100644 --- a/sys/dev/firmware/arm/scmi_shmem.c +++ b/sys/dev/firmware/arm/scmi_shmem.c @@ -247,7 +247,7 @@ scmi_shmem_clear_channel(device_t dev) } int -scmi_shmem_read_msg_header(device_t dev, uint32_t *msg_header) +scmi_shmem_read_msg_header(device_t dev, uint32_t *msg_header, unsigned int *rx_len) { uint32_t length, header; @@ -256,6 +256,7 @@ scmi_shmem_read_msg_header(device_t dev, uint32_t *msg_header) if (le32toh(length) < sizeof(header)) return (EINVAL); + *rx_len = le32toh(length); /* Read header. */ scmi_shmem_read(dev, SMT_OFFSET_MSG_HEADER, &header, SMT_SIZE_MSG_HEADER); @@ -266,14 +267,11 @@ scmi_shmem_read_msg_header(device_t dev, uint32_t *msg_header) } int -scmi_shmem_read_msg_payload(device_t dev, uint8_t *buf, uint32_t buf_len) +scmi_shmem_read_msg_payload(device_t dev, uint8_t *buf, uint32_t buf_len, uint32_t rx_len) { - uint32_t length, payld_len; - - /* Read length. */ - scmi_shmem_read(dev, SMT_OFFSET_LENGTH, &length, SMT_SIZE_LENGTH); - payld_len = le32toh(length) - SCMI_MSG_HDR_SIZE; + uint32_t payld_len; + payld_len = rx_len - SCMI_MSG_HDR_SIZE; if (payld_len > buf_len) { device_printf(dev, "RX payload %dbytes exceeds buflen %dbytes. Truncate.\n", @@ -296,7 +294,7 @@ scmi_shmem_tx_complete(device_t dev) scmi_shmem_release_channel(sc); } -bool scmi_shmem_poll_msg(device_t dev, uint32_t *msg_header) +bool scmi_shmem_poll_msg(device_t dev, uint32_t *msg_header, uint32_t *rx_len) { uint32_t status; bool ret; @@ -306,12 +304,10 @@ bool scmi_shmem_poll_msg(device_t dev, uint32_t *msg_header) ret = (status & (SCMI_SHMEM_CHAN_STAT_CHANNEL_ERROR | SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE)); + if (ret == 0) + return (ret); - if (ret) - scmi_shmem_read(dev, SMT_OFFSET_MSG_HEADER, msg_header, - SMT_SIZE_MSG_HEADER); - - return (ret); + return (scmi_shmem_read_msg_header(dev, msg_header, rx_len)); } static device_method_t shmem_methods[] = { diff --git a/sys/dev/firmware/arm/scmi_shmem.h b/sys/dev/firmware/arm/scmi_shmem.h index ed8763d5c145..bc8284502129 100644 --- a/sys/dev/firmware/arm/scmi_shmem.h +++ b/sys/dev/firmware/arm/scmi_shmem.h @@ -63,9 +63,9 @@ struct scmi_smt_header { device_t scmi_shmem_get(device_t sdev, phandle_t node, int index); int scmi_shmem_prepare_msg(device_t dev, uint8_t *msg, uint32_t tx_len, bool polling); -bool scmi_shmem_poll_msg(device_t dev, uint32_t *msg_header); -int scmi_shmem_read_msg_header(device_t dev, uint32_t *msg_header); -int scmi_shmem_read_msg_payload(device_t dev, uint8_t *buf, uint32_t buf_len); +bool scmi_shmem_poll_msg(device_t dev, uint32_t *msg_header, uint32_t *rx_len); +int scmi_shmem_read_msg_header(device_t dev, uint32_t *msg_header, uint32_t *rx_len); +int scmi_shmem_read_msg_payload(device_t dev, uint8_t *buf, uint32_t buf_len, uint32_t rx_len); void scmi_shmem_tx_complete(device_t); void scmi_shmem_clear_channel(device_t); diff --git a/sys/dev/firmware/arm/scmi_smc.c b/sys/dev/firmware/arm/scmi_smc.c index 9f0d899233fa..81c66ad7bb46 100644 --- a/sys/dev/firmware/arm/scmi_smc.c +++ b/sys/dev/firmware/arm/scmi_smc.c @@ -122,7 +122,7 @@ scmi_smc_poll_msg(device_t dev, struct scmi_msg *msg, unsigned int tmo) * Nothing to poll since commands are completed as soon as smc * returns ... but did we get back what we were poling for ? */ - scmi_shmem_read_msg_header(sc->a2p_dev, &msg->hdr); + scmi_shmem_read_msg_header(sc->a2p_dev, &msg->hdr, &msg->rx_len); return (0); } @@ -136,7 +136,7 @@ scmi_smc_collect_reply(device_t dev, struct scmi_msg *msg) sc = device_get_softc(dev); ret = scmi_shmem_read_msg_payload(sc->a2p_dev, - msg->payld, msg->rx_len - SCMI_MSG_HDR_SIZE); + msg->payld, msg->rx_len - SCMI_MSG_HDR_SIZE, msg->rx_len); return (ret); } diff --git a/sys/dev/firmware/arm/scmi_virtio.c b/sys/dev/firmware/arm/scmi_virtio.c index 12cbb9ecefd5..8714fee2ec87 100644 --- a/sys/dev/firmware/arm/scmi_virtio.c +++ b/sys/dev/firmware/arm/scmi_virtio.c @@ -76,7 +76,7 @@ scmi_virtio_callback(void *msg, unsigned int len, void *priv) } hdr = le32toh(*((uint32_t *)msg)); - scmi_rx_irq_callback(sc->base.dev, msg, hdr); + scmi_rx_irq_callback(sc->base.dev, msg, hdr, len); } static void * @@ -225,7 +225,6 @@ scmi_virtio_poll_msg(device_t dev, struct scmi_msg *msg, unsigned int tmo_ms) } rx_msg = hdr_to_msg(rx_buf); - rx_msg->rx_len = rx_len; /* Complete the polling on any poll path */ if (rx_msg->polling) atomic_store_rel_int(&rx_msg->poll_done, 1); @@ -242,7 +241,7 @@ scmi_virtio_poll_msg(device_t dev, struct scmi_msg *msg, unsigned int tmo_ms) rx_msg->hdr, rx_msg->polling); if (!rx_msg->polling) - scmi_rx_irq_callback(sc->base.dev, rx_msg, rx_msg->hdr); + scmi_rx_irq_callback(sc->base.dev, rx_msg, rx_msg->hdr, rx_len); } return (tmo_loops > 0 ? 0 : ETIMEDOUT); From nobody Thu Jan 23 17:27:34 2025 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 4Yf7Dk4MSKz5lDDQ; Thu, 23 Jan 2025 17:27: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 4Yf7Dk1VgJz43k5; Thu, 23 Jan 2025 17:27:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yiyC0B9IMtCCmKRZsnCqjhNuzi+bUEaPQwsBon+3AlA=; b=xvvyBB+K1cjdGAukuaEbOTf2zzPQIPAyVeWhUdrMdIJLyyaj0WBKfuEteVMBEB0dswZdac DBRGQyDQrshd0oYGyYgxaNN1634OvyRTXA8TjQdwawedKON/x1cbmmL0qwvJUgj5MU9mNZ r8zYoejBWxuJ5GjDm1OS0Bqml7Asqgx5TmJnobf3uOh0nrJtA0QketlOV+sGG1DqkxvJrW G99vS6PTQs1mWrE84Cuf5mQA81owA1eg3b+NAUAOiW3IRKw4xAZpo7HwaEy95ia//z3oSd +TdutZuUOU8462v64JH1NHF4jrMhBpfG4Bv7iBFelnQvq7W96Ma1mB7prnhvDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yiyC0B9IMtCCmKRZsnCqjhNuzi+bUEaPQwsBon+3AlA=; b=T1djLZrW9CMt6lUO4NYc4NUbS3o5TZxSXwiI3baCIaGwb6Klm8FSb21yZYEdoPE1RdIAP9 cjNH6Wp01M6mMM/gSo0w9DqLJ2dht/5NL7i35ddRvPxo3Cu8bSX5HZoEKgnFjeEtWTvtIt 7kkFgI56WlUd2M40qzwdxI4Fh8iFBCM5GGJNZOvqkH/v2AiWZ2U88tPzuFoey4xQahfWkB yYcUdwbcC6sEYWDX/hcbhT3LSJW3mikW3pjTd0nGdJOqpflgGbs3+k2W8oKRe5+4Gyt6r1 LcB7qlcadl1vLLaSYzHNCM7+7NEYxyIEUCqeF30hFXDoHolK4C+5FROd/kFjIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653254; a=rsa-sha256; cv=none; b=pYLJ9lT5YEmtx6QS9bcC1KZeqgIPMlMQKP1djKlh+kMXJulKoHHdXHqHGyDifI7MhfFBRA NkQ7C+ChZSNpk359Kl2wdCvTVAvKAmNpAOYFpCko02HXpYkvKVVraVZIpAdVFDXhaDUuBf s+xyL+DNLiuc4XkgdUSsoSdiSE1Vy6qJNGGAAb6FqbFCZyLNhi5h7IrO+qtEpQ8xwxSjir eQ6zLFfDOpZ4hx2VOuHDzutOdd+TMlmkmIPUPhiYNqqK3IcD3cMjQ11zyk6sQZLvqc7mBi vZv8RoUrzBP62tm+pII3vaJ9076FdFGs8gsbk0qqvh3yyVxlQNDDlA+OTJZ1Vg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7Dk15hgzp0t; Thu, 23 Jan 2025 17:27: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 50NHRYiX022667; Thu, 23 Jan 2025 17:27:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRYKq022662; Thu, 23 Jan 2025 17:27:34 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:34 GMT Message-Id: <202501231727.50NHRYKq022662@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: 103ea03e6713 - main - scmi: Add devicetree transport properties 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: 103ea03e6713a0f3bb874472fbd9fd81e2278805 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=103ea03e6713a0f3bb874472fbd9fd81e2278805 commit 103ea03e6713a0f3bb874472fbd9fd81e2278805 Author: Cristian Marussi AuthorDate: 2025-01-23 13:01:26 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:26 +0000 scmi: Add devicetree transport properties SCMI transport characteristics can be optionally described in the devicetree to override the default build-time values. Tested on: Arm Morello Board Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47422 Signed-off-by: Cristian Marussi --- sys/dev/firmware/arm/scmi.c | 52 +++++++++++++++++++++++++------------- sys/dev/firmware/arm/scmi.h | 14 +++++++--- sys/dev/firmware/arm/scmi_virtio.c | 12 ++++----- 3 files changed, 51 insertions(+), 27 deletions(-) diff --git a/sys/dev/firmware/arm/scmi.c b/sys/dev/firmware/arm/scmi.c index 00a229762414..cf5a678370fd 100644 --- a/sys/dev/firmware/arm/scmi.c +++ b/sys/dev/firmware/arm/scmi.c @@ -127,7 +127,8 @@ struct scmi_transport { struct mtx mtx; }; -static int scmi_transport_init(struct scmi_softc *); +static void scmi_transport_configure(struct scmi_transport_desc *, phandle_t); +static int scmi_transport_init(struct scmi_softc *, phandle_t); static void scmi_transport_cleanup(struct scmi_softc *); static struct scmi_reqs_pool *scmi_reqs_pool_allocate(const int, const int); static void scmi_reqs_pool_free(struct scmi_reqs_pool *); @@ -165,12 +166,12 @@ scmi_attach(device_t dev) simplebus_init(dev, node); - error = scmi_transport_init(sc); + error = scmi_transport_init(sc, node); if (error != 0) return (error); - device_printf(dev, "Transport reply timeout initialized to %dms\n", - sc->trs_desc.reply_timo_ms); + device_printf(dev, "Transport - max_msg:%d max_payld_sz:%lu reply_timo_ms:%d\n", + SCMI_MAX_MSG(sc), SCMI_MAX_MSG_PAYLD_SIZE(sc), SCMI_MAX_MSG_TIMEOUT_MS(sc)); /* * Allow devices to identify. @@ -248,29 +249,42 @@ scmi_reqs_pool_free(struct scmi_reqs_pool *rp) free(rp, M_DEVBUF); } +static void +scmi_transport_configure(struct scmi_transport_desc *td, phandle_t node) +{ + if (OF_getencprop(node, "arm,max-msg", &td->max_msg, sizeof(td->max_msg)) == -1) + td->max_msg = SCMI_DEF_MAX_MSG; + + if (OF_getencprop(node, "arm,max-msg-size", &td->max_payld_sz, + sizeof(td->max_payld_sz)) == -1) + td->max_payld_sz = SCMI_DEF_MAX_MSG_PAYLD_SIZE; +} + static int -scmi_transport_init(struct scmi_softc *sc) +scmi_transport_init(struct scmi_softc *sc, phandle_t node) { + struct scmi_transport_desc *td = &sc->trs_desc; struct scmi_transport *trs; int ret; trs = malloc(sizeof(*trs), M_DEVBUF, M_ZERO | M_WAITOK); + scmi_transport_configure(td, node); + BIT_FILL(SCMI_MAX_TOKEN, &trs->avail_tokens); mtx_init(&trs->mtx, "tokens", "SCMI", MTX_SPIN); - trs->inflight_ht = hashinit(SCMI_MAX_MSG, M_DEVBUF, - &trs->inflight_mask); + trs->inflight_ht = hashinit(td->max_msg, M_DEVBUF, &trs->inflight_mask); trs->chans[SCMI_CHAN_A2P] = - scmi_reqs_pool_allocate(SCMI_MAX_MSG, SCMI_MAX_MSG_PAYLD_SIZE); + scmi_reqs_pool_allocate(td->max_msg, td->max_payld_sz); if (trs->chans[SCMI_CHAN_A2P] == NULL) { free(trs, M_DEVBUF); return (ENOMEM); } trs->chans[SCMI_CHAN_P2A] = - scmi_reqs_pool_allocate(SCMI_MAX_MSG, SCMI_MAX_MSG_PAYLD_SIZE); + scmi_reqs_pool_allocate(td->max_msg, td->max_payld_sz); if (trs->chans[SCMI_CHAN_P2A] == NULL) { scmi_reqs_pool_free(trs->chans[SCMI_CHAN_A2P]); free(trs, M_DEVBUF); @@ -286,8 +300,13 @@ scmi_transport_init(struct scmi_softc *sc) return (ret); } + /* Use default transport timeout if not overridden by OF */ + OF_getencprop(node, "arm,max-rx-timeout-ms", &td->reply_timo_ms, + sizeof(td->reply_timo_ms)); + return (0); } + static void scmi_transport_cleanup(struct scmi_softc *sc) { @@ -355,7 +374,7 @@ scmi_req_put(struct scmi_softc *sc, struct scmi_req *req) { mtx_lock_spin(&req->mtx); if (!refcount_release_if_not_last(&req->cnt)) { - bzero(&req->msg, sizeof(req->msg) + SCMI_MAX_MSG_PAYLD_SIZE); + bzero(&req->msg, sizeof(req->msg) + SCMI_MAX_MSG_PAYLD_SIZE(sc)); scmi_req_free_unlocked(sc, SCMI_CHAN_A2P, req); } mtx_unlock_spin(&req->mtx); @@ -532,13 +551,13 @@ scmi_rx_irq_callback(device_t dev, void *chan, uint32_t hdr, uint32_t rx_len) static int scmi_wait_for_response(struct scmi_softc *sc, struct scmi_req *req, void **out) { + unsigned int reply_timo_ms = SCMI_MAX_MSG_TIMEOUT_MS(sc); int ret; if (req->msg.polling) { bool needs_drop; - ret = SCMI_POLL_MSG(sc->dev, &req->msg, - sc->trs_desc.reply_timo_ms); + ret = SCMI_POLL_MSG(sc->dev, &req->msg, reply_timo_ms); /* * Drop reference to successfully polled req unless it had * already also been processed on the IRQ path. @@ -557,8 +576,7 @@ scmi_wait_for_response(struct scmi_softc *sc, struct scmi_req *req, void **out) le32toh(req->msg.hdr), le32toh(req->header)); } } else { - ret = tsleep(req, 0, "scmi_wait4", - (sc->trs_desc.reply_timo_ms * hz) / 1000); + ret = tsleep(req, 0, "scmi_wait4", (reply_timo_ms * hz) / 1000); /* Check for lost wakeups since there is no associated lock */ mtx_lock_spin(&req->mtx); if (ret != 0 && req->done) @@ -591,8 +609,8 @@ scmi_buf_get(device_t dev, uint8_t protocol_id, uint8_t message_id, sc = device_get_softc(dev); - if (tx_payld_sz > SCMI_MAX_MSG_PAYLD_SIZE || - rx_payld_sz > SCMI_MAX_MSG_REPLY_SIZE) { + if (tx_payld_sz > SCMI_MAX_MSG_PAYLD_SIZE(sc) || + rx_payld_sz > SCMI_MAX_MSG_REPLY_SIZE(sc)) { device_printf(dev, "Unsupported payload size. Drop.\n"); return (NULL); } @@ -606,7 +624,7 @@ scmi_buf_get(device_t dev, uint8_t protocol_id, uint8_t message_id, req->message_id = message_id & SCMI_HDR_MESSAGE_ID_BF; req->msg.tx_len = sizeof(req->msg.hdr) + tx_payld_sz; req->msg.rx_len = rx_payld_sz ? - rx_payld_sz + 2 * sizeof(uint32_t) : SCMI_MAX_MSG_SIZE; + rx_payld_sz + 2 * sizeof(uint32_t) : SCMI_MAX_MSG_SIZE(sc); return (&req->msg.payld[0]); } diff --git a/sys/dev/firmware/arm/scmi.h b/sys/dev/firmware/arm/scmi.h index 73b49f099ad8..135b49c3b05b 100644 --- a/sys/dev/firmware/arm/scmi.h +++ b/sys/dev/firmware/arm/scmi.h @@ -34,10 +34,14 @@ #include "scmi_if.h" -#define SCMI_MAX_MSG 32 -#define SCMI_MAX_MSG_PAYLD_SIZE 128 -#define SCMI_MAX_MSG_REPLY_SIZE (SCMI_MAX_MSG_PAYLD_SIZE + sizeof(uint32_t)) -#define SCMI_MAX_MSG_SIZE (SCMI_MAX_MSG_REPLY_SIZE + sizeof(uint32_t)) +#define SCMI_DEF_MAX_MSG 32 +#define SCMI_DEF_MAX_MSG_PAYLD_SIZE 128 + +#define SCMI_MAX_MSG_PAYLD_SIZE(sc) ((sc)->trs_desc.max_payld_sz + sizeof(uint32_t)) +#define SCMI_MAX_MSG_REPLY_SIZE(sc) (SCMI_MAX_MSG_PAYLD_SIZE((sc)) + sizeof(uint32_t)) +#define SCMI_MAX_MSG_SIZE(sc) (SCMI_MAX_MSG_REPLY_SIZE(sc) + sizeof(uint32_t)) +#define SCMI_MAX_MSG(sc) ((sc)->trs_desc.max_msg) +#define SCMI_MAX_MSG_TIMEOUT_MS(sc) ((sc)->trs_desc.reply_timo_ms) enum scmi_chan { SCMI_CHAN_A2P, @@ -47,6 +51,8 @@ enum scmi_chan { struct scmi_transport_desc { bool no_completion_irq; + unsigned int max_msg; + unsigned int max_payld_sz; unsigned int reply_timo_ms; }; diff --git a/sys/dev/firmware/arm/scmi_virtio.c b/sys/dev/firmware/arm/scmi_virtio.c index 8714fee2ec87..5252ad9cf9a4 100644 --- a/sys/dev/firmware/arm/scmi_virtio.c +++ b/sys/dev/firmware/arm/scmi_virtio.c @@ -83,19 +83,19 @@ static void * scmi_virtio_p2a_pool_init(device_t dev, unsigned int max_msg) { struct scmi_virtio_softc *sc; + unsigned int max_msg_sz; void *pool; uint8_t *buf; int i; sc = device_get_softc(dev); + max_msg_sz = SCMI_MAX_MSG_SIZE(&sc->base); + pool = mallocarray(max_msg, max_msg_sz, M_DEVBUF, M_ZERO | M_WAITOK); - pool = mallocarray(max_msg, SCMI_MAX_MSG_SIZE, M_DEVBUF, - M_ZERO | M_WAITOK); - - for (i = 0, buf = pool; i < max_msg; i++, buf += SCMI_MAX_MSG_SIZE) { + for (i = 0, buf = pool; i < max_msg; i++, buf += max_msg_sz) { /* Feed platform with pre-allocated P2A buffers */ virtio_scmi_message_enqueue(sc->virtio_dev, - VIRTIO_SCMI_CHAN_P2A, buf, 0, SCMI_MAX_MSG_SIZE); + VIRTIO_SCMI_CHAN_P2A, buf, 0, max_msg_sz); } device_printf(dev, @@ -111,7 +111,7 @@ scmi_virtio_clear_channel(device_t dev, void *msg) sc = device_get_softc(dev); virtio_scmi_message_enqueue(sc->virtio_dev, VIRTIO_SCMI_CHAN_P2A, - msg, 0, SCMI_MAX_MSG_SIZE); + msg, 0, SCMI_MAX_MSG_SIZE(&sc->base)); } static int From nobody Thu Jan 23 17:27:35 2025 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 4Yf7Dl40QMz5lDYY; Thu, 23 Jan 2025 17:27: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 4Yf7Dl2Clbz43dJ; Thu, 23 Jan 2025 17:27:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653255; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9MBbrMuv/TVoDGKqdIr562aTQjW2Uk2K1QU5qqmrjPM=; b=eoAdBEqTkrGUUDMvo3DiQnFOO5DVFBeXaLNx4A9Db0oybYnXNFsRT9EdZMDlKulFmmfg8x +cfUXpDJRM/yXu42UHL/6xDQGrLkzFDmIjea9yPpUUpHl7VFrjNArgIqnDHQzU/P0RiJnq NgjX/bjD2ONbTE69NN6Dlfo4yFIc/9M5u7a92CuWEjwhcDoLE8Xuxg+nAsNFpcgqusvKnW +xrdw/9oqc8lvrpVCPgL0vGONQurhhP4WshkV1GDAg+QnH9Au60F2midqjA9N0r9dHNaf7 wbT0DvrGtnYBV3i0Ytv3o/4GEBLW4iAjxqlNPfzU5slnPVqmVdcfDjqRHb0+6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653255; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9MBbrMuv/TVoDGKqdIr562aTQjW2Uk2K1QU5qqmrjPM=; b=p/qREQu5MRrEbSmChOgP8kcBdoZCfGisTyTCaLJ02WmyuCCww3RIF8XgchVMeZBa5QoE1Y up7uPCVw0T3+7WH5Qo4bfaNHKGUD/CwUQPYQ3/jf5WnfCk5s+HoT7MzGK1fcpQ0KW7sNL7 9IOBxZ8jzcVTHDG1BZ0ue56vR06KGfOmLytb/x5NjK6fONlGn3w+XHEr9EXE5+wpT/p26E yz2hX9iGVz+XiGEgu272Co3YlL1Hv/yDNtUDn4uTIWL5yK9FC6t3GmKeOA96esfFUzW3ss hTbCOaV7ISpBIJN5+P0i7TUcVl5v1FoNJKcqa9igtrYdxuGRR/ttaVB6I4ZiBw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653255; a=rsa-sha256; cv=none; b=P06K7BYYhETSqxfxxK3BJSI0Sw6tIkqtzYmoNjedNMEUTrEHOFMJ+v9hkSSJYV0xaFv4UV qvBNx55n+VbxAB5khUPZQY4HzfqXxYafjr07gQnguaagZiPoOSZ5RqpghysJYnDcBNFoNN gERSjwfI/tfg+aYqAmg9Fum2L7AJf7OhAIAmpHHLotJDikWMB6fibBr2vgpw2QpYf3fJaM xCDQl70oG3KrRV27eX+XNTJ60fy/HQmCKVWvXiuFtCF7k66m/I3xP5iadZmFQy74cgINDM mREQwqVIliOrtXxEJLLBHRdEViLEmSXDy01AK4DbQV2JzDEmytSX5uhnTVbHig== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7Dl1qF8zpWf; Thu, 23 Jan 2025 17:27: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 50NHRZAS022701; Thu, 23 Jan 2025 17:27:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRZRT022698; Thu, 23 Jan 2025 17:27:35 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:35 GMT Message-Id: <202501231727.50NHRZRT022698@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: e887179d4bc0 - main - scmi: Add helper to manipulate scmi_msg descriptors 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: e887179d4bc032e79d0334371d613c5841989a41 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=e887179d4bc032e79d0334371d613c5841989a41 commit e887179d4bc032e79d0334371d613c5841989a41 Author: Cristian Marussi AuthorDate: 2025-01-23 13:23:28 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:26 +0000 scmi: Add helper to manipulate scmi_msg descriptors Refactor allocation logic for scmi_req and introduce new helpers to be able to obtain an scmi_msg reference to a freshly allocated request. Tested on: Arm Morello Board Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47423 Signed-off-by: Cristian Marussi --- sys/dev/firmware/arm/scmi.c | 77 +++++++++++++++++++++++++++++++++++---------- sys/dev/firmware/arm/scmi.h | 2 ++ 2 files changed, 63 insertions(+), 16 deletions(-) diff --git a/sys/dev/firmware/arm/scmi.c b/sys/dev/firmware/arm/scmi.c index cf5a678370fd..8104f4e10429 100644 --- a/sys/dev/firmware/arm/scmi.c +++ b/sys/dev/firmware/arm/scmi.c @@ -132,9 +132,10 @@ static int scmi_transport_init(struct scmi_softc *, phandle_t); static void scmi_transport_cleanup(struct scmi_softc *); static struct scmi_reqs_pool *scmi_reqs_pool_allocate(const int, const int); static void scmi_reqs_pool_free(struct scmi_reqs_pool *); -static struct scmi_req *scmi_req_alloc(struct scmi_softc *, enum scmi_chan); +static struct scmi_req *scmi_req_alloc(struct scmi_softc *, enum scmi_chan); +static struct scmi_req *scmi_req_initialized_alloc(device_t, int, int); static void scmi_req_free_unlocked(struct scmi_softc *, - enum scmi_chan, struct scmi_req *); + enum scmi_chan, struct scmi_req *); static void scmi_req_get(struct scmi_softc *, struct scmi_req *); static void scmi_req_put(struct scmi_softc *, struct scmi_req *); static int scmi_token_pick(struct scmi_softc *); @@ -319,6 +320,32 @@ scmi_transport_cleanup(struct scmi_softc *sc) free(sc->trs, M_DEVBUF); } +static struct scmi_req * +scmi_req_initialized_alloc(device_t dev, int tx_payld_sz, int rx_payld_sz) +{ + struct scmi_softc *sc; + struct scmi_req *req; + + sc = device_get_softc(dev); + + if (tx_payld_sz > SCMI_MAX_MSG_PAYLD_SIZE(sc) || + rx_payld_sz > SCMI_MAX_MSG_REPLY_SIZE(sc)) { + device_printf(dev, "Unsupported payload size. Drop.\n"); + return (NULL); + } + + /* Pick one from free list */ + req = scmi_req_alloc(sc, SCMI_CHAN_A2P); + if (req == NULL) + return (NULL); + + req->msg.tx_len = sizeof(req->msg.hdr) + tx_payld_sz; + req->msg.rx_len = rx_payld_sz ? + rx_payld_sz + 2 * sizeof(uint32_t) : SCMI_MAX_MSG_SIZE(sc); + + return (req); +} + static struct scmi_req * scmi_req_alloc(struct scmi_softc *sc, enum scmi_chan ch_idx) { @@ -374,6 +401,10 @@ scmi_req_put(struct scmi_softc *sc, struct scmi_req *req) { mtx_lock_spin(&req->mtx); if (!refcount_release_if_not_last(&req->cnt)) { + req->protocol_id = 0; + req->message_id = 0; + req->token = 0; + req->header = 0; bzero(&req->msg, sizeof(req->msg) + SCMI_MAX_MSG_PAYLD_SIZE(sc)); scmi_req_free_unlocked(sc, SCMI_CHAN_A2P, req); } @@ -604,27 +635,15 @@ void * scmi_buf_get(device_t dev, uint8_t protocol_id, uint8_t message_id, int tx_payld_sz, int rx_payld_sz) { - struct scmi_softc *sc; struct scmi_req *req; - sc = device_get_softc(dev); - - if (tx_payld_sz > SCMI_MAX_MSG_PAYLD_SIZE(sc) || - rx_payld_sz > SCMI_MAX_MSG_REPLY_SIZE(sc)) { - device_printf(dev, "Unsupported payload size. Drop.\n"); - return (NULL); - } - - /* Pick one from free list */ - req = scmi_req_alloc(sc, SCMI_CHAN_A2P); + /* Pick a pre-built req */ + req = scmi_req_initialized_alloc(dev, tx_payld_sz, rx_payld_sz); if (req == NULL) return (NULL); req->protocol_id = protocol_id & SCMI_HDR_PROTOCOL_ID_BF; req->message_id = message_id & SCMI_HDR_MESSAGE_ID_BF; - req->msg.tx_len = sizeof(req->msg.hdr) + tx_payld_sz; - req->msg.rx_len = rx_payld_sz ? - rx_payld_sz + 2 * sizeof(uint32_t) : SCMI_MAX_MSG_SIZE(sc); return (&req->msg.payld[0]); } @@ -641,6 +660,32 @@ scmi_buf_put(device_t dev, void *buf) scmi_req_put(sc, req); } +struct scmi_msg * +scmi_msg_get(device_t dev, int tx_payld_sz, int rx_payld_sz) +{ + struct scmi_req *req; + + /* Pick a pre-built req */ + req = scmi_req_initialized_alloc(dev, tx_payld_sz, rx_payld_sz); + if (req == NULL) + return (NULL); + + return (&req->msg); +} + +void +scmi_msg_put(device_t dev, struct scmi_msg *msg) +{ + struct scmi_softc *sc; + struct scmi_req *req; + + sc = device_get_softc(dev); + + req = msg_to_req(msg); + + scmi_req_put(sc, req); +} + int scmi_request(device_t dev, void *in, void **out) { diff --git a/sys/dev/firmware/arm/scmi.h b/sys/dev/firmware/arm/scmi.h index 135b49c3b05b..f6aa072caeca 100644 --- a/sys/dev/firmware/arm/scmi.h +++ b/sys/dev/firmware/arm/scmi.h @@ -80,6 +80,8 @@ struct scmi_msg { void *scmi_buf_get(device_t dev, uint8_t protocol_id, uint8_t message_id, int tx_payd_sz, int rx_payld_sz); void scmi_buf_put(device_t dev, void *buf); +struct scmi_msg *scmi_msg_get(device_t dev, int tx_payld_sz, int rx_payld_sz); +void scmi_msg_put(device_t dev, struct scmi_msg *msg); int scmi_request(device_t dev, void *in, void **); void scmi_rx_irq_callback(device_t dev, void *chan, uint32_t hdr, uint32_t rx_len); From nobody Thu Jan 23 17:27:39 2025 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 4Yf7Dr1PrCz5lDdh; Thu, 23 Jan 2025 17:27: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 4Yf7Dq5LPsz43hd; Thu, 23 Jan 2025 17:27:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FphtWkOWhjTvRgcXCqGnFNHObm4ubKeYJ6RfpefhF24=; b=mvYI0O2MYhT+3YHbk1aHJwa7zLQUIzWRZ+8bKop9s1ewjnxpXA8UGsfhhamI9NqT5uR3Iz f3ERBEzgXwVEM4+5EA0WEuyVwl8tzQ7aJOAyy/ehrH3raG32s+4XykzbiNQ+bCeBEz2wfY Or0+cPM9dJKxccmw627M3It3YJP5fFUOsukmHKI7Mc+VVkvPdAyYWSgSyk+1pAOouNwa45 hUgg8Pi7pvTKvmnIdWvsLNX2IPq9oWM/q7J+oEb7JIRZ90C9Px0gxJM2OOv1npwx9Q08tG IGmNhLkf2C+mtG+dBUbbwpJLv9VWvw0cjwJO885htc/m0yBdi9YkOb3Tw2DZHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FphtWkOWhjTvRgcXCqGnFNHObm4ubKeYJ6RfpefhF24=; b=dRyF6JRQBv06u3XkOclID8PNqKh0sGfD4uTTZUevfPMVxq1EXAooyh7tJ/TnOtoDA1nbCq KCcEhubj2NDhT3biegdCrZ7I5M42qZ9689TKgAjoeZJah7YNqUA3Ea3/MeUw5pP6gLb6Hw FkdPyz4coU/DDKAAz0jwBLX5QpsTL0tzO1gwQB1aAG4lE4Dxh5fuxj0uMLxeSBUZOAKDpd Eh6evN/LzuXypfhJTJGgUuslgEfmDz0hSZKh5b3rdo1rrtNWL4LRcPew04V5KEHyNDFE8r Q/Rrw4KgB3k8udO9+HWYYQONcrSs+9ZzSF//3pIqnx1atwCRNGJWiQddvfCTuA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653259; a=rsa-sha256; cv=none; b=aZPWi3+7z1LltH4eEEo1/CteWotI44lCYllFXUhTyUQAvHbONb6/UgAzVmjb64ZB+eTH7R NtkAMl2tGJVrXidN4PkzHqrrdrI/IIw1S6nuQ35sfbUV9/PkZmXpYBJfeqt4anAg7ySSlV /9Mcmm7t8zsFHiZvldiIRi/EAUao3EI6IRScIuE05CINIZMtBl/prhpYlpcoNEeR5qj+kR cfRBCyym7ZUybWMOLvwsoQMpvZILf/zxlSBpSCwKkJYSLRmBTrkPka1XgeKdKJWZippK3j iJMkIzNawlTSuvsArz6vPA8/Kj8PiDvR0av7iNMP1E+kfs5HbQ5E163/IdEU0w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7Dq4ndxzpWg; Thu, 23 Jan 2025 17:27: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 50NHRd2E022848; Thu, 23 Jan 2025 17:27:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRdPe022845; Thu, 23 Jan 2025 17:27:39 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:39 GMT Message-Id: <202501231727.50NHRdPe022845@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: 984f9fb81a9d - main - scmi: Add SDT traces to the core stack 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: 984f9fb81a9dfb9780c9bcc99607ad7cac3a72dd Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=984f9fb81a9dfb9780c9bcc99607ad7cac3a72dd commit 984f9fb81a9dfb9780c9bcc99607ad7cac3a72dd Author: Cristian Marussi AuthorDate: 2025-01-23 13:26:41 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:27 +0000 scmi: Add SDT traces to the core stack Add a few basic traces to track SCMI messages lifecycle. Tested on: Arm Morello Board Reviewed by: Andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47427 Signed-off-by: Cristian Marussi --- sys/dev/firmware/arm/scmi.c | 59 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/sys/dev/firmware/arm/scmi.c b/sys/dev/firmware/arm/scmi.c index 0b165e413674..2d9f6fa89d4b 100644 --- a/sys/dev/firmware/arm/scmi.c +++ b/sys/dev/firmware/arm/scmi.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -53,6 +54,26 @@ #include "scmi.h" #include "scmi_protocols.h" +SDT_PROVIDER_DEFINE(scmi); +SDT_PROBE_DEFINE3(scmi, func, scmi_req_alloc, req_alloc, + "int", "int", "int"); +SDT_PROBE_DEFINE3(scmi, func, scmi_req_free_unlocked, req_alloc, + "int", "int", "int"); +SDT_PROBE_DEFINE3(scmi, func, scmi_req_get, req_alloc, + "int", "int", "int"); +SDT_PROBE_DEFINE3(scmi, func, scmi_req_put, req_alloc, + "int", "int", "int"); +SDT_PROBE_DEFINE5(scmi, func, scmi_request_tx, xfer_track, + "int", "int", "int", "int", "int"); +SDT_PROBE_DEFINE5(scmi, entry, scmi_wait_for_response, xfer_track, + "int", "int", "int", "int", "int"); +SDT_PROBE_DEFINE5(scmi, exit, scmi_wait_for_response, xfer_track, + "int", "int", "int", "int", "int"); +SDT_PROBE_DEFINE2(scmi, func, scmi_rx_irq_callback, hdr_dump, + "int", "int"); +SDT_PROBE_DEFINE5(scmi, func, scmi_process_response, xfer_track, + "int", "int", "int", "int", "int"); + #define SCMI_MAX_TOKEN 1024 #define SCMI_HDR_TOKEN_S 18 @@ -88,6 +109,12 @@ #define SCMI_MSG_TOKEN(_hdr) \ (((_hdr) & SCMI_HDR_TOKEN_M) >> SCMI_HDR_TOKEN_S) +#define SCMI_MSG_PROTOCOL_ID(_hdr) \ + (((_hdr) & SCMI_HDR_PROTOCOL_ID_M) >> SCMI_HDR_PROTOCOL_ID_S) +#define SCMI_MSG_MESSAGE_ID(_hdr) \ + (((_hdr) & SCMI_HDR_MESSAGE_ID_M) >> SCMI_HDR_MESSAGE_ID_S) +#define SCMI_MSG_TYPE(_hdr) \ + (((_hdr) & SCMI_HDR_TYPE_ID_M) >> SCMI_HDR_TYPE_ID_S) struct scmi_req { int cnt; @@ -372,8 +399,11 @@ scmi_req_alloc(struct scmi_softc *sc, enum scmi_chan ch_idx) } mtx_unlock_spin(&rp->mtx); - if (req != NULL) + if (req != NULL) { refcount_init(&req->cnt, 1); + SDT_PROBE3(scmi, func, scmi_req_alloc, req_alloc, + req, refcount_load(&req->cnt), -1); + } return (req); } @@ -392,6 +422,9 @@ scmi_req_free_unlocked(struct scmi_softc *sc, enum scmi_chan ch_idx, refcount_init(&req->cnt, 0); LIST_INSERT_HEAD(&rp->head, req, next); mtx_unlock_spin(&rp->mtx); + + SDT_PROBE3(scmi, func, scmi_req_free_unlocked, req_alloc, + req, refcount_load(&req->cnt), -1); } static void @@ -406,6 +439,9 @@ scmi_req_get(struct scmi_softc *sc, struct scmi_req *req) if (!ok) device_printf(sc->dev, "%s() -- BAD REFCOUNT\n", __func__); + SDT_PROBE3(scmi, func, scmi_req_get, req_alloc, + req, refcount_load(&req->cnt), SCMI_MSG_TOKEN(req->msg.hdr)); + return; } @@ -420,6 +456,9 @@ scmi_req_put(struct scmi_softc *sc, struct scmi_req *req) req->header = 0; bzero(&req->msg, sizeof(req->msg) + SCMI_MAX_MSG_PAYLD_SIZE(sc)); scmi_req_free_unlocked(sc, SCMI_CHAN_A2P, req); + } else { + SDT_PROBE3(scmi, func, scmi_req_put, req_alloc, + req, refcount_load(&req->cnt), SCMI_MSG_TOKEN(req->msg.hdr)); } mtx_unlock_spin(&req->mtx); } @@ -571,6 +610,10 @@ scmi_process_response(struct scmi_softc *sc, uint32_t hdr, uint32_t rx_len) return; } + SDT_PROBE5(scmi, func, scmi_process_response, xfer_track, req, + SCMI_MSG_PROTOCOL_ID(req->msg.hdr), SCMI_MSG_MESSAGE_ID(req->msg.hdr), + SCMI_MSG_TOKEN(req->msg.hdr), req->timed_out); + mtx_lock_spin(&req->mtx); req->done = true; req->msg.rx_len = rx_len; @@ -608,6 +651,8 @@ scmi_rx_irq_callback(device_t dev, void *chan, uint32_t hdr, uint32_t rx_len) sc = device_get_softc(dev); + SDT_PROBE2(scmi, func, scmi_rx_irq_callback, hdr_dump, hdr, rx_len); + if (SCMI_IS_MSG_TYPE_NOTIF(hdr) || SCMI_IS_MSG_TYPE_DRESP(hdr)) { device_printf(dev, "DRESP/NOTIF unsupported. Drop.\n"); SCMI_CLEAR_CHANNEL(dev, chan); @@ -623,6 +668,10 @@ scmi_wait_for_response(struct scmi_softc *sc, struct scmi_req *req, void **out) unsigned int reply_timo_ms = SCMI_MAX_MSG_TIMEOUT_MS(sc); int ret; + SDT_PROBE5(scmi, entry, scmi_wait_for_response, xfer_track, req, + SCMI_MSG_PROTOCOL_ID(req->msg.hdr), SCMI_MSG_MESSAGE_ID(req->msg.hdr), + SCMI_MSG_TOKEN(req->msg.hdr), reply_timo_ms); + if (req->msg.polling) { bool needs_drop; @@ -667,6 +716,10 @@ scmi_wait_for_response(struct scmi_softc *sc, struct scmi_req *req, void **out) SCMI_TX_COMPLETE(sc->dev, NULL); + SDT_PROBE5(scmi, exit, scmi_wait_for_response, xfer_track, req, + SCMI_MSG_PROTOCOL_ID(req->msg.hdr), SCMI_MSG_MESSAGE_ID(req->msg.hdr), + SCMI_MSG_TOKEN(req->msg.hdr), req->timed_out); + return (ret); } @@ -769,6 +822,10 @@ scmi_request_tx(device_t dev, void *in) return (error); } + SDT_PROBE5(scmi, func, scmi_request_tx, xfer_track, req, + SCMI_MSG_PROTOCOL_ID(req->msg.hdr), SCMI_MSG_MESSAGE_ID(req->msg.hdr), + SCMI_MSG_TOKEN(req->msg.hdr), req->msg.polling); + return (0); } From nobody Thu Jan 23 17:27:37 2025 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 4Yf7Dp0CW8z5lD8M; Thu, 23 Jan 2025 17:27:38 +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 4Yf7Dn3qj4z43rT; Thu, 23 Jan 2025 17:27:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UgTYKRlP/iQGQ321pODW58ZjoTzn0OHIPldmToSqKiE=; b=NkO/nvXgcO8UdqwXD4ipAJuUrftDHcZ8RRTPKxJ5050D5cY4VZIOTFNdDhFmEUlbSWH0YS tujyK7VpP7Rwva6IlY4hvCpsSJgD4sKar9wrwFLis4LBgRMkTBIdVq92f2/zZK0xCx5Euo Dq4Z8SJRtANYbMj5QpVz3UtPdE9h82DWr3DrktEOkgT8O2SY+ZPhEFAZx2LsB2Qumf6P+3 foDn+T+XuM6Lh2+UCexxDhL0QcHAFWb2/jkHpUoR+u17pMN2oC1hNXlxdeEUShtwW/0JlC LBs2GGyqXyG745wQk/y/WsFcwYGa22qKBZqoWsxG/g5IjDcpu1KDRWlRNVKh3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UgTYKRlP/iQGQ321pODW58ZjoTzn0OHIPldmToSqKiE=; b=Nki0u9xoWFOwJ+nwUAsHdEJTIj6JzuAk9J0w2Ba11J1IQVlLOscsQPpNjcM1yzo9HFG12e GyJa+Zrxv7AzrETSH4twBmM2IfwfKFNEMJLkXZwq0+nnhNg+BtMUtCsiHuWvmIDUsXlfyy qDpyiJ3RJ20LXJLsGTsKBK0MXFx+0bD9Fqnuu1YpE8Ye/hHkBWN7ojVvDxk56I+XMpUJPZ 5Loue5yPN4QEzMt690SeD8Hj1BZ1V3sovPkezDNKaRuml9jr3LQYubvDFPJZqoHXza7u3U 0lMX2u1dtudfm9fC7gYgSOjFzUcOKUVGtSHI0Ihv3gm59XtXCen0L+MRI26/5Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653257; a=rsa-sha256; cv=none; b=GfSxDiFWv0xfYM+cOl/ZTDRzdRo741Xiqv4wLsNLodtnifPE4MLrcFBLx0K73lGn2rkKyb AjcGBwIXDZ5IOaw/gIRu4bbxavouyTcwt/VNW8wVBDhvbArnQ6uNtebOG1tBt+tK0DyV4E ufwW0r0lPj1BmQ/eCAtMMfEYFoF+9b50NToHGyB8b6NOoKQ/BE5ee0YdIcxGMu4O+5OK2E Mu6Sfs+bn5W2DLxjJMSahezh4FcKmczUfzumJZKbDMJhnts06zLsy6BCYXJBEDbNu2Tgqu KPREGkomJJUu+ddYwr1nyCx7VpkaZTFVC89T6i2fU5cBj0kn+tnPa1YuiaaQlw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7Dn36v1zpF7; Thu, 23 Jan 2025 17:27:37 +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 50NHRbuw022778; Thu, 23 Jan 2025 17:27:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRbMs022775; Thu, 23 Jan 2025 17:27:37 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:37 GMT Message-Id: <202501231727.50NHRbMs022775@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: 341d8fd90fa0 - main - scmi: Refactor scmi_request internal logic 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: 341d8fd90fa084d074059051478657cb45e53402 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=341d8fd90fa084d074059051478657cb45e53402 commit 341d8fd90fa084d074059051478657cb45e53402 Author: Cristian Marussi AuthorDate: 2025-01-23 13:24:39 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:27 +0000 scmi: Refactor scmi_request internal logic Split scmi_request internals into a TX and an RX phase, which will be called, anyway, in sequence as before when a normal transmission is requested. No functional change. Tested on: Arm Morello Board Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47425 Signed-off-by: Cristian Marussi --- sys/dev/firmware/arm/scmi.c | 24 ++++++++++++++++++++++-- sys/dev/firmware/arm/scmi.h | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/sys/dev/firmware/arm/scmi.c b/sys/dev/firmware/arm/scmi.c index c24768a5668a..950bbf94eeb6 100644 --- a/sys/dev/firmware/arm/scmi.c +++ b/sys/dev/firmware/arm/scmi.c @@ -717,7 +717,7 @@ scmi_msg_put(device_t dev, struct scmi_msg *msg) } int -scmi_request(device_t dev, void *in, void **out) +scmi_request_tx(device_t dev, void *in) { struct scmi_softc *sc; struct scmi_req *req; @@ -732,8 +732,11 @@ scmi_request(device_t dev, void *in, void **out) /* Set inflight and send using transport specific method - refc-2 */ error = scmi_req_track_inflight(sc, req); - if (error != 0) + if (error != 0) { + device_printf(dev, "Failed to build req with HDR |%0X|\n", + req->msg.hdr); return (error); + } error = SCMI_XFER_MSG(sc->dev, &req->msg); if (error != 0) { @@ -741,5 +744,22 @@ scmi_request(device_t dev, void *in, void **out) return (error); } + return (0); +} + +int +scmi_request(device_t dev, void *in, void **out) +{ + struct scmi_softc *sc; + struct scmi_req *req; + int error; + + error = scmi_request_tx(dev, in); + if (error != 0) + return (error); + + sc = device_get_softc(dev); + req = buf_to_req(in); + return (scmi_wait_for_response(sc, req, out)); } diff --git a/sys/dev/firmware/arm/scmi.h b/sys/dev/firmware/arm/scmi.h index f6aa072caeca..f5b4173272bb 100644 --- a/sys/dev/firmware/arm/scmi.h +++ b/sys/dev/firmware/arm/scmi.h @@ -83,6 +83,7 @@ void scmi_buf_put(device_t dev, void *buf); struct scmi_msg *scmi_msg_get(device_t dev, int tx_payld_sz, int rx_payld_sz); void scmi_msg_put(device_t dev, struct scmi_msg *msg); int scmi_request(device_t dev, void *in, void **); +int scmi_request_tx(device_t dev, void *in); void scmi_rx_irq_callback(device_t dev, void *chan, uint32_t hdr, uint32_t rx_len); DECLARE_CLASS(scmi_driver); From nobody Thu Jan 23 17:27:38 2025 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 4Yf7Dq1W2mz5lDWp; Thu, 23 Jan 2025 17:27: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 4Yf7Dp4G6bz43dT; Thu, 23 Jan 2025 17:27:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/2oYWOYcTuGxVLU9DNWW9OWsTSwxXmJt5yDpZHQ1Qkw=; b=SAob/+KUKhcwjcETWxC/vpy380OvmLbuSD+DtbgHL9M2ZOONH9xjOFyZXJzujEihdidA85 9sbMXSPfZ+58URONOT0tTUMJUbhymF/TmXA62OGJyeA1fz+RUDarNt0ny5NMV9Koq/3fMA KiX25bPwSh3PZCkzo9CkFLEdq6YHuKaSqvwXq7TG5vAWgeVJx8Tpik8Dv7ehs/RobWD/gh dNN3oNM0A4M/Fj3t7kLx+4o+M+bJZMJqhrb14phHIIxZt8wjd+e5wtkUvTCPgvNfyt46wf ioBJ5+7yN+7gtoafYHFct6fo0LEHfvcH1XSB/Cj+UFpGcwQZJZo76mu8ibjvQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/2oYWOYcTuGxVLU9DNWW9OWsTSwxXmJt5yDpZHQ1Qkw=; b=uUKYIJyxhKKm9OJGigtPpzTYayFLA0k+RymsH3RN7UE8u+aQiIdo3dze8fXWzVJLqIXq0d I3BxdOJ2KN9Om9AVe89C+IkojnjcLgIGWmbts0cyuWjVb70uLrexLBgzK26j6GURzb9oFG EkkUDWkE77UtuUrjb3oP2hi7iXG3glbEIDGKW2+nWaQpvZaIh+1XA9+lmJYzL6aXS/rtzQ 5e1T+AQxdex3lMvHApA8aJGOb/iOYnYHD8mT04wAVHrTUw2AQ89uWnkuqyZOpZsPYPdiY2 2cevxtmuSR635t4Ybtx93gQg4fcWHiBF7VvrQ5niKbKSUZPQDjrdi3NvPkEVTA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653258; a=rsa-sha256; cv=none; b=VVdzRaQkaaaIAn4Y3QWkJCxWGXsIvWHqNBEDMSgPW3m2DyJiAyAMYlUVQceYaimcLlFXyv 8xNi5z8Cqs8r3XiAsB5oDqYgOZxZBD0ml5OtQDRCOU9goqi0W0ggdw7RtR8GqO5DaL8+rv jxs7rC7vFcAlDEYpmcSH1tpqSc8AZK/TkkzSfW4+6fudaQteRiqbjKj1puvIwB8HpGKoP2 NBwutwJSCbU7Q/xsiMx6f9o6KQ/ej+Qxmyp5EcGblsQxUJniEf0rNdOBob2ArS91WKxsYg E8o5jlhYVo6baxSdz9B9jeU/qNQAppi86oggugU6vm8YCYJL/t8jpe3dk3JFUA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7Dp3ph3zp0w; Thu, 23 Jan 2025 17:27:38 +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 50NHRcxL022812; Thu, 23 Jan 2025 17:27:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRchQ022809; Thu, 23 Jan 2025 17:27:38 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:38 GMT Message-Id: <202501231727.50NHRchQ022809@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: b802926b7b14 - main - scmi: Add optional asynchronous handling of replies 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: b802926b7b145d7cfe2465ac4e19f062a9eb6e6d Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=b802926b7b145d7cfe2465ac4e19f062a9eb6e6d commit b802926b7b145d7cfe2465ac4e19f062a9eb6e6d Author: Cristian Marussi AuthorDate: 2025-01-23 13:26:12 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:27 +0000 scmi: Add optional asynchronous handling of replies Add the core logic to handle the replies to pending command in an asynchronous manner. Tested on: Arm Morello Board Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47426 Signed-off-by: Cristian Marussi --- sys/dev/firmware/arm/scmi.c | 46 ++++++++++++++++++++++++++++++++++++++++----- sys/dev/firmware/arm/scmi.h | 1 + 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/sys/dev/firmware/arm/scmi.c b/sys/dev/firmware/arm/scmi.c index 950bbf94eeb6..0b165e413674 100644 --- a/sys/dev/firmware/arm/scmi.c +++ b/sys/dev/firmware/arm/scmi.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -94,6 +95,8 @@ struct scmi_req { bool use_polling; bool done; bool is_raw; + device_t dev; + struct task tsk; struct mtx mtx; LIST_ENTRY(scmi_req) next; int protocol_id; @@ -103,6 +106,7 @@ struct scmi_req { struct scmi_msg msg; }; +#define tsk_to_req(t) __containerof((t), struct scmi_req, tsk) #define buf_to_msg(b) __containerof((b), struct scmi_msg, payld) #define msg_to_req(m) __containerof((m), struct scmi_req, msg) #define buf_to_req(b) msg_to_req(buf_to_msg(b)) @@ -131,7 +135,9 @@ struct scmi_transport { static void scmi_transport_configure(struct scmi_transport_desc *, phandle_t); static int scmi_transport_init(struct scmi_softc *, phandle_t); static void scmi_transport_cleanup(struct scmi_softc *); -static struct scmi_reqs_pool *scmi_reqs_pool_allocate(const int, const int); +static void scmi_req_async_waiter(void *, int); +static struct scmi_reqs_pool *scmi_reqs_pool_allocate(device_t, const int, + const int); static void scmi_reqs_pool_free(struct scmi_reqs_pool *); static struct scmi_req *scmi_req_alloc(struct scmi_softc *, enum scmi_chan); static struct scmi_req *scmi_req_initialized_alloc(device_t, int, int); @@ -217,7 +223,7 @@ DRIVER_MODULE(scmi, simplebus, scmi_driver, 0, 0); MODULE_VERSION(scmi, 1); static struct scmi_reqs_pool * -scmi_reqs_pool_allocate(const int max_msg, const int max_payld_sz) +scmi_reqs_pool_allocate(device_t dev, const int max_msg, const int max_payld_sz) { struct scmi_reqs_pool *rp; struct scmi_req *req; @@ -229,6 +235,10 @@ scmi_reqs_pool_allocate(const int max_msg, const int max_payld_sz) req = malloc(sizeof(*req) + max_payld_sz, M_DEVBUF, M_ZERO | M_WAITOK); + req->dev = dev; + req->tsk.ta_context = &req->tsk; + req->tsk.ta_func = scmi_req_async_waiter; + mtx_init(&req->mtx, "req", "SCMI", MTX_SPIN); LIST_INSERT_HEAD(&rp->head, req, next); } @@ -280,14 +290,14 @@ scmi_transport_init(struct scmi_softc *sc, phandle_t node) trs->inflight_ht = hashinit(td->max_msg, M_DEVBUF, &trs->inflight_mask); trs->chans[SCMI_CHAN_A2P] = - scmi_reqs_pool_allocate(td->max_msg, td->max_payld_sz); + scmi_reqs_pool_allocate(sc->dev, td->max_msg, td->max_payld_sz); if (trs->chans[SCMI_CHAN_A2P] == NULL) { free(trs, M_DEVBUF); return (ENOMEM); } trs->chans[SCMI_CHAN_P2A] = - scmi_reqs_pool_allocate(td->max_msg, td->max_payld_sz); + scmi_reqs_pool_allocate(sc->dev, td->max_msg, td->max_payld_sz); if (trs->chans[SCMI_CHAN_P2A] == NULL) { scmi_reqs_pool_free(trs->chans[SCMI_CHAN_A2P]); free(trs, M_DEVBUF); @@ -648,7 +658,8 @@ scmi_wait_for_response(struct scmi_softc *sc, struct scmi_req *req, void **out) SCMI_COLLECT_REPLY(sc->dev, &req->msg); if (req->msg.payld[0] != 0) ret = req->msg.payld[0]; - *out = &req->msg.payld[SCMI_MSG_HDR_SIZE]; + if (out != NULL) + *out = &req->msg.payld[SCMI_MSG_HDR_SIZE]; } else { device_printf(sc->dev, "Request for token 0x%X timed-out.\n", req->token); @@ -703,6 +714,20 @@ scmi_msg_get(device_t dev, int tx_payld_sz, int rx_payld_sz) return (&req->msg); } +static void +scmi_req_async_waiter(void *context, int pending) +{ + struct task *ta = context; + struct scmi_softc *sc; + struct scmi_req *req; + + req = tsk_to_req(ta); + sc = device_get_softc(req->dev); + scmi_wait_for_response(sc, req, NULL); + + scmi_msg_put(req->dev, &req->msg); +} + void scmi_msg_put(device_t dev, struct scmi_msg *msg) { @@ -763,3 +788,14 @@ scmi_request(device_t dev, void *in, void **out) return (scmi_wait_for_response(sc, req, out)); } + +int +scmi_msg_async_enqueue(struct scmi_msg *msg) +{ + struct scmi_req *req; + + req = msg_to_req(msg); + + return taskqueue_enqueue_flags(taskqueue_thread, &req->tsk, + TASKQUEUE_FAIL_IF_PENDING | TASKQUEUE_FAIL_IF_CANCELING); +} diff --git a/sys/dev/firmware/arm/scmi.h b/sys/dev/firmware/arm/scmi.h index f5b4173272bb..990759237964 100644 --- a/sys/dev/firmware/arm/scmi.h +++ b/sys/dev/firmware/arm/scmi.h @@ -84,6 +84,7 @@ struct scmi_msg *scmi_msg_get(device_t dev, int tx_payld_sz, int rx_payld_sz); void scmi_msg_put(device_t dev, struct scmi_msg *msg); int scmi_request(device_t dev, void *in, void **); int scmi_request_tx(device_t dev, void *in); +int scmi_msg_async_enqueue(struct scmi_msg *msg); void scmi_rx_irq_callback(device_t dev, void *chan, uint32_t hdr, uint32_t rx_len); DECLARE_CLASS(scmi_driver); From nobody Thu Jan 23 17:27:40 2025 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 4Yf7Ds4m7fz5lDdj; Thu, 23 Jan 2025 17:27: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 4Yf7Dr68wsz43q8; Thu, 23 Jan 2025 17:27:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653260; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9aTYW/xXnXvQdivFvuLSA2blY2v/SttrFeXYsICg0cI=; b=pQSjMLhW5S599CUAzijCz7Z889fk/llBVCiCTSQZrJE3MU6wBFvDOD3OlairrudEMGjSTw WhhukP4cj4uj6Pd4phqr/GvMaqLnPUWES0Ys24LXlH0Geoq+8bFVYj3o0XxT2l4WiXCldH +JpI4oS+u78+5an9iTvat6DnuCRZ1pZiMQZ2RCOcXLcme1H9YQZtf5NChHhlcjrYxI0b8w e6mE63K3CbuXS/iYC6cZN/g2/ytx2A34tbh6b6qkI21XbR2Y7l4boPxepUfGa2alzKSRlh aWzyOL2zsKWHoBwJsO2sMpvL7lTacQlNkujNHpPCGQxg4QFMulDMKwSwDcsccA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653260; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9aTYW/xXnXvQdivFvuLSA2blY2v/SttrFeXYsICg0cI=; b=NBXCL0k2mbeji2r9nNO0oBvldpwEG5vgfsdyR+9vTYW+a3Y56ySvVuTDU2LsPeyZVqR9WF enDKxLQs0R/RRPxKwjXDPshx5uP+F+beYXW+2J4AdG/zmLJtLUBYFFcLEuKpdyUIyuR4Xw Qx+/joA6xiPKhZhfYDESbKvBesAOA5qwuvKn0GIPPKOwm8UmWzNcsWMQdgGvamsjq9aiP/ +BjZG3y38HiArm7Jct0A3e7nLO0ui2B39bin3uxitxmdnvV8X0woby9W3//vcsNk5/1DU/ AQoQHHEdEk7JQtc1FLiAEcM2d8KJcAHbV3Ye/AFYdE6acWUKKagWYjkcrBEmCg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653260; a=rsa-sha256; cv=none; b=Bsv3SN8xUuWjK47yy7kcMmREWc9l5uwUCfCfBgkkvvIoku2P65ooKwIcj/2ap6HjdDnsln hAJBXHoiDotBrGHO8L8hBzFlOMciid5HuvKRsTMebzT8OL9ddGjod8v0XGUB/0hkvdanje SZgelopJrOO9PYSFHSG/O58iE70MDIYJDj6hCDflY+lmklCJg39oUrUzTEwRlBFwZI/32r mmXDKoXAGRlRmi2hE7meHIr0OS5lvjAuSrBwx7gaUe03OkXjAomVVGaqGXTN+Nujw/0tQN 1wO05/AK5JGGPP2tdO9sL5z9TOF4uvqPiJF7UB54b9w/TgKqQDgIxe3ylYbSHA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf7Dr5jsdzpBK; Thu, 23 Jan 2025 17:27: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 50NHRes9022882; Thu, 23 Jan 2025 17:27:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHReAD022879; Thu, 23 Jan 2025 17:27:40 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:40 GMT Message-Id: <202501231727.50NHReAD022879@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: e6d0edd2fe8c - main - scmi: Add sysctl transport properties 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: e6d0edd2fe8c3c15faa7c9c66703efa007a5fbe1 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=e6d0edd2fe8c3c15faa7c9c66703efa007a5fbe1 commit e6d0edd2fe8c3c15faa7c9c66703efa007a5fbe1 Author: Cristian Marussi AuthorDate: 2025-01-23 13:27:08 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:27 +0000 scmi: Add sysctl transport properties Expose as read-only the configured transport properties. Tested on: Arm Morello Board Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47428 Signed-off-by: Cristian Marussi --- sys/dev/firmware/arm/scmi.c | 13 +++++++++++++ sys/dev/firmware/arm/scmi.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/sys/dev/firmware/arm/scmi.c b/sys/dev/firmware/arm/scmi.c index 2d9f6fa89d4b..b27f7211201e 100644 --- a/sys/dev/firmware/arm/scmi.c +++ b/sys/dev/firmware/arm/scmi.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -189,6 +190,7 @@ static void scmi_process_response(struct scmi_softc *, uint32_t, int scmi_attach(device_t dev) { + struct sysctl_oid *sysctl_trans; struct scmi_softc *sc; phandle_t node; int error; @@ -209,6 +211,17 @@ scmi_attach(device_t dev) device_printf(dev, "Transport - max_msg:%d max_payld_sz:%lu reply_timo_ms:%d\n", SCMI_MAX_MSG(sc), SCMI_MAX_MSG_PAYLD_SIZE(sc), SCMI_MAX_MSG_TIMEOUT_MS(sc)); + sc->sysctl_root = SYSCTL_ADD_NODE(NULL, SYSCTL_STATIC_CHILDREN(_hw), + OID_AUTO, "scmi", CTLFLAG_RD, 0, "SCMI root"); + sysctl_trans = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(sc->sysctl_root), + OID_AUTO, "transport", CTLFLAG_RD, 0, "SCMI Transport properties"); + SYSCTL_ADD_INT(NULL, SYSCTL_CHILDREN(sysctl_trans), OID_AUTO, "max_msg", + CTLFLAG_RD, &sc->trs_desc.max_msg, 0, "SCMI Max number of inflight messages"); + SYSCTL_ADD_INT(NULL, SYSCTL_CHILDREN(sysctl_trans), OID_AUTO, "max_msg_size", + CTLFLAG_RD, &sc->trs_desc.max_payld_sz, 0, "SCMI Max message payload size"); + SYSCTL_ADD_INT(NULL, SYSCTL_CHILDREN(sysctl_trans), OID_AUTO, "max_rx_timeout_ms", + CTLFLAG_RD, &sc->trs_desc.reply_timo_ms, 0, "SCMI Max message RX timeout ms"); + /* * Allow devices to identify. */ diff --git a/sys/dev/firmware/arm/scmi.h b/sys/dev/firmware/arm/scmi.h index 990759237964..fc52732bd503 100644 --- a/sys/dev/firmware/arm/scmi.h +++ b/sys/dev/firmware/arm/scmi.h @@ -32,6 +32,8 @@ #ifndef _ARM64_SCMI_SCMI_H_ #define _ARM64_SCMI_SCMI_H_ +#include + #include "scmi_if.h" #define SCMI_DEF_MAX_MSG 32 @@ -64,6 +66,7 @@ struct scmi_softc { struct mtx mtx; struct scmi_transport_desc trs_desc; struct scmi_transport *trs; + struct sysctl_oid *sysctl_root; }; struct scmi_msg { From nobody Thu Jan 23 17:38:26 2025 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 4Yf7TW3NNSz5lFWr; Thu, 23 Jan 2025 17:38:39 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) (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 4Yf7TW1Zhfz4DWW; Thu, 23 Jan 2025 17:38:39 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-il1-f181.google.com with SMTP id e9e14a558f8ab-3ce868498d3so3415265ab.3; Thu, 23 Jan 2025 09:38:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737653918; x=1738258718; 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=tm9UMgdwZcgqBSsMEEhj0G2tMokKzs+jn5Y+RPjtlvQ=; b=TonihdNU2WvTxIULiO2jnTGckJjD96Ps8oh/wimDvPoGv2ZcuMhuHQdkMEZEzCi8hp NMUSnYcodSfFSL/2ajV6Qbi7MM9Y+2JvlTSC36F6++VskQoQqWr9+Nn+7v8p9n3LEjYW OGUzVkJCrWA33V4A2YXZa8OHiy/aNIndW+06iF7PkSASZySW7p31NyadvpWtbSvQwg9u pco2rK/bpnkmfsF6Hy20lrxSqTzMQdPGlux+f/A7DAsPaKiIZiffalRlNDi187mkvMcE Ko483f4SsAfVib0o0fUTnV9+tV7/cURYwgRT758V+GLHxNQkZdCWPvJCg8ysUglkJN43 SueQ== X-Forwarded-Encrypted: i=1; AJvYcCU+1FNWZFBwtfolgoA1Ef6/1G+a49lr1TqU1FQybxcaS8jYgKPyK2NazDJyqhYHK6PlwgD7AOkqoqz9pAMLIm6mSgWL@freebsd.org, AJvYcCVv3hMsfqJsxNVBppAodr8HTqAMXtWRBaoHbFiivlSn6O+i5Gdk901tDUOsXd8d0tQnGMSC1C209KdVvdKinSzFk735HQM=@freebsd.org X-Gm-Message-State: AOJu0Yx859FtT4anREt7iBSVMnQLsMT/4BjksxsJpxgKhkyeIjcEVlJ9 +8en5ICj5gOmVKkAyAg5y68fwrjQ+wUeG1g5qHhbmfbO1TZpr+0YyWRxJ8ugX/3Ja6u/Qa0Sz5I BsVayHWAPSC9BO3ljmB+O5iVg643ZCg== X-Gm-Gg: ASbGncv4qqIMv4YP4+AajdJC8pHuaurOvxil9kfjkutoEJ2SPyWB/7lLmn50urgt+kc 0z4MOjftW4PXee4VMsFHKHuvNIWwrEbhfNC56MljgLXjD0SjygPkR8roE+MVmCpz/50VieP9+7H 2hqTZG+dPG2iRKWyF1p8ZO X-Google-Smtp-Source: AGHT+IGUM8cIp7hcEIDmjPWkh4md6PVvJoYboZYdE1UcgHwbsi7o8ojyAJTDA2MyKiNE+/KmKuANq8gOdJiZhHqosAg= X-Received: by 2002:a05:6e02:8d:b0:3cf:b9d3:95a7 with SMTP id e9e14a558f8ab-3cfb9d39641mr60480295ab.18.1737653917696; Thu, 23 Jan 2025 09:38:37 -0800 (PST) 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: <202501231632.50NGWgHd026140@gitrepo.freebsd.org> In-Reply-To: <202501231632.50NGWgHd026140@gitrepo.freebsd.org> From: Ed Maste Date: Thu, 23 Jan 2025 12:38:26 -0500 X-Gm-Features: AbW1kvan0J1Och1D0qQBj-jfVOifMAdUWJFT02gekzGKJBy0pKDnuUdKE3dQPy8 Message-ID: Subject: Re: git: 0e4167514fe3 - main - development.7: Add example for just kernel modules To: Alexander Ziaee Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Yf7TW1Zhfz4DWW 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:15169, ipnet:209.85.128.0/17, country:US] On Thu, 23 Jan 2025 at 11:32, Alexander Ziaee wrote: > > The branch main has been updated by ziaee: > > URL: https://cgit.FreeBSD.org/src/commit/?id=0e4167514fe3894b288457f9c1edd8fb3237dfb8 > > commit 0e4167514fe3894b288457f9c1edd8fb3237dfb8 > Author: Alexander Ziaee > AuthorDate: 2025-01-17 22:56:59 +0000 > Commit: Alexander Ziaee > CommitDate: 2025-01-23 16:32:03 +0000 > > development.7: Add example for just kernel modules > ... > +Rebuild and reinstall a single loadable kernel module, in this case > +.Xr sound 4 : > +.Bd -literal -offset indent > +cd src/sys/modules/sound > +make all install clean cleandepend KMODDIR=/boot/kernel It's great to have an example like this on this page, thank you. There's one issue with sound(4) as the example though, in that sound is included in the kernel already; in the context of a standard kernel configuration the sound module serves no purpose. Perhaps we should have example of configuring a custom kernel (which can be without sound support) as well? From nobody Thu Jan 23 18:12:35 2025 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 4Yf8Dg4k2Dz5lHbF; Thu, 23 Jan 2025 18:12: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 4Yf8Dg3yj1z4HHq; Thu, 23 Jan 2025 18:12:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737655955; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=khrQsYvGDV3BHqASDPHBud+jmT5UxwSY7l5ZJeEAcCM=; b=dhoK2TqV4felR1C3Tpg6FAzvRpzeN6qbzDUhLITzSYC+8ms7PZOTyfyMzNqTa+iniAAqmg /mdAAJys/4w1nMZI2bu5Nu0J76GKgZa2L+JAdw03TscC23NDYc4jQHH6iRQK7Xjy7h8xsD tqeOHVAudcjo4Rk9gYt3Udpx/ZQx2/IZDYKA2yRzgi0mqw/9R36zaTwKLv5vOGe+dsKySC p/DjNE9leohFqvQcVi2NV2Q6Dc2KnSwr5DEIkgK2ANpdTGf1vYVp02IEUOH0kC4IzD6KZZ jIvXXfYBgBWS+ojjehj4FwQHTdGFw3+sAItNfhdDeU70Ej3AqjzXLwgtTfgiSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737655955; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=khrQsYvGDV3BHqASDPHBud+jmT5UxwSY7l5ZJeEAcCM=; b=QwuKvTYdkkomeU9SqMdluu08i+mPSnRwkrNZYQnArg1n8IhNXcCinnEuRfYlNGWH5tRw1I vuk4HpfMXbtqnKispz/CUJxAyttTjEjl89k3EGntEMYxKidCgntXqDqDEIsTxmWWpxmWLe eyNYkQXkVUwJK8rxa40C8oshxoHJuJT2pCRcGFRt3ZygUaYXldV0B177YqkZX5RHP4HmAc X+ELzjORxVe9GATaEYjocZ6iA+JEW0llQ7T17gd7bqcf3eMzQF45cvzXOwixOmOkOpuO3G tMGFC0WwhnrKFGC4fU+5RB+Zsa64GOj7wtA2ZbMjW5gznveBAY+IH/FbENPXww== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737655955; a=rsa-sha256; cv=none; b=PKv1s7zhCaQjslnUIamrh9DdYmCMBbLGH6lqAAA7XPhKyWyAI+PvBY/66YD5SayjrFWa+u DGPtdTOd1bNHotgy8IpcN671yPTkvR1hO/wtEMD2HLiysibwM1spckuS5DjjJOUAoP+13k eiR9StlY3Q/3fl2HU0G/+wEstFAp9LOvgHLv0szUQoXQgB416Ra5yCrYoKxjg3kcXbts5t DQ26a8Vny6cmde+3ytOh3ejC3Bjpnv67+sdgcV9P+rekBQYHRGubD0HSL8YXWjlrdYAdA5 0PKa1RPpckhMk572usYAg7VPml5QnJbzdX9N0d/UJqoeQTh08PwPqvvDZDAc9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf8Dg3Wv1zqYF; Thu, 23 Jan 2025 18:12: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 50NICZ82014878; Thu, 23 Jan 2025 18:12:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NICZuA014875; Thu, 23 Jan 2025 18:12:35 GMT (envelope-from git) Date: Thu, 23 Jan 2025 18:12:35 GMT Message-Id: <202501231812.50NICZuA014875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: cda74c35cb37 - main - firewire: Add deprecation notice 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cda74c35cb37aa8ecb536aae8d93451eafec15df Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=cda74c35cb37aa8ecb536aae8d93451eafec15df commit cda74c35cb37aa8ecb536aae8d93451eafec15df Author: Ed Maste AuthorDate: 2025-01-22 20:51:45 +0000 Commit: Ed Maste CommitDate: 2025-01-23 18:12:27 +0000 firewire: Add deprecation notice This was originally discussed as part of FreeBSD 15 planning, but did not happen in time. Add the deprecation notice now, with an expectation that it will be removed before FreeBSD 16. Reviewed by: brooks, imp Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48598 --- share/man/man4/firewire.4 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/share/man/man4/firewire.4 b/share/man/man4/firewire.4 index 8c4b65eb25bb..99aadb308fc3 100644 --- a/share/man/man4/firewire.4 +++ b/share/man/man4/firewire.4 @@ -29,7 +29,7 @@ .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd June 6, 2022 +.Dd January 23, 2025 .Dt FIREWIRE 4 .Os .Sh NAME @@ -49,6 +49,11 @@ module at boot time, place the following line in .Bd -literal -offset indent firewire_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is slated to be removed prior to +.Fx 16.0 . .Sh DESCRIPTION .Fx provides machine-independent bus support and raw drivers for From nobody Thu Jan 23 18:17:02 2025 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 4Yf8Kp5s1Qz5lHfr; Thu, 23 Jan 2025 18:17: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 4Yf8Kp56Q9z4JsV; Thu, 23 Jan 2025 18:17:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737656222; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pqUjL5cc+VQqgLdPZxnAl4cVESWwWr9k8cBxgtm71HI=; b=e/BUiMdfRhMlXhIrCgKffwMEfjGOKg3UR+lzjOuHZy9ir6D9J9Qb38fOkFEf8kVEqo2VUV aQRdjDn4ogBCuqARF7sJvJeaZEoCTIiMCdmAgE44SFA+bvmbOk30JAoEpq0V+kk4GfdoQU ZY1J7wu7d9ML+L8DoT+Ro6OwZzVoKj5y0FDCwE049k/RE3x9k34nR2G8v5HqvQ/umBOpAL Ggel0VNrb/suX9pMIQmrcKrb7tgBGDG8FyI119i3//0VUpjnRHEQZXvWE3Pkpi2VRwqq0g gKgP0+IyLeru2WXaXbO8kTDORPAsQBpPGEt98vey5qztnrBYXo6FdUeNkjZFKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737656222; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pqUjL5cc+VQqgLdPZxnAl4cVESWwWr9k8cBxgtm71HI=; b=b9Dfg5/ITcBSzzrPuyqk2KWs1xFlPnUmg47m20/jiBdrvi7SR+NsrQpPfhgXV1tcIrB8hA DKsNo5YhGB4se1ADTiWlnBWT93evKcP+VnQ304NCuWHUXVrWnrCatIgB9cRtvSrnQB14mc JnNpWQR1m7thAZoMH4ykE9n9/Eb6/9WoABqn2SaxlC/HApMbFuJMnmX806LKn/jIPFQxzJ ekJUe58vWDUJcgpzzEtPipsEDeAAZGzNif/VPzxzMw9OLloiyLJPH53dnsuMxG2akN49G7 0zNZZCAxqEM+LdTa5VV4ZSxLCLDDScNNya08mBInX+FWyotAKazvyJ5WQXSCig== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737656222; a=rsa-sha256; cv=none; b=ufZOichfAfF8Hz5oOu2m1AbB5IyfbmJ57KEh50lFK32qzjnoaRfFUJ2uKTzzUMomQ+yYGj UATNMH+cUITfVZ5vvz0dKwXv1hRU9fPxMaEFrrHP7lEE9OQiJWaqgIVY4gYoPjjc9Ex3C2 YqTJbf5TdNDPOelYkYWgL9xg0gdC8JSDUzfm/3WPjC8IAfPhiPUGO6dBmXc03nqKTxOXRE x8HHSVsFu+TtChxjHplQ+rSzIHI8Neu2xxJsp1x7168KJ1kZtBbj4MAnSM+vKpgHPrSNhP XsPKHpBI0ifGXLl3OTe9vNndd6jfDN4GaqRYRy6iH930FHRdkyLZBNLuSTI/Hg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf8Kp4gMczqSG; Thu, 23 Jan 2025 18:17: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 50NIH2bb016601; Thu, 23 Jan 2025 18:17:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NIH2nD016598; Thu, 23 Jan 2025 18:17:02 GMT (envelope-from git) Date: Thu, 23 Jan 2025 18:17:02 GMT Message-Id: <202501231817.50NIH2nD016598@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 27bd6c32bbb4 - main - Remove references to gvinum(8) in various manpages 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 27bd6c32bbb49a592a0dfbec5f211a7c2fed31d6 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=27bd6c32bbb49a592a0dfbec5f211a7c2fed31d6 commit 27bd6c32bbb49a592a0dfbec5f211a7c2fed31d6 Author: John Baldwin AuthorDate: 2025-01-23 18:16:47 +0000 Commit: John Baldwin CommitDate: 2025-01-23 18:16:47 +0000 Remove references to gvinum(8) in various manpages Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D48540 --- lib/geom/concat/gconcat.8 | 3 +-- lib/geom/mirror/gmirror.8 | 3 +-- lib/geom/raid/graid.8 | 5 ++--- lib/geom/raid3/graid3.8 | 3 +-- lib/geom/stripe/gstripe.8 | 3 +-- sbin/ffsinfo/ffsinfo.8 | 3 +-- sbin/growfs/growfs.8 | 4 +--- sbin/newfs/newfs.8 | 3 +-- share/man/man4/ccd.4 | 3 +-- share/man/man7/tuning.7 | 6 ++---- 10 files changed, 12 insertions(+), 24 deletions(-) diff --git a/lib/geom/concat/gconcat.8 b/lib/geom/concat/gconcat.8 index 55c05b469d4a..165f809ffba8 100644 --- a/lib/geom/concat/gconcat.8 +++ b/lib/geom/concat/gconcat.8 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 14, 2021 +.Dd January 23, 2025 .Dt GCONCAT 8 .Os .Sh NAME @@ -216,7 +216,6 @@ growfs /dev/concat/data .Xr loader.conf 5 , .Xr geom 8 , .Xr growfs 8 , -.Xr gvinum 8 , .Xr mount 8 , .Xr newfs 8 , .Xr sysctl 8 , diff --git a/lib/geom/mirror/gmirror.8 b/lib/geom/mirror/gmirror.8 index 0d1bb4566d58..aeffb2d948b1 100644 --- a/lib/geom/mirror/gmirror.8 +++ b/lib/geom/mirror/gmirror.8 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 5, 2022 +.Dd January 23, 2025 .Dt GMIRROR 8 .Os .Sh NAME @@ -436,7 +436,6 @@ there. .Xr geom 4 , .Xr dumpon 8 , .Xr geom 8 , -.Xr gvinum 8 , .Xr mount 8 , .Xr newfs 8 , .Xr savecore 8 , diff --git a/lib/geom/raid/graid.8 b/lib/geom/raid/graid.8 index 50c0116ba22e..f722fd5c17bd 100644 --- a/lib/geom/raid/graid.8 +++ b/lib/geom/raid/graid.8 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 4, 2013 +.Dd January 23, 2025 .Dt GRAID 8 .Os .Sh NAME @@ -307,8 +307,7 @@ Enable taste for specific metadata or transformation module. Exit status is 0 on success, and non-zero if the command fails. .Sh SEE ALSO .Xr geom 4 , -.Xr geom 8 , -.Xr gvinum 8 +.Xr geom 8 .Sh HISTORY The .Nm diff --git a/lib/geom/raid3/graid3.8 b/lib/geom/raid3/graid3.8 index 0e8eebc2bd81..e1bcdac17f99 100644 --- a/lib/geom/raid3/graid3.8 +++ b/lib/geom/raid3/graid3.8 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 15, 2012 +.Dd January 23, 2025 .Dt GRAID3 8 .Os .Sh NAME @@ -236,7 +236,6 @@ graid3 insert -n 0 data da5 .Sh SEE ALSO .Xr geom 4 , .Xr geom 8 , -.Xr gvinum 8 , .Xr mount 8 , .Xr newfs 8 , .Xr umount 8 diff --git a/lib/geom/stripe/gstripe.8 b/lib/geom/stripe/gstripe.8 index 0282faf58b6d..6fd486355a2e 100644 --- a/lib/geom/stripe/gstripe.8 +++ b/lib/geom/stripe/gstripe.8 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 21, 2004 +.Dd January 23, 2025 .Dt GSTRIPE 8 .Os .Sh NAME @@ -227,7 +227,6 @@ for .Xr loader.conf 5 , .Xr ccdconfig 8 , .Xr geom 8 , -.Xr gvinum 8 , .Xr mount 8 , .Xr newfs 8 , .Xr sysctl 8 , diff --git a/sbin/ffsinfo/ffsinfo.8 b/sbin/ffsinfo/ffsinfo.8 index 6daa9a79c9e9..2221b2fb63b6 100644 --- a/sbin/ffsinfo/ffsinfo.8 +++ b/sbin/ffsinfo/ffsinfo.8 @@ -36,7 +36,7 @@ .\" .\" $TSHeader: src/sbin/ffsinfo/ffsinfo.8,v 1.3 2000/12/12 19:30:55 tomsoft Exp $ .\" -.Dd November 19, 2024 +.Dd January 23, 2025 .Dt FFSINFO 8 .Os .Sh NAME @@ -125,7 +125,6 @@ with all available information. .Xr fsck 8 , .Xr gpart 8 , .Xr growfs 8 , -.Xr gvinum 8 , .Xr newfs 8 , .Xr tunefs 8 .Sh HISTORY diff --git a/sbin/growfs/growfs.8 b/sbin/growfs/growfs.8 index 9b619613f30e..f23817b0afbe 100644 --- a/sbin/growfs/growfs.8 +++ b/sbin/growfs/growfs.8 @@ -36,7 +36,7 @@ .\" .\" $TSHeader: src/sbin/growfs/growfs.8,v 1.3 2000/12/12 19:31:00 tomsoft Exp $ .\" -.Dd October 3, 2023 +.Dd January 23, 2025 .Dt GROWFS 8 .Os .Sh NAME @@ -55,8 +55,6 @@ Before running .Nm the partition or slice containing the file system must be extended using .Xr gpart 8 . -If you are using volumes you must enlarge them by using -.Xr gvinum 8 . The .Nm utility extends the size of the file system on the specified special file. diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8 index daf568fe6a33..16bca26f7cd8 100644 --- a/sbin/newfs/newfs.8 +++ b/sbin/newfs/newfs.8 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd November 19, 2024 +.Dd January 23, 2025 .Dt NEWFS 8 .Os .Sh NAME @@ -362,7 +362,6 @@ on file systems that contain many small files. .Xr gjournal 8 , .Xr gpart 8 , .Xr growfs 8 , -.Xr gvinum 8 , .Xr makefs 8 , .Xr mount 8 , .Xr newfs_msdos 8 , diff --git a/share/man/man4/ccd.4 b/share/man/man4/ccd.4 index c44013dab11f..9727fb68064f 100644 --- a/share/man/man4/ccd.4 +++ b/share/man/man4/ccd.4 @@ -32,7 +32,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 9, 1995 +.Dd January 23, 2025 .Dt CCD 4 .Os .Sh NAME @@ -277,7 +277,6 @@ device special files .Xr config 8 , .Xr disklabel 8 , .Xr fsck 8 , -.Xr gvinum 8 , .Xr mount 8 , .Xr newfs 8 .Sh HISTORY diff --git a/share/man/man7/tuning.7 b/share/man/man7/tuning.7 index 8cebfe62bb64..ebba551f65d0 100644 --- a/share/man/man7/tuning.7 +++ b/share/man/man7/tuning.7 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 25, 2024 +.Dd January 23, 2025 .Dt TUNING 7 .Os .Sh NAME @@ -151,8 +151,7 @@ Striping can also improve the performance of a file system by splitting I/O operations across two or more disks. The -.Xr gstripe 8 , -.Xr gvinum 8 , +.Xr gstripe 8 and .Xr ccdconfig 8 utilities may be used to create simple striped file systems. @@ -687,7 +686,6 @@ over services you export from your box (web services, email). .Xr gjournal 8 , .Xr gpart 8 , .Xr gstripe 8 , -.Xr gvinum 8 , .Xr ifconfig 8 , .Xr ipfw 8 , .Xr loader 8 , From nobody Thu Jan 23 18:17:03 2025 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 4Yf8Kr35h0z5lHlh; Thu, 23 Jan 2025 18:17: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 4Yf8Kq6f7mz4K1S; Thu, 23 Jan 2025 18:17:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737656223; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VLiah3FEBzSqVEQzJt3k02vXHqxhOZZr8sYX/rq5/Sc=; b=QJThNzfNWOlnbi/ZyzfL3DoqckWLZDuGI1yLNiaiiuxRI9IwxePaC/AhfBp1yZrPKDNzL5 NkQ0TLY5HLVPYLcNh3kgVFsavYPld9G81aH+LDVIljgj7aDLw9McYylNYApNKo2qAKz1k7 9ciUbypy1+GDyMNjitchS+1bnB7dlf1P1T+cK1hWmNljvSLS2p2EtgkDS0CiB0CJ6j4br+ wHV7hPesGPK7ILVQnfLQxtIoHScTrPxCCM6iwBfH2z6DtP3hJtcK2y2L8hlfKDhJ0OXrEu TegvgJU52oHE0CalRpltJPo6a1Yplc1p47TmedFAncxv3Ml7UA+IkKeC0LOmTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737656223; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VLiah3FEBzSqVEQzJt3k02vXHqxhOZZr8sYX/rq5/Sc=; b=mvNacNRiKFipKVaAVBNS25ZYF4JbGNsETY+QAHQxBJFMC9+jGQ6NZzfj6Dn7KwT4hm5ftN QvaP80CjQjqkx1wM4hUL7aZZ9CuEQq7nTEoFEZkLrptpzsGHgq7tqnH0LdJ0ZO0RrdaZZB hDaf9MPeux7FLESgMGoubEsfYRaP+ZLETpQg26zpH7y/dFWtqFn6QUUUF1Fe7O7E3GBVXQ 3LbbPoZU8aA9vSpZsgNpuaoUTcZ62s2BX244vhi0AlUicCXbeoU2aeWl0x1O11ldZ08DC8 7xzFbXSeWSIMHsySKCUCY+u0zltI+XLqU/tm0kH3J0FsOCOK+DBEmsS/3mnknA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737656223; a=rsa-sha256; cv=none; b=acl6qHmvYmFr2tWaVS20Zjqj55R7QW632DzSbihH8CXk+u3w4Lq9Tlj0UHmUkODb3FYCqd oX+03jwfkI0hfbwjva9xxuiDhveM+6UuY8oZHDsr0F7LH34xqtJDzWYwmV+QUH4ia97T+o KfLnAhey84iWoq7eMFyYtDUOpFWnZDK5jgOc2wk0glpbB7o0uqXpoG3KX68rBQ566+QrQe gxDb0rtgrtlxRSH+P0TZUj+WIfKNs9Y76mANJlqyaWqlw1b5EYElO7ThU1cZwVT0tPGn1o FAzaurP8vbK3O4MFDCX+ON31wVmjcF0bjGYkED/rDGhcGnqIFcnike6NbGsnbg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf8Kq5bY1zqHH; Thu, 23 Jan 2025 18:17: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 50NIH36v016638; Thu, 23 Jan 2025 18:17:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NIH3nJ016635; Thu, 23 Jan 2025 18:17:03 GMT (envelope-from git) Date: Thu, 23 Jan 2025 18:17:03 GMT Message-Id: <202501231817.50NIH3nJ016635@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: a9ffa9b3d4d0 - main - RELNOTES: Document removal of vinum 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a9ffa9b3d4d00230a472148c5df7a37c927150cf Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a9ffa9b3d4d00230a472148c5df7a37c927150cf commit a9ffa9b3d4d00230a472148c5df7a37c927150cf Author: John Baldwin AuthorDate: 2025-01-23 18:16:55 +0000 Commit: John Baldwin CommitDate: 2025-01-23 18:16:55 +0000 RELNOTES: Document removal of vinum support Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D48644 --- RELNOTES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/RELNOTES b/RELNOTES index 515966f8ea08..12f5c20cf4d0 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,9 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +f87bb5967670, e51036fbf3f8: + Support for vinum volumes has been removed. + 8ae6247aa966, cf0ede720391d, 205659c43d87bd, 1ccbdf561f417, 4db1b113b151: The layout of NFS file handles for the tarfs, tmpfs, cd9660, and ext2fs file systems has changed. An NFS server that exports any of these file From nobody Thu Jan 23 18:45:27 2025 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 4Yf8yg4w0qz5lKSH; Thu, 23 Jan 2025 18:45:31 +0000 (UTC) (envelope-from ziaee@FreeBSD.org) Received: from mailtransmit05.runbox.com (mailtransmit05.runbox.com [IPv6:2a0c:5a00:149::26]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yf8yg2ZHlz4N8x; Thu, 23 Jan 2025 18:45:31 +0000 (UTC) (envelope-from ziaee@FreeBSD.org) Authentication-Results: mx1.freebsd.org; none Received: from mailtransmit02.runbox ([10.9.9.162] helo=aibo.runbox.com) by mailtransmit05.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1tb2Cl-007Itk-Mo; Thu, 23 Jan 2025 19:45:27 +0100 Received: from [10.9.9.129] (helo=rmmprod07.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1tb2Cl-00060b-5s; Thu, 23 Jan 2025 19:45:27 +0100 Received: from mail by rmmprod07.runbox with local (Exim 4.86_2) (envelope-from ) id 1tb2Cl-0004B8-4R; Thu, 23 Jan 2025 19:45:27 +0100 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 Received: from [Authenticated alias (960477)] by runbox.com with http (RMM6); Thu, 23 Jan 2025 18:45:27 GMT From: "Alexander Ziaee" To: "Ed Maste" CC: "src-committers" , "dev-commits-src-all" , "dev-commits-src-main" Subject: Re: git: 0e4167514fe3 - main - development.7: Add example for just kernel modules Date: Thu, 23 Jan 2025 18:45:27 +0000 (UTC) X-RMM-Aliasid: 960477 X-Mailer: RMM6 In-Reply-To: Message-Id: X-Rspamd-Queue-Id: 4Yf8yg2ZHlz4N8x 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:50304, ipnet:2a0c:5a00::/29, country:NO] On 2025-01-23 12:38 -05:00 EST, "Ed Maste" wrote: > On Thu, 23 Jan 2025 at 11:32, Alexander Ziaee wrote: >> >> The branch main has been updated by ziaee: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D0e4167514fe3894b288457f9c= 1edd8fb3237dfb8 >> >> commit 0e4167514fe3894b288457f9c1edd8fb3237dfb8 >> Author: Alexander Ziaee >> AuthorDate: 2025-01-17 22:56:59 +0000 >> Commit: Alexander Ziaee >> CommitDate: 2025-01-23 16:32:03 +0000 >> >> development.7: Add example for just kernel modules >> > ... >> +Rebuild and reinstall a single loadable kernel module, in this case >> +.Xr sound 4 : >> +.Bd -literal -offset indent >> +cd src/sys/modules/sound >> +make all install clean cleandepend KMODDIR=3D/boot/kernel >=20 > It's great to have an example like this on this page, thank you. > There's one issue with sound(4) as the example though, in that sound > is included in the kernel already; in the context of a standard kernel > configuration the sound module serves no purpose. Perhaps we should > have example of configuring a custom kernel (which can be without > sound support) as well? That would be wonderful! I'll draw that up and tag you for review. I wonder if that's why the patches I was testing didn't change anything? May I forward this to christos? Thanks, Alex= From nobody Thu Jan 23 19:04:23 2025 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 4Yf9NR56wxz5lLLF; Thu, 23 Jan 2025 19:04: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 4Yf9NR4TdHz4PCQ; Thu, 23 Jan 2025 19:04:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737659063; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WPCdrGD65jaFaBUAq55VOGBvj5iC1srI/68faIzLQeM=; b=l+jIoBZfLXecgO96caXvh0fChDbp1KnPL5E+XvoiY74pm9fwWLzkda9ysxd9VJ80pt36XX FSq675k2VqiDijunv2pHDe5ehntFomc/gD8LmLKRrmKS0mKobRfHYFpE5Leh+RPkx2iHwy ZSy0c0R3y3wkW9N5gTyomubIHQedSU5fB9CewWEE7zg+ZG/dhsHb2T9OzU5vBiDmpvLB2k jEKtX0QkDDYPARpAN2tVuQeSlFcRIWHEhpJLLpdgqQ4qvwakp/Q5TH/TGI2dD5NBQWFm4Z /aXlXAiEITuP09b6dbR3aDnuJ2Qy3FdBQ/Fzn+dMs3DDNKMtWo9XN64r5EtqSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737659063; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WPCdrGD65jaFaBUAq55VOGBvj5iC1srI/68faIzLQeM=; b=Yrvft9JSPox3TMstqzlF6auUiFsYvnvag9wJzzB4zeZRRwYKZrEmlVCZKe9RCMJ426g7Q8 xQy3WP/cWYRtpJAzayOz74hmEdLnviCahW8bVsXmj2pGoRVOBbsq3wLGP9Q5jVpj7SAqe4 aZeknzusWJetvcuE2iQ0rwKpN5NoRj/vA0q9+rZksLHzGKss8nIrq0ZdbE68sKvycSBPj9 w7kxuv0DOvZOUfv7wTlTvQ/1Vj7raLhQswnAy1RhNbGnls7C4291aVA3+B2S7GCjAg6lh0 XgYHc3YnvSFI1FjpX7Z/HsfWFmX73YHEeWCUfiFLNyXJtPDu7WzwUcKbc66B1A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737659063; a=rsa-sha256; cv=none; b=Se+bHMhoJ9TlxuZQr3YE9qz1ZsgGD9lrTO7hBF7CfB86n/8+4N2LelOkaNMgWz1j0Uv0TA 1MIpYsPoJml+CuCArsO8Vdkwy6gJxNo/Jlx4e+lHsZ9hq65Ht2YNypXZUhIDBIdH2YAVp/ fAfGOxKBTcmDzPqiFtN4VJ22gCeG1qAZS1Qz0qP46V7gFNXjT8OWh6UmOkLpqI/SnuRkna wOlOceqjlUFPtF1G3CJEGQvp3wI5bQisj1nEiXQ3K/FBr9ueK1mbs/vA+HR3AyfAFvUDau ZwQaXSwKrVQudADOD0sm4z++/nXOdNzyRgsYtzDF7q/Kzj3z1QmvUP2qKFh9LA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf9NR3rPbzsJs; Thu, 23 Jan 2025 19:04: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 50NJ4Ntt009992; Thu, 23 Jan 2025 19:04:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NJ4NIk009989; Thu, 23 Jan 2025 19:04:23 GMT (envelope-from git) Date: Thu, 23 Jan 2025 19:04:23 GMT Message-Id: <202501231904.50NJ4NIk009989@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: ce52baebd3b3 - main - icmp6: Fix ICMP6 message type 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ce52baebd3b37044e8a8e3f64ea4bc64d52c0a52 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ce52baebd3b37044e8a8e3f64ea4bc64d52c0a52 commit ce52baebd3b37044e8a8e3f64ea4bc64d52c0a52 Author: Mark Johnston AuthorDate: 2025-01-23 19:03:25 +0000 Commit: Mark Johnston CommitDate: 2025-01-23 19:03:25 +0000 icmp6: Fix ICMP6 message type counters Previously this macro would always increment the first counter in the histogram array. PR: 279975 Fixes: 60d8dbbef075 ("netinet: add a probe point for IP, IP6, ICMP, ICMP6, UDP and TCP stats counters") Sponsored by: Klara, Inc. --- sys/netinet/icmp6.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/icmp6.h b/sys/netinet/icmp6.h index 9de8daaa3390..7845b682f3e4 100644 --- a/sys/netinet/icmp6.h +++ b/sys/netinet/icmp6.h @@ -652,7 +652,7 @@ VNET_PCPUSTAT_DECLARE(struct icmp6stat, icmp6stat); #define ICMP6STAT_INC2(name, type) \ do { \ MIB_SDT_PROBE2(icmp6, count, name, 1, type); \ - VNET_PCPUSTAT_ADD(struct icmp6stat, icmp6stat, name, 1); \ + VNET_PCPUSTAT_ADD(struct icmp6stat, icmp6stat, name[type], 1); \ } while (0) /* From nobody Thu Jan 23 19:04:24 2025 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 4Yf9NS6DP1z5lLYZ; Thu, 23 Jan 2025 19:04: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 4Yf9NS4xZwz4PCR; Thu, 23 Jan 2025 19:04:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737659064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mObXD3L6D5xm94hkRtjjQI769hJMmFM3lAnws7qtNJE=; b=GtqXvU4D6DJCzF6JF8U3eofQEsnffnIhRXCoPEeOTV3qAbShFRnjZlQHTiruq5jcjzGJfJ B322AIOzhVkXjLhuSj1YJM/Ovebs/EJGS3BfBh9Aea+WwEq9hFiA4W8Q4nwdz5R+ysZ7Iq VKlBMtHJZIC3i/f40IG91UaqM408ftnnoAJMvPMZaNl/Q1iJBwKQgnO29mAsJbPGmlEXkC pVhKNFvPPnGnMf1jJpAUPj2sPwJsG/MVB2US4U5CDINdQefLZuNKxsSGZnE9n1fx0ChYV7 VIJIvDavOo3W+uRm2qX4Pzq6uMgeooYXFC622i1WnfJtAsCZRSHBy3/mW5Br9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737659064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mObXD3L6D5xm94hkRtjjQI769hJMmFM3lAnws7qtNJE=; b=NV/KE2kqPptWJemwAzCv+e1MqruK56Nrui6kJKcJjeXMsONYub4QrstpJLTZrR40sworvq AFyJ3TRTxGD4lwrfUpFPwWEloAvrDzGRewGwtcTB514+qrxXuPh03aVYAs/CNEyd0rmh5p KJ96gNeYAr6aKQK3leMpLNvjyVa7uKPWT4K4eSbHmlv0DPgU6/elgGeeK6kSvU6OmuRbC6 fPMz2dmw8E6mMA5gqTPKaMrcHX/sNMjVL4YFstNdnheSgy0V7/D6rtRxuEh9dRdKbStevB 1GgnJWEV/p34CT2A+Ht0yjp5zi1W8WIE/2olaUmPsykaZjJgvVPwUWYwTolHhg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737659064; a=rsa-sha256; cv=none; b=RPSTPU28FVk1VyRlfxvRO08ad27+x4PK1JI6Qm3rcVEn6oNr+cCo4tVZIxdpWgKEoEHXrz vh+ztdry95/jZfJL8aLN0GQ2z8aUPnI4YYeyFUw3tPVO/RxL1aAALln54Rt/CJtkSOMdnx CHEB4dTzPSBV3Ga4yx9O3bVz7AIuzD8hEuX/VIkSi7NvKjS0qSj3VXITTU/wcDlru/kyib DBRuiiQ8Z10bvkGtdjk0oLWk+Nfhc+JApTCEEjZh8Ju6I9YcXri9xXjnz8VMUaaQ8Whzey 5gt96pcO8UtKxiwK7Yoo3K2697hvhUk4RreeRx2ayiruSCohgJEDDy26sUt+Kw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf9NS4SwNzs4j; Thu, 23 Jan 2025 19:04: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 50NJ4OAS010025; Thu, 23 Jan 2025 19:04:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NJ4OaC010022; Thu, 23 Jan 2025 19:04:24 GMT (envelope-from git) Date: Thu, 23 Jan 2025 19:04:24 GMT Message-Id: <202501231904.50NJ4OaC010022@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: 2f8a6bb08744 - main - divert tests: Stop skipping ipdivert_ip6_output_remote_success 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: 2f8a6bb0874490bec20f383edeac4c304913eea2 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2f8a6bb0874490bec20f383edeac4c304913eea2 commit 2f8a6bb0874490bec20f383edeac4c304913eea2 Author: Mark Johnston AuthorDate: 2025-01-23 19:03:29 +0000 Commit: Mark Johnston CommitDate: 2025-01-23 19:03:29 +0000 divert tests: Stop skipping ipdivert_ip6_output_remote_success It passes after commit ce52baebd3b3 ("icmp6: Fix ICMP6 message type counters"). PR: 279975 Sponsored by: Klara, Inc. --- tests/sys/netinet6/divert.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/sys/netinet6/divert.sh b/tests/sys/netinet6/divert.sh index 3517c0f1777f..788f539dfe9a 100755 --- a/tests/sys/netinet6/divert.sh +++ b/tests/sys/netinet6/divert.sh @@ -45,11 +45,6 @@ ipdivert_ip6_output_remote_success_head() { } ipdivert_ip6_output_remote_success_body() { - - if [ "$(atf_config_get ci false)" = "true" ]; then - atf_skip "https://bugs.freebsd.org/279975" - fi - ids=65530 id=`printf "%x" ${ids}` if [ $$ -gt 65535 ]; then From nobody Thu Jan 23 19:10:07 2025 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 4Yf9W40nMzz5lLs3; Thu, 23 Jan 2025 19:10: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 4Yf9W407gnz4Q96; Thu, 23 Jan 2025 19:10:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737659408; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OfeSh10JeliURMk1jAIULrO5+QZBgzEhj9MrUCr1bos=; b=ZhTCiO2RYK6L9/DFH5TppMi+ttnURQmkjWR/lv/Z+iOspRhCpJpY/hjReYRQnf+IFLAzNM QVibDhjk4Ducn79uGBcvIo3Q3NkSu2898eOL+ZkakJwmOIXf7ZNAqz7GxoeJ+nL9hne/fB Vx27vjgA4MVpDGwwOLrns27GUww1mroCgc41TPc58aUrU5MxwLUxMA4sCJ9pENgAoDcrag 071lystVoh/0ddQfdLFNGLR2ogQyuv9Esh61MDkgi2TCtTzi6i9QDOx7Ho/un+tHQQXEMi TAGJ50eOOQgtNG/OSme/3s8Op0lpA/oZJ1gI7EaEmd4MC5tpxGwB6eDkVXE9hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737659408; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OfeSh10JeliURMk1jAIULrO5+QZBgzEhj9MrUCr1bos=; b=SFEgZB/Zc0mgw2oyNfpk3RUXzYJfAfvvZ+KMfQIsAFTSNrlzZ1W8ow1YnEiedz8ZqsXmb2 3Ee2OZZq0EeXYPVv8RrIrWb3DnHn0rFPXG6Ru/Vo3mRmQZkE9TocZDi0lAmw0+YBfpIX/E TgxxQzekeT8CZkyeUjmYWJogDKWI4aHic+gzkRUeH0B3C3+7kqjNj2I+vFdRAV3ph3xcav tdxKOVeVYaHQlpyO2tN0fEhWlc9X6hhr5TvCw5GSDUaDNvdxhSn/sves67ieF9ojjhySl5 9YTtYBE2fW/5Jb4EmGjYSui3zylWwjwQss0hgZyeQ2pix7eDvAwwywLMvPt8jg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737659408; a=rsa-sha256; cv=none; b=l9fLkWB6FFAhF2/4fBvzMzzcnbJebuAcdls6qMTFO6VjO2VM057b9s0fHANq47JNQxGQpX yGeVZ1QszNXiesvfkytyPgAapGUhOzL/aBjXpawOAO/647JkRrrId3MU3ySEr+RImGyHBK bj+THvvDhVmLoN+lHmhwoI0Hsp4MA6fx3yRDSbScAvECu5wdVcSbkx0s20nRndUIXNEOwX rtoDXSZECfVkH7ZJ32QsN02V8QAg8OtB3GP29wPm5tLXVYai7OiR+x7Ui0+77HHvKdgRm1 XX3TgBuuv8ljTQdL4HNcryyh047eidv92O7iRWtVQ8hp244jpGw81L9yxoS2Ng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf9W36jp0zrbX; Thu, 23 Jan 2025 19:10: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 50NJA7Ik015174; Thu, 23 Jan 2025 19:10:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NJA7c0015167; Thu, 23 Jan 2025 19:10:07 GMT (envelope-from git) Date: Thu, 23 Jan 2025 19:10:07 GMT Message-Id: <202501231910.50NJA7c0015167@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: ba9cff7aa2eb - main - dtrace: Use size_t instead of uintptr_t to represent buffer offsets 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: ba9cff7aa2eb62d84bead503cd606d1586ea8388 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ba9cff7aa2eb62d84bead503cd606d1586ea8388 commit ba9cff7aa2eb62d84bead503cd606d1586ea8388 Author: Mark Johnston AuthorDate: 2025-01-23 19:08:46 +0000 Commit: Mark Johnston CommitDate: 2025-01-23 19:08:46 +0000 dtrace: Use size_t instead of uintptr_t to represent buffer offsets This eases porting of DTrace to CHERI, where uintptr_t and size_t aren't interchangeable. No functional change intended. Reviewed by: Domagoj Stolfa MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D48625 --- .../contrib/opensolaris/uts/common/dtrace/dtrace.c | 19 +++++++++---------- .../contrib/opensolaris/uts/common/sys/dtrace_impl.h | 6 +++--- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index 5f635cc088d7..608bff1d23ae 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -472,7 +472,7 @@ static kmutex_t dtrace_errlock; #define DT_MASK_LO 0x00000000FFFFFFFFULL #define DTRACE_STORE(type, tomax, offset, what) \ - *((type *)((uintptr_t)(tomax) + (uintptr_t)offset)) = (type)(what); + *((type *)((uintptr_t)(tomax) + (size_t)offset)) = (type)(what); #if !defined(__x86) && !defined(__aarch64__) #define DTRACE_ALIGNCHECK(addr, size, flags) \ @@ -601,7 +601,7 @@ static uint64_t dtrace_helper(int, dtrace_mstate_t *, static dtrace_helpers_t *dtrace_helpers_create(proc_t *); static void dtrace_buffer_drop(dtrace_buffer_t *); static int dtrace_buffer_consumed(dtrace_buffer_t *, hrtime_t when); -static intptr_t dtrace_buffer_reserve(dtrace_buffer_t *, size_t, size_t, +static ssize_t dtrace_buffer_reserve(dtrace_buffer_t *, size_t, size_t, dtrace_state_t *, dtrace_mstate_t *); static int dtrace_state_option(dtrace_state_t *, dtrace_optid_t, dtrace_optval_t); @@ -2548,7 +2548,7 @@ dtrace_aggregate(dtrace_aggregation_t *agg, dtrace_buffer_t *dbuf, caddr_t tomax, data, kdata; dtrace_actkind_t action; dtrace_action_t *act; - uintptr_t offs; + size_t offs; if (buf == NULL) return; @@ -2843,7 +2843,7 @@ dtrace_speculation_commit(dtrace_state_t *state, processorid_t cpu, dtrace_buffer_t *src, *dest; uintptr_t daddr, saddr, dlimit, slimit; dtrace_speculation_state_t curstate, new = 0; - intptr_t offs; + ssize_t offs; uint64_t timestamp; if (which == 0) @@ -6910,7 +6910,6 @@ dtrace_action_breakpoint(dtrace_ecb_t *ecb) char c[DTRACE_FULLNAMELEN + 80], *str; char *msg = "dtrace: breakpoint action at probe "; char *ecbmsg = " (ecb "; - uintptr_t mask = (0xf << (sizeof (uintptr_t) * NBBY / 4)); uintptr_t val = (uintptr_t)ecb; int shift = (sizeof (uintptr_t) * NBBY) - 4, i = 0; @@ -6951,9 +6950,9 @@ dtrace_action_breakpoint(dtrace_ecb_t *ecb) c[i++] = *ecbmsg++; while (shift >= 0) { - mask = (uintptr_t)0xf << shift; + size_t mask = (size_t)0xf << shift; - if (val >= ((uintptr_t)1 << shift)) + if (val >= ((size_t)1 << shift)) c[i++] = "0123456789abcdef"[(val & mask) >> shift]; shift -= 4; } @@ -8038,7 +8037,7 @@ dtrace_hash_str(const char *p) } static dtrace_hash_t * -dtrace_hash_create(uintptr_t stroffs, uintptr_t nextoffs, uintptr_t prevoffs) +dtrace_hash_create(size_t stroffs, size_t nextoffs, size_t prevoffs) { dtrace_hash_t *hash = kmem_zalloc(sizeof (dtrace_hash_t), KM_SLEEP); @@ -12316,11 +12315,11 @@ dtrace_buffer_drop(dtrace_buffer_t *buf) * mstate. Returns the new offset in the buffer, or a negative value if an * error has occurred. */ -static intptr_t +static ssize_t dtrace_buffer_reserve(dtrace_buffer_t *buf, size_t needed, size_t align, dtrace_state_t *state, dtrace_mstate_t *mstate) { - intptr_t offs = buf->dtb_offset, soffs; + ssize_t offs = buf->dtb_offset, soffs; intptr_t woffs; caddr_t tomax; size_t total; diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h index cfb97c71f262..222f8e206da1 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h @@ -149,9 +149,9 @@ typedef struct dtrace_hash { int dth_size; /* size of hash table */ int dth_mask; /* mask to index into table */ int dth_nbuckets; /* total number of buckets */ - uintptr_t dth_nextoffs; /* offset of next in probe */ - uintptr_t dth_prevoffs; /* offset of prev in probe */ - uintptr_t dth_stroffs; /* offset of str in probe */ + size_t dth_nextoffs; /* offset of next in probe */ + size_t dth_prevoffs; /* offset of prev in probe */ + size_t dth_stroffs; /* offset of str in probe */ } dtrace_hash_t; /* From nobody Thu Jan 23 19:10:08 2025 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 4Yf9W51P4Cz5lLvR; Thu, 23 Jan 2025 19:10: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 4Yf9W50m67z4Q97; Thu, 23 Jan 2025 19:10:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737659409; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+7BkBZS3w901IwD4ueL2lVLuPYS0oHA5ajdcUQOeQHQ=; b=sRaNLK4hu2nrVdEY1zecX2ZxL8ydYwhgdp6Lqfm5/VwzuiKRyiqXLWmYVa3z5QhqYHJnYb yyUtU7O1h8a7cb6SpSsQfzUyKwKsAjHynpIG0/JrhzJGaUUWro6YiYJhrdtUOraL2J1npa lkTigmVjENDFU+/NgHVqyIGLH2UVMFNTx4mUPnDyH2tocOea33QdIqt/4U+gxD6iEaA86B NBFEZ7roL4+NkZKV+RRVitlMLzybWkUni18KW0ghZPs8viiYj4uizEDctYVngYNn+a0lY1 idqllfjo7t5TqximTNtwIpxLSnKuiBUIs0tyymW/C3hGOV0j0TqGdnoT1OVheA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737659409; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+7BkBZS3w901IwD4ueL2lVLuPYS0oHA5ajdcUQOeQHQ=; b=yJuYDSWsUQvv3kj0JrwFdrY0tmhNp8YzS2ty0OWjUMusbf4OJ4R5Jznpl/LRYpPPCXWd7q qcXb/4Xx65PnYT4Z4TDB1YB7OvA68rG6OisyNNPG1S2m+3xh4oj+xXoyiwoq/HX79nyUiV l5THfo3hMInPZbmXsWud1m+hQDeRdhVjwue3wf71YKfEQ+ZezNCe2n4pwe6aMnn4rs+sYn 02BxzjA0ZJzU1qiNYRsWhL+mn512Z1p/YiMCq1UiT2RIV2XTohjXNzrGcCvTZKuMTh/NZ4 bc6bNv0KY16rwbZvO9xa/NyMymyvBC6xwYOUlfMMrcj1By5P/pavyPVK+c4cPQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737659409; a=rsa-sha256; cv=none; b=xJZATw2+k7gdi5JvVs6aFBDwcM4UpwQsuglKm5lm/wLSueU1Rexr2ULXh8KsTA9zdNZf96 bMwvtquQLTh6twoJyg6GOiq9JrIMmebfVijYJ+xc4rA5GIjiv/706SbUPs+AcxPu00fKqx yavjGIYpLpD5Ws797HO3fZ3+UFeLy3qxLlS08+JU17Xz9WFHgm4HFG0reAA0VLhp33tEpQ 8P8x3nNQ+UWA6XOB5Kjtm7DyyfNs5U4YVXfcvnUQT2Z/9aWIsJ4/ZnnSnRuDgKDHL4TsRZ wo2MwdH+r4QWLwz+viaRnRY2bzY/crETon0pHibu5E16j4d3IDjMrve4UG+xxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yf9W50MZ8zsJw; Thu, 23 Jan 2025 19:10: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 50NJA8bj015497; Thu, 23 Jan 2025 19:10:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NJA8QG015492; Thu, 23 Jan 2025 19:10:08 GMT (envelope-from git) Date: Thu, 23 Jan 2025 19:10:08 GMT Message-Id: <202501231910.50NJA8QG015492@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: fed08c59b7bf - main - dtrace tests: Fix the ATF config variable name 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: fed08c59b7bf2cb4d05bacadadde2dcef4dc6c46 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fed08c59b7bf2cb4d05bacadadde2dcef4dc6c46 commit fed08c59b7bf2cb4d05bacadadde2dcef4dc6c46 Author: Mark Johnston AuthorDate: 2025-01-23 19:09:56 +0000 Commit: Mark Johnston CommitDate: 2025-01-23 19:09:56 +0000 dtrace tests: Fix the ATF config variable name Fixes: 6e6a67e98652 ("dtrace tests: Avoid hard-coding paths to required programs") Sponsored by: Innovate UK --- cddl/usr.sbin/dtrace/tests/dtrace.test.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cddl/usr.sbin/dtrace/tests/dtrace.test.mk b/cddl/usr.sbin/dtrace/tests/dtrace.test.mk index da7c3a440be0..54e2aec68dcc 100644 --- a/cddl/usr.sbin/dtrace/tests/dtrace.test.mk +++ b/cddl/usr.sbin/dtrace/tests/dtrace.test.mk @@ -12,7 +12,7 @@ ${TESTGROUP}EXEPACKAGE= ${PACKAGE} TESTWRAPPER= t_dtrace_contrib ATF_TESTS_SH+= ${TESTWRAPPER} -TEST_METADATA.t_dtrace_contrib+= required_progs="ksh jq perl xmllint" +TEST_METADATA.t_dtrace_contrib+= required_programs="ksh jq perl xmllint" TEST_METADATA.t_dtrace_contrib+= required_user="root" GENTEST?= ${.CURDIR:H:H}/tools/gentest.sh From nobody Thu Jan 23 20:30:15 2025 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 4YfCHX1Xc9z5lRgX; Thu, 23 Jan 2025 20: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 4YfCHX0sM1z3LDC; Thu, 23 Jan 2025 20: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=1737664216; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fAXaEjEl0HSijU7L+RPIag4YguBx4yPqwl1hEsY4+cM=; b=UKnpYzEGJ55o0SdapLOuT84dDaAUjI7JS6YXbYJqgzyZmHBgpp/KOTKYEINN1k0sQg2aqK dUeTfHNHc1gO8g+J+8J425i8qgTGZgNYtTtKmem4iBARWdkXuFLiEJzrWMuqaOV7kVQrSY fWKnW4DQjxFJr/fkS2ATBuqdEzZyaIdEvmYYD7ooa8Wzw+2XwfmK80jWNDMPDxRpRzpiqQ /QKRXZpjALYex/T+eIlnIPGbm1GiTq8A1T6rjz6Vy57Y2xCfLi36xdW1OGgMKwhD3se0H9 7om+kmSJFJqmxLYBMGba1m09RpJ41ZgU4RiOzslf7+vFLOwL0hv4G3jAPPxJ/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737664216; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fAXaEjEl0HSijU7L+RPIag4YguBx4yPqwl1hEsY4+cM=; b=pHDQIXMFwMqa3rjTt6QjvYNKJRqrZLW2+2zIjKx3FojnGJ4w9Uv4YBUEbUHsYM7L+AHJvK c3Iw3ET0RGYoK/sN0ZicTUHHWFY0KWXfrT23qiTd61qhj2UC+jFZBtyCmKTvdsoEFMiqfo Dk/SkJI2owGHab0Rrf7uZm/yNCTVwvJ0GUOrR9JzEI44L592d40AwzMSZh8ArodIPysT6t /vDGu40cGfpzmSRnyMFa4It1KhjbAgnKptwAegwKBPgzdOMsllSwj9wggmeAIhpJnsWTbI NTx4qrAISw9CM+Z4fUJIpTclF6DaZMF5eXQSVt4HjKbAt5uUwuomsphC5DpRfA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737664216; a=rsa-sha256; cv=none; b=uFh832x65mG4ogCs+XwhBhorFV1uQYVEsuIg34rH0sQ9Edh/6c4N2NlkUuWy91l51Afpco wmY/00mkyafvQR3hpWhlqC2wb79TZvTz+Tw31o+YY8b+GP+9Doj6rSOpIBO0AcVF7S3A8q TELUs77VI71DAqiitVBw4P3x5Pe5Qau50m3cHlei/BGiHNaulVK5P6FJS/Hog8J4yZbLDK 3uH+Pi+sMCY2bMFox9hqKjWwy6wDLONC/miSnM40RNmw8bjY+SGLFpFE36JLzlhrdllclA QIQbAun63uII/I5oI+/ghtNaPU/ZOQ2sRC3VJbtp6Xgch8C9Ho7JEqJyqjdAWw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfCHX0N63zvKW; Thu, 23 Jan 2025 20: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 50NKUFGP068718; Thu, 23 Jan 2025 20: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 50NKUFe9068709; Thu, 23 Jan 2025 20:30:15 GMT (envelope-from git) Date: Thu, 23 Jan 2025 20:30:15 GMT Message-Id: <202501232030.50NKUFe9068709@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Joseph Mingrone Subject: git: 6651a75af260 - main - ObsoleteFiles.inc: Remove bogus entries 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: jrm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6651a75af260a1c57b787a8146266de4cecd70cf Auto-Submitted: auto-generated The branch main has been updated by jrm: URL: https://cgit.FreeBSD.org/src/commit/?id=6651a75af260a1c57b787a8146266de4cecd70cf commit 6651a75af260a1c57b787a8146266de4cecd70cf Author: Joseph Mingrone AuthorDate: 2025-01-23 20:19:43 +0000 Commit: Joseph Mingrone CommitDate: 2025-01-23 20:27:54 +0000 ObsoleteFiles.inc: Remove bogus entries Reviewed by: emaste --- ObsoleteFiles.inc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index eea25cc2e489..b406c3e281f1 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -754,11 +754,6 @@ OLD_FILES+=usr/tests/sys/netpfil/pf/divapp # 20240930: libmd bumped to version 7 OLD_LIBS+=lib/libmd.so.6 -# 20240914 libpcap upgrade from 1.10.4 to 1.10.5 -OLD_FILES+=contrib/libpcap/pcap-haiku.cpp -OLD_FILES+=contrib/libpcap/pcap-rpcap-int.h -OLD_FILES+=contrib/libpcap/pcap-usb-linux-common.c - # 20240827: retire fips.so OLD_LIBS+=usr/lib/ossl-modules/fips.so From nobody Thu Jan 23 20:31:03 2025 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 4YfCJR49dNz5lRb0; Thu, 23 Jan 2025 20:31: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 4YfCJR3XbKz3LlB; Thu, 23 Jan 2025 20:31:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737664263; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Xlf07Wg1hVc0E3lk5C1LavsUACzww8fwVbP7U3cwzbE=; b=BJ4JPfDyl8Oavr4KQExtqvMAh/7aWPgkJA/b4ZXek4jlP3SD1vViZ3sy1ZQqfipg/pvtBL WovKOxxYJNNPXY+dDllJ3dP7MufwUov0fYFtEY3PruTIHzwSOThs4fQaBt4HZ6+o+9TA+Z WNnInArgCKAOpfwsyYBTXPjdQMndbEgqewqYXHn6Vjr2d2LP6HPlQxE235gKkYzPq3tglp kYlxqWrccBp5DZgEFaEs3asLaVM6c0nsVJbdRn8sjNZqYhHWZoH9CDBb9T2YZ9BO0U4s3y np0/BrFnQcvfmP4QePTvMNwpKRhZDQyHorssmoDv3GPXM9RxzI3oAnK8EOc9AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737664263; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Xlf07Wg1hVc0E3lk5C1LavsUACzww8fwVbP7U3cwzbE=; b=Mh85EzhpaH92zNuxGiv+tRl+OtLcW9lZeW2tm1cy8FyHT/c8ny24qNFo+hmdyFBFZy6+FM HL21d2gaJiqjyWoA5BLGROmpBa0zPUFiLLyrcTN7Pxvtp2YKYO5TckscZEJlhsp98VtVWt JznsMw4y1GpV/h//QzRpI/FUlX9pgTAh6ff0Mn0C5ULZ35YKzEhgVO0s0iBCUKLORbbB2b g5TFtjLLZfNll/J41wq18Q4TxRu+ibz9e7Nws/6Z4xqKwSeJ/AdvbE/qJgVfqftaNMh5Vp v+Nd4ivhFvdKOPGxbMut7f2/XsNJ8fUKI457Kn5VesjQQOgSFT2YcwhSSqdAqw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737664263; a=rsa-sha256; cv=none; b=Sy3FJBO8uhTc1C/lGWQxddw/v6cW9ZGzhBCnv/HwEC4evpnThtim1Ab8ZXlp4IIviC69na SLyTwe8Zqu78AxO8lZM4snlqVTbddbjFOIOgD5W7GKJ2d6MQgT1FeLwe05uGYHPD3rE1NV WQByj653BsaSdOuK3w1TOJSiB4KGXepRr0lGWr1tMnmQwvEuQddIX4abj9VxbJ3hZfqQ6h SXfqOB0Kx1C7zhIVt8zufEbyi9vPI0CIuirumYh6upvb18YE4USJvdopvskE89XBcC3un/ DRkBZX0vQRAI4nbsmXHmsXokzbukyIshc3zkX7LJtafbRXw1+TH/RaxmOoHONQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfCJR381Zzthy; Thu, 23 Jan 2025 20:31: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 50NKV3WQ074253; Thu, 23 Jan 2025 20:31:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NKV3JJ074250; Thu, 23 Jan 2025 20:31:03 GMT (envelope-from git) Date: Thu, 23 Jan 2025 20:31:03 GMT Message-Id: <202501232031.50NKV3JJ074250@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: 5884fab46153 - main - pci: cleanup __PCI_REROUTE_INTERRUPTS 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: 5884fab46153dee52bda660bcabca95c3cc97f44 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=5884fab46153dee52bda660bcabca95c3cc97f44 commit 5884fab46153dee52bda660bcabca95c3cc97f44 Author: Mitchell Horne AuthorDate: 2025-01-20 15:51:27 +0000 Commit: Mitchell Horne CommitDate: 2025-01-23 20:30:31 +0000 pci: cleanup __PCI_REROUTE_INTERRUPTS This flag was used as a transition for differing pcib implementations. Today it is defined for all supported architectures, and can be removed. Reviewed by: imp, jhb Differential Revision: https://reviews.freebsd.org/D48485 --- sys/amd64/include/param.h | 1 - sys/arm/include/param.h | 2 -- sys/arm64/include/param.h | 2 -- sys/dev/pci/pci.c | 4 ---- sys/i386/include/param.h | 1 - sys/powerpc/include/param.h | 3 --- sys/riscv/include/param.h | 2 -- 7 files changed, 15 deletions(-) diff --git a/sys/amd64/include/param.h b/sys/amd64/include/param.h index 371128c6fe20..86f96ef15832 100644 --- a/sys/amd64/include/param.h +++ b/sys/amd64/include/param.h @@ -48,7 +48,6 @@ */ #define __HAVE_ACPI -#define __PCI_REROUTE_INTERRUPT #ifndef MACHINE #define MACHINE "amd64" diff --git a/sys/arm/include/param.h b/sys/arm/include/param.h index 03131ebcb436..14cd32631a5f 100644 --- a/sys/arm/include/param.h +++ b/sys/arm/include/param.h @@ -49,8 +49,6 @@ #define STACKALIGNBYTES (8 - 1) #define STACKALIGN(p) ((u_int)(p) & ~STACKALIGNBYTES) -#define __PCI_REROUTE_INTERRUPT - #ifndef MACHINE #define MACHINE "arm" #endif diff --git a/sys/arm64/include/param.h b/sys/arm64/include/param.h index c3f6990db79b..753035b7775e 100644 --- a/sys/arm64/include/param.h +++ b/sys/arm64/include/param.h @@ -43,8 +43,6 @@ #define STACKALIGNBYTES (16 - 1) #define STACKALIGN(p) ((uint64_t)(p) & ~STACKALIGNBYTES) -#define __PCI_REROUTE_INTERRUPT - #ifndef MACHINE #define MACHINE "arm64" #endif diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 0b02d873c5a1..30a95298a114 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -4094,7 +4094,6 @@ pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask) pci_add_map(bus, dev, q->arg1, rl, force, 0); if (cfg->intpin > 0 && PCI_INTERRUPT_VALID(cfg->intline)) { -#ifdef __PCI_REROUTE_INTERRUPT /* * Try to re-route interrupts. Sometimes the BIOS or * firmware may leave bogus values in these registers. @@ -4102,9 +4101,6 @@ pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask) * have. */ pci_assign_interrupt(bus, dev, 1); -#else - pci_assign_interrupt(bus, dev, 0); -#endif } if (pci_usb_takeover && pci_get_class(dev) == PCIC_SERIALBUS && diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h index 79b6eee9db69..177b4d9a168b 100644 --- a/sys/i386/include/param.h +++ b/sys/i386/include/param.h @@ -43,7 +43,6 @@ #define __HAVE_ACPI #define __HAVE_PIR -#define __PCI_REROUTE_INTERRUPT #ifndef MACHINE #define MACHINE "i386" diff --git a/sys/powerpc/include/param.h b/sys/powerpc/include/param.h index b40ada24ad11..e79e92f76ec2 100644 --- a/sys/powerpc/include/param.h +++ b/sys/powerpc/include/param.h @@ -46,9 +46,6 @@ #include -/* Needed to display interrupts on OFW PCI */ -#define __PCI_REROUTE_INTERRUPT - #ifndef MACHINE #define MACHINE "powerpc" #endif diff --git a/sys/riscv/include/param.h b/sys/riscv/include/param.h index ca9c91f3f981..32b0c7a1e34b 100644 --- a/sys/riscv/include/param.h +++ b/sys/riscv/include/param.h @@ -39,8 +39,6 @@ #define STACKALIGNBYTES (16 - 1) #define STACKALIGN(p) ((uint64_t)(p) & ~STACKALIGNBYTES) -#define __PCI_REROUTE_INTERRUPT - #ifndef MACHINE #define MACHINE "riscv" #endif From nobody Thu Jan 23 20:31:04 2025 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 4YfCJS5BMbz5lRb1; Thu, 23 Jan 2025 20:31: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 4YfCJS4CkCz3Lfg; Thu, 23 Jan 2025 20:31:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737664264; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jRiO5AdPzbrREgevqfOcpQBTFIg7glYuIyVPUkzLI7M=; b=wMKW0iuSq9KPnc1QvUgWOv9unOdi5gSeRPhu7E25D+CPjCSyuEYKFBp9tRpWLZFLFpWN4j VQs+puNX/aQGqaovEZolxLX/pACn+55+38syho7TYug5r5Ann3FxrtUGJs3zjsUxorO2qY 75lUevcw84+1Ogk85Bjva/m//w9ZndFJqAgke0SMq/Wo7iM2gMkF/q53wNHycmgiu3jpYj YAS2jv/cJqMejv77VLHmra9Jp4+NvXZTv5P3JfRcJ/b8q4h8Iv+hXowKqgojQpzZTry9r0 vKPntXYv9PuJ3Qr2Cvc8TWf9nTKbOvnA8a362PtRe4AQuP2gB6BaO5yRPhvyOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737664264; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jRiO5AdPzbrREgevqfOcpQBTFIg7glYuIyVPUkzLI7M=; b=XP115Zm8PVTWL0XpQtRn7kq30mFEGYTgMfZiO4n+W80hBORDN8XdZ6+DEnvHbMrc/2Vric RdB0+xgAXtrv/tzNsj8C6yxH1AEfXvu7FFmU10n225FfuJfFUvb7xezBkbG17/m2zUV0eh nlR3BA1QrCqK6iJUNFc61i1NPQ8+tVOJuYraV3+hyhXHH0S7zNIlNt7BTUD8nB9FOw1OP8 8VNwynQJuH1ktifeux2pHYCtirf96KGk7s9cdtLVgAVBvg2TaSs37QvAdMREionlb2OMeZ ewKDWlD1LXbNW/39h8vkQJaDS5PmZJCpQq9tXlCfm7MolLSGAsN1AWKwNaTNkA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737664264; a=rsa-sha256; cv=none; b=uGa3gsjNx+pMT4S2dHZJy7je0jCSXjutKOvwrSMlP6yZ07V+bOF0ZQ4NoCudaY4pX4itYg fk0Gs7i7m5HfmWRK82W/3o0H/yjIbomRJYcQKqdTKYpoElRE6DE5Bsix6eZH4QJGru/Xt9 qKOUrolzp5T5nTxtFnrV07n0Ag3H7uC24sQJojg45oz2H68YP801QOkn5K8OW0UXxdUPOD wwecbatbHjSEtM04hT4yhmfqfxmP6RVqz8KeawIb21GEqc4cUuoUm5o/BAd1pRJ4dcLig0 T70TNzaBpOdVc8TOaSBPoLqyBRcqKybjPN/W5aN8kLi8h8JuejZ0tctz8X9OGA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfCJS3n7qzvKc; Thu, 23 Jan 2025 20:31: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 50NKV4s2074292; Thu, 23 Jan 2025 20:31:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NKV4dF074289; Thu, 23 Jan 2025 20:31:04 GMT (envelope-from git) Date: Thu, 23 Jan 2025 20:31:04 GMT Message-Id: <202501232031.50NKV4dF074289@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: 44bd0e89a1c4 - main - machine/param.h: drop __HAVE_ACPI define 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: 44bd0e89a1c47c02639f3b2b6b9c7a5ca3aa84be Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=44bd0e89a1c47c02639f3b2b6b9c7a5ca3aa84be commit 44bd0e89a1c47c02639f3b2b6b9c7a5ca3aa84be Author: Mitchell Horne AuthorDate: 2025-01-23 20:26:27 +0000 Commit: Mitchell Horne CommitDate: 2025-01-23 20:30:31 +0000 machine/param.h: drop __HAVE_ACPI define It is no longer used anywhere (since 62508c531e0f), and not defined for arm64 which also supports ACPI. Reviewed by: imp, jhb Differential Revision: https://reviews.freebsd.org/D48486 --- sys/amd64/include/param.h | 2 -- sys/i386/include/param.h | 1 - 2 files changed, 3 deletions(-) diff --git a/sys/amd64/include/param.h b/sys/amd64/include/param.h index 86f96ef15832..8db314fa034d 100644 --- a/sys/amd64/include/param.h +++ b/sys/amd64/include/param.h @@ -47,8 +47,6 @@ * Machine dependent constants for AMD64. */ -#define __HAVE_ACPI - #ifndef MACHINE #define MACHINE "amd64" #endif diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h index 177b4d9a168b..657dbcd879bd 100644 --- a/sys/i386/include/param.h +++ b/sys/i386/include/param.h @@ -41,7 +41,6 @@ * Machine dependent constants for Intel 386. */ -#define __HAVE_ACPI #define __HAVE_PIR #ifndef MACHINE From nobody Thu Jan 23 20:31:05 2025 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 4YfCJV0h2Qz5lRjy; Thu, 23 Jan 2025 20:31: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 4YfCJT5KHcz3LnV; Thu, 23 Jan 2025 20:31:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737664265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2Z0wZmh9MEHdsal9sqdmQlQTXdQboItR2l+66xWT7fg=; b=FcQ12vJa8MflawsvmIF6o6CzludCECMrCVIqaJKBrXVXh1aULACWGD6T24O+7cJ3erFRwI VgZFkKG9/oHQaF26QPVN2xAgTOBM0YEcAoAoeYAqOKGDYb+YfUe2FoSR/3ducDLTGrl7L7 pi0hjxyrZcRtnNhpB4ckf0XAuq99sAvmUVgSkS4fnREpfD5tV8w4TzRJKMVbPDpCGqZdH1 bxVFlBLTgZfLEyretl54m/yk0iHYis17nlCLUHNqDT502rk7XWI0shoB954oCLVUm8RWjP WlORCHBDChtiYWR1CAEaB3g0MjCtGA+tU+YcaGAnPUtpmz5XjoXzhb5Evk229g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737664265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2Z0wZmh9MEHdsal9sqdmQlQTXdQboItR2l+66xWT7fg=; b=a16wu/2Zj/DpZkNF7vktgaCob0NqEl952oQdDUlG/k5Q/Ik/K4loSOLMlEv8okwexaBXAj YZDTuS28CVZlwRZbBKpIp4/e8v4rJTCAivlyZI0CG1JwDi525OwXoVgIVBZDhr36GlN+KP GTf22mV0NBwL1MM0KHYASLtcPLcAQdpuf2omjOQqqc6MiPhGe5ILDmI0lS4LvExE6jmtAC 1qfQ4Sf0zaVt3zlIrf15HQcMyCQDeHWHg01BP7TW9s9nXJd1syfcn9h8GMRWHn6vVRH/Et +EXdx9qR3+WVhn2JiOaU+0dMYinyUYYn758/3X9dwM/dFtQy8YEROdh2IAfVzA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737664265; a=rsa-sha256; cv=none; b=dsHHtjxqssupuzSkCUiZj0iZqbeKM1b4TkWD2vynJ199VeMchZD8SSe6QgYSWnrBdXbAHD 2Tz3QoByAzen5VkiCbkYKlM4rPMoOY3KUv/DeXCImJDzGzQH+rtKignKbYotPDQbEQ4fq6 2J/3lIzhOJBtRXYBijBUB6ZrdPmHC/b1IY4+vMqmqMae7N4YXkL0EpFyKNwZQk4CuA5XSD E3Q2KNAMtjy61CSmWLQ54HUdKSzQcoI7ssu6GEqD8mOKNRCwcPyK3eiluo0dTvohnV7JdQ c1jhCqiiMQ6yzslc2U/85KlG8zxHxjf1vYIKrqIQCLVO5mPpZL2gPvT7jwXZrQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfCJT4kjQzvKd; Thu, 23 Jan 2025 20:31: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 50NKV5ee074326; Thu, 23 Jan 2025 20:31:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NKV5tA074323; Thu, 23 Jan 2025 20:31:05 GMT (envelope-from git) Date: Thu, 23 Jan 2025 20:31:05 GMT Message-Id: <202501232031.50NKV5tA074323@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: f52902fdcf66 - main - bus.h: remove deprecated struct 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f52902fdcf669a95fbd3b30591e2e2a82420ddce Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=f52902fdcf669a95fbd3b30591e2e2a82420ddce commit f52902fdcf669a95fbd3b30591e2e2a82420ddce Author: Mitchell Horne AuthorDate: 2025-01-23 20:28:33 +0000 Commit: Mitchell Horne CommitDate: 2025-01-23 20:30:31 +0000 bus.h: remove deprecated struct driver Unused, and deprecated in 2003. Reviewed by: imp, jhb Differential Revision: https://reviews.freebsd.org/D48487 --- sys/sys/bus.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sys/sys/bus.h b/sys/sys/bus.h index 01031ae3ef28..14c9c3e8473f 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -308,16 +308,6 @@ enum cpu_sets { typedef int (*devop_t)(void); -/** - * @brief This structure is deprecated. - * - * Use the kobj(9) macro DEFINE_CLASS to - * declare classes which implement device drivers. - */ -struct driver { - KOBJ_CLASS_FIELDS; -}; - struct resource; /** From nobody Thu Jan 23 20:31:06 2025 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 4YfCJW0yCfz5lRdn; Thu, 23 Jan 2025 20: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 4YfCJV6jy7z3Lnh; Thu, 23 Jan 2025 20:31:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737664267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=M3a4eRwxJZZKe2STz7O5N7AGpOKWhgIqCrPP0TK3uf8=; b=HUVx4CZT6MRbko6ZmnRwWm8kOEQ1PxFWXM8BlCRzr6HBq3uBsCgKWElxWuhKNkIWjS4mci QTSEEqn9jCAL+J6ARKx1WDLG1xiCLIw70Ea458gmAn4qwlniLcN1alHIdI7g0eS1qDHSh0 pJSdTJXsXZKP2haXBR4iFzw/5Y3DLRLS0Ftx4Qp+xieWnH618GszjoJtYYgR1tWd8K7tWM 3QSyVfKBcPLabnflmOZljauevTotguNPSbJQlQFJlLBws+n0WbtoxFcZfWWd2ZIoH8RHFW Su7zKvHXFDOap5LfVV97McY8Ecwlk3lSEGVraPyFDeNmJJkiN9oW3vq/5JQQlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737664267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=M3a4eRwxJZZKe2STz7O5N7AGpOKWhgIqCrPP0TK3uf8=; b=Zz/8bZuDA6DAbeMnMIfhJ0HCXI7cjKj/98ZpPEA6ssdMn+wQMmmZeFuFxCJczqzIHBOFmo Z9jJ0g+yznXa7BMaddX3uT1J5pUrVerBlWz7UExH4zc+R949HnXI/g8M7SI6eMKGsY6fS1 eZXfYimaNgw2n02BiPvWp0XzdTrV6srMzjvaGTzNepZYnIQL2LZydPxD1DxEDue5cZRzMI oN/2eFilpt9TvSpQHdWrFtJ3NJzfeyl+N9pPqAZJKoNI8SAv8fRVRbCXU3DECe3nb2r7zB b5ccyrAUhsiYADgqAo77yTz1RAAje4qJXtJKCLBaA/jNLDJNPFkIpbd9tXw4Tg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737664267; a=rsa-sha256; cv=none; b=KMzvxB7h/RE6TZsVQusqWQ1PIPwPIdOV7j0xca4BSm/EIkISsxrUi6/cj+GpKw8TsTppI3 p3RSHCAJ2M8tCy09+Wf25iJSA5Fnj76xCJT1jCnrZsWWiOqyVcOdb9/5aDBwc7MW6oHGJl R+yknydWoyGjPCn49o/XNSW+vAVtn8Xym4TPQ1wRD0Oqre42q4KVlCbcoK8emRnF8XmCLp qlxKezoHo6l7jKNzuPf5YWSsL1I/CIENu9tuU0aL+HdhYg1ixXg+gqUZHb9kKgO0fdmBM/ cKKwEUAlGfr8lc2V59BXkeItob82AXElGRX64AludX02DwfplKR+v5i7bf7qgw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfCJV5cjdzv3x; Thu, 23 Jan 2025 20:31: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 50NKV6pT074359; Thu, 23 Jan 2025 20:31:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NKV6YY074356; Thu, 23 Jan 2025 20:31:06 GMT (envelope-from git) Date: Thu, 23 Jan 2025 20:31:06 GMT Message-Id: <202501232031.50NKV6YY074356@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: 5ec5d08489ba - main - bus.h: remove unused devop_t typedef 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: 5ec5d08489ba557f4f5868330c5ec3aa1f612236 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=5ec5d08489ba557f4f5868330c5ec3aa1f612236 commit 5ec5d08489ba557f4f5868330c5ec3aa1f612236 Author: Mitchell Horne AuthorDate: 2025-01-23 20:29:15 +0000 Commit: Mitchell Horne CommitDate: 2025-01-23 20:30:31 +0000 bus.h: remove unused devop_t typedef Reviewed by: imp, jhb Differential Revision: https://reviews.freebsd.org/D48488 --- sys/sys/bus.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/sys/bus.h b/sys/sys/bus.h index 14c9c3e8473f..067868da4367 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -306,8 +306,6 @@ enum cpu_sets { INTR_CPUS }; -typedef int (*devop_t)(void); - struct resource; /** From nobody Thu Jan 23 20:31:07 2025 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 4YfCJX2lPyz5lRb5; Thu, 23 Jan 2025 20: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 4YfCJW6km3z3Lnl; Thu, 23 Jan 2025 20: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=1737664268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IzmwQMYmthe4wef2Y1LnoXlClutdTnwBu+T7GXly1iM=; b=Dfu3JUACLn+5sjS0KhsoaKv745XXL7/W1a2KhrZAjY9b8PcR/8m2X8Q/y1S6XNpy1l5XOg XZ8fH/jBtS6LR8Y4K8wDLKv0Hw1+Ss8RD+HFKBGUb45ZFvmMp7YrRt9v7z6qAEcefFK5Zk 64MMUzaf2GvX0TyJ/E3rs5XvTJg9d+rfHlgwLrUNsAmu6KPVTOt1h3OmDJmYD3lLjhf51/ NiKpBAEjS0Q/8pDNwS/V4SZ5I1JW1qi40sUO4K6SHmp3bRvopJ6zwSjmVgqyj1ht7vsTl3 cZM6bYR94ItFBX8Anaqrx2lv5yJcmf/zO28p0x3YKFf3ugsFtQWj287IJoiPIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737664268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IzmwQMYmthe4wef2Y1LnoXlClutdTnwBu+T7GXly1iM=; b=riRdoFw9KSfCnkfBYFNHIWQHQRCAD9Xp9gqt7Gi++3AcF7ETtxYOt8YHHqc+N14gOTQaUW KBYrTH8KGzzvcVxPOc/lpgpd6tbNJiDE9EqBhjF2LHwEu3zGcAQoakqohrslln6AOuTJ9E bbr9L4aQRtOaf7wz2ud9M82hQc3f7t6gYxgT5lvRec1X/+DoxhC7B1Vmgh9xJTpZrXGCs+ 5T110aurjjYBKgiXjBkLlINBvgRy09it4hxXK3g5l4XWpRcwZ7Wyqx6q0LtBXKDB3iqbli hhThlVq84f/2KArA/Kzwp5sdY/F3t3shZjq9cKLMjf5oWNSoQ7a5RJ8CY8KPyg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737664268; a=rsa-sha256; cv=none; b=H2ldygKbUChIykCHlFo4HiE36BL+fLWA6gGDSQ4XZZEaMNWExQ1IrhjBU4xysa9iQN/sKc VF2vgQXH4aU9CQ7IBj3DROdiDLpyrmjhvmCHhrUZoAmm1CIyqGjVJ128zgSmPCP1g/7uQg VFFo4gBDThSI7YF1hz1I9NZOq1rzQg9tNpgnYPA5iauHFlKOOVuQvoj1NrXna5R+ucqUsm RwD6e9xnJVcshP2tGzoen2VyFu50rYTwN40rFUB8vucMUcH4Nvs5mLJ97ivoEW47izBUB6 9e7kvrP9iL5chyT7FslIpo2M0I51tirIAdp9w/A7CTGLcxDl0vUZONxRPutjWg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfCJW6Km9zvHG; Thu, 23 Jan 2025 20: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 50NKV7wu074392; Thu, 23 Jan 2025 20: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 50NKV7kl074389; Thu, 23 Jan 2025 20:31:07 GMT (envelope-from git) Date: Thu, 23 Jan 2025 20:31:07 GMT Message-Id: <202501232031.50NKV7kl074389@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: db221468b09a - main - EARLY_DRIVER_MODULE: use designated initializers 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: db221468b09ac8b57fa6ec8c142fdde8d5d4beeb Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=db221468b09ac8b57fa6ec8c142fdde8d5d4beeb commit db221468b09ac8b57fa6ec8c142fdde8d5d4beeb Author: Mitchell Horne AuthorDate: 2025-01-23 20:29:27 +0000 Commit: Mitchell Horne CommitDate: 2025-01-23 20:30:31 +0000 EARLY_DRIVER_MODULE: use designated initializers It helps the reader to parse the macro definition, with respect to how the arguments are mapped to the structure members. No functional change intended. Reviewed by: imp, jhb MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48489 --- sys/sys/bus.h | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/sys/sys/bus.h b/sys/sys/bus.h index 067868da4367..8b32e10f1285 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -851,24 +851,25 @@ struct driver_module_data { int dmd_pass; }; -#define EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, evh, arg, \ +#define EARLY_DRIVER_MODULE_ORDERED(_name, busname, driver, evh, arg, \ order, pass) \ \ -static struct driver_module_data name##_##busname##_driver_mod = { \ - evh, arg, \ - #busname, \ - (kobj_class_t) &driver, \ - NULL, \ - pass \ +static struct driver_module_data _name##_##busname##_driver_mod = { \ + .dmd_chainevh = evh, \ + .dmd_chainarg = arg, \ + .dmd_busname = #busname, \ + .dmd_driver = (kobj_class_t)&driver, \ + .dmd_devclass = NULL, \ + .dmd_pass = pass, \ }; \ \ -static moduledata_t name##_##busname##_mod = { \ - #busname "/" #name, \ - driver_module_handler, \ - &name##_##busname##_driver_mod \ +static moduledata_t _name##_##busname##_mod = { \ + .name = #busname "/" #_name , \ + .evhand = driver_module_handler, \ + .priv = &_name##_##busname##_driver_mod, \ }; \ -DECLARE_MODULE(name##_##busname, name##_##busname##_mod, \ - SI_SUB_DRIVERS, order) +DECLARE_MODULE(_name##_##busname, _name##_##busname##_mod, \ + SI_SUB_DRIVERS, order) #define EARLY_DRIVER_MODULE(name, busname, driver, evh, arg, pass) \ EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, evh, arg, \ From nobody Thu Jan 23 22:53:08 2025 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 4YfGSP1QLPz5lZmr; Thu, 23 Jan 2025 22:53: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 4YfGSP0grnz3dL7; Thu, 23 Jan 2025 22:53:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737672789; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hMaQuaHTa5Oe1JCWxRnrAucdQeXbhr7b1RN+Dfi8q0s=; b=Xv9avcC8TYfthQPVZPtxgeyf935+5P09K2lEsllXatiXxrBjxB/xdkAswZGUiqNcrM61fb GqZ1yuB7L1f+RH0WUpIG5puYmwPRkeHGNs5z+IRq0G4xRFzzAMEukvGnXpGgpv2P0yraGB BODX3rhIH7PPkInKoA4bcIrqx6B4d3qTz/FyX+6lP0Xr1g4NWyRdyloW4jQxROeDjJpmLg 2LnK+ynyxomrW2gNDLzPhkOq8KVto/YCINQMTl5V5rnaHphjya8QtP3ytwbRwK9DJ4xWZL PajrflCwTmDaYjaFozglGTV8WN/WNjuThMjjKzUxcFJdwU+ThWXaXSYBKtLUig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737672789; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hMaQuaHTa5Oe1JCWxRnrAucdQeXbhr7b1RN+Dfi8q0s=; b=YQHOm5sej7Skyed/CbTdkapxk4krGPrq6Z5lQLl3+ona0oQtte99Wa3bZY5oi1g2zBwJ8N 7MT6RRIuRDSJ3Irh+0fMIwQxqw1MAAeuMLAYPdeZs1Cc7xsFtM0RXV470R+ARzVdEqm7wS xug2mEDjC6TU3vXZjrASu0mNbkmYEhlB0NwZw6PhzgbzaABF9zEhQZevT4QbBRGj/eBGPp c+93M6Vv+Hx6RIyDR7ORhmc9+Cv/cfv0f8Xi5y/HS8wtyCiEaYXBMYpT0ugbPVplQSOw1C 0uaO2dGEjPeAtauW+04f54MATOFrXWPNdhf2bjz/9Ogw1TtNoeXochJJBDu6kw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737672789; a=rsa-sha256; cv=none; b=HEvk0zk8CulTt4Q5ovSUxCqq5Gu0dEl9kIaE7/42gXW8n/RcliMP5tPD72Y9+LaWBNxhbL AgVTgTlJRFq4b0g0Pf2MM14qr3pXDzIHkqcTBXQQ65daMhbd1CdwZIVsIP66nKn1SFqYra lvqI+Vcw0N0NOkXIK2cWMZgGthWdDAj1bb8zlE3+6/Oqppkj8aP89wYQK/tSnK0TOqmYS0 rueVHOv8U3H3xMa1mT5IBhTj0ixZx/7VvylVJkG6PWHgMUBZzxzvLjZyF9JxUihz7EeGsz 98j8RR12f8MHzc3YKqfjc07oPhtdc5pQfj8e1b5/PEmBK1JOufLjc095y7vjew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfGSN73NZzyw3; Thu, 23 Jan 2025 22:53: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 50NMr8Zj040173; Thu, 23 Jan 2025 22:53:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NMr8P7040170; Thu, 23 Jan 2025 22:53:08 GMT (envelope-from git) Date: Thu, 23 Jan 2025 22:53:08 GMT Message-Id: <202501232253.50NMr8P7040170@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: b937aac62254 - main - ziaee@ joins comitters-doc and calendar.freebsd 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: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b937aac622540286267040628fffa69268eabaca Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=b937aac622540286267040628fffa69268eabaca commit b937aac622540286267040628fffa69268eabaca Author: Alexander Ziaee AuthorDate: 2025-01-23 19:50:10 +0000 Commit: Alexander Ziaee CommitDate: 2025-01-23 22:52:59 +0000 ziaee@ joins comitters-doc and calendar.freebsd Approved by: carlavilla, mhorne (mentors) Differential Revision: https://reviews.freebsd.org/D48647 --- share/misc/committers-doc.dot | 4 ++++ usr.bin/calendar/calendars/calendar.freebsd | 1 + 2 files changed, 5 insertions(+) diff --git a/share/misc/committers-doc.dot b/share/misc/committers-doc.dot index 2c37a5f8ca6e..ba4c229bc658 100644 --- a/share/misc/committers-doc.dot +++ b/share/misc/committers-doc.dot @@ -107,6 +107,7 @@ ryusuke [label="Ryusuke Suzuki\nryusuke@FreeBSD.org\n2009/12/21"] salvadore [label="Lorenzo Salvadore\nsalvadore@FreeBSD.org\n2023/03/20"] trhodes [label="Tom Rhodes\ntrhodes@FreeBSD.org\n2002/03/25"] ygy [label="Guangyuan Yang\nygy@FreeBSD.org\n2017/09/18"] +ziaee [label="Alexander Ziaee\nziaee@FreeBSD.org\n2024/12/30"] # Here are the mentor/mentee relationships. # Group together all the mentees for a particular mentor. @@ -144,6 +145,7 @@ carlavilla -> grahamperrin carlavilla -> lwhsu carlavilla -> pauamma carlavilla -> salvadore +carlavilla -> ziaee ceri -> brd ceri -> brueffer @@ -209,6 +211,8 @@ maxim -> taras mheinen -> jkois +mhorne -> ziaee + murray -> ceri murray -> delphij diff --git a/usr.bin/calendar/calendars/calendar.freebsd b/usr.bin/calendar/calendars/calendar.freebsd index 6135a5fdfa4c..0b1a37f43723 100644 --- a/usr.bin/calendar/calendars/calendar.freebsd +++ b/usr.bin/calendar/calendars/calendar.freebsd @@ -492,6 +492,7 @@ 12/19 Emmanuel Vadot born in Decines-Charpieu, France, 1983 12/20 Sean Bruno born in Monterey, California, United States, 1974 12/21 Rong-En Fan born in Taipei, Taiwan, Republic of China, 1982 +12/21 Alexander Ziaee born in Columbus, Ohio, United States, 1995 12/22 Alan L. Cox born in Warren, Ohio, United States, 1964 12/22 Maxim Sobolev born in Dnepropetrovsk, Ukraine, 1976 12/23 Sean Chittenden born in Seattle, Washington, United States, 1979 From nobody Thu Jan 23 23:28:07 2025 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 4YfHDl6nXXz5lcYv; Thu, 23 Jan 2025 23:28: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 4YfHDl5zhCz3k6G; Thu, 23 Jan 2025 23:28:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737674887; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TgMQ2g4VX4UJLKckfJVbuEB8Pv6jfdAa6q17CMqGbw8=; b=ps6gWNRZkBtXL5YMeZ3xIX9O6mclDMCk1hGX9vjwuc0Pd0sDKTUgX7OMZ2nc3f+KcgwqQA AlQgRk/QckUD+0XBhsub70JxFjjg1/yta4SYdhgplhUviRgGhK0Im+p2qLz4IWQflX3wUn 51VFzOJ8fi4ms3vl/kDTOIqZW+Wiubb/uY3GEud3VKgDogTgUbR/cJ9D/YkWTet3hsdaf5 JrePjh+siPDjmQSyFnhWhafn9ecihfVEF+2WRxaufX6xUKhEz6MlK6diU9kRW+MmnBdCIc 6UlE7umJATDmThwJG7kGRqp2N0IgBHrrThvsEA48ZAg9Ty5PYricR4v/3hM8EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737674887; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TgMQ2g4VX4UJLKckfJVbuEB8Pv6jfdAa6q17CMqGbw8=; b=pvqOq28rmlthQlI4L7M72xyMN8resLKwWtYnF+6O1XtrWeS25/al9CIbTnEcenOurrg21c Ee4apdGXezJxog5BHvBl2+ZfVHWgM/BvxikFrKR7HYscOboqwWG3P31Mnj/UaYnanC2C/X IcTw9Z1W4KGVqge5t7e4iQAVxw1U0cKE9tzHn8YENMgX4aF9lJIzcKRx6a7tAencVy78zB 2k/WcjJdWuztRAIcire/vIesftDv3bDamozSA3RuCghyakmrq3ke4UY0SrLjzFDRIT4K1T uhYOO6dX7WU0K/LDEcG3ALkd0lmagYTpvqxT2/q4iL+aXuPF391So7e67+F1mg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737674887; a=rsa-sha256; cv=none; b=CPyu74pF8FtKzxVtvrnzSAwhc5zlj9nWDVI1VavRsCmn29Sh/RGgghE4BaqRLDYoelzc/R mIRz/ng5g4ulv6Vc5U4lVFPeCySOKdh0DR+LvH5LcFN0XTzG3SU+z/NDRUzMvuhthcku6Y lQ+kFaCgBg8LqIJ1PCIooK+rsBihzqhvzopzZQB3M4v/EFq3tNXVKUhJwGcksM8Gt/6NCd A3I56wj86EQYmWJwsr7nVZ9JEYgfuCUoeo4vC/Ky7orvgX45wZgNWibKqjHzX8O6QAx1lU m9a/RChcahNEEWz1ToXlc1uYoDq4Cp99xysOVBEKtKkynh3ajTodIV4hMv/6rw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfHDl5Vmkz10v5; Thu, 23 Jan 2025 23:28: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 50NNS79N099222; Thu, 23 Jan 2025 23:28:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NNS7GG099219; Thu, 23 Jan 2025 23:28:07 GMT (envelope-from git) Date: Thu, 23 Jan 2025 23:28:07 GMT Message-Id: <202501232328.50NNS7GG099219@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: bf6c4ee6f0c8 - main - arm64 nexus: Remove support for I/O port resources 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bf6c4ee6f0c8d0b9025207cde648427b749d8420 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=bf6c4ee6f0c8d0b9025207cde648427b749d8420 commit bf6c4ee6f0c8d0b9025207cde648427b749d8420 Author: John Baldwin AuthorDate: 2025-01-23 23:27:48 +0000 Commit: John Baldwin CommitDate: 2025-01-23 23:27:48 +0000 arm64 nexus: Remove support for I/O port resources arm64 doesn't natively support I/O port resources. PCI I/O port BARs are remapped to memory resources by PCI bridge drivers before the request is passed up to the nexus layer. Reviewed by: imp, markj Differential Revision: https://reviews.freebsd.org/D48581 --- sys/arm64/arm64/nexus.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sys/arm64/arm64/nexus.c b/sys/arm64/arm64/nexus.c index 8d7489b844ae..2de996447edd 100644 --- a/sys/arm64/arm64/nexus.c +++ b/sys/arm64/arm64/nexus.c @@ -221,7 +221,6 @@ nexus_get_rman(device_t bus, int type, u_int flags) case SYS_RES_IRQ: return (&irq_rman); case SYS_RES_MEMORY: - case SYS_RES_IOPORT: return (&mem_rman); default: return (NULL); @@ -334,7 +333,6 @@ nexus_activate_resource_flags(device_t bus, device_t child, struct resource *r, * If this is a memory resource, map it into the kernel. */ switch (rman_get_type(r)) { - case SYS_RES_IOPORT: case SYS_RES_MEMORY: if ((err = rman_activate_resource(r)) != 0) return (err); @@ -390,9 +388,8 @@ nexus_map_resource(device_t bus, device_t child, struct resource *r, if ((rman_get_flags(r) & RF_ACTIVE) == 0) return (ENXIO); - /* Mappings are only supported on I/O and memory resources. */ + /* Mappings are only supported on memory resources. */ switch (rman_get_type(r)) { - case SYS_RES_IOPORT: case SYS_RES_MEMORY: break; default: @@ -422,7 +419,6 @@ nexus_unmap_resource(device_t bus, device_t child, struct resource *r, switch (rman_get_type(r)) { case SYS_RES_MEMORY: - case SYS_RES_IOPORT: pmap_unmapdev(map->r_vaddr, map->r_size); return (0); default: @@ -480,7 +476,6 @@ nexus_fdt_activate_resource(device_t bus, device_t child, struct resource *r) flags = 0; switch (rman_get_type(r)) { case SYS_RES_MEMORY: - case SYS_RES_IOPORT: /* * If the fdt parent has the nonposted-mmio property we * need to use non-posted IO to access the device. When From nobody Thu Jan 23 23:28:08 2025 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 4YfHDn0SZvz5lcZ0; Thu, 23 Jan 2025 23:28: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 4YfHDn00l4z3k8F; Thu, 23 Jan 2025 23:28:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737674889; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jf7NQjHgj90qpPpzqEox60AtL4Q6PV050JhBHjpBDkw=; b=BE+EAcH6c2G1ZJ0w4EgcuSp1TtNVZZXWO8ff7FAX0QC1YsOZ11eE4WifZqEtnsppJooPfW 23/AFZH30bgBfC8gX8X53z58S36ReUbvdPPfFXC6jcQC4oy3IHs0Rq2TwPinx8KL/t0Zef 9TPcWgSTP1Bahh0vrdUzw4GOA/sQ9UGQNj5P0Mk8fNew7SWChY+Tst1ntjCk+tkitIG947 NdDcBa4nPQkjjtqSLsxSMwpOMEagXu+iNdPRTjFrOnVNO0yO7eJekSIVKWbRc7KBqX8ay7 lV6XzOeG8cjsmkPVbgEJKFyQ/Z2feh0RS9RcaoS0Eo0TV2o6lsBdpZUgE9oO2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737674889; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jf7NQjHgj90qpPpzqEox60AtL4Q6PV050JhBHjpBDkw=; b=eTnLeyISSQ03ejRPx+cnm8pTUAHz2PNrYcittPBGGfcU3XVGWGiqzmvVj44zLl3nheabNW ffKTGNM4L/n4AAPm8QSGdxGwwb0QIYqBwo28fjQVn6KoLHcVo3ifSKpUkyBgGzlw6vn66M 1AjYGi1jfAzzfOGHlQpNxVdY8YNcdVQ5KyKe92Qa0nbmeR4Un4QosofJt3YCW0BlvMtbh6 8DrpKau6qSx+32XBUBGc9BRjrtO4nJ8eA7m7r0DW+q5XTeeJ0gFfrQlFllzn711ALj40T9 h9elOSSc1Hc/wEDM+CSw/ZN/jMe1yRKuJJAbdu5xOsDppjgeis/+9uGLwHh3xQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737674889; a=rsa-sha256; cv=none; b=R1suznOoVsTe1++zJToAlOk8ewY434fCKJ+1dalbV9JHPlVTPRgtgx+hGKw5Hhvc2uWn6p d20zqzn/vwvwIQt9kwWTKWX/dbE1UxXFqVpAz3Yuv2Za8d514765ubXbpUw/absWNPNppy FXWIsgRD7Gf1xMy2H4bWKyBGVlRbY86tXFUSBw5+ZkIcJJhTfDzhlqmA75+OP6zl6GBHxl g/aDo3m0OZdQpdXyw6GDcIzoSa1EW1INVyggIaSmmK6cU4QO7k9EvFAkN9JLiakEvoAbhd LrCiBjuepPF4+qxCqS4Si5+tHUYAQN4EHHrstHbFeshG1wAhYTy5QnrD1qqVNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfHDm6jjqz106C; Thu, 23 Jan 2025 23: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 50NNS8Rk099254; Thu, 23 Jan 2025 23: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 50NNS8XA099251; Thu, 23 Jan 2025 23:28:08 GMT (envelope-from git) Date: Thu, 23 Jan 2025 23:28:08 GMT Message-Id: <202501232328.50NNS8XA099251@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 2f51074c90ad - main - riscv nexus: Remove support for I/O port resources 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2f51074c90ad28a9cc7715f5f9c4e9323609ab1b Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2f51074c90ad28a9cc7715f5f9c4e9323609ab1b commit 2f51074c90ad28a9cc7715f5f9c4e9323609ab1b Author: John Baldwin AuthorDate: 2025-01-23 23:27:57 +0000 Commit: John Baldwin CommitDate: 2025-01-23 23:27:57 +0000 riscv nexus: Remove support for I/O port resources RISC-V doesn't natively support I/O port resources. PCI I/O port BARs are remapped to memory resources by PCI bridge drivers before the request is passed up to the nexus layer. Reviewed by: jrtc27, imp Differential Revision: https://reviews.freebsd.org/D48582 --- sys/riscv/riscv/nexus.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sys/riscv/riscv/nexus.c b/sys/riscv/riscv/nexus.c index 6eb194f86390..836e1648edeb 100644 --- a/sys/riscv/riscv/nexus.c +++ b/sys/riscv/riscv/nexus.c @@ -214,7 +214,6 @@ nexus_get_rman(device_t bus, int type, u_int flags) case SYS_RES_IRQ: return (&irq_rman); case SYS_RES_MEMORY: - case SYS_RES_IOPORT: return (&mem_rman); default: return (NULL); @@ -308,7 +307,6 @@ nexus_activate_resource(device_t bus, device_t child, struct resource *r) int error; switch (rman_get_type(r)) { - case SYS_RES_IOPORT: case SYS_RES_MEMORY: error = bus_generic_rman_activate_resource(bus, child, r); break; @@ -343,7 +341,6 @@ nexus_deactivate_resource(device_t bus, device_t child, struct resource *r) int error; switch (rman_get_type(r)) { - case SYS_RES_IOPORT: case SYS_RES_MEMORY: error = bus_generic_rman_deactivate_resource(bus, child, r); break; @@ -372,9 +369,8 @@ nexus_map_resource(device_t bus, device_t child, struct resource *r, if ((rman_get_flags(r) & RF_ACTIVE) == 0) return (ENXIO); - /* Mappings are only supported on I/O and memory resources. */ + /* Mappings are only supported on memory resources. */ switch (rman_get_type(r)) { - case SYS_RES_IOPORT: case SYS_RES_MEMORY: break; default: @@ -403,7 +399,6 @@ nexus_unmap_resource(device_t bus, device_t child, struct resource *r, { switch (rman_get_type(r)) { case SYS_RES_MEMORY: - case SYS_RES_IOPORT: pmap_unmapdev(map->r_vaddr, map->r_size); return (0); default: From nobody Fri Jan 24 09:38:46 2025 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 4YfXnM02bPz5l7Sq; Fri, 24 Jan 2025 09:38: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 4YfXnL6C19z3lJY; Fri, 24 Jan 2025 09:38:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737711526; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NGQvAX+gV5WRWkbetMqya076C9852EpYaxMZ/gkgoOs=; b=WKDYsltICRt15nwHAorJjAzkN1wCqXSDfFYa1I6VqxCQLtfakkjuXUo5eIxKjIJjjWch0J yP+8FJiFI41mIrhEU5DXvC9uql71eeWx741Bl/B+w1qv+HIVYVj5TTY0ffuJC4pLO+r9IW Ru6qZ2tWAwDwvToIqc06NmgLYrfuijF6vkHzfkMUn0d5hAn8UToXdh+psvLvtPPXbgjTBP D2g3mXslXZLoPUQtYE8wO9OL6muxSmno7oaLAt5K3Z1UyR2/MLkXGhs/0osGoJEl9jluaW yhXi6OGHxkSdsfeTnbIujGn3dNxkIDUpzPMoJfdJrW8B/la6FLMIkST0ISVZvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737711526; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NGQvAX+gV5WRWkbetMqya076C9852EpYaxMZ/gkgoOs=; b=w8Iw8VNn8iM24bnNyeyYFjio253sv78511IyYp+SBunCSdrIcq24g6YGw/PGGt5cT5tZ8d 8xOA3tCLBr2j7p8t1/hIMrmabuEA8kvAHipcY7af1F28H6WUrKnIzImyDAzktV4K8LtjNJ AiBKIeoM0e95fyU+UWpIG9A7Ns7kG8ZxRrnAX4TTSTeir/5PXkIsPtdGrxGnAvav30t/xE EjURsp+kRdsqca9qEbv8R8iItOU26JsZgVkJhoSZKG0yZAVDDfW3/a12WD42XojHMmSeOv AwBlCv4eYcaIj+JzZ9xYTlNbvMehPyXt+IJQTtcGH8CGWvB2lbTJu4mScHc9FQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737711526; a=rsa-sha256; cv=none; b=kgvw9X1nmaFLYL0CXgzVshQI3ohwgzWHRdv1LYMLzuKxhOK79GRqd99Jft+gHLy0w1AWv+ yPvdGrE+kOHbtsrVq7HRY131cfr0ojmCq6bDjXXuU5tKlwTB2FkKKyGYKTTphXPl1TWfxV cpQziUwJp3eH+L/yO5oK6crlj4wq/0tpnHXi6zpJbAsV3Bn52yAx8eeVvv06vEDhKtK4Ji 9GPVZfganppUwJiErFSPibzMV0IPG+8U3z1P6fdeyH978UWppMU+rncKxP33g74F7163OX 8uD9odF6WfxHTxhLmpxivdqJGd1bZetEdeVpifgxkt6fT0nILVX5u/lCjZGrNQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfXnL5pJlz4Qv; Fri, 24 Jan 2025 09:38: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 50O9ckvc044696; Fri, 24 Jan 2025 09:38:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50O9ckhK044693; Fri, 24 Jan 2025 09:38:46 GMT (envelope-from git) Date: Fri, 24 Jan 2025 09:38:46 GMT Message-Id: <202501240938.50O9ckhK044693@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 5e0dbbc238e2 - main - if_vxlan(4): Use static initializers 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e0dbbc238e2e935c68e293314a90f2ce6e6ef16 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=5e0dbbc238e2e935c68e293314a90f2ce6e6ef16 commit 5e0dbbc238e2e935c68e293314a90f2ce6e6ef16 Author: Zhenlei Huang AuthorDate: 2025-01-24 09:37:24 +0000 Commit: Zhenlei Huang CommitDate: 2025-01-24 09:37:24 +0000 if_vxlan(4): Use static initializers MFC after: 1 week --- sys/net/if_vxlan.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c index b7af304e3126..58285c632771 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -419,7 +419,8 @@ static struct mtx vxlan_list_mtx; #define VXLAN_LIST_LOCK() mtx_lock(&vxlan_list_mtx) #define VXLAN_LIST_UNLOCK() mtx_unlock(&vxlan_list_mtx) -static LIST_HEAD(, vxlan_socket) vxlan_socket_list; +static LIST_HEAD(, vxlan_socket) vxlan_socket_list = + LIST_HEAD_INITIALIZER(vxlan_socket_list); static eventhandler_tag vxlan_ifdetach_event_tag; @@ -3609,12 +3610,10 @@ vxlan_tunable_int(struct vxlan_softc *sc, const char *knob, int def) static void vxlan_ifdetach_event(void *arg __unused, struct ifnet *ifp) { - struct vxlan_softc_head list; + struct vxlan_softc_head list = LIST_HEAD_INITIALIZER(list); struct vxlan_socket *vso; struct vxlan_softc *sc, *tsc; - LIST_INIT(&list); - if (ifp->if_flags & IFF_RENAMING) return; if ((ifp->if_flags & IFF_MULTICAST) == 0) @@ -3642,7 +3641,6 @@ vxlan_load(void) { mtx_init(&vxlan_list_mtx, "vxlan list", NULL, MTX_DEF); - LIST_INIT(&vxlan_socket_list); vxlan_ifdetach_event_tag = EVENTHANDLER_REGISTER(ifnet_departure_event, vxlan_ifdetach_event, NULL, EVENTHANDLER_PRI_ANY); From nobody Fri Jan 24 10:24:58 2025 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 4YfYpf3g6Cz5lBl7; Fri, 24 Jan 2025 10: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 4YfYpf3M9mz3tGp; Fri, 24 Jan 2025 10: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=1737714298; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=c1rznoBpvOGmdOnxezGQ7BxdSzs4pWt8HeC9kpbE3Cc=; b=ZNyQLJhwFJ5D0pDrXBC4aQRLdflW0TFnGVEdQ1r2qamH3RLFh1rCLfdoJAhP/aRfLP/O5L Do1rqTEPtDEyA74HKuCEl+t7e/ni9hPfd4jGEm1M6sIrbJ/59rJxciR7gVE+hc84RvtvSu /Bn0CTjppm5UO/XM6KFpxO9Nk65w79uhfzoAXPVRVgFmqYo3YrZZtt5xcZns0minI0GzUZ mVFMgTTJag0INPRKPal5QdkUIks7oI+7znaWla08qb6c2larDnimEJsdDinw0ry6WvW9+S a/VWm7fV9JE4HGzLm99HicpfyJL+X/JSMCdiOpBq4WiSAY6pF9y7ZRkVIukxew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737714298; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=c1rznoBpvOGmdOnxezGQ7BxdSzs4pWt8HeC9kpbE3Cc=; b=OKPFWuBDrRowlpRWL5cHIdZvtnWtoXpnM7Mk5hJ69tefCwJcR7Tz84Rvq6GUoUblH1zoWp HX97PZgzqkcqaCgAVboSbRV0skqAxVyc1IDsxRSrw7CyvtBb7wyh2v+/UkgCIpyWM0ogHO xosob9jOQyqxMEc/BHPK9W2/dqF2/dINRwsExgZg4+hmKZ1n9TBG6Wm6oCkH1nkd/PzPYG VT2dL5arm2QzWQ83wIuLCOAu/tLxgaSqjm36OKyPREVQQ1kzYw02IhbJUmZ9Kcb9djW4Sx BJXzQ1dMxrDUjy76IU8c88CPJjDNRzwRGm8TMhFz6r0bHjhaR30L15ysa8jsLA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737714298; a=rsa-sha256; cv=none; b=B3AA4rltrrUUAIriPllg9QsrlbKlpgc9IRjCiTEn/zsmmCnt0J9Se69IWrluWBipfVpXX7 UzNc0i/G0LYNWd/Z777w29pCUnF6Lzcs2Gl1AIk/vm9I3vXeed+bfx60uebOA0h4gc5SCS N3UWFhs+feFfzAXOm2RH6kQQSOGcYnN+xNjAaSIMUcnk0+bkk424yMZXojipTZztHq0GnN UTQoBMRSjaDPcvjNKFUc70bXwrYYqqxnYjMRRh8O74dWm1DzafDVpGPQWb3sOoLGZscLC2 DfzbUmg1c2ikI2vD9vNFpyzbvIfqQVkeCb8GOBkyEz0AKXgBnDvr0mltibbdEQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfYpf2vbyz5dB; Fri, 24 Jan 2025 10: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 50OAOwLN038270; Fri, 24 Jan 2025 10: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 50OAOwSB038267; Fri, 24 Jan 2025 10:24:58 GMT (envelope-from git) Date: Fri, 24 Jan 2025 10:24:58 GMT Message-Id: <202501241024.50OAOwSB038267@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: 096efeb658b5 - main - pfctl: follow rpool -> rdr rename 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: 096efeb658b5a6d63068bd90f3c6508f74767bba Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=096efeb658b5a6d63068bd90f3c6508f74767bba commit 096efeb658b5a6d63068bd90f3c6508f74767bba Author: Kristof Provost AuthorDate: 2025-01-20 08:34:46 +0000 Commit: Kristof Provost CommitDate: 2025-01-24 10:20:29 +0000 pfctl: follow rpool -> rdr rename In e11dacbf8484adc7bbb61b20fee3ab8385745925 the redirect pool was renamed from rpool to rdr. It included backwards compatibility support for libpfctl users, but didn't fully implement the rename in our own code. Do so now. No functional change. Sponsored by: Rubicon Communications, LLC ("Netgate") --- contrib/pf/ftp-proxy/filter.c | 6 ++-- contrib/pf/tftp-proxy/filter.c | 6 ++-- sbin/pfctl/parse.y | 80 +++++++++++++++++++++--------------------- sbin/pfctl/pfctl.c | 18 +++++----- sbin/pfctl/pfctl_optimize.c | 26 +++++++------- sbin/pfctl/pfctl_parser.c | 6 ++-- 6 files changed, 71 insertions(+), 71 deletions(-) diff --git a/contrib/pf/ftp-proxy/filter.c b/contrib/pf/ftp-proxy/filter.c index 7d6d3f1fa348..f29467c98d4c 100644 --- a/contrib/pf/ftp-proxy/filter.c +++ b/contrib/pf/ftp-proxy/filter.c @@ -107,8 +107,8 @@ add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, if (ioctl(pfctl_fd(pfh), DIOCADDADDR, &pfp) == -1) return (-1); - pfrule.rpool.proxy_port[0] = nat_range_low; - pfrule.rpool.proxy_port[1] = nat_range_high; + pfrule.rdr.proxy_port[0] = nat_range_low; + pfrule.rdr.proxy_port[1] = nat_range_high; if (pfctl_add_rule_h(pfh, &pfrule, pfanchor, pfanchor_call, pfticket, pfpool_ticket)) return (-1); @@ -141,7 +141,7 @@ add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, if (ioctl(pfctl_fd(pfh), DIOCADDADDR, &pfp) == -1) return (-1); - pfrule.rpool.proxy_port[0] = rdr_port; + pfrule.rdr.proxy_port[0] = rdr_port; if (pfctl_add_rule_h(pfh, &pfrule, pfanchor, pfanchor_call, pfticket, pfpool_ticket)) return (-1); diff --git a/contrib/pf/tftp-proxy/filter.c b/contrib/pf/tftp-proxy/filter.c index 8d5dcc21badc..d462d159d779 100644 --- a/contrib/pf/tftp-proxy/filter.c +++ b/contrib/pf/tftp-proxy/filter.c @@ -111,8 +111,8 @@ add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, if (ioctl(pfctl_fd(pfh), DIOCADDADDR, &pfp) == -1) return (-1); - pfrule.rpool.proxy_port[0] = nat_range_low; - pfrule.rpool.proxy_port[1] = nat_range_high; + pfrule.rdr.proxy_port[0] = nat_range_low; + pfrule.rdr.proxy_port[1] = nat_range_high; if (pfctl_add_rule_h(pfh, &pfrule, pfanchor, pfanchor_call, pfticket, pfpool_ticket)) return (-1); @@ -145,7 +145,7 @@ add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, if (ioctl(pfctl_fd(pfh), DIOCADDADDR, &pfp) == -1) return (-1); - pfrule.rpool.proxy_port[0] = rdr_port; + pfrule.rdr.proxy_port[0] = rdr_port; if (pfctl_add_rule_h(pfh, &pfrule, pfanchor, pfanchor_call, pfticket, pfpool_ticket)) return (-1); diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 4a7bd3125372..2bd8e16b535b 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -2737,9 +2737,9 @@ pfrule : action dir logquick interface route af proto fromto YYERROR; } r.rt = $5.rt; - r.rpool.opts = $5.pool_opts; + r.rdr.opts = $5.pool_opts; if ($5.key != NULL) - memcpy(&r.rpool.key, $5.key, + memcpy(&r.rdr.key, $5.key, sizeof(struct pf_poolhashkey)); } if (r.rt) { @@ -2750,26 +2750,26 @@ pfrule : action dir logquick interface route af proto fromto "matching address family found."); YYERROR; } - if ((r.rpool.opts & PF_POOL_TYPEMASK) == + if ((r.rdr.opts & PF_POOL_TYPEMASK) == PF_POOL_NONE && ($5.host->next != NULL || $5.host->addr.type == PF_ADDR_TABLE || DYNIF_MULTIADDR($5.host->addr))) - r.rpool.opts |= PF_POOL_ROUNDROBIN; - if ((r.rpool.opts & PF_POOL_TYPEMASK) != + r.rdr.opts |= PF_POOL_ROUNDROBIN; + if ((r.rdr.opts & PF_POOL_TYPEMASK) != PF_POOL_ROUNDROBIN && disallow_table($5.host, "tables are only " "supported in round-robin routing pools")) YYERROR; - if ((r.rpool.opts & PF_POOL_TYPEMASK) != + if ((r.rdr.opts & PF_POOL_TYPEMASK) != PF_POOL_ROUNDROBIN && disallow_alias($5.host, "interface (%s) " "is only supported in round-robin " "routing pools")) YYERROR; if ($5.host->next != NULL) { - if ((r.rpool.opts & PF_POOL_TYPEMASK) != + if ((r.rdr.opts & PF_POOL_TYPEMASK) != PF_POOL_ROUNDROBIN) { - yyerror("r.rpool.opts must " + yyerror("r.rdr.opts must " "be PF_POOL_ROUNDROBIN"); YYERROR; } @@ -4874,59 +4874,59 @@ natrule : nataction interface af proto fromto tag tagged rtable if (check_netmask($9->host, r.af)) YYERROR; - r.rpool.proxy_port[0] = ntohs($9->rport.a); + r.rdr.proxy_port[0] = ntohs($9->rport.a); switch (r.action) { case PF_RDR: if (!$9->rport.b && $9->rport.t && $5.dst.port != NULL) { - r.rpool.proxy_port[1] = + r.rdr.proxy_port[1] = ntohs($9->rport.a) + (ntohs( $5.dst.port->port[1]) - ntohs( $5.dst.port->port[0])); } else - r.rpool.proxy_port[1] = + r.rdr.proxy_port[1] = ntohs($9->rport.b); break; case PF_NAT: - r.rpool.proxy_port[1] = + r.rdr.proxy_port[1] = ntohs($9->rport.b); - if (!r.rpool.proxy_port[0] && - !r.rpool.proxy_port[1]) { - r.rpool.proxy_port[0] = + if (!r.rdr.proxy_port[0] && + !r.rdr.proxy_port[1]) { + r.rdr.proxy_port[0] = PF_NAT_PROXY_PORT_LOW; - r.rpool.proxy_port[1] = + r.rdr.proxy_port[1] = PF_NAT_PROXY_PORT_HIGH; - } else if (!r.rpool.proxy_port[1]) - r.rpool.proxy_port[1] = - r.rpool.proxy_port[0]; + } else if (!r.rdr.proxy_port[1]) + r.rdr.proxy_port[1] = + r.rdr.proxy_port[0]; break; default: break; } - r.rpool.opts = $10.type; - if ((r.rpool.opts & PF_POOL_TYPEMASK) == + r.rdr.opts = $10.type; + if ((r.rdr.opts & PF_POOL_TYPEMASK) == PF_POOL_NONE && ($9->host->next != NULL || $9->host->addr.type == PF_ADDR_TABLE || DYNIF_MULTIADDR($9->host->addr))) - r.rpool.opts = PF_POOL_ROUNDROBIN; - if ((r.rpool.opts & PF_POOL_TYPEMASK) != + r.rdr.opts = PF_POOL_ROUNDROBIN; + if ((r.rdr.opts & PF_POOL_TYPEMASK) != PF_POOL_ROUNDROBIN && disallow_table($9->host, "tables are only " "supported in round-robin redirection " "pools")) YYERROR; - if ((r.rpool.opts & PF_POOL_TYPEMASK) != + if ((r.rdr.opts & PF_POOL_TYPEMASK) != PF_POOL_ROUNDROBIN && disallow_alias($9->host, "interface (%s) " "is only supported in round-robin " "redirection pools")) YYERROR; if ($9->host->next != NULL) { - if ((r.rpool.opts & PF_POOL_TYPEMASK) != + if ((r.rdr.opts & PF_POOL_TYPEMASK) != PF_POOL_ROUNDROBIN) { yyerror("only round-robin " "valid for multiple " @@ -4937,11 +4937,11 @@ natrule : nataction interface af proto fromto tag tagged rtable } if ($10.key != NULL) - memcpy(&r.rpool.key, $10.key, + memcpy(&r.rdr.key, $10.key, sizeof(struct pf_poolhashkey)); if ($10.opts) - r.rpool.opts |= $10.opts; + r.rdr.opts |= $10.opts; if ($10.staticport) { if (r.action != PF_NAT) { @@ -4949,17 +4949,17 @@ natrule : nataction interface af proto fromto tag tagged rtable "only valid with nat rules"); YYERROR; } - if (r.rpool.proxy_port[0] != + if (r.rdr.proxy_port[0] != PF_NAT_PROXY_PORT_LOW && - r.rpool.proxy_port[1] != + r.rdr.proxy_port[1] != PF_NAT_PROXY_PORT_HIGH) { yyerror("the 'static-port' option can't" " be used when specifying a port" " range"); YYERROR; } - r.rpool.proxy_port[0] = 0; - r.rpool.proxy_port[1] = 0; + r.rdr.proxy_port[0] = 0; + r.rdr.proxy_port[1] = 0; } if ($10.mape.offset) { @@ -4973,16 +4973,16 @@ natrule : nataction interface af proto fromto tag tagged rtable " can't be used 'static-port'"); YYERROR; } - if (r.rpool.proxy_port[0] != + if (r.rdr.proxy_port[0] != PF_NAT_PROXY_PORT_LOW && - r.rpool.proxy_port[1] != + r.rdr.proxy_port[1] != PF_NAT_PROXY_PORT_HIGH) { yyerror("the 'map-e-portset' option" " can't be used when specifying" " a port range"); YYERROR; } - r.rpool.mape = $10.mape; + r.rdr.mape = $10.mape; } o = keep_state_defaults; @@ -5170,13 +5170,13 @@ binatrule : no BINAT natpasslog interface af proto FROM ipspec toipspec tag YYERROR; } - TAILQ_INIT(&binat.rpool.list); + TAILQ_INIT(&binat.rdr.list); pa = calloc(1, sizeof(struct pf_pooladdr)); if (pa == NULL) err(1, "binat: calloc"); pa->addr = $13->host->addr; pa->ifname[0] = 0; - TAILQ_INSERT_TAIL(&binat.rpool.list, + TAILQ_INSERT_TAIL(&binat.rdr.list, pa, entries); free($13); @@ -5521,7 +5521,7 @@ filter_consistent(struct pfctl_rule *r, int anchor_call) problems++; } } - if (r->rpool.opts & PF_POOL_STICKYADDR && !r->keep_state) { + if (r->rdr.opts & PF_POOL_STICKYADDR && !r->keep_state) { yyerror("'sticky-address' requires 'keep state'"); problems++; } @@ -5549,8 +5549,8 @@ rdr_consistent(struct pfctl_rule *r) yyerror("dst port only applies to tcp/udp/sctp"); problems++; } - if (r->rpool.proxy_port[0]) { - yyerror("rpool port only applies to tcp/udp/sctp"); + if (r->rdr.proxy_port[0]) { + yyerror("rdr port only applies to tcp/udp/sctp"); problems++; } } @@ -6320,7 +6320,7 @@ expand_rule(struct pfctl_rule *r, errx(1, "expand_rule: strlcpy"); } else pa->ifname[0] = 0; - TAILQ_INSERT_TAIL(&r->rpool.list, pa, entries); + TAILQ_INSERT_TAIL(&r->rdr.list, pa, entries); } TAILQ_INIT(&r->nat.list); for (h = nat_hosts; h != NULL; h = h->next) { diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index ca374ca3295d..9da13daee063 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1302,7 +1302,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, goto error; } - if (pfctl_get_pool(dev, &rule.rpool, + if (pfctl_get_pool(dev, &rule.rdr, nr, ri.ticket, PF_SCRUB, path, PF_RDR) != 0) goto error; @@ -1323,7 +1323,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, case PFCTL_SHOW_NOTHING: break; } - pfctl_clear_pool(&rule.rpool); + pfctl_clear_pool(&rule.rdr); } ret = pfctl_get_rules_info_h(pfh, &ri, PF_PASS, path); if (ret != 0) { @@ -1337,7 +1337,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, goto error; } - if (pfctl_get_pool(dev, &rule.rpool, + if (pfctl_get_pool(dev, &rule.rdr, nr, ri.ticket, PF_PASS, path, PF_RDR) != 0) goto error; @@ -1409,7 +1409,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, case PFCTL_SHOW_NOTHING: break; } - pfctl_clear_pool(&rule.rpool); + pfctl_clear_pool(&rule.rdr); } error: @@ -1498,7 +1498,7 @@ pfctl_show_nat(int dev, char *path, int opts, char *anchorname, int depth, warnc(ret, "DIOCGETRULE"); return (-1); } - if (pfctl_get_pool(dev, &rule.rpool, nr, + if (pfctl_get_pool(dev, &rule.rdr, nr, ri.ticket, nattype[i], path, PF_RDR) != 0) return (-1); if (pfctl_get_pool(dev, &rule.nat, nr, @@ -1755,8 +1755,8 @@ pfctl_append_rule(struct pfctl *pf, struct pfctl_rule *r, if ((rule = calloc(1, sizeof(*rule))) == NULL) err(1, "calloc"); bcopy(r, rule, sizeof(*rule)); - TAILQ_INIT(&rule->rpool.list); - pfctl_move_pool(&r->rpool, &rule->rpool); + TAILQ_INIT(&rule->rdr.list); + pfctl_move_pool(&r->rdr, &rule->rdr); TAILQ_INSERT_TAIL(rs->rules[rs_num].active.ptr, rule, entries); return (0); @@ -2057,7 +2057,7 @@ pfctl_load_rule(struct pfctl *pf, char *path, struct pfctl_rule *r, int depth) errc(1, error, "DIOCBEGINADDRS"); } - if (pfctl_add_pool(pf, &r->rpool, r->af, PF_RDR)) + if (pfctl_add_pool(pf, &r->rdr, r->af, PF_RDR)) return (1); if (pfctl_add_pool(pf, &r->nat, r->naf ? r->naf : r->af, PF_NAT)) return (1); @@ -2085,7 +2085,7 @@ pfctl_load_rule(struct pfctl *pf, char *path, struct pfctl_rule *r, int depth) printf(" -- rule was already present"); } path[len] = '\0'; - pfctl_clear_pool(&r->rpool); + pfctl_clear_pool(&r->rdr); return (0); } diff --git a/sbin/pfctl/pfctl_optimize.c b/sbin/pfctl/pfctl_optimize.c index a688fe484128..48b9a9caa82d 100644 --- a/sbin/pfctl/pfctl_optimize.c +++ b/sbin/pfctl/pfctl_optimize.c @@ -135,7 +135,7 @@ static struct pf_rule_field { PF_RULE_FIELD(return_ttl, BREAK), PF_RULE_FIELD(overload_tblname, BREAK), PF_RULE_FIELD(flush, BREAK), - PF_RULE_FIELD(rpool, BREAK), + PF_RULE_FIELD(rdr, BREAK), PF_RULE_FIELD(logif, BREAK), /* @@ -290,12 +290,12 @@ pfctl_optimize_ruleset(struct pfctl *pf, struct pfctl_ruleset *rs) if ((por = calloc(1, sizeof(*por))) == NULL) err(1, "calloc"); memcpy(&por->por_rule, r, sizeof(*r)); - if (TAILQ_FIRST(&r->rpool.list) != NULL) { - TAILQ_INIT(&por->por_rule.rpool.list); - pfctl_move_pool(&r->rpool, &por->por_rule.rpool); + if (TAILQ_FIRST(&r->rdr.list) != NULL) { + TAILQ_INIT(&por->por_rule.rdr.list); + pfctl_move_pool(&r->rdr, &por->por_rule.rdr); } else - bzero(&por->por_rule.rpool, - sizeof(por->por_rule.rpool)); + bzero(&por->por_rule.rdr, + sizeof(por->por_rule.rdr)); TAILQ_INSERT_TAIL(&opt_queue, por, por_entry); @@ -325,8 +325,8 @@ pfctl_optimize_ruleset(struct pfctl *pf, struct pfctl_ruleset *rs) if ((r = calloc(1, sizeof(*r))) == NULL) err(1, "calloc"); memcpy(r, &por->por_rule, sizeof(*r)); - TAILQ_INIT(&r->rpool.list); - pfctl_move_pool(&por->por_rule.rpool, &r->rpool); + TAILQ_INIT(&r->rdr.list); + pfctl_move_pool(&por->por_rule.rdr, &r->rdr); TAILQ_INSERT_TAIL( rs->rules[PF_RULESET_FILTER].active.ptr, r, entries); @@ -912,14 +912,14 @@ load_feedback_profile(struct pfctl *pf, struct superblocks *superblocks) memcpy(&por->por_rule, &rule, sizeof(por->por_rule)); rs = pf_find_or_create_ruleset(anchor_call); por->por_rule.anchor = rs->anchor; - if (TAILQ_EMPTY(&por->por_rule.rpool.list)) - memset(&por->por_rule.rpool, 0, - sizeof(por->por_rule.rpool)); + if (TAILQ_EMPTY(&por->por_rule.rdr.list)) + memset(&por->por_rule.rdr, 0, + sizeof(por->por_rule.rdr)); TAILQ_INSERT_TAIL(&queue, por, por_entry); - /* XXX pfctl_get_pool(pf->dev, &rule.rpool, nr, pr.ticket, + /* XXX pfctl_get_pool(pf->dev, &rule.rdr, nr, pr.ticket, * PF_PASS, pf->anchor) ??? - * ... pfctl_clear_pool(&rule.rpool) + * ... pfctl_clear_pool(&rule.rdr) */ } diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index af10bdcf7e4b..85f1797e58e1 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -942,7 +942,7 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer else if (r->rt == PF_DUPTO) printf(" dup-to"); printf(" "); - print_pool(&r->rpool, 0, 0, r->af, PF_PASS); + print_pool(&r->rdr, 0, 0, r->af, PF_PASS); } if (r->af) { if (r->af == AF_INET) @@ -1253,8 +1253,8 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer (r->action == PF_NAT || r->action == PF_BINAT || r->action == PF_RDR)) { printf(" -> "); - print_pool(&r->rpool, r->rpool.proxy_port[0], - r->rpool.proxy_port[1], r->af, r->action); + print_pool(&r->rdr, r->rdr.proxy_port[0], + r->rdr.proxy_port[1], r->af, r->action); } } From nobody Fri Jan 24 10:24:59 2025 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 4YfYpg5mg2z5lBbr; Fri, 24 Jan 2025 10: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 4YfYpg3yx4z3tJQ; Fri, 24 Jan 2025 10: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=1737714299; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F9Q6Z20ZIplYf4J8FN+ytqornOoqmTkC29gzdRkLfaI=; b=LsMjo1e0CaDrZu5wzMWx5SreJHhJlxasLw9CA0+s3IYsk8kTB7z6kzVjof3IxmyGjKR9E+ vyC5AqoGDxCn3tDA4jRNZriE4oYpXg+0ZU9vGIiirVl1nvue1Q3PxhAHsWm5/lEO5wP0DO BTVjpYozE5+RAtPIOiEXYGtnKKfoys1bPK+EnXEMeinYqEs/s6ZauIjkAIAVgjFAo8tAfG qIbUlYx6AZg1momWG84KFxUzmOedaCmZT6NmFEUCcHcq4t+Y5lf4zwHt47Zpb0g+2j4AwK PV8RL+Yy0B/55a6qlvC/GOwofxfiKSftOBqyDw/B2z6en3HrW2NneDAd0iK9kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737714299; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F9Q6Z20ZIplYf4J8FN+ytqornOoqmTkC29gzdRkLfaI=; b=L/IFcnHdFpc2VN1vHu63dL0XEBlEYPWACQykiwsbGClhNPC5N7WX8CMLzx0+L+9EgEKk3S UawitAbaNRmLF/Gf0A3EUqh2DcfItOWug82jBrndQ1RT5ehzD/WHA45j0gwQ1U5HPihzQ/ bH8HvH1hOX0aNXV2EdQX+iJ5wLYXkq4OMjnn/LZHO36TlZcs4W+MtDSY4C+fQYcgnmifOJ Dr9PuvryMRVCrw9nfmwqodGdV2pzdIyCsnOGUxlYuj2pyvyfd3pY6cn7N24nW3Et0cDhVq Go9iIgeju8BULfR2V3VjSB+lfrfdeSMIR+T410gutYH8bnmcxGBWdCgLeQGQLQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737714299; a=rsa-sha256; cv=none; b=NVnuL4GjogrU+vnahvfw9TwFHr+ChgzDzcvp802T7f+zFeF1wckTLoEY0hbdcyXt/GsrTl avTUT2p4vBtyeBZZjSpx4x9Bk19Tt2ohXFVjrVD6ds2Nkm/tgCNFLkDPqyPRfw1DFsFD3L KgsK8L7M+zyeInnEeXBOEgvBlHJLYbF6EwxPtJ7px34GJ4lz70takqEnyRHw4Y2Kdm8eQ4 l1iaPk+SUn7wi1uANdivNMevabdei8axNRhfwi0mswBAQod9QpKYEDFBJY1Qu6sJTtFhVr cOXB0Nsyk/+Y98ThlEMgkKjJy828HjJYgyDMDeZuBYl2IJckn2jaYRX1D+WdnA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfYpg3ZVGz64x; Fri, 24 Jan 2025 10: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 50OAOxiU038305; Fri, 24 Jan 2025 10: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 50OAOx0j038302; Fri, 24 Jan 2025 10:24:59 GMT (envelope-from git) Date: Fri, 24 Jan 2025 10:24:59 GMT Message-Id: <202501241024.50OAOx0j038302@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: 5cb08fddef99 - main - pfctl: improve NAT pool handling 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: 5cb08fddef998b5e6452df3f52474e00883e06c4 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5cb08fddef998b5e6452df3f52474e00883e06c4 commit 5cb08fddef998b5e6452df3f52474e00883e06c4 Author: Kristof Provost AuthorDate: 2025-01-20 13:11:20 +0000 Commit: Kristof Provost CommitDate: 2025-01-24 10:20:29 +0000 pfctl: improve NAT pool handling Ensure we always free the NAT pool (as well as the rdr pool) and actually handle it in the optimiser. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 1 + sbin/pfctl/pfctl.c | 5 +++++ sbin/pfctl/pfctl_optimize.c | 13 ++++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 2bd8e16b535b..e66d3cdd295e 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -5171,6 +5171,7 @@ binatrule : no BINAT natpasslog interface af proto FROM ipspec toipspec tag } TAILQ_INIT(&binat.rdr.list); + TAILQ_INIT(&binat.nat.list); pa = calloc(1, sizeof(struct pf_pooladdr)); if (pa == NULL) err(1, "binat: calloc"); diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 9da13daee063..7b54bc1c7c7a 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1324,6 +1324,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, break; } pfctl_clear_pool(&rule.rdr); + pfctl_clear_pool(&rule.nat); } ret = pfctl_get_rules_info_h(pfh, &ri, PF_PASS, path); if (ret != 0) { @@ -1410,6 +1411,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, break; } pfctl_clear_pool(&rule.rdr); + pfctl_clear_pool(&rule.nat); } error: @@ -1757,6 +1759,8 @@ pfctl_append_rule(struct pfctl *pf, struct pfctl_rule *r, bcopy(r, rule, sizeof(*rule)); TAILQ_INIT(&rule->rdr.list); pfctl_move_pool(&r->rdr, &rule->rdr); + TAILQ_INIT(&rule->nat.list); + pfctl_move_pool(&r->nat, &rule->nat); TAILQ_INSERT_TAIL(rs->rules[rs_num].active.ptr, rule, entries); return (0); @@ -2086,6 +2090,7 @@ pfctl_load_rule(struct pfctl *pf, char *path, struct pfctl_rule *r, int depth) } path[len] = '\0'; pfctl_clear_pool(&r->rdr); + pfctl_clear_pool(&r->nat); return (0); } diff --git a/sbin/pfctl/pfctl_optimize.c b/sbin/pfctl/pfctl_optimize.c index 48b9a9caa82d..a97664e0c929 100644 --- a/sbin/pfctl/pfctl_optimize.c +++ b/sbin/pfctl/pfctl_optimize.c @@ -136,6 +136,7 @@ static struct pf_rule_field { PF_RULE_FIELD(overload_tblname, BREAK), PF_RULE_FIELD(flush, BREAK), PF_RULE_FIELD(rdr, BREAK), + PF_RULE_FIELD(nat, BREAK), PF_RULE_FIELD(logif, BREAK), /* @@ -296,7 +297,12 @@ pfctl_optimize_ruleset(struct pfctl *pf, struct pfctl_ruleset *rs) } else bzero(&por->por_rule.rdr, sizeof(por->por_rule.rdr)); - + if (TAILQ_FIRST(&r->nat.list) != NULL) { + TAILQ_INIT(&por->por_rule.nat.list); + pfctl_move_pool(&r->nat, &por->por_rule.nat); + } else + bzero(&por->por_rule.nat, + sizeof(por->por_rule.nat)); TAILQ_INSERT_TAIL(&opt_queue, por, por_entry); } @@ -327,6 +333,8 @@ pfctl_optimize_ruleset(struct pfctl *pf, struct pfctl_ruleset *rs) memcpy(r, &por->por_rule, sizeof(*r)); TAILQ_INIT(&r->rdr.list); pfctl_move_pool(&por->por_rule.rdr, &r->rdr); + TAILQ_INIT(&r->nat.list); + pfctl_move_pool(&por->por_rule.nat, &r->nat); TAILQ_INSERT_TAIL( rs->rules[PF_RULESET_FILTER].active.ptr, r, entries); @@ -915,6 +923,9 @@ load_feedback_profile(struct pfctl *pf, struct superblocks *superblocks) if (TAILQ_EMPTY(&por->por_rule.rdr.list)) memset(&por->por_rule.rdr, 0, sizeof(por->por_rule.rdr)); + if (TAILQ_EMPTY(&por->por_rule.nat.list)) + memset(&por->por_rule.nat, 0, + sizeof(por->por_rule.nat)); TAILQ_INSERT_TAIL(&queue, por, por_entry); /* XXX pfctl_get_pool(pf->dev, &rule.rdr, nr, pr.ticket, From nobody Fri Jan 24 10:25:00 2025 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 4YfYpj2Yxkz5lBc6; Fri, 24 Jan 2025 10: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 4YfYph5t6Xz3t32; Fri, 24 Jan 2025 10: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=1737714300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=f/ACxx4bRdzAbH1KGq0Xq4YXOP3/qw17D/h/drjRaMc=; b=jPBgWyE42k+j2ChQ10kpaLa3B7tIHzqkhOqB/0xTyn0wQ2qHCTtX9WOZZrA7b4nMKXixbv j+SmW+MyRHAomUe3bcAiLqmePRiM9lqcSfVgs1SD+R7mvzzbemG7k9ID/XeLKgTuFjknB5 nrovutUPJ5yNjpRQRG5K9+cHFCWcL47oDRYETCKvgZb4uH8qhVorEVxunKZBoAZGWz/FTj HfZWheBa8J5A9G37xSpDe2QAK9oySzuXAT73X354hk1T2WTZuJgRHK5EauiPqKAqLBL5lL fLBfSUq5F/oCHI6T//k4Z8NziuPt41UMFCCUXeOs7dfFUj9uHywpVjaVJYeHFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737714300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=f/ACxx4bRdzAbH1KGq0Xq4YXOP3/qw17D/h/drjRaMc=; b=G2iNXTeQzv0ATV/lnRFGg0lhB1Wi6uYEF8OmgADyscMmPvnydgTQ/q2Ql00u3f3l+iO2TY gn5tOSrqOIf+Zzpc25wLqGa6DY4WsBNszUHHEI88MfWAx/A1p/lBsegu2SgxwG3t5x1xDU OM4hcL2siHiII3LRAmWVSehkrxyJLc1KEveXAJA31IdTsYQbpzngHWF0kJjjsLl7X3lFjh Lup3lzB28LyBQrzQCWlj69ht2ufllsEs1gqnUkfDjQW5/Xv7UV5prCC6h/6FHK8tm0a5Wa Gk4vBULEzf7VOJnF2NlCLjQY9+UMBUJ7BBI12AJxFmPe/lqy53JBV5VQ4rUPyA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737714300; a=rsa-sha256; cv=none; b=H53eFJj0q/+m0605VJbahbzHug5RUcKQPPwKVbvDjMSvMUBKiGMnWMD2JCK9ZmwwNtOSkL 3RpR49QgvUmbHEueGZTF2Pxs/YuZS0qYZWMSbs+IsKdKLBJVcC3dcB02uFOaVvWNaSTP/W FayIwLOSzqlefJKq/ZLb6goNujXn1DgDs/Pq+9DVuZk69M0+eVMTWtGGn7Qy5NiA4/tbig 2H4xAoHyBCTKNHW3D8cJQCvud6Zu3cdhi1d/SZmLHT7W7XIQjwy3mp8CVAKEAj6QZMPmX8 znrhi8Eiqbx5ba7C2dNarP6aizeTMntwsU5oGKASjfBCGRA8qjzike+fzTglwA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfYph4khjz5v0; Fri, 24 Jan 2025 10: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 50OAP03g038359; Fri, 24 Jan 2025 10: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 50OAP0tf038356; Fri, 24 Jan 2025 10:25:00 GMT (envelope-from git) Date: Fri, 24 Jan 2025 10:25:00 GMT Message-Id: <202501241025.50OAP0tf038356@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: 3331975ab18f - main - pf: check rather than assert pool 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3331975ab18f88a519b16e5c4781f5924b191eb7 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3331975ab18f88a519b16e5c4781f5924b191eb7 commit 3331975ab18f88a519b16e5c4781f5924b191eb7 Author: Kristof Provost AuthorDate: 2025-01-20 16:19:22 +0000 Commit: Kristof Provost CommitDate: 2025-01-24 10:20:30 +0000 pf: check rather than assert pool type These pool types are passed by userspace, so we must check rather than assert they are valid. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_ioctl.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 188681329b43..d206a9f8da43 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2566,7 +2566,8 @@ pf_ioctl_add_addr(struct pf_nl_pooladdr *pp) struct pfi_kkif *kif = NULL; int error; - MPASS(pp->which == PF_RDR || pp->which == PF_NAT); + if (pp->which != PF_RDR && pp->which != PF_NAT) + return (EINVAL); #ifndef INET if (pp->af == AF_INET) @@ -2631,7 +2632,8 @@ pf_ioctl_get_addrs(struct pf_nl_pooladdr *pp) PF_RULES_RLOCK_TRACKER; - MPASS(pp->which == PF_RDR || pp->which == PF_NAT); + if (pp->which != PF_RDR && pp->which != PF_NAT) + return (EINVAL); pp->anchor[sizeof(pp->anchor) - 1] = 0; pp->nr = 0; @@ -2657,7 +2659,8 @@ pf_ioctl_get_addr(struct pf_nl_pooladdr *pp) struct pf_kpooladdr *pa; u_int32_t nr = 0; - MPASS(pp->which == PF_RDR || pp->which == PF_NAT); + if (pp->which != PF_RDR && pp->which != PF_NAT) + return (EINVAL); PF_RULES_RLOCK_TRACKER; From nobody Fri Jan 24 10:25:01 2025 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 4YfYpk1pbPz5lBjh; Fri, 24 Jan 2025 10: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 4YfYpj5vV7z3tH3; Fri, 24 Jan 2025 10: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=1737714301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fz6Gv/mKJldSvwB8GoqxQl0UB619Pdp0O/nEyaZKgoE=; b=QvRlsJl0VRLQB1ZpraiEgryLIw2MLw/Oh7R7pguxjxE044iBH0IcN3EdKki0hEzprYhhSS xqLTzrCxToEcdwqBM+v/3BXAUCimoa7HXcXYluTf/zlreqxWtV0mR8Uk/ES4JRnox741O1 yp7nTJVliWpLEnEv/vJrp2rEjUNM/Gjh2oTHJjCu1ZmdOWlu7i/yKxMCQSCP7Hq7OPPTIE 9JGTVbNkqPgzXp4UrdihaKOTaXZ/Grm6S8WDedoMkbMRuQG2k2Vl5wIqR4p0rE6dUDqhUT yKrYzs4tTx+Wu2ednqhrURHHXY83qOUMNlaDgwmiuhTRAFW16R3DqJFf4Ru5GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737714301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fz6Gv/mKJldSvwB8GoqxQl0UB619Pdp0O/nEyaZKgoE=; b=HofCkRYGHxvlbBxmrDOyouYa11Ny3eBgXtLfT0j7vL8CUEGYu0X4PiJF50tDQlnaEUVPei 8jVXWJEfbG6objI2cVomkZD8nOn+Qq9U23g44moaKtT1QpDdqvSQSOhd11YFi6CF6+Si3d H4qrqhuQQqtV6/iBpC6c/MJpB6FivWqmwKsQcHHLEmwxXoBCdugPsQ/4KS/MRaZ+TaiSKf Lb/+U25HLRFpdy1Qr/ljRZzLj9DghFMowebLA+H1ZMcJ3dN1Lto6JLkTfFza4A45AFRclN jcH1fH58zD4aRw57RYqF39j3y4HKqtFjDEiajPANHXupudkR7NFbWgdENMe8xw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737714301; a=rsa-sha256; cv=none; b=UlNH9SQ0cFURVnRfjHgPCl0JxZsVcHqXB8l7crsAE2NU2n+yEVFgUR1++qoj3heMLX+mCr fP3luaArgvOFGkZoFWINUV/Tr42lzuAlMWX5D0nyOt1997/A0ZJklPqNdv/9mo5YmQENQ0 BTLDJM3ujd7617O/TSdL2TQAsfkLUnDu/doW6DDvvgvk7o+UDA7y3Sg2Df8OGcDt+iPacv wzIz6QV/DxvyBewmlGGXVinDTIcDJIhU61/+d2lOd3IV7c2I4Z+3hncmYaLi+7GU4YPdXE dCYx5FWeNQoCRzsd1BmwZbXxMTETXWY+yqpkNFqL+BDsjgdJMYYMc1rsEsI96A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfYpj5Pzmz5f7; Fri, 24 Jan 2025 10: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 50OAP1Qe038396; Fri, 24 Jan 2025 10: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 50OAP14W038393; Fri, 24 Jan 2025 10:25:01 GMT (envelope-from git) Date: Fri, 24 Jan 2025 10:25:01 GMT Message-Id: <202501241025.50OAP14W038393@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: af33f86e6aef - main - carp: don't unintentionally revert to multicast 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: af33f86e6aef6b15c8aa3da615167272aa7a3ee3 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=af33f86e6aef6b15c8aa3da615167272aa7a3ee3 commit af33f86e6aef6b15c8aa3da615167272aa7a3ee3 Author: Kristof Provost AuthorDate: 2025-01-21 09:49:55 +0000 Commit: Kristof Provost CommitDate: 2025-01-24 10:20:30 +0000 carp: don't unintentionally revert to multicast mode PR: 284140 MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/ifconfig/carp.c | 4 ---- tests/sys/netinet/carp.sh | 7 +++++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sbin/ifconfig/carp.c b/sbin/ifconfig/carp.c index 36b5d85ab7b8..7c7398f92d48 100644 --- a/sbin/ifconfig/carp.c +++ b/sbin/ifconfig/carp.c @@ -292,10 +292,6 @@ static struct afswtch af_carp = { static __constructor void carp_ctor(void) { - /* Default to multicast. */ - setcarp_mcast(NULL, NULL, 0); - setcarp_mcast6(NULL, NULL, 0); - for (size_t i = 0; i < nitems(carp_cmds); i++) cmd_register(&carp_cmds[i]); af_register(&af_carp); diff --git a/tests/sys/netinet/carp.sh b/tests/sys/netinet/carp.sh index 39cfad14907c..f9e47c70f492 100755 --- a/tests/sys/netinet/carp.sh +++ b/tests/sys/netinet/carp.sh @@ -202,8 +202,11 @@ unicast_v4_body() atf_check -s exit:0 -o ignore jexec carp_uni_v4_one \ ping -c 3 192.0.2.1 - jexec carp_uni_v4_two ifconfig - jexec carp_uni_v4_three ifconfig + # Check that we remain in unicast when tweaking settings + atf_check -s exit:0 -o ignore \ + jexec carp_uni_v4_two ifconfig ${epair_one}b vhid 1 advskew 2 + atf_check -s exit:0 -o match:"peer 198.51.100.130" \ + jexec carp_uni_v4_two ifconfig ${epair_one}b } unicast_v4_cleanup() From nobody Fri Jan 24 10:25:02 2025 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 4YfYpl3h7Sz5lC1x; Fri, 24 Jan 2025 10: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 4YfYpl1Th2z3t6h; Fri, 24 Jan 2025 10: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=1737714303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZJzBc7MWNUJhntcMos63TqZ7nNnBcgFa4QAJJGJG5h8=; b=dQXeQcRZOAmeaBulgSBLIQvJWiH+xskLFxwERfDiQWsgLEmkFuXrSulWx0Uy1LVt2oO7mE AbBXJzFcgFCX+7KZBDziPvM5V29cWM4eilKiNDcbxQWJr228KOBAtXmXMVXJavOBv3AjFx OwZqqmeAG9si5mdjogGgya6/zB6kX+cF0a/gP/6O0XDfW1fOL3UUIjD7IwMqucRV+x5Sx9 tOZ4cLBQky/xnMPXTx1qKNqIJ6DsuE62bmpkFVgA8GMCCgDHzQZIXJwa9V6MzCprfkTzEp 5P8gKFrzVtkqmSebGnVI60a1Z1mSkpWF9DxsHZkuIX8A50uOaqicDLgWg6W44w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737714303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZJzBc7MWNUJhntcMos63TqZ7nNnBcgFa4QAJJGJG5h8=; b=qEyE/45OYqwRHnF86K8QO9VHsFkpY7xP4h9v+2LMGi6/VIHJ3ogmbS0eVSRun+fVv5ZBjS 6RqcMKNGse3xrEAwIFhd/2nnMArgGXyUX7pKpROuLD91PVJRWwiB0Dp7A7ip1XVOShxzlL 8Sj8WmOmpqijZYaLt20XMd2sF9MxOV16iSWrlQJchVyD+51Q+o/zQVYdhDHk54t9+RAr/f hmadfXsjbh9wsc3E+3NJUPOKnK9UzcPxAQfiQfHT+VtYpmAov+eKXWS7VjF7+rzgOiNajn Iawy/vOBqk+xMEieeOggoiuoN5Jyh4qmCDEz1Blc2zEIsCyTjdR6SBYX4hSuTQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737714303; a=rsa-sha256; cv=none; b=pI0xy6EiUsT1EUiNmS7OfJSlt1Ap8j3O2JTFvkiVjrLQXSOlUmIKQwv1G6+21do63rg3Lx J+7IqDdCHj3L/3AxKN3pT4XwgL/YQF/NqlzSita0AO3JBYk97Y8liFnFfo9FWSrAEM+KAb GEuLtCRgzF78E/ypQeRt9qv2GgOUz9n/gNttVFvXBMDy5rbw+0gOwyJTgCMl6HupapQ4rC wsicNqzUmASr1CLTwrpNNuV6MVKPtrTZo5dxUcjVEVPeZBCI/LcI8phgV2PQfvxKP25hva xeK3em7T7SYTea8sMei4XWO7NdpPI6QJknqOYm/hH74qOYJgQjtja8nLO2X4vA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfYpk6hKlz5WN; Fri, 24 Jan 2025 10: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 50OAP2lX038430; Fri, 24 Jan 2025 10: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 50OAP2FP038427; Fri, 24 Jan 2025 10:25:02 GMT (envelope-from git) Date: Fri, 24 Jan 2025 10:25:02 GMT Message-Id: <202501241025.50OAP2FP038427@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: 899e79760dcc - main - pfctl: allow an implicit address family for af-to rules 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: 899e79760dcce8c9358caf2e2bddfe1ba3ad6dee Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=899e79760dcce8c9358caf2e2bddfe1ba3ad6dee commit 899e79760dcce8c9358caf2e2bddfe1ba3ad6dee Author: Kristof Provost AuthorDate: 2025-01-23 08:46:06 +0000 Commit: Kristof Provost CommitDate: 2025-01-24 10:20:30 +0000 pfctl: allow an implicit address family for af-to rules If the address family can be determined by the "from" or "to" parameter in the matching part, it is no longer necessary to specify "inet" or "inet6" there. OK henning@ mikeb@ Obtained from: OpenBSD, bluhm , ff33038bc1 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 17 +++++------------ sbin/pfctl/tests/files/pf1025.in | 1 + sbin/pfctl/tests/files/pf1025.ok | 1 + sbin/pfctl/tests/pfctl_test_list.inc | 1 + 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index e66d3cdd295e..ab74d2dd57ab 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -2422,19 +2422,8 @@ pfrule : action dir logquick interface route af proto fromto r.scrub_flags |= PFSTATE_SETPRIO; } - if ($9.marker & FOM_AFTO) { - if (!$6) { - yyerror("must indicate source address " - "family with af-to"); - YYERROR; - } - if ($6 == $9.nat.af) { - yyerror("incorrect address family " - "translation"); - YYERROR; - } + if ($9.marker & FOM_AFTO) r.rule_flag |= PFRULE_AFTO; - } r.af = $6; if ($9.tag) @@ -5465,6 +5454,10 @@ filter_consistent(struct pfctl_rule *r, int anchor_call) yyerror("must indicate address family with icmp-type/code"); problems++; } + if (r->rule_flag & PFRULE_AFTO && r->af == r->naf) { + yyerror("must indicate different address family with af-to"); + problems++; + } if (r->overload_tblname[0] && r->max_src_conn == 0 && r->max_src_conn_rate.seconds == 0) { yyerror("'overload' requires 'max-src-conn' " diff --git a/sbin/pfctl/tests/files/pf1025.in b/sbin/pfctl/tests/files/pf1025.in new file mode 100644 index 000000000000..d4ad821a6899 --- /dev/null +++ b/sbin/pfctl/tests/files/pf1025.in @@ -0,0 +1 @@ +pass in from 10.0.0.0/8 af-to inet6 from 2001:db8::1 diff --git a/sbin/pfctl/tests/files/pf1025.ok b/sbin/pfctl/tests/files/pf1025.ok new file mode 100644 index 000000000000..8f48c987c6a0 --- /dev/null +++ b/sbin/pfctl/tests/files/pf1025.ok @@ -0,0 +1 @@ +pass in inet from 10.0.0.0/8 to any flags S/SA keep state af-to inet6 from 2001:db8::1 diff --git a/sbin/pfctl/tests/pfctl_test_list.inc b/sbin/pfctl/tests/pfctl_test_list.inc index 62bb87e680d8..0a523386c16c 100644 --- a/sbin/pfctl/tests/pfctl_test_list.inc +++ b/sbin/pfctl/tests/pfctl_test_list.inc @@ -133,3 +133,4 @@ PFCTL_TEST(1021, "Endpoint-independent") PFCTL_TEST(1022, "Test received-on") PFCTL_TEST(1023, "Test match log(matches)") PFCTL_TEST(1024, "nat64") +PFCTL_TEST(1025, "nat64 with implicit address family") From nobody Fri Jan 24 10:25:03 2025 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 4YfYpm3RpRz5lC6s; Fri, 24 Jan 2025 10: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 4YfYpm14CYz3tRm; Fri, 24 Jan 2025 10: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=1737714304; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OmH2TApBYr2cvIXA1GaZW5EjxyW8SVn0jsESNDM+Qyo=; b=So7o0DFJwYn5KcfWZM3GJ/srK2w4SRNXHHILhxdztnNnClK3Vnz+E1vVnZJGSjNNY3jZLV 1LZqhflTFqbcIsVaNKvn5xVJWUl3StOvRzqTV8IE8YiSwHSp67PMwa2TZpXVWqxoIGo8Xd 5t8JhvLU9a0z8w5gDATQMSZG1dxKrzWjOCALj4GHRB4inLVYtsPvaMwghVh4BWT+kLQDh2 XUH60LVovfEdJcptf4J2ugGV567F6UM2I0Cpuyah1pHNgUhUNwjdMTV+VqLDYSYn5OALJF kLQKSuXiitj5WhlX9tA78gkiwRJolHm6GaGvW95Fae6nb4BMup2hc7U4ZNvzwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737714304; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OmH2TApBYr2cvIXA1GaZW5EjxyW8SVn0jsESNDM+Qyo=; b=bfUqkR7g+ZVkfBEUeQHopwQ9Q0qqT0PWVBzidlbbdLvr4ZgAWj8jJ9ChHLTrhKfAQ1pUbC TZ5EpagSV5ySSXefYQVq+Vosawc1xhmD8CJlL4vd0aULClzkzkHMP848CLU0CtevfBfvxd s4Qb1y3xz/ZhcHOHxoGCcJJ30QdawnC6p1LSMfE5nhtfi34d1To557aZVnmYZsj9HBsCsb peMPxoDT0VBLm+lETqr1k11YHCoeyB4kaN/VjRB7nq2Q12k9TSvQdgzJYrsjKUAZCgB2Zd eaiaeUousm5/lUS6FlR6Q3mcuwf8vXPLMiogzh4h7ZaUQ83NnPDmIhP2cuNV+A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737714304; a=rsa-sha256; cv=none; b=D6o33OwFDteiu4Cga9wC+mRv7EUYCabyAFopV9cqIzAr6VZoR9yiYYF4JDU2jBjh7wc4H5 IJ6SULK+Le2zTdRo5M7sdkwEiAB3hQ4nG9M5h3E/GPPlVygU4NhOS2RbhayAABcawQldwt Mfqz3RWmIkM7MXNYHgd4Km/z73iCt/dOd6uN7Qg+nJ8Pxx8lhIDyS3VeFj9jXKdpw5rGkK H3qYThnfzVrX08dq2gtuGSotwQdGR5CL322olSk5TY8AQYKEVh1UAO4ceGvSSfserD6375 yb3FS5QwJ1oSr4wJjJLsllJSZoRxwjozs6rBZGCVgDMj6O6qFu2iW1L0dqx23A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfYpm0QRXz5qP; Fri, 24 Jan 2025 10: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 50OAP3YY038465; Fri, 24 Jan 2025 10: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 50OAP3gf038462; Fri, 24 Jan 2025 10:25:03 GMT (envelope-from git) Date: Fri, 24 Jan 2025 10:25:03 GMT Message-Id: <202501241025.50OAP3gf038462@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: 0972294ef034 - main - pf: add a dedicated pf pool for route options 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: 0972294ef034d92f59857b8312dd2e1e3a7adc9c Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0972294ef034d92f59857b8312dd2e1e3a7adc9c commit 0972294ef034d92f59857b8312dd2e1e3a7adc9c Author: Kristof Provost AuthorDate: 2025-01-20 17:25:37 +0000 Commit: Kristof Provost CommitDate: 2025-01-24 10:20:30 +0000 pf: add a dedicated pf pool for route options As suggested by henning. Which unbreaks ie route-to after the recent pf changes. With much help debugging and pointing out of missing bits from claudio@ ok claudio@ "looks good" henning@ Obtained from: OpenBSD, jsg , 7fa5c09028 Sponsored by: Rubicon Communications, LLC ("Netgate") --- lib/libpfctl/libpfctl.c | 2 + lib/libpfctl/libpfctl.h | 1 + sbin/pfctl/parse.y | 95 +++++++++++++++++++++++++++------------------ sbin/pfctl/pfctl.c | 16 ++++++++ sbin/pfctl/pfctl_optimize.c | 7 ++++ sbin/pfctl/pfctl_parser.c | 1 + sys/net/pfvar.h | 3 +- sys/netpfil/pf/if_pfsync.c | 8 +++- sys/netpfil/pf/pf.c | 11 +++++- sys/netpfil/pf/pf.h | 2 +- sys/netpfil/pf/pf_ioctl.c | 53 +++++++++++++++++++------ sys/netpfil/pf/pf_nl.c | 2 + sys/netpfil/pf/pf_nl.h | 1 + 13 files changed, 147 insertions(+), 55 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index f0708c8f0439..2297b24d37a0 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -1227,6 +1227,7 @@ snl_add_msg_attr_pf_rule(struct snl_writer *nw, uint32_t type, const struct pfct snl_add_msg_attr_string(nw, PF_RT_OVERLOAD_TBLNAME, r->overload_tblname); snl_add_msg_attr_rpool(nw, PF_RT_RPOOL_RDR, &r->rdr); snl_add_msg_attr_rpool(nw, PF_RT_RPOOL_NAT, &r->nat); + snl_add_msg_attr_rpool(nw, PF_RT_RPOOL_RT, &r->route); snl_add_msg_attr_u32(nw, PF_RT_OS_FINGERPRINT, r->os_fingerprint); snl_add_msg_attr_u32(nw, PF_RT_RTABLEID, r->rtableid); snl_add_msg_attr_timeouts(nw, PF_RT_TIMEOUT, r->timeout); @@ -1661,6 +1662,7 @@ static struct snl_attr_parser ap_getrule[] = { { .type = PF_RT_MAX_SRC_CONN, .off = _OUT(r.max_src_conn), .cb = snl_attr_get_uint32 }, { .type = PF_RT_RPOOL_NAT, .off = _OUT(r.nat), .arg = &pool_parser, .cb = snl_attr_get_nested }, { .type = PF_RT_NAF, .off = _OUT(r.naf), .cb = snl_attr_get_uint8 }, + { .type = PF_RT_RPOOL_RT, .off = _OUT(r.route), .arg = &pool_parser, .cb = snl_attr_get_nested }, }; #undef _OUT SNL_DECLARE_PARSER(getrule_parser, struct genlmsghdr, snl_f_p_empty, ap_getrule); diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 14ea06fd151a..2532894ffa21 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -180,6 +180,7 @@ struct pfctl_rule { struct pfctl_pool rpool; struct pfctl_pool rdr; }; + struct pfctl_pool route; uint64_t evaluations; uint64_t packets[2]; diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index ab74d2dd57ab..830581c57f9c 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -304,6 +304,7 @@ static struct filter_opts { } divert; struct redirspec nat; struct redirspec rdr; + struct redirspec rroute; /* new-style scrub opts */ int nodf; int minttl; @@ -382,11 +383,12 @@ void expand_eth_rule(struct pfctl_eth_rule *, struct node_host *, struct node_host *, const char *, const char *); void expand_rule(struct pfctl_rule *, struct node_if *, - struct redirspec *, struct redirspec *, struct node_host *, - struct node_host *, struct node_proto *, struct node_os *, - struct node_host *, struct node_port *, struct node_host *, - struct node_port *, struct node_uid *, struct node_gid *, - struct node_if *, struct node_icmp *, const char *); + struct redirspec *, struct redirspec *, struct redirspec *, + struct node_host *, struct node_host *, struct node_host *, + struct node_proto *, struct node_os *, struct node_host *, + struct node_port *, struct node_host *, struct node_port *, + struct node_uid *, struct node_gid *, struct node_if *, + struct node_icmp *, const char *); int expand_altq(struct pf_altq *, struct node_if *, struct node_queue *, struct node_queue_bw bwspec, struct node_queue_opt *); @@ -1080,9 +1082,9 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto decide_address_family($8.src.host, &r.af); decide_address_family($8.dst.host, &r.af); - expand_rule(&r, $5, NULL, NULL, NULL, NULL, $7, $8.src_os, - $8.src.host, $8.src.port, $8.dst.host, $8.dst.port, - $9.uid, $9.gid, $9.rcv, $9.icmpspec, + expand_rule(&r, $5, NULL, NULL, NULL, NULL, NULL, NULL, + $7, $8.src_os, $8.src.host, $8.src.port, $8.dst.host, + $8.dst.port, $9.uid, $9.gid, $9.rcv, $9.icmpspec, pf->astack[pf->asd + 1] ? pf->alast->name : $2); free($2); pf->astack[pf->asd + 1] = NULL; @@ -1103,9 +1105,9 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto decide_address_family($6.src.host, &r.af); decide_address_family($6.dst.host, &r.af); - expand_rule(&r, $3, NULL, NULL, NULL, NULL, $5, $6.src_os, - $6.src.host, $6.src.port, $6.dst.host, $6.dst.port, - 0, 0, 0, 0, $2); + expand_rule(&r, $3, NULL, NULL, NULL, NULL, NULL, NULL, + $5, $6.src_os, $6.src.host, $6.src.port, $6.dst.host, + $6.dst.port, 0, 0, 0, 0, $2); free($2); } | RDRANCHOR string interface af proto fromto rtable { @@ -1145,9 +1147,9 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto r.dst.port_op = $6.dst.port->op; } - expand_rule(&r, $3, NULL, NULL, NULL, NULL, $5, $6.src_os, - $6.src.host, $6.src.port, $6.dst.host, $6.dst.port, - 0, 0, 0, 0, $2); + expand_rule(&r, $3, NULL, NULL, NULL, NULL, NULL, NULL, + $5, $6.src_os, $6.src.host, $6.src.port, $6.dst.host, + $6.dst.port, 0, 0, 0, 0, $2); free($2); } | BINATANCHOR string interface af proto fromto rtable { @@ -1468,9 +1470,9 @@ scrubrule : scrubaction dir logquick interface af proto fromto scrub_opts r.match_tag_not = $8.match_tag_not; r.rtableid = $8.rtableid; - expand_rule(&r, $4, NULL, NULL, NULL, NULL, $6, $7.src_os, - $7.src.host, $7.src.port, $7.dst.host, $7.dst.port, - NULL, NULL, NULL, NULL, ""); + expand_rule(&r, $4, NULL, NULL, NULL, NULL, NULL, NULL, + $6, $7.src_os, $7.src.host, $7.src.port, $7.dst.host, + $7.dst.port, NULL, NULL, NULL, NULL, ""); } ; @@ -1633,8 +1635,8 @@ antispoof : ANTISPOOF logquick antispoof_ifspc af antispoof_opts { } if (h != NULL) - expand_rule(&r, j, NULL, NULL, NULL, NULL, NULL, NULL, h, - NULL, NULL, NULL, NULL, NULL, + expand_rule(&r, j, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, h, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ""); if ((i->ifa_flags & IFF_LOOPBACK) == 0) { @@ -1656,7 +1658,7 @@ antispoof : ANTISPOOF logquick antispoof_ifspc af antispoof_opts { h = ifa_lookup(i->ifname, 0); if (h != NULL) expand_rule(&r, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, h, NULL, NULL, + NULL, NULL, NULL, NULL, h, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ""); } else free(hh); @@ -2726,9 +2728,9 @@ pfrule : action dir logquick interface route af proto fromto YYERROR; } r.rt = $5.rt; - r.rdr.opts = $5.pool_opts; + r.route.opts = $5.pool_opts; if ($5.key != NULL) - memcpy(&r.rdr.key, $5.key, + memcpy(&r.route.key, $5.key, sizeof(struct pf_poolhashkey)); } if (r.rt) { @@ -2739,26 +2741,26 @@ pfrule : action dir logquick interface route af proto fromto "matching address family found."); YYERROR; } - if ((r.rdr.opts & PF_POOL_TYPEMASK) == + if ((r.route.opts & PF_POOL_TYPEMASK) == PF_POOL_NONE && ($5.host->next != NULL || $5.host->addr.type == PF_ADDR_TABLE || DYNIF_MULTIADDR($5.host->addr))) - r.rdr.opts |= PF_POOL_ROUNDROBIN; - if ((r.rdr.opts & PF_POOL_TYPEMASK) != + r.route.opts |= PF_POOL_ROUNDROBIN; + if ((r.route.opts & PF_POOL_TYPEMASK) != PF_POOL_ROUNDROBIN && disallow_table($5.host, "tables are only " "supported in round-robin routing pools")) YYERROR; - if ((r.rdr.opts & PF_POOL_TYPEMASK) != + if ((r.route.opts & PF_POOL_TYPEMASK) != PF_POOL_ROUNDROBIN && disallow_alias($5.host, "interface (%s) " "is only supported in round-robin " "routing pools")) YYERROR; if ($5.host->next != NULL) { - if ((r.rdr.opts & PF_POOL_TYPEMASK) != + if ((r.route.opts & PF_POOL_TYPEMASK) != PF_POOL_ROUNDROBIN) { - yyerror("r.rdr.opts must " + yyerror("r.route.opts must " "be PF_POOL_ROUNDROBIN"); YYERROR; } @@ -2833,7 +2835,8 @@ pfrule : action dir logquick interface route af proto fromto YYERROR; } - expand_rule(&r, $4, &$9.nat, &$9.rdr, $5.host, $9.nat.rdr ? $9.nat.rdr->host : NULL, + expand_rule(&r, $4, &$9.nat, &$9.rdr, &$9.rroute, + NULL, $9.nat.rdr ? $9.nat.rdr->host : NULL, $5.host, $7, $8.src_os, $8.src.host, $8.src.port, $8.dst.host, $8.dst.port, $9.uid, $9.gid, $9.rcv, $9.icmpspec, ""); } @@ -4989,8 +4992,9 @@ natrule : nataction interface af proto fromto tag tagged rtable o = o->next; } - expand_rule(&r, $2, NULL, NULL, $9 == NULL ? NULL : $9->host, - NULL, $4, $5.src_os, $5.src.host, $5.src.port, $5.dst.host, + expand_rule(&r, $2, NULL, NULL, NULL, + $9 == NULL ? NULL : $9->host, NULL, NULL, $4, + $5.src_os, $5.src.host, $5.src.port, $5.dst.host, $5.dst.port, 0, 0, 0, 0, ""); free($9); } @@ -6149,13 +6153,13 @@ expand_eth_rule(struct pfctl_eth_rule *r, void expand_rule(struct pfctl_rule *r, struct node_if *interfaces, struct redirspec *nat, - struct redirspec *rdr, struct node_host *rdr_hosts, - struct node_host *nat_hosts, - struct node_proto *protos, struct node_os *src_oses, - struct node_host *src_hosts, struct node_port *src_ports, - struct node_host *dst_hosts, struct node_port *dst_ports, - struct node_uid *uids, struct node_gid *gids, struct node_if *rcv, - struct node_icmp *icmp_types, const char *anchor_call) + struct redirspec *rdr, struct redirspec *route, + struct node_host *rdr_hosts, struct node_host *nat_hosts, + struct node_host *route_hosts, struct node_proto *protos, + struct node_os *src_oses, struct node_host *src_hosts, + struct node_port *src_ports, struct node_host *dst_hosts, + struct node_port *dst_ports, struct node_uid *uids, struct node_gid *gids, + struct node_if *rcv, struct node_icmp *icmp_types, const char *anchor_call) { sa_family_t af = r->af; int added = 0, error = 0; @@ -6331,6 +6335,21 @@ expand_rule(struct pfctl_rule *r, pa->ifname[0] = 0; TAILQ_INSERT_TAIL(&r->nat.list, pa, entries); } + TAILQ_INIT(&r->route.list); + for (h = route_hosts; h != NULL; h = h->next) { + pa = calloc(1, sizeof(struct pf_pooladdr)); + if (pa == NULL) + err(1, "expand_rule: calloc"); + pa->addr = h->addr; + if (h->ifname != NULL) { + if (strlcpy(pa->ifname, h->ifname, + sizeof(pa->ifname)) >= + sizeof(pa->ifname)) + errx(1, "expand_rule: strlcpy"); + } else + pa->ifname[0] = 0; + TAILQ_INSERT_TAIL(&r->route.list, pa, entries); + } r->nat.proxy_port[0] = PF_NAT_PROXY_PORT_LOW; r->nat.proxy_port[1] = PF_NAT_PROXY_PORT_HIGH; diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 7b54bc1c7c7a..ec07a5da999c 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1310,6 +1310,10 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, nr, ri.ticket, PF_SCRUB, path, PF_NAT) != 0) goto error; + if (pfctl_get_pool(dev, &rule.route, + nr, ri.ticket, PF_SCRUB, path, PF_RT) != 0) + goto error; + switch (format) { case PFCTL_SHOW_LABELS: break; @@ -1325,6 +1329,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, } pfctl_clear_pool(&rule.rdr); pfctl_clear_pool(&rule.nat); + pfctl_clear_pool(&rule.route); } ret = pfctl_get_rules_info_h(pfh, &ri, PF_PASS, path); if (ret != 0) { @@ -1346,6 +1351,10 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, nr, ri.ticket, PF_PASS, path, PF_NAT) != 0) goto error; + if (pfctl_get_pool(dev, &rule.route, + nr, ri.ticket, PF_PASS, path, PF_RT) != 0) + goto error; + switch (format) { case PFCTL_SHOW_LABELS: { bool show = false; @@ -1506,6 +1515,9 @@ pfctl_show_nat(int dev, char *path, int opts, char *anchorname, int depth, if (pfctl_get_pool(dev, &rule.nat, nr, ri.ticket, nattype[i], path, PF_NAT) != 0) return (-1); + if (pfctl_get_pool(dev, &rule.route, nr, + ri.ticket, nattype[i], path, PF_RT) != 0) + return (-1); if (dotitle) { pfctl_print_title("TRANSLATION RULES:"); @@ -1761,6 +1773,8 @@ pfctl_append_rule(struct pfctl *pf, struct pfctl_rule *r, pfctl_move_pool(&r->rdr, &rule->rdr); TAILQ_INIT(&rule->nat.list); pfctl_move_pool(&r->nat, &rule->nat); + TAILQ_INIT(&rule->route.list); + pfctl_move_pool(&r->route, &rule->route); TAILQ_INSERT_TAIL(rs->rules[rs_num].active.ptr, rule, entries); return (0); @@ -2065,6 +2079,8 @@ pfctl_load_rule(struct pfctl *pf, char *path, struct pfctl_rule *r, int depth) return (1); if (pfctl_add_pool(pf, &r->nat, r->naf ? r->naf : r->af, PF_NAT)) return (1); + if (pfctl_add_pool(pf, &r->route, r->af, PF_RT)) + return (1); error = pfctl_add_rule_h(pf->h, r, anchor, name, ticket, pf->paddr.ticket); switch (error) { diff --git a/sbin/pfctl/pfctl_optimize.c b/sbin/pfctl/pfctl_optimize.c index a97664e0c929..7817bcfd284a 100644 --- a/sbin/pfctl/pfctl_optimize.c +++ b/sbin/pfctl/pfctl_optimize.c @@ -137,6 +137,7 @@ static struct pf_rule_field { PF_RULE_FIELD(flush, BREAK), PF_RULE_FIELD(rdr, BREAK), PF_RULE_FIELD(nat, BREAK), + PF_RULE_FIELD(route, BREAK), PF_RULE_FIELD(logif, BREAK), /* @@ -303,6 +304,12 @@ pfctl_optimize_ruleset(struct pfctl *pf, struct pfctl_ruleset *rs) } else bzero(&por->por_rule.nat, sizeof(por->por_rule.nat)); + if (TAILQ_FIRST(&r->route.list) != NULL) { + TAILQ_INIT(&por->por_rule.route.list); + pfctl_move_pool(&r->route, &por->por_rule.route); + } else + bzero(&por->por_rule.route, + sizeof(por->por_rule.route)); TAILQ_INSERT_TAIL(&opt_queue, por, por_entry); } diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 85f1797e58e1..df76f8312cf3 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -943,6 +943,7 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer printf(" dup-to"); printf(" "); print_pool(&r->rdr, 0, 0, r->af, PF_PASS); + print_pool(&r->route, 0, 0, r->af, PF_PASS); } if (r->af) { if (r->af == AF_INET) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 6e9418f59aef..e50fbc96a8ba 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -787,6 +787,7 @@ struct pf_krule { TAILQ_ENTRY(pf_krule) entries; struct pf_kpool nat; struct pf_kpool rdr; + struct pf_kpool route; struct pf_counter_u64 evaluations; struct pf_counter_u64 packets[2]; @@ -2217,7 +2218,7 @@ VNET_DECLARE(struct unrhdr64, pf_stateid); TAILQ_HEAD(pf_altqqueue, pf_altq); VNET_DECLARE(struct pf_altqqueue, pf_altqs[4]); #define V_pf_altqs VNET(pf_altqs) -VNET_DECLARE(struct pf_kpalist, pf_pabuf[2]); +VNET_DECLARE(struct pf_kpalist, pf_pabuf[3]); #define V_pf_pabuf VNET(pf_pabuf) VNET_DECLARE(u_int32_t, ticket_altqs_active); diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 60bfb05d1570..98a2367b79b0 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -574,6 +574,12 @@ pfsync_state_import(union pfsync_state_union *sp, int flags, int msg_version) * from the local ruleset. */ if (r != &V_pf_default_rule) { + struct pf_kpool *pool = &r->route; + + /* Backwards compatibility. */ + if (TAILQ_EMPTY(&pool->list)) + pool = &r->rdr; + /* * The ruleset is identical, try to recover. If the rule * has a redirection pool with a single interface, there @@ -582,7 +588,7 @@ pfsync_state_import(union pfsync_state_union *sp, int flags, int msg_version) * give up, as we can't be sure that we will pick the * same one as the pfsync peer did. */ - rpool_first = TAILQ_FIRST(&(r->rdr.list)); + rpool_first = TAILQ_FIRST(&(pool->list)); if ((rpool_first == NULL) || (TAILQ_NEXT(rpool_first, entries) != NULL)) { DPFPRINTF(PF_DEBUG_MISC, diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 83eca735d2bb..00d6583234c7 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -164,7 +164,7 @@ SDT_PROBE_DEFINE2(pf, purge, state, rowcount, "int", "size_t"); /* state tables */ VNET_DEFINE(struct pf_altqqueue, pf_altqs[4]); -VNET_DEFINE(struct pf_kpalist, pf_pabuf[2]); +VNET_DEFINE(struct pf_kpalist, pf_pabuf[3]); VNET_DEFINE(struct pf_altqqueue *, pf_altqs_active); VNET_DEFINE(struct pf_altqqueue *, pf_altq_ifs_active); VNET_DEFINE(struct pf_altqqueue *, pf_altqs_inactive); @@ -1267,6 +1267,7 @@ pf_initialize(void) TAILQ_INIT(&V_pf_altqs[3]); TAILQ_INIT(&V_pf_pabuf[0]); TAILQ_INIT(&V_pf_pabuf[1]); + TAILQ_INIT(&V_pf_pabuf[2]); V_pf_altqs_active = &V_pf_altqs[0]; V_pf_altq_ifs_active = &V_pf_altqs[1]; V_pf_altqs_inactive = &V_pf_altqs[2]; @@ -5900,6 +5901,12 @@ nextrule: if (r->rt) { struct pf_ksrc_node *sn = NULL; struct pf_srchash *snh = NULL; + struct pf_kpool *pool = &r->route; + + /* Backwards compatibility. */ + if (TAILQ_EMPTY(&pool->list)) + pool = &r->rdr; + /* * Set act.rt here instead of in pf_rule_to_actions() because * it is applied only from the last pass rule. @@ -5907,7 +5914,7 @@ nextrule: pd->act.rt = r->rt; /* Don't use REASON_SET, pf_map_addr increases the reason counters */ reason = pf_map_addr_sn(pd->af, r, pd->src, &pd->act.rt_addr, - &pd->act.rt_kif, NULL, &sn, &snh, &r->rdr); + &pd->act.rt_kif, NULL, &sn, &snh, pool); if (reason != 0) goto cleanup; } diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 5de85c1fe7ef..24249ead6ba2 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -49,7 +49,7 @@ enum { PF_INOUT, PF_IN, PF_OUT }; enum { PF_PASS, PF_DROP, PF_SCRUB, PF_NOSCRUB, PF_NAT, PF_NONAT, PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER, - PF_MATCH, PF_AFRT }; + PF_MATCH, PF_AFRT, PF_RT }; enum { PF_RULESET_SCRUB, PF_RULESET_FILTER, PF_RULESET_NAT, PF_RULESET_BINAT, PF_RULESET_RDR, PF_RULESET_MAX }; enum { PF_OP_NONE, PF_OP_IRG, PF_OP_EQ, PF_OP_NE, PF_OP_LT, diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index d206a9f8da43..340e7c25a501 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -436,7 +436,7 @@ pf_get_kpool(const char *anchor, u_int32_t ticket, u_int8_t rule_action, struct pf_krule *rule; int rs_num; - MPASS(which == PF_RDR || which == PF_NAT); + MPASS(which == PF_RDR || which == PF_NAT || which == PF_RT); ruleset = pf_find_kruleset(anchor); if (ruleset == NULL) @@ -470,10 +470,16 @@ pf_get_kpool(const char *anchor, u_int32_t ticket, u_int8_t rule_action, if (rule == NULL) return (NULL); - if (which == PF_NAT) - return (&rule->nat); - else + switch (which) { + case PF_RDR: return (&rule->rdr); + case PF_NAT: + return (&rule->nat); + case PF_RT: + return (&rule->route); + default: + panic("Unknow pool type %d", which); + } } static void @@ -612,6 +618,7 @@ pf_free_rule(struct pf_krule *rule) pf_kanchor_remove(rule); pf_empty_kpool(&rule->rdr.list); pf_empty_kpool(&rule->nat.list); + pf_empty_kpool(&rule->route.list); pf_krule_free(rule); } @@ -1832,6 +1839,7 @@ pf_krule_alloc(void) rule = malloc(sizeof(struct pf_krule), M_PFRULE, M_WAITOK | M_ZERO); mtx_init(&rule->nat.mtx, "pf_krule_nat_pool", NULL, MTX_DEF); mtx_init(&rule->rdr.mtx, "pf_krule_rdr_pool", NULL, MTX_DEF); + mtx_init(&rule->route.mtx, "pf_krule_route_pool", NULL, MTX_DEF); rule->timestamp = uma_zalloc_pcpu(pf_timestamp_pcpu_zone, M_WAITOK | M_ZERO); return (rule); @@ -1871,6 +1879,7 @@ pf_krule_free(struct pf_krule *rule) mtx_destroy(&rule->nat.mtx); mtx_destroy(&rule->rdr.mtx); + mtx_destroy(&rule->route.mtx); free(rule, M_PFRULE); } @@ -2106,6 +2115,7 @@ pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, rule->cpid = pid; TAILQ_INIT(&rule->rdr.list); TAILQ_INIT(&rule->nat.list); + TAILQ_INIT(&rule->route.list); PF_CONFIG_LOCK(); PF_RULES_WLOCK(); @@ -2203,7 +2213,7 @@ pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, (rule->set_prio[0] > PF_PRIO_MAX || rule->set_prio[1] > PF_PRIO_MAX)) error = EINVAL; - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 3; i++) { TAILQ_FOREACH(pa, &V_pf_pabuf[i], entries) if (pa->addr.type == PF_ADDR_TABLE) { pa->addr.p.tbl = pfr_attach_table(ruleset, @@ -2225,10 +2235,12 @@ pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, pf_mv_kpool(&V_pf_pabuf[0], &rule->nat.list); pf_mv_kpool(&V_pf_pabuf[1], &rule->rdr.list); + pf_mv_kpool(&V_pf_pabuf[2], &rule->route.list); if (((((rule->action == PF_NAT) || (rule->action == PF_RDR) || (rule->action == PF_BINAT)) && rule->anchor == NULL) || (rule->rt > PF_NOPFROUTE)) && - (TAILQ_FIRST(&rule->rdr.list) == NULL)) + (TAILQ_FIRST(&rule->rdr.list) == NULL && + TAILQ_FIRST(&rule->route.list) == NULL)) error = EINVAL; if (rule->action == PF_PASS && rule->rdr.opts & PF_POOL_STICKYADDR && @@ -2244,6 +2256,7 @@ pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, rule->nat.cur = TAILQ_FIRST(&rule->nat.list); rule->rdr.cur = TAILQ_FIRST(&rule->rdr.list); + rule->route.cur = TAILQ_FIRST(&rule->route.list); TAILQ_INSERT_TAIL(ruleset->rules[rs_num].inactive.ptr, rule, entries); ruleset->rules[rs_num].inactive.rcount++; @@ -2553,6 +2566,7 @@ pf_ioctl_begin_addrs(uint32_t *ticket) PF_RULES_WLOCK(); pf_empty_kpool(&V_pf_pabuf[0]); pf_empty_kpool(&V_pf_pabuf[1]); + pf_empty_kpool(&V_pf_pabuf[2]); *ticket = ++V_ticket_pabuf; PF_RULES_WUNLOCK(); @@ -2566,7 +2580,8 @@ pf_ioctl_add_addr(struct pf_nl_pooladdr *pp) struct pfi_kkif *kif = NULL; int error; - if (pp->which != PF_RDR && pp->which != PF_NAT) + if (pp->which != PF_RDR && pp->which != PF_NAT && + pp->which != PF_RT) return (EINVAL); #ifndef INET @@ -2613,8 +2628,17 @@ pf_ioctl_add_addr(struct pf_nl_pooladdr *pp) PF_RULES_WUNLOCK(); goto out; } - TAILQ_INSERT_TAIL(&V_pf_pabuf[pp->which == PF_RDR ? 1 : 0], - pa, entries); + switch (pp->which) { + case PF_NAT: + TAILQ_INSERT_TAIL(&V_pf_pabuf[0], pa, entries); + break; + case PF_RDR: + TAILQ_INSERT_TAIL(&V_pf_pabuf[1], pa, entries); + break; + case PF_RT: + TAILQ_INSERT_TAIL(&V_pf_pabuf[2], pa, entries); + break; + } PF_RULES_WUNLOCK(); return (0); @@ -2632,7 +2656,8 @@ pf_ioctl_get_addrs(struct pf_nl_pooladdr *pp) PF_RULES_RLOCK_TRACKER; - if (pp->which != PF_RDR && pp->which != PF_NAT) + if (pp->which != PF_RDR && pp->which != PF_NAT && + pp->which != PF_RT) return (EINVAL); pp->anchor[sizeof(pp->anchor) - 1] = 0; @@ -2659,7 +2684,8 @@ pf_ioctl_get_addr(struct pf_nl_pooladdr *pp) struct pf_kpooladdr *pa; u_int32_t nr = 0; - if (pp->which != PF_RDR && pp->which != PF_NAT) + if (pp->which != PF_RDR && pp->which != PF_NAT && + pp->which != PF_RT) return (EINVAL); PF_RULES_RLOCK_TRACKER; @@ -3652,6 +3678,7 @@ DIOCGETRULENV_error: newrule->cpid = td->td_proc ? td->td_proc->p_pid : 0; TAILQ_INIT(&newrule->nat.list); TAILQ_INIT(&newrule->rdr.list); + TAILQ_INIT(&newrule->route.list); } #define ERROUT(x) ERROUT_IOCTL(DIOCCHANGERULE_error, x) @@ -3748,7 +3775,7 @@ DIOCGETRULENV_error: error = ENOMEM; if (pf_kanchor_setup(newrule, ruleset, pcr->anchor_call)) error = EINVAL; - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 3; i++) { TAILQ_FOREACH(pa, &V_pf_pabuf[i], entries) if (pa->addr.type == PF_ADDR_TABLE) { pa->addr.p.tbl = @@ -3772,6 +3799,7 @@ DIOCGETRULENV_error: pf_mv_kpool(&V_pf_pabuf[0], &newrule->nat.list); pf_mv_kpool(&V_pf_pabuf[1], &newrule->rdr.list); + pf_mv_kpool(&V_pf_pabuf[2], &newrule->route.list); if (((((newrule->action == PF_NAT) || (newrule->action == PF_RDR) || (newrule->action == PF_BINAT) || @@ -3792,6 +3820,7 @@ DIOCGETRULENV_error: } pf_empty_kpool(&V_pf_pabuf[0]); pf_empty_kpool(&V_pf_pabuf[1]); + pf_empty_kpool(&V_pf_pabuf[2]); if (pcr->action == PF_CHANGE_ADD_HEAD) oldrule = TAILQ_FIRST( diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c index 3e7a6965d387..c0f722b1fd18 100644 --- a/sys/netpfil/pf/pf_nl.c +++ b/sys/netpfil/pf/pf_nl.c @@ -736,6 +736,7 @@ static const struct nlattr_parser nla_p_rule[] = { { .type = PF_RT_MAX_SRC_CONN, .off = _OUT(max_src_conn), .cb = nlattr_get_uint32 }, { .type = PF_RT_RPOOL_NAT, .off = _OUT(nat), .arg = &pool_parser, .cb = nlattr_get_nested }, { .type = PF_RT_NAF, .off = _OUT(naf), .cb = nlattr_get_uint8 }, + { .type = PF_RT_RPOOL_RT, .off = _OUT(route), .arg = &pool_parser, .cb = nlattr_get_nested }, }; NL_DECLARE_ATTR_PARSER(rule_parser, nla_p_rule); #undef _OUT @@ -909,6 +910,7 @@ pf_handle_getrule(struct nlmsghdr *hdr, struct nl_pstate *npt) nlattr_add_string(nw, PF_RT_OVERLOAD_TBLNAME, rule->overload_tblname); nlattr_add_pool(nw, PF_RT_RPOOL_RDR, &rule->rdr); nlattr_add_pool(nw, PF_RT_RPOOL_NAT, &rule->nat); + nlattr_add_pool(nw, PF_RT_RPOOL_RT, &rule->route); nlattr_add_u32(nw, PF_RT_OS_FINGERPRINT, rule->os_fingerprint); nlattr_add_u32(nw, PF_RT_RTABLEID, rule->rtableid); nlattr_add_timeout(nw, PF_RT_TIMEOUT, rule->timeout); diff --git a/sys/netpfil/pf/pf_nl.h b/sys/netpfil/pf/pf_nl.h index 8c0149891773..d749ef3ab99e 100644 --- a/sys/netpfil/pf/pf_nl.h +++ b/sys/netpfil/pf/pf_nl.h @@ -267,6 +267,7 @@ enum pf_rule_type_t { PF_RT_MAX_SRC_CONN = 74, /* u32 */ PF_RT_RPOOL_NAT = 75, /* nested, pf_rpool_type_t */ PF_RT_NAF = 76, /* u8 */ + PF_RT_RPOOL_RT = 77, /* nested, pf_rpool_type_t */ }; enum pf_addrule_type_t { From nobody Fri Jan 24 10:25:05 2025 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 4YfYpn404mz5lC4L; Fri, 24 Jan 2025 10: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 4YfYpn1t6qz3tQ3; Fri, 24 Jan 2025 10: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=1737714305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9KAx6rijQnYgq0biNz2aeberGigoRmxZIbDM/1/iyu0=; b=ODx3B0XAGczVsua83z9idV8q/FP+qzSbe/k3F0jYWHt7yHYdmxDmkDGrUwvQTzmGyLlavF kw7KYzqWIQCltBNljuRMpPSgxCXL/fISwcsgXkYLQihcpKXLzjcEZlZGR26gonsifyZZfg hJ9f4ZHpNFE3ye3Zua0AH5knnjX+oYXB40a48ZD9nXSTGpsVM23rf8dfUfeLUBuf/GuK5H KVnfJTZvkYayt7XMEVB979ayybAmnq9PHddTJhYXkQ73hdaQB1Py47ng14F0GIi4yHEYqZ jFPq/wQlwXuv4pOSqhSlJyzQJo9yzr2LATy+xtlf1FdHCE9zAI2tNYGkT51C3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737714305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9KAx6rijQnYgq0biNz2aeberGigoRmxZIbDM/1/iyu0=; b=pJ1q+SXfIB2Qgp+Mrs5e2YL+SibTGs0dm6p4V7T3r6pQ8YthL5EVlSs8PsFxtqplv+BUVB Ed3FtLAvIGiSdm72FtMmGy2DU13C65RUlmtJgM/vkpjmGStI2M9X2DO6ZpaPPrfh02tZF7 5Lges3G1/nkyeaj5n5iB44e5CTQMUtXFbUDisbWm+s1oGlq7HM+eRYHwaXtQta/L6d6l/J nXYa75RD93QPaGV9YkkL/35Mx77ocURk/dbY4NsOPUEcK50AK8cpIaivMvkyXSHPZQUXGs jy07TZY46y8Cx2z5b2YnXR78EyZ2MbMrnO/HtYrCHrhsND4/e4L0frGVSntiLA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737714305; a=rsa-sha256; cv=none; b=axJzCikYe6p0fHkQseQmIjszRPsmW4IsRV0qcGL5eDwbVkfPOzV2/lKY5LvtqpatVLGoCW cBwSRL+gG93S8PL4A6i34r0JtRX/+fE2GluJh6ZmDqlsAj8CgA7LnTDE/3MkZJUJfpbd2u c1WliS450jwx0sXshflQBhPAGQa4mW2L2GI3pLy9Eza009olnaT9R/ZXVbWCGC3T6AUBVu 7l7L4SGuLPFRCalj93qHqvkgfxTpNf9J4lwyDL2AKgvHwn0B7HFYgmQhm7HUE+QADeVYwL YBU/5wERama/wazw/XAhT9Mcos1orVzqEfs/zIQjDaP17hEXBILIZOTKJ3Fdhw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfYpn1QVhz5dC; Fri, 24 Jan 2025 10: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 50OAP5uT038498; Fri, 24 Jan 2025 10: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 50OAP5wq038495; Fri, 24 Jan 2025 10:25:05 GMT (envelope-from git) Date: Fri, 24 Jan 2025 10:25:05 GMT Message-Id: <202501241025.50OAP5wq038495@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: ca0e69345320 - main - pf: cope with route-to on af-to rules 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: ca0e69345320832c505ef6762b725391b3c41f50 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ca0e69345320832c505ef6762b725391b3c41f50 commit ca0e69345320832c505ef6762b725391b3c41f50 Author: Kristof Provost AuthorDate: 2025-01-13 14:29:53 +0000 Commit: Kristof Provost CommitDate: 2025-01-24 10:20:30 +0000 pf: cope with route-to on af-to rules af-to uses pf_route() and pf_route6(), which caused issues when af-to and route-to were combined in a single rule. Extend the relevant functions to cope with this and add test cases. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 10 +++++++- sbin/pfctl/pfctl_parser.c | 3 ++- sbin/pfctl/tests/files/pf1026.in | 1 + sbin/pfctl/tests/files/pf1026.ok | 1 + sbin/pfctl/tests/pfctl_test_list.inc | 1 + sys/netpfil/pf/pf.c | 26 ++++++++++++++++++-- tests/sys/netpfil/pf/nat64.sh | 47 ++++++++++++++++++++++++++++++++++++ 7 files changed, 85 insertions(+), 4 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 830581c57f9c..7da200c91c22 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -2735,7 +2735,8 @@ pfrule : action dir logquick interface route af proto fromto } if (r.rt) { decide_address_family($5.host, &r.af); - remove_invalid_hosts(&$5.host, &r.af); + if (!(r.rule_flag & PFRULE_AFTO)) + remove_invalid_hosts(&$5.host, &r.af); if ($5.host == NULL) { yyerror("no routing address with " "matching address family found."); @@ -5503,6 +5504,13 @@ filter_consistent(struct pfctl_rule *r, int anchor_call) "synproxy state or modulate state"); problems++; } + if (r->rule_flag & PFRULE_AFTO && r->rt) { + if (r->rt != PF_ROUTETO) { + yyerror("reply-to and dup-to " + "must not be used on af-to rules"); + problems++; + } + } /* match rules rules */ if (r->action == PF_MATCH) { if (r->divert.port) { diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index df76f8312cf3..8e88a2794e45 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -943,7 +943,8 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer printf(" dup-to"); printf(" "); print_pool(&r->rdr, 0, 0, r->af, PF_PASS); - print_pool(&r->route, 0, 0, r->af, PF_PASS); + print_pool(&r->route, 0, 0, + r->rule_flag & PFRULE_AFTO ? r->naf : r->af, PF_PASS); } if (r->af) { if (r->af == AF_INET) diff --git a/sbin/pfctl/tests/files/pf1026.in b/sbin/pfctl/tests/files/pf1026.in new file mode 100644 index 000000000000..3691d0947b39 --- /dev/null +++ b/sbin/pfctl/tests/files/pf1026.in @@ -0,0 +1 @@ +pass in on epair2b route-to (epair0a 192.0.2.2) inet6 from any to 64:ff9b::/96 af-to inet from (epair0a) diff --git a/sbin/pfctl/tests/files/pf1026.ok b/sbin/pfctl/tests/files/pf1026.ok new file mode 100644 index 000000000000..5b849fe80bd3 --- /dev/null +++ b/sbin/pfctl/tests/files/pf1026.ok @@ -0,0 +1 @@ +pass in on epair2b route-to (epair0a 192.0.2.2) inet6 from any to 64:ff9b::/96 flags S/SA keep state af-to inet from (epair0a) diff --git a/sbin/pfctl/tests/pfctl_test_list.inc b/sbin/pfctl/tests/pfctl_test_list.inc index 0a523386c16c..95f26b18b8d6 100644 --- a/sbin/pfctl/tests/pfctl_test_list.inc +++ b/sbin/pfctl/tests/pfctl_test_list.inc @@ -134,3 +134,4 @@ PFCTL_TEST(1022, "Test received-on") PFCTL_TEST(1023, "Test match log(matches)") PFCTL_TEST(1024, "nat64") PFCTL_TEST(1025, "nat64 with implicit address family") +PFCTL_TEST(1026, "nat64 with route-to") diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 00d6583234c7..5fdda62481db 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -8941,12 +8941,23 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } } } else { - if ((pd->act.rt == PF_REPLYTO) == (r_dir == pd->dir)) { + if (((pd->act.rt == PF_REPLYTO) == (r_dir == pd->dir)) && + (pd->af == pd->naf)) { pf_dummynet(pd, s, r, m); if (s) PF_STATE_UNLOCK(s); return; } + + /* + * If we're actually doing route-to and af-to and are in the + * reply direction. + */ + if (pd->act.rt_kif && pd->act.rt_kif->pfik_ifp && + pd->af != pd->naf && r->naf != AF_INET) { + /* Un-set ifp so we do a plain route lookup. */ + ifp = NULL; + } m0 = *m; } @@ -9201,12 +9212,23 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } } } else { - if ((pd->act.rt == PF_REPLYTO) == (r_dir == pd->dir)) { + if (((pd->act.rt == PF_REPLYTO) == (r_dir == pd->dir)) && + (pd->af == pd->naf)) { pf_dummynet(pd, s, r, m); if (s) PF_STATE_UNLOCK(s); return; } + + /* + * If we're actually doing route-to and af-to and are in the + * reply direction. + */ + if (pd->act.rt_kif && pd->act.rt_kif->pfik_ifp && + pd->af != pd->naf && r->naf != AF_INET6) { + /* Un-set ifp so we do a plain route lookup. */ + ifp = NULL; + } m0 = *m; } diff --git a/tests/sys/netpfil/pf/nat64.sh b/tests/sys/netpfil/pf/nat64.sh index 913f90480e5d..41c1ae3d4522 100644 --- a/tests/sys/netpfil/pf/nat64.sh +++ b/tests/sys/netpfil/pf/nat64.sh @@ -671,6 +671,52 @@ gateway6_cleanup() pft_cleanup } +atf_test_case "route_to" "cleanup" +route_to_head() +{ + atf_set descr 'Test route-to on af-to rules' + atf_set require.user root +} + +route_to_body() +{ + pft_init + + epair_link=$(vnet_mkepair) + epair_null=$(vnet_mkepair) + epair=$(vnet_mkepair) + + ifconfig ${epair}a inet6 2001:db8::2/64 up no_dad + route -6 add default 2001:db8::1 + + vnet_mkjail rtr ${epair}b ${epair_link}a ${epair_null}a + jexec rtr ifconfig ${epair}b inet6 2001:db8::1/64 up no_dad + jexec rtr ifconfig ${epair_null}a 192.0.2.3/24 up + jexec rtr ifconfig ${epair_link}a 192.0.2.1/24 up + + vnet_mkjail dst ${epair_link}b + jexec dst ifconfig ${epair_link}b 192.0.2.2/24 up + jexec dst route add default 192.0.2.1 + + # Sanity checks + atf_check -s exit:0 -o ignore \ + ping6 -c 1 2001:db8::1 + + jexec rtr pfctl -e + pft_set_rules rtr \ + "set reassemble yes" \ + "set state-policy if-bound" \ + "pass in on ${epair}b route-to (${epair_link}a 192.0.2.2) inet6 from any to 64:ff9b::/96 af-to inet from (${epair_link}a)" + + atf_check -s exit:0 -o ignore \ + ping6 -c 3 64:ff9b::192.0.2.2 +} + +route_to_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "icmp_echo" @@ -687,4 +733,5 @@ atf_init_test_cases() atf_add_test_case "table_round_robin" atf_add_test_case "dummynet" atf_add_test_case "gateway6" + atf_add_test_case "route_to" } From nobody Fri Jan 24 10:25:06 2025 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 4YfYpq0qJsz5lC24; Fri, 24 Jan 2025 10: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 4YfYpp2h0Zz3tQG; Fri, 24 Jan 2025 10: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=1737714306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4w0AvluZKHeD+iVqdNHN+r83IqdILDChVAZibw9oGxg=; b=g6BfduqNqPzwir+VhGMr+LEZQmOERZfkeAjRggCFmyKnXBfUSvJkhxO6iWnyIWIlzmBxUQ tAosER3U/2EjH7bGFahXDu3bXFv9upJ0GX9B2BNRe9FG9O4ijpcaYgkYW4jThrhfuBveIZ NHNkUonbGfooiTmBqKJU+1TnSXJkx2ACaj74nbtNQo8BTzpb3/5F12b4i2qHW1AgZWxNMm jFVzo5s2bkG4Nj5HWV0u8XIlXyLiYZXay3hJVQ95n0pByq8s6rFT7AeKSBZ9f9CSzStZmh gyRRnnU8tkVNNe1CQHMj9UJZ93poPvGh5SeXP+hx3LMF7/Ucd/WSyhTgHvpwKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737714306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4w0AvluZKHeD+iVqdNHN+r83IqdILDChVAZibw9oGxg=; b=Kaechtt6t2HQQDSIpFAGiMkHA9HBBZjzLf37tbIAx0xtVjmK8k2FqdHTpUFj3JnpcWBVF2 8MunTM/5yFk2c+BlTm1cRu3ERFPa/3C/Mn4thvg93fGIFAtDW39WBZVD+XPqkT1oIogGe1 Y572qEmSlk0PtnhM+ssZeU4o0HVmW+diYB0rNUwozDgCUU0MF2CIzSSQwqHzI9bGiJTOaL 2sLyVKTjIUa3OC4jXDFDKccUip/5ZQIWVfwE7qJPruOppw+k3GVy0b75dGM2EezqJ6/IXe XQMDiLKz0RDrzZgr0orbd/vO8vsS7QYQok98ufIfBE8wa4X+2w2ccI6ZuMsY1g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737714306; a=rsa-sha256; cv=none; b=nJ2YGwCGuInq+xVa74SF4wzuoXJBlrA+oeKYNAKxMh6Br1xS1uZnVo0FCcCfrb0lF1jAws 3cOLydJo2ksm0UUGHeSJHSkgCGSSeBrvnAyk1YkVVSlCEVLe6Nv7C5gU+bQC2gW/a1ul4D /21gxbiCcfEnws0c6vmTWXiBgCjmRQMMO/dBTzteLYuFh/3dlpxrcLr4qkYBSDeQfsBqC1 DrdyxZhsNcfn1Jwh8dpXwR1o37D/aCyrXg1+0zXu8XL/OINIYPhDnwKO1OaxD/SfKOPrxt GwwJAi0CaJ5D/BJWnYq6hejvQTGZRYl5fq7fFsXeIpIbwb3yxX3nQu68HA/T6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfYpp2B5Nz64y; Fri, 24 Jan 2025 10: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 50OAP6mR038531; Fri, 24 Jan 2025 10: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 50OAP6Kw038528; Fri, 24 Jan 2025 10:25:06 GMT (envelope-from git) Date: Fri, 24 Jan 2025 10:25:06 GMT Message-Id: <202501241025.50OAP6Kw038528@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: 7a372bded812 - main - pf: make reply-to work with nat64 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: 7a372bded8126b41608fd0eac550606bafe57a11 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7a372bded8126b41608fd0eac550606bafe57a11 commit 7a372bded8126b41608fd0eac550606bafe57a11 Author: Kristof Provost AuthorDate: 2025-01-22 16:49:22 +0000 Commit: Kristof Provost CommitDate: 2025-01-24 10:20:31 +0000 pf: make reply-to work with nat64 Just like route-to reply-to is problematic when used in combination with nat64. In the normal (i.e. without nat64) flow we return immediately from pf_route(). However, with nat64 we need to continue and do a route lookup. In that case we should not make the extra pf_test(PF_OUT) call to remain similar to the non-nat64 flow. We also have to fix the interface binding. We can only bind to the interface after we've done the route lookup, not before. Add a funcional test case, and a test for pfctl's rule printing. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 4 +- sbin/pfctl/pfctl_parser.c | 3 +- sbin/pfctl/tests/files/pf1027.in | 1 + sbin/pfctl/tests/files/pf1027.ok | 1 + sbin/pfctl/tests/pfctl_test_list.inc | 1 + sys/netpfil/pf/pf.c | 88 ++++++++++++++++++++++-------------- tests/sys/netpfil/pf/nat64.sh | 45 ++++++++++++++++++ 7 files changed, 106 insertions(+), 37 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 7da200c91c22..efbd7cac18e8 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -5505,8 +5505,8 @@ filter_consistent(struct pfctl_rule *r, int anchor_call) problems++; } if (r->rule_flag & PFRULE_AFTO && r->rt) { - if (r->rt != PF_ROUTETO) { - yyerror("reply-to and dup-to " + if (r->rt != PF_ROUTETO && r->rt != PF_REPLYTO) { + yyerror("dup-to " "must not be used on af-to rules"); problems++; } diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 8e88a2794e45..f32fe9024ff1 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -944,7 +944,8 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer printf(" "); print_pool(&r->rdr, 0, 0, r->af, PF_PASS); print_pool(&r->route, 0, 0, - r->rule_flag & PFRULE_AFTO ? r->naf : r->af, PF_PASS); + r->rule_flag & PFRULE_AFTO && r->rt != PF_REPLYTO ? r->naf : r->af, + PF_PASS); } if (r->af) { if (r->af == AF_INET) diff --git a/sbin/pfctl/tests/files/pf1027.in b/sbin/pfctl/tests/files/pf1027.in new file mode 100644 index 000000000000..3c5c24025e0a --- /dev/null +++ b/sbin/pfctl/tests/files/pf1027.in @@ -0,0 +1 @@ +pass in on epair2b reply-to (epair0a 2001:db8::1) inet6 from any to 64:ff9b::/96 af-to inet from (epair0a) diff --git a/sbin/pfctl/tests/files/pf1027.ok b/sbin/pfctl/tests/files/pf1027.ok new file mode 100644 index 000000000000..5a3f30ae1592 --- /dev/null +++ b/sbin/pfctl/tests/files/pf1027.ok @@ -0,0 +1 @@ +pass in on epair2b reply-to (epair0a 2001:db8::1) inet6 from any to 64:ff9b::/96 flags S/SA keep state af-to inet from (epair0a) diff --git a/sbin/pfctl/tests/pfctl_test_list.inc b/sbin/pfctl/tests/pfctl_test_list.inc index 95f26b18b8d6..7dd3a2af0eea 100644 --- a/sbin/pfctl/tests/pfctl_test_list.inc +++ b/sbin/pfctl/tests/pfctl_test_list.inc @@ -135,3 +135,4 @@ PFCTL_TEST(1023, "Test match log(matches)") PFCTL_TEST(1024, "nat64") PFCTL_TEST(1025, "nat64 with implicit address family") PFCTL_TEST(1026, "nat64 with route-to") +PFCTL_TEST(1027, "nat64 with reply-to") diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 5fdda62481db..a0bc65e78430 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -8891,6 +8891,7 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, uint16_t ip_len, ip_off; uint16_t tmp; int r_dir; + bool skip_test = false; KASSERT(m && *m && r && oifp, ("%s: invalid parameters", __func__)); @@ -8941,12 +8942,15 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } } } else { - if (((pd->act.rt == PF_REPLYTO) == (r_dir == pd->dir)) && - (pd->af == pd->naf)) { - pf_dummynet(pd, s, r, m); - if (s) - PF_STATE_UNLOCK(s); - return; + if ((pd->act.rt == PF_REPLYTO) == (r_dir == pd->dir)) { + if (pd->af == pd->naf) { + pf_dummynet(pd, s, r, m); + if (s) + PF_STATE_UNLOCK(s); + return; + } else { + skip_test = true; + } } /* @@ -8954,9 +8958,15 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, * reply direction. */ if (pd->act.rt_kif && pd->act.rt_kif->pfik_ifp && - pd->af != pd->naf && r->naf != AF_INET) { - /* Un-set ifp so we do a plain route lookup. */ - ifp = NULL; + pd->af != pd->naf) { + if (pd->act.rt == PF_ROUTETO && r->naf != AF_INET) { + /* Un-set ifp so we do a plain route lookup. */ + ifp = NULL; + } + if (pd->act.rt == PF_REPLYTO && r->naf != AF_INET6) { + /* Un-set ifp so we do a plain route lookup. */ + ifp = NULL; + } } m0 = *m; } @@ -8970,13 +8980,6 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, dst.sin_addr.s_addr = pd->act.rt_addr.v4.s_addr; if (s != NULL){ - if (r->rule_flag & PFRULE_IFBOUND && - pd->act.rt == PF_REPLYTO && - s->kif == V_pfi_all) { - s->kif = pd->act.rt_kif; - s->orig_kif = oifp->if_pf_kif; - } - if (ifp == NULL && (pd->af != pd->naf)) { /* We're in the AFTO case. Do a route lookup. */ const struct nhop_object *nh; @@ -9002,6 +9005,13 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } } + if (r->rule_flag & PFRULE_IFBOUND && + pd->act.rt == PF_REPLYTO && + s->kif == V_pfi_all) { + s->kif = pd->act.rt_kif; + s->orig_kif = oifp->if_pf_kif; + } + PF_STATE_UNLOCK(s); } @@ -9012,7 +9022,7 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, goto bad; } - if (pd->dir == PF_IN) { + if (pd->dir == PF_IN && !skip_test) { if (pf_test(AF_INET, PF_OUT, PFIL_FWD, ifp, &m0, inp, &pd->act) != PF_PASS) { SDT_PROBE1(pf, ip, route_to, drop, __LINE__); @@ -9162,6 +9172,7 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, struct ip6_hdr *ip6; struct ifnet *ifp = NULL; int r_dir; + bool skip_test = false; KASSERT(m && *m && r && oifp, ("%s: invalid parameters", __func__)); @@ -9212,12 +9223,15 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } } } else { - if (((pd->act.rt == PF_REPLYTO) == (r_dir == pd->dir)) && - (pd->af == pd->naf)) { - pf_dummynet(pd, s, r, m); - if (s) - PF_STATE_UNLOCK(s); - return; + if ((pd->act.rt == PF_REPLYTO) == (r_dir == pd->dir)) { + if (pd->af == pd->naf) { + pf_dummynet(pd, s, r, m); + if (s) + PF_STATE_UNLOCK(s); + return; + } else { + skip_test = true; + } } /* @@ -9225,9 +9239,15 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, * reply direction. */ if (pd->act.rt_kif && pd->act.rt_kif->pfik_ifp && - pd->af != pd->naf && r->naf != AF_INET6) { - /* Un-set ifp so we do a plain route lookup. */ - ifp = NULL; + pd->af != pd->naf) { + if (pd->act.rt == PF_ROUTETO && r->naf != AF_INET6) { + /* Un-set ifp so we do a plain route lookup. */ + ifp = NULL; + } + if (pd->act.rt == PF_REPLYTO && r->naf != AF_INET) { + /* Un-set ifp so we do a plain route lookup. */ + ifp = NULL; + } } m0 = *m; } @@ -9241,13 +9261,6 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, PF_ACPY((struct pf_addr *)&dst.sin6_addr, &pd->act.rt_addr, AF_INET6); if (s != NULL) { - if (r->rule_flag & PFRULE_IFBOUND && - pd->act.rt == PF_REPLYTO && - s->kif == V_pfi_all) { - s->kif = pd->act.rt_kif; - s->orig_kif = oifp->if_pf_kif; - } - if (ifp == NULL && (pd->af != pd->naf)) { const struct nhop_object *nh; nh = fib6_lookup(M_GETFIB(*m), &ip6->ip6_dst, 0, NHR_NONE, 0); @@ -9273,6 +9286,13 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, } } + if (r->rule_flag & PFRULE_IFBOUND && + pd->act.rt == PF_REPLYTO && + s->kif == V_pfi_all) { + s->kif = pd->act.rt_kif; + s->orig_kif = oifp->if_pf_kif; + } + PF_STATE_UNLOCK(s); } @@ -9293,7 +9313,7 @@ pf_route6(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, goto bad; } - if (pd->dir == PF_IN) { + if (pd->dir == PF_IN && !skip_test) { if (pf_test(AF_INET6, PF_OUT, PFIL_FWD | PF_PFIL_NOREFRAGMENT, ifp, &m0, inp, &pd->act) != PF_PASS) { SDT_PROBE1(pf, ip6, route_to, drop, __LINE__); diff --git a/tests/sys/netpfil/pf/nat64.sh b/tests/sys/netpfil/pf/nat64.sh index 41c1ae3d4522..9cc6aececc42 100644 --- a/tests/sys/netpfil/pf/nat64.sh +++ b/tests/sys/netpfil/pf/nat64.sh @@ -717,6 +717,50 @@ route_to_cleanup() pft_cleanup } +atf_test_case "reply_to" "cleanup" +reply_to_head() +{ + atf_set descr 'Test reply-to on af-to rules' + atf_set require.user root +} + +reply_to_body() +{ + pft_init + + epair_link=$(vnet_mkepair) + epair=$(vnet_mkepair) + + ifconfig ${epair}a inet6 2001:db8::2/64 up no_dad + route -6 add default 2001:db8::1 + + vnet_mkjail rtr ${epair}b ${epair_link}a + jexec rtr ifconfig ${epair}b inet6 2001:db8::1/64 up no_dad + jexec rtr ifconfig ${epair_link}a 192.0.2.1/24 up + + vnet_mkjail dst ${epair_link}b + jexec dst ifconfig ${epair_link}b 192.0.2.2/24 up + jexec dst route add default 192.0.2.1 + + # Sanity checks + atf_check -s exit:0 -o ignore \ + ping6 -c 1 2001:db8::1 + + jexec rtr pfctl -e + pft_set_rules rtr \ + "set reassemble yes" \ + "set state-policy if-bound" \ + "pass in on ${epair}b reply-to (${epair}b 2001:db8::2) inet6 from any to 64:ff9b::/96 af-to inet from 192.0.2.1" + + atf_check -s exit:0 -o ignore \ + ping6 -c 3 64:ff9b::192.0.2.2 +} + +reply_to_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "icmp_echo" @@ -734,4 +778,5 @@ atf_init_test_cases() atf_add_test_case "dummynet" atf_add_test_case "gateway6" atf_add_test_case "route_to" + atf_add_test_case "reply_to" } From nobody Fri Jan 24 10:25:08 2025 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 4YfYps450Xz5lBns; Fri, 24 Jan 2025 10: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 4YfYpr4GdMz3tKZ; Fri, 24 Jan 2025 10: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=1737714308; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xFOou1JNL5n2nHClk2YCM0Y6ubqW5npPgDyvIm0ejRY=; b=rjrm3nJMGVFmgGtqo4yA3yT76Ty9/lAuzl5gF5uFV6mt6ASB5kJR7aKDQzhrb2WIQHG1ec 0jaMCJ8DN00eX71ymJDryYrXZIizjk0eJGS6K6WfQvxF/0/rAUf7ZaD11vtqyaeEQoRxLE vSIa0w5tx9YN8ZCdP+zzEWO3MUgWd8f0W8aoj30mgZccTPkXM26B/keDCZH0rdkLr1UjQM YAFLHHNEbYUi0Or3rL/6/8SfIt/b2AftuqbVozeZKr2yaSSoGj2ivKZ94GQahezdFzoQq6 +ammN2FStfGtM1UxyMyN7emL/dQai7SOvunU8ygsexF0Wn2qVTxGwD37La/tdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737714308; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xFOou1JNL5n2nHClk2YCM0Y6ubqW5npPgDyvIm0ejRY=; b=FmOt3OvVDKjQdONpYZs+lGW34OR+cMk05SwKgYgeNJvvQBw6BPsAaUgjoJuAmGNcOhJeVb S6WXPAuduoiZQSyRZi/g38DCzZ2jWa8kW9Z51BT7ARqbXSKj+J6NePEZd03F5eEwbAQ7We sklCrIFAiksOYvdRaRuToxxSx4xC6QvHX5sz2iyNv2TpH3TAoIg0mJlZMoAvA9wk9OzDev nnf0yr+sjZ4vARVos40wu89lFYUVNF+IhzB82XAUC1wh/mUUbw6Oof5PH/iB1mn1heiUUO +ocxiVWpFaoW5VkZJpgbpCjiGS6MeTRoirXKnd3+MeAaybkMd2sOzckHPqK3Yw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737714308; a=rsa-sha256; cv=none; b=GVlGq7b8dzl9+bge896D31UoZn8auFJSEjkM8CB4sg7hay7y8s7k9n0CNwa1lGSC4VuJXR Fw0vTA5ixkpeSWW3N3gtCVjDyFts0HWu62m+O7eLsLOjYCyiRhoFiDDbKyx8fMOag8Dr95 JN00uy8ni+vA6hfxT2oz3zdpc0N8nrlQgUVN0o//eoVY9fRftK9q8H494ylqVchVB+u/F0 +xkPr5h3enLqWv4XnbCHCyWzhJVEGr7BvWkt0+3FquW/gSE5k7LZC1mcQRZ/usrXCEOrCF ioyobYuYsDcqg1WiDFMKbIAZ7shJg2qaaJqnzc6aAhhh3jJcRyBA49QhTDnlrA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfYpr3qXTz5WP; Fri, 24 Jan 2025 10: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 50OAP8kL038603; Fri, 24 Jan 2025 10: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 50OAP8lH038600; Fri, 24 Jan 2025 10:25:08 GMT (envelope-from git) Date: Fri, 24 Jan 2025 10:25:08 GMT Message-Id: <202501241025.50OAP8lH038600@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: 3bf6554017b7 - main - pf: remove PFLOGIFS_MAX 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: 3bf6554017b78f03bb779a5a3115034243e5c6c7 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3bf6554017b78f03bb779a5a3115034243e5c6c7 commit 3bf6554017b78f03bb779a5a3115034243e5c6c7 Author: Kristof Provost AuthorDate: 2025-01-22 15:55:19 +0000 Commit: Kristof Provost CommitDate: 2025-01-24 10:20:31 +0000 pf: remove PFLOGIFS_MAX There was a limit on the number of pflog interfaces - 16. remove that. mostly by dynamically allocating pflogifs instead of making that a static array. ok claudio zinke Obtained from: OpenBSD, henning , ab0a082ea6 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/if_pflog.h | 2 -- sys/netpfil/pf/if_pflog.c | 48 +++++++++++++++++++++++++++++++++++++---------- sys/netpfil/pf/pf_ioctl.c | 4 ---- 3 files changed, 38 insertions(+), 16 deletions(-) diff --git a/sys/net/if_pflog.h b/sys/net/if_pflog.h index 9734ca245eda..dc22c05cdea0 100644 --- a/sys/net/if_pflog.h +++ b/sys/net/if_pflog.h @@ -33,8 +33,6 @@ #include -#define PFLOGIFS_MAX 16 - #define PFLOG_RULESET_NAME_SIZE 16 struct pfloghdr { diff --git a/sys/netpfil/pf/if_pflog.c b/sys/netpfil/pf/if_pflog.c index 3cd7cd1f2ddc..f325d0001799 100644 --- a/sys/netpfil/pf/if_pflog.c +++ b/sys/netpfil/pf/if_pflog.c @@ -88,6 +88,7 @@ static int pflogoutput(struct ifnet *, struct mbuf *, const struct sockaddr *, struct route *); static void pflogattach(int); +static int pflogifs_resize(size_t); static int pflogioctl(struct ifnet *, u_long, caddr_t); static void pflogstart(struct ifnet *); static int pflog_clone_create(struct if_clone *, char *, size_t, @@ -99,36 +100,58 @@ static const char pflogname[] = "pflog"; VNET_DEFINE_STATIC(struct if_clone *, pflog_cloner); #define V_pflog_cloner VNET(pflog_cloner) -VNET_DEFINE(struct ifnet *, pflogifs[PFLOGIFS_MAX]); /* for fast access */ +VNET_DEFINE_STATIC(int, npflogifs) = 0; +#define V_npflogifs VNET(npflogifs) +VNET_DEFINE(struct ifnet **, pflogifs); /* for fast access */ #define V_pflogifs VNET(pflogifs) static void pflogattach(int npflog __unused) { - int i; - - for (i = 0; i < PFLOGIFS_MAX; i++) - V_pflogifs[i] = NULL; - struct if_clone_addreq req = { .create_f = pflog_clone_create, .destroy_f = pflog_clone_destroy, .flags = IFC_F_AUTOUNIT | IFC_F_LIMITUNIT, - .maxunit = PFLOGIFS_MAX - 1, }; V_pflog_cloner = ifc_attach_cloner(pflogname, &req); struct ifc_data ifd = { .unit = 0 }; ifc_create_ifp(pflogname, &ifd, NULL); } +static int +pflogifs_resize(size_t n) +{ + struct ifnet **p; + int i; + + if (n > SIZE_MAX / sizeof(struct ifnet *)) + return (EINVAL); + if (n == 0) + p = NULL; + else if ((p = malloc(n * sizeof(struct ifnet *), M_DEVBUF, + M_NOWAIT | M_ZERO)) == NULL) + return (ENOMEM); + for (i = 0; i < n; i++) { + if (i < V_npflogifs) + p[i] = V_pflogifs[i]; + else + p[i] = NULL; + } + + if (V_pflogifs) + free(V_pflogifs, M_DEVBUF); + V_pflogifs = p; + V_npflogifs = n; + + return (0); +} + static int pflog_clone_create(struct if_clone *ifc, char *name, size_t maxlen, struct ifc_data *ifd, struct ifnet **ifpp) { struct ifnet *ifp; - MPASS(ifd->unit < PFLOGIFS_MAX); - ifp = if_alloc(IFT_PFLOG); if_initname(ifp, pflogname, ifd->unit); ifp->if_mtu = PFLOGMTU; @@ -141,6 +164,11 @@ pflog_clone_create(struct if_clone *ifc, char *name, size_t maxlen, bpfattach(ifp, DLT_PFLOG, PFLOG_HDRLEN); + if (ifd->unit + 1 > V_npflogifs && + pflogifs_resize(ifd->unit + 1) != 0) { + pflog_clone_destroy(ifc, ifp, IFC_F_FORCE); + return (ENOMEM); + } V_pflogifs[ifd->unit] = ifp; *ifpp = ifp; @@ -155,7 +183,7 @@ pflog_clone_destroy(struct if_clone *ifc, struct ifnet *ifp, uint32_t flags) if (ifp->if_dunit == 0 && (flags & IFC_F_FORCE) == 0) return (EINVAL); - for (i = 0; i < PFLOGIFS_MAX; i++) + for (i = 0; i < V_npflogifs; i++) if (V_pflogifs[i] == ifp) V_pflogifs[i] = NULL; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 340e7c25a501..a45db33f38dc 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2201,8 +2201,6 @@ pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, error = EINVAL; if (!rule->log) rule->logif = 0; - if (rule->logif >= PFLOGIFS_MAX) - error = EINVAL; if (pf_addr_setup(ruleset, &rule->src.addr, rule->af)) error = ENOMEM; if (pf_addr_setup(ruleset, &rule->dst.addr, rule->af)) @@ -3767,8 +3765,6 @@ DIOCGETRULENV_error: error = EINVAL; if (!newrule->log) newrule->logif = 0; - if (newrule->logif >= PFLOGIFS_MAX) - error = EINVAL; if (pf_addr_setup(ruleset, &newrule->src.addr, newrule->af)) error = ENOMEM; if (pf_addr_setup(ruleset, &newrule->dst.addr, newrule->af)) From nobody Fri Jan 24 10:25:07 2025 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 4YfYpq5Pm1z5lBnp; Fri, 24 Jan 2025 10: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 4YfYpq3tHHz3tQM; Fri, 24 Jan 2025 10: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=1737714307; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eSqfhlIEexSaFdak9P281G222BiN/5QPemz3f25MEaY=; b=gScJWRE4DOloOgqt+VEyoTfJknI1GNfWA34mFtQzTBqVFX1dQAFCHN71+eErjf5M5+qWFA f0OCsfUpgICFFjtXkafLMr7qz5wHtHJwBvd3X1IZ+dfFKu6upXehsefziqJluNr0svWdYr z8ObOmmhIlJPJBleyezV6zFJFvSZ86/XqfPmoGzTWGhCz055aJ/NayqU6EAqY4pcTsqiK7 lPeOGcFzSgcLi+IC5m1WIrSxM5txLEuA5Ttn4udyP0i+Rl9lFZQAeEzMmpKZ3OdEo3XWJC qHD9pQHkdy51E2nCKEeKXVgDZ8Yprx0oCp1gRYEYZY9nF7srablvpMCxieSZ0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737714307; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eSqfhlIEexSaFdak9P281G222BiN/5QPemz3f25MEaY=; b=l/FrVV4k0TyxLfIocLsJX8Or9wsidQSZEVsLpdcqVDp6k0iCnGAWtk3PEC388vrsM8i/4X +8DiNJ6mOylGMGe+90mq5oB/hT2eRREBNuov7uOGhhroXKp+Hk5FbOClTjAXs2A9zojzKJ FsMbwwEvRfzc0Fc85kYfjQRBUSFXjhXpq5GSrorxLEo0Ct112NhPELwOw9UzRNCWI3IDJP jeVZGqQ38yqV/6d4CJQT1rnt9WwSdPwSfO1B4lxiJVCSs9MUNb1SFL/0CpZl3Rty7jo7/o vdoY6idvCoFDWp3IbKAWsbT9ECIUEPIaYWDMuM+OTzri1gRj5qCgV1RmHRuwzA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737714307; a=rsa-sha256; cv=none; b=XEeN19GqCRqXVdpGi8uhGee+FkqPzGkusatVFLT6pB2+y+SxbEkVj7650vor+y2zEYXXX0 LXQ2xQDj1UopBKqrJQ9eAVstpRYJENw0zL6l4wTsB3FiExC3jsZbO0JfxJK6n2uar20uJn 9kjP9UiVcFV61/c0Bfk+aIXtMeZW0o+mDUPvOrJ/dFdRHwMso8u0IDY7BwpqFRSSGzpUhi bhlL/JKn4Io21LT/LIILfBQ518U2J128EmGqZjYkLo7DxpMQdJVqmasMg5iS9CUTSWEa77 XYzqzmaZvPRPkeyhby4z5z31/5/pcSUo0Xp2A9LF5j6xkc9la/QEDAGyE3cqZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfYpq3B70z65C; Fri, 24 Jan 2025 10: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 50OAP73b038570; Fri, 24 Jan 2025 10: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 50OAP7sE038567; Fri, 24 Jan 2025 10:25:07 GMT (envelope-from git) Date: Fri, 24 Jan 2025 10:25:07 GMT Message-Id: <202501241025.50OAP7sE038567@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: 06a6ec55fbd0 - main - pf: ignore/preserve ECN bits on ToS matching and scrubbing 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: 06a6ec55fbd01a372778870cb5039341bdea9e38 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=06a6ec55fbd01a372778870cb5039341bdea9e38 commit 06a6ec55fbd01a372778870cb5039341bdea9e38 Author: Kristof Provost AuthorDate: 2025-01-22 10:56:09 +0000 Commit: Kristof Provost CommitDate: 2025-01-24 10:20:31 +0000 pf: ignore/preserve ECN bits on ToS matching and scrubbing The lower 2 bits of the tos-header are used for ECN. (http://tools.ietf.org/html/rfc2474#section-3) OK henning@, haesbaert@ Obtained from: OpenBSD, mpf , 60dfe711ee Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index a0bc65e78430..0ebc813756f1 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -9986,7 +9986,7 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0, pd->dst = (struct pf_addr *)&h->ip_dst; pd->ip_sum = &h->ip_sum; pd->virtual_proto = pd->proto = h->ip_p; - pd->tos = h->ip_tos; + pd->tos = h->ip_tos & ~IPTOS_ECN_MASK; pd->ttl = h->ip_ttl; pd->tot_len = ntohs(h->ip_len); pd->act.rtableid = -1; From nobody Fri Jan 24 12:11:47 2025 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 4Yfc9v6RMqz5lKpD; Fri, 24 Jan 2025 12:11: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 4Yfc9v2bYCz47mv; Fri, 24 Jan 2025 12:11:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720707; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MiWu0irlzU2KZ+8mtAH3///2SwovsXne73pDg8komhY=; b=xGG2ZeNpYlvTAW6OjOYqkL9QEtlY6HsS24g3/ml9AS8rqHkuEWBPgqkFZi/w7VZ/6Icqqb uBOV3jB5G9zLeJdzGej7pkcPqaYs/OgFoKuf5bqKxesq+KvDCfe3L9+1OgbjO1SWqSNJ5n Sm3jj7B/3wug4CySW5ccReH6HxKT5KZEQSKQgbuwe4blLxD9b4j92hLUduK1utSHefUzuM RJzcP5gjc3cu0zuyPArd5aq7Ajyeadbtg4VRtmWb4brjdCAovmxMOWM1E39unCJfPqKJfQ v+HV3my8oS3sBMBkcD1RKPsW01KQvADQYQXnRd1fj3kb1eVxnoBI1rnR0qJAOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720707; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MiWu0irlzU2KZ+8mtAH3///2SwovsXne73pDg8komhY=; b=bwB9duKqBeEa2mLUH13zj5M/IAmj+SGAMgspW2eq7bRL5/ihqkzJgn7gPcJrtB+/tDxVIL kPOOcCKNjXTMAgHfpj2TQvw3gq3Aaw3YQH8WS66NPWKl3ez+AdzXx/SXJMOLdS2CIEITdi I71q6+GZfj4WjJCwelOZnOD1X/BFV2uN7axCiVQWoVmYG+n5U7EvVcCAeylFaVyDGUtfLC FACIW4xTTRv3/M5zfbgb6Cavt63YK3s/clFgyU8tXw1GKdJLLR9VGnAq3dIn+txQ1JzQmQ Ie1ioIYkJ3+qoSgpgl6l3aYWWwPdVQFM0WSKpakKSZeolvnUQqhUz578XBZhCQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737720707; a=rsa-sha256; cv=none; b=yLKFPFNxm+ZqoxTt99QtqlPMPT9VnV22JgEhKtMA1i8JIgFCfdYFwgYKcA/hkaS3cuZ5lt UNjr3Vx6ivsIAO2v0jMwSaQjDbnXUhqrWEOIK5lkLc1seKBSAh0VXViJshoEklvvPMM5QH 0VvcI20KSkwp52+7z0aFsXH3EEDJDudpcfio1Kutu3vABXEZC2/yFNKnPD8hF3QWGwMkND HEvsCjpEui3+I4s8MRKIrVLN7xhxxt6xYzYJ5XMwmM28dNP1efVH1I4yFyNxnYZE7yXtB0 QQ/3s5wD6xN1u92G8CCOkNvUP9XMKiRLV6HhZ2Df7fLAlaYLpXiSZd3jkU6UZA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfc9v1y70z8jT; Fri, 24 Jan 2025 12:11:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50OCBlb4040266; Fri, 24 Jan 2025 12:11:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OCBl47040263; Fri, 24 Jan 2025 12:11:47 GMT (envelope-from git) Date: Fri, 24 Jan 2025 12:11:47 GMT Message-Id: <202501241211.50OCBl47040263@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: 3041b636463d - main - arm64: Support mapping a 52-bit physical adddress 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: 3041b636463d521e3c2bbea7673da6afceec34e5 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=3041b636463d521e3c2bbea7673da6afceec34e5 commit 3041b636463d521e3c2bbea7673da6afceec34e5 Author: Andrew Turner AuthorDate: 2025-01-24 11:36:18 +0000 Commit: Andrew Turner CommitDate: 2025-01-24 12:09:27 +0000 arm64: Support mapping a 52-bit physical adddress When FEAT_LPA2 is enabled the physical address space increases from 48-bits to 52-bits. The top two address bits are moved to the now unused shareability field. Update the kernel to support this new larger address space. Reviewed by: alc, kib Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D46624 --- sys/arm64/arm64/pmap.c | 2 +- sys/arm64/include/armreg.h | 2 +- sys/arm64/include/hypervisor.h | 1 + sys/arm64/include/pmap.h | 2 ++ sys/arm64/include/pte.h | 52 ++++++++++++++++++++++++++++++++++++------ sys/arm64/vmm/vmm_arm64.c | 10 +++++--- 6 files changed, 57 insertions(+), 12 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 23eedff2e7cd..5c1e5bb63e4d 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -355,7 +355,7 @@ static u_int physmap_idx; static SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "VM/pmap parameters"); -static bool pmap_lpa_enabled __read_mostly = false; +bool pmap_lpa_enabled __read_mostly = false; pt_entry_t pmap_sh_attr __read_mostly = ATTR_SH(ATTR_SH_IS); #if PAGE_SIZE == PAGE_SIZE_4K diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index d586d3568bd7..2a2c8b23e0a4 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -2066,7 +2066,7 @@ #define PAR_NS_SHIFT 9 #define PAR_NS_MASK (0x3 << PAR_NS_SHIFT) #define PAR_PA_SHIFT 12 -#define PAR_PA_MASK 0x0000fffffffff000 +#define PAR_PA_MASK 0x000ffffffffff000 #define PAR_ATTR_SHIFT 56 #define PAR_ATTR_MASK (0xff << PAR_ATTR_SHIFT) /* When PAR_F == 1 (aborted) */ diff --git a/sys/arm64/include/hypervisor.h b/sys/arm64/include/hypervisor.h index 15fc36014626..a32e1000d911 100644 --- a/sys/arm64/include/hypervisor.h +++ b/sys/arm64/include/hypervisor.h @@ -281,6 +281,7 @@ #define VTCR_EL2_PS_42BIT (0x3UL << VTCR_EL2_PS_SHIFT) #define VTCR_EL2_PS_44BIT (0x4UL << VTCR_EL2_PS_SHIFT) #define VTCR_EL2_PS_48BIT (0x5UL << VTCR_EL2_PS_SHIFT) +#define VTCR_EL2_PS_52BIT (0x6UL << VTCR_EL2_PS_SHIFT) #define VTCR_EL2_DS_SHIFT 32 #define VTCR_EL2_DS (0x1UL << VTCR_EL2_DS_SHIFT) diff --git a/sys/arm64/include/pmap.h b/sys/arm64/include/pmap.h index d92069ee42fd..75de9e342c72 100644 --- a/sys/arm64/include/pmap.h +++ b/sys/arm64/include/pmap.h @@ -101,6 +101,8 @@ extern struct pmap kernel_pmap_store; #define kernel_pmap (&kernel_pmap_store) #define pmap_kernel() kernel_pmap +extern bool pmap_lpa_enabled; + #define PMAP_ASSERT_LOCKED(pmap) \ mtx_assert(&(pmap)->pm_mtx, MA_OWNED) #define PMAP_LOCK(pmap) mtx_lock(&(pmap)->pm_mtx) diff --git a/sys/arm64/include/pte.h b/sys/arm64/include/pte.h index 02eba21448ba..ae6a8694f6c4 100644 --- a/sys/arm64/include/pte.h +++ b/sys/arm64/include/pte.h @@ -54,13 +54,6 @@ typedef uint64_t pt_entry_t; /* page table entry */ #define ATTR_MASK_L UINT64_C(0x0000000000000fff) #define ATTR_MASK (ATTR_MASK_H | ATTR_MASK_L) -#define BASE_MASK ~ATTR_MASK -#define BASE_ADDR(x) ((x) & BASE_MASK) - -#define PTE_TO_PHYS(pte) BASE_ADDR(pte) -/* Convert a phys addr to the output address field of a PTE */ -#define PHYS_TO_PTE(pa) (pa) - /* Bits 58:55 are reserved for software */ #define ATTR_SW_UNUSED1 (1UL << 58) #define ATTR_SW_NO_PROMOTE (1UL << 57) @@ -81,13 +74,35 @@ typedef uint64_t pt_entry_t; /* page table entry */ #define ATTR_CONTIGUOUS (1UL << 52) #define ATTR_DBM (1UL << 51) #define ATTR_S1_GP (1UL << 50) + +/* + * Largest possible output address field for a level 3 page. Block + * entries will use fewer low address bits, but these are res0 so + * should be safe to include. + * + * This is also safe to use for the next-level table address for + * table entries as they encode a physical address in the same way. + */ +#if PAGE_SIZE == PAGE_SIZE_4K +#define ATTR_ADDR UINT64_C(0x0003fffffffff000) +#elif PAGE_SIZE == PAGE_SIZE_16K +#define ATTR_ADDR UINT64_C(0x0003ffffffffc000) +#else +#error Unsupported page size +#endif + #define ATTR_S1_nG (1 << 11) #define ATTR_AF (1 << 10) +/* When TCR_EL1.DS == 0 */ #define ATTR_SH(x) ((x) << 8) #define ATTR_SH_MASK ATTR_SH(3) #define ATTR_SH_NS 0 /* Non-shareable */ #define ATTR_SH_OS 2 /* Outer-shareable */ #define ATTR_SH_IS 3 /* Inner-shareable */ +/* When TCR_EL1.DS == 1 */ +#define ATTR_OA_51_50_SHIFT 8 +#define ATTR_OA_51_50_MASK (3 << ATTR_OA_51_50_SHIFT) +#define ATTR_OA_51_50_DELTA (50 - 8) /* Delta from address to pte */ #define ATTR_S1_AP_RW_BIT (1 << 7) #define ATTR_S1_AP(x) ((x) << 6) @@ -124,6 +139,29 @@ typedef uint64_t pt_entry_t; /* page table entry */ */ #define ATTR_PROMOTE (ATTR_MASK & ~(ATTR_CONTIGUOUS | ATTR_AF)) +/* Read the output address or next-level table address from a PTE */ +#define PTE_TO_PHYS(x) ({ \ + pt_entry_t _pte = (x); \ + vm_paddr_t _pa; \ + _pa = _pte & ATTR_ADDR; \ + if (pmap_lpa_enabled) \ + _pa |= (_pte & ATTR_OA_51_50_MASK) << ATTR_OA_51_50_DELTA; \ + _pa; \ +}) + +/* + * Convert a physical address to an output address or next-level + * table address in a PTE + */ +#define PHYS_TO_PTE(x) ({ \ + vm_paddr_t _pa = (x); \ + pt_entry_t _pte; \ + _pte = _pa & ATTR_ADDR; \ + if (pmap_lpa_enabled) \ + _pte |= (_pa >> ATTR_OA_51_50_DELTA) & ATTR_OA_51_50_MASK; \ + _pte; \ +}) + #if PAGE_SIZE == PAGE_SIZE_4K #define L0_SHIFT 39 #define L1_SHIFT 30 diff --git a/sys/arm64/vmm/vmm_arm64.c b/sys/arm64/vmm/vmm_arm64.c index 80d985241c69..43b2ba7802d7 100644 --- a/sys/arm64/vmm/vmm_arm64.c +++ b/sys/arm64/vmm/vmm_arm64.c @@ -381,8 +381,6 @@ vmmops_modinit(int ipinum) * shareable */ el2_regs.vtcr_el2 = VTCR_EL2_RES1; - el2_regs.vtcr_el2 |= - min(pa_range_bits << VTCR_EL2_PS_SHIFT, VTCR_EL2_PS_48BIT); el2_regs.vtcr_el2 |= VTCR_EL2_IRGN0_WBWA | VTCR_EL2_ORGN0_WBWA; el2_regs.vtcr_el2 |= VTCR_EL2_T0SZ(64 - vmm_virt_bits); el2_regs.vtcr_el2 |= vmm_vtcr_el2_sl(vmm_pmap_levels); @@ -402,8 +400,14 @@ vmmops_modinit(int ipinum) * the shareability field changes to become address bits when this * is set. */ - if ((READ_SPECIALREG(tcr_el1) & TCR_DS) != 0) + if ((READ_SPECIALREG(tcr_el1) & TCR_DS) != 0) { el2_regs.vtcr_el2 |= VTCR_EL2_DS; + el2_regs.vtcr_el2 |= + min(pa_range_bits << VTCR_EL2_PS_SHIFT, VTCR_EL2_PS_52BIT); + } else { + el2_regs.vtcr_el2 |= + min(pa_range_bits << VTCR_EL2_PS_SHIFT, VTCR_EL2_PS_48BIT); + } smp_rendezvous(NULL, arm_setup_vectors, NULL, &el2_regs); From nobody Fri Jan 24 12:11:48 2025 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 4Yfc9w4Qn2z5lJry; Fri, 24 Jan 2025 12:11: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 4Yfc9w3NY9z480s; Fri, 24 Jan 2025 12:11:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xsaBTbWjzIIT+jH9XvfVTiDF6WY+F6LF5LsSjUknyB0=; b=pPUZ6/z9T8I6LRT/R3IsT1p61tGAsCG3GSiNNR4zsZ2BI37t64mOraswTwxa1pfvXxR9Og JnmAXQtnUt8EBkgndHF02DecAJZeIA0kwUgZaTg59xIT4/TG43FgV9JrJtzZVU9X9dxMlN GHJyok7ePhYcd6yw6JoF63u4AatW1deCe/9TzpksQsLKw6VEuLWVRbB4IdXjCusZ2Nvlew 7y8lL3rLUzyMgPqbLA//u1c6Cvm0xIf1QFhQI9ffgrLeNoIGPTvahtqLhnyLsdveodeRg0 VYZTVEIv0NbOv08Xjb+METDfLwVwxKqxhXOmtQhUsNpVYT/yzjwWYLYUqu/gVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xsaBTbWjzIIT+jH9XvfVTiDF6WY+F6LF5LsSjUknyB0=; b=sm9/JdQEKbHphNNFR5OrDLGnWlwI6J5/WfLKr/7cFpThPIVaoPx4IanEjIWbqgqZkX0KvX 7hWnWMcwWXlOswpIqLKgwXUJKBYPdcqqPoMal1pef9XDUOLa8vHyDif5f03FNVqGMKuwLY aQnIxxBKFJ8C3RgRHIaY1oFGQQz8cH5C/OCuRUgZLwVrleju7SDlp2iWT6wUW1ggcehCJE jU4UNALehcmreF6JETt9Jl2i9N6hlDCvVIhCXXSa2TouDBj/pr03Ca70w4HApAt7q1Gmel JepCN8tPRCkq+4ZaNaCvwYqornb/fO1GGf22bUgijhS++X633XITaBgizLsVng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737720708; a=rsa-sha256; cv=none; b=h2m4D133KWwLtFIqRTTupH3RGTVLmUVhOMdhCwRKdVNLT3m/B2z6zYn+CqUnLrTHZufkl/ 7MaCItI1s/Lo/AiGLs2reSXskAENTR7+VukhApwrCxAZwXAnwUxWMvPmDOngng7GYeYeSO RrzBwp1jJGlwEgyGre2UvGqOY1e63F7UNFn6Ff/dZ1lOiGJU7HdFdEB7ZuQJKrjIDG1z49 Pt4P9WrJTS2lIyqGj+XyGS6hc55rOTE7ZX3Y2DJ9mPfWlN6qRDG3l5zL5Z1umhrkXvf9Vg +1lsePnp+8yZa4pYa2/sI09z2hsc5tmTnWzBc7Li2n6BbD1YA7rXKlAanIU/uA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfc9w2tMFz8x5; Fri, 24 Jan 2025 12:11: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 50OCBmZs040302; Fri, 24 Jan 2025 12:11:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OCBm8j040299; Fri, 24 Jan 2025 12:11:48 GMT (envelope-from git) Date: Fri, 24 Jan 2025 12:11:48 GMT Message-Id: <202501241211.50OCBm8j040299@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: d249bcb712db - main - stand/efi: Limit where we load the arm64 kernel 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: d249bcb712db38bf4f31b99087bd9c39e5178288 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=d249bcb712db38bf4f31b99087bd9c39e5178288 commit d249bcb712db38bf4f31b99087bd9c39e5178288 Author: Andrew Turner AuthorDate: 2025-01-24 11:37:01 +0000 Commit: Andrew Turner CommitDate: 2025-01-24 12:09:28 +0000 stand/efi: Limit where we load the arm64 kernel When FEAT_LPA2 is implemented the hardware supports increasing the physical address space from 48-bit to 52-bit. As older kernels only support a 48-bit physical address space limit where the kernel is loaded to this. Reviewed by: kib, markj Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D46625 --- stand/efi/loader/copy.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/stand/efi/loader/copy.c b/stand/efi/loader/copy.c index 935db3a420ba..e4ad865a4acd 100644 --- a/stand/efi/loader/copy.c +++ b/stand/efi/loader/copy.c @@ -290,6 +290,17 @@ get_staging_max(void) res = copy_staging == COPY_STAGING_ENABLE ? G(1) : G(4); return (res); } +#define EFI_ALLOC_MAX_ADDR +#elif defined(__aarch64__) +/* + * Older kernels only support a 48-bit physical address space, and locore.S + * only supports a 50-bit space. Limit to 48 bits so older kernels can boot + * even if FEAT_LPA2 is supported by the hardware. + */ +#define get_staging_max() (1ul << 48) +#define EFI_ALLOC_MAX_ADDR +#endif +#ifdef EFI_ALLOC_MAX_ADDR #define EFI_ALLOC_METHOD AllocateMaxAddress #else #define EFI_ALLOC_METHOD AllocateAnyPages @@ -316,7 +327,7 @@ efi_copy_init(void) if (running_on_hyperv()) efi_verify_staging_size(&nr_pages); #endif -#if defined(__amd64__) || defined(__i386__) +#ifdef EFI_ALLOC_MAX_ADDR staging = get_staging_max(); #endif status = BS->AllocatePages(EFI_ALLOC_METHOD, EfiLoaderCode, @@ -424,7 +435,7 @@ expand: #if EFI_STAGING_2M_ALIGN nr_pages += M(2) / EFI_PAGE_SIZE; #endif -#if defined(__amd64__) || defined(__i386__) +#ifdef EFI_ALLOC_MAX_ADDR new_base = get_staging_max(); #endif status = BS->AllocatePages(EFI_ALLOC_METHOD, EfiLoaderCode, From nobody Fri Jan 24 12:11:49 2025 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 4Yfc9y4jSsz5lKVF; Fri, 24 Jan 2025 12:11: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 4Yfc9x73tDz480v; Fri, 24 Jan 2025 12:11:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X2F+hYdGXpghUBWunAFgR8rYsxOltIPxIhVSX6Gmp/k=; b=sgXmvv3Htw2itfrRJFiiBbxx79tP7sWyzbGa4MVdwSunWeB0JSmeb30XbwyYj13IPvZUsS aLCopmxs+7TIT2r1l/hG1/PvI/qJaO2yoS9Bv4/ph+3fKzcdTu3LgUEl8FKhrayvAmbcYa 8nyJbIjWZYN4bveKljajF61ACxuudXyP3NNhNDpfOuUNADK+hZZ2jr+qP14jQVoXInTyGN 2Hw8jtX8o4zlU4kP7KQ9f++D6MtQ1tDtp7SsR3IoG7umXTdZSWmN+j/0lcZ0azFYCZzTbJ Wa+NTvr6zG74qvp/780bF8COprY9+BL/0vY/KI040Fl1iGCpA63qB1sl6ZaSNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X2F+hYdGXpghUBWunAFgR8rYsxOltIPxIhVSX6Gmp/k=; b=c9xPnL8M3hOS167n2GAtiOcZr57imER3ziP3MtAxr5pIdBNhqrBnc9cI+PHa9E2T26O1F+ l0B/ncIUUKnZHkLwRQKNBPrhLCFfzOSYiezOcmzdTWjtYrf+Di1Z9e7Qw9naH8NfAJ9ldb nYfjvFn8E9Ak2NHxZvEpncH+VNfzrw/+tFfC0kpxOV588ngs66sMkROKZBoQH0n7gtolsJ ItH69ECCZQQSXVz6cznkBEHGq834G2CwLKZNLqQyOIPPMAahROlcYFNP8hwX7vFs7IZh37 Vu5zRmsq/mlzIPRReDI+xRR1sEjlm4Kkqg5vijXD57I/p/X/+YSrl+vHPVuy6Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737720710; a=rsa-sha256; cv=none; b=ovb2+RTN4C8La5YW9oTA4q80nnUs8eqPLaoCJa/0Qp1t1mUhaNcFrWFNBVWZNtJEyzIlVM qUdxy2rRdPPyQL+ESq4/yfmawwAO3dxz1W1/+mthK4tuMEz7phOcZdVloNsL0l4OQbUtQO isEBeut6dg2FzJGpKbrdKZGhauiKLLLJejrXfrA6AnutDBwIrM3nP1wX/OY+lFNByjod1v XxI7Cn71sj35itBs+hAL2tv0ljaOBoSJjEQLy8kcZrYkvp1HTycTH+SameSUFxPDNlrYp7 44Px0UWcRaPHsL2l6GjP4dzPJ78pnlW2t77VH+lMS0iWVl9cdlyIZzrshykUPA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfc9x3XYwz8t1; Fri, 24 Jan 2025 12:11:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50OCBnVa040338; Fri, 24 Jan 2025 12:11:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OCBnuv040335; Fri, 24 Jan 2025 12:11:49 GMT (envelope-from git) Date: Fri, 24 Jan 2025 12:11:49 GMT Message-Id: <202501241211.50OCBnuv040335@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: ac4fa5838bb3 - main - arm64: Add a new CPU feature framework 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: ac4fa5838bb33f0c3ba05fce02d41164bd84a560 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=ac4fa5838bb33f0c3ba05fce02d41164bd84a560 commit ac4fa5838bb33f0c3ba05fce02d41164bd84a560 Author: Andrew Turner AuthorDate: 2025-01-24 11:42:29 +0000 Commit: Andrew Turner CommitDate: 2025-01-24 12:09:28 +0000 arm64: Add a new CPU feature framework This will be used to enable features that are discoverable on boot. It has support to check if a feature needs to be enabled, and if there is any errata associated with the feature that mean it shouldn't be enabled. It can also be used to enable errata workarounds that aren't associated with a specific feature, e.g. where we need to trap access to a register in userspace to emulate it. As some features need to be enabled early, while others can wait there are two options for when to enable a feature: * CPU_FEAT_EARLY_BOOT: The feature will be enabled early in the boot. On the boot CPU this is in initarm, while on secondary CPUs this is before signalling the CPU has started. * CPU_FEAT_AFTER_DEV: The feature will be enabled after devices have attached but before interrupts are enabled. There are also two scopes for where to enable the feature: * CPU_FEAT_PER_CPU: The feature will be checked and enabled on all CPU cores. * CPU_FEAT_SYSTEM: The feature will only be checked and enabled on a single core. It is expected the former will be used for most features, while the latter is for features that set a global variable to be checked. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47812 --- sys/arm64/arm64/cpu_feat.c | 119 +++++++++++++++++++++++++++++++++++++++++++ sys/arm64/arm64/machdep.c | 4 ++ sys/arm64/arm64/mp_machdep.c | 5 ++ sys/arm64/include/cpu_feat.h | 88 ++++++++++++++++++++++++++++++++ sys/conf/files.arm64 | 1 + 5 files changed, 217 insertions(+) diff --git a/sys/arm64/arm64/cpu_feat.c b/sys/arm64/arm64/cpu_feat.c new file mode 100644 index 000000000000..cc262394913d --- /dev/null +++ b/sys/arm64/arm64/cpu_feat.c @@ -0,0 +1,119 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024 Arm Ltd + * + * 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. + */ + +#include +#include +#include + +#include +#include + +/* TODO: Make this a list if we ever grow a callback other than smccc_errata */ +static cpu_feat_errata_check_fn cpu_feat_check_cb = NULL; + +void +enable_cpu_feat(uint32_t stage) +{ + struct cpu_feat **featp, *feat; + uint32_t midr; + u_int errata_count, *errata_list; + cpu_feat_errata errata_status; + + MPASS((stage & ~CPU_FEAT_STAGE_MASK) == 0); + + midr = get_midr(); + SET_FOREACH(featp, cpu_feat_set) { + feat = *featp; + + /* Run the enablement code at the correct stage of boot */ + if ((feat->feat_flags & CPU_FEAT_STAGE_MASK) != stage) + continue; + + /* If the feature is system wide run on a single CPU */ + if ((feat->feat_flags & CPU_FEAT_SCOPE_MASK)==CPU_FEAT_SYSTEM && + PCPU_GET(cpuid) != 0) + continue; + + if (feat->feat_check != NULL && !feat->feat_check(feat, midr)) + continue; + + /* + * Check if the feature has any errata that may need a + * workaround applied (or it is to install the workaround for + * known errata. + */ + errata_status = ERRATA_NONE; + errata_list = NULL; + errata_count = 0; + if (feat->feat_has_errata != NULL) { + if (feat->feat_has_errata(feat, midr, &errata_list, + &errata_count)) { + /* Assume we are affected */ + errata_status = ERRATA_AFFECTED; + } + } + + if (errata_status == ERRATA_AFFECTED && + cpu_feat_check_cb != NULL) { + for (int i = 0; i < errata_count; i++) { + cpu_feat_errata new_status; + + /* Check if affected by this erratum */ + new_status = cpu_feat_check_cb(feat, + errata_list[i]); + if (new_status != ERRATA_UNKNOWN) { + errata_status = new_status; + errata_list = &errata_list[i]; + errata_count = 1; + break; + } + } + } + + /* Shouldn't be possible */ + MPASS(errata_status != ERRATA_UNKNOWN); + + feat->feat_enable(feat, errata_status, errata_list, + errata_count); + } +} + +static void +enable_cpu_feat_after_dev(void *dummy __unused) +{ + MPASS(PCPU_GET(cpuid) == 0); + enable_cpu_feat(CPU_FEAT_AFTER_DEV); +} +SYSINIT(enable_cpu_feat_after_dev, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, + enable_cpu_feat_after_dev, NULL); + +void +cpu_feat_register_errata_check(cpu_feat_errata_check_fn cb) +{ + MPASS(cpu_feat_check_cb == NULL); + cpu_feat_check_cb = cb; +} diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 03f041851c8f..db223e011c67 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -77,6 +77,7 @@ #include #include +#include #include #include #include @@ -999,6 +1000,9 @@ initarm(struct arm64_bootparams *abp) panic("Invalid bus configuration: %s", kern_getenv("kern.cfg.order")); + /* Detect early CPU feature support */ + enable_cpu_feat(CPU_FEAT_EARLY_BOOT); + /* * Check if pointer authentication is available on this system, and * if so enable its use. This needs to be called before init_proc0 diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c index 636f26fba939..fe04e39edecc 100644 --- a/sys/arm64/arm64/mp_machdep.c +++ b/sys/arm64/arm64/mp_machdep.c @@ -56,6 +56,7 @@ #include #include +#include #include #include #include @@ -224,6 +225,9 @@ init_secondary(uint64_t cpu) /* Ensure the stores in identify_cpu have completed */ atomic_thread_fence_acq_rel(); + /* Detect early CPU feature support */ + enable_cpu_feat(CPU_FEAT_EARLY_BOOT); + /* Signal the BSP and spin until it has released all APs. */ atomic_add_int(&aps_started, 1); while (!atomic_load_int(&aps_ready)) @@ -241,6 +245,7 @@ init_secondary(uint64_t cpu) pcpup->pc_curpmap = pmap0; install_cpu_errata(); + enable_cpu_feat(CPU_FEAT_AFTER_DEV); intr_pic_init_secondary(); diff --git a/sys/arm64/include/cpu_feat.h b/sys/arm64/include/cpu_feat.h new file mode 100644 index 000000000000..9fe6a9dd95d9 --- /dev/null +++ b/sys/arm64/include/cpu_feat.h @@ -0,0 +1,88 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024 Arm Ltd + * + * 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 _MACHINE_CPU_FEAT_H_ +#define _MACHINE_CPU_FEAT_H_ + +#include + +typedef enum { + ERRATA_UNKNOWN, /* Unknown erratum */ + ERRATA_NONE, /* No errata for this feature on this system. */ + ERRATA_AFFECTED, /* There is errata on this system. */ + ERRATA_FW_MITIGAION, /* There is errata, and a firmware */ + /* mitigation. The mitigation may need a */ + /* kernel component. */ +} cpu_feat_errata; + +#define CPU_FEAT_STAGE_MASK 0x00000001 +#define CPU_FEAT_EARLY_BOOT 0x00000000 +#define CPU_FEAT_AFTER_DEV 0x00000001 + +#define CPU_FEAT_SCOPE_MASK 0x00000010 +#define CPU_FEAT_PER_CPU 0x00000000 +#define CPU_FEAT_SYSTEM 0x00000010 + +struct cpu_feat; + +typedef bool (cpu_feat_check)(const struct cpu_feat *, u_int); +typedef bool (cpu_feat_has_errata)(const struct cpu_feat *, u_int, + u_int **, u_int *); +typedef void (cpu_feat_enable)(const struct cpu_feat *, cpu_feat_errata, + u_int *, u_int); + +struct cpu_feat { + const char *feat_name; + cpu_feat_check *feat_check; + cpu_feat_has_errata *feat_has_errata; + cpu_feat_enable *feat_enable; + uint32_t feat_flags; +}; +SET_DECLARE(cpu_feat_set, struct cpu_feat); + +/* + * Allow drivers to mark an erratum as worked around, e.g. the Errata + * Management ABI may know the workaround isn't needed on a given system. + */ +typedef cpu_feat_errata (*cpu_feat_errata_check_fn)(const struct cpu_feat *, + u_int); +void cpu_feat_register_errata_check(cpu_feat_errata_check_fn); + +void enable_cpu_feat(uint32_t); + +/* Check if an erratum is in the list of errata */ +static inline bool +cpu_feat_has_erratum(u_int *errata_list, u_int errata_count, u_int erratum) +{ + for (u_int i = 0; i < errata_count; i++) + if (errata_list[0] == erratum) + return (true); + + return (false); +} + +#endif /* _MACHINE_CPU_FEAT_H_ */ diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index ed251b7ae0d7..c095bae42996 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -32,6 +32,7 @@ arm64/arm64/busdma_machdep.c standard arm64/arm64/clock.c standard arm64/arm64/copyinout.S standard arm64/arm64/cpu_errata.c standard +arm64/arm64/cpu_feat.c standard arm64/arm64/cpufunc_asm.S standard arm64/arm64/db_disasm.c optional ddb arm64/arm64/db_interface.c optional ddb From nobody Fri Jan 24 12:11:50 2025 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 4Yfc9z1FC9z5lKpH; Fri, 24 Jan 2025 12:11: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 4Yfc9y51zgz480x; Fri, 24 Jan 2025 12:11:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LcV/VPDai+zgbf+kGHbdDwig+D1+1rPxoP/tYmBlXYg=; b=YwRK2P8jnD4o7hE7Bly8CoAuLegQBxWm41K8943aVCBtZpbwPhHyjKOpaLHlcXYj3gDgv7 0yEEqz/U48L7x2330DbJ+bsKEoyLFCa563Vq6DbMgS4qwqFqSqRrDWsDLkujigsvVBfQ3p aWEtJE2//Zn5NQ04EWmfr2UGiOMBpDYrVjwVG/La7QHlCSGISTpSDiZgObhkNNBqqqQEq6 yiAQeZUypNPfDOGFmJWbgaRFFtTClrUro12am8jKsJZ74QUV/cQqHBSi0xSBGoIa1ACxrO 5ix3bh4EBe3H9l8wa9OX2VOgTO30Mi0jjicuGr0OOOGytjzHcp5zs8gNUD9uhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LcV/VPDai+zgbf+kGHbdDwig+D1+1rPxoP/tYmBlXYg=; b=CbP8LcDPRG15D7DbE1qofwU98aS5mvcZExB9xoYlUzyL268LUx1uZRwXupnJTKppjhHm2y u/Zvmp/QCKElSX3EirwyaWU+UJAc06sgoqRbCjRNTz5BsaUtwTOg4yi3kfqTyZpTTzY0Ks Rr7HFKx3LH1jFMWM1e32euJgMGfSPw4AM85JrBa1FgXD0MX9agoX3Pry/8z/fU8gJzx8Vs 5WIrWr3MvfVRRnh2J2aPj2w+m6YP+cxvGawT2AdKyjW/ZWj3WaeeYKL+1Yy1/oG95R+s74 3DwtItR4w0nZvRYUAxkaEl4sucAsAGhWjna69n4+nqknfJnsnzOYlE8axwfjhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737720710; a=rsa-sha256; cv=none; b=Bwt8zx6jQL6M8dsCL99SR8SsYWbqoDPmJzR8mxtCAbfmoQ+CCi4y+7XDrR0/SRdk76BfQh zmX8XJv/CA/OkWWOS7hXuv3Ed8x3yiybzLPvz04UOaEAuBLMLpBeBCFpH+gf1+ySnqws8e rgdinL7nYIr1aP8I2iVHN+qT2XIMXaQhcqGxE8agAycy/wnZKtBGqeyncds3pc5xWrV9e2 A+xuZv28RcVsas6j3XWIopz2PNfrkwO9590RwFf+WSVIA/zeg4lQwegB9jryQ+oCBHS3yJ IwkhKpszhFYZ7BArbOU/QXRD3V92V9tSfwC1rUpPBQ85Ex1+NYCfvMz3nI28oQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfc9y4ZvYz8Sd; Fri, 24 Jan 2025 12:11: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 50OCBoLY040377; Fri, 24 Jan 2025 12:11:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OCBobw040374; Fri, 24 Jan 2025 12:11:50 GMT (envelope-from git) Date: Fri, 24 Jan 2025 12:11:50 GMT Message-Id: <202501241211.50OCBobw040374@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: b55a4854a483 - main - arm64: Add support for emulating CTR_EL0 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: b55a4854a48350e276911cf90905f863b61a69ea Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=b55a4854a48350e276911cf90905f863b61a69ea commit b55a4854a48350e276911cf90905f863b61a69ea Author: Andrew Turner AuthorDate: 2025-01-24 11:42:37 +0000 Commit: Andrew Turner CommitDate: 2025-01-24 12:09:28 +0000 arm64: Add support for emulating CTR_EL0 Emulate CTR_EL0 when it is either different on different cores or there is errata affecting the core that means we need to report a different value. This adds the kernel part of Arm Neoverse-N1 erratum 1542419. This depends on the firmware implementing part of the workaround. This is safe even if the firmware is missing the workaround as it is telling userspace to perform a stronger cache sync operation than is required, just on a page at a time rather than a single cache-line. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47814 --- sys/arm64/arm64/identcpu.c | 149 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index d430dc649e0b..a481661ff782 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -42,6 +42,7 @@ #include #include +#include #include #include #include @@ -76,6 +77,8 @@ static int allow_idc = 1; SYSCTL_INT(_machdep_cache, OID_AUTO, allow_idc, CTLFLAG_RDTUN, &allow_idc, 0, "Allow optimizations based on the IDC cache bit"); +static bool emulate_ctr = false; + static void check_cpu_regs(u_int cpu, struct cpu_desc *desc, struct cpu_desc *prev_desc); static uint64_t update_special_reg_field(uint64_t user_reg, u_int type, @@ -2076,6 +2079,8 @@ static const struct mrs_user_reg user_regs[] = { USER_REG(ID_AA64ZFR0_EL1, id_aa64zfr0, true), + USER_REG(CTR_EL0, ctr, true), + #ifdef COMPAT_FREEBSD32 USER_REG(ID_ISAR5_EL1, id_isar5, false), @@ -2087,6 +2092,143 @@ static const struct mrs_user_reg user_regs[] = { #define CPU_DESC_FIELD(desc, idx) \ *(uint64_t *)((char *)&(desc) + user_regs[(idx)].offset) +static bool +user_ctr_has_neoverse_n1_1542419(uint32_t midr, uint64_t ctr) +{ + /* Skip non-Neoverse-N1 */ + if (!CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, CPU_IMPL_ARM, + CPU_PART_NEOVERSE_N1, 0, 0)) + return (false); + + switch (CPU_VAR(midr)) { + default: + break; + case 4: + /* Fixed in r4p1 */ + if (CPU_REV(midr) > 0) + break; + /* FALLTHROUGH */ + case 3: + /* If DIC is enabled (coherent icache) then we are affected */ + return (CTR_DIC_VAL(ctr) != 0); + } + + return (false); +} + +static bool +user_ctr_check(const struct cpu_feat *feat __unused, u_int midr __unused) +{ + if (emulate_ctr) + return (true); + + if (user_ctr_has_neoverse_n1_1542419(midr, READ_SPECIALREG(ctr_el0))) + return (true); + + return (false); +} + +static bool +user_ctr_has_errata(const struct cpu_feat *feat __unused, u_int midr, + u_int **errata_list, u_int *errata_count) +{ + if (user_ctr_has_neoverse_n1_1542419(midr, READ_SPECIALREG(ctr_el0))) { + static u_int errata_id = 1542419; + + *errata_list = &errata_id; + *errata_count = 1; + return (true); + } + + return (false); +} + +static void +user_ctr_enable(const struct cpu_feat *feat __unused, + cpu_feat_errata errata_status, u_int *errata_list, u_int errata_count) +{ + MPASS(emulate_ctr || errata_status != ERRATA_NONE); + + /* + * The Errata Management Firmware Interface may incorrectly mark + * this as firmware mitigated. We should ignore that as there is + * a kernel component to the mitigation. + */ + if (errata_status != ERRATA_NONE && PCPU_GET(cpuid) == 0 && + cpu_feat_has_erratum(errata_list, errata_count, 1542419)) { + /* Clear fields we will change */ + user_cpu_desc.ctr &= ~(CTR_DIC_MASK | CTR_ILINE_WIDTH); + + /* + * Set DIC to none so userspace will execute an 'ic ivau' + * instruction that can be trapped by EL3. + */ + user_cpu_desc.ctr |= CTR_DIC_NONE; + /* + * Set the i-cache line size to be page size to reduce the + * number of times userspace needs to execute the 'ic ivau' + * instruction. The ctr_el0.IminLine is log2 the number of + * 4-byte words the instruction covers. As PAGE_SHIFT is log2 + * of the number of bytes in a page we need to subtract 2. + */ + user_cpu_desc.ctr |= (PAGE_SHIFT - 2) << CTR_ILINE_SHIFT; + + l_user_cpu_desc.ctr = user_cpu_desc.ctr; + } + + WRITE_SPECIALREG(sctlr_el1, + READ_SPECIALREG(sctlr_el1) & ~SCTLR_UCT); + isb(); +} + +static struct cpu_feat user_ctr = { + .feat_name = "Trap CTR_EL0", + .feat_check = user_ctr_check, + .feat_has_errata = user_ctr_has_errata, + .feat_enable = user_ctr_enable, + .feat_flags = CPU_FEAT_AFTER_DEV | CPU_FEAT_PER_CPU, +}; +DATA_SET(cpu_feat_set, user_ctr); + +static int +user_ctr_handler(vm_offset_t va, uint32_t insn, struct trapframe *frame, + uint32_t esr) +{ + uint64_t value; + int reg; + + if ((insn & MRS_MASK) != MRS_VALUE) + return (0); + + /* Check if this is the ctr_el0 register */ + /* TODO: Add macros to armreg.h */ + if (mrs_Op0(insn) != 3 || mrs_Op1(insn) != 3 || mrs_CRn(insn) != 0 || + mrs_CRm(insn) != 0 || mrs_Op2(insn) != 1) + return (0); + + if (SV_CURPROC_ABI() == SV_ABI_FREEBSD) + value = user_cpu_desc.ctr; + else + value = l_user_cpu_desc.ctr; + /* + * We will handle this instruction, move to the next so we + * don't trap here again. + */ + frame->tf_elr += INSN_SIZE; + + reg = MRS_REGISTER(insn); + /* If reg is 31 then write to xzr, i.e. do nothing */ + if (reg == 31) + return (1); + + if (reg < nitems(frame->tf_x)) + frame->tf_x[reg] = value; + else if (reg == 30) + frame->tf_lr = value; + + return (1); +} + static int user_mrs_handler(vm_offset_t va, uint32_t insn, struct trapframe *frame, uint32_t esr) @@ -2497,6 +2639,7 @@ identify_cpu_sysinit(void *dummy __unused) panic("CPU does not support LSE atomic instructions"); #endif + install_undef_handler(true, user_ctr_handler); install_undef_handler(true, user_mrs_handler); } SYSINIT(identify_cpu, SI_SUB_CPU, SI_ORDER_MIDDLE, identify_cpu_sysinit, NULL); @@ -3029,6 +3172,12 @@ check_cpu_regs(u_int cpu, struct cpu_desc *desc, struct cpu_desc *prev_desc) } if (desc->ctr != prev_desc->ctr) { + /* + * If the cache is different on different cores we should + * emulate for userspace to provide a uniform value + */ + emulate_ctr = true; + /* * If the cache type register is different we may * have a different l1 cache type. From nobody Fri Jan 24 12:11:52 2025 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 4YfcB13cGPz5lJs3; Fri, 24 Jan 2025 12:11:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YfcB101fbz481K; Fri, 24 Jan 2025 12:11:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dyV3Qqw5CTvlmIGTd6l3+NL7I33od69sHMOwcO72DMM=; b=y4Luu/IMDz8TI3Rd3F8pJCIoyFl+G5Ct5F6D4OV49Zn8RkHZk8vc3/2HSprPyS1hodnIcb AqoHWHpNvFbdXH2U91pSd3nA13cpvC83XvznH97OU5K3tSX8VGLw1VXmdZDMCqiPgO59oR wymDMtOoocYVoU9CnjV7O2Oy9OOlrwruuq655IFjI0l7Gj6EeMiGRNe6nMB62z4wHBt496 lPM23UpBNp2+qzh67B/Ninur/kT0kPsuVwPhT0L1/MLTzC2N6mZUsPkjyPw4jW21b7myf9 zdKY5VARAGq0EO61tgYeKhAumyqd2Wq+mLRcFEYR38n00QxfjPtecccA2EU52g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dyV3Qqw5CTvlmIGTd6l3+NL7I33od69sHMOwcO72DMM=; b=eh/q1NkV8MyinGrRShCtowYXNerYdoVIpIVKeYPVp7PzrNHpZHj207DBWwnste3Gn9C7R+ pKno6n/2wxmOExKhMj2ER6BI+Inyz0uo98uh00U2y/JAdG3PFCs7Zxgp/fiAXtCpz7fiSs 8bogXPWZSNrWD5pr8CvGgJbWOzwa2VtGAxPqBIKd1yGZkunLuhkg3b5vNnxDE0J3s7kPyZ Lp6hpBac0A8n2R8+XqMYw092mHpB+XV/iLh0Zr6t85BbvGDtReUEVg817McmlqwJJ8D9FD 8a8lN0gro7McKPP3KPSPRomr2sy1SXlmC1btL1S61Vlvs9rO4FZylt5bbzOirA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737720713; a=rsa-sha256; cv=none; b=VzKfBGhvoqmlNFlICECqg5XJoctFw4Hsj3xm/QJG/hJe4/hVyMcQWj7Y/oa7uZqLtPWMLy fA42D1Wy9MiicER6ed+jGPTUq+5JWVHABF7kR5iT/gKAurLSj/Hq7Ii+kI6OmDtUMU+Tvy necnwBJGDrmEzskyux5e/8otwKA/wVQaiDECbQkj5Mz3xrz5587EXrDMDeb/suTr7hqnMy j33vtvVUoOFhUE/L1SE4eOd/tGCtCcILZMOjgzeZEnpqf3Upwfh0heMzRwr/C3beDsERNV 4u/B+92PruTQVSSpmLKbOiH7EVLbwyGWdSiIYrromvN1no/IDxvh4c5aKtwPEw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfcB06CwNz8x7; Fri, 24 Jan 2025 12:11: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 50OCBqwG040447; Fri, 24 Jan 2025 12:11:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OCBqX8040444; Fri, 24 Jan 2025 12:11:52 GMT (envelope-from git) Date: Fri, 24 Jan 2025 12:11:52 GMT Message-Id: <202501241211.50OCBqX8040444@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: 62f8d65ee4d0 - main - arm64: Move FEAT_PAN to the cpu feat framework 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: 62f8d65ee4d0178f670a0930736d3628d06746fb Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=62f8d65ee4d0178f670a0930736d3628d06746fb commit 62f8d65ee4d0178f670a0930736d3628d06746fb Author: Andrew Turner AuthorDate: 2025-01-24 11:42:48 +0000 Commit: Andrew Turner CommitDate: 2025-01-24 12:09:28 +0000 arm64: Move FEAT_PAN to the cpu feat framework Use the common framework rather than custom functions called on each CPU. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47816 --- sys/arm64/arm64/machdep.c | 38 ++++++++++++++++++++++---------------- sys/arm64/arm64/mp_machdep.c | 1 - sys/arm64/include/cpufunc.h | 2 -- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index db223e011c67..0a925842dba4 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -173,35 +173,43 @@ SYSINIT(ssp_warn, SI_SUB_COPYRIGHT, SI_ORDER_ANY, print_ssp_warning, NULL); SYSINIT(ssp_warn2, SI_SUB_LAST, SI_ORDER_ANY, print_ssp_warning, NULL); #endif -static void -pan_setup(void) +static bool +pan_check(const struct cpu_feat *feat __unused, u_int midr __unused) { uint64_t id_aa64mfr1; id_aa64mfr1 = READ_SPECIALREG(id_aa64mmfr1_el1); - if (ID_AA64MMFR1_PAN_VAL(id_aa64mfr1) != ID_AA64MMFR1_PAN_NONE) - has_pan = 1; + return (ID_AA64MMFR1_PAN_VAL(id_aa64mfr1) != ID_AA64MMFR1_PAN_NONE); } -void -pan_enable(void) +static void +pan_enable(const struct cpu_feat *feat __unused, + cpu_feat_errata errata_status __unused, u_int *errata_list __unused, + u_int errata_count __unused) { + has_pan = 1; /* * This sets the PAN bit, stopping the kernel from accessing * memory when userspace can also access it unless the kernel * uses the userspace load/store instructions. */ - if (has_pan) { - WRITE_SPECIALREG(sctlr_el1, - READ_SPECIALREG(sctlr_el1) & ~SCTLR_SPAN); - __asm __volatile( - ".arch_extension pan \n" - "msr pan, #1 \n" - ".arch_extension nopan \n"); - } + WRITE_SPECIALREG(sctlr_el1, + READ_SPECIALREG(sctlr_el1) & ~SCTLR_SPAN); + __asm __volatile( + ".arch_extension pan \n" + "msr pan, #1 \n" + ".arch_extension nopan \n"); } +static struct cpu_feat feat_pan = { + .feat_name = "FEAT_PAN", + .feat_check = pan_check, + .feat_enable = pan_enable, + .feat_flags = CPU_FEAT_EARLY_BOOT | CPU_FEAT_PER_CPU, +}; +DATA_SET(cpu_feat_set, feat_pan); + bool has_hyp(void) { @@ -964,7 +972,6 @@ initarm(struct arm64_bootparams *abp) init_param1(); cache_setup(); - pan_setup(); /* Bootstrap enough of pmap to enter the kernel proper */ pmap_bootstrap(lastaddr - KERNBASE); @@ -1029,7 +1036,6 @@ initarm(struct arm64_bootparams *abp) if ((boothowto & RB_KDB) != 0) kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger"); #endif - pan_enable(); kcsan_cpu_init(0); kasan_init(); diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c index 987ff9ac1ceb..d052033d9575 100644 --- a/sys/arm64/arm64/mp_machdep.c +++ b/sys/arm64/arm64/mp_machdep.c @@ -256,7 +256,6 @@ init_secondary(uint64_t cpu) #endif dbg_init(); - pan_enable(); mtx_lock_spin(&ap_boot_mtx); atomic_add_rel_32(&smp_cpus, 1); diff --git a/sys/arm64/include/cpufunc.h b/sys/arm64/include/cpufunc.h index c948799eb7b9..e6e1f682794e 100644 --- a/sys/arm64/include/cpufunc.h +++ b/sys/arm64/include/cpufunc.h @@ -41,8 +41,6 @@ breakpoint(void) #ifdef _KERNEL #include -void pan_enable(void); - static __inline register_t dbg_disable(void) { From nobody Fri Jan 24 12:11:51 2025 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 4YfcB13btxz5lJs2; Fri, 24 Jan 2025 12:11:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YfcB036bJz48Hx; Fri, 24 Jan 2025 12:11:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2axjmsv3o+xP0Wjiuqpkp/bZd6uDVd35Z8gcRBWql0k=; b=L6xLlaHW7wybyj4waQpXyhEr1W78Pxmq18sX/RMQwejTp4bF/c9mINR2daPQ8RHWSNFAYW g2XGrB/WMJ9KsaGi4+23pm9wHpPzS3PN0Lrwd2qeyzt7YpOC7lkFtdr0WNlYIqNoApelK/ l0KGDuXlOYmLPyydX6onQhgevBItJaSW3lMZf91dUN+jREgUWzAx/QFFEHwTEpVSSlf9Hs bnMQcA4rE9/5b+PtzlU11q28Mh8dKWmoivj91QcunBRUXH/B9kl4707qiKhGhPeIlN3Foh FYXo3ULtZhj0l3DqaCNdIur0ev/ftUiK7snona9Aql10LYF1WSBtQQF7/tnytg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2axjmsv3o+xP0Wjiuqpkp/bZd6uDVd35Z8gcRBWql0k=; b=DbSakOEcraUeOaKdpRVWOMOdJCyViabg6HVr0kn+/XZViCCiXzwTmpIz5Lk8oS8ZY4xGmh 2zkYvrpDcXvptOtUcLovMihs2P9KXZFKkwctZDdqXC+RGO+6Shsi58r0KvA1hG8GF2KECC Q3OK21HgmTbqSngOM/CF2H0Z2zQ9IqiEcDv0GIEgt83dLAj0vh0LDHD/2NlGfmC38nSU+i QPgkRyoLYyGEag4PzPJflCK0kd3u0wFBQ5kvaBdZTwwmZsGCMRwdHBIKs0V8s7CWNwSaM3 EC0lqLJbnSOp00tyJRipbHDRYxW3xbR7amX/l37SD25SSfsIEGaBIxhKSJ1M7w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737720712; a=rsa-sha256; cv=none; b=iMeQ3CNgDWj4zkKWP6CbAlR7ejuvAD7foTdWkgpPS9DRngly/LBgoz27qx7bUfvcu6qAvN OOJ+yrRHcPFBMDPQLxRKG4+jgEXtvvmLryygxfD8r0nQPsqptOvFUHpwG+bnWM+q0USOqS QsNJJ6XCsENKTv9nSovO2UEII4H3neM0b+93vJ87C169AbWE3Hti6wD7rRkqAtKtCa5HP2 oQEXYIsT8qT/snlGMeP0R5OHJAjoj7hVl4Io2UXW7Av9l06skl8ICrrrbtXe6Cyh3XcObk 31QHGxRF13rDBAOnten/PmO7PiYsYBKa/4VVD6dwrXqiYtzpdlkmNCkZXIMAKg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfc9z5cmTz8WN; Fri, 24 Jan 2025 12:11: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 50OCBpda040412; Fri, 24 Jan 2025 12:11:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OCBpIE040409; Fri, 24 Jan 2025 12:11:51 GMT (envelope-from git) Date: Fri, 24 Jan 2025 12:11:51 GMT Message-Id: <202501241211.50OCBpIE040409@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: 3c4bc06f9b91 - main - arm64: Move DBM errata to the cpu feat framework 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: 3c4bc06f9b91b719c2797f1cbd0b541ae4632332 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=3c4bc06f9b91b719c2797f1cbd0b541ae4632332 commit 3c4bc06f9b91b719c2797f1cbd0b541ae4632332 Author: Andrew Turner AuthorDate: 2025-01-24 11:42:44 +0000 Commit: Andrew Turner CommitDate: 2025-01-24 12:09:28 +0000 arm64: Move DBM errata to the cpu feat framework Move to the new cpu feature framework for enabling DBM and disabling when there are errata affecting it. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47815 --- sys/arm64/arm64/mp_machdep.c | 1 - sys/arm64/arm64/pmap.c | 87 +++++++++++++++++++++++++++++++------------- sys/arm64/include/pmap.h | 1 - 3 files changed, 61 insertions(+), 28 deletions(-) diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c index fe04e39edecc..987ff9ac1ceb 100644 --- a/sys/arm64/arm64/mp_machdep.c +++ b/sys/arm64/arm64/mp_machdep.c @@ -220,7 +220,6 @@ init_secondary(uint64_t cpu) pcpup = cpuid_to_pcpu[cpu]; pcpup->pc_midr = get_midr(); identify_cpu(cpu); - pmap_cpu_init(); /* Ensure the stores in identify_cpu have completed */ atomic_thread_fence_acq_rel(); diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 5c1e5bb63e4d..5a3dbbf00203 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -146,6 +146,7 @@ #include #include +#include #include #include #include @@ -1309,8 +1310,6 @@ pmap_bootstrap(vm_size_t kernlen) vm_paddr_t start_pa, pa; uint64_t tcr; - pmap_cpu_init(); - tcr = READ_SPECIALREG(tcr_el1); /* Verify that the ASID is set through TTBR0. */ @@ -1625,39 +1624,75 @@ pmap_init_pv_table(void) } } -void -pmap_cpu_init(void) +static bool +pmap_dbm_check(const struct cpu_feat *feat __unused, u_int midr __unused) { - uint64_t id_aa64mmfr1, tcr; - bool enable_dbm; - - enable_dbm = false; + uint64_t id_aa64mmfr1; - /* Enable HAFDBS if supported */ id_aa64mmfr1 = READ_SPECIALREG(id_aa64mmfr1_el1); - if (ID_AA64MMFR1_HAFDBS_VAL(id_aa64mmfr1) >= ID_AA64MMFR1_HAFDBS_AF_DBS) - enable_dbm = true; + return (ID_AA64MMFR1_HAFDBS_VAL(id_aa64mmfr1) >= + ID_AA64MMFR1_HAFDBS_AF_DBS); +} + +static bool +pmap_dbm_has_errata(const struct cpu_feat *feat __unused, u_int midr, + u_int **errata_list, u_int *errata_count) +{ /* Disable on Cortex-A55 for erratum 1024718 - all revisions */ if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK, CPU_IMPL_ARM, - CPU_PART_CORTEX_A55, 0, 0)) - enable_dbm = false; + CPU_PART_CORTEX_A55, 0, 0)) { + static u_int errata_id = 1024718; + + *errata_list = &errata_id; + *errata_count = 1; + return (true); + } + /* Disable on Cortex-A510 for erratum 2051678 - r0p0 to r0p2 */ - else if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK | CPU_VAR_MASK, - CPU_IMPL_ARM, CPU_PART_CORTEX_A510, 0, 0)) - if (CPU_REV(PCPU_GET(midr)) < 3) - enable_dbm = false; - if (enable_dbm) { - tcr = READ_SPECIALREG(tcr_el1) | TCR_HD; - WRITE_SPECIALREG(tcr_el1, tcr); - isb(); - /* Flush the local TLB for the TCR_HD flag change */ - dsb(nshst); - __asm __volatile("tlbi vmalle1"); - dsb(nsh); - isb(); + if (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK | CPU_VAR_MASK, + CPU_IMPL_ARM, CPU_PART_CORTEX_A510, 0, 0)) { + if (CPU_REV(PCPU_GET(midr)) < 3) { + static u_int errata_id = 2051678; + + *errata_list = &errata_id; + *errata_count = 1; + return (true); + } } + + return (false); +} + +static void +pmap_dbm_enable(const struct cpu_feat *feat __unused, + cpu_feat_errata errata_status, u_int *errata_list __unused, + u_int errata_count) +{ + uint64_t tcr; + + /* Skip if there is an erratum affecting DBM */ + if (errata_status != ERRATA_NONE) + return; + + tcr = READ_SPECIALREG(tcr_el1) | TCR_HD; + WRITE_SPECIALREG(tcr_el1, tcr); + isb(); + /* Flush the local TLB for the TCR_HD flag change */ + dsb(nshst); + __asm __volatile("tlbi vmalle1"); + dsb(nsh); + isb(); } +static struct cpu_feat feat_dbm = { + .feat_name = "FEAT_HAFDBS (DBM)", + .feat_check = pmap_dbm_check, + .feat_has_errata = pmap_dbm_has_errata, + .feat_enable = pmap_dbm_enable, + .feat_flags = CPU_FEAT_AFTER_DEV | CPU_FEAT_PER_CPU, +}; +DATA_SET(cpu_feat_set, feat_dbm); + /* * Initialize the pmap module. * diff --git a/sys/arm64/include/pmap.h b/sys/arm64/include/pmap.h index 75de9e342c72..2503f1df8404 100644 --- a/sys/arm64/include/pmap.h +++ b/sys/arm64/include/pmap.h @@ -142,7 +142,6 @@ extern pt_entry_t pmap_sh_attr; void pmap_activate_vm(pmap_t); void pmap_bootstrap(vm_size_t); -void pmap_cpu_init(void); int pmap_change_attr(vm_offset_t va, vm_size_t size, int mode); int pmap_change_prot(vm_offset_t va, vm_size_t size, vm_prot_t prot); void pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_t pa, int mode); From nobody Fri Jan 24 12:11:53 2025 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 4YfcB25XR1z5lKpR; Fri, 24 Jan 2025 12:11: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 4YfcB21KpVz47yP; Fri, 24 Jan 2025 12:11:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720714; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ERSt/nJ/J+WsyOCm74TtYjab048MrSLZwS618xaatSg=; b=yBVYhMylxdDesqx6WT3urLpYvEh7Mv0jCJobx6t92xvgxDtdONDUxXBNwfPjQUHtvqMjZ5 5j8Prj7SWbp3XNwaZLfNG/rTJTTjI4c+awbH1FLeawGgihBBTzN1qdQ7dZKTinRQRLJ8zS BqGr5ofHWaQ0OvnT5gkeRQtVLtt7pnvDTKEjjaatO+GAbnNQ3T3uOXE9jtX6BfLLlAI7P7 xLtbcVnzW7MPDp+5wMXEKDaUlgoa1dhqSVc2NuC7K1fw6bV/xTOfzKTLEl3bvnKGeYwr8P hykYrEG7Ue1e/BgqpHrp1byfDrrEobwaC+5EPX6TgFS2TWmzF3Q0PuUiajNQog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720714; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ERSt/nJ/J+WsyOCm74TtYjab048MrSLZwS618xaatSg=; b=UUIRjNXMCPfYpl1ILn33K/L2nO0Ic06mzjblec3dUrZoq0CPR3lMbjltxpD0D+6RDbIFwH 0TGZcMQOK3cqqdVJhZ0WE26xc+fC8KFCIqoCr6obHngzg/CHCc0gU+jsqOtuwLKdurQBL2 Yor+sp9s1F83VjqOT7RyohLwvm0QLoGAAA9HuxAL31W2qt7krza4wnCHfMHDON38NIGP5Q 35aadr6OoA3uCaZ/WHBKIOsM1rRiIXwGhCNDPcVonxJQ+SqdiV5+mnDZLlDVVYwjEMDEBQ x1gI4JHpNrCTYLLnbHVBgPMpSt3I8rbd/tLzqZvbcZVJQDI/Y42jP5IV6BGK9g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737720714; a=rsa-sha256; cv=none; b=Syxnn7YT/vfuuQj+wCr46yqnCXbM/Rrmj87JfDIzL80PFjCzGRYGktEZIRrMqKlE/i3GeR tbqQ8Lk9xNAhkhY2FClcHQuLoegeWEl6UjfQgOVszld3hqMtAkz3hBPP715QE+if+BinRU tFKEL9CyAseBM7qiVsyhbUn97aOvTWipVfC/SchtBseaTSnlK/Tch/2RPQBSd18ZwjCv7q GrdYXjZI2MYBUBgjyDaFew0akDm41nZmg3GhWoIYFo+1h/k22VxzcDphaTopYuQzUH1Grl sezfrnQnfoubzIXKDYsHW/Io3rfLoFvoDI3eny3uBHPvtRj4p8CcxAU1e/UeRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfcB20PZLz8v3; Fri, 24 Jan 2025 12:11:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50OCBrsx040482; Fri, 24 Jan 2025 12:11:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OCBrKd040479; Fri, 24 Jan 2025 12:11:53 GMT (envelope-from git) Date: Fri, 24 Jan 2025 12:11:53 GMT Message-Id: <202501241211.50OCBrKd040479@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: e3f9593ed6ff - main - arm64: Move FEAT_PAuth to the cpu feat framework 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: e3f9593ed6ff70da7a8be46644693389214f26d5 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=e3f9593ed6ff70da7a8be46644693389214f26d5 commit e3f9593ed6ff70da7a8be46644693389214f26d5 Author: Andrew Turner AuthorDate: 2025-01-24 11:42:54 +0000 Commit: Andrew Turner CommitDate: 2025-01-24 12:09:28 +0000 arm64: Move FEAT_PAuth to the cpu feat framework Use the common framework rather than a custom function on boot. Because we need to be careful when enabling pointer authentication the enable function only sets the flag to tell other functions it needs to be enabled. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47818 --- sys/arm64/arm64/machdep.c | 7 ------- sys/arm64/arm64/ptrauth.c | 38 +++++++++++++++++++++++++++----------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 0a925842dba4..ff7a88edfe61 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -1010,13 +1010,6 @@ initarm(struct arm64_bootparams *abp) /* Detect early CPU feature support */ enable_cpu_feat(CPU_FEAT_EARLY_BOOT); - /* - * Check if pointer authentication is available on this system, and - * if so enable its use. This needs to be called before init_proc0 - * as that will configure the thread0 pointer authentication keys. - */ - ptrauth_init(); - /* * Dump the boot metadata. We have to wait for cninit() since console * output is required. If it's grossly incorrect the kernel will never diff --git a/sys/arm64/arm64/ptrauth.c b/sys/arm64/arm64/ptrauth.c index b5f9fad1dc95..7ef958b2e03c 100644 --- a/sys/arm64/arm64/ptrauth.c +++ b/sys/arm64/arm64/ptrauth.c @@ -43,6 +43,7 @@ #include #include +#include #include #include @@ -81,8 +82,8 @@ ptrauth_disable(void) return (false); } -void -ptrauth_init(void) +static bool +ptrauth_check(const struct cpu_feat *feat __unused, u_int midr __unused) { uint64_t isar1; int pac_enable; @@ -96,28 +97,43 @@ ptrauth_init(void) if (!pac_enable) { if (boothowto & RB_VERBOSE) printf("Pointer authentication is disabled\n"); - return; + return (false); } if (!get_kernel_reg(ID_AA64ISAR1_EL1, &isar1)) - return; + return (false); if (ptrauth_disable()) - return; + return (false); /* * This assumes if there is pointer authentication on the boot CPU * it will also be available on any non-boot CPUs. If this is ever * not the case we will have to add a quirk. */ - if (ID_AA64ISAR1_APA_VAL(isar1) > 0 || - ID_AA64ISAR1_API_VAL(isar1) > 0) { - enable_ptrauth = true; - elf64_addr_mask.code |= PAC_ADDR_MASK; - elf64_addr_mask.data |= PAC_ADDR_MASK; - } + return (ID_AA64ISAR1_APA_VAL(isar1) > 0 || + ID_AA64ISAR1_API_VAL(isar1) > 0); } +static void +ptrauth_enable(const struct cpu_feat *feat __unused, + cpu_feat_errata errata_status __unused, u_int *errata_list __unused, + u_int errata_count __unused) +{ + enable_ptrauth = true; + elf64_addr_mask.code |= PAC_ADDR_MASK; + elf64_addr_mask.data |= PAC_ADDR_MASK; +} + + +static struct cpu_feat feat_pauth = { + .feat_name = "FEAT_PAuth", + .feat_check = ptrauth_check, + .feat_enable = ptrauth_enable, + .feat_flags = CPU_FEAT_EARLY_BOOT | CPU_FEAT_SYSTEM, +}; +DATA_SET(cpu_feat_set, feat_pauth); + /* Copy the keys when forking a new process */ void ptrauth_fork(struct thread *new_td, struct thread *orig_td) From nobody Fri Jan 24 12:11:56 2025 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 4YfcB44TS4z5lKWv; Fri, 24 Jan 2025 12:11: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 4YfcB42XNnz488Y; Fri, 24 Jan 2025 12:11:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720716; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=peE8+8dFy4kAJPOjlSD5UT7aBnjiNcCSDsJ7d+FIYuQ=; b=PwH3i8sgdqsrG362LCJsmKJSgcaKX3bsYxS9ViiXCMlCy+D7uOTJ9TMlplo5D2zFaoi7VF 2QJhlXFH72eVvgR8YePEZbr9pi0FJ/OmiJN2wEe8hcZrS68WF/q1m4G006kAu9XM6RDK0N rBXE72NoDB01DJZhcz/57jnlSgxwRH61ZPPwwk+ufEVBE+KfUUKwOTTQE9Waam7TWygkfY DBXNUijsyzJTqQsfEU9ZJ56BKyvyZmfkb4pDLoxW4Uq1i0moOG/rhqpCJkt2MbsNEJO7Cd fuPBQEjs4Y25oqBSg8HxZ4brWeSyu1UGkxK7U74ENPRob3z6RX1EPtA/BZG/7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720716; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=peE8+8dFy4kAJPOjlSD5UT7aBnjiNcCSDsJ7d+FIYuQ=; b=R+Kco/hnugV7P0Jm5eZDTnQKfsz++1MmgJqxIxdER7XxRp8rPOaeky8nHDLM5F5cbobeNR iz6M+3mnXcZ7erEhMdRygL8IokVFYiO9n9tqKqR5347Uj1B3im09hrj3aPqV7wZszr8LcK mEE89SFifD/Sfu2M5JYDmhKbq84QCC/+DCUJKuDYLQOeR7GLpEidoHLzJBwZJOHpfsvWZ+ B672uwdNbIm8KFTI+ljA4mW8vEk4FCvf/U7ITI2ShDEdkc/X9yB9WXXp79vw6mGx493E40 rSfM3lyat9blwaWcouT0YU2FPiU8NcJOE0SXo5tosmQekDHXpXJDNxsD6S3f3Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737720716; a=rsa-sha256; cv=none; b=H5BK9t6nRojSIkfxktRxSXDQmFivSxuqQUC2hYToq8mgUNN07++j2vLXwMFkd5KN2kQ8Gl ak/1fLpOepbkLbAk2aSAHbYfSkgJDVHC+EXjTMpwaUj16zSsYlB61tSF7uHjFB+7BVF0Gd KtATWX7Q6Lx611EpZxAxpsztKERusZ+hWmYEvJcoqEtLy9yMF9WfKDmEuK537DVlt85AJD j7GA/jSVnIgvucxveKLmy403htNzTVC1VpjhxdAmd8sJqHvwIrsufc04tr2gXtUrJSnrqU 9wLAYZKeqRoqW/sgKE1rgiEg7x9b6nI0smM0OZKdltkH2rpeDIs6Od1mqiRoEQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfcB423X9z8WR; Fri, 24 Jan 2025 12:11: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 50OCBueb040559; Fri, 24 Jan 2025 12:11:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OCBuHf040556; Fri, 24 Jan 2025 12:11:56 GMT (envelope-from git) Date: Fri, 24 Jan 2025 12:11:56 GMT Message-Id: <202501241211.50OCBuHf040556@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: 41dfdf04e2b1 - main - arm: Fix the location of a ';' 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: 41dfdf04e2b1e39634603370299b15634a17e4a7 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=41dfdf04e2b1e39634603370299b15634a17e4a7 commit 41dfdf04e2b1e39634603370299b15634a17e4a7 Author: Andrew Turner AuthorDate: 2025-01-24 11:43:03 +0000 Commit: Andrew Turner CommitDate: 2025-01-24 12:09:29 +0000 arm: Fix the location of a ';' It must have fallen off the line, return it to its correct location. Sponsored by: Arm Ltd --- sys/arm/arm/generic_timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm/arm/generic_timer.c b/sys/arm/arm/generic_timer.c index 9b5f0f52368b..775290960ebd 100644 --- a/sys/arm/arm/generic_timer.c +++ b/sys/arm/arm/generic_timer.c @@ -191,8 +191,8 @@ get_freq(void) static uint64_t get_cntxct_a64_unstable(bool physical) { - uint64_t val -; + uint64_t val; + isb(); if (physical) { do { From nobody Fri Jan 24 12:11:55 2025 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 4YfcB345RYz5lKpT; Fri, 24 Jan 2025 12:11: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 4YfcB31prQz47yZ; Fri, 24 Jan 2025 12:11:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720715; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=c0auGDO/siNuzuiYcOrNJhzl8XAspzf3M370NwHNj+o=; b=kvw1qRgX3xWs262J6vTDVT0bbf2JEVADyjAI+B24EWaaVvh8+pfz/j6FljfJQlz5V08Wrj md/ScYUG2rC2z9vFnJF9y6C6gT5z0nVpV5ktt7YxbnR6dt7HY+Y1UJKQ0w2AfGuPv79k+L 4WWMgJJBjQay7HzBGOZ1H/45u1D/GgCY66TbPwszKYwxQtdk7ruKDc/yRLfLqGUiKRCcPo /v1hZJnKYEGEy/yPZyrcqsTVdVGm8GzrBSjaXdvXhFzE+3Vc2bfyO9FvteJ3I+Swv5SBKF wHO8pU6Wm4Gtx3EEPedg0TJEuXi/ztUWmodzzgQppXBRRB35wreeLLWxsfK0yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737720715; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=c0auGDO/siNuzuiYcOrNJhzl8XAspzf3M370NwHNj+o=; b=oOlkSQCxH3PtyRROm2AZuH48Wuku/KV1041LJCarstJpwozh3NLoV6kEWU3NxF6msdutnc puzevAb1tqC/0QxuBxcqKKMH1RyzoUBCjcBdMMD8HgES/iNeUjaG7OooLpa7ogFS3M7WeR BFWf2UmQxRfysa2EBxoEPtE0phllCE+VMCw8SY1FVYwXNYHguDI8tG4dva9o+EV+14CjX+ ZqaI7ryyhbzFGZgfocU9hYBZLXhugpdSVydigaIRsi7Tp7msJQ1RRsMwj/rBykTwbWPnqE ujVTw6zjN1pgekimbPjZsewkMeIdh6rFt902rWEUq9wsHkZ1SP+s1tlpLv6T4w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737720715; a=rsa-sha256; cv=none; b=Cb5FtnjTwQANeUXC/NjKXcR1nfxDp2nSWbuOyObsSFgjEvlPnDpfTPuiKPqs9UrVvrhKar IKhrO9UULEMYN/32+iItfF4sDmryEV362d3a4+zlXIjmKOxoTYIpuWnaqq6Pqaq01GAWxK hnVk8dV9VWQzGw6rff2An1FuMTgUyHT27mO3y2oKfU/eYL4N4NNpDWY9qZKRuWR+bRFtlK JUgLcVnNGJghpHkzMCptaknDshqHh3RVUJwAFpyGMoNKJpW+Lr/sTR6NwtSbzCSHEsdN+g etJv4+bkaJdufubgBnvW1ZNf5IyruQzPeCuG6woXaPnVJnqp9cQ9tB/gIUg0cA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfcB31N7Fz8v4; Fri, 24 Jan 2025 12:11: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 50OCBt02040517; Fri, 24 Jan 2025 12:11:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OCBt7L040514; Fri, 24 Jan 2025 12:11:55 GMT (envelope-from git) Date: Fri, 24 Jan 2025 12:11:55 GMT Message-Id: <202501241211.50OCBt7L040514@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: 0c333f8c6e6a - main - psci: Support the arm64 Errata ABI 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: 0c333f8c6e6abee331b12a7dbadfe077dbaf79c8 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=0c333f8c6e6abee331b12a7dbadfe077dbaf79c8 commit 0c333f8c6e6abee331b12a7dbadfe077dbaf79c8 Author: Andrew Turner AuthorDate: 2025-01-24 11:42:59 +0000 Commit: Andrew Turner CommitDate: 2025-01-24 12:09:28 +0000 psci: Support the arm64 Errata ABI Add support for the Arm Errata Management Firmware Interface (Errata ABI) [1]. This provides an interface for the kernel to query the status of an erratum workaround. Some errata may be mitigated depending on the other hardware in a SoC, e.g. Cortex-A78 erratum 2712571 is not affected in systems that use an Arm interconnect. As there may not be a way for the kernel to know if this is the case then it would have to implement the workaround even when not needed. There are other cases where the needed workaround is implemented in firmware and if not implemented then the kernel may decide to not use a feature. In this case we can query the firmware before deciding if we should use a feature or now. There is a known issue with some firmware implementations of the Errata ABI that incorrectly returns a status indicating the erratum is fully mitigated by the firmware, however there is a kernel component needed, e.g. Neoverse-N1 erratum 1542419. To handle this case we tell the caller there is some workaround implemented in the firmware and it can decide how to handle it. If this is fixed in a way we can detect we can add a new erratum status value to indicate this. [1] https://developer.arm.com/documentation/den0100/latest/ Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D48055 --- sys/conf/files.arm64 | 1 + sys/dev/psci/smccc_errata.c | 138 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index c095bae42996..64c8acfcdb9a 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -421,6 +421,7 @@ dev/pci/pci_dw_if.m optional pci fdt dev/psci/psci.c standard dev/psci/smccc_arm64.S standard +dev/psci/smccc_errata.c standard dev/psci/smccc_trng.c standard dev/psci/smccc.c standard diff --git a/sys/dev/psci/smccc_errata.c b/sys/dev/psci/smccc_errata.c new file mode 100644 index 000000000000..db6b0a588a86 --- /dev/null +++ b/sys/dev/psci/smccc_errata.c @@ -0,0 +1,138 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024 Arm Ltd + * + * 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. + */ + +/* + * A driver for the Arm Errata Management Firmware Interface (Errata ABI). + * This queries into the SMCCC firmware for the status of errata using the + * interface documented in den0100 [1]. + * + * [1] https://developer.arm.com/documentation/den0100/latest + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#define ERRATA_HIGHER_EL_MITIGATION 3 +#define ERRATA_NOT_AFFECTED 2 +#define ERRATA_AFFECTED 1 + +#define EM_VERSION SMCCC_FUNC_ID(SMCCC_FAST_CALL, \ + SMCCC_32BIT_CALL, SMCCC_STD_SECURE_SERVICE_CALLS, 0xf0u) +#define EM_VERSION_MIN 0x10000L +#define EM_FEATURES SMCCC_FUNC_ID(SMCCC_FAST_CALL, \ + SMCCC_32BIT_CALL, SMCCC_STD_SECURE_SERVICE_CALLS, 0xf1u) +#define EM_CPU_ERRATUM_FEATURES SMCCC_FUNC_ID(SMCCC_FAST_CALL, \ + SMCCC_32BIT_CALL, SMCCC_STD_SECURE_SERVICE_CALLS, 0xf2u) + +static device_identify_t errata_identify; +static device_probe_t errata_probe; +static device_attach_t errata_attach; +static cpu_feat_errata errata_cpu_feat_errata_check(const struct cpu_feat *, + u_int); + +static void +errata_identify(driver_t *driver, device_t parent) +{ + int32_t version; + + if (smccc_get_version() < SMCCC_MAKE_VERSION(1, 1)) + return; + + /* Check we have Errata 1.0 or later */ + version = psci_call(EM_VERSION, 0, 0, 0); + if (version < EM_VERSION_MIN) + return; + + if (BUS_ADD_CHILD(parent, 0, "errata", -1) == NULL) + device_printf(parent, "add errata child failed\n"); +} + +static int +errata_probe(device_t dev) +{ + device_set_desc(dev, "Arm SMCCC Errata Management"); + return (BUS_PROBE_NOWILDCARD); +} + +static int +errata_attach(device_t dev) +{ + /* Check for EM_CPU_ERRATUM_FEATURES. It's mandatory, so should exist */ + if (arm_smccc_invoke(EM_FEATURES, EM_CPU_ERRATUM_FEATURES, NULL) < 0) { + device_printf(dev, + "EM_CPU_ERRATUM_FEATURES is not implemented\n"); + return (ENXIO); + } + + cpu_feat_register_errata_check(errata_cpu_feat_errata_check); + + return (0); +} + +static cpu_feat_errata +errata_cpu_feat_errata_check(const struct cpu_feat *feat __unused, u_int errata_id) +{ + struct arm_smccc_res res; + + switch(arm_smccc_invoke(EM_CPU_ERRATUM_FEATURES, errata_id, 0, &res)) { + default: + return (ERRATA_UNKNOWN); + case ERRATA_NOT_AFFECTED: + return (ERRATA_NONE); + case ERRATA_AFFECTED: + return (ERRATA_AFFECTED); + case ERRATA_HIGHER_EL_MITIGATION: + return (ERRATA_FW_MITIGAION); + } +} + +static device_method_t errata_methods[] = { + DEVMETHOD(device_identify, errata_identify), + DEVMETHOD(device_probe, errata_probe), + DEVMETHOD(device_attach, errata_attach), + + DEVMETHOD_END +}; + +static driver_t errata_driver = { + "errata", + errata_methods, + 0 +}; + +DRIVER_MODULE(errata, smccc, errata_driver, 0, 0); From nobody Fri Jan 24 13:36:53 2025 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 4Yff45531Bz5lQjw; Fri, 24 Jan 2025 13:36:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yff452VRhz3NQm; Fri, 24 Jan 2025 13:36:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737725813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bmTf9eZ+3MoTEc6Rv/o62Ed5virgYF4cP57wuNwnW1s=; b=IdHqJf1MGqEBWZVqN6Wfu4ebIZEeXMHqHEVgKUI/oLiMtOZZba7EUkqosPHpjn3ZajSvub qCqCD3Lrm31gWiZtZreM5ZFrlJDmoducsc6Te54t6nFs/oevE/Scjb6J89n3y/034AJwso 9H2ZZkASYFyha2eTYuaLbwzNYmugGoZJ3Cd+T/xQZvIQN+hhxzxYUY+QhIXWM5WhsEeMct g4QZR9r7gFf7zt8o1agTXOB+24gwm5jKiPlJyiHRad4JkzQ9eLeYMOyIFNt41xZ9FrmedE zbZoOCS9txXQa8uaGZnm6Rh0rAhabpQrIrhxpQ81LLZVg09uuZ1ORjrLDEtrsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737725813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bmTf9eZ+3MoTEc6Rv/o62Ed5virgYF4cP57wuNwnW1s=; b=WhY9UJiHrLItotoSYXq0YqqLHCLu4ItBFxfQdBs/pnYGkn3WhoTk3n2PeDSt+6NW+b2tHE l8nEnObOEa1icFBDeE0MM1gt6uMyRiuMXwJgtGu1OUhDGw4msBjHsTXsU1Vhtq+9Tw1m+2 WJeA3jJasDG+LHJa/wBa2fz8xVSzvrG7zaAvDqy8zRgmjYitvdqXHOZeDQ8t/CIq9e6YtW aM2NNGqRXQ5XhiDgq6ZY5s6TlIDFLZz8so6pKeLzgG9jWLp+BQ0imi8AY0uOm7FFqZKhhz fZ7eMNvDkHVG0E4CZj8SaWKMYVAG1t8bNA6yHkdN3YkD3K2SG6iBDzJCgVbyJA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737725813; a=rsa-sha256; cv=none; b=vUmXw7sGcxZc5MKfuY8xzBGxtb0J7d6q8ey/IRW2fJdoIYUgFqPqy4dqhbSexnExakJhU7 NepqrhYv4KJXlEWYwcsBptJvjNlpHW7YSAPacDLvGVb7ImUJr7FjVlx7qOZ8OjiMBPPMgb ka2G9xtkb48ecAN4T4Vtd7ISvHvcJXrLti5DcS2V6w+je32caEq/6Lr05liv2+MQRB3sie C/SkVVEpPIalzvmhQdhuvud/sIv9muAvMqZ+KjB2l1eBcoTonnkQl13JLYT5fv8s+XWD3V j7XwBcxY/MSvbSVWskVfuLEHhk3Xez5L4TEQXVTPZeIp6NCPJBcDUPreruh1Qg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yff451XGkzB4L; Fri, 24 Jan 2025 13:36: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 50ODar23094437; Fri, 24 Jan 2025 13:36:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50ODarMa094434; Fri, 24 Jan 2025 13:36:53 GMT (envelope-from git) Date: Fri, 24 Jan 2025 13:36:53 GMT Message-Id: <202501241336.50ODarMa094434@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: 6700e2d963ff - main - csu: add the "Retain" flag to notes sections flag 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: 6700e2d963ff0475cc5cd444e92ce40855643084 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6700e2d963ff0475cc5cd444e92ce40855643084 commit 6700e2d963ff0475cc5cd444e92ce40855643084 Author: Konstantin Belousov AuthorDate: 2025-01-24 11:32:53 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-24 13:36:41 +0000 csu: add the "Retain" flag to notes sections flag It should make the notes immune against --gc-sections. Reported and tested by: bapt Sponsored by: The FreeBSD Foundation MFC after: 1 week --- lib/csu/common/crtbrand.S | 2 +- lib/csu/common/feature_note.S | 2 +- lib/csu/common/ignore_init_note.S | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/csu/common/crtbrand.S b/lib/csu/common/crtbrand.S index b59e2fd8056b..a06f72daa99d 100644 --- a/lib/csu/common/crtbrand.S +++ b/lib/csu/common/crtbrand.S @@ -36,7 +36,7 @@ * for more information. */ - .section .note.tag,"aG",%note,.freebsd.noteG,comdat + .section .note.tag,"aGR",%note,.freebsd.noteG,comdat .p2align 2 .4byte 2f-1f .4byte 4f-3f diff --git a/lib/csu/common/feature_note.S b/lib/csu/common/feature_note.S index 5c1d56d4cde1..fb9f6141699e 100644 --- a/lib/csu/common/feature_note.S +++ b/lib/csu/common/feature_note.S @@ -29,7 +29,7 @@ #include #include "notes.h" - .section .note.tag,"a",%note + .section .note.tag,"aR",%note .p2align 2 .4byte 2f-1f .4byte 4f-3f diff --git a/lib/csu/common/ignore_init_note.S b/lib/csu/common/ignore_init_note.S index 57fb4e8f4d51..d78be61f17a9 100644 --- a/lib/csu/common/ignore_init_note.S +++ b/lib/csu/common/ignore_init_note.S @@ -30,7 +30,7 @@ #include "notes.h" - .section .note.tag,"a",%note + .section .note.tag,"aR",%note .p2align 2 .4byte 2f-1f .4byte 4f-3f From nobody Fri Jan 24 14:36:04 2025 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 4YfgNN3jdMz5lVDf; Fri, 24 Jan 2025 14:36: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 4YfgNN30jxz3Vbw; Fri, 24 Jan 2025 14:36:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737729364; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0vXMjsVBudi8t+T6Pf4eiU84LO4Z9TvaVHUpRWp+WNU=; b=Nz4sbuCBoTqZnt5bjaG0qpYrD9Dll4DQeB8pc7k63CBMnH609NzvbE15syG9q8vS98XDA4 5nZdQ7IH8Lz4mWfX6TrMd2o8ZnTYPLHIZNqRbT+z31FTvoD45d1027w9oSC4YoLtKb6vGo uFJGV1rQAYmW91gzjRpnWnA0/1nn1QsjRmz/ivPg2p41czlB/mz6KJFwWx+YttpZDtXvj4 Kr0ALo0i+jBnq2a4ktTTy7mTPc83s6V8LIvW9vM/Kjg8SEoPjiWTqEjKjG56sB3AljKlj5 HtuUSPojAXAUERDPPHphAm2l0qbt4mD1EVl8Sq1BmPsjgd/Dh0EeumBTrxtiwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737729364; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0vXMjsVBudi8t+T6Pf4eiU84LO4Z9TvaVHUpRWp+WNU=; b=bKkfmVhQQY167Y6HRHRTiMK0lDzvbh88bpsZRIKXidJIZrhyS3j0YB/imOBpdvhxZ46VII FVmcNF9u+KdUwLEvM6beBef7QxsKLTCCETMYMRQnSkLyzFume3Gzs4QrbQKuUL3AokWBsv 78bNU/42MvtoNEsdm+j23wDhOrvVP/TZwXxOyaV+HScVY1/VHTu3NEth4FfY5aM4uqI2F0 ymoLRHJmHvm0JX3tszteqv9Bhs2aRKuGm7AWvu+gZb4eOmF7U3sBRuGOD98RGNqz/6POQA CwlhDOsjuohXWyU5Qp3E1FMSM2Orepm8PVx6oq9LKlUeID6DGxB1MKXLfjEQxg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737729364; a=rsa-sha256; cv=none; b=cghqOJu588PfDNngmrk51AVS2n25ZEMbyawNrCbL20ecOZqGam8+PCPDRg1KqVj99IV9eo LHUy19e+H5egMF9wrrZzMBTGu3GqmtkLJm/sWnA9b1jVaOnZKLINigazVpHDA6KX22q4xr T4Ch3kE8RZb6Zw/MnpLYUE5KfKD4Qv0ZsBcdgSYLHw3xeynj9n2+Ens08/SNMZ9RqqXXoh 3ciKgRgFgtgOllOaKyLLYoEWIiiesLFDMgXjPBvhX43/kXSP+Dd3ipkEHiYYgdG0sA+K/f pPRndUG3tZUd+UbrKYUwnc20cGUisDdxeyfp6pJ+9X3Q/14ToRlkfF4Wdc1N8w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfgNN2W7FzDLP; Fri, 24 Jan 2025 14:36: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 50OEa4N0006550; Fri, 24 Jan 2025 14:36:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OEa4b9006547; Fri, 24 Jan 2025 14:36:04 GMT (envelope-from git) Date: Fri, 24 Jan 2025 14:36:04 GMT Message-Id: <202501241436.50OEa4b9006547@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: 5db50a3167ac - main - rtsold: Further usage message updates 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: 5db50a3167ac7a4f18088a5cfdaac64aa925c32e Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5db50a3167ac7a4f18088a5cfdaac64aa925c32e commit 5db50a3167ac7a4f18088a5cfdaac64aa925c32e Author: Mark Johnston AuthorDate: 2025-01-24 14:06:59 +0000 Commit: Mark Johnston CommitDate: 2025-01-24 14:06:59 +0000 rtsold: Further usage message updates Add -u, remove -p from the rtsol(8) usage message. PR: 266634 MFC after: 1 week --- usr.sbin/rtsold/rtsold.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/usr.sbin/rtsold/rtsold.c b/usr.sbin/rtsold/rtsold.c index e0b168a379bf..63f20e3032a7 100644 --- a/usr.sbin/rtsold/rtsold.c +++ b/usr.sbin/rtsold/rtsold.c @@ -792,19 +792,19 @@ usage(const char *progname) { if (strcmp(progname, "rtsold") == 0) { - fprintf(stderr, "usage: rtsold [-dDfFim1] [-O script-name] " + fprintf(stderr, "usage: rtsold [-dDfFimu1] [-O script-name] " "[-M script-name ] [-A script-name ] " "[-p pidfile] [-R script-name] interface ...\n"); - fprintf(stderr, "usage: rtsold [-dDfFim1] [-O script-name] " + fprintf(stderr, "usage: rtsold [-dDfFimu1] [-O script-name] " "[-M script-name ] [-A script-name ] " "[-p pidfile] [-R script-name] -a\n"); } else { - fprintf(stderr, "usage: rtsol [-dDFi] [-O script-name] " + fprintf(stderr, "usage: rtsol [-dDFiu] [-O script-name] " "[-M script-name ] [-A script-name ] " - "[-p pidfile] [-R script-name] interface ...\n"); - fprintf(stderr, "usage: rtsol [-dDFi] [-O script-name] " + "[-R script-name] interface ...\n"); + fprintf(stderr, "usage: rtsol [-dDFiu] [-O script-name] " "[-M script-name ] [-A script-name ] " - "[-p pidfile] [-R script-name] -a\n"); + "[-R script-name] -a\n"); } exit(1); } From nobody Fri Jan 24 14:36:05 2025 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 4YfgNP703Wz5lV3y; Fri, 24 Jan 2025 14:36: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 4YfgNP4N3cz3VJT; Fri, 24 Jan 2025 14:36:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737729365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JmLgdxxwJBuPRpOfqRE4ONamvHqetHJMO16dBKzjIVU=; b=Xwe6HOtZqmFCf+qviMF0IkEbaoDYYpMak+vlGKL67sreHXS4nq3d39ExjwCI81GD194Nyb I7aq5YL9zMsDNKK3M8taJU+Jt1UryrJrl6d8Z1kFumIwFL3SHPjUg4gi4oyQGpIP+zSnb6 +9bTjkMbM8A6rWCznA1vWTZggRnF3GltUNOuU+iD/An9c1whlIuZ5920bJuFKBZF4LfCJ9 kaW9+bBqdRiqSvWC5IceCFx4h38AHOWY5csn/AZqzRXyF9wUNPtHcEypcyxubhZdfOcRkf BhqcLjPeexvh8eEJj1eChy0trRXm3kFITHuOs2Em77hRJBQTRFwR1ZBd6yO5vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737729365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JmLgdxxwJBuPRpOfqRE4ONamvHqetHJMO16dBKzjIVU=; b=sYt7NyUnj8SEYtCzycHHJP6IGvdfqJ6kLwh7aj9/Rvr6p6Mu0eQHiez5hY+pKesCyJI9iC QQNstew2hjzk2sed4tswQM9ms04FccNvUQYrHdk186EYxYsKp3NAGilyeQS8bn9xH3NKai bWYJ9fOUXPr4Tx81EgbOgtNziUkgPuhXM+CBbgOFaE9h/FqO+oWs3svIXwCV9A1u5e3hrw +EjzPKJ9G1nvZXdkZcBan4GgifM1qUkt79O8FNlK/YCzuLwP+Co/aDH1DajTAl+P2E2eXt 18wwtgm+/Qlr3/bpI4Cja8UzyMtMWdncfWot6EcDaQONFeFChwqI9Zt0KH70LQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737729365; a=rsa-sha256; cv=none; b=cY6z6ySPs+bJUNYmI4CG93Krzf7dDB5Zf07qfIk6Os+Ts2VIMPRUyEPJkWWWHRTnKdAeM2 IB6o/YgaZM9sNT7r8NzejjA7GBGxacJ+JbLcY7CAbxh28SzW0g44eniOrbvmDVYlr96uKU kQZin8GvJLsXcquoMX7VGtKzAhxruA5z1ABZ6nwFer+O1TdS58cWV/GaB4JReJpe2ODP1a 7VuBqap7R1rCtpt/rtfGHFNQg0v5WG+2/FYH6iOwytOARn3dUYI9aUF2GkaUpWRoKnJn37 eVqU0MziHYd1YcSHDA0gvKZvrLwtpEttrOJWYOd4e/SHMJk2wQabhmkmal4S/Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfgNP3mdNzDCy; Fri, 24 Jan 2025 14:36: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 50OEa5J9006583; Fri, 24 Jan 2025 14:36:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OEa5be006580; Fri, 24 Jan 2025 14:36:05 GMT (envelope-from git) Date: Fri, 24 Jan 2025 14:36:05 GMT Message-Id: <202501241436.50OEa5be006580@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: c901e89d8e46 - main - savecore: add missing call to cap_openlog when in capabilities 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c901e89d8e467b56f844ab5dba18dc20d503c2be Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c901e89d8e467b56f844ab5dba18dc20d503c2be commit c901e89d8e467b56f844ab5dba18dc20d503c2be Author: Stéphane Rochoy AuthorDate: 2024-12-11 13:39:36 +0000 Commit: Mark Johnston CommitDate: 2025-01-24 14:20:51 +0000 savecore: add missing call to cap_openlog when in capabilities mode Signed-off-by: Stéphane Rochoy Reviewed by: markj, oshogbo MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/1546 --- sbin/savecore/savecore.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c index 5ba7e62e7d6c..2f3ad3adc7ab 100644 --- a/sbin/savecore/savecore.c +++ b/sbin/savecore/savecore.c @@ -101,6 +101,9 @@ #define STATUS_GOOD 1 #define STATUS_UNKNOWN 2 +#define LOG_OPTIONS LOG_PERROR +#define LOG_FACILITY LOG_DAEMON + static cap_channel_t *capsyslog; static fileargs_t *capfa; static bool checkfor, compress, uncompress, clear, force, keep; /* flags */ @@ -1409,6 +1412,7 @@ init_caps(int argc, char **argv) exit(EXIT_FAILURE); } cap_close(capcas); + cap_openlog(capsyslog, "savecore", LOG_OPTIONS, LOG_FACILITY); } static void @@ -1436,7 +1440,7 @@ main(int argc, char **argv) savedir = "."; comp_desired = KERNELDUMP_COMP_NONE; - openlog("savecore", LOG_PERROR, LOG_DAEMON); + openlog("savecore", LOG_OPTIONS, LOG_FACILITY); signal(SIGINFO, infohandler); argc = xo_parse_args(argc, argv); From nobody Fri Jan 24 14:36:06 2025 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 4YfgNR1jFKz5lTs5; Fri, 24 Jan 2025 14:36: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 4YfgNQ5l2Sz3VYT; Fri, 24 Jan 2025 14:36:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737729366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fRtXjYNF0FJlvTt9FNVDrNDxdSqdtaxcap9o6YNuLeM=; b=tgHYybzvn/VfEvJlhkuLRI8Mngo6EcIEU1ljSUxXdPtsvNWUJ/k+cR5ZOJ2cB+OyroKm4q Kvd/+4Gu60TdJviDBquMiAyqvfaTk1c8RVsDwL+9fuG+zgmA3tWpN/L0jp14z2nZLIV274 ys1S65u4CUu69JTcIdYhygz+cMMpsmG7SKyzw4YnyDcGFoD0elmUF3m6DbrGTsglkUN2yD 6qmqoYmPgSUgMcX/nbLcyhtzMqYCk7ZHvFciI4Z4h4LN0jXwFWOCtVIHb8o3QNmayyaWng k+GqKWjLZ01DGKemUQ6R9zO1SuGzT/TlsfFTccKBq+MAgTEvBJsuS+SgL+0Vrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737729366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fRtXjYNF0FJlvTt9FNVDrNDxdSqdtaxcap9o6YNuLeM=; b=tMUabNhKZyST72Hz2NYUu5Tna36HuX+H6azqoD16+sCvtcVgHcmPklvI7M/1RYwFiG0zl3 b6Wsve8+T5uj5VmYal7v90n+K7R8oZJHn+wLXcZwUnLus8ZcVsyu0QJct/bAEzyH8FyX5b j+0mJjlHVo9k1IDtgAm3Eakjmzhp2BnUwm5GmHa6dtQy3mQ9Dg5PCDz3JiIuadl1EM7/HV x7TgKe6ABJJHeWqJsG4OkLmg/XMaBazkkmTpGHolXxc/lbyhZNYiwSNO6LR8qp5kXNhE0h LKSJn+wT8LMlxrU0I5raQq6YSpg3UrKnAo93SEyrGJfHVPayrPzYb2aJdjsUkQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737729366; a=rsa-sha256; cv=none; b=f3Sup1oTpboOs4+v00pmk47b/Twq7a2yWxTuk1HJoDvOUVzjV7/FT3yH8qTcfTiEIpPqgj 6+VA9qDj1IoK6e4L+USpQmCExdkA/DsqqIVlIQau+MxLmIiDRfiBkpRxg9itKpGCTfm9// EPTI6B3CPRMWJJF1HE/kfag9j1CgoyFLAkXcmKkOsWTmevn5qgPFqD/VHHtZ9SA79K+DA9 7IjCzF5uvntxt1davDFoR0g899LGN0hra2WlUzwFPQV6h7lxHeBtK5GYdFe1D+K8TigXlt hmLX+LtpHw24J8IOmCN2MNNZG6Qsd7hwNlnPyzKQRqQ9PHO0oVmPk8TSNrW6Fg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfgNQ5FGBzDD0; Fri, 24 Jan 2025 14:36: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 50OEa6Oi006616; Fri, 24 Jan 2025 14:36:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OEa6Uu006613; Fri, 24 Jan 2025 14:36:06 GMT (envelope-from git) Date: Fri, 24 Jan 2025 14:36:06 GMT Message-Id: <202501241436.50OEa6Uu006613@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: 3dc18af5770f - main - savecore: add a test for LOG_PERROR 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: 3dc18af5770f9fc820343021d63dfc4cf09d9906 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3dc18af5770f9fc820343021d63dfc4cf09d9906 commit 3dc18af5770f9fc820343021d63dfc4cf09d9906 Author: Stéphane Rochoy AuthorDate: 2024-12-12 14:11:47 +0000 Commit: Mark Johnston CommitDate: 2025-01-24 14:21:36 +0000 savecore: add a test for LOG_PERROR Signed-off-by: Stéphane Rochoy Reviewed by: markj, oshogbo MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/1546 --- sbin/savecore/tests/Makefile | 2 +- sbin/savecore/tests/log_test.sh | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/sbin/savecore/tests/Makefile b/sbin/savecore/tests/Makefile index b58e79f518ef..81e6b8ce2667 100644 --- a/sbin/savecore/tests/Makefile +++ b/sbin/savecore/tests/Makefile @@ -1,3 +1,3 @@ -ATF_TESTS_SH= livedump_test +ATF_TESTS_SH= livedump_test log_test .include diff --git a/sbin/savecore/tests/log_test.sh b/sbin/savecore/tests/log_test.sh new file mode 100644 index 000000000000..9b006a2f2644 --- /dev/null +++ b/sbin/savecore/tests/log_test.sh @@ -0,0 +1,25 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2025 Stéphane Rochoy +# + +atf_test_case log_perror +log_perror_head() +{ + atf_set "descr" "Test LOG_PERROR behavior" +} +log_perror_body() +{ + atf_check -s exit:1 \ + -o ignore \ + -e save:savecore.err \ + savecore -vC /dev/missing + grep -qE 'savecore [0-9]+ - - /dev/missing: No such file or directory' savecore.err \ + || atf_fail "missing/invalid error output" +} + +atf_init_test_cases() +{ + atf_add_test_case log_perror +} From nobody Fri Jan 24 14:36:07 2025 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 4YfgNS05KLz5lV42; Fri, 24 Jan 2025 14:36: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 4YfgNR5m4Rz3VJb; Fri, 24 Jan 2025 14:36:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737729367; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4rBATG9HY5YGtYU7lCyuZfIfDXdkxhjjnhM+uQnoOkk=; b=QRaVS7JFq4UezlJ4BVxBE9FpF9a/tGvzTxlChNWdiYzGSq0HrmvaqH6A6sqkpoIJYAhESa M04fbEeu6E024EhR31gBk3/zX7Z4Y3JpR7KL4F9INRygmJvQSh+1q50uBuNnOD54Eb5WM3 FkN4wuxdF9HM3DsHG7co9LrRlwaxnx4ldD8wrDsJxPoGDz9b8tpR7fiMuFDaWGF1RoHqMI BEI84PVlE5LggJwO+esUWsgz4nslgmscxBOqAFkYRX0e/Be0LLeHE3cffpcDDw83sqRwby TDG+8rDR0tXhwqEhWFJ1wVoMk7H4Np90YTvpBA2kjwgq0S0QYwPE9hEa7THuMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737729367; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4rBATG9HY5YGtYU7lCyuZfIfDXdkxhjjnhM+uQnoOkk=; b=uKo+zYxaj7B0qREoO11P4/c+65c0jjjmubxroM/wR9jPO9ZFy6ZaJwixj6K6Ma9u4C8lmD hhsHR8niKWOoE8lYcC343IwD901CQx6o5VGEhrLCZNUdIBj3RZ1LnB9nEq3bwGVW07o0+t xtkn0aEdV49CLgULxJkFbcBKou8eo4kwOlQyR4/bPRQ0wcwwYUFtC7EGQd6NVGxGUMShGD NOP++0T3ongRFnJIk50onEGXRAWqym+jcId/syNvZP518RTMwdF3+D18EZ2wbR8l4XnmM5 hGGDnRhFeOa0sL6LM46LgpZ1lr6NmkqToYH0xjh0mTC27hFvfTU5oiSlVJXeDQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737729367; a=rsa-sha256; cv=none; b=Y2WqZI4AMZQu9lDr1CG1IpX5/cnK6XXlbtYIPFJTtKVYsDCD+YMkBkaiT7y1DAErwyrTsM EsDAlqqS20Xwfy1sSiN7Q4Q/CHYPC+Sxwx3XNWhyIzMOzH++B/fnclFjzK/BsAL6BtvAm5 0JLk/5npJ/VKrwNEtskU8F6jMH3rxtbwocm4jUUTV9j2PtPBu0/a8ZgNkUvWtdNdumP7wI T9oY9I4ObkrgCFCnkQRbtAMfanXPX9f1VKQyXCs6Cn1EQDguhNyMcXSTDabHBncA6quNhS Zb6UsgtFs2NlCjsj544H4FECfbBEA3OlMn7lmQktRjniWMwwSXnTPu1t5pdoMw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfgNR5B2lzD9M; Fri, 24 Jan 2025 14:36: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 50OEa7Zo006649; Fri, 24 Jan 2025 14:36:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OEa7DC006646; Fri, 24 Jan 2025 14:36:07 GMT (envelope-from git) Date: Fri, 24 Jan 2025 14:36:07 GMT Message-Id: <202501241436.50OEa7DC006646@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: 16369f33c5d9 - main - inpcb: Remove an incorrect assertion in in_pcblbgroup_find() 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: 16369f33c5d920c614d0778642364ee1213e6069 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=16369f33c5d920c614d0778642364ee1213e6069 commit 16369f33c5d920c614d0778642364ee1213e6069 Author: Mark Johnston AuthorDate: 2025-01-24 14:22:54 +0000 Commit: Mark Johnston CommitDate: 2025-01-24 14:22:54 +0000 inpcb: Remove an incorrect assertion in in_pcblbgroup_find() The inpcb might indeed not belong to a load-balancing group when passed from in_pcblbgroup_numa(). Reported by: syzbot+58bb60fe7a452df78835@syzkaller.appspotmail.com Fixes: 7cbb6b6e28db ("inpcb: Close some SO_REUSEPORT_LB races, part 2") --- sys/netinet/in_pcb.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index c50e39f20c16..f9eac96acd5b 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -304,8 +304,6 @@ in_pcblbgroup_find(struct inpcb *inp) pcbinfo = inp->inp_pcbinfo; INP_HASH_LOCK_ASSERT(pcbinfo); - KASSERT((inp->inp_flags & INP_INLBGROUP) != 0, - ("inpcb %p is not in a load balance group", inp)); hdr = &pcbinfo->ipi_lbgrouphashbase[ INP_PCBPORTHASH(inp->inp_lport, pcbinfo->ipi_lbgrouphashmask)]; From nobody Fri Jan 24 14:36:08 2025 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 4YfgNT1xFBz5lTgc; Fri, 24 Jan 2025 14:36: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 4YfgNS6ZnWz3VT3; Fri, 24 Jan 2025 14:36:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737729368; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+3wtGTavu3EGayrj8Vk5GjtwjreOmwM9IRBj0kbfuJM=; b=wRO4T/kyc1MdoKOZYqpqnOfdWbaCmuggRhNq0ovzg+NzL28X1X2nBm/fFuZCRjy2OSRmWr MdaXw0JCDx/k97DXEUuuHAYAloVimQHBEA1J/jLWeVQPpdjpT2xJk32S9LCUPCjwaTSqUb fUC73O6jazi02D1jHQyW/ihkGcqOlJXsccQuKsaz6iMCdinoHjcBSDFR7xYDUgPz9wIfNL Af/uDrAe1sqsfY1XHkBCBgXle6S1UMcLgp6Ng+0wKMqDNuxz6nalhFpeC0rdZyaMgp1Tua OQIVfhSYYhVOSg84Yh9wyMKQAKgbldzxp4LfAnmFFG2VGNNQ2TMqQjzBr6WcfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737729368; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+3wtGTavu3EGayrj8Vk5GjtwjreOmwM9IRBj0kbfuJM=; b=UP1bSFcFu3AfbCJGdKo9JprYlkyxI6qOhJ/pc8tfL/63NJxpYl8CVbxxKUjm/kMYiMOM1G U+JwkB9Q4R+uQdrrtbKZcSBICiUfjofKltKhjjJRhBaFkBjurMLq0qGXgUx0UzzWPnGh4k ZN1cSJtd1FQFMv7GQBZ7U6Zz4heylMRVdzgyW2/k//FjM7ojDdZ8IyXtXJWHq00y1o1VJR H3QSY3CxYnMQwHBYqoeunXEK3e3gnpZO6fU4iqripXcAaBv0gAg4wlYKY/WdieGhOWUGR1 l2aSFT4FPazLPu5vjyBlOHcV7jWATu3mH5syoA4AYqGuLE2eo8dUj0lZI0edkg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737729369; a=rsa-sha256; cv=none; b=rTQjpoim7s9/YqM0LXUaIF+PlMJRpaf1QXu35q5rJunf6QMOhSJOkREwZQ0vTZngNr5jw/ FddhVtTRtVq7DnTJOfffk1mzIpnJPxB4yCG1VjMHvzbdmdjpS6pEktC+be79whlOrlY+H2 sK5I6KZ/4cogx7a9JasLlKI/5K/+t+Vfp/LtLrXm0V4m3pnjq3ktGOIvA2x/hWSGVsWIr4 RzSLOuaWsvpFNGtkCfjkzjUZ3uIzIqH5JNhy9EEEVeaQ5kGq4G9xa9vGvfYe/9IZMRS7EE qONcEE7NwONRAgySF25Rthj4/E5XBh/1hYj9PNTjdLw3cFcrwuko16DS/oiYxw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfgNS676VzTH4; Fri, 24 Jan 2025 14:36: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 50OEa8Vs006684; Fri, 24 Jan 2025 14:36:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OEa8SK006681; Fri, 24 Jan 2025 14:36:08 GMT (envelope-from git) Date: Fri, 24 Jan 2025 14:36:08 GMT Message-Id: <202501241436.50OEa8SK006681@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: ff13773802dc - main - savecore tests: Update to match output from savecore(8) 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: ff13773802dcc22f3585fb953c9fffbb605ce3ac Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ff13773802dcc22f3585fb953c9fffbb605ce3ac commit ff13773802dcc22f3585fb953c9fffbb605ce3ac Author: Mark Johnston AuthorDate: 2025-01-24 14:32:36 +0000 Commit: Mark Johnston CommitDate: 2025-01-24 14:32:36 +0000 savecore tests: Update to match output from savecore(8) --- sbin/savecore/tests/livedump_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/savecore/tests/livedump_test.sh b/sbin/savecore/tests/livedump_test.sh index 42c726bfad4e..382b090235ee 100644 --- a/sbin/savecore/tests/livedump_test.sh +++ b/sbin/savecore/tests/livedump_test.sh @@ -13,7 +13,7 @@ livedump_kldstat_head() } livedump_kldstat_body() { - atf_check savecore -L . + atf_check -e match:"savecore .*- livedump" savecore -L . kernel=$(sysctl -n kern.bootfile) From nobody Fri Jan 24 14:51:19 2025 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 4Yfgjz4py9z5lW0g; Fri, 24 Jan 2025 14:51: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 4Yfgjz10gfz3bCg; Fri, 24 Jan 2025 14:51:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737730279; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Lp6ZaePx2zfUOyAuN4sMO3quJYio49N19SH+1WVFH7s=; b=ZLOxPjt/Pt/nWraIlGq7+Vm4l6KtycOJT3bUpCvTpWoqICNnzClzc9mdbAvS853Aip03FN rRtQmG5ru74CdTDNpjcpqDNEqse8l/EctUJqiRNxoZGlUQRrZAp5L5jZWT1pztsYlvdoAd jA8Bjr6PCy0FIKSc2WT1F1gdw56plL56PzxC3ghCtouhvVRAqaOInCm9ov/MezuoC4C9R9 XoCo7aiYr4hDNOnbwwlqEaTuh0/LLPtpRpGSJASq08aL4s/KYSu7QvRyiL2iNs1ah2lxfx 4BkBGvynIbkKGpf03SAjceZffbyzY0R54brAwsbq8Nm+Q88c2Zkd2cVCOraAKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737730279; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Lp6ZaePx2zfUOyAuN4sMO3quJYio49N19SH+1WVFH7s=; b=Oowd3C08pcF788FxpaBQkD69L2JRs9X30KWplmNP0Vamgpt/Xw4rzRtXRrnbDcHsPR3XYb vxa7aVgohSHOuvemb/ZSqMjYkYaGwv8jRhVNpBMFtdW+JmRvbL/oVvxv3hSzzyL9oIoZZ3 gmTVNujUWAVAooUHZiLHpSk3+Xvd/fvKTZaR9+auzkmBa8DOudoODOXEeg6fgqQ3fwfz1d rQips+ZawgclYezK3ojc3stIMQLiffRcxyQK1dwK2CIbR2Fy0POsBa0xvuz4cwdhhbM6QR Ypi2HDpl/IsUUMfxizICjN+Qkpx/97+Slj8vSl8m+IXL9rjN5U9jME2ei4N/dQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737730279; a=rsa-sha256; cv=none; b=prxK/8w65lPQY37gkS/Ur2cJMtGXNy55yPFXt39opSsoo/Qgx6RRnPh4FF8kCLMafu+Rxx J6+mNfDxytXJJ6GRLsJMJyMSYrAkqHAnvXh3MwDVfHFCIHZ0kzATqNcGqfumjw0oi8yXFy hQVolbC3x1y1cGJM4J1nzS/vnSUAgTwptftvwvePVhAa5NrqI2PT0aJZJwNbMr7f4s1Q41 UoD+YKGz2BSuBDJJKowMQvoYJycY2hG8RXyWbPGck6y9zx4rSgjVlJ6TLQvPTOk4GLWy5k 9Z1hjUtXP8jaansesJaPVB1AJVeaZvSr3kwLejNR5/qJIIWm4bpF/BWCSdDKfw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfgjz0b5yzTJZ; Fri, 24 Jan 2025 14:51: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 50OEpJM1036860; Fri, 24 Jan 2025 14:51:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OEpJa3036857; Fri, 24 Jan 2025 14:51:19 GMT (envelope-from git) Date: Fri, 24 Jan 2025 14:51:19 GMT Message-Id: <202501241451.50OEpJa3036857@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 8bba2c0f8958 - main - nvmf: Refactor reconnection 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8bba2c0f8958443790b1f3abc0675719da987e87 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8bba2c0f8958443790b1f3abc0675719da987e87 commit 8bba2c0f8958443790b1f3abc0675719da987e87 Author: John Baldwin AuthorDate: 2025-01-24 14:43:19 +0000 Commit: John Baldwin CommitDate: 2025-01-24 14:43:19 +0000 nvmf: Refactor reconnection support Save more data associated with a new association including the network address of the remote controller. This permits reconnecting an association without providing the address or other details. To use this new mode, provide only an existing device ID to nvmecontrol's reconnect command. An address can still be provided to request a different address or other different settings for the new association. The saved data includes an entire Discovery Log page entry to aim to be compatible with other transports in the future. When a remote controller is connected to via a Discovery Log page entry (nvmecontrol connect-all), the raw entry is used. When a remote controller is connected to via an explicit address, an entry is synthesized from the parameters. Note that this is a pseudo-ABI break for the ioctls used by nvmf(4) in that the nvlists for handoff and reconnect now use a slightly different set of elements. Since this is only present in main I did not bother implementing compatability shims. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48214 --- lib/libnvmf/internal.h | 4 + lib/libnvmf/libnvmf.h | 17 ++- lib/libnvmf/nvmf_host.c | 77 ++++++++++++-- lib/libnvmf/nvmf_tcp.c | 22 ++++ lib/libnvmf/nvmf_transport.c | 9 ++ sbin/nvmecontrol/connect.c | 28 ++++- sbin/nvmecontrol/fabrics.c | 35 ++++-- sbin/nvmecontrol/fabrics.h | 15 ++- sbin/nvmecontrol/nvmecontrol.8 | 22 +++- sbin/nvmecontrol/reconnect.c | 234 ++++++++++++++++++++++++++++++++--------- sys/dev/nvmf/host/nvmf.c | 54 ++++++---- sys/dev/nvmf/host/nvmf_var.h | 2 + sys/dev/nvmf/nvmf.h | 14 ++- 13 files changed, 424 insertions(+), 109 deletions(-) diff --git a/lib/libnvmf/internal.h b/lib/libnvmf/internal.h index 7b3d4fbb03ef..300776c1213b 100644 --- a/lib/libnvmf/internal.h +++ b/lib/libnvmf/internal.h @@ -26,6 +26,8 @@ struct nvmf_transport_ops { /* Add params for kernel handoff. */ void (*kernel_handoff_params)(struct nvmf_qpair *qp, nvlist_t *nvl); + int (*populate_dle)(struct nvmf_qpair *qp, + struct nvme_discovery_log_entry *dle); /* Capsule operations. */ struct nvmf_capsule *(*allocate_capsule)(struct nvmf_qpair *qp); @@ -111,6 +113,8 @@ void na_clear_error(struct nvmf_association *na); void na_error(struct nvmf_association *na, const char *fmt, ...); int nvmf_kernel_handoff_params(struct nvmf_qpair *qp, nvlist_t **nvlp); +int nvmf_populate_dle(struct nvmf_qpair *qp, + struct nvme_discovery_log_entry *dle); int nvmf_pack_ioc_nvlist(struct nvmf_ioc_nv *nv, nvlist_t *nvl); #endif /* !__LIBNVMF_INTERNAL_H__ */ diff --git a/lib/libnvmf/libnvmf.h b/lib/libnvmf/libnvmf.h index 44f13fda5ddd..f34ccdb177e7 100644 --- a/lib/libnvmf/libnvmf.h +++ b/lib/libnvmf/libnvmf.h @@ -320,6 +320,14 @@ int nvmf_host_identify_namespace(struct nvmf_qpair *qp, uint32_t nsid, int nvmf_host_fetch_discovery_log_page(struct nvmf_qpair *qp, struct nvme_discovery_log **logp); +/* + * Construct a discovery log page entry that describes the connection + * used by a host association's admin queue pair. + */ +int nvmf_init_dle_from_admin_qp(struct nvmf_qpair *qp, + const struct nvme_controller_data *cdata, + struct nvme_discovery_log_entry *dle); + /* * Request a desired number of I/O queues via SET_FEATURES. The * number of actual I/O queues available is returned in *actual on @@ -332,7 +340,8 @@ int nvmf_host_request_queues(struct nvmf_qpair *qp, u_int requested, * Handoff active host association to the kernel. This frees the * qpairs (even on error). */ -int nvmf_handoff_host(struct nvmf_qpair *admin_qp, u_int num_queues, +int nvmf_handoff_host(const struct nvme_discovery_log_entry *dle, + const char *hostnqn, struct nvmf_qpair *admin_qp, u_int num_queues, struct nvmf_qpair **io_queues, const struct nvme_controller_data *cdata); /* @@ -359,8 +368,8 @@ int nvmf_reconnect_params(int fd, nvlist_t **nvlp); * Handoff active host association to an existing host in the kernel. * This frees the qpairs (even on error). */ -int nvmf_reconnect_host(int fd, struct nvmf_qpair *admin_qp, - u_int num_queues, struct nvmf_qpair **io_queues, - const struct nvme_controller_data *cdata); +int nvmf_reconnect_host(int fd, const struct nvme_discovery_log_entry *dle, + const char *hostnqn, struct nvmf_qpair *admin_qp, u_int num_queues, + struct nvmf_qpair **io_queues, const struct nvme_controller_data *cdata); #endif /* !__LIBNVMF_H__ */ diff --git a/lib/libnvmf/nvmf_host.c b/lib/libnvmf/nvmf_host.c index c3668600c463..e194522870d1 100644 --- a/lib/libnvmf/nvmf_host.c +++ b/lib/libnvmf/nvmf_host.c @@ -709,6 +709,27 @@ nvmf_host_fetch_discovery_log_page(struct nvmf_qpair *qp, return (0); } +int +nvmf_init_dle_from_admin_qp(struct nvmf_qpair *qp, + const struct nvme_controller_data *cdata, + struct nvme_discovery_log_entry *dle) +{ + int error; + uint16_t cntlid; + + memset(dle, 0, sizeof(*dle)); + error = nvmf_populate_dle(qp, dle); + if (error != 0) + return (error); + if ((cdata->fcatt & 1) == 0) + cntlid = NVMF_CNTLID_DYNAMIC; + else + cntlid = cdata->ctrlr_id; + dle->cntlid = htole16(cntlid); + memcpy(dle->subnqn, cdata->subnqn, sizeof(dle->subnqn)); + return (0); +} + int nvmf_host_request_queues(struct nvmf_qpair *qp, u_int requested, u_int *actual) { @@ -767,17 +788,23 @@ is_queue_pair_idle(struct nvmf_qpair *qp) } static int -prepare_queues_for_handoff(struct nvmf_ioc_nv *nv, struct nvmf_qpair *admin_qp, - u_int num_queues, struct nvmf_qpair **io_queues, - const struct nvme_controller_data *cdata) +prepare_queues_for_handoff(struct nvmf_ioc_nv *nv, + const struct nvme_discovery_log_entry *dle, const char *hostnqn, + struct nvmf_qpair *admin_qp, u_int num_queues, + struct nvmf_qpair **io_queues, const struct nvme_controller_data *cdata) { - nvlist_t *nvl, *nvl_qp; + const struct nvmf_association *na = admin_qp->nq_association; + nvlist_t *nvl, *nvl_qp, *nvl_rparams; u_int i; int error; if (num_queues == 0) return (EINVAL); + /* Ensure trtype matches. */ + if (dle->trtype != na->na_trtype) + return (EINVAL); + /* All queue pairs must be idle. */ if (!is_queue_pair_idle(admin_qp)) return (EBUSY); @@ -786,9 +813,35 @@ prepare_queues_for_handoff(struct nvmf_ioc_nv *nv, struct nvmf_qpair *admin_qp, return (EBUSY); } + /* Fill out reconnect parameters. */ + nvl_rparams = nvlist_create(0); + nvlist_add_binary(nvl_rparams, "dle", dle, sizeof(*dle)); + nvlist_add_string(nvl_rparams, "hostnqn", hostnqn); + nvlist_add_number(nvl_rparams, "num_io_queues", num_queues); + nvlist_add_number(nvl_rparams, "kato", admin_qp->nq_kato); + nvlist_add_number(nvl_rparams, "io_qsize", io_queues[0]->nq_qsize); + nvlist_add_bool(nvl_rparams, "sq_flow_control", + na->na_params.sq_flow_control); + switch (na->na_trtype) { + case NVMF_TRTYPE_TCP: + nvlist_add_bool(nvl_rparams, "header_digests", + na->na_params.tcp.header_digests); + nvlist_add_bool(nvl_rparams, "data_digests", + na->na_params.tcp.data_digests); + break; + default: + __unreachable(); + } + error = nvlist_error(nvl_rparams); + if (error != 0) { + nvlist_destroy(nvl_rparams); + return (error); + } + nvl = nvlist_create(0); - nvlist_add_number(nvl, "trtype", admin_qp->nq_association->na_trtype); + nvlist_add_number(nvl, "trtype", na->na_trtype); nvlist_add_number(nvl, "kato", admin_qp->nq_kato); + nvlist_move_nvlist(nvl, "rparams", nvl_rparams); /* First, the admin queue. */ error = nvmf_kernel_handoff_params(admin_qp, &nvl_qp); @@ -816,7 +869,8 @@ prepare_queues_for_handoff(struct nvmf_ioc_nv *nv, struct nvmf_qpair *admin_qp, } int -nvmf_handoff_host(struct nvmf_qpair *admin_qp, u_int num_queues, +nvmf_handoff_host(const struct nvme_discovery_log_entry *dle, + const char *hostnqn, struct nvmf_qpair *admin_qp, u_int num_queues, struct nvmf_qpair **io_queues, const struct nvme_controller_data *cdata) { struct nvmf_ioc_nv nv; @@ -829,8 +883,8 @@ nvmf_handoff_host(struct nvmf_qpair *admin_qp, u_int num_queues, goto out; } - error = prepare_queues_for_handoff(&nv, admin_qp, num_queues, io_queues, - cdata); + error = prepare_queues_for_handoff(&nv, dle, hostnqn, admin_qp, + num_queues, io_queues, cdata); if (error != 0) goto out; @@ -924,15 +978,16 @@ nvmf_reconnect_params(int fd, nvlist_t **nvlp) } int -nvmf_reconnect_host(int fd, struct nvmf_qpair *admin_qp, u_int num_queues, +nvmf_reconnect_host(int fd, const struct nvme_discovery_log_entry *dle, + const char *hostnqn, struct nvmf_qpair *admin_qp, u_int num_queues, struct nvmf_qpair **io_queues, const struct nvme_controller_data *cdata) { struct nvmf_ioc_nv nv; u_int i; int error; - error = prepare_queues_for_handoff(&nv, admin_qp, num_queues, io_queues, - cdata); + error = prepare_queues_for_handoff(&nv, dle, hostnqn, admin_qp, + num_queues, io_queues, cdata); if (error != 0) goto out; diff --git a/lib/libnvmf/nvmf_tcp.c b/lib/libnvmf/nvmf_tcp.c index 3f794b5d9750..6f41ca7ff502 100644 --- a/lib/libnvmf/nvmf_tcp.c +++ b/lib/libnvmf/nvmf_tcp.c @@ -8,9 +8,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -1144,6 +1146,25 @@ tcp_kernel_handoff_params(struct nvmf_qpair *nq, nvlist_t *nvl) nvlist_add_number(nvl, "max_icd", qp->max_icd); } +static int +tcp_populate_dle(struct nvmf_qpair *nq, struct nvme_discovery_log_entry *dle) +{ + struct nvmf_tcp_qpair *qp = TQP(nq); + struct sockaddr_storage ss; + socklen_t ss_len; + + ss_len = sizeof(ss); + if (getpeername(qp->s, (struct sockaddr *)&ss, &ss_len) == -1) + return (errno); + + if (getnameinfo((struct sockaddr *)&ss, ss_len, dle->traddr, + sizeof(dle->traddr), dle->trsvcid, sizeof(dle->trsvcid), + NI_NUMERICHOST | NI_NUMERICSERV) != 0) + return (EINVAL); + + return (0); +} + static struct nvmf_capsule * tcp_allocate_capsule(struct nvmf_qpair *qp __unused) { @@ -1468,6 +1489,7 @@ struct nvmf_transport_ops tcp_ops = { .allocate_qpair = tcp_allocate_qpair, .free_qpair = tcp_free_qpair, .kernel_handoff_params = tcp_kernel_handoff_params, + .populate_dle = tcp_populate_dle, .allocate_capsule = tcp_allocate_capsule, .free_capsule = tcp_free_capsule, .transmit_capsule = tcp_transmit_capsule, diff --git a/lib/libnvmf/nvmf_transport.c b/lib/libnvmf/nvmf_transport.c index fa3826b8c50d..b105c17d2efb 100644 --- a/lib/libnvmf/nvmf_transport.c +++ b/lib/libnvmf/nvmf_transport.c @@ -259,6 +259,15 @@ nvmf_kernel_handoff_params(struct nvmf_qpair *qp, nvlist_t **nvlp) return (0); } +int +nvmf_populate_dle(struct nvmf_qpair *qp, struct nvme_discovery_log_entry *dle) +{ + struct nvmf_association *na = qp->nq_association; + + dle->trtype = na->na_trtype; + return (na->na_ops->populate_dle(qp, dle)); +} + const char * nvmf_transport_type(uint8_t trtype) { diff --git a/sbin/nvmecontrol/connect.c b/sbin/nvmecontrol/connect.c index ef614eca2e2a..c1d5d2cbaf5a 100644 --- a/sbin/nvmecontrol/connect.c +++ b/sbin/nvmecontrol/connect.c @@ -62,11 +62,14 @@ tcp_association_params(struct nvmf_association_params *params) static int connect_nvm_controller(enum nvmf_trtype trtype, int adrfam, const char *address, - const char *port, uint16_t cntlid, const char *subnqn) + const char *port, uint16_t cntlid, const char *subnqn, + const struct nvme_discovery_log_entry *dle) { struct nvme_controller_data cdata; + struct nvme_discovery_log_entry dle_thunk; struct nvmf_association_params aparams; struct nvmf_qpair *admin, **io; + const char *hostnqn; int error; memset(&aparams, 0, sizeof(aparams)); @@ -80,16 +83,31 @@ connect_nvm_controller(enum nvmf_trtype trtype, int adrfam, const char *address, return (EX_UNAVAILABLE); } + hostnqn = opt.hostnqn; + if (hostnqn == NULL) + hostnqn = nvmf_default_hostnqn(); io = calloc(opt.num_io_queues, sizeof(*io)); error = connect_nvm_queues(&aparams, trtype, adrfam, address, port, - cntlid, subnqn, opt.hostnqn, opt.kato * 1000, &admin, io, + cntlid, subnqn, hostnqn, opt.kato * 1000, &admin, io, opt.num_io_queues, opt.queue_size, &cdata); if (error != 0) { free(io); return (error); } - error = nvmf_handoff_host(admin, opt.num_io_queues, io, &cdata); + if (dle == NULL) { + error = nvmf_init_dle_from_admin_qp(admin, &cdata, &dle_thunk); + if (error != 0) { + warnc(error, "Failed to generate handoff parameters"); + disconnect_nvm_queues(admin, io, opt.num_io_queues); + free(io); + return (EX_IOERR); + } + dle = &dle_thunk; + } + + error = nvmf_handoff_host(dle, hostnqn, admin, opt.num_io_queues, io, + &cdata); if (error != 0) { warnc(error, "Failed to handoff queues to kernel"); free(io); @@ -140,7 +158,7 @@ connect_discovery_entry(struct nvme_discovery_log_entry *entry) /* XXX: Should this make use of entry->aqsz in some way? */ connect_nvm_controller(entry->trtype, adrfam, entry->traddr, - entry->trsvcid, entry->cntlid, entry->subnqn); + entry->trsvcid, entry->cntlid, entry->subnqn, entry); } static void @@ -198,7 +216,7 @@ connect_fn(const struct cmd *f, int argc, char *argv[]) cntlid = nvmf_parse_cntlid(opt.cntlid); error = connect_nvm_controller(trtype, AF_UNSPEC, address, port, cntlid, - opt.subnqn); + opt.subnqn, NULL); if (error != 0) exit(error); diff --git a/sbin/nvmecontrol/fabrics.c b/sbin/nvmecontrol/fabrics.c index 27ecc8fb6cdc..1d90a62dd3e3 100644 --- a/sbin/nvmecontrol/fabrics.c +++ b/sbin/nvmecontrol/fabrics.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -48,6 +49,14 @@ init_hostid(void) return (true); } +const char * +nvmf_default_hostnqn(void) +{ + if (!init_hostid()) + exit(EX_IOERR); + return (nqn); +} + void nvmf_parse_address(const char *in_address, const char **address, const char **port, char **tofree) @@ -137,7 +146,7 @@ nvmf_parse_cntlid(const char *cntlid) } } -bool +static bool tcp_qpair_params(struct nvmf_qpair_params *params, int adrfam, const char *address, const char *port) { @@ -422,13 +431,10 @@ connect_nvm_queues(const struct nvmf_association_params *aparams, if (!init_hostid()) return (EX_IOERR); - if (hostnqn != NULL) { - if (!nvmf_nqn_valid(hostnqn)) { - warnx("Invalid HostNQN %s", hostnqn); - return (EX_USAGE); - } - } else - hostnqn = nqn; + if (hostnqn == NULL || !nvmf_nqn_valid(hostnqn)) { + warnx("Invalid HostNQN %s", hostnqn); + return (EX_USAGE); + } /* Association. */ na = nvmf_allocate_association(trtype, false, aparams); @@ -510,12 +516,19 @@ connect_nvm_queues(const struct nvmf_association_params *aparams, return (0); out: + disconnect_nvm_queues(*admin, io, num_io_queues); + nvmf_free_association(na); + return (error); +} + +void +disconnect_nvm_queues(struct nvmf_qpair *admin, struct nvmf_qpair **io, + u_int num_io_queues) +{ for (u_int i = 0; i < num_io_queues; i++) { if (io[i] == NULL) break; nvmf_free_qpair(io[i]); } - shutdown_controller(*admin); - nvmf_free_association(na); - return (error); + shutdown_controller(admin); } diff --git a/sbin/nvmecontrol/fabrics.h b/sbin/nvmecontrol/fabrics.h index 9d6ee24b88fb..1f43fc53bb8f 100644 --- a/sbin/nvmecontrol/fabrics.h +++ b/sbin/nvmecontrol/fabrics.h @@ -18,9 +18,11 @@ void nvmf_parse_address(const char *in_address, const char **address, uint16_t nvmf_parse_cntlid(const char *cntlid); -/* Returns true if able to open a connection. */ -bool tcp_qpair_params(struct nvmf_qpair_params *params, int adrfam, - const char *address, const char *port); +const char *nvmf_default_hostnqn(void); + +int nvmf_init_dle_from_address(enum nvmf_trtype trtype, const char *address, + const char *port, uint16_t cntlid, const char *subnqn, + struct nvme_discovery_log_entry *dle); /* Connect to a discovery controller and return the Admin qpair. */ struct nvmf_qpair *connect_discovery_adminq(enum nvmf_trtype trtype, @@ -38,4 +40,11 @@ int connect_nvm_queues(const struct nvmf_association_params *aparams, uint32_t kato, struct nvmf_qpair **admin, struct nvmf_qpair **io, u_int num_io_queues, u_int queue_size, struct nvme_controller_data *cdata); +/* + * Disconnect from an NVM controller disconnecting all queues and + * shutting down the controller. + */ +void disconnect_nvm_queues(struct nvmf_qpair *admin, struct nvmf_qpair **io, + u_int num_io_queues); + #endif /* !__FABRICS_H__ */ diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8 index e21079b17ed6..a9f4552fbdc6 100644 --- a/sbin/nvmecontrol/nvmecontrol.8 +++ b/sbin/nvmecontrol/nvmecontrol.8 @@ -235,6 +235,9 @@ .Aq Ar device-id | Ar namespace-id | Ar SubNQN .Nm .Ic reconnect +.Aq Ar device-id +.Nm +.Ic reconnect .Op Fl FGg .Op Fl i Ar queues .Op Fl k Ar seconds @@ -813,11 +816,20 @@ Delete the controller device associated with a remote I/O controller including any active association and open queues. .Ss reconnect Reestablish an association for the remote I/O controller associated with -.Ar device-id -at -.Ar address . -The address must include a port. -The flags have the same meaning for the new association as described above +.Ar device-id . +If an +.Ar address +is not provided, +the resolved address and settings from the previous association are used +to establish a new association. +If an +.Ar address +is provided, +the supplied address and command line flags are used to establish a new +association. +In this case, +the address must include a port and +the flags have the same meaning for the new association as described above for the .Cm connect command. diff --git a/sbin/nvmecontrol/reconnect.c b/sbin/nvmecontrol/reconnect.c index 4c9277bd34cb..adf1edac662b 100644 --- a/sbin/nvmecontrol/reconnect.c +++ b/sbin/nvmecontrol/reconnect.c @@ -5,6 +5,7 @@ * Written by: John Baldwin */ +#include #include #include #include @@ -24,7 +25,6 @@ static struct options { const char *dev; const char *transport; - const char *address; const char *hostnqn; uint32_t kato; uint16_t num_io_queues; @@ -35,7 +35,6 @@ static struct options { } opt = { .dev = NULL, .transport = "tcp", - .address = NULL, .hostnqn = NULL, .kato = NVMF_KATO_DEFAULT / 1000, .num_io_queues = 1, @@ -46,100 +45,240 @@ static struct options { }; static void -tcp_association_params(struct nvmf_association_params *params) +tcp_association_params(struct nvmf_association_params *params, + bool header_digests, bool data_digests) { params->tcp.pda = 0; - params->tcp.header_digests = opt.header_digests; - params->tcp.data_digests = opt.data_digests; + params->tcp.header_digests = header_digests; + params->tcp.data_digests = data_digests; /* XXX */ params->tcp.maxr2t = 1; } static int -reconnect_nvm_controller(int fd, enum nvmf_trtype trtype, int adrfam, - const char *address, const char *port) +reconnect_nvm_controller(int fd, const struct nvmf_association_params *aparams, + enum nvmf_trtype trtype, int adrfam, const char *address, const char *port, + uint16_t cntlid, const char *subnqn, const char *hostnqn, uint32_t kato, + u_int num_io_queues, u_int queue_size, + const struct nvme_discovery_log_entry *dle) { struct nvme_controller_data cdata; - struct nvmf_association_params aparams; - nvlist_t *rparams; + struct nvme_discovery_log_entry dle_thunk; struct nvmf_qpair *admin, **io; int error; - error = nvmf_reconnect_params(fd, &rparams); + io = calloc(num_io_queues, sizeof(*io)); + error = connect_nvm_queues(aparams, trtype, adrfam, address, port, + cntlid, subnqn, hostnqn, kato, &admin, io, num_io_queues, + queue_size, &cdata); if (error != 0) { - warnc(error, "Failed to fetch reconnect parameters"); - return (EX_IOERR); + free(io); + return (error); } - if (!nvlist_exists_number(rparams, "cntlid") || - !nvlist_exists_string(rparams, "subnqn")) { - nvlist_destroy(rparams); - warnx("Missing required reconnect parameters"); + if (dle == NULL) { + error = nvmf_init_dle_from_admin_qp(admin, &cdata, &dle_thunk); + if (error != 0) { + warnc(error, "Failed to generate handoff parameters"); + disconnect_nvm_queues(admin, io, num_io_queues); + free(io); + return (EX_IOERR); + } + dle = &dle_thunk; + } + + error = nvmf_reconnect_host(fd, dle, hostnqn, admin, num_io_queues, io, + &cdata); + if (error != 0) { + warnc(error, "Failed to handoff queues to kernel"); + free(io); return (EX_IOERR); } + free(io); + return (0); +} + +static int +reconnect_by_address(int fd, const nvlist_t *rparams, const char *addr) +{ + const struct nvme_discovery_log_entry *dle; + struct nvmf_association_params aparams; + enum nvmf_trtype trtype; + const char *address, *hostnqn, *port; + char *subnqn, *tofree; + int error; memset(&aparams, 0, sizeof(aparams)); aparams.sq_flow_control = opt.flow_control; - switch (trtype) { + if (strcasecmp(opt.transport, "tcp") == 0) { + trtype = NVMF_TRTYPE_TCP; + tcp_association_params(&aparams, opt.header_digests, + opt.data_digests); + } else { + warnx("Unsupported or invalid transport"); + return (EX_USAGE); + } + + nvmf_parse_address(addr, &address, &port, &tofree); + if (port == NULL) { + free(tofree); + warnx("Explicit port required"); + return (EX_USAGE); + } + + dle = nvlist_get_binary(rparams, "dle", NULL); + + hostnqn = opt.hostnqn; + if (hostnqn == NULL) + hostnqn = nvmf_default_hostnqn(); + + /* Ensure subnqn is a terminated C string. */ + subnqn = strndup(dle->subnqn, sizeof(dle->subnqn)); + + error = reconnect_nvm_controller(fd, &aparams, trtype, AF_UNSPEC, + address, port, le16toh(dle->cntlid), subnqn, hostnqn, + opt.kato * 1000, opt.num_io_queues, opt.queue_size, NULL); + free(subnqn); + free(tofree); + return (error); +} + +static int +reconnect_by_params(int fd, const nvlist_t *rparams) +{ + struct nvmf_association_params aparams; + const struct nvme_discovery_log_entry *dle; + char *address, *port, *subnqn; + int adrfam, error; + + dle = nvlist_get_binary(rparams, "dle", NULL); + + memset(&aparams, 0, sizeof(aparams)); + aparams.sq_flow_control = nvlist_get_bool(rparams, "sq_flow_control"); + switch (dle->trtype) { case NVMF_TRTYPE_TCP: - tcp_association_params(&aparams); + switch (dle->adrfam) { + case NVMF_ADRFAM_IPV4: + adrfam = AF_INET; + break; + case NVMF_ADRFAM_IPV6: + adrfam = AF_INET6; + break; + default: + warnx("Unsupported address family"); + return (EX_UNAVAILABLE); + } + switch (dle->tsas.tcp.sectype) { + case NVME_TCP_SECURITY_NONE: + break; + default: + warnx("Unsupported TCP security type"); + return (EX_UNAVAILABLE); + } + break; + + tcp_association_params(&aparams, + nvlist_get_bool(rparams, "header_digests"), + nvlist_get_bool(rparams, "data_digests")); break; default: - nvlist_destroy(rparams); - warnx("Unsupported transport %s", nvmf_transport_type(trtype)); + warnx("Unsupported transport %s", + nvmf_transport_type(dle->trtype)); return (EX_UNAVAILABLE); } - io = calloc(opt.num_io_queues, sizeof(*io)); - error = connect_nvm_queues(&aparams, trtype, adrfam, address, port, - nvlist_get_number(rparams, "cntlid"), - nvlist_get_string(rparams, "subnqn"), opt.hostnqn, opt.kato, - &admin, io, opt.num_io_queues, opt.queue_size, &cdata); + /* Ensure address, port, and subnqn is a terminated C string. */ + address = strndup(dle->traddr, sizeof(dle->traddr)); + port = strndup(dle->trsvcid, sizeof(dle->trsvcid)); + subnqn = strndup(dle->subnqn, sizeof(dle->subnqn)); + + error = reconnect_nvm_controller(fd, &aparams, dle->trtype, adrfam, + address, port, le16toh(dle->cntlid), dle->subnqn, + nvlist_get_string(rparams, "hostnqn"), + dnvlist_get_number(rparams, "kato", 0), + nvlist_get_number(rparams, "num_io_queues"), + nvlist_get_number(rparams, "io_qsize"), dle); + free(subnqn); + free(port); + free(address); + return (error); +} + +static int +fetch_and_validate_rparams(int fd, nvlist_t **rparamsp) +{ + const struct nvme_discovery_log_entry *dle; + nvlist_t *rparams; + size_t len; + int error; + + error = nvmf_reconnect_params(fd, &rparams); if (error != 0) { - free(io); + warnc(error, "Failed to fetch reconnect parameters"); + return (EX_IOERR); + } + + if (!nvlist_exists_binary(rparams, "dle") || + !nvlist_exists_string(rparams, "hostnqn") || + !nvlist_exists_number(rparams, "num_io_queues") || + !nvlist_exists_number(rparams, "io_qsize") || + !nvlist_exists_bool(rparams, "sq_flow_control")) { nvlist_destroy(rparams); - return (error); + warnx("Missing required reconnect parameters"); + return (EX_IOERR); } - nvlist_destroy(rparams); - error = nvmf_reconnect_host(fd, admin, opt.num_io_queues, io, &cdata); - if (error != 0) { - warnc(error, "Failed to handoff queues to kernel"); - free(io); + dle = nvlist_get_binary(rparams, "dle", &len); + if (len != sizeof(*dle)) { + nvlist_destroy(rparams); + warnx("Discovery Log entry reconnect parameter is wrong size"); return (EX_IOERR); } - free(io); + + switch (dle->trtype) { + case NVMF_TRTYPE_TCP: + if (!nvlist_exists_bool(rparams, "header_digests") || + !nvlist_exists_bool(rparams, "data_digests")) { + nvlist_destroy(rparams); + warnx("Missing required reconnect parameters"); + return (EX_IOERR); + } + break; + default: + nvlist_destroy(rparams); + warnx("Unsupported transport %s", + nvmf_transport_type(dle->trtype)); + return (EX_UNAVAILABLE); + } + + *rparamsp = rparams; return (0); } static void reconnect_fn(const struct cmd *f, int argc, char *argv[]) { - enum nvmf_trtype trtype; - const char *address, *port; - char *tofree; + nvlist_t *rparams; int error, fd; if (arg_parse(argc, argv, f)) return; - if (strcasecmp(opt.transport, "tcp") == 0) { - trtype = NVMF_TRTYPE_TCP; - } else - errx(EX_USAGE, "Unsupported or invalid transport"); - - nvmf_parse_address(opt.address, &address, &port, &tofree); - open_dev(opt.dev, &fd, 1, 1); - if (port == NULL) - errx(EX_USAGE, "Explicit port required"); + error = fetch_and_validate_rparams(fd, &rparams); + if (error != 0) + exit(error); - error = reconnect_nvm_controller(fd, trtype, AF_UNSPEC, address, port); + /* Check for optional address. */ + if (optind < argc) + error = reconnect_by_address(fd, rparams, argv[optind]); + else + error = reconnect_by_params(fd, rparams); if (error != 0) exit(error); + nvlist_destroy(rparams); close(fd); - free(tofree); } static const struct opts reconnect_opts[] = { @@ -166,7 +305,6 @@ static const struct opts reconnect_opts[] = { static const struct args reconnect_args[] = { { arg_string, &opt.dev, "controller-id" }, - { arg_string, &opt.address, "address" }, { arg_none, NULL, NULL }, }; diff --git a/sys/dev/nvmf/host/nvmf.c b/sys/dev/nvmf/host/nvmf.c index 77d3081243f6..94205666accf 100644 --- a/sys/dev/nvmf/host/nvmf.c +++ b/sys/dev/nvmf/host/nvmf.c @@ -200,8 +200,10 @@ nvmf_send_keep_alive(void *arg) int nvmf_copyin_handoff(const struct nvmf_ioc_nv *nv, nvlist_t **nvlp) { + const struct nvme_discovery_log_entry *dle; + const struct nvme_controller_data *cdata; const nvlist_t *const *io; - const nvlist_t *admin; + const nvlist_t *admin, *rparams; nvlist_t *nvl; size_t i, num_io_queues; uint32_t qsize; @@ -214,7 +216,15 @@ nvmf_copyin_handoff(const struct nvmf_ioc_nv *nv, nvlist_t **nvlp) if (!nvlist_exists_number(nvl, "trtype") || !nvlist_exists_nvlist(nvl, "admin") || !nvlist_exists_nvlist_array(nvl, "io") || - !nvlist_exists_binary(nvl, "cdata")) + !nvlist_exists_binary(nvl, "cdata") || + !nvlist_exists_nvlist(nvl, "rparams")) + goto invalid; + + rparams = nvlist_get_nvlist(nvl, "rparams"); + if (!nvlist_exists_binary(rparams, "dle") || + !nvlist_exists_string(rparams, "hostnqn") || + !nvlist_exists_number(rparams, "num_io_queues") || + !nvlist_exists_number(rparams, "io_qsize")) goto invalid; admin = nvlist_get_nvlist(nvl, "admin"); @@ -224,7 +234,8 @@ nvmf_copyin_handoff(const struct nvmf_ioc_nv *nv, nvlist_t **nvlp) goto invalid; io = nvlist_get_nvlist_array(nvl, "io", &num_io_queues); - if (num_io_queues < 1) + if (num_io_queues < 1 || + num_io_queues != nvlist_get_number(rparams, "num_io_queues")) goto invalid; for (i = 0; i < num_io_queues; i++) { if (!nvmf_validate_qpair_nvlist(io[i], false)) @@ -232,14 +243,20 @@ nvmf_copyin_handoff(const struct nvmf_ioc_nv *nv, nvlist_t **nvlp) } /* Require all I/O queues to be the same size. */ - qsize = nvlist_get_number(io[0], "qsize"); - for (i = 1; i < num_io_queues; i++) { + qsize = nvlist_get_number(rparams, "io_qsize"); + for (i = 0; i < num_io_queues; i++) { if (nvlist_get_number(io[i], "qsize") != qsize) goto invalid; } - nvlist_get_binary(nvl, "cdata", &i); - if (i != sizeof(struct nvme_controller_data)) + cdata = nvlist_get_binary(nvl, "cdata", &i); + if (i != sizeof(*cdata)) + goto invalid; + dle = nvlist_get_binary(rparams, "dle", &i); + if (i != sizeof(*dle)) + goto invalid; + + if (memcmp(dle->subnqn, cdata->subnqn, sizeof(cdata->subnqn)) != 0) goto invalid; *nvlp = nvl; @@ -264,7 +281,7 @@ nvmf_probe(device_t dev) } static int -nvmf_establish_connection(struct nvmf_softc *sc, const nvlist_t *nvl) +nvmf_establish_connection(struct nvmf_softc *sc, nvlist_t *nvl) { const nvlist_t *const *io; const nvlist_t *admin; @@ -294,7 +311,7 @@ nvmf_establish_connection(struct nvmf_softc *sc, const nvlist_t *nvl) sc->io[i] = nvmf_init_qp(sc, trtype, io[i], name, i); if (sc->io[i] == NULL) { device_printf(sc->dev, "Failed to setup I/O queue %u\n", - i + 1); + i); return (ENXIO); } } @@ -314,6 +331,10 @@ nvmf_establish_connection(struct nvmf_softc *sc, const nvlist_t *nvl) memcpy(sc->cdata, nvlist_get_binary(nvl, "cdata", NULL), sizeof(*sc->cdata)); + /* Save reconnect parameters. */ + nvlist_destroy(sc->rparams); + sc->rparams = nvlist_take_nvlist(nvl, "rparams"); + return (0); } @@ -467,7 +488,7 @@ nvmf_attach(device_t dev) { struct make_dev_args mda; struct nvmf_softc *sc = device_get_softc(dev); - const nvlist_t *nvl = device_get_ivars(dev); + nvlist_t *nvl = device_get_ivars(dev); const nvlist_t * const *io; struct sysctl_oid *oid; uint64_t val; @@ -584,6 +605,7 @@ out: taskqueue_drain(taskqueue_thread, &sc->disconnect_task); sx_destroy(&sc->connection_lock); + nvlist_destroy(sc->rparams); free(sc->cdata, M_NVMF); return (error); } @@ -837,6 +859,7 @@ nvmf_detach(device_t dev) nvmf_destroy_aer(sc); sx_destroy(&sc->connection_lock); + nvlist_destroy(sc->rparams); free(sc->cdata, M_NVMF); return (0); } @@ -1053,21 +1076,12 @@ error: static int *** 64 LINES SKIPPED *** From nobody Fri Jan 24 14:54:39 2025 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 4Yfgnq5DXnz5lW9v; Fri, 24 Jan 2025 14:54: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 4Yfgnq4QxGz3d8T; Fri, 24 Jan 2025 14:54:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737730479; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rg00C+LpuZGtmIM6QYTPhBDaX49YuCi0i/drQGO8xcY=; b=vE9tO42oNefhUx/ZBb178Uojvn4pMIvHMA3X0WIUXqY9jMS4bd7CDE7IM5ayXO1C4lNiO5 D+c2HIjzRYBqi60DslrbG5pIsj/JNopMOntNYkU9Wn6JqSHLHCkLP+ZHzv5ibF8ybgLHvy +n3R1HFS0E+xLVKyRtrFWzEA0FHQBrKt04l5+E0vyztQzoP7roGLmXrRfByHKAkupgLd8w pHewFgSO80jKN3XhsJsRT1T762aYdmQhOSzVcnNAlWIkNwrcDUcCsJp/Mh0Vcj+B8eOu2r zaGKHznRX8OkELwTTz7yRS3+qOY9sBPGIXUytK0Y8dOGp2Cv3Nz+FjQAwwPKtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737730479; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rg00C+LpuZGtmIM6QYTPhBDaX49YuCi0i/drQGO8xcY=; b=oTZUqSW8ogXLWWHNTRon9qO2n1VrXOuYQ8Di2erFhpjqxti7+xXhsLSkRoJEy49jAz+1/7 k4eP2k/QnV4+Czk199spWOIKX59goieMKQb+7xG09tUX0m/+I5korur5aa8XQdnr/bWf8M OtoxUjbUXoIQEFQD2+wfPG5ZsUD5vCuq3HzdFu7uD4FlcOkE3PXU39mUoUCkALA9bPZYXU jkVCHPibBdvSsDKDuQsOeCFkR/JX4KANIitqk9pQzTyPVs36XDOt1ReiUQv30iHJqtyysT g7/J/S3DFvGmDydVgSO03UsZFfEo/mvOO4Fb+QGES+tQUjVLaTxdfqtsq6Yrpg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737730479; a=rsa-sha256; cv=none; b=Se9cLg7RS542g03rSmgKYcNJipSujC0nwZ0LYcxWNMJVg/gZbri4FQXezD6AR0TZbpAkjt TXFL+YAcTUaPJA3Ph4mExrDTnvRd2gNpMdbLJwg1UsA5jBGnpb7e2+JN/Ap4+JnDCEx0Og CvJiupcGOwlB3gHn6E3mNLSpQCWPXYuw38BJCysOYHnGvlMQstGg8f6S0nFqf3f2KgNqM0 lVdfZHdejaew/0zcRCFfAy/7uoFVosBWOqekNf8M6LUhSRiqKdvrjkSON13TCsgN8wwQ0A 9B07WLiTjQFm5Chjlctt/m+zPUGNS5sAAWtWQU0eiEGuBn6Xk+zYx8uF+708eQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfgnq3nKWzTyL; Fri, 24 Jan 2025 14:54: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 50OEsdXw043710; Fri, 24 Jan 2025 14:54:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OEsdfr043707; Fri, 24 Jan 2025 14:54:39 GMT (envelope-from git) Date: Fri, 24 Jan 2025 14:54:39 GMT Message-Id: <202501241454.50OEsdfr043707@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: dd3603749cb7 - main - iscsi: Move valid_iscsi_name to libiscsiutil 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dd3603749cb7f20a628f04d595b105962b21a3d2 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=dd3603749cb7f20a628f04d595b105962b21a3d2 commit dd3603749cb7f20a628f04d595b105962b21a3d2 Author: John Baldwin AuthorDate: 2025-01-24 14:52:10 +0000 Commit: John Baldwin CommitDate: 2025-01-24 14:53:22 +0000 iscsi: Move valid_iscsi_name to libiscsiutil While here, use isxdigit(3) instead of a home-rolled version. Reviewed by: mav, asomers Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48593 --- lib/libiscsiutil/libiscsiutil.h | 3 ++ lib/libiscsiutil/utils.c | 71 ++++++++++++++++++++++++++ usr.bin/iscsictl/Makefile | 3 +- usr.bin/iscsictl/iscsictl.c | 107 ++-------------------------------------- usr.bin/iscsictl/iscsictl.h | 3 -- usr.sbin/ctld/ctld.c | 103 +------------------------------------- usr.sbin/ctld/ctld.h | 2 - usr.sbin/ctld/login.c | 2 +- 8 files changed, 82 insertions(+), 212 deletions(-) diff --git a/lib/libiscsiutil/libiscsiutil.h b/lib/libiscsiutil/libiscsiutil.h index bf26a5b8ed66..8da6ead73fce 100644 --- a/lib/libiscsiutil/libiscsiutil.h +++ b/lib/libiscsiutil/libiscsiutil.h @@ -154,6 +154,9 @@ void text_send_response(struct pdu *request, void connection_init(struct connection *conn, const struct connection_ops *ops, bool use_proxy); +bool valid_iscsi_name(const char *name, + void (*warn_fn)(const char *, ...)); + void log_init(int level); void log_set_peer_name(const char *name); void log_set_peer_addr(const char *addr); diff --git a/lib/libiscsiutil/utils.c b/lib/libiscsiutil/utils.c index e078c7a53a17..ef2d67106da5 100644 --- a/lib/libiscsiutil/utils.c +++ b/lib/libiscsiutil/utils.c @@ -28,10 +28,13 @@ * SUCH DAMAGE. */ +#include #include #include "libiscsiutil.h" +#define MAX_NAME_LEN 223 + char * checked_strdup(const char *s) { @@ -42,3 +45,71 @@ checked_strdup(const char *s) log_err(1, "strdup"); return (c); } + +bool +valid_iscsi_name(const char *name, void (*warn_fn)(const char *, ...)) +{ + int i; + + if (strlen(name) >= MAX_NAME_LEN) { + warn_fn("overlong name for target \"%s\"; max length allowed " + "by iSCSI specification is %d characters", + name, MAX_NAME_LEN); + return (false); + } + + /* + * In the cases below, we don't return an error, just in case the admin + * was right, and we're wrong. + */ + if (strncasecmp(name, "iqn.", strlen("iqn.")) == 0) { + for (i = strlen("iqn."); name[i] != '\0'; i++) { + /* + * XXX: We should verify UTF-8 normalisation, as defined + * by 3.2.6.2: iSCSI Name Encoding. + */ + if (isalnum(name[i])) + continue; + if (name[i] == '-' || name[i] == '.' || name[i] == ':') + continue; + warn_fn("invalid character \"%c\" in target name " + "\"%s\"; allowed characters are letters, digits, " + "'-', '.', and ':'", name[i], name); + break; + } + /* + * XXX: Check more stuff: valid date and a valid reversed domain. + */ + } else if (strncasecmp(name, "eui.", strlen("eui.")) == 0) { + if (strlen(name) != strlen("eui.") + 16) + warn_fn("invalid target name \"%s\"; the \"eui.\" " + "should be followed by exactly 16 hexadecimal " + "digits", name); + for (i = strlen("eui."); name[i] != '\0'; i++) { + if (!isxdigit(name[i])) { + warn_fn("invalid character \"%c\" in target " + "name \"%s\"; allowed characters are 1-9 " + "and A-F", name[i], name); + break; + } + } + } else if (strncasecmp(name, "naa.", strlen("naa.")) == 0) { + if (strlen(name) > strlen("naa.") + 32) + warn_fn("invalid target name \"%s\"; the \"naa.\" " + "should be followed by at most 32 hexadecimal " + "digits", name); + for (i = strlen("naa."); name[i] != '\0'; i++) { + if (!isxdigit(name[i])) { + warn_fn("invalid character \"%c\" in target " + "name \"%s\"; allowed characters are 1-9 " + "and A-F", name[i], name); + break; + } + } + } else { + warn_fn("invalid target name \"%s\"; should start with " + "either \"iqn.\", \"eui.\", or \"naa.\"", + name); + } + return (true); +} diff --git a/usr.bin/iscsictl/Makefile b/usr.bin/iscsictl/Makefile index 6c09faa3d915..c47b28e7be5e 100644 --- a/usr.bin/iscsictl/Makefile +++ b/usr.bin/iscsictl/Makefile @@ -3,9 +3,10 @@ PROG= iscsictl SRCS= iscsictl.c periphs.c parse.y token.l y.tab.h CFLAGS+= -I${.CURDIR} CFLAGS+= -I${SRCTOP}/sys/dev/iscsi +CFLAGS+= -I${SRCTOP}/lib/libiscsiutil MAN= iscsi.conf.5 iscsictl.8 -LIBADD= util xo +LIBADD= iscsiutil util xo YFLAGS+= -v LFLAGS+= -i diff --git a/usr.bin/iscsictl/iscsictl.c b/usr.bin/iscsictl/iscsictl.c index 922e9ed9ebea..f78e47d226bf 100644 --- a/usr.bin/iscsictl/iscsictl.c +++ b/usr.bin/iscsictl/iscsictl.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -122,38 +123,6 @@ default_initiator_name(void) return (name); } -static bool -valid_hex(const char ch) -{ - switch (ch) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'a': - case 'A': - case 'b': - case 'B': - case 'c': - case 'C': - case 'd': - case 'D': - case 'e': - case 'E': - case 'f': - case 'F': - return (true); - default: - return (false); - } -} - int parse_enable(const char *enable) { @@ -171,74 +140,6 @@ parse_enable(const char *enable) return (ENABLE_UNSPECIFIED); } -bool -valid_iscsi_name(const char *name) -{ - int i; - - if (strlen(name) >= MAX_NAME_LEN) { - xo_warnx("overlong name for \"%s\"; max length allowed " - "by iSCSI specification is %d characters", - name, MAX_NAME_LEN); - return (false); - } - - /* - * In the cases below, we don't return an error, just in case the admin - * was right, and we're wrong. - */ - if (strncasecmp(name, "iqn.", strlen("iqn.")) == 0) { - for (i = strlen("iqn."); name[i] != '\0'; i++) { - /* - * XXX: We should verify UTF-8 normalisation, as defined - * by 3.2.6.2: iSCSI Name Encoding. - */ - if (isalnum(name[i])) - continue; - if (name[i] == '-' || name[i] == '.' || name[i] == ':') - continue; - xo_warnx("invalid character \"%c\" in iSCSI name " - "\"%s\"; allowed characters are letters, digits, " - "'-', '.', and ':'", name[i], name); - break; - } - /* - * XXX: Check more stuff: valid date and a valid reversed domain. - */ - } else if (strncasecmp(name, "eui.", strlen("eui.")) == 0) { - if (strlen(name) != strlen("eui.") + 16) - xo_warnx("invalid iSCSI name \"%s\"; the \"eui.\" " - "should be followed by exactly 16 hexadecimal " - "digits", name); - for (i = strlen("eui."); name[i] != '\0'; i++) { - if (!valid_hex(name[i])) { - xo_warnx("invalid character \"%c\" in iSCSI " - "name \"%s\"; allowed characters are 1-9 " - "and A-F", name[i], name); - break; - } - } - } else if (strncasecmp(name, "naa.", strlen("naa.")) == 0) { - if (strlen(name) > strlen("naa.") + 32) - xo_warnx("invalid iSCSI name \"%s\"; the \"naa.\" " - "should be followed by at most 32 hexadecimal " - "digits", name); - for (i = strlen("naa."); name[i] != '\0'; i++) { - if (!valid_hex(name[i])) { - xo_warnx("invalid character \"%c\" in ISCSI " - "name \"%s\"; allowed characters are 1-9 " - "and A-F", name[i], name); - break; - } - } - } else { - xo_warnx("invalid iSCSI name \"%s\"; should start with " - "either \".iqn\", \"eui.\", or \"naa.\"", - name); - } - return (true); -} - void conf_verify(struct conf *conf) { @@ -257,7 +158,7 @@ conf_verify(struct conf *conf) xo_errx(1, "cannot specify TargetName for discovery " "sessions for target \"%s\"", targ->t_nickname); if (targ->t_name != NULL) { - if (valid_iscsi_name(targ->t_name) == false) + if (valid_iscsi_name(targ->t_name, xo_warnx) == false) xo_errx(1, "invalid target name \"%s\"", targ->t_name); } @@ -268,7 +169,7 @@ conf_verify(struct conf *conf) targ->t_nickname); if (targ->t_initiator_name == NULL) targ->t_initiator_name = default_initiator_name(); - if (valid_iscsi_name(targ->t_initiator_name) == false) + if (valid_iscsi_name(targ->t_initiator_name, xo_warnx) == false) xo_errx(1, "invalid initiator name \"%s\"", targ->t_initiator_name); if (targ->t_header_digest == DIGEST_UNSPECIFIED) @@ -1014,7 +915,7 @@ main(int argc, char **argv) user, secret, enable); } else { if (Aflag != 0 && target != NULL) { - if (valid_iscsi_name(target) == false) + if (valid_iscsi_name(target, xo_warnx) == false) xo_errx(1, "invalid target name \"%s\"", target); } conf = conf_new(); diff --git a/usr.bin/iscsictl/iscsictl.h b/usr.bin/iscsictl/iscsictl.h index 3bc69e4877a9..dea1a6712dd8 100644 --- a/usr.bin/iscsictl/iscsictl.h +++ b/usr.bin/iscsictl/iscsictl.h @@ -40,8 +40,6 @@ #define ISCSICTL_XO_VERSION "1" -#define MAX_NAME_LEN 223 - #define AUTH_METHOD_UNSPECIFIED 0 #define AUTH_METHOD_NONE 1 #define AUTH_METHOD_CHAP 2 @@ -103,7 +101,6 @@ void target_delete(struct target *ic); void print_periphs(int session_id); -bool valid_iscsi_name(const char *name); int parse_enable(const char *enable); #endif /* !ISCSICTL_H */ diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index 3136a5d4b7cb..93a749b9109a 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -1072,106 +1072,6 @@ portal_group_set_redirection(struct portal_group *pg, const char *addr) return (0); } -static bool -valid_hex(const char ch) -{ - switch (ch) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'a': - case 'A': - case 'b': - case 'B': - case 'c': - case 'C': - case 'd': - case 'D': - case 'e': - case 'E': - case 'f': - case 'F': - return (true); - default: - return (false); - } -} - -bool -valid_iscsi_name(const char *name) -{ - int i; - - if (strlen(name) >= MAX_NAME_LEN) { - log_warnx("overlong name for target \"%s\"; max length allowed " - "by iSCSI specification is %d characters", - name, MAX_NAME_LEN); - return (false); - } - - /* - * In the cases below, we don't return an error, just in case the admin - * was right, and we're wrong. - */ - if (strncasecmp(name, "iqn.", strlen("iqn.")) == 0) { - for (i = strlen("iqn."); name[i] != '\0'; i++) { - /* - * XXX: We should verify UTF-8 normalisation, as defined - * by 3.2.6.2: iSCSI Name Encoding. - */ - if (isalnum(name[i])) - continue; - if (name[i] == '-' || name[i] == '.' || name[i] == ':') - continue; - log_warnx("invalid character \"%c\" in target name " - "\"%s\"; allowed characters are letters, digits, " - "'-', '.', and ':'", name[i], name); - break; - } - /* - * XXX: Check more stuff: valid date and a valid reversed domain. - */ - } else if (strncasecmp(name, "eui.", strlen("eui.")) == 0) { - if (strlen(name) != strlen("eui.") + 16) - log_warnx("invalid target name \"%s\"; the \"eui.\" " - "should be followed by exactly 16 hexadecimal " - "digits", name); - for (i = strlen("eui."); name[i] != '\0'; i++) { - if (!valid_hex(name[i])) { - log_warnx("invalid character \"%c\" in target " - "name \"%s\"; allowed characters are 1-9 " - "and A-F", name[i], name); - break; - } - } - } else if (strncasecmp(name, "naa.", strlen("naa.")) == 0) { - if (strlen(name) > strlen("naa.") + 32) - log_warnx("invalid target name \"%s\"; the \"naa.\" " - "should be followed by at most 32 hexadecimal " - "digits", name); - for (i = strlen("naa."); name[i] != '\0'; i++) { - if (!valid_hex(name[i])) { - log_warnx("invalid character \"%c\" in target " - "name \"%s\"; allowed characters are 1-9 " - "and A-F", name[i], name); - break; - } - } - } else { - log_warnx("invalid target name \"%s\"; should start with " - "either \"iqn.\", \"eui.\", or \"naa.\"", - name); - } - return (true); -} - struct pport * pport_new(struct kports *kports, const char *name, uint32_t ctl_port) { @@ -1389,8 +1289,7 @@ target_new(struct conf *conf, const char *name) log_warnx("duplicated target \"%s\"", name); return (NULL); } - if (valid_iscsi_name(name) == false) { - log_warnx("target name \"%s\" is invalid", name); + if (valid_iscsi_name(name, log_warnx) == false) { return (NULL); } targ = calloc(1, sizeof(*targ)); diff --git a/usr.sbin/ctld/ctld.h b/usr.sbin/ctld/ctld.h index 3f4b653d6896..88490a94464e 100644 --- a/usr.sbin/ctld/ctld.h +++ b/usr.sbin/ctld/ctld.h @@ -46,7 +46,6 @@ #define DEFAULT_CD_BLOCKSIZE 2048 #define MAX_LUNS 1024 -#define MAX_NAME_LEN 223 #define MAX_DATA_SEGMENT_LENGTH (128 * 1024) #define SOCKBUF_SIZE 1048576 @@ -387,7 +386,6 @@ void login(struct ctld_connection *conn); void discovery(struct ctld_connection *conn); -bool valid_iscsi_name(const char *name); void set_timeout(int timeout, int fatal); #endif /* !CTLD_H */ diff --git a/usr.sbin/ctld/login.c b/usr.sbin/ctld/login.c index afd3210a828a..f57582f4e62f 100644 --- a/usr.sbin/ctld/login.c +++ b/usr.sbin/ctld/login.c @@ -874,7 +874,7 @@ login(struct ctld_connection *conn) login_send_error(request, 0x02, 0x07); log_errx(1, "received Login PDU without InitiatorName"); } - if (valid_iscsi_name(initiator_name) == false) { + if (valid_iscsi_name(initiator_name, log_warnx) == false) { login_send_error(request, 0x02, 0x00); log_errx(1, "received Login PDU with invalid InitiatorName"); } From nobody Fri Jan 24 14:54:40 2025 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 4Yfgnr5RjVz5lW85; Fri, 24 Jan 2025 14:54: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 4Yfgnr4pt2z3dSV; Fri, 24 Jan 2025 14:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737730480; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PKU+bD+bDhjzk3MSwujqyxMRH6FzNMQWpRUBNAqZKgA=; b=d59w5jdBTwKLIANGM+ZGeqFJPeZuY2EtFNnrqroxMTRvDx39mVe/ATlcFYWAMAJa8+BN4I U3FnbyojkuQ7dSUt69hQ0YErWmsevIwmNYgauzQZHeHPYBDNnUkARLYJhJhFggruB4juLU 2nQJhnoQcHe70NpqhrLbjpkkWqfH5t2XFz56csAq6nQEAbfWiL4HV0BqpBZ3xljrnWXb94 Jiby+43qarklt81pFWwKEiUcmtulh0/+lNVLlzVLJRS7sJKMltYcQN9nMR8OjTka5F0kEW ay7OvuCMTZcCfiI9CvudNaw+ENPkV35GlwEBLMV7ajB4v/VFNPJQzFF1OrW5Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737730480; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PKU+bD+bDhjzk3MSwujqyxMRH6FzNMQWpRUBNAqZKgA=; b=v9ES8arxsIc3h2mJE40ZGaWlvA+j4qR7yVsQvyMoObtfCwY6bF0G2pCBnSygNDOBSJ/0jd VPekmKBs0sTs4M8GHI98JpRJkJtxRDotpCR8YfryNb6E07lgGS2X3BbPJr96nsWnPhgykM dCV0X1rVAdFiZXm+SWUWIO/XTyB90BlBo6k3ODPkOVHHVZgi8E5kezIjO8PkotIgMsZZ0H OIpUM9eUiHVNg5/cZkK9ikQAu9j2eNmd4OF23L7ZqA7IDrdheqeVEb3cZa8pFanAB4h8fS 8gcxiGqZeFanP2ZIE9RJIhAviGm48lhSCvgl4AGlMIl6Zmxgy3x7aSYvC+Kn9Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737730480; a=rsa-sha256; cv=none; b=nBY03PR46HxDUf+X5cqLvL7P6muEnYtzC1MbSN3fs531py4fo1slA9eqMeycGwCer9Z3NW yghf9w8Y+k7QQiVGQJ+hjuXqcZKP2CsWUJ3y+iU2mnYBgKFnRanb7SBMw3LjQGLHonAgyf UmL3i6GqeKST6evcRILGcdgBzPe/zwBSO9vrq/8658cZBpqVxgK894LBTnrBWPkRx9ezVW Ppp5zRyZa3G4NcbGCRdZzWbmp9vST/3nzr4p0louZUm+ypwA/jH8NOTCZEbc91oqkc8CQO iBYph1hVjIIBeX2NdhteYf9leR2I+SYAQYS63ps3wnhhKJiDGppBnBGxtcOQtw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfgnr4N54zTK6; Fri, 24 Jan 2025 14:54: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 50OEseKK043751; Fri, 24 Jan 2025 14:54:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OEsebb043748; Fri, 24 Jan 2025 14:54:40 GMT (envelope-from git) Date: Fri, 24 Jan 2025 14:54:40 GMT Message-Id: <202501241454.50OEsebb043748@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 78cd9f0c0941 - main - ctld: Use bool in uclparse.c 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 78cd9f0c0941e7a85dde12f719d16392b23a9975 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=78cd9f0c0941e7a85dde12f719d16392b23a9975 commit 78cd9f0c0941e7a85dde12f719d16392b23a9975 Author: John Baldwin AuthorDate: 2025-01-24 14:52:26 +0000 Commit: John Baldwin CommitDate: 2025-01-24 14:53:26 +0000 ctld: Use bool in uclparse.c Previously these functions all returned either 0 or 1, but 0 was success and 1 was failure. Use a bool where false indicates failure instead which is more readable. Reviewed by: mav, asomers Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48594 --- usr.sbin/ctld/uclparse.c | 256 +++++++++++++++++++++++------------------------ 1 file changed, 128 insertions(+), 128 deletions(-) diff --git a/usr.sbin/ctld/uclparse.c b/usr.sbin/ctld/uclparse.c index b93142ede8a4..b48a96cb0263 100644 --- a/usr.sbin/ctld/uclparse.c +++ b/usr.sbin/ctld/uclparse.c @@ -44,17 +44,17 @@ static struct conf *conf = NULL; -static int uclparse_toplevel(const ucl_object_t *); -static int uclparse_chap(struct auth_group *, const ucl_object_t *); -static int uclparse_chap_mutual(struct auth_group *, const ucl_object_t *); -static int uclparse_lun(const char *, const ucl_object_t *); -static int uclparse_auth_group(const char *, const ucl_object_t *); -static int uclparse_portal_group(const char *, const ucl_object_t *); -static int uclparse_target(const char *, const ucl_object_t *); -static int uclparse_target_portal_group(struct target *, const ucl_object_t *); -static int uclparse_target_lun(struct target *, const ucl_object_t *); - -static int +static bool uclparse_toplevel(const ucl_object_t *); +static bool uclparse_chap(struct auth_group *, const ucl_object_t *); +static bool uclparse_chap_mutual(struct auth_group *, const ucl_object_t *); +static bool uclparse_lun(const char *, const ucl_object_t *); +static bool uclparse_auth_group(const char *, const ucl_object_t *); +static bool uclparse_portal_group(const char *, const ucl_object_t *); +static bool uclparse_target(const char *, const ucl_object_t *); +static bool uclparse_target_portal_group(struct target *, const ucl_object_t *); +static bool uclparse_target_lun(struct target *, const ucl_object_t *); + +static bool uclparse_chap(struct auth_group *auth_group, const ucl_object_t *obj) { const struct auth *ca; @@ -65,7 +65,7 @@ uclparse_chap(struct auth_group *auth_group, const ucl_object_t *obj) if (!user || user->type != UCL_STRING) { log_warnx("chap section in auth-group \"%s\" is missing " "\"user\" string key", auth_group->ag_name); - return (1); + return (false); } secret = ucl_object_find_key(obj, "secret"); @@ -79,12 +79,12 @@ uclparse_chap(struct auth_group *auth_group, const ucl_object_t *obj) ucl_object_tostring(secret)); if (ca == NULL) - return (1); + return (false); - return (0); + return (true); } -static int +static bool uclparse_chap_mutual(struct auth_group *auth_group, const ucl_object_t *obj) { const struct auth *ca; @@ -96,28 +96,28 @@ uclparse_chap_mutual(struct auth_group *auth_group, const ucl_object_t *obj) if (!user || user->type != UCL_STRING) { log_warnx("chap-mutual section in auth-group \"%s\" is missing " "\"user\" string key", auth_group->ag_name); - return (1); + return (false); } secret = ucl_object_find_key(obj, "secret"); if (!secret || secret->type != UCL_STRING) { log_warnx("chap-mutual section in auth-group \"%s\" is missing " "\"secret\" string key", auth_group->ag_name); - return (1); + return (false); } mutual_user = ucl_object_find_key(obj, "mutual-user"); if (!user || user->type != UCL_STRING) { log_warnx("chap-mutual section in auth-group \"%s\" is missing " "\"mutual-user\" string key", auth_group->ag_name); - return (1); + return (false); } mutual_secret = ucl_object_find_key(obj, "mutual-secret"); if (!secret || secret->type != UCL_STRING) { log_warnx("chap-mutual section in auth-group \"%s\" is missing " "\"mutual-secret\" string key", auth_group->ag_name); - return (1); + return (false); } ca = auth_new_chap_mutual(auth_group, @@ -127,12 +127,12 @@ uclparse_chap_mutual(struct auth_group *auth_group, const ucl_object_t *obj) ucl_object_tostring(mutual_secret)); if (ca == NULL) - return (1); + return (false); - return (0); + return (true); } -static int +static bool uclparse_target_portal_group(struct target *target, const ucl_object_t *obj) { struct portal_group *tpg; @@ -144,14 +144,14 @@ uclparse_target_portal_group(struct target *target, const ucl_object_t *obj) if (!portal_group || portal_group->type != UCL_STRING) { log_warnx("portal-group section in target \"%s\" is missing " "\"name\" string key", target->t_name); - return (1); + return (false); } auth_group = ucl_object_find_key(obj, "auth-group-name"); if (auth_group && auth_group->type != UCL_STRING) { log_warnx("portal-group section in target \"%s\" is missing " "\"auth-group-name\" string key", target->t_name); - return (1); + return (false); } @@ -159,7 +159,7 @@ uclparse_target_portal_group(struct target *target, const ucl_object_t *obj) if (tpg == NULL) { log_warnx("unknown portal-group \"%s\" for target " "\"%s\"", ucl_object_tostring(portal_group), target->t_name); - return (1); + return (false); } if (auth_group) { @@ -168,7 +168,7 @@ uclparse_target_portal_group(struct target *target, const ucl_object_t *obj) log_warnx("unknown auth-group \"%s\" for target " "\"%s\"", ucl_object_tostring(auth_group), target->t_name); - return (1); + return (false); } } @@ -176,14 +176,14 @@ uclparse_target_portal_group(struct target *target, const ucl_object_t *obj) if (tp == NULL) { log_warnx("can't link portal-group \"%s\" to target " "\"%s\"", ucl_object_tostring(portal_group), target->t_name); - return (1); + return (false); } tp->p_auth_group = tag; - return (0); + return (true); } -static int +static bool uclparse_target_lun(struct target *target, const ucl_object_t *obj) { struct lun *lun; @@ -196,17 +196,17 @@ uclparse_target_lun(struct target *target, const ucl_object_t *obj) if (tmp >= MAX_LUNS) { log_warnx("LU number %ju in target \"%s\" is too big", tmp, target->t_name); - return (1); + return (false); } asprintf(&name, "%s,lun,%ju", target->t_name, tmp); lun = lun_new(conf, name); if (lun == NULL) - return (1); + return (false); lun_set_scsiname(lun, name); target->t_luns[tmp] = lun; - return (0); + return (true); } if (obj->type == UCL_OBJECT) { @@ -216,32 +216,32 @@ uclparse_target_lun(struct target *target, const ucl_object_t *obj) if (num == NULL || num->type != UCL_INT) { log_warnx("lun section in target \"%s\" is missing " "\"number\" integer property", target->t_name); - return (1); + return (false); } tmp = ucl_object_toint(num); if (tmp >= MAX_LUNS) { log_warnx("LU number %ju in target \"%s\" is too big", tmp, target->t_name); - return (1); + return (false); } if (name == NULL || name->type != UCL_STRING) { log_warnx("lun section in target \"%s\" is missing " "\"name\" string property", target->t_name); - return (1); + return (false); } lun = lun_find(conf, ucl_object_tostring(name)); if (lun == NULL) - return (1); + return (false); target->t_luns[tmp] = lun; } - return (0); + return (true); } -static int +static bool uclparse_toplevel(const ucl_object_t *top) { ucl_object_iter_t it = NULL, iter = NULL; @@ -257,7 +257,7 @@ uclparse_toplevel(const ucl_object_t *top) conf->conf_debug = ucl_object_toint(obj); else { log_warnx("\"debug\" property value is not integer"); - return (1); + return (false); } } @@ -266,7 +266,7 @@ uclparse_toplevel(const ucl_object_t *top) conf->conf_timeout = ucl_object_toint(obj); else { log_warnx("\"timeout\" property value is not integer"); - return (1); + return (false); } } @@ -275,7 +275,7 @@ uclparse_toplevel(const ucl_object_t *top) conf->conf_maxproc = ucl_object_toint(obj); else { log_warnx("\"maxproc\" property value is not integer"); - return (1); + return (false); } } @@ -285,7 +285,7 @@ uclparse_toplevel(const ucl_object_t *top) ucl_object_tostring(obj)); else { log_warnx("\"pidfile\" property value is not string"); - return (1); + return (false); } } @@ -295,18 +295,18 @@ uclparse_toplevel(const ucl_object_t *top) while ((child = ucl_iterate_object(obj, &iter, true))) { if (child->type != UCL_STRING) - return (1); + return (false); err = isns_new(conf, ucl_object_tostring(child)); if (err != 0) { - return (1); + return (false); } } } else { log_warnx("\"isns-server\" property value is " "not an array"); - return (1); + return (false); } } @@ -315,7 +315,7 @@ uclparse_toplevel(const ucl_object_t *top) conf->conf_timeout = ucl_object_toint(obj); else { log_warnx("\"isns-period\" property value is not integer"); - return (1); + return (false); } } @@ -324,7 +324,7 @@ uclparse_toplevel(const ucl_object_t *top) conf->conf_timeout = ucl_object_toint(obj); else { log_warnx("\"isns-timeout\" property value is not integer"); - return (1); + return (false); } } @@ -336,7 +336,7 @@ uclparse_toplevel(const ucl_object_t *top) } } else { log_warnx("\"auth-group\" section is not an object"); - return (1); + return (false); } } @@ -348,7 +348,7 @@ uclparse_toplevel(const ucl_object_t *top) } } else { log_warnx("\"portal-group\" section is not an object"); - return (1); + return (false); } } @@ -360,7 +360,7 @@ uclparse_toplevel(const ucl_object_t *top) } } else { log_warnx("\"lun\" section is not an object"); - return (1); + return (false); } } } @@ -380,15 +380,15 @@ uclparse_toplevel(const ucl_object_t *top) } } else { log_warnx("\"target\" section is not an object"); - return (1); + return (false); } } } - return (0); + return (true); } -static int +static bool uclparse_auth_group(const char *name, const ucl_object_t *top) { struct auth_group *auth_group; @@ -408,7 +408,7 @@ uclparse_auth_group(const char *name, const ucl_object_t *top) } if (auth_group == NULL) - return (1); + return (false); while ((obj = ucl_iterate_object(top, &it, true))) { key = ucl_object_key(obj); @@ -418,7 +418,7 @@ uclparse_auth_group(const char *name, const ucl_object_t *top) err = auth_group_set_type(auth_group, value); if (err) - return (1); + return (false); } if (!strcmp(key, "chap")) { @@ -426,13 +426,13 @@ uclparse_auth_group(const char *name, const ucl_object_t *top) log_warnx("\"chap\" property of " "auth-group \"%s\" is not an array", name); - return (1); + return (false); } it2 = NULL; while ((tmp = ucl_iterate_object(obj, &it2, true))) { - if (uclparse_chap(auth_group, tmp) != 0) - return (1); + if (!uclparse_chap(auth_group, tmp)) + return (false); } } @@ -441,13 +441,13 @@ uclparse_auth_group(const char *name, const ucl_object_t *top) log_warnx("\"chap-mutual\" property of " "auth-group \"%s\" is not an array", name); - return (1); + return (false); } it2 = NULL; while ((tmp = ucl_iterate_object(obj, &it2, true))) { - if (uclparse_chap_mutual(auth_group, tmp) != 0) - return (1); + if (!uclparse_chap_mutual(auth_group, tmp)) + return (false); } } @@ -456,7 +456,7 @@ uclparse_auth_group(const char *name, const ucl_object_t *top) log_warnx("\"initiator-name\" property of " "auth-group \"%s\" is not an array", name); - return (1); + return (false); } it2 = NULL; @@ -465,7 +465,7 @@ uclparse_auth_group(const char *name, const ucl_object_t *top) an = auth_name_new(auth_group, value); if (an == NULL) - return (1); + return (false); } } @@ -474,7 +474,7 @@ uclparse_auth_group(const char *name, const ucl_object_t *top) log_warnx("\"initiator-portal\" property of " "auth-group \"%s\" is not an array", name); - return (1); + return (false); } it2 = NULL; @@ -483,15 +483,15 @@ uclparse_auth_group(const char *name, const ucl_object_t *top) ap = auth_portal_new(auth_group, value); if (ap == NULL) - return (1); + return (false); } } } - return (0); + return (true); } -static int +static bool uclparse_portal_group(const char *name, const ucl_object_t *top) { struct portal_group *portal_group; @@ -508,7 +508,7 @@ uclparse_portal_group(const char *name, const ucl_object_t *top) } if (portal_group == NULL) - return (1); + return (false); while ((obj = ucl_iterate_object(top, &it, true))) { key = ucl_object_key(obj); @@ -521,7 +521,7 @@ uclparse_portal_group(const char *name, const ucl_object_t *top) "for portal-group \"%s\"", ucl_object_tostring(obj), portal_group->pg_name); - return (1); + return (false); } } @@ -530,19 +530,19 @@ uclparse_portal_group(const char *name, const ucl_object_t *top) log_warnx("\"discovery-filter\" property of " "portal-group \"%s\" is not a string", portal_group->pg_name); - return (1); + return (false); } if (portal_group_set_filter(portal_group, ucl_object_tostring(obj)) != 0) - return (1); + return (false); } if (!strcmp(key, "listen")) { if (obj->type == UCL_STRING) { if (portal_group_add_listen(portal_group, ucl_object_tostring(obj), false) != 0) - return (1); + return (false); } else if (obj->type == UCL_ARRAY) { while ((tmp = ucl_iterate_object(obj, &it2, true))) { @@ -550,13 +550,13 @@ uclparse_portal_group(const char *name, const ucl_object_t *top) portal_group, ucl_object_tostring(tmp), false) != 0) - return (1); + return (false); } } else { log_warnx("\"listen\" property of " "portal-group \"%s\" is not a string", portal_group->pg_name); - return (1); + return (false); } } @@ -564,7 +564,7 @@ uclparse_portal_group(const char *name, const ucl_object_t *top) if (obj->type == UCL_STRING) { if (portal_group_add_listen(portal_group, ucl_object_tostring(obj), true) != 0) - return (1); + return (false); } else if (obj->type == UCL_ARRAY) { while ((tmp = ucl_iterate_object(obj, &it2, true))) { @@ -572,13 +572,13 @@ uclparse_portal_group(const char *name, const ucl_object_t *top) portal_group, ucl_object_tostring(tmp), true) != 0) - return (1); + return (false); } } else { log_warnx("\"listen\" property of " "portal-group \"%s\" is not a string", portal_group->pg_name); - return (1); + return (false); } } @@ -587,19 +587,19 @@ uclparse_portal_group(const char *name, const ucl_object_t *top) log_warnx("\"listen\" property of " "portal-group \"%s\" is not a string", portal_group->pg_name); - return (1); + return (false); } if (portal_group_set_redirection(portal_group, ucl_object_tostring(obj)) != 0) - return (1); + return (false); } if (!strcmp(key, "options")) { if (obj->type != UCL_OBJECT) { log_warnx("\"options\" property of portal group " "\"%s\" is not an object", portal_group->pg_name); - return (1); + return (false); } while ((tmp = ucl_iterate_object(obj, &it2, @@ -614,7 +614,7 @@ uclparse_portal_group(const char *name, const ucl_object_t *top) if ((obj->type != UCL_STRING) && (obj->type != UCL_INT)) { log_warnx("\"dscp\" property of portal group " "\"%s\" is not a string or integer", portal_group->pg_name); - return(1); + return (false); } if (obj->type == UCL_INT) portal_group->pg_dscp = ucl_object_toint(obj); @@ -668,7 +668,7 @@ uclparse_portal_group(const char *name, const ucl_object_t *top) portal_group->pg_dscp = IPTOS_DSCP_AF43 >> 2; else { log_warnx("\"dscp\" property value is not a supported textual value"); - return (1); + return (false); } } } @@ -677,7 +677,7 @@ uclparse_portal_group(const char *name, const ucl_object_t *top) if (obj->type != UCL_INT) { log_warnx("\"pcp\" property of portal group " "\"%s\" is not an integer", portal_group->pg_name); - return(1); + return (false); } portal_group->pg_pcp = ucl_object_toint(obj); if (!((portal_group->pg_pcp >= 0) && (portal_group->pg_pcp <= 7))) { @@ -687,10 +687,10 @@ uclparse_portal_group(const char *name, const ucl_object_t *top) } } - return (0); + return (true); } -static int +static bool uclparse_target(const char *name, const ucl_object_t *top) { struct target *target; @@ -700,7 +700,7 @@ uclparse_target(const char *name, const ucl_object_t *top) target = target_new(conf, name); if (target == NULL) - return (1); + return (false); while ((obj = ucl_iterate_object(top, &it, true))) { key = ucl_object_key(obj); @@ -709,7 +709,7 @@ uclparse_target(const char *name, const ucl_object_t *top) if (obj->type != UCL_STRING) { log_warnx("\"alias\" property of target " "\"%s\" is not a string", target->t_name); - return (1); + return (false); } target->t_alias = strdup(ucl_object_tostring(obj)); @@ -727,19 +727,19 @@ uclparse_target(const char *name, const ucl_object_t *top) log_warnx("cannot use both auth-group " "and explicit authorisations for " "target \"%s\"", target->t_name); - return (1); + return (false); } ag = ucl_object_tostring(obj); if (!ag) { log_warnx("auth-group must be a string"); - return (1); + return (false); } target->t_auth_group = auth_group_find(conf, ag); if (target->t_auth_group == NULL) { log_warnx("unknown auth-group \"%s\" for target " "\"%s\"", ucl_object_tostring(obj), target->t_name); - return (1); + return (false); } } @@ -751,19 +751,19 @@ uclparse_target(const char *name, const ucl_object_t *top) log_warnx("cannot use both auth-group and " "auth-type for target \"%s\"", target->t_name); - return (1); + return (false); } } else { target->t_auth_group = auth_group_new(conf, NULL); if (target->t_auth_group == NULL) - return (1); + return (false); target->t_auth_group->ag_target = target; } error = auth_group_set_type(target->t_auth_group, ucl_object_tostring(obj)); if (error != 0) - return (1); + return (false); } if (!strcmp(key, "chap")) { @@ -772,22 +772,22 @@ uclparse_target(const char *name, const ucl_object_t *top) log_warnx("cannot use both auth-group " "and chap for target \"%s\"", target->t_name); - return (1); + return (false); } } else { target->t_auth_group = auth_group_new(conf, NULL); if (target->t_auth_group == NULL) { - return (1); + return (false); } target->t_auth_group->ag_target = target; } - if (uclparse_chap(target->t_auth_group, obj) != 0) - return (1); + if (!uclparse_chap(target->t_auth_group, obj)) + return (false); } if (!strcmp(key, "chap-mutual")) { - if (uclparse_chap_mutual(target->t_auth_group, obj) != 0) - return (1); + if (!uclparse_chap_mutual(target->t_auth_group, obj)) + return (false); } if (!strcmp(key, "initiator-name")) { @@ -798,19 +798,19 @@ uclparse_target(const char *name, const ucl_object_t *top) log_warnx("cannot use both auth-group and " "initiator-name for target \"%s\"", target->t_name); - return (1); + return (false); } } else { target->t_auth_group = auth_group_new(conf, NULL); if (target->t_auth_group == NULL) - return (1); + return (false); target->t_auth_group->ag_target = target; } an = auth_name_new(target->t_auth_group, ucl_object_tostring(obj)); if (an == NULL) - return (1); + return (false); } if (!strcmp(key, "initiator-portal")) { @@ -821,33 +821,33 @@ uclparse_target(const char *name, const ucl_object_t *top) log_warnx("cannot use both auth-group and " "initiator-portal for target \"%s\"", target->t_name); - return (1); + return (false); } } else { target->t_auth_group = auth_group_new(conf, NULL); if (target->t_auth_group == NULL) - return (1); + return (false); target->t_auth_group->ag_target = target; } ap = auth_portal_new(target->t_auth_group, ucl_object_tostring(obj)); if (ap == NULL) - return (1); + return (false); } if (!strcmp(key, "portal-group")) { if (obj->type == UCL_OBJECT) { - if (uclparse_target_portal_group(target, obj) != 0) - return (1); + if (!uclparse_target_portal_group(target, obj)) + return (false); } if (obj->type == UCL_ARRAY) { while ((tmp = ucl_iterate_object(obj, &it2, true))) { - if (uclparse_target_portal_group(target, - tmp) != 0) - return (1); + if (!uclparse_target_portal_group(target, + tmp)) + return (false); } } } @@ -863,26 +863,26 @@ uclparse_target(const char *name, const ucl_object_t *top) if (obj->type != UCL_STRING) { log_warnx("\"redirect\" property of target " "\"%s\" is not a string", target->t_name); - return (1); + return (false); } if (target_set_redirection(target, ucl_object_tostring(obj)) != 0) - return (1); + return (false); } if (!strcmp(key, "lun")) { while ((tmp = ucl_iterate_object(obj, &it2, true))) { - if (uclparse_target_lun(target, tmp) != 0) - return (1); + if (!uclparse_target_lun(target, tmp)) + return (false); } } } - return (0); + return (true); } -static int +static bool uclparse_lun(const char *name, const ucl_object_t *top) { struct lun *lun; @@ -892,7 +892,7 @@ uclparse_lun(const char *name, const ucl_object_t *top) lun = lun_new(conf, name); if (lun == NULL) - return (1); + return (false); while ((obj = ucl_iterate_object(top, &it, true))) { key = ucl_object_key(obj); @@ -902,7 +902,7 @@ uclparse_lun(const char *name, const ucl_object_t *top) log_warnx("\"backend\" property of lun " "\"%s\" is not a string", lun->l_name); - return (1); + return (false); } lun_set_backend(lun, ucl_object_tostring(obj)); @@ -912,7 +912,7 @@ uclparse_lun(const char *name, const ucl_object_t *top) if (obj->type != UCL_INT) { log_warnx("\"blocksize\" property of lun " "\"%s\" is not an integer", lun->l_name); - return (1); + return (false); } lun_set_blocksize(lun, ucl_object_toint(obj)); @@ -922,7 +922,7 @@ uclparse_lun(const char *name, const ucl_object_t *top) if (obj->type != UCL_STRING) { log_warnx("\"device-id\" property of lun " "\"%s\" is not an integer", lun->l_name); - return (1); + return (false); } lun_set_device_id(lun, ucl_object_tostring(obj)); @@ -932,7 +932,7 @@ uclparse_lun(const char *name, const ucl_object_t *top) if (obj->type != UCL_OBJECT) { log_warnx("\"options\" property of lun " "\"%s\" is not an object", lun->l_name); - return (1); + return (false); } while ((child = ucl_iterate_object(obj, &child_it, @@ -947,7 +947,7 @@ uclparse_lun(const char *name, const ucl_object_t *top) if (obj->type != UCL_STRING) { log_warnx("\"path\" property of lun " "\"%s\" is not a string", lun->l_name); - return (1); + return (false); } lun_set_path(lun, ucl_object_tostring(obj)); @@ -957,7 +957,7 @@ uclparse_lun(const char *name, const ucl_object_t *top) if (obj->type != UCL_STRING) { log_warnx("\"serial\" property of lun " "\"%s\" is not a string", lun->l_name); - return (1); + return (false); } lun_set_serial(lun, ucl_object_tostring(obj)); @@ -967,14 +967,14 @@ uclparse_lun(const char *name, const ucl_object_t *top) if (obj->type != UCL_INT) { log_warnx("\"size\" property of lun " "\"%s\" is not an integer", lun->l_name); - return (1); + return (false); } lun_set_size(lun, ucl_object_toint(obj)); } } - return (0); + return (true); } int @@ -982,7 +982,7 @@ uclparse_conf(struct conf *newconf, const char *path) { struct ucl_parser *parser; ucl_object_t *top; - int error; + bool parsed; conf = newconf; parser = ucl_parser_new(0); @@ -995,9 +995,9 @@ uclparse_conf(struct conf *newconf, const char *path) } top = ucl_parser_get_object(parser); - error = uclparse_toplevel(top); + parsed = uclparse_toplevel(top); ucl_object_unref(top); ucl_parser_free(parser); - return (error); + return (parsed ? 0 : 1); } From nobody Fri Jan 24 14:54:41 2025 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 4Yfgnt1FmLz5lWSL; Fri, 24 Jan 2025 14:54: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 4Yfgns65yCz3dMf; Fri, 24 Jan 2025 14:54:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737730481; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/ggieH6/GrGHpuonSWOXQ3av5VFzI0TiV0bGXQdaILI=; b=UZ3XJCwOaswktYmUEvy0JkqioqTTyazDIRxNQ7w8LraRgkboQVQZFlQ+QlBszC+pHtpo6r 6Xhh4EsXCAdj7cSJeWyUE9WfFA9oIbiP9HOZxTqLFgA9Wi6i4Fk1LFDMmpRAF+6GWKeE/5 RjedJDAJcLwXlzq3XUuTPZ6zLxlM9+vMaZpYzR9tLCp3aliDFRN1KUzSHD5mTLpYPS+LW3 tslJHUlvgj74oDACjZi7brfTUDMbD9XX0IYCV//9UHS5T6L/IZ6jgcR2Huow5Vx3MukikJ qz9jHq/Wmq2foI/EKMB9zhd6Ukjx1qEoayCl8lX3RwDOC1thtuAOG6uBc4rGSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737730481; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/ggieH6/GrGHpuonSWOXQ3av5VFzI0TiV0bGXQdaILI=; b=wtyZ5ZzxTOKWhrueCu9csmqx0nxAVGABTu4JMAHToalU42c5YvaK2jLBAVOtGcSDI1O3kS gAOHWEDPX7zNewKElEl7ABBEXb0lnMXjdgKuE1eSkfM2WfBgqqjnCP+DxCFJYIDtBcbIWg OS6WyBQKygXxuFm4C3B0fTxp4vGPMUAt1NDV7Bv40kyh378Inq4ZMD6Fs/P3KFWdTkX3nV +bLAJfSDtG80IdSa0TAAF8Lm2saSfp5u5Ciip7eHqM/vLYIb7Hld1Q8R9s4mQwUJW2yvkC K2qxPj2tniK6vtk2dxzBqffZeJj1dy6FCLconZo2XhVTLdoRogayzIaWQhDQEw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737730481; a=rsa-sha256; cv=none; b=cvBlvFViy3mi7mxwZ+zJDxIyxalh33q9Yb/ETy87+SdcieSg7D28nIg61Ck8ahRDDtgDjp BdQ+cQ2/vaProgRPBje+HKBWVbI3mjznvpz88dJWONV5uaQBgUrQXLnPhrj9AR+bP+zq2s eUGW6PdSnAGnkM9tIAhyJ41uO8SFPe/JmcF4mwCzXwehLpLSU08jlIU+Bey3sgClpKv6eo CM7w17ymYTQA0w+4onfvbwJgwuDXhtZkM+cVqorOWCrJ9dGNf5iJMrzkISqfEeYpJxEH9B pKVbbXdpwvADb40O7wfRlyjBHObJQvA2a5/AXllOMCCbUBLBPmfpxOVV9RakEQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfgns5KMBzDNM; Fri, 24 Jan 2025 14:54: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 50OEsfpO043785; Fri, 24 Jan 2025 14:54:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OEsfK1043782; Fri, 24 Jan 2025 14:54:41 GMT (envelope-from git) Date: Fri, 24 Jan 2025 14:54:41 GMT Message-Id: <202501241454.50OEsfK1043782@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: b4a5ab97c810 - main - ctld: Factor out code to setup a listening socket into a separate 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b4a5ab97c8104bd9e3f36b164b4648bf9dc6bc94 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b4a5ab97c8104bd9e3f36b164b4648bf9dc6bc94 commit b4a5ab97c8104bd9e3f36b164b4648bf9dc6bc94 Author: John Baldwin AuthorDate: 2025-01-24 14:52:51 +0000 Commit: John Baldwin CommitDate: 2025-01-24 14:53:30 +0000 ctld: Factor out code to setup a listening socket into a separate function While here: - Reuse the address family from the addrinfo structure instead of calling getsockname(2) on the socket. - Remove a bogus comment about the PCP option. Reviewed by: mav, asomers Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48596 --- usr.sbin/ctld/ctld.c | 199 ++++++++++++++++++++++++--------------------------- 1 file changed, 94 insertions(+), 105 deletions(-) diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index 93a749b9109a..a67ff51a451d 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -1806,6 +1806,98 @@ conf_verify(struct conf *conf) return (0); } +static bool +portal_init_socket(struct portal *p) +{ + struct portal_group *pg = p->p_portal_group; + int error, sockbuf; + int one = 1; + + log_debugx("listening on %s, portal-group \"%s\"", + p->p_listen, pg->pg_name); + p->p_socket = socket(p->p_ai->ai_family, p->p_ai->ai_socktype, + p->p_ai->ai_protocol); + if (p->p_socket < 0) { + log_warn("socket(2) failed for %s", + p->p_listen); + return (false); + } + + sockbuf = SOCKBUF_SIZE; + if (setsockopt(p->p_socket, SOL_SOCKET, SO_RCVBUF, &sockbuf, + sizeof(sockbuf)) == -1) + log_warn("setsockopt(SO_RCVBUF) failed for %s", + p->p_listen); + sockbuf = SOCKBUF_SIZE; + if (setsockopt(p->p_socket, SOL_SOCKET, SO_SNDBUF, &sockbuf, + sizeof(sockbuf)) == -1) + log_warn("setsockopt(SO_SNDBUF) failed for %s", p->p_listen); + if (setsockopt(p->p_socket, SOL_SOCKET, SO_NO_DDP, &one, + sizeof(one)) == -1) + log_warn("setsockopt(SO_NO_DDP) failed for %s", p->p_listen); + error = setsockopt(p->p_socket, SOL_SOCKET, SO_REUSEADDR, &one, + sizeof(one)); + if (error != 0) { + log_warn("setsockopt(SO_REUSEADDR) failed for %s", p->p_listen); + close(p->p_socket); + p->p_socket = 0; + return (false); + } + + if (pg->pg_dscp != -1) { + /* Only allow the 6-bit DSCP field to be modified */ + int tos = pg->pg_dscp << 2; + switch (p->p_ai->ai_family) { + case AF_INET: + if (setsockopt(p->p_socket, IPPROTO_IP, IP_TOS, + &tos, sizeof(tos)) == -1) + log_warn("setsockopt(IP_TOS) failed for %s", + p->p_listen); + break; + case AF_INET6: + if (setsockopt(p->p_socket, IPPROTO_IPV6, IPV6_TCLASS, + &tos, sizeof(tos)) == -1) + log_warn("setsockopt(IPV6_TCLASS) failed for %s", + p->p_listen); + break; + } + } + if (pg->pg_pcp != -1) { + int pcp = pg->pg_pcp; + switch (p->p_ai->ai_family) { + case AF_INET: + if (setsockopt(p->p_socket, IPPROTO_IP, IP_VLAN_PCP, + &pcp, sizeof(pcp)) == -1) + log_warn("setsockopt(IP_VLAN_PCP) failed for %s", + p->p_listen); + break; + case AF_INET6: + if (setsockopt(p->p_socket, IPPROTO_IPV6, IPV6_VLAN_PCP, + &pcp, sizeof(pcp)) == -1) + log_warn("setsockopt(IPV6_VLAN_PCP) failed for %s", + p->p_listen); + break; + } + } + + error = bind(p->p_socket, p->p_ai->ai_addr, + p->p_ai->ai_addrlen); + if (error != 0) { + log_warn("bind(2) failed for %s", p->p_listen); + close(p->p_socket); + p->p_socket = 0; + return (false); + } + error = listen(p->p_socket, -1); + if (error != 0) { + log_warn("listen(2) failed for %s", p->p_listen); + close(p->p_socket); + p->p_socket = 0; + return (false); + } + return (true); +} + static int conf_apply(struct conf *oldconf, struct conf *newconf) { @@ -1814,8 +1906,7 @@ conf_apply(struct conf *oldconf, struct conf *newconf) struct portal *oldp, *newp; struct port *oldport, *newport, *tmpport; struct isns *oldns, *newns; - int changed, cumulated_error = 0, error, sockbuf; - int one = 1; + int changed, cumulated_error = 0, error; if (oldconf->conf_debug != newconf->conf_debug) { log_debugx("changing debug level to %d", newconf->conf_debug); @@ -2082,109 +2173,7 @@ conf_apply(struct conf *oldconf, struct conf *newconf) assert(proxy_mode == false); assert(newp->p_iser == false); - log_debugx("listening on %s, portal-group \"%s\"", - newp->p_listen, newpg->pg_name); - newp->p_socket = socket(newp->p_ai->ai_family, - newp->p_ai->ai_socktype, - newp->p_ai->ai_protocol); - if (newp->p_socket < 0) { - log_warn("socket(2) failed for %s", - newp->p_listen); - cumulated_error++; - continue; - } - sockbuf = SOCKBUF_SIZE; - if (setsockopt(newp->p_socket, SOL_SOCKET, SO_RCVBUF, - &sockbuf, sizeof(sockbuf)) == -1) - log_warn("setsockopt(SO_RCVBUF) failed " - "for %s", newp->p_listen); - sockbuf = SOCKBUF_SIZE; - if (setsockopt(newp->p_socket, SOL_SOCKET, SO_SNDBUF, - &sockbuf, sizeof(sockbuf)) == -1) - log_warn("setsockopt(SO_SNDBUF) failed " - "for %s", newp->p_listen); - if (setsockopt(newp->p_socket, SOL_SOCKET, SO_NO_DDP, - &one, sizeof(one)) == -1) - log_warn("setsockopt(SO_NO_DDP) failed " - "for %s", newp->p_listen); - error = setsockopt(newp->p_socket, SOL_SOCKET, - SO_REUSEADDR, &one, sizeof(one)); - if (error != 0) { - log_warn("setsockopt(SO_REUSEADDR) failed " - "for %s", newp->p_listen); - close(newp->p_socket); - newp->p_socket = 0; - cumulated_error++; - continue; - } - if (newpg->pg_dscp != -1) { - struct sockaddr sa; - int len = sizeof(sa); - getsockname(newp->p_socket, &sa, &len); - /* - * Only allow the 6-bit DSCP - * field to be modified - */ - int tos = newpg->pg_dscp << 2; - if (sa.sa_family == AF_INET) { - if (setsockopt(newp->p_socket, - IPPROTO_IP, IP_TOS, - &tos, sizeof(tos)) == -1) - log_warn("setsockopt(IP_TOS) " - "failed for %s", - newp->p_listen); - } else - if (sa.sa_family == AF_INET6) { - if (setsockopt(newp->p_socket, - IPPROTO_IPV6, IPV6_TCLASS, - &tos, sizeof(tos)) == -1) - log_warn("setsockopt(IPV6_TCLASS) " - "failed for %s", - newp->p_listen); - } - } - if (newpg->pg_pcp != -1) { - struct sockaddr sa; - int len = sizeof(sa); - getsockname(newp->p_socket, &sa, &len); - /* - * Only allow the 6-bit DSCP - * field to be modified - */ - int pcp = newpg->pg_pcp; - if (sa.sa_family == AF_INET) { - if (setsockopt(newp->p_socket, - IPPROTO_IP, IP_VLAN_PCP, - &pcp, sizeof(pcp)) == -1) - log_warn("setsockopt(IP_VLAN_PCP) " - "failed for %s", - newp->p_listen); - } else - if (sa.sa_family == AF_INET6) { - if (setsockopt(newp->p_socket, - IPPROTO_IPV6, IPV6_VLAN_PCP, - &pcp, sizeof(pcp)) == -1) - log_warn("setsockopt(IPV6_VLAN_PCP) " - "failed for %s", - newp->p_listen); - } - } - error = bind(newp->p_socket, newp->p_ai->ai_addr, - newp->p_ai->ai_addrlen); - if (error != 0) { - log_warn("bind(2) failed for %s", - newp->p_listen); - close(newp->p_socket); - newp->p_socket = 0; - cumulated_error++; - continue; - } - error = listen(newp->p_socket, -1); - if (error != 0) { - log_warn("listen(2) failed for %s", - newp->p_listen); - close(newp->p_socket); - newp->p_socket = 0; + if (!portal_init_socket(newp)) { cumulated_error++; continue; } From nobody Fri Jan 24 14:54:42 2025 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 4Yfgnv3Jylz5lVxp; Fri, 24 Jan 2025 14:54: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 4Yfgnt6fVqz3dHS; Fri, 24 Jan 2025 14:54:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737730482; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1R3oMGrJ2Lf5qc+tYhrTLRgS1/OG4rwdKxWjdYo6iOs=; b=kLTKho28GaeUCn+nuVf4V7Byvrc8H/cP2VESjMH7dG3nLSmHJHTTZJQaoTPP7ftJHN/Nf5 wfrhkNncCSYvLSaqlGqFKVkf7nNuxPnqSH5m0TnB/SVdabnteUj9UqFGwUSDvLylXCQzKP +N/pTmhz4uBfWZUtT76sN6BwkGcFPij/o5xeWSwcji0SK4oZRgAUE8qmd+tqqGv5St4jfK DK97FzRdFKNqoZ2A5YthYP/6AjmaipCdVBcvSKh5gNEnFFjIO8UlByjWLhx5Q91xZVYw20 EhKpSC2HG6IqfnCqlaOLN24QwtLl0jcPmKePEW7+8vJcgreU18wz6mx23Ev0KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737730482; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1R3oMGrJ2Lf5qc+tYhrTLRgS1/OG4rwdKxWjdYo6iOs=; b=PAXDaQ9hYBao5XSHsR+18W2hp1zYQZqUR/iuZiHTd0/Jyq0lHxkv0/ZgOAfeKWv5jGMRkO ua7+f8IyxxEUjn0bFk5e49L+hbr205EnzexuGnyz7Rw9cA4p7u7bwjzLFrrXnbGeBFTLwX N8ecZJTNhBu/t8ufn2H4B4lqWk7yewvdM2QKUSuvN/gQT42dVe2Kzvr+Lh/8lmuzXdGHV2 WeX7xbYx3P+Woy8Pf0NP499X5TtEVzRmDJro3UYHxd4F+9zzKLnmfJAUhar/rqP8ocqrPe JCVovJxJOkCgRukGg8hfVV8ihQ/42qoW8Y1SA2hbSgEYMOcp+nCAMkH2yKvctg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737730482; a=rsa-sha256; cv=none; b=V2maALaeu5MdTsYpEa+ZcrYMtVhdKTlqD+vp16/p8vBa1YraEjTZqYxivTYbQK6AOgSySe T3oqcSZYhtCP7fYKTw4s/lWbkT/AlDqJdVDv6JmOVzwowhu/9jqO0gCiGcMWHeaQzAfTSy G9YsZNMcHxO012iHHuqVygio/adAPldS/tpqWTQfRNJ0YKYprvis3i0IK6AJeaLJuKvZMc butnfi78ty4aln5CHuPXZG2cMqiHXWa2XU/AwbR3LDBTCs1SKYmkaCzssePI2Rb+s0HLSy XdbgB/ZjKMZOCTG/5BCttGPSF8A9VCchwUcCCMZBhYL2cUruMOkXyhWXdwwGBw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfgnt6CSjzTt2; Fri, 24 Jan 2025 14:54: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 50OEsgLt043819; Fri, 24 Jan 2025 14:54:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OEsgkp043816; Fri, 24 Jan 2025 14:54:42 GMT (envelope-from git) Date: Fri, 24 Jan 2025 14:54:42 GMT Message-Id: <202501241454.50OEsgkp043816@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: ca81304f7cbe - main - ctld: Fix assertion against the wrong field 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca81304f7cbe033be802e3e2ef12378a61fe2175 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ca81304f7cbe033be802e3e2ef12378a61fe2175 commit ca81304f7cbe033be802e3e2ef12378a61fe2175 Author: John Baldwin AuthorDate: 2025-01-24 14:53:44 +0000 Commit: John Baldwin CommitDate: 2025-01-24 14:53:44 +0000 ctld: Fix assertion against the wrong field Reviewed by: mav, imp, asomers Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48622 --- usr.sbin/ctld/discovery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/ctld/discovery.c b/usr.sbin/ctld/discovery.c index f548b41d5cba..09613284f881 100644 --- a/usr.sbin/ctld/discovery.c +++ b/usr.sbin/ctld/discovery.c @@ -161,7 +161,7 @@ discovery_target_filtered_out(const struct ctld_connection *conn, ag = targ->t_auth_group; pg = conn->conn_portal->p_portal_group; - assert(pg->pg_discovery_auth_group != PG_FILTER_UNKNOWN); + assert(pg->pg_discovery_filter != PG_FILTER_UNKNOWN); if (pg->pg_discovery_filter >= PG_FILTER_PORTAL && auth_portal_check(ag, &conn->conn_initiator_sa) != 0) { From nobody Fri Jan 24 15:08:25 2025 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 4Yfh5j6Dnmz5lX30; Fri, 24 Jan 2025 15:08: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 4Yfh5j5jW9z3jY3; Fri, 24 Jan 2025 15:08:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737731305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=w5VavZ0tpP5BeHhfLGZKAFTeAvBVV160a5fgN5EDSNg=; b=YmVBEYPq6jQkA4UzySiuwymwjmyWH6f4rm8br1tMQUDSl8yjKi8AEF128emKlwQs5ns9zz n0bV5XehWCEcfD6oguIj6PXPbhzOZVcr9Mm6EqlGWxZzse1xz3+6EGxrjADaVkxbzE5FnH UeP2pp8UjbpAt+uRKtBboaIVUKedAt7vRVTANZp3T/oKnbCOuytc9jTyQMwKaiXXJLvteO 5X22byE2Pp2fBla1CSs41xeCmo/CTHiH3sRUtNLd7cm8Fslnw+10vW0zOYr/L3MM4HNuBP ba5+kTkEYinVnk6z8SGJSNrwQDrpAbFZYATQTPN/N5OSQBicASdEvAbVAvXqaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737731305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=w5VavZ0tpP5BeHhfLGZKAFTeAvBVV160a5fgN5EDSNg=; b=WJVsJkWdAqKaJ3jdn5PQaxJEAjpiya5M9ZXv2p4ibLkJPA+fApAkrYC8g5UWiAzfQOjrAY ZzhCNfRjK1aym4jsRg//l8s4Fa8+MY12e9AXWzGeazgcok7VZB3wmKwn+QrhaavSaNIh9c noXYb61/BJ+gu8SsYLdFcOTg3qhaqUQ2LAxKzKZgBLBjsDwi1Edg7K1c8aG6A3n4aHiY7q 3q92XdlSh4zXCZiWjA1v4bO4GnzB+MqksJPisX/orSehCVh2L9Nvx6g9A8x+3OrtAL4lX/ 7dobfuRs9Gxqum0qSebBYRIfyg43a6pc3z5wcoF70aqJ5eVn3U6tahMokWrMtw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737731305; a=rsa-sha256; cv=none; b=B9WhOG/oLA24Gn9JD+mlvm3DuKS0AZUK8CuYz4lm1WBf+psQgeAgvv3DPoxUBo59NMslD4 //vxSnERO6senxyHHsinUSl9J+NisFsIIPR9fBmzKdtm/pD7wf7qdrS8rqn7xcedb7FTNo 215CV3L8QZpeaANGy/Bj/XWgg5aw1u3dPf3LG9UQ/hvEsZzc4PUqeS+g6bsjdps3koeZFS fWqWbOeQlluK4k75PQ/3JIs3pjCm+B+Q1O2b1NuSI7tUF3fEfnJPeu8+AtFTn7Z+qLhs09 8GzGaYh+SQGZmSf+AE6sCj2ywU23PTTr6wfM0lPTFBIICHEUSMtRp3MNm7dUTg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfh5j5962zV0h; Fri, 24 Jan 2025 15:08: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 50OF8PdN064573; Fri, 24 Jan 2025 15:08:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OF8PF4064570; Fri, 24 Jan 2025 15:08:25 GMT (envelope-from git) Date: Fri, 24 Jan 2025 15:08:25 GMT Message-Id: <202501241508.50OF8PF4064570@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: 0863dc10354f - main - ithread: Allow some ithreads to sleep 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: 0863dc10354ff458a3ddf8ef3b47044d7a615154 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=0863dc10354ff458a3ddf8ef3b47044d7a615154 commit 0863dc10354ff458a3ddf8ef3b47044d7a615154 Author: Andrew Turner AuthorDate: 2025-01-13 05:35:27 +0000 Commit: Andrew Turner CommitDate: 2025-01-24 15:08:09 +0000 ithread: Allow some ithreads to sleep Some ithreads need to hold a sleep mutex, e.g. when calling ACPI methods. Allow ithreads to be marked as sleepable when this is known to be safe. Reviewed by: markj, jhb Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D48283 --- share/man/man9/intr_event.9 | 10 +++++++++- sys/kern/kern_intr.c | 18 +++++++++++++----- sys/sys/bus.h | 1 + sys/sys/interrupt.h | 1 + 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/share/man/man9/intr_event.9 b/share/man/man9/intr_event.9 index d1964ce289a5..ba8faf877e6a 100644 --- a/share/man/man9/intr_event.9 +++ b/share/man/man9/intr_event.9 @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 30, 2022 +.Dd January 24, 2025 .Dt INTR_EVENT 9 .Os .Sh NAME @@ -295,6 +295,14 @@ from the handler's source triggers. Presently, the .Dv INTR_ENTROPY flag is not valid for software interrupt handlers. +The +.Dv INTR_SLEEPABLE +flag specifies that the interrupt ithread may sleep. +Presently, the +.Dv INTR_SLEEPABLE +flag requires the +.Dv INTR_EXCL +flag to be set. .Ss Handler Callbacks Each .Vt struct intr_event diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index ad0cc135167e..4ef37ac829b3 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -610,6 +610,12 @@ intr_event_add_handler(struct intr_event *ie, const char *name, if (ie == NULL || name == NULL || (handler == NULL && filter == NULL)) return (EINVAL); + if ((flags & INTR_SLEEPABLE) != 0 && (flags & INTR_EXCL) == 0) { + printf("%s: INTR_SLEEPABLE requires INTR_EXCL to be set\n", + __func__); + return (EINVAL); + } + /* Allocate and populate an interrupt handler structure. */ ih = malloc(sizeof(struct intr_handler), M_ITHREAD, M_WAITOK | M_ZERO); ih->ih_filter = filter; @@ -627,16 +633,18 @@ intr_event_add_handler(struct intr_event *ie, const char *name, if (flags & INTR_TYPE_NET) ih->ih_flags |= IH_NET; - /* We can only have one exclusive handler in a event. */ + /* We can only have one exclusive or sleepable handler in a event. */ mtx_lock(&ie->ie_lock); if (!CK_SLIST_EMPTY(&ie->ie_handlers)) { - if ((flags & INTR_EXCL) || + if ((flags & (INTR_EXCL | INTR_SLEEPABLE)) || (CK_SLIST_FIRST(&ie->ie_handlers)->ih_flags & IH_EXCLUSIVE)) { mtx_unlock(&ie->ie_lock); free(ih, M_ITHREAD); return (EINVAL); } } + if (flags & INTR_SLEEPABLE) + ie->ie_flags |= IE_SLEEPABLE; /* Create a thread if we need one. */ while (ie->ie_thread == NULL && handler != NULL) { @@ -1190,11 +1198,11 @@ static void ithread_execute_handlers(struct proc *p, struct intr_event *ie) { - /* Interrupt handlers should not sleep. */ - if (!(ie->ie_flags & IE_SOFT)) + /* Only specifically marked sleepable interrupt handlers can sleep. */ + if (!(ie->ie_flags & (IE_SOFT | IE_SLEEPABLE))) THREAD_NO_SLEEPING(); intr_event_execute_handlers(p, ie); - if (!(ie->ie_flags & IE_SOFT)) + if (!(ie->ie_flags & (IE_SOFT | IE_SLEEPABLE))) THREAD_SLEEPING_OK(); /* diff --git a/sys/sys/bus.h b/sys/sys/bus.h index 8b32e10f1285..84df9e6956d3 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -277,6 +277,7 @@ enum intr_type { INTR_EXCL = 256, /* exclusive interrupt */ INTR_MPSAFE = 512, /* this interrupt is SMP safe */ INTR_ENTROPY = 1024, /* this interrupt provides entropy */ + INTR_SLEEPABLE = 2048, /* this interrupt handler can sleep */ INTR_MD1 = 4096, /* flag reserved for MD use */ INTR_MD2 = 8192, /* flag reserved for MD use */ INTR_MD3 = 16384, /* flag reserved for MD use */ diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h index 899d65e386e0..2e84faa78e38 100644 --- a/sys/sys/interrupt.h +++ b/sys/sys/interrupt.h @@ -129,6 +129,7 @@ struct intr_event { /* Interrupt event flags kept in ie_flags. */ #define IE_SOFT 0x000001 /* Software interrupt. */ +#define IE_SLEEPABLE 0x000002 /* Sleepable ithread */ #define IE_ADDING_THREAD 0x000004 /* Currently building an ithread. */ /* Flags to pass to swi_sched. */ From nobody Fri Jan 24 15:08:26 2025 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 4Yfh5k74Jtz5lWwN; Fri, 24 Jan 2025 15:08:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yfh5k64Fzz3jQq; Fri, 24 Jan 2025 15:08:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737731306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XixfAY2qMZAAYVhrZlHX4z69t67DR+jsuW5UGZrL6Ys=; b=uqQsvLvRtPBW+sCqO9XT5d46hc9625DHtZDjmEAkvYncgaJ1JCcw9Z8I9mqpRWlfkZ7YKQ M4Tydjn2mn6FV2kyM+761vvib+cZwtX2ZaQ1fBy+9mtiLk/L3NxA+PtH0Hu+e+AjUUmtBz FgkfLhCTHRdERB6bmeVy/V0q265PzVanV4so7R1assWZNM8us+FsleF830nLu8hcuARQ25 Nt/yVpNma7MwA7XKllPWw2jNpBCjr6D1dtTQBa4xhVqP+an38aksAgKitlq6RitNBKtWcL gTkxe1rw2xbBZ8PHDlsU9p+IhG1YtOTYRt5GTh5gsKFGYRbZBVUKGXfRqOx4Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737731306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XixfAY2qMZAAYVhrZlHX4z69t67DR+jsuW5UGZrL6Ys=; b=oP23pvNQ6KgJWxvuWTL44WWzl1JzhEimueLvXzS0WhEnICFcRW/4QgJEComwdiq7l13PRN 0BmtjPxBydrV9Iau+ysMtxjw1SnFcNjU/RZxayuDJXdcQs3LDUz8RFQkjxvfzfGRrYtCpn N7MpYfJkM7GdfnUUTFRZDvbkSSrkKzYyS01br0SmmWqlimFhAe+vewTbEj9T5TnMhY+MTW /jN/mwAZehTRC6cjBuKruE4f7i4r55RVVsqGKdvR6R6nxo4LCd4JtMEbm2hdbSTBWm1QHK aabGelbKh2skhUlueWE/k+yszxzg7k4yMKDbfEgoKd/P1K06XgTMTnG9tGIK8A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737731306; a=rsa-sha256; cv=none; b=uhsEaZsFtJi/TCm8BF/uHipOaVFMPzI+2VKVAv8yJc4UR6s0WrErq5k3ZyXq3g0VkpRkZE aXs3Vs1W2wQ6MqnskcUeyw7j/C1V5J5NJelffaiFddrMNnw0gmLK0yEePmUyGHeW+vwelA Ufog8SOXwgHamwmWNJ2dHsk8T0LyRSu2s7/sNHRagST8wubXVwOKkW+eDRAxq8WtT/HJ/d cB21NlK9HF7kZBjJXhvgmxO2VTmX4g33XYPWVAd1izqTZXPMTks8t+9kK13hiO3r5ndTpy n51y4TrrhUbss4GQwCmpImyMIUAfmL9SLfvAFH0B5yBxbhRNddmwCwHeWno//A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfh5k5fp3zVT8; Fri, 24 Jan 2025 15:08: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 50OF8QBW064606; Fri, 24 Jan 2025 15:08:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OF8QL6064603; Fri, 24 Jan 2025 15:08:26 GMT (envelope-from git) Date: Fri, 24 Jan 2025 15:08:26 GMT Message-Id: <202501241508.50OF8QL6064603@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: dbedcc169f70 - main - acpi: Mark the GED ithread as sleepable 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: dbedcc169f70c924a680e02bc86d7419682a70ac Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=dbedcc169f70c924a680e02bc86d7419682a70ac commit dbedcc169f70c924a680e02bc86d7419682a70ac Author: Andrew Turner AuthorDate: 2025-01-13 05:37:52 +0000 Commit: Andrew Turner CommitDate: 2025-01-24 15:08:09 +0000 acpi: Mark the GED ithread as sleepable We need to complete calling the ACPI method before marking the interrupt as complete. If two threads are inspecting the ACPI tables at the same time they may both try to lock the ACPI mutex causing one to sleep. If this is the ithread it will panic the kernel as this is not allowed. Update the ged ithread to allow sleeping as it is expected this lock will be uncommon enough any sleep will be short. PR: 283103 Reviewed by: markj (earlier version) Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D48284 --- sys/dev/acpica/acpi_ged.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/acpica/acpi_ged.c b/sys/dev/acpica/acpi_ged.c index 23e125f277c5..caf911758ed2 100644 --- a/sys/dev/acpica/acpi_ged.c +++ b/sys/dev/acpica/acpi_ged.c @@ -244,8 +244,9 @@ acpi_ged_attach(device_t dev) } if (bus_setup_intr(dev, sc->evts[i].r, - INTR_TYPE_MISC | INTR_MPSAFE, NULL, acpi_ged_intr, - &sc->evts[i], &sc->evts[i].cookie) != 0) { + INTR_TYPE_MISC | INTR_MPSAFE | INTR_SLEEPABLE | + INTR_EXCL, NULL, acpi_ged_intr, &sc->evts[i], + &sc->evts[i].cookie) != 0) { device_printf(dev, "Failed to setup intr %d\n", i); } } From nobody Fri Jan 24 16:22:00 2025 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 4Yfjkc6jjKz5lcG8; Fri, 24 Jan 2025 16:22: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 4Yfjkc5yN3z4F4C; Fri, 24 Jan 2025 16:22:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737735720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eYYJWDkAMFLGGuih2vv35w63nkMv/vaSeRSNC8zfXxc=; b=opVxil5aKKFJRpiwH2RZ7iz+p/vII3jsCS64PLZb+tX2ca28cppaWdX8Z9QDncluM3m+yr GKhwGBGozQEpmntZqJMceSj/Bz+GtmRp9SPxafaanezKC4AE7bwW1yVegDMJ6L5FyoTQJl 5wkoor8p7qPZOgfwJdRbo0DKXghlLLtnH4McGWQqxlwqFgZVKc69VGSvmSck+ul8aYP/JP SQy+Ww34aCaN0SIaJploODE2EMpd7/uc3s3bZ7w5gcQTAF2SaSH4hfGiSJrEqWdhlcEVUe 4jFGMfTJagWJW1MEKdOMO9Qo3usxSqiQVr4QdGhEjX1JwIR684WZBq3jiDVZXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737735720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eYYJWDkAMFLGGuih2vv35w63nkMv/vaSeRSNC8zfXxc=; b=D3sLzZ2cKdTsMitMGBFS4aukMjVJmQUuRGdM3Oup+1WgC5/C/2+R6j9ShVZKfQV0nLU0oY R3G9aKdr7zjtHITjgbk5opVCCBlyztUnWnOE/unJJDu2fA2bcZbxPy1OXEKw/iqYX9aP3G dRiXk0mOxVbRiHQj3y3cdh1mtBNJDJxF4M56RJXH5u/YTrrLmJV1e9FB6Zxc0c2Gaf+AMw vlq9+p4vU6iQyo2ve/AT9jLbb3oFgH8e1T4xhJ6WZDc192/yALfCLsPxWCt2Cz+1vr3fsm TFV66b5aK5xi1weVMYDjq+TQO+GAAUtj8FlQU0lr9nvraXi3VfUcDPzYZmMrbg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737735720; a=rsa-sha256; cv=none; b=O89fjqc2oCNI6llHfGsEuDNiaEDbyVQfRvEf2wKss0a3mcwBNWIWZ2GsPaGfueRlt56MOu I4A6CQFi4aX9KD4dDs6kR5A7ayMlgEapfH16sfG+6Pw2URtjvTq7vRG3SjJCkL22MHoItW WjwBHYH38OxXYIbxzPtpHJPFuV+v/2PjJgGtyrq7sQg9ynklrJiHIsqcZy4fgRiIyB2Jab mrQxaZM2pspgfMwCXNmZc7g+JSLt03quNwoH+Cwp4vQxYyeDyDhRqmHVeZKePqvcv4vyPj 3nzVULCR+xrZcGhHNZLkkL45XJHyaNznJGeAXfBp9YbaPMNg+pbUhpfmCcD3RQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfjkc5SWWzYqx; Fri, 24 Jan 2025 16:22: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 50OGM0Kn011979; Fri, 24 Jan 2025 16:22:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OGM0FA011976; Fri, 24 Jan 2025 16:22:00 GMT (envelope-from git) Date: Fri, 24 Jan 2025 16:22:00 GMT Message-Id: <202501241622.50OGM0FA011976@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: c6170b00f44e - main - vmm: Depend on vmm_hyp* files as needed 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: c6170b00f44e97f054a3e318744729d05d5360f9 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=c6170b00f44e97f054a3e318744729d05d5360f9 commit c6170b00f44e97f054a3e318744729d05d5360f9 Author: Andrew Turner AuthorDate: 2025-01-24 16:09:03 +0000 Commit: Andrew Turner CommitDate: 2025-01-24 16:21:06 +0000 vmm: Depend on vmm_hyp* files as needed The arm64 vmm_nvhe* files depend on a vmm_hyp file to provide most of the implementation. As these are built with custom rules the normal generated dependency information is not used, even if generated. Add a dependency between these two sets of files to ensure when the implementation is updated the file will be rebuilt. Sponsored by: Arm Ltd --- sys/modules/vmm/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/modules/vmm/Makefile b/sys/modules/vmm/Makefile index 7c34dd92939b..c990852ae441 100644 --- a/sys/modules/vmm/Makefile +++ b/sys/modules/vmm/Makefile @@ -45,11 +45,11 @@ CLEANFILES+= vmm_nvhe_exception.o vmm_nvhe.o CLEANFILES+= vmm_hyp_blob.elf.full CLEANFILES+= vmm_hyp_blob.elf vmm_hyp_blob.bin -vmm_nvhe_exception.o: vmm_nvhe_exception.S +vmm_nvhe_exception.o: vmm_nvhe_exception.S vmm_hyp_exception.S ${CC} -c -x assembler-with-cpp -DLOCORE \ ${NOSAN_CFLAGS:N-mbranch-protection*} ${.IMPSRC} -o ${.TARGET} -fpie -vmm_nvhe.o: vmm_nvhe.c +vmm_nvhe.o: vmm_nvhe.c vmm_hyp.c ${CC} -c ${NOSAN_CFLAGS:N-mbranch-protection*} ${.IMPSRC} \ -o ${.TARGET} -fpie From nobody Fri Jan 24 16:48:28 2025 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 4YfkK93P8Qz5ldxh; Fri, 24 Jan 2025 16:48:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YfkK90gp9z4JfR; Fri, 24 Jan 2025 16:48:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737737309; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VYDkAsEjY/vl7w0TtEiNYitIXYotcvXoCv1Zfr7+7+A=; b=GSmPA6+Y1Z/cE9aN2X8VlC6JmmOE4N/Qst59sQ5MxgnzgSCa/bQ0+h+PKy22JHl1SPjQIg +Fre2rmBYvhcMn3auGI6UxGbwhLzWmpy964d3z8OMvm6ob/WRS6NUZG3m+JeVnDUjTWT6h btre7To2Q3mBx5I+s7UGNi/xMsG04W4VREZF7gABzrMKY/6oTf1w9gdgU3RD/rXqFL8vIL d9LPdZex4iAshGsDwiWKKpgw8a1uUctUoG8OWSji4XKVBkg4OMlt/WzjomeOK49wnudE0y E1TEQB1AYyCCczqIvCX7y+3juM0CSXpQ7ZXt6AYqUtuaxuRthQtjD7P2r20IbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737737309; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VYDkAsEjY/vl7w0TtEiNYitIXYotcvXoCv1Zfr7+7+A=; b=iBoZGIT4RWBzo/QO15QTtKJChHAEAQIArxRIWjBck6O0tK//8JgDcaobdSQkbMTlIHS1lO auv03/66u0GkOTiGMtfYvTj8A4FHxE1DptD7hxLymHHVJjb693f2AX/ODWtH86eorC88ZF fWKDx3lhxg4n+nQt03P6KZAZtq80H4DoBVWlgl2LRyoX3RoY1bJqtAmX/XpJab7775DcHH bb/02SigqXer/kvmQAjjlP4xcCqOhgXJDBbTSMsMWQzOnL6Y8xxfjOKA36cVIDWLo19YN9 snXaSGFbVCmRVDjmpOf/+/ox47G2r8n3Pvk6vqnkCwhpFz7toj5sE5D0tJDZ5w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737737309; a=rsa-sha256; cv=none; b=PB4oiNBtVX1xcndrP2B13TWxIoYNwT85TRy2T0KTlQk7h6Siv2+Gr9AIta+ff+FJO0QEVl 9K4KRXFMs+XgsAMKi5KekmA+h3qvWoxkujPx8hhfZzUl4LuFnQYyDw8IbSEM1mSjHoxrXd FMYJb1dCIhV196KiG9SDWUZoINj7dElhKhv9LiK1UksS871jN4HOSz56lBkKfMrGYLvC/5 dk2bKruHbKbKfxmVV1dM0BugmSa8yeyWhcqUcN9JdYQUOyMNh6iES0swvJcD1Qkh+DAWV8 NWaIPiMvC+gkMWKlWSGd4+bQI3DDquCc9MId+7lG9brrU795IpETgktEXd2OoQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfkK90FPqzZs1; Fri, 24 Jan 2025 16:48: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 50OGmScD051439; Fri, 24 Jan 2025 16:48:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OGmSre051436; Fri, 24 Jan 2025 16:48:28 GMT (envelope-from git) Date: Fri, 24 Jan 2025 16:48:28 GMT Message-Id: <202501241648.50OGmSre051436@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: 04a3ca71ead6 - main - netcat: Add a flag to enable the use of SO_REUSEPORT_LB 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: 04a3ca71ead61b4ced23a791d3a5e2633ca1ef72 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=04a3ca71ead61b4ced23a791d3a5e2633ca1ef72 commit 04a3ca71ead61b4ced23a791d3a5e2633ca1ef72 Author: Mark Johnston AuthorDate: 2025-01-24 16:37:43 +0000 Commit: Mark Johnston CommitDate: 2025-01-24 16:37:43 +0000 netcat: Add a flag to enable the use of SO_REUSEPORT_LB This is handy for testing purposes. Hide it behind a long option so that it doesn't conflict with upstream, like we do with several other flags. Reviewed by: imp, glebius, delphij MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D48543 --- contrib/netcat/nc.1 | 9 ++++++++- contrib/netcat/netcat.c | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/contrib/netcat/nc.1 b/contrib/netcat/nc.1 index 2e34cdc586c3..5801c6fa00e3 100644 --- a/contrib/netcat/nc.1 +++ b/contrib/netcat/nc.1 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 17, 2023 +.Dd January 20, 2025 .Dt NC 1 .Os .Sh NAME @@ -40,6 +40,7 @@ .Op Fl e Ar IPsec_policy .Op Fl I Ar length .Op Fl i Ar interval +.Op Fl -lb .Op Fl -no-tcpopt .Op Fl -sctp .Op Fl -crlf @@ -175,6 +176,12 @@ options. Additionally, any timeouts specified with the .Fl w option are ignored. +.It Fl -lb +When using +.Fl l , +put the socket in load-balancing mode. +In this mode, multiple sockets can bind to the same address and port, +and incoming connections are distributed among them. .It Fl M Collect per-connection TCP statistics using the .Xr stats 3 diff --git a/contrib/netcat/netcat.c b/contrib/netcat/netcat.c index 279489a45e92..7035fdf68961 100644 --- a/contrib/netcat/netcat.c +++ b/contrib/netcat/netcat.c @@ -89,6 +89,7 @@ int Fflag; /* fdpass sock to stdout */ unsigned int iflag; /* Interval Flag */ int kflag; /* More than one connect */ int lflag; /* Bind to local port */ +int FreeBSD_lb; /* Use SO_REUSEPORT_LB */ int FreeBSD_Mflag; /* Measure using stats(3) */ int Nflag; /* shutdown() network socket */ int nflag; /* Don't do name look up */ @@ -168,6 +169,7 @@ main(int argc, char *argv[]) char unix_dg_tmp_socket_buf[UNIX_DG_TMP_SOCKET_SIZE]; struct option longopts[] = { { "crlf", no_argument, &FreeBSD_crlf, 1 }, + { "lb", no_argument, &FreeBSD_lb, 1 }, { "no-tcpopt", no_argument, &FreeBSD_Oflag, 1 }, { "sctp", no_argument, &FreeBSD_sctp, 1 }, { "tun", required_argument, NULL, FREEBSD_TUN }, @@ -371,6 +373,8 @@ main(int argc, char *argv[]) errx(1, "cannot use -z and -l"); if (!lflag && kflag) errx(1, "must use -l with -k"); + if (!lflag && FreeBSD_lb) + errx(1, "must use -l with --lb"); if (FreeBSD_sctp) { if (uflag) errx(1, "cannot use -u and --sctp"); @@ -800,6 +804,8 @@ local_listen(char *host, char *port, struct addrinfo hints) res0 = res; do { + int opt; + if ((s = socket(res0->ai_family, res0->ai_socktype, res0->ai_protocol)) < 0) continue; @@ -808,7 +814,8 @@ local_listen(char *host, char *port, struct addrinfo hints) &rtableid, sizeof(rtableid)) == -1)) err(1, "setsockopt SO_SETFIB"); - ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); + opt = FreeBSD_lb != 0 ? SO_REUSEPORT_LB : SO_REUSEPORT; + ret = setsockopt(s, SOL_SOCKET, opt, &x, sizeof(x)); if (ret == -1) err(1, NULL); From nobody Fri Jan 24 19:25:54 2025 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 4Yfnpp4vh0z5lp1L; Fri, 24 Jan 2025 19:25: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 4Yfnpp4Ngsz3P9S; Fri, 24 Jan 2025 19:25:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737746754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BX9cPtCdyFGaofJJcCP3hj1scHukhkyr4GBUOA2QfsE=; b=OnK+vk6iYsbuUoNrvVnVra9sZHTOVIwfBa8X0YArol3Pj/TdLjnPsJl0U/OwdMenf1dCAf VDPm3DH2XVNrdSSLRzRSQw5tP53fDV28C1hImFXm+Mv/IQ307mAvEYF4rqd9aI9nvZOZIx U0UQw34kA5cF1NJF0xOvmrIk/huO5oT6BvW5jWo2lqzoqQ7Xg4EV9MmPsxN+rUoHGeamL7 IEug+Xtzqg4TFsx51yytpXMAADkKPfpxl7oq4+vKqLd1FEU7BbDRUF9B9H96VITTh6kThi dN8alzBZtkwNq5af/VtXetbDOgmjlAGP33823nX5RhO7MRMHPPQLyd96YGQucg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737746754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BX9cPtCdyFGaofJJcCP3hj1scHukhkyr4GBUOA2QfsE=; b=L6YnC3rUa9F1t8hmk4ojGmLee97lHlV/+UQNg5XbzP9h3tQlfm5VthmX84T0a7KzL/kFk/ 1thhNZWLlI/oIDXZXkEVhXUIWmb0LIfx2o5gSDj+V/ldUKOKxRE/tnDgQ5r6CfAu8XA3hX qYjqIrGE0qfS4d28gLMi9pY2V5hMMXDNYSJsKypM9okklZxA8gcnXVINPrRfy/LH6Bi18L 8N5XbDK0f6SH9hLB49Xrn0A1WOWA7Q/PdiAy8IO9ptHODizldJ+G9Fb4m8ONG4hQdHpTxw LpCjaiwcHSCkCaUv+1v431TOE/Di7Ug+3NFDNFQ6Em62NEyQ7nlNmZqMP5V5Kw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737746754; a=rsa-sha256; cv=none; b=eGXEn48EAAnslab2yrRApmVhWm91WDY4Y1IKhW3gwKp/7YK2YuqrVXKXAXjPPl+1+ghUDO gCYjhWlLDrVbJUtawDgn6qvjDeWScGtUtfR0PEs6APPl5QDCg9YagGOFaSkJOYhbWk0vQP PAsMc6dxg8g1Ne9ECl1poEr/j580opqIxcZ1X3sopvIAw/mqSowaZMQwp9nfit2xb/4ClT fXsinJHImil4YWT0TwbMofcaoreeDhxCeevt/9lpC31y6oeYAA3F85A6LhASYOxI5i3Zlk fEkBs6qnASN+ZxWBb5nWhAhS+2LE00TLF/Ba/M0IGJOL+LjN6edheJ91Buyb3g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfnpp3YwWzfWc; Fri, 24 Jan 2025 19:25:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50OJPs8a048780; Fri, 24 Jan 2025 19:25:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OJPsLJ048777; Fri, 24 Jan 2025 19:25:54 GMT (envelope-from git) Date: Fri, 24 Jan 2025 19:25:54 GMT Message-Id: <202501241925.50OJPsLJ048777@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: dc273058cb0b - main - ure(4): Add support for ELECOM EDC-QUA3C 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: dc273058cb0b6bef075e77272afc66f1a1fd3889 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=dc273058cb0b6bef075e77272afc66f1a1fd3889 commit dc273058cb0b6bef075e77272afc66f1a1fd3889 Author: FUKAUMI Naoki AuthorDate: 2025-01-23 01:43:59 +0000 Commit: Mark Johnston CommitDate: 2025-01-24 19:25:11 +0000 ure(4): Add support for ELECOM EDC-QUA3C ELECOM EDC-QUA3C is a USB3.1 Gen1 Type-A/C 2.5GBASE-T network adapter. This also works as a cdce(4) device by: usbconfig -d X.Y set_config 1 or usbconfig -d X.Y set_config 2 Signed-off-by: FUKAUMI Naoki MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/1578 --- sys/dev/usb/net/if_ure.c | 1 + sys/dev/usb/usbdevs | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/dev/usb/net/if_ure.c b/sys/dev/usb/net/if_ure.c index 8e307daccfad..7c9b74334b58 100644 --- a/sys/dev/usb/net/if_ure.c +++ b/sys/dev/usb/net/if_ure.c @@ -96,6 +96,7 @@ static const STRUCT_USB_HOST_ID ure_devs[] = { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i), \ USB_IFACE_CLASS(UICLASS_VENDOR), \ USB_IFACE_SUBCLASS(UISUBCLASS_VENDOR) } + URE_DEV(ELECOM, EDCQUA3C, 0), URE_DEV(LENOVO, RTL8153, URE_FLAG_8153), URE_DEV(LENOVO, TBT3LANGEN2, 0), URE_DEV(LENOVO, ONELINK, 0), diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index c71ebbaf9405..61f563ca1aa6 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -1944,6 +1944,7 @@ product ELECOM WDC150SU2M 0x4008 WDC-150SU2M product ELECOM LDUSBTX2 0x400b LD-USB/TX product ELECOM WDB433SU2M2 0x400f WDB-433SU2M2 product ELECOM LDUSB20 0x4010 LD-USB20 +product ELECOM EDCQUA3C 0x4017 EDC-QUA3C product ELECOM UCSGT 0x5003 UC-SGT product ELECOM UCSGT0 0x5004 UC-SGT product ELECOM LDUSBTX3 0xabc1 LD-USB/TX From nobody Fri Jan 24 19:40:01 2025 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 4Yfp752cnDz5lptB; Fri, 24 Jan 2025 19:40: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 4Yfp751sLyz3QfK; Fri, 24 Jan 2025 19:40:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737747601; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=C/IPUH1d/k478gRKAZq9LcX4RmKzDYqEIBwifyh0uVI=; b=kiz3WWpT4XNPvstAdVspyMp+8us1JXAabzl6u238HZXiZisPQLvYpHyJkt/4dcVEpO8kth 0NMEP2SOt6VCwp+D5SxTdxY60HLmP3QzMfTvdvvm6EfToj5Yqrd239dh/WWy7r000bZQvY VtcNxnIjNjSrRXuUS6gr2jtD3HGuiVq0unlK/SpUTBIz+E2raf26RTgjcvj3MxHSuC3fqM M96b+WVcO+ZrOrHgzII4795XwltJW+0iDvnsd08HI6heafGXncqF1YSq30PwlUogq00jpC 6MHYigbi1RZvFCCZHdmvbk2zgSntxdxJZUH05LqvSnpryBWABtp0MFTl4b2sFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737747601; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=C/IPUH1d/k478gRKAZq9LcX4RmKzDYqEIBwifyh0uVI=; b=wRbSt5JEE6ZfOTkZGTaJFPIE7CQJsUJ0HkU6GFQnhpfxzV68uXU6jXetGLn9Vh93NB8DS5 xDC+6bp+Sj9NFegHsWBNkrG+K9+mDVh50gassG9qWkckx1KQUk6PgX0mwIf8raADbtKBaG A/fj5uJzJ/JbfQyyH8gn5X1IQghM7SyHwBGBj5dD72sAVrQwYZs5kBLiATyuB6lWRqWwvo PWP/wYIrJbLtCUbWezfxA0SRscMPkFWXdfOwblxVzUr40zRmNFNerPFCTtDRQC49T28YGn u2IZ7rJzNbkAbJwoOrnV6wjdDJwBBY2a+QP+BFVQZGXxORLWQTXMMMESeuCdqQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737747601; a=rsa-sha256; cv=none; b=l6CRwuTj8uoYhjo8/1z8Vw0pA7B5nScZXhklpxYB+fo6OvkHgyLRXeumQg+vxAmOMRa6dM BL0+pXX52sgzU2n0qadb2l5PNUL7fc6cUQ70ojq5iY3+u1W0S7b6EJ9Ohp05OAGrvwK2Mn yjbQWgzYCn3BXt3tLHf6LojqdzqtN8+FlvGuwEe/6L4ql0DPn57a4Uv8dlM0+tzCGH2Zu2 F69xlbW29SEnt4SEzEIR+8FWFFoN0tiqa0nS1Wa9YI4w3Dlte26XgHB+CGm7Qn2OhgkaHK kw8v7zD2XRyxVq/C+1FQ79ln3MM/Ra8A4WSMEoFj839/+5koHUCeFEyjbsrWPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfp7518xKzgH3; Fri, 24 Jan 2025 19:40: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 50OJe1dL070893; Fri, 24 Jan 2025 19:40:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OJe1bh070890; Fri, 24 Jan 2025 19:40:01 GMT (envelope-from git) Date: Fri, 24 Jan 2025 19:40:01 GMT Message-Id: <202501241940.50OJe1bh070890@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: d726bc286325 - main - bsdinstall: hook up help line and prompt for ZFS disk selection 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: d726bc286325dd7093b83c6ebcbaa768c687d825 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d726bc286325dd7093b83c6ebcbaa768c687d825 commit d726bc286325dd7093b83c6ebcbaa768c687d825 Author: Franco Fichtner AuthorDate: 2025-01-23 11:27:09 +0000 Commit: Mark Johnston CommitDate: 2025-01-24 19:33:18 +0000 bsdinstall: hook up help line and prompt for ZFS disk selection Previously we were passing the wrong variable names for the prompt and help line, so the intended action wasn't clear to the user. Reviewed by: jhb, markj MFC after: 3 days See also: https://github.com/opnsense/installer/issues/22 Pull Request: https://github.com/freebsd/freebsd-src/pull/1579 --- usr.sbin/bsdinstall/scripts/zfsboot | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot index bfb863f5e7c8..f4670e0d272c 100755 --- a/usr.sbin/bsdinstall/scripts/zfsboot +++ b/usr.sbin/bsdinstall/scripts/zfsboot @@ -688,17 +688,17 @@ dialog_menu_layout() done eval f_dialog_checklist_size height width rows \ - \"\$title\" \"\$btitle\" \"\$prompt\" \ - \"\$hline\" $disk_check_list + \"\$title\" \"\$btitle\" \"\$disk_prompt\" \ + \"\$disk_hline\" $disk_check_list selections=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --separate-output \ - --hline \"\$hline\" \ + --hline \"\$disk_hline\" \ --ok-label \"\$msg_ok\" \ --cancel-label \"\$msg_back\" \ - --checklist \"\$prompt\" \ + --checklist \"\$disk_prompt\" \ $height $width $rows \ $disk_check_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD From nobody Fri Jan 24 19:41:50 2025 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 4Yfp9B5kYfz5lq2J; Fri, 24 Jan 2025 19:41: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 4Yfp9B1T31z3SYj; Fri, 24 Jan 2025 19:41:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737747710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mlRgaDLA2r87ta/TFFCqGA6FiubtDXzVhIk26DRTjx4=; b=FdSE0Bs+a3fa66Q1edTeDasH0u5F1+wS3xcU/rfluoZ4JSN07FvsjqP74kcOAB1qDQJyK1 SmHBhrtxk6CJkrfOjgfWWwveyJ+U9p6YXyBLPfCc345oXbVB5S5NStQuXZLlY8U8YJkeW1 CgXGxxW/kE/NauGDOnPpGri43sWBRruy/OjvgfEO/pcS0M4dU6F1Qf61nmb8g0aLaHiFaA yHOWmdH6gk5rHE6DzalGyaybIJv/hJyGy6bwOr6tG0XWbDiO5+5yuN3yXmawq8e/XNe45p DxAVj+g3coPHA2sCtr3QBJ+/MBVg/m0zDjnzUMuBnsA5hdmg7mqDZeBHqOgxvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737747710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mlRgaDLA2r87ta/TFFCqGA6FiubtDXzVhIk26DRTjx4=; b=OyNP9lSXQf0oovaEX2FRXQhrrCHRRQPZBnUewK5VnUQ2PIsCqjBCH9ihrWv/hyjEP8BvH0 fOqqiezARQUguVnReFS7CHREFB5GzjBV/extuhfggETMRGk6vofFLytfNfmVtyFdlnAoNh /wr5LuiaNcofE0vBu/LjvOHesOmaAp2KuFKML/QCAxgCT2lzElnEBLREMWeU9/rdwyPAE7 yUhQqYgnXzdc+CIx7XqcktNEDRCwzvnMGmaFNdBmOyGKXbUdqEmR3VkMhPe3UKA2+/H0Vb NKIIYuE/tgZNsB60PKgLUv2esJJS8ums65b9I1s8jVtSMXnJkT84Hl0tDzJwOA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737747710; a=rsa-sha256; cv=none; b=DnFtv7LRpMVkVsx2zGwJRKsMLcZXo/XDSNHv0+Sw8tGO4OsVxkk0TxJW7doTi0mWTsZ7LR p22p6Kt+i2GcBYg/138CNPAOVCESLGMWsvUNwtX0WFR4N/U8jMCLTizykgDyIB2/uOR2Mf 3avBNaYxvqOh1Ro0YAju6qeJspfP/k/FZ68Sud69Eg4boVrVyg3jwoQSqgaNT57PoVKnP5 yn6KQ4gDJ9Rld64HnWDLo1ivD53rkMoEBdEXjww67gBF4mI7IkMBMYXpVNEfR+2uddn0Py PEcvICRTHqdr9IjtNhlJpZukRRQkWNRONPzf1ml9yrag50rExV+Ss3okZuTyng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfp9B11yVzgJB; Fri, 24 Jan 2025 19:41: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 50OJfoex083246; Fri, 24 Jan 2025 19:41:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OJfoWN083243; Fri, 24 Jan 2025 19:41:50 GMT (envelope-from git) Date: Fri, 24 Jan 2025 19:41:50 GMT Message-Id: <202501241941.50OJfoWN083243@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: 3c61bbebc416 - main - Update rc.initdiskless, fix error handling of remount_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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3c61bbebc4166ca209b9becfd1529298bac6ed66 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3c61bbebc4166ca209b9becfd1529298bac6ed66 commit 3c61bbebc4166ca209b9becfd1529298bac6ed66 Author: Keve Müller AuthorDate: 2024-10-27 13:09:24 +0000 Commit: Warner Losh CommitDate: 2025-01-24 19:40:33 +0000 Update rc.initdiskless, fix error handling of remount_optional chkerr() ignores the exit code of a preceding mount command in case a file ```remount_optional``` exists. The check is performed and a subshell is launched to log the informational message and return. The return is executed in the context of the subshell, not the context of the chkerr() function, hence is a NOP. The remount_optional check is hence ineffective. Change the code to if/then/fi, so the return is evaluated in the context of the chkerr function, to make the check effective. Reviewed by: imp, emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/1497 --- libexec/rc/rc.initdiskless | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.initdiskless b/libexec/rc/rc.initdiskless index a4c6c613b85a..3b66a3c4928a 100644 --- a/libexec/rc/rc.initdiskless +++ b/libexec/rc/rc.initdiskless @@ -174,7 +174,10 @@ log() { chkerr() { lastitem () ( n=$(($# - 1)) ; shift $n ; echo $1 ) mountpoint="$(lastitem $2)" - [ -r $mountpoint/remount_optional ] && ( echo "$2 failed: ignoring due to remount_optional" ; return ) + if [ -r $mountpoint/remount_optional ]; then + echo "$2 failed: ignoring due to remount_optional" + return + fi case $1 in 0) ;; From nobody Fri Jan 24 19:41:51 2025 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 4Yfp9C5wYnz5lqJ2; Fri, 24 Jan 2025 19:41:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yfp9C2L15z3SYr; Fri, 24 Jan 2025 19:41:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737747711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AT2q6E3xbpDLphuTr3ixbmNVMML6V5hBoadCjvEsyu4=; b=u4Zo+QoQDOFchCzpeuu5NKK8QP94yWqXDaomXkkvnaDJEM1qxFYhI1/cNfqBs4fU3ZrUyu w41Y98F9spZ6/LW4YYEuAKids/0xZ69LrxZBZviDZDAQXkegRpfjuHfhYJdqEYuNZWWxRd W62lpzJbNGZ4Gp/PZ0TheD3Zh4d3VVElYvHQZZxltz/wAzLYQu3MoQIZ8RevyaxbEsm6qd BPOSAcZhVZcUlXCkkzpeYAv9HV0QZnNMWTrvmN8gJWkm5rAfRVw1PHyGq9ir/G4gTlreFr M87PZ0FU3/PmgnCZzggvzceifniZ1t4vwxy2VeNFhnRzpHYb3chs4h3mi/39/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737747711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AT2q6E3xbpDLphuTr3ixbmNVMML6V5hBoadCjvEsyu4=; b=fVSFH+X8uYCfBy7FDk4ujb0pbaOhNrda36OhgOP4SCKymsXU2vgFAvlGlGECSmhWDtSHur vWAI6ThBvu1ki7kUlF+KuLlt2hiE2o33p1FNX0c2ixF/6JEPATFHq/lJqqKJYBFXkU8KiA P4tXNiBuqddotgJ7vR9piEpGt6n5Zqxm0KaoOFIdaJARwvPJg3/B4Az3q68nk1kAbEa9zd Au4KHjiq8Srp0kcScKEjQcKKAngq4f4481pYyqJ5F5J5rVp8quwBs1Sq++NSAnUyZjlSlb 7HrAK5y+PfYqCpxksB64QhNCbTFfEdiMjqnVeqc7yTLXMPLdl0K2moO6CzMGUQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737747711; a=rsa-sha256; cv=none; b=LCtrnNCFAKm7R8wlIQ2N1Wp6yCvbAJWkxDE1nzWcjFFltn+whcMEyknXxCui37cB5SzoJV JATaaIVzjLXeA7yQypXbUgfGIDE8QzlvDFdz09iCHz8ZzC6L/Yqvrx4s668w04JZSLzU2+ TAccIuHHN4Adf2s/Zt1I6YjXHQm3Yoc2wdteuWCLkUMNpEnlGYOO/EH+zfEnDDU9Un94/0 WqTR/EBCeGuisNEqmrrOOm41qaiI+xzhcQe4wlwhmT2go1YSPglkcnkTQij6gPkc4ZGOoa pwyh/ornYIpVk5OWQsoJx/kfEdjvIpISuDac4/t+gkBY+PtBPXeS4icER0VTPQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfp9C1fxLzgJD; Fri, 24 Jan 2025 19:41:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50OJfpLo083280; Fri, 24 Jan 2025 19:41:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OJfp9O083277; Fri, 24 Jan 2025 19:41:51 GMT (envelope-from git) Date: Fri, 24 Jan 2025 19:41:51 GMT Message-Id: <202501241941.50OJfp9O083277@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: 813f244b27eb - main - ps3disk.c: Rewrite ps3disk_transfer 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: 813f244b27eba29aebaad0b725f30c58216bfab9 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=813f244b27eba29aebaad0b725f30c58216bfab9 commit 813f244b27eba29aebaad0b725f30c58216bfab9 Author: Chattrapat Sangmanee AuthorDate: 2024-10-16 14:49:22 +0000 Commit: Warner Losh CommitDate: 2025-01-24 19:40:34 +0000 ps3disk.c: Rewrite ps3disk_transfer This function is bugged since the beginning, but it never hit because its variable doesn't allow. However, since commit a77e1f0f81df5fa3b4a6a38728ebace599cb18a4 it happen now. First, it assume that ds_len will always equal to real user requested size. So it being used for sector count calculation. This is no longer true, and will fail if attempt to read last few sectors. Use bp->bio_length instead. Second, this being a loop is pointless because nsegs will never be > 1 as specified at bus_dma_tag_create() call. And all it doing is to repeat very same command again but with different ds_addr. Since bio_driver2 tag ident pointer are being reused, the result will be discarded at ps3disk_intr(). Signed-off-by: Chattrapat Sangmanee Reviewed by: imp,mav Pull Request: https://github.com/freebsd/freebsd-src/pull/1414 --- sys/powerpc/ps3/ps3disk.c | 96 +++++++++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 41 deletions(-) diff --git a/sys/powerpc/ps3/ps3disk.c b/sys/powerpc/ps3/ps3disk.c index 0931e6aad58b..4d9976ecccee 100644 --- a/sys/powerpc/ps3/ps3disk.c +++ b/sys/powerpc/ps3/ps3disk.c @@ -588,9 +588,10 @@ ps3disk_transfer(void *arg, bus_dma_segment_t *segs, int nsegs, int error) struct bio *bp = (struct bio *)(arg); struct ps3disk_softc *sc = (struct ps3disk_softc *)bp->bio_disk->d_drv1; struct ps3disk_region *rp = &sc->sc_reg[bp->bio_disk->d_unit]; + bus_dma_segment_t *seg = &segs[0]; uint64_t devid = ps3bus_get_device(sc->sc_dev); - uint64_t block; - int i, err; + uint64_t block, bio_length, sector_op_count; + int err; /* Locks already held by busdma */ PS3DISK_ASSERT_LOCKED(sc); @@ -603,49 +604,62 @@ ps3disk_transfer(void *arg, bus_dma_segment_t *segs, int nsegs, int error) return; } + /* supports only 1 segment */ + + KASSERT(nsegs == 1, + ("nsegs must be 1!, %d", nsegs)); + block = bp->bio_pblkno; - for (i = 0; i < nsegs; i++) { - KASSERT((segs[i].ds_len % sc->sc_blksize) == 0, - ("DMA fragments not blocksize multiples")); - - if (bp->bio_cmd == BIO_READ) { - err = lv1_storage_read(devid, rp->r_id, - block, segs[i].ds_len/sc->sc_blksize, - rp->r_flags, segs[i].ds_addr, - (uint64_t *)&bp->bio_driver2); - } else { - bus_dmamap_sync(sc->sc_dmatag, - (bus_dmamap_t)bp->bio_driver1, - BUS_DMASYNC_PREWRITE); - err = lv1_storage_write(devid, rp->r_id, - block, segs[i].ds_len/sc->sc_blksize, - rp->r_flags, segs[i].ds_addr, - (uint64_t *)&bp->bio_driver2); - } + bio_length = bp->bio_length; - if (err) { - if (err == LV1_BUSY) { - bioq_remove(&sc->sc_bioq, bp); - bioq_insert_tail(&sc->sc_deferredq, bp); - } else { - bus_dmamap_unload(sc->sc_dmatag, (bus_dmamap_t) - bp->bio_driver1); - bus_dmamap_destroy(sc->sc_dmatag, (bus_dmamap_t) - bp->bio_driver1); - device_printf(sc->sc_dev, "Could not read " - "sectors (0x%08x)\n", err); - bp->bio_error = EINVAL; - bp->bio_flags |= BIO_ERROR; - bioq_remove(&sc->sc_bioq, bp); - biodone(bp); - } - - break; - } + /* ds_len always >= bio_length */ + + KASSERT((seg->ds_len % bio_length) == 0, + ("ds_len not bio_length multiples, %lu, %lu", + (uint64_t)seg->ds_len, bio_length)); - DPRINTF(sc, PS3DISK_DEBUG_READ, "%s: tag 0x%016lx\n", - __func__, sc->sc_bounce_tag); + KASSERT((bio_length % sc->sc_blksize) == 0, + ("bio_length not blocksize multiples, %lu, %lu", + bio_length, (uint64_t)sc->sc_blksize)); + + sector_op_count = bio_length / sc->sc_blksize; + + if (bp->bio_cmd == BIO_READ) { + err = lv1_storage_read(devid, rp->r_id, + block, sector_op_count, + rp->r_flags, seg->ds_addr, + (uint64_t *)&bp->bio_driver2); + } else { + bus_dmamap_sync(sc->sc_dmatag, + (bus_dmamap_t)bp->bio_driver1, + BUS_DMASYNC_PREWRITE); + + err = lv1_storage_write(devid, rp->r_id, + block, sector_op_count, + rp->r_flags, seg->ds_addr, + (uint64_t *)&bp->bio_driver2); } + + if (err) { + if (err == LV1_BUSY) { + bioq_remove(&sc->sc_bioq, bp); + bioq_insert_tail(&sc->sc_deferredq, bp); + } else { + bus_dmamap_unload(sc->sc_dmatag, (bus_dmamap_t) + bp->bio_driver1); + bus_dmamap_destroy(sc->sc_dmatag, (bus_dmamap_t) + bp->bio_driver1); + device_printf(sc->sc_dev, "Could not read " + "sectors (0x%08x)\n", err); + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; + bioq_remove(&sc->sc_bioq, bp); + biodone(bp); + } + } + + DPRINTF(sc, PS3DISK_DEBUG_READ, "%s: tag 0x%016lx\n", + __func__, sc->sc_bounce_tag); } #ifdef PS3DISK_DEBUG From nobody Fri Jan 24 20:17:05 2025 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 4Yfpxs3x8wz5ls20; Fri, 24 Jan 2025 20:17: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 4Yfpxs3J39z3Ytr; Fri, 24 Jan 2025 20:17:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737749825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WBgAxX5xw8tSQ/YN0O+Trn0lNrZyp5HJJ120Vl7FV8E=; b=UBvM2+uwVy+oyeFcQ5ke9IzlyFau4LDB9qz5ldvHo+aK1xvbckZTGyPbXQxPBAlRDKd4yY KRfGIVeu1EL2P+f2qzfSiaNPf5jennlVkykUeuKzeo1TCighehEON1fAgLcHE9eyTqfDFT QwL/etO6Cb+cnQF0TLatuWx/27zPEjHrOImSRvsHx0HOZ+eFYajxKvRblTmLDFc9SVgjWx f/yXQGLFctmqSjRodLfr/NOh+zKySDh/H1f2HAsj258uIUw78d/oaQVntTCHhD0uPF5ynA /Ym0l3TJcMqTa5QTYrfZR9Wm3AyurnV7JnaauAJ/jCmdWdsaiOg3IU9N4Qewcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737749825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WBgAxX5xw8tSQ/YN0O+Trn0lNrZyp5HJJ120Vl7FV8E=; b=atMjLlHxHvoFV57VdvlWOgY73EO6efrHfLLxq5DPLJnDJ+WOQqT341znIaOzQlN1kAx5Ly hnqA4/FaR1eEhICA553QG2zVQ6CPO7DQhUsDV/+pOGGAcgnoz6XLGdgxi1QZurbuaYxyKx UEdbhaQxG0YKinoU47kINSW1msYICOACPlqPAeVt9W9J9xeXAOPeIRnwNKC8/RbEnTgzF4 6vsoapY+CPNeAwdeugIQMNncsUl5kg0/VdCY5wLq+W0muronR8hJSppT/3YO5/FHFNtRLL 2yAV/6/HSPpMD1w6I5v0MQZTPSnGU1dE43McUiu/d9Qs1wrvric3UNKlB876MQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737749825; a=rsa-sha256; cv=none; b=gtvoZmQFpGT+s8sKTtwB2XIWGqUdm0C2Zfg4DRWNRQtZazpno7HqiAG488TkDlKeVavUBq Adb6MmxuKyu3VWE3dvfMi4WIrKgQVuwt8hro2UTPmT1/WEvqfY5nIOaW098KnJSQjfBRze Az7CfMNeT9ylILuCTcfuLfTPqBwCWRgtswdP9a73yiWxKWEEUGzYEw1TTtkfklzTAPkDxf SFLlaVhiLPaORHQLCyG5wa5asaFHXHD7v/nMq4TRxJhAdZd7CjGxjUlEK8E50jhI4S8WIZ JIxxCQcZnJ9Ywm77TnTFAEiwvFokxgqkA4MW707j6ONyf6FLs0KvRUh59wX+oA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfpxs2hlMzgqD; Fri, 24 Jan 2025 20:17: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 50OKH5ll044489; Fri, 24 Jan 2025 20:17:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OKH5ui044486; Fri, 24 Jan 2025 20:17:05 GMT (envelope-from git) Date: Fri, 24 Jan 2025 20:17:05 GMT Message-Id: <202501242017.50OKH5ui044486@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: c81417289606 - main - open.2: update description for O_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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c81417289606ca9c808417672c603b5e233856de Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c81417289606ca9c808417672c603b5e233856de commit c81417289606ca9c808417672c603b5e233856de Author: CismonX AuthorDate: 2025-01-03 10:52:34 +0000 Commit: Mark Johnston CommitDate: 2025-01-24 20:15:09 +0000 open.2: update description for O_PATH - Add fstatfs(), fchdir(), fchroot(), extattr_*_fd(), cap_*_get(), cap_*_limit() to the list of syscalls that can take an O_PATH fd. - Remove readlinkat() from the list, since it is already discussed in the first few lines of the paragraph. It was originally added to the list when readlinkat() adds support for non-dir fd with an empty relative path (as if with AT_EMPTY_PATH), however, such use case is also discussed in the next paragraph. - Add funlinkat() to the list, since it accepts an extra fd (of the file to be unlinked), which is worth extra mentioning. - Fix a syntax issue which causes a bogus space to be rendered before a closing parentheses. Signed-off-by: CismonX Reviewed by: markj, jhb MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/1564 --- lib/libsys/open.2 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/libsys/open.2 b/lib/libsys/open.2 index fe1ad757b5b0..9ad5440bf239 100644 --- a/lib/libsys/open.2 +++ b/lib/libsys/open.2 @@ -393,7 +393,12 @@ but advisory locking is not allowed .It Xr dup 2 .It Xr close 2 .It Xr fstat 2 +.It Xr fstatfs 2 +.It Xr fchdir 2 +.It Xr fchroot 2 .It Xr fexecve 2 +.It Xr funlinkat 2 +can be passed as the third argument .It Dv SCM_RIGHTS can be passed over a .Xr unix 4 @@ -403,16 +408,23 @@ message .It Xr kqueue 2 only with .Dv EVFILT_VNODE -.It Xr readlinkat 2 .It Xr __acl_get_fd 2 .It Xr __acl_aclcheck_fd 2 +.It Xr extattr 2 +.It Xr capsicum 4 +can be passed to +.Fn cap_*_limit +and +.Fn cap_*_get +system calls (such as +.Xr cap_rights_limit 2 ) . .El .Pp Other operations like .Xr read 2 , .Xr ftruncate 2 , and any other that operate on file and not on file descriptor (except -.Xr fstat 2 ), +.Xr fstat 2 ) , are not allowed. .Pp A file descriptor created with the From nobody Fri Jan 24 20:27:44 2025 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 4YfqB924Z1z5lsRc; Fri, 24 Jan 2025 20:27: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 4YfqB91L52z3bfZ; Fri, 24 Jan 2025 20:27:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737750465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=e96JOJ6CBQyGlCgjIAD0IBn1INHUrj/zPgIzP99IrxU=; b=JL3JeXnHf3h4epzJ2OM2jdbYFQBvHccOhUFU93arUyDd/Lq9oIwWzpqGukHuFv8ensxW11 pL9wHcJHn6E2hS0ASTaIuVi14DsbELd/Tu5mi4Du2jKYlc9HcfmX0zad8wHxOHsQEytyhm ot86LwEihcNLjMBb+x4JgFTyy5mVMFgZDLi5YJGr1iinurcWlOPHzc7txOKK9MpFwyISfC YdetNCh+VV8QWZvZm2B2xdQTE+IziW5oy7CbYLI9z8+eove3dhYL3WmLris3UwEMsCL5Pu 6XuTkj3l60YcVIHIcakAW83QH7PSP8Zt4f+1Zko1CzQS8uRJ6S/2hs89Ci1jyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737750465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=e96JOJ6CBQyGlCgjIAD0IBn1INHUrj/zPgIzP99IrxU=; b=lUQDj2pvG7NEM38JkliTyQ6jnGufu0CeLeO2B2yz5MB94ttBZkJbp9WWP8ysfAbByfwwXK yY147U0KU1WPwQhwGYlqE92UKW4s04sM80JP1uhxseljq+oFKJOBJzozgvgxGoGzeEaLwu 5FG2WkogKIU2U4Phj7XQQ2/jqL0++Y5tPMhqKihxspg0FfC7TZZqPfJP07l9NI5WgBkApl mAoPtrsEfot+osrYeDVQW4XXzk7xPcpaJxKp/g+XMG7BKdMry5M1Mblc/MKy9k9FUhDsda EMDXkzJL9AgnNe/p+vwOTYFbuTvPy0fScwL9jpyO2SDbKyB5SUmTog+E5kKcxA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737750465; a=rsa-sha256; cv=none; b=haqMAa6wkFbv0lz/vr+BSArhU8eFtV06Yz92LqyoaQcwIPO0X+rLQpfet5Mm9yF5LAqi+F FDqT//3t2kyeE6JhWq9iU6X322TgBgN0S4qQ4W0nhkhpPZfPVjUussqnyn3LlNNc/0PSwe IwVJhJfKuZrdRS0l5JnPpSOKA0gkaD1Ooo7Qf5NVOXEmqQ21Qjb1y3lkjH1TB6e7pHS3A2 r4+giF4/kCnBLxh97InNN4gk60REMwKBxh2BOcjGFj81b5XHiWBZRuc2//7Pb9NIrDkva2 Sb6R+YNqz4QwYSbkv0QD28hZx0ORH/x/mFo8J/h47Otp/89Hbz1Ja1f83nMAzg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfqB90Ywkzh7Y; Fri, 24 Jan 2025 20:27: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 50OKRiU3064629; Fri, 24 Jan 2025 20:27:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OKRiIe064626; Fri, 24 Jan 2025 20:27:44 GMT (envelope-from git) Date: Fri, 24 Jan 2025 20:27:44 GMT Message-Id: <202501242027.50OKRiIe064626@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: a9a6a51edac1 - main - github: Add new checklist workflow 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a9a6a51edac13aaff5517dd602272152efa6d7bd Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=a9a6a51edac13aaff5517dd602272152efa6d7bd commit a9a6a51edac13aaff5517dd602272152efa6d7bd Author: Ahmad Khalifa AuthorDate: 2025-01-05 05:01:07 +0000 Commit: Ed Maste CommitDate: 2025-01-24 20:27:08 +0000 github: Add new checklist workflow Add a new 'checklist' workflow that checks the commit messages on pull requests. Currently, the workflow creates a comment on the pull request if any of these conditions are hit: - Missing Signed-off-by - Malformed Signed-off-by - Bad email (i.e *noreply*) Reviewed by: emaste, imp Pull request: https://github.com/freebsd/freebsd-src/pull/1570 Signed-off-by: Ahmad Khalifa --- .github/workflows/checklist.yml | 106 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml new file mode 100644 index 000000000000..9734af4a1a1d --- /dev/null +++ b/.github/workflows/checklist.yml @@ -0,0 +1,106 @@ +name: Checklist + +# Produce a list of things that need to be changed +# for the submission to align with CONTRIBUTING.md + +on: + pull_request: + types: [ opened, reopened, edited, synchronize ] + +permissions: + pull-requests: write + +jobs: + checklist: + name: commit + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + # An asynchronous javascript function + script: | + /* + * Github's API returns the results in pages of 30, so + * pass the function we want, along with it's arguments, + * to paginate() which will handle gathering all the results. + */ + const comments = await github.paginate(github.rest.issues.listComments, { + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number + }); + + const commits = await github.paginate(github.rest.pulls.listCommits, { + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number + }); + + let checklist = {}; + let checklist_len = 0; + let comment_id = -1; + + const msg_prefix = "Thank you for taking the time to contribute to FreeBSD!\n"; + const addToChecklist = (msg, sha) => { + if (!checklist[msg]) { + checklist[msg] = []; + checklist_len++; + } + checklist[msg].push(sha); + } + + for (const commit of commits) { + const sob_lines = commit.commit.message.match(/^[^\S\r\n]*signed-off-by:.*/gim); + + if (sob_lines == null && !commit.commit.author.email.toLowerCase().endsWith("freebsd.org")) + addToChecklist("Missing Signed-off-by lines", commit.sha); + else if (sob_lines != null) { + let author_signed = false; + for (const line of sob_lines) { + if (!line.includes("Signed-off-by: ")) + /* Only display the part we care about. */ + addToChecklist("Expected `Signed-off-by: `, got `" + line.match(/^[^\S\r\n]*signed-off-by:./i) + "`", commit.sha); + if (line.includes(commit.commit.author.email)) + author_signed = true; + } + + if (!author_signed) + console.log("::warning title=Missing-Author-Signature::Missing Signed-off-by from author"); + } + + if (commit.commit.author.email.toLowerCase().includes("noreply")) + addToChecklist("Real email address is needed", commit.sha); + } + + /* Check if we've commented before. */ + for (const comment of comments) { + if (comment.user.login == "github-actions[bot]") { + comment_id = comment.id; + break; + } + } + + if (checklist_len != 0) { + let msg = msg_prefix + + "There " + (checklist_len > 1 ? "are a few issues that need " : "is an issue that needs ") + + "to be fixed:\n"; + let comment_func = comment_id == -1 ? github.rest.issues.createComment : github.rest.issues.updateComment; + + /* Loop for each key in "checklist". */ + for (const c in checklist) + msg += "- " + c + "" + checklist[c].join(", ") + "\n"; + + comment_func({ + owner: context.repo.owner, + repo: context.repo.repo, + body: msg, + ...(comment_id == -1 ? {issue_number: context.issue.number} : {comment_id: comment_id}) + }); + } else if (comment_id != -1) { + github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: comment_id, + body: msg_prefix + "All issues resolved." + }); + } From nobody Fri Jan 24 20:27:46 2025 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 4YfqBB3DN8z5lsRd; Fri, 24 Jan 2025 20:27:46 +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 4YfqBB1GCdz3btP; Fri, 24 Jan 2025 20:27:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737750466; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LQo1Lp29qZU+vlmzvAUYnrAyCkCtbBtf9+wlu64y6DI=; b=SV+NyFpmnk4/j8ZId6zAH0OCS0jeQGoX42VhITFO42AiSYdwTmwLtSiNY+dfcMkyH7rt/0 /Q5+Hh75re7eYI0J1jqw9wlek3QaBkEjIMx2G1U017XtWJ2/gRZ0ncjpdPn3aKbXs0gp7e RwagPhG0LdmWch2veUC6ttwVMqUz2LDfXYTEKhXziZ8Xo1GtnnLUYi6o1a+OE++X6Rl+eq 7ZUT58/sOQ+IZPpv70UN8RuXf9+KTzsFc9pBCNXnbIbVFOt3naPk1/ehHmFEAxXZZrFEZL /BMynCK1t+0CkF+EeON2tFcoOsr8zm/TtEwDUSLDJhfSk3Wgq0HWsKXLLWe9mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737750466; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LQo1Lp29qZU+vlmzvAUYnrAyCkCtbBtf9+wlu64y6DI=; b=VQRSO24yL88x7Ig4he+rD7i/mHGtB1Gvz7Uj+qzl+YRsPkyU2QvD9I+ybmtTrSb5QHffxl YvGrEm0qwszlbvzfpQy8iC1BmFhZWy3sPSi2vu04HDrmCLbMRj6JYpEsu3k9Afzqaj8TJz sDZV+w1b6mrQD1EcoKAQhkkfxbqYbHkbKI1QesdqI1Ukb1jO33KsPDsdXZ/t5/noWSOfqz aYAB/zzjj7wLR+0yydqtK92Iq7rQBWw5vWqcH6dk9poPwGu/Dpgb6Z/Vq81aulsHeBi1mU N94++LiaLCq0JeElymLAj1K8+JpRVGKCrQ1U2utHUlH1BO1WzcRLfSW7CoIFvw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737750466; a=rsa-sha256; cv=none; b=v/fRF/KYVBzOUaXtquLJHo64m2Zv3wHEvxffNFFOaS66i7ilzwJcv9MTJNvP3Pk8luFngx yU6we6CmSFUcgjiGreU8S1KakvqCMfek8ccI7LEF7IYsNsQIHtlJwN1sH8veH5AG2U9q6l dGd+1S/YBS5XSM3DtxdRpzkz8j0eyDwuOvEv/QjUmPa5RErJxGekAeQH/qxu45BR3hn4qe 8rYTTSLZ3F0lUhf+RNjcqmtQ5WawAMsKqZN1BQicK0IMJ+o8dd9oN+ro1JUfAIckbYhCiO KcrxtjZXTNh15fbsIIhAfAdzwkzWZgI4a4w6Pvl40oIMTPaRSKvX1/TPwjhntA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfqBB0q8QzgYF; Fri, 24 Jan 2025 20:27: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 50OKRkFr064663; Fri, 24 Jan 2025 20:27:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OKRkOa064660; Fri, 24 Jan 2025 20:27:46 GMT (envelope-from git) Date: Fri, 24 Jan 2025 20:27:46 GMT Message-Id: <202501242027.50OKRkOa064660@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: ca363716fc49 - main - checkstyle9.pl: Remove unneeded checks 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca363716fc492146978c8650b97862f94daab6bf Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ca363716fc492146978c8650b97862f94daab6bf commit ca363716fc492146978c8650b97862f94daab6bf Author: Ahmad Khalifa AuthorDate: 2025-01-06 01:52:06 +0000 Commit: Ed Maste CommitDate: 2025-01-24 20:27:20 +0000 checkstyle9.pl: Remove unneeded checks Both the bad email check and the signoff check are handled in the "checklist" github workflow now. Reviewed by: emaste, imp Pull request: https://github.com/freebsd/freebsd-src/pull/1570 Signed-off-by: Ahmad Khalifa --- tools/build/checkstyle9.pl | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/tools/build/checkstyle9.pl b/tools/build/checkstyle9.pl index 5854cf613e01..b40c9810bc93 100755 --- a/tools/build/checkstyle9.pl +++ b/tools/build/checkstyle9.pl @@ -1253,8 +1253,6 @@ sub process { my $in_header_lines = $file ? 0 : 1; my $in_commit_log = 0; #Scanning lines before patch - my $has_sob = 0; - my $author_is_committer = 0; my $non_utf8_charset = 0; our @report = (); @@ -1450,33 +1448,6 @@ sub process { $is_patch = 1; } -# Filter out bad email addresses. - if ($line =~ /^(Author|From): .*noreply.*/) { - ERROR("Real email adress is needed\n" . $herecurr); - } - - if ($line =~ /^Author: .*[a-z-0-9]\@freebsd\.org/i) { - $author_is_committer = 1 - } - -#check the patch for a signoff: - if ($line =~ /^\s*signed-off-by:/i) { - # This is a signoff, if ugly, so do not double report. - $in_commit_log = 0; - $has_sob = 1; - - if (!($line =~ /^\s*Signed-off-by:/)) { - ERROR("The correct form is \"Signed-off-by\"\n" . - $herecurr); - $has_sob = 0; - } - if ($line =~ /^\s*signed-off-by:\S/i) { - ERROR("space required after Signed-off-by:\n" . - $herecurr); - $has_sob = 0; - } - } - # Check for wrappage within a valid hunk of the file if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) { ERROR("patch seems to be corrupt (line wrapped?)\n" . @@ -2659,10 +2630,6 @@ sub process { } - if ($has_sob == 0 && $author_is_committer == 0) { - WARN("Missing Signed-off-by: line"); - } - # If we have no input at all, then there is nothing to report on # so just keep quiet. if ($#rawlines == -1) { From nobody Fri Jan 24 20:50:51 2025 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 4Yfqj5160Wz5ltdT for ; Fri, 24 Jan 2025 20:51:05 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 4Yfqj46M6Vz3dtX for ; Fri, 24 Jan 2025 20:51:04 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-385f07cd1a4so2536617f8f.1 for ; Fri, 24 Jan 2025 12:51:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737751863; x=1738356663; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=waEJUfbRTXYqyQG2ZDsWZQGVhv+WfWD/Jf53NnWfcfs=; b=ZMCo2M+IcAauWerms52bYLZqNS041o8h0vVcawP4RMnOPS710kFnI+7/QdpLe3LgWN STCiH+Tw+cLdStxvM9PBkIChdLohH8evqnKS54GT6IqqGjDxF5ON3d6kmJD3OVwMQ/Rl SZTSXN11oZGjUM97Eq9La9+YXahPw5mhKLuVuItTXsICKtY/pVLlkNPlKRiPdDifzPCN 8cpzZHOw7Vbo6eFtn+q/ZGxIIZwzAcGMGVpp1TYqfaKsL46Dk874aaWOunVMkKCASsJD vVub80DqnrOZtELzhWnR+EoRY+5OY1T8ireWfQHDW+5eJSHekXDIF7QXhn921CL+kjb6 JGSA== X-Forwarded-Encrypted: i=1; AJvYcCUKlx2Y/vrGzAIZxEbktp6NHj4NGhfy/2mqXROkM6FDTolqgWZQHztTjtKsn9MC0rzHfWhTt27o6QNJUb1puC4uMM1Stg==@freebsd.org X-Gm-Message-State: AOJu0Yz2rE9jtqypdGNqC3u92c9dMUy1M6vuaVnvcoZcmdPBwtEw5DtQ jWX1Obmh/bkI72DrgfDrA1CF0Cizzhu4ZmPuoKe+eAwlzQ7ygMGHNJEGKTzDw1lNts3j5vsdrKn G X-Gm-Gg: ASbGncv9MinUYLOfJnrQ8mdGBcK4Mfq3aUJEqbK9Dbx9xtNmAN06MgTdr66G1pEQvP+ ru8NPSNY4q7uS2/7hsHn9mVaTePKmbmwuBqZfWcWCH4oVgVrKhnCDvsO2x67n3VdMkLp1YBChlM zmHBySrFwZVVNJOsw/OYsQ8FovJGkBTc9Qwo1GyiSNuBIbsU0LnsMSxFPZbklKrNI4B+5YAtdf6 PFUPxVFEFfCNFYmocK65WXzPVJNusgHIP/0OKjAw46HAtOfigE4pVJ+74y2hG6ZHyLP2gJt0Z1V PjREPkaHoxbzbQ/W/cs= X-Google-Smtp-Source: AGHT+IEiGKN1oRRPgv1zR4Y8Crl48LCkzaF+shATYoUDI6/rFaMfz9rFR/KdNbWU+Y3F+G5NgvYn9Q== X-Received: by 2002:a05:6000:1449:b0:386:3825:2c3b with SMTP id ffacd0b85a97d-38bf5663880mr29643930f8f.18.1737751862731; Fri, 24 Jan 2025 12:51:02 -0800 (PST) Received: from smtpclient.apple ([131.111.5.201]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a17d6d7sm3757244f8f.31.2025.01.24.12.51.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jan 2025 12:51:02 -0800 (PST) Content-Type: text/plain; charset=utf-8 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 (Mac OS X Mail 16.0 \(3826.300.87.4.3\)) Subject: Re: git: a9a6a51edac1 - main - github: Add new checklist workflow From: Jessica Clarke In-Reply-To: <202501242027.50OKRiIe064626@gitrepo.freebsd.org> Date: Fri, 24 Jan 2025 20:50:51 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202501242027.50OKRiIe064626@gitrepo.freebsd.org> To: Ed Maste X-Mailer: Apple Mail (2.3826.300.87.4.3) X-Rspamd-Queue-Id: 4Yfqj46M6Vz3dtX 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:15169, ipnet:209.85.128.0/17, country:US] On 24 Jan 2025, at 20:27, Ed Maste wrote: >=20 > The branch main has been updated by emaste: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Da9a6a51edac13aaff5517dd602272152= efa6d7bd >=20 > commit a9a6a51edac13aaff5517dd602272152efa6d7bd > Author: Ahmad Khalifa > AuthorDate: 2025-01-05 05:01:07 +0000 > Commit: Ed Maste > CommitDate: 2025-01-24 20:27:08 +0000 >=20 > github: Add new checklist workflow >=20 > Add a new 'checklist' workflow that checks the commit messages on = pull > requests. Currently, the workflow creates a comment on the pull = request > if any of these conditions are hit: > - Missing Signed-off-by > - Malformed Signed-off-by > - Bad email (i.e *noreply*) >=20 > Reviewed by: emaste, imp > Pull request: https://github.com/freebsd/freebsd-src/pull/1570 >=20 > Signed-off-by: Ahmad Khalifa > --- > .github/workflows/checklist.yml | 106 = ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 106 insertions(+) >=20 > diff --git a/.github/workflows/checklist.yml = b/.github/workflows/checklist.yml > new file mode 100644 > index 000000000000..9734af4a1a1d > --- /dev/null > +++ b/.github/workflows/checklist.yml > @@ -0,0 +1,106 @@ > +name: Checklist > + > +# Produce a list of things that need to be changed > +# for the submission to align with CONTRIBUTING.md > + > +on: > + pull_request: > + types: [ opened, reopened, edited, synchronize ] > + > +permissions: > + pull-requests: write > + > +jobs: > + checklist: > + name: commit > + runs-on: ubuntu-latest Please be careful to restrict these kinds of jobs with if: github.repository_owner =3D=3D 'freebsd' or if: github.repository =3D=3D 'freebsd/freebsd-src' otherwise it=E2=80=99s a pain for forks. Jess > + steps: > + - uses: actions/github-script@v7 > + with: > + # An asynchronous javascript function > + script: | > + /* > + * Github's API returns the results in pages of 30, so > + * pass the function we want, along with it's arguments, > + * to paginate() which will handle gathering all the = results. > + */ > + const comments =3D await = github.paginate(github.rest.issues.listComments, { > + owner: context.repo.owner, > + repo: context.repo.repo, > + issue_number: context.issue.number > + }); > + > + const commits =3D await = github.paginate(github.rest.pulls.listCommits, { > + owner: context.repo.owner, > + repo: context.repo.repo, > + pull_number: context.issue.number > + }); > + > + let checklist =3D {}; > + let checklist_len =3D 0; > + let comment_id =3D -1; > + > + const msg_prefix =3D "Thank you for taking the time to = contribute to FreeBSD!\n"; > + const addToChecklist =3D (msg, sha) =3D> { > + if (!checklist[msg]) { > + checklist[msg] =3D []; > + checklist_len++; > + } > + checklist[msg].push(sha); > + } > + > + for (const commit of commits) { > + const sob_lines =3D = commit.commit.message.match(/^[^\S\r\n]*signed-off-by:.*/gim); > + > + if (sob_lines =3D=3D null && = !commit.commit.author.email.toLowerCase().endsWith("freebsd.org")) > + addToChecklist("Missing Signed-off-by lines", = commit.sha); > + else if (sob_lines !=3D null) { > + let author_signed =3D false; > + for (const line of sob_lines) { > + if (!line.includes("Signed-off-by: ")) > + /* Only display the part we care about. */ > + addToChecklist("Expected `Signed-off-by: `, got = `" + line.match(/^[^\S\r\n]*signed-off-by:./i) + "`", commit.sha); > + if (line.includes(commit.commit.author.email)) > + author_signed =3D true; > + } > + > + if (!author_signed) > + console.log("::warning = title=3DMissing-Author-Signature::Missing Signed-off-by from author"); > + } > + > + if = (commit.commit.author.email.toLowerCase().includes("noreply")) > + addToChecklist("Real email address is needed", = commit.sha); > + } > + > + /* Check if we've commented before. */ > + for (const comment of comments) { > + if (comment.user.login =3D=3D "github-actions[bot]") { > + comment_id =3D comment.id; > + break; > + } > + } > + > + if (checklist_len !=3D 0) { > + let msg =3D msg_prefix + > + "There " + (checklist_len > 1 ? "are a few issues = that need " : "is an issue that needs ") + > + "to be fixed:\n"; > + let comment_func =3D comment_id =3D=3D -1 ? = github.rest.issues.createComment : github.rest.issues.updateComment; > + > + /* Loop for each key in "checklist". */ > + for (const c in checklist) > + msg +=3D "- " + c + "" + checklist[c].join(", ") = + "\n"; > + > + comment_func({ > + owner: context.repo.owner, > + repo: context.repo.repo, > + body: msg, > + ...(comment_id =3D=3D -1 ? {issue_number: = context.issue.number} : {comment_id: comment_id}) > + }); > + } else if (comment_id !=3D -1) { > + github.rest.issues.updateComment({ > + owner: context.repo.owner, > + repo: context.repo.repo, > + comment_id: comment_id, > + body: msg_prefix + "All issues resolved." > + }); > + } From nobody Fri Jan 24 21:07:38 2025 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 4Yfr4B3dnLz5lvf0; Fri, 24 Jan 2025 21:07:38 +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 4Yfr4B2vTjz3g2R; Fri, 24 Jan 2025 21:07:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737752858; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yJooVuB6/I1GAbSosp99gZnrJNqiugfyGa/sYl0pFFs=; b=UzfW4Cdkav3JcDIEDKRVTxyKaQqJ7tcqVR8rBGIIxNyxZi7PVhCDm10hh61by8m6F3PYf4 3TYlQteTAwLVeSG9ZJMxW/7Hwj6IR3QwOGo2lQ7d+G0lCmg7DZgAf3chEOHjM3fzCAcOhq EJ1gXawwGZehNUjZ2rbaJ470Ulm89Y+zHRKCTpKLVM1GHBOqnjUiuNPswNbFC61hkAttvk m7HaqShS2GR/K97t310VTBo9MZOdnkbqubfIUMN9eTrLB/863gUDX2elUAcamVVukHbH5K XZnGoWUGg1zr0H74sZ1/9g22zdOX1UZsixbn/SfeKdDHRY/HMAJ3Fwvszqwudw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737752858; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yJooVuB6/I1GAbSosp99gZnrJNqiugfyGa/sYl0pFFs=; b=dmYyKYyS4tPZJHixe/8dB+TebjGsyqHyz0I/lLulTLWUtb236eghyAPPEJkpD5Oua/Kxbl 0a58UUUKHwAC5/pgnT+RNLJOblEdKhFNDR0e3UKWtpLfUhBrbsskiG/Q38NcJZPnK8oB3s UbEawXEWVk1iUfinscMzHusCOWxp9GNZSNe/0c+DazkOJI8k/VwVbTXkT03rOmJqlca+8p dT26BO37IKprFFm6xTk9mz8wRTh41XXcH7KWs0Xe4CcRfWOohkVKA7unKgdFQteuLgglCh douUtNIeGCGwkmbO7r4Up/L7wFaG5nYN5cKLQD8rr1b4GePmEv2y4gI3UD5J+A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737752858; a=rsa-sha256; cv=none; b=Mj2AfgP4wnFOKrc9+6L1+f1K2y8rtkoSfDf3wP748OvcKzs8v9708FRmuX0UIB3Bgslt+B q9XPmjkDftbKy++mf8ddN6XRE+PsvKPzlQbj2fgOnDRP5N9ex3BUZkR0ZjMTMFXKRm0R24 /ztEfwiVkP3cnCCTVu6HX86sHd9qb+WJptfB1nqhCg+w+++psS8ftdm8wQaxNFQu3SGU7S JQ0cqXMzUmJDn44344U4X3M9VvtuXmGBZPgezmpo+du/6J+J3YH4pXa5RHGF52HSM5A/pU 8bmxD1aVVrwF7G4FZuE/QvhIdBVA1p9Zk95ETeZrdI48uzhAxHfKMQCwLEUFcA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfr4B2KPzzjDB; Fri, 24 Jan 2025 21:07:38 +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 50OL7cBC039520; Fri, 24 Jan 2025 21:07:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OL7cdA039517; Fri, 24 Jan 2025 21:07:38 GMT (envelope-from git) Date: Fri, 24 Jan 2025 21:07:38 GMT Message-Id: <202501242107.50OL7cdA039517@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: 3ad01642fe9e - main - iflib(4): Replace admin taskqueue group with per-interface taskqueues 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: 3ad01642fe9e241124553f2f18fd365ffea5d20b Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3ad01642fe9e241124553f2f18fd365ffea5d20b commit 3ad01642fe9e241124553f2f18fd365ffea5d20b Author: Krzysztof Galazka AuthorDate: 2024-07-05 11:00:13 +0000 Commit: Warner Losh CommitDate: 2025-01-24 21:08:12 +0000 iflib(4): Replace admin taskqueue group with per-interface taskqueues Using one taskqueue group with single thread to execute all admin tasks may lead to unexpected timeouts when long running task (e.g. handling a reset after FW update) for one interface prevents tasks from other interfaces being executed. Taskqueue group API doesn't let to dynamically add threads, and pre-allocating thread for each CPU as it's done for traffic queues would be a waste of resources on systems with small number of interfaces. Replace global taskqueue group for admin tasks with taskqueue allocated for each interface to allow independent execution. Signed-off-by: Krzysztof Galazka Reviewed by: imp, jhb Pull Request: https://github.com/freebsd/freebsd-src/pull/1336 --- sys/dev/bnxt/bnxt_en/bnxt.h | 2 +- sys/dev/bnxt/bnxt_en/if_bnxt.c | 10 +++--- sys/net/iflib.c | 77 ++++++++++++++++++++++-------------------- sys/net/iflib.h | 6 ++-- 4 files changed, 48 insertions(+), 47 deletions(-) diff --git a/sys/dev/bnxt/bnxt_en/bnxt.h b/sys/dev/bnxt/bnxt_en/bnxt.h index c5fadeafa181..e4f866807070 100644 --- a/sys/dev/bnxt/bnxt_en/bnxt.h +++ b/sys/dev/bnxt/bnxt_en/bnxt.h @@ -1091,7 +1091,7 @@ struct bnxt_softc { struct bnxt_cp_ring def_nq_ring; struct iflib_dma_info def_cp_ring_mem; struct iflib_dma_info def_nq_ring_mem; - struct grouptask def_cp_task; + struct task def_cp_task; int db_size; int legacy_db_size; struct bnxt_doorbell_ops db_ops; diff --git a/sys/dev/bnxt/bnxt_en/if_bnxt.c b/sys/dev/bnxt/bnxt_en/if_bnxt.c index 00d37f5e0151..efc467a043f9 100644 --- a/sys/dev/bnxt/bnxt_en/if_bnxt.c +++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c @@ -229,7 +229,7 @@ static void bnxt_clear_ids(struct bnxt_softc *softc); static void inline bnxt_do_enable_intr(struct bnxt_cp_ring *cpr); static void inline bnxt_do_disable_intr(struct bnxt_cp_ring *cpr); static void bnxt_mark_cpr_invalid(struct bnxt_cp_ring *cpr); -static void bnxt_def_cp_task(void *context); +static void bnxt_def_cp_task(void *context, int pending); static void bnxt_handle_async_event(struct bnxt_softc *softc, struct cmpl_base *cmpl); static uint64_t bnxt_get_baudrate(struct bnxt_link_info *link); @@ -2384,8 +2384,7 @@ bnxt_attach_pre(if_ctx_t ctx) &softc->def_cp_ring_mem, 0); softc->def_cp_ring.ring.vaddr = softc->def_cp_ring_mem.idi_vaddr; softc->def_cp_ring.ring.paddr = softc->def_cp_ring_mem.idi_paddr; - iflib_config_gtask_init(ctx, &softc->def_cp_task, bnxt_def_cp_task, - "dflt_cp"); + iflib_config_task_init(ctx, &softc->def_cp_task, bnxt_def_cp_task); rc = bnxt_init_sysctl_ctx(softc); if (rc) @@ -2512,7 +2511,6 @@ bnxt_detach(if_ctx_t ctx) bnxt_free_ctx_mem(softc); bnxt_clear_ids(softc); iflib_irq_free(ctx, &softc->def_cp_ring.irq); - iflib_config_gtask_deinit(&softc->def_cp_task); /* We need to free() these here... */ for (i = softc->nrxqsets-1; i>=0; i--) { if (BNXT_CHIP_P5(softc)) @@ -4348,7 +4346,7 @@ bnxt_handle_def_cp(void *arg) struct bnxt_softc *softc = arg; softc->db_ops.bnxt_db_rx_cq(&softc->def_cp_ring, 0); - GROUPTASK_ENQUEUE(&softc->def_cp_task); + iflib_config_task_enqueue(softc->ctx, &softc->def_cp_task); return FILTER_HANDLED; } @@ -4608,7 +4606,7 @@ async_event_process_exit: } static void -bnxt_def_cp_task(void *context) +bnxt_def_cp_task(void *context, int pending) { if_ctx_t ctx = context; struct bnxt_softc *softc = iflib_get_softc(ctx); diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 6644197f7d5b..1ae2207c9d13 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -178,8 +178,9 @@ struct iflib_ctx { struct resource *ifc_msix_mem; struct if_irq ifc_legacy_irq; - struct grouptask ifc_admin_task; - struct grouptask ifc_vflr_task; + struct task ifc_admin_task; + struct task ifc_vflr_task; + struct taskqueue *ifc_tq; struct iflib_filter_info ifc_filter_info; struct ifmedia ifc_media; struct ifmedia *ifc_mediap; @@ -1640,7 +1641,7 @@ static int iflib_fast_intr_ctx(void *arg) { iflib_filter_info_t info = arg; - struct grouptask *gtask = info->ifi_task; + if_ctx_t ctx = info->ifi_ctx; int result; DBG_COUNTER_INC(fast_intrs); @@ -1650,8 +1651,7 @@ iflib_fast_intr_ctx(void *arg) return (result); } - if (gtask->gt_taskqueue != NULL) - GROUPTASK_ENQUEUE(gtask); + taskqueue_enqueue(ctx->ifc_tq, &ctx->ifc_admin_task); return (FILTER_HANDLED); } @@ -4176,7 +4176,7 @@ skip_rxeof: } static void -_task_fn_admin(void *context) +_task_fn_admin(void *context, int pending) { if_ctx_t ctx = context; if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; @@ -4227,7 +4227,7 @@ _task_fn_admin(void *context) } static void -_task_fn_iov(void *context) +_task_fn_iov(void *context, int pending) { if_ctx_t ctx = context; @@ -5200,6 +5200,7 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct kobj_method_t *kobj_method; int err, msix, rid; int num_txd, num_rxd; + char namebuf[TASKQUEUE_NAMELEN]; ctx = malloc(sizeof(*ctx), M_IFLIB, M_WAITOK | M_ZERO); @@ -5290,10 +5291,25 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct scctx->isc_rss_table_size = 64; scctx->isc_rss_table_mask = scctx->isc_rss_table_size - 1; - GROUPTASK_INIT(&ctx->ifc_admin_task, 0, _task_fn_admin, ctx); - /* XXX format name */ - taskqgroup_attach(qgroup_if_config_tqg, &ctx->ifc_admin_task, ctx, - NULL, NULL, "admin"); + /* Create and start admin taskqueue */ + snprintf(namebuf, TASKQUEUE_NAMELEN, "if_%s_tq", device_get_nameunit(dev)); + ctx->ifc_tq = taskqueue_create_fast(namebuf, M_NOWAIT, + taskqueue_thread_enqueue, &ctx->ifc_tq); + if (ctx->ifc_tq == NULL) { + device_printf(dev, "Unable to create admin taskqueue\n"); + return (ENOMEM); + } + + err = taskqueue_start_threads(&ctx->ifc_tq, 1, PI_NET, "%s", namebuf); + if (err) { + device_printf(dev, + "Unable to start admin taskqueue threads error: %d\n", + err); + taskqueue_free(ctx->ifc_tq); + return (err); + } + + TASK_INIT(&ctx->ifc_admin_task, 0, _task_fn_admin, ctx); /* Set up cpu set. If it fails, use the set of all CPUs. */ if (bus_get_cpus(dev, INTR_CPUS, sizeof(ctx->ifc_cpus), &ctx->ifc_cpus) != 0) { @@ -5430,6 +5446,7 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct fail_detach: ether_ifdetach(ctx->ifc_ifp); fail_queues: + taskqueue_free(ctx->ifc_tq); iflib_tqg_detach(ctx); iflib_tx_structures_free(ctx); iflib_rx_structures_free(ctx); @@ -5508,6 +5525,9 @@ iflib_device_deregister(if_ctx_t ctx) IFDI_QUEUES_FREE(ctx); CTX_UNLOCK(ctx); + taskqueue_free(ctx->ifc_tq); + ctx->ifc_tq = NULL; + /* ether_ifdetach calls if_qflush - lock must be destroy afterwards*/ iflib_free_intr_mem(ctx); @@ -5545,11 +5565,6 @@ iflib_tqg_detach(if_ctx_t ctx) if (rxq->ifr_task.gt_uniq != NULL) taskqgroup_detach(tqg, &rxq->ifr_task); } - tqg = qgroup_if_config_tqg; - if (ctx->ifc_admin_task.gt_uniq != NULL) - taskqgroup_detach(tqg, &ctx->ifc_admin_task); - if (ctx->ifc_vflr_task.gt_uniq != NULL) - taskqgroup_detach(tqg, &ctx->ifc_vflr_task); } static void @@ -6324,9 +6339,7 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, int rid, q = ctx; tqrid = -1; info = &ctx->ifc_filter_info; - gtask = &ctx->ifc_admin_task; - tqg = qgroup_if_config_tqg; - fn = _task_fn_admin; + gtask = NULL; intr_fast = iflib_fast_intr_ctx; break; default: @@ -6388,12 +6401,8 @@ iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type, NET_GROUPTASK_INIT(gtask, 0, fn, q); break; case IFLIB_INTR_IOV: - q = ctx; - gtask = &ctx->ifc_vflr_task; - tqg = qgroup_if_config_tqg; - fn = _task_fn_iov; - GROUPTASK_INIT(gtask, 0, fn, q); - break; + TASK_INIT(&ctx->ifc_vflr_task, 0, _task_fn_iov, ctx); + return; default: panic("unknown net intr type"); } @@ -6483,15 +6492,14 @@ void iflib_admin_intr_deferred(if_ctx_t ctx) { - MPASS(ctx->ifc_admin_task.gt_taskqueue != NULL); - GROUPTASK_ENQUEUE(&ctx->ifc_admin_task); + taskqueue_enqueue(ctx->ifc_tq, &ctx->ifc_admin_task); } void iflib_iov_intr_deferred(if_ctx_t ctx) { - GROUPTASK_ENQUEUE(&ctx->ifc_vflr_task); + taskqueue_enqueue(ctx->ifc_tq, &ctx->ifc_vflr_task); } void @@ -6503,20 +6511,15 @@ iflib_io_tqg_attach(struct grouptask *gt, void *uniq, int cpu, const char *name) } void -iflib_config_gtask_init(void *ctx, struct grouptask *gtask, gtask_fn_t *fn, - const char *name) +iflib_config_task_init(if_ctx_t ctx, struct task *config_task, task_fn_t *fn) { - - GROUPTASK_INIT(gtask, 0, fn, ctx); - taskqgroup_attach(qgroup_if_config_tqg, gtask, gtask, NULL, NULL, - name); + TASK_INIT(config_task, 0, fn, ctx); } void -iflib_config_gtask_deinit(struct grouptask *gtask) +iflib_config_task_enqueue(if_ctx_t ctx, struct task *config_task) { - - taskqgroup_detach(qgroup_if_config_tqg, gtask); + taskqueue_enqueue(ctx->ifc_tq, config_task); } void diff --git a/sys/net/iflib.h b/sys/net/iflib.h index e3d76fbd3c01..3817445228d0 100644 --- a/sys/net/iflib.h +++ b/sys/net/iflib.h @@ -470,9 +470,9 @@ void iflib_irq_free(if_ctx_t ctx, if_irq_t irq); void iflib_io_tqg_attach(struct grouptask *gt, void *uniq, int cpu, const char *name); -void iflib_config_gtask_init(void *ctx, struct grouptask *gtask, - gtask_fn_t *fn, const char *name); -void iflib_config_gtask_deinit(struct grouptask *gtask); +void iflib_config_task_init(if_ctx_t ctx, struct task *config_task, + task_fn_t *fn); +void iflib_config_task_enqueue(if_ctx_t ctx, struct task *config_task); void iflib_tx_intr_deferred(if_ctx_t ctx, int txqid); void iflib_rx_intr_deferred(if_ctx_t ctx, int rxqid); From nobody Fri Jan 24 21:37:12 2025 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 4YfrkJ6frLz5lRsW; Fri, 24 Jan 2025 21:37: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 4YfrkJ6Lk6z3jqQ; Fri, 24 Jan 2025 21:37:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737754632; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YNO+gMKarz196l+mz2Yb6afwenZwq02Vsx6HG99ibpc=; b=BAt3l7077zQwMsHvQk/g0ph64bwRDKX5tiBMyS+vZn0JLAdTH7tCa1YP/EKV+zCa2qo8Fz yDDeI5CPCPs3tj7mMtfu63CO8VIrTeiDntqiVkMrZ+yHkT8wxLN+wsJO195Jz0ZeYigOCu K+g5GE6h+JOJA2uc8S3MRb/kOTfZ46IPoRr5IlSNPK6DGfYgIsv4dgkAwuIKXJ0/ZWe3C7 qhNsRryD09idb7lFaGWjeMH2VUij/9aiyZYoC8TQ33Ks35rv42kVZ1CeL5HpM2+rO2lSba JL1ckV2LAdXhowL6qRpPEup/Cmi9m4PYeOvVr0Yo8Ww+V+pP7T8emiC7FbEepg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737754632; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YNO+gMKarz196l+mz2Yb6afwenZwq02Vsx6HG99ibpc=; b=f1Mydaiep4B15oi0/FoL7FCKRPf0wf/nbnT6kDftAmUgcc4pNg08cb0Dy4uoce7+tXYzN4 zq79IynMmZJZwhbSAomtHt2yh5Yacm8OHpxujSjLeXo2sayocLHBQ5nfzhnD+qiSk/Praf evFk4wG0jGBn2eebrP4hEUjjM71Wu2kEcuBW+fhQeHLzoMa0N2eWFtq7xzoSNKCc1UEfSQ HuRB8ycQf90cozkseJ3nuPlc/ADDbPF78MT1tfSUjI9djJEf4MhOKs7XO9TebW9gM4S4YZ ZI6WaIdBXMzhlYx2OQ+qBr8cxfoCXWrsWME7WT1zPRLcPh8i+EZoFOB3SMifxw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737754632; a=rsa-sha256; cv=none; b=PbziumkkgfwCSKpC2BLy9joG3p1QB/ohOBJP5c59QLzjgIrDZZTf5hMJ24EK+uTNByK9wE kjjePVB5OTFwoKq66O1W1h+KS5g4JCdiaxra2iaZv6evTCwgUkfPBAeyyarmV9agfpAGU1 frTFNItdp866bCX9FW3V6p0H141O27q87Fd9L9LNYQoGKmsB0OViCYD3x+TJadvK1jKje0 3sjNq5aD/2QWagQSArcx/qeIw9IC92Fqg44hIwcmGS8ufdmSIMNUpAYO34GttmwGlFLbtx IP7U3h+p63X7bf37MPbw8YHrBB19rdhe3y9IJD6S2xeYqiCpiysQqe5IiLQJIQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfrkJ5kZYzjfj; Fri, 24 Jan 2025 21:37: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 50OLbCdE094772; Fri, 24 Jan 2025 21:37:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OLbCJJ094769; Fri, 24 Jan 2025 21:37:12 GMT (envelope-from git) Date: Fri, 24 Jan 2025 21:37:12 GMT Message-Id: <202501242137.50OLbCJJ094769@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: b72ae900d434 - main - sys: make the kernel metadata pointer 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b72ae900d4348118829fe04abdc11b620930c30f Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b72ae900d4348118829fe04abdc11b620930c30f commit b72ae900d4348118829fe04abdc11b620930c30f Author: Ahmad Khalifa AuthorDate: 2024-08-22 19:05:38 +0000 Commit: Warner Losh CommitDate: 2025-01-24 21:25:51 +0000 sys: make the kernel metadata pointer global The way we got the kernel metadata pointer was by calling preload_search_by_type with one of the following three: "elf kernel", "elf32 kernel" and "elf64 kernel". Which one(s) we used wasn't consistent though. Sometimes we would only try "elf kernel", and other times we would try one of the latter two if the first failed. However, the loader only ever sets "elf kernel" as the kernel type. Now, the kmdp is a global, preload_kmdp, and it's initialized using preload_initkmdp in machdep.c (or machdep_boot.c on arm/64). preload_initkmdp takes a single boolean argument that tells us whether not finding the kmdp is fatal or not. Reviewed by: imp, kib Pull Request: https://github.com/freebsd/freebsd-src/pull/1394 --- sys/amd64/amd64/machdep.c | 65 ++++++++++---------------- sys/arm/arm/machdep.c | 8 ++-- sys/arm/arm/machdep_boot.c | 20 ++++---- sys/arm64/arm64/machdep.c | 21 ++++----- sys/arm64/arm64/machdep_boot.c | 20 ++++---- sys/compat/linuxkpi/common/include/linux/efi.h | 8 +--- sys/dev/efidev/efirt.c | 6 +-- sys/dev/hyperv/vmbus/vmbus.c | 8 +--- sys/dev/nvdimm/nvdimm_e820.c | 6 +-- sys/dev/vt/hw/efifb/efifb.c | 12 +---- sys/dev/vt/hw/vbefb/vbefb.c | 12 +---- sys/dev/vt/vt_core.c | 18 ++----- sys/i386/i386/machdep.c | 20 +++----- sys/kern/link_elf.c | 24 ++++------ sys/kern/subr_module.c | 11 ++++- sys/opencrypto/crypto.c | 9 +--- sys/powerpc/powerpc/machdep.c | 55 +++++++++++----------- sys/riscv/riscv/machdep.c | 24 ++++------ sys/sys/linker.h | 5 +- sys/x86/include/init.h | 4 +- sys/x86/x86/fdt_machdep.c | 7 +-- sys/x86/x86/nexus.c | 8 +--- sys/x86/xen/hvm.c | 13 +----- sys/x86/xen/pv.c | 59 +++++++++-------------- 24 files changed, 169 insertions(+), 274 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 73bfdd4d07f5..6d9bc8b7c573 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -169,10 +169,10 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL); static void native_clock_source_init(void); /* Preload data parse function */ -static caddr_t native_parse_preload_data(u_int64_t); +static void native_parse_preload_data(u_int64_t); /* Native function to fetch and parse the e820 map */ -static void native_parse_memmap(caddr_t, vm_paddr_t *, int *); +static void native_parse_memmap(vm_paddr_t *, int *); /* Default init_ops implementation. */ struct init_ops init_ops = { @@ -814,7 +814,7 @@ add_efi_map_entries(struct efi_map_header *efihdr, vm_paddr_t *physmap, } static void -native_parse_memmap(caddr_t kmdp, vm_paddr_t *physmap, int *physmap_idx) +native_parse_memmap(vm_paddr_t *physmap, int *physmap_idx) { struct bios_smap *smap; struct efi_map_header *efihdr; @@ -828,9 +828,9 @@ native_parse_memmap(caddr_t kmdp, vm_paddr_t *physmap, int *physmap_idx) * ie: an int32_t immediately precedes smap. */ - efihdr = (struct efi_map_header *)preload_search_info(kmdp, + efihdr = (struct efi_map_header *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_EFI_MAP); - smap = (struct bios_smap *)preload_search_info(kmdp, + smap = (struct bios_smap *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_SMAP); if (efihdr == NULL && smap == NULL) panic("No BIOS smap or EFI map info from loader!"); @@ -858,7 +858,7 @@ native_parse_memmap(caddr_t kmdp, vm_paddr_t *physmap, int *physmap_idx) * XXX first should be vm_paddr_t. */ static void -getmemsize(caddr_t kmdp, u_int64_t first) +getmemsize(u_int64_t first) { int i, physmap_idx, pa_indx, da_indx; vm_paddr_t pa, physmap[PHYS_AVAIL_ENTRIES]; @@ -877,7 +877,7 @@ getmemsize(caddr_t kmdp, u_int64_t first) bzero(physmap, sizeof(physmap)); physmap_idx = 0; - init_ops.parse_memmap(kmdp, physmap, &physmap_idx); + init_ops.parse_memmap(physmap, &physmap_idx); physmap_idx -= 2; /* @@ -1127,10 +1127,9 @@ do_next: TSEXIT(); } -static caddr_t +static void native_parse_preload_data(u_int64_t modulep) { - caddr_t kmdp; char *envp; #ifdef DDB vm_offset_t ksym_start; @@ -1139,22 +1138,19 @@ native_parse_preload_data(u_int64_t modulep) preload_metadata = (caddr_t)(uintptr_t)(modulep + KERNBASE); preload_bootstrap_relocate(KERNBASE); - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); + preload_initkmdp(true); + boothowto = MD_FETCH(preload_kmdp, MODINFOMD_HOWTO, int); + envp = MD_FETCH(preload_kmdp, MODINFOMD_ENVP, char *); if (envp != NULL) envp += KERNBASE; init_static_kenv(envp, 0); #ifdef DDB - ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t); - ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t); + ksym_start = MD_FETCH(preload_kmdp, MODINFOMD_SSYM, uintptr_t); + ksym_end = MD_FETCH(preload_kmdp, MODINFOMD_ESYM, uintptr_t); db_fetch_ksymtab(ksym_start, ksym_end, 0); #endif - efi_systbl_phys = MD_FETCH(kmdp, MODINFOMD_FW_HANDLE, vm_paddr_t); - - return (kmdp); + efi_systbl_phys = MD_FETCH(preload_kmdp, MODINFOMD_FW_HANDLE, + vm_paddr_t); } static void @@ -1287,7 +1283,6 @@ amd64_loadaddr(void) u_int64_t hammer_time(u_int64_t modulep, u_int64_t physfree) { - caddr_t kmdp; int gsel_tss, x; struct pcpu *pc; uint64_t rsp0; @@ -1302,9 +1297,10 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) physfree += kernphys; - kmdp = init_ops.parse_preload_data(modulep); + /* Initializes preload_kmdp */ + init_ops.parse_preload_data(modulep); - efi_boot = preload_search_info(kmdp, MODINFO_METADATA | + efi_boot = preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_EFI_MAP) != NULL; if (!efi_boot) { @@ -1350,7 +1346,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) TUNABLE_INT_FETCH("hw.use_xsave", &use_xsave); } - link_elf_ireloc(kmdp); + link_elf_ireloc(); /* * This may be done better later if it gets more high level @@ -1535,7 +1531,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) amd64_kdb_init(); } - getmemsize(kmdp, physfree); + getmemsize(physfree); init_param2(physmem); /* now running on new page tables, configured,and u/iom is accessible */ @@ -1635,19 +1631,15 @@ smap_sysctl_handler(SYSCTL_HANDLER_ARGS) { struct bios_smap *smapbase; struct bios_smap_xattr smap; - caddr_t kmdp; uint32_t *smapattr; int count, error, i; /* Retrieve the system memory map from the loader. */ - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - smapbase = (struct bios_smap *)preload_search_info(kmdp, + smapbase = (struct bios_smap *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_SMAP); if (smapbase == NULL) return (0); - smapattr = (uint32_t *)preload_search_info(kmdp, + smapattr = (uint32_t *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_SMAP_XATTR); count = *((uint32_t *)smapbase - 1) / sizeof(*smapbase); error = 0; @@ -1672,13 +1664,9 @@ static int efi_map_sysctl_handler(SYSCTL_HANDLER_ARGS) { struct efi_map_header *efihdr; - caddr_t kmdp; uint32_t efisize; - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - efihdr = (struct efi_map_header *)preload_search_info(kmdp, + efihdr = (struct efi_map_header *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_EFI_MAP); if (efihdr == NULL) return (0); @@ -1694,13 +1682,8 @@ static int efi_arch_sysctl_handler(SYSCTL_HANDLER_ARGS) { char *arch; - caddr_t kmdp; - - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - arch = (char *)preload_search_info(kmdp, + arch = (char *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_EFI_ARCH); if (arch == NULL) return (0); diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index fdaf5d3dade8..e45ef9834e81 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -421,7 +421,6 @@ initarm(struct arm_boot_params *abp) vm_paddr_t lastaddr; vm_offset_t dtbp, kernelstack, dpcpu; char *env; - void *kmdp; int err_devmap, mem_regions_sz; phandle_t root; char dts_version[255]; @@ -439,8 +438,7 @@ initarm(struct arm_boot_params *abp) /* * Find the dtb passed in by the boot loader. */ - kmdp = preload_search_by_type("elf kernel"); - dtbp = MD_FETCH(kmdp, MODINFOMD_DTBP, vm_offset_t); + dtbp = MD_FETCH(preload_kmdp, MODINFOMD_DTBP, vm_offset_t); #if defined(FDT_DTB_STATIC) /* * In case the device tree blob was not retrieved (from metadata) try @@ -461,7 +459,7 @@ initarm(struct arm_boot_params *abp) #endif #ifdef EFI - efihdr = (struct efi_map_header *)preload_search_info(kmdp, + efihdr = (struct efi_map_header *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_EFI_MAP); if (efihdr != NULL) { arm_add_efi_map_entries(efihdr, mem_regions, &mem_regions_sz); @@ -571,7 +569,7 @@ initarm(struct arm_boot_params *abp) #endif debugf("initarm: console initialized\n"); - debugf(" arg1 kmdp = 0x%08x\n", (uint32_t)kmdp); + debugf(" arg1 kmdp = 0x%08x\n", (uint32_t)preload_kmdp); debugf(" boothowto = 0x%08x\n", boothowto); debugf(" dtbp = 0x%08x\n", (uint32_t)dtbp); debugf(" lastaddr1: 0x%08x\n", lastaddr); diff --git a/sys/arm/arm/machdep_boot.c b/sys/arm/arm/machdep_boot.c index 475da7b47ac8..534d34acabe2 100644 --- a/sys/arm/arm/machdep_boot.c +++ b/sys/arm/arm/machdep_boot.c @@ -270,7 +270,6 @@ freebsd_parse_boot_param(struct arm_boot_params *abp) { vm_offset_t lastaddr = 0; void *mdp; - void *kmdp; #ifdef DDB vm_offset_t ksym_start; vm_offset_t ksym_end; @@ -287,17 +286,19 @@ freebsd_parse_boot_param(struct arm_boot_params *abp) if ((mdp = (void *)(abp->abp_r0 & ~PAGE_MASK)) == NULL) return 0; preload_metadata = mdp; - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) + + /* Initialize preload_kmdp */ + preload_initkmdp(false); + if (preload_kmdp == NULL) return 0; - boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - loader_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); + boothowto = MD_FETCH(preload_kmdp, MODINFOMD_HOWTO, int); + loader_envp = MD_FETCH(preload_kmdp, MODINFOMD_ENVP, char *); init_static_kenv(loader_envp, 0); - lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t); + lastaddr = MD_FETCH(preload_kmdp, MODINFOMD_KERNEND, vm_offset_t); #ifdef DDB - ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t); - ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t); + ksym_start = MD_FETCH(preload_kmdp, MODINFOMD_SSYM, uintptr_t); + ksym_end = MD_FETCH(preload_kmdp, MODINFOMD_ESYM, uintptr_t); db_fetch_ksymtab(ksym_start, ksym_end, 0); #endif return lastaddr; @@ -381,6 +382,9 @@ fake_preload_metadata(struct arm_boot_params *abp __unused, void *dtb_ptr, fake_preload[i] = 0; preload_metadata = (void *)fake_preload; + /* Initialize preload_kmdp */ + preload_initkmdp(true); + init_static_kenv(NULL, 0); return (lastaddr); diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index ff7a88edfe61..22c74b21cf48 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -734,11 +734,11 @@ exclude_efi_memreserve(vm_offset_t efi_systbl_phys) #ifdef FDT static void -try_load_dtb(caddr_t kmdp) +try_load_dtb(void) { vm_offset_t dtbp; - dtbp = MD_FETCH(kmdp, MODINFOMD_DTBP, vm_offset_t); + dtbp = MD_FETCH(preload_kmdp, MODINFOMD_DTBP, vm_offset_t); #if defined(FDT_DTB_STATIC) /* * In case the device tree blob was not retrieved (from metadata) try @@ -900,7 +900,6 @@ initarm(struct arm64_bootparams *abp) char dts_version[255]; #endif vm_offset_t lastaddr; - caddr_t kmdp; bool valid; TSRAW(&thread0, TS_ENTER, __func__, NULL); @@ -910,11 +909,6 @@ initarm(struct arm64_bootparams *abp) /* Parse loader or FDT boot parameters. Determine last used address. */ lastaddr = parse_boot_param(abp); - /* Find the kernel address */ - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - identify_cpu(0); identify_hypervisor_smbios(); @@ -936,15 +930,16 @@ initarm(struct arm64_bootparams *abp) PCPU_SET(curthread, &thread0); PCPU_SET(midr, get_midr()); - link_elf_ireloc(kmdp); + link_elf_ireloc(); #ifdef FDT - try_load_dtb(kmdp); + try_load_dtb(); #endif - efi_systbl_phys = MD_FETCH(kmdp, MODINFOMD_FW_HANDLE, vm_paddr_t); + efi_systbl_phys = MD_FETCH(preload_kmdp, MODINFOMD_FW_HANDLE, + vm_paddr_t); /* Load the physical memory ranges */ - efihdr = (struct efi_map_header *)preload_search_info(kmdp, + efihdr = (struct efi_map_header *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_EFI_MAP); if (efihdr != NULL) add_efi_map_entries(efihdr); @@ -962,7 +957,7 @@ initarm(struct arm64_bootparams *abp) #endif /* Exclude the EFI framebuffer from our view of physical memory. */ - efifb = (struct efi_fb *)preload_search_info(kmdp, + efifb = (struct efi_fb *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_EFI_FB); if (efifb != NULL) physmem_exclude_region(efifb->fb_addr, efifb->fb_size, diff --git a/sys/arm64/arm64/machdep_boot.c b/sys/arm64/arm64/machdep_boot.c index b8e0c734bbb4..029ae23530ff 100644 --- a/sys/arm64/arm64/machdep_boot.c +++ b/sys/arm64/arm64/machdep_boot.c @@ -124,6 +124,9 @@ fake_preload_metadata(void *dtb_ptr, size_t dtb_size) preload_metadata = (caddr_t)(uintptr_t)fake_preload; + /* Initialize preload_kmdp */ + preload_initkmdp(true); + init_static_kenv(NULL, 0); return (lastaddr); @@ -188,7 +191,6 @@ static vm_offset_t freebsd_parse_boot_param(struct arm64_bootparams *abp) { vm_offset_t lastaddr = 0; - void *kmdp; #ifdef DDB vm_offset_t ksym_start; vm_offset_t ksym_end; @@ -198,17 +200,19 @@ freebsd_parse_boot_param(struct arm64_bootparams *abp) return (0); preload_metadata = (caddr_t)(uintptr_t)(abp->modulep); - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) + + /* Initialize preload_kmdp */ + preload_initkmdp(false); + if (preload_kmdp == NULL) return (0); - boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - loader_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); + boothowto = MD_FETCH(preload_kmdp, MODINFOMD_HOWTO, int); + loader_envp = MD_FETCH(preload_kmdp, MODINFOMD_ENVP, char *); init_static_kenv(loader_envp, 0); - lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t); + lastaddr = MD_FETCH(preload_kmdp, MODINFOMD_KERNEND, vm_offset_t); #ifdef DDB - ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t); - ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t); + ksym_start = MD_FETCH(preload_kmdp, MODINFOMD_SSYM, uintptr_t); + ksym_end = MD_FETCH(preload_kmdp, MODINFOMD_ESYM, uintptr_t); db_fetch_ksymtab(ksym_start, ksym_end, 0); #endif return (lastaddr); diff --git a/sys/compat/linuxkpi/common/include/linux/efi.h b/sys/compat/linuxkpi/common/include/linux/efi.h index a485b4b1fd94..aa33371bd0e8 100644 --- a/sys/compat/linuxkpi/common/include/linux/efi.h +++ b/sys/compat/linuxkpi/common/include/linux/efi.h @@ -41,9 +41,6 @@ static inline bool __efi_enabled(int feature) { -#if defined(MODINFOMD_EFI_MAP) && !defined(__amd64__) - caddr_t kmdp; -#endif bool enabled = false; switch (feature) { @@ -52,10 +49,7 @@ __efi_enabled(int feature) /* Use cached value on amd64 */ enabled = efi_boot; #elif defined(MODINFOMD_EFI_MAP) - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - enabled = preload_search_info(kmdp, + enabled = preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_EFI_MAP) != NULL; #endif break; diff --git a/sys/dev/efidev/efirt.c b/sys/dev/efidev/efirt.c index fcbed48af395..5dff2258725d 100644 --- a/sys/dev/efidev/efirt.c +++ b/sys/dev/efidev/efirt.c @@ -167,7 +167,6 @@ efi_init(void) struct efi_map_header *efihdr; struct efi_md *map; struct efi_rt *rtdm; - caddr_t kmdp; size_t efisz; int ndesc, rt_disabled; @@ -197,10 +196,7 @@ efi_init(void) printf("EFI config table is not present\n"); } - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - efihdr = (struct efi_map_header *)preload_search_info(kmdp, + efihdr = (struct efi_map_header *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_EFI_MAP); if (efihdr == NULL) { if (bootverbose) diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c index 1c620a1f5d84..115d4af599ee 100644 --- a/sys/dev/hyperv/vmbus/vmbus.c +++ b/sys/dev/hyperv/vmbus/vmbus.c @@ -1305,18 +1305,14 @@ vmbus_fb_mmio_res(device_t dev) #endif /* aarch64 */ rman_res_t fb_start, fb_end, fb_count; int fb_height, fb_width; - caddr_t kmdp; struct vmbus_softc *sc = device_get_softc(dev); int rid = 0; - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - efifb = (struct efi_fb *)preload_search_info(kmdp, + efifb = (struct efi_fb *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_EFI_FB); #if !defined(__aarch64__) - vbefb = (struct vbe_fb *)preload_search_info(kmdp, + vbefb = (struct vbe_fb *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_VBE_FB); #endif /* aarch64 */ if (efifb != NULL) { diff --git a/sys/dev/nvdimm/nvdimm_e820.c b/sys/dev/nvdimm/nvdimm_e820.c index 2a6f29ebad21..6f9bb4c70f7a 100644 --- a/sys/dev/nvdimm/nvdimm_e820.c +++ b/sys/dev/nvdimm/nvdimm_e820.c @@ -257,7 +257,6 @@ static void nvdimm_e820_identify(driver_t *driver, device_t parent) { device_t child; - caddr_t kmdp; if (resource_disabled(driver->name, 0)) return; @@ -265,10 +264,7 @@ nvdimm_e820_identify(driver_t *driver, device_t parent) if (device_find_child(parent, driver->name, -1) != NULL) return; - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - smapbase = (const void *)preload_search_info(kmdp, + smapbase = (const void *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_SMAP); /* Only supports BIOS SMAP for now. */ diff --git a/sys/dev/vt/hw/efifb/efifb.c b/sys/dev/vt/hw/efifb/efifb.c index cac6f93b7af1..eda05ec3d203 100644 --- a/sys/dev/vt/hw/efifb/efifb.c +++ b/sys/dev/vt/hw/efifb/efifb.c @@ -77,17 +77,13 @@ vt_efifb_probe(struct vt_device *vd) { int disabled; struct efi_fb *efifb; - caddr_t kmdp; disabled = 0; TUNABLE_INT_FETCH("hw.syscons.disable", &disabled); if (disabled != 0) return (CN_DEAD); - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - efifb = (struct efi_fb *)preload_search_info(kmdp, + efifb = (struct efi_fb *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_EFI_FB); if (efifb == NULL) return (CN_DEAD); @@ -100,7 +96,6 @@ vt_efifb_init(struct vt_device *vd) { struct fb_info *info; struct efi_fb *efifb; - caddr_t kmdp; int memattr; int roff, goff, boff; char attr[16]; @@ -132,10 +127,7 @@ vt_efifb_init(struct vt_device *vd) if (info == NULL) info = vd->vd_softc = (void *)&local_info; - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - efifb = (struct efi_fb *)preload_search_info(kmdp, + efifb = (struct efi_fb *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_EFI_FB); if (efifb == NULL) return (CN_DEAD); diff --git a/sys/dev/vt/hw/vbefb/vbefb.c b/sys/dev/vt/hw/vbefb/vbefb.c index 2d6ada6002d0..0f9d9257948c 100644 --- a/sys/dev/vt/hw/vbefb/vbefb.c +++ b/sys/dev/vt/hw/vbefb/vbefb.c @@ -77,17 +77,13 @@ vt_vbefb_probe(struct vt_device *vd) { int disabled; struct vbe_fb *vbefb; - caddr_t kmdp; disabled = 0; TUNABLE_INT_FETCH("hw.syscons.disable", &disabled); if (disabled != 0) return (CN_DEAD); - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - vbefb = (struct vbe_fb *)preload_search_info(kmdp, + vbefb = (struct vbe_fb *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_VBE_FB); if (vbefb == NULL) return (CN_DEAD); @@ -100,17 +96,13 @@ vt_vbefb_init(struct vt_device *vd) { struct fb_info *info; struct vbe_fb *vbefb; - caddr_t kmdp; int format, roff, goff, boff; info = vd->vd_softc; if (info == NULL) info = vd->vd_softc = (void *)&local_vbe_info; - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - vbefb = (struct vbe_fb *)preload_search_info(kmdp, + vbefb = (struct vbe_fb *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_VBE_FB); if (vbefb == NULL) return (CN_DEAD); diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 1be98466112e..b0f58b38a6f1 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -1675,15 +1675,11 @@ 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; - 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 *); + si = MD_FETCH(preload_kmdp, MODINFOMD_SPLASH, struct splash_info *); if (!(vd->vd_flags & VDF_TEXTMODE) && (boothowto & RB_MUTE)) { if (si == NULL) { top = (vd->vd_height - vt_logo_height) / 2; @@ -1806,14 +1802,10 @@ parse_font_info(struct font_info *fi) static void vt_init_font(void *arg) { - caddr_t kmdp; struct font_info *fi; struct vt_font *font; - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - fi = MD_FETCH(kmdp, MODINFOMD_FONT, struct font_info *); + fi = MD_FETCH(preload_kmdp, MODINFOMD_FONT, struct font_info *); font = parse_font_info(fi); if (font != NULL) @@ -1825,14 +1817,10 @@ SYSINIT(vt_init_font, SI_SUB_KMEM, SI_ORDER_ANY, vt_init_font, &vt_consdev); static void vt_init_font_static(void) { - caddr_t kmdp; struct font_info *fi; struct vt_font *font; - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - fi = MD_FETCH(kmdp, MODINFOMD_FONT, struct font_info *); + fi = MD_FETCH(preload_kmdp, MODINFOMD_FONT, struct font_info *); font = parse_font_info_static(fi); if (font != NULL) diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 008d67017f68..6aac0e968362 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -903,7 +903,6 @@ getmemsize(int first) struct vm86context vmc; vm_paddr_t pa; struct bios_smap *smap, *smapbase; - caddr_t kmdp; has_smap = 0; bzero(&vmf, sizeof(vmf)); @@ -924,10 +923,7 @@ getmemsize(int first) * use that and do not make any VM86 calls. */ physmap_idx = 0; - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf32 kernel"); - smapbase = (struct bios_smap *)preload_search_info(kmdp, + smapbase = (struct bios_smap *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_SMAP); if (smapbase != NULL) { add_smap_entries(smapbase, physmap, &physmap_idx); @@ -1388,7 +1384,6 @@ init386(int first) int gsel_tss, metadata_missing, x, pa; struct pcpu *pc; struct xstate_hdr *xhdr; - caddr_t kmdp; vm_offset_t addend; size_t ucode_len; @@ -1547,8 +1542,9 @@ init386(int first) TUNABLE_INT_FETCH("hw.use_xsave", &use_xsave); } - kmdp = preload_search_by_type("elf kernel"); - link_elf_ireloc(kmdp); + /* Initialize preload_kmdp */ + preload_initkmdp(!metadata_missing); + link_elf_ireloc(); vm86_initialize(); getmemsize(first); @@ -1734,19 +1730,15 @@ smap_sysctl_handler(SYSCTL_HANDLER_ARGS) { struct bios_smap *smapbase; struct bios_smap_xattr smap; - caddr_t kmdp; uint32_t *smapattr; int count, error, i; /* Retrieve the system memory map from the loader. */ - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf32 kernel"); - smapbase = (struct bios_smap *)preload_search_info(kmdp, + smapbase = (struct bios_smap *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_SMAP); if (smapbase == NULL) return (0); - smapattr = (uint32_t *)preload_search_info(kmdp, + smapattr = (uint32_t *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_SMAP_XATTR); count = *((u_int32_t *)smapbase - 1) / sizeof(*smapbase); error = 0; diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 9f9c10456b60..23a924636ca2 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -450,18 +450,14 @@ link_elf_init(void* arg) Elf_Dyn *dp; Elf_Addr *ctors_addrp; Elf_Size *ctors_sizep; - caddr_t modptr, baseptr, sizeptr; + caddr_t baseptr, sizeptr; elf_file_t ef; const char *modname; linker_add_class(&link_elf_class); dp = (Elf_Dyn *)&_DYNAMIC; - modname = NULL; - modptr = preload_search_by_type("elf" __XSTRING(__ELF_WORD_SIZE) " kernel"); - if (modptr == NULL) - modptr = preload_search_by_type("elf kernel"); - modname = (char *)preload_search_info(modptr, MODINFO_NAME); + modname = (char *)preload_search_info(preload_kmdp, MODINFO_NAME); if (modname == NULL) modname = "kernel"; linker_kernel_file = linker_make_file(modname, &link_elf_class); @@ -493,17 +489,17 @@ link_elf_init(void* arg) linker_kernel_file->size = -(intptr_t)linker_kernel_file->address; #endif - if (modptr != NULL) { - ef->modptr = modptr; - baseptr = preload_search_info(modptr, MODINFO_ADDR); + if (preload_kmdp != NULL) { + ef->modptr = preload_kmdp; + baseptr = preload_search_info(preload_kmdp, MODINFO_ADDR); if (baseptr != NULL) linker_kernel_file->address = *(caddr_t *)baseptr; - sizeptr = preload_search_info(modptr, MODINFO_SIZE); + sizeptr = preload_search_info(preload_kmdp, MODINFO_SIZE); if (sizeptr != NULL) linker_kernel_file->size = *(size_t *)sizeptr; - ctors_addrp = (Elf_Addr *)preload_search_info(modptr, + ctors_addrp = (Elf_Addr *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_CTORS_ADDR); - ctors_sizep = (Elf_Size *)preload_search_info(modptr, + ctors_sizep = (Elf_Size *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_CTORS_SIZE); if (ctors_addrp != NULL && ctors_sizep != NULL) { linker_kernel_file->ctors_addr = ef->address + @@ -2016,7 +2012,7 @@ elf_lookup_ifunc(linker_file_t lf, Elf_Size symidx, int deps __unused, } void -link_elf_ireloc(caddr_t kmdp) +link_elf_ireloc(void) { struct elf_file eff; elf_file_t ef; @@ -2026,7 +2022,7 @@ link_elf_ireloc(caddr_t kmdp) bzero_early(ef, sizeof(*ef)); - ef->modptr = kmdp; + ef->modptr = preload_kmdp; ef->dynamic = (Elf_Dyn *)&_DYNAMIC; #ifdef RELOCATABLE_KERNEL diff --git a/sys/kern/subr_module.c b/sys/kern/subr_module.c index 7f56ed72e1ac..14272bd913f8 100644 --- a/sys/kern/subr_module.c +++ b/sys/kern/subr_module.c @@ -44,7 +44,16 @@ */ vm_offset_t preload_addr_relocate = 0; -caddr_t preload_metadata; +caddr_t preload_metadata, preload_kmdp; + +void +preload_initkmdp(bool fatal) +{ + preload_kmdp = preload_search_by_type("elf kernel"); + + if (preload_kmdp == NULL && fatal) + panic("unable to find kernel metadata"); +} /* * Search for the preloaded module (name) diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index e840d514fcd5..3c7299780a38 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -253,14 +253,7 @@ static struct keybuf empty_keybuf = { static void keybuf_init(void) { - caddr_t kmdp; - - kmdp = preload_search_by_type("elf kernel"); - - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - - keybuf = (struct keybuf *)preload_search_info(kmdp, + keybuf = (struct keybuf *)preload_search_info(preload_kmdp, MODINFO_METADATA | MODINFOMD_KEYBUF); if (keybuf == NULL) diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c index 899fb430e5d9..96f3b292854d 100644 --- a/sys/powerpc/powerpc/machdep.c +++ b/sys/powerpc/powerpc/machdep.c @@ -264,7 +264,6 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry, void *mdp, struct cpuref bsp; vm_offset_t startkernel, endkernel; char *env; - void *kmdp = NULL; bool ofw_bootargs = false; #ifdef DDB bool symbols_provided = false; @@ -336,33 +335,34 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry, void *mdp, preload_metadata += md_offset; preload_bootstrap_relocate(md_offset); } - kmdp = preload_search_by_type("elf kernel"); - if (kmdp != NULL) { - boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); - if (envp != NULL) - envp += md_offset; - init_static_kenv(envp, 0); - if (fdt == 0) { - fdt = MD_FETCH(kmdp, MODINFOMD_DTBP, uintptr_t); - if (fdt != 0) - fdt += md_offset; - } - /* kernelstartphys is already relocated. */ - kernelendphys = MD_FETCH(kmdp, MODINFOMD_KERNEND, - vm_offset_t); - if (kernelendphys != 0) - kernelendphys += md_offset; - endkernel = ulmax(endkernel, kernelendphys); + + /* Initialize preload_kmdp */ + preload_initkmdp(true); + + boothowto = MD_FETCH(preload_kmdp, MODINFOMD_HOWTO, int); + envp = MD_FETCH(preload_kmdp, MODINFOMD_ENVP, char *); + if (envp != NULL) + envp += md_offset; + init_static_kenv(envp, 0); + if (fdt == 0) { + fdt = MD_FETCH(preload_kmdp, MODINFOMD_DTBP, uintptr_t); + if (fdt != 0) + fdt += md_offset; + } + /* kernelstartphys is already relocated. */ + kernelendphys = MD_FETCH(preload_kmdp, MODINFOMD_KERNEND, + vm_offset_t); + if (kernelendphys != 0) + kernelendphys += md_offset; + endkernel = ulmax(endkernel, kernelendphys); #ifdef DDB - ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t); - ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t); + ksym_start = MD_FETCH(preload_kmdp, MODINFOMD_SSYM, uintptr_t); + ksym_end = MD_FETCH(preload_kmdp, MODINFOMD_ESYM, uintptr_t); - db_fetch_ksymtab(ksym_start, ksym_end, md_offset); - /* Symbols provided by loader. */ - symbols_provided = true; + db_fetch_ksymtab(ksym_start, ksym_end, md_offset); + /* Symbols provided by loader. */ + symbols_provided = true; #endif - } } else { /* * Self-loading kernel, we have to fake up metadata. @@ -372,7 +372,8 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry, void *mdp, * preload_boostrap_relocate(). */ fake_preload_metadata(); - kmdp = preload_search_by_type("elf kernel"); + /* Initialize preload_kmdp */ + preload_initkmdp(true); init_static_kenv(init_kenv, sizeof(init_kenv)); ofw_bootargs = true; } @@ -466,7 +467,7 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry, void *mdp, * Bring up MMU */ pmap_mmu_init(); - link_elf_ireloc(kmdp); + link_elf_ireloc(); pmap_bootstrap(startkernel, endkernel); mtmsr(psl_kernset & ~PSL_EE); diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c index c0d4b7cc2726..a17cff55f2cc 100644 --- a/sys/riscv/riscv/machdep.c +++ b/sys/riscv/riscv/machdep.c @@ -307,11 +307,11 @@ init_proc0(vm_offset_t kstack) #ifdef FDT static void -try_load_dtb(caddr_t kmdp) +try_load_dtb(void) { vm_offset_t dtbp; - dtbp = MD_FETCH(kmdp, MODINFOMD_DTBP, vm_offset_t); + dtbp = MD_FETCH(preload_kmdp, MODINFOMD_DTBP, vm_offset_t); #if defined(FDT_DTB_STATIC) /* @@ -434,34 +434,30 @@ parse_fdt_bootargs(void) static vm_offset_t parse_metadata(void) { - caddr_t kmdp; vm_offset_t lastaddr; #ifdef DDB vm_offset_t ksym_start, ksym_end; #endif char *kern_envp; - /* Find the kernel address */ - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - KASSERT(kmdp != NULL, ("No preload metadata found!")); + /* Initialize preload_kmdp */ + preload_initkmdp(true); *** 306 LINES SKIPPED *** From nobody Fri Jan 24 21:37:13 2025 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 4YfrkL0shsz5lS43; Fri, 24 Jan 2025 21:37: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 4YfrkK74SBz3jf5; Fri, 24 Jan 2025 21:37:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737754634; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5USh3nZiDAFTp05j/bWR7T1dRTC7JcySIBer1EVuv+k=; b=dkRFVqIi4emtx/LzXa54Bc4bS1BBAsB/BUw0IztHHJSTBZxq3SDfVEQLUCovmY0jwIWyfa W82l36OMYz7lpZfeD4Qm7DBdiQ93Jn9ezvgyef1MoHYIqwfLJ+42Iew2b8+5EN+9INj3u4 RMdjLJwK832RLQTAu14zkpppWgr5YiJmXk5z6YEZJyvy11Ne6WdGrLK0JEAfk3ZmG1dKQY Pn0bqe5LbC7PwBZJDGXqFRYHlx7s0sdBDUh64M4DFU89q9aQSOJSN6FFCdqMyUpXvYBKQl Zwc3TT6pnpJPmAQcOSXxtlkhpgc3h872xVGECuDmYMb8TnJOKBRkHUAByyMDuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737754634; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5USh3nZiDAFTp05j/bWR7T1dRTC7JcySIBer1EVuv+k=; b=Ktr8qQyBRme+zMnZfYOqAtGmD44LRJIKAv+/nE9m0N3R8MIdFgloecNs1g9qU/Dhwr57WM MAOm6lNs9RJDMpUy9jgDds9WwD6FUY0FQuHRgSMd4be36mBWT/nff5jza1VyzZvx/RWqT+ R4VJzKt77OUhH/xIQexH09JfBfKS1I5NkJ9wGY+bYuUh6r20eg/px7rQIBr3MD5yoIQt1f pJbrZiVOgrvVgyDbsxShuAjEeD950ntpbZBn5Vz9sm3mDLUYJJ6CsZQMYbdUmTrqB7OfMk i41ZP3GZ80I/F2hMHkKxE4BRstZzFbubYXtYt1Az18cLr+5ey1T2vdRobluRXg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737754634; a=rsa-sha256; cv=none; b=cbmsPkI1vND1qnMRNnkzc9VSQVHBQTJAm1zKtrkDm7fk8l6EEmFSpJ7Vq4WqDT+6ubwUFi da4AJk0HZf0yJN/tPWJWw4Y31+HXn/Xk7sIJdYDOx5nOF2lRZ+BVAaf3lrF56YyoHiD6Ce 3ARXn99pC1J6/K/sfXW/uxSMZCfe/TErL36wHHrAs4ZpH6+iZ76AnFUkFnTwX34O0aPtxa RNq90WLgXEuGDEEdKQYNbLDf4XwvjpQYCLs7Jzd4HZbe6Zzz9yAby6FkrCDERQjoYNR+W9 rjeW8mTIucxR7QW2LzPXu1xrGKIMW1TnfwJ3v+6GkKFt2s+nwMTqe0fzoTbGKg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfrkK6fHYzjwk; Fri, 24 Jan 2025 21:37: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 50OLbDro094812; Fri, 24 Jan 2025 21:37:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OLbDn2094809; Fri, 24 Jan 2025 21:37:13 GMT (envelope-from git) Date: Fri, 24 Jan 2025 21:37:13 GMT Message-Id: <202501242137.50OLbDn2094809@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: 707136024fcc - main - stand: remove unnecessary checks for "elfN kernel" 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: 707136024fcc64be5008c793cdbdd05720be0e18 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=707136024fcc64be5008c793cdbdd05720be0e18 commit 707136024fcc64be5008c793cdbdd05720be0e18 Author: Ahmad Khalifa AuthorDate: 2024-08-22 19:07:59 +0000 Commit: Warner Losh CommitDate: 2025-01-24 21:25:52 +0000 stand: remove unnecessary checks for "elfN kernel" We never set the kernel type to either "elf64 kernel" nor "elf32 kernel". Reviewed by: imp, kib Pull Request: https://github.com/freebsd/freebsd-src/pull/1394 --- stand/common/bootstrap.h | 2 +- stand/common/gfx_fb.c | 4 ---- stand/common/metadata.c | 4 +--- stand/efi/loader/bootinfo.c | 2 -- stand/i386/libi386/bootinfo32.c | 2 -- stand/i386/libi386/bootinfo64.c | 2 -- stand/userboot/userboot/bootinfo32.c | 2 -- stand/userboot/userboot/bootinfo64.c | 2 -- 8 files changed, 2 insertions(+), 18 deletions(-) diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h index 37cef2956f40..cc198490ac3b 100644 --- a/stand/common/bootstrap.h +++ b/stand/common/bootstrap.h @@ -230,7 +230,7 @@ struct kernel_module struct preloaded_file { char *f_name; /* file name */ - char *f_type; /* verbose file type, eg 'ELF kernel', 'pnptable', etc. */ + char *f_type; /* verbose file type, eg 'elf kernel', 'pnptable', etc. */ char *f_args; /* arguments for the file */ /* metadata that will be placed in the module directory */ struct file_metadata *f_metadata; diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 9942c629d124..9bda0e7139a9 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -2983,8 +2983,6 @@ build_font_module(vm_offset_t addr) fi.fi_checksum = -checksum; fp = file_findfile(NULL, "elf kernel"); - if (fp == NULL) - fp = file_findfile(NULL, "elf64 kernel"); if (fp == NULL) panic("can't find kernel file"); @@ -3027,8 +3025,6 @@ build_splash_module(vm_offset_t 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"); diff --git a/stand/common/metadata.c b/stand/common/metadata.c index f95763bfd01b..8962763061dc 100644 --- a/stand/common/metadata.c +++ b/stand/common/metadata.c @@ -146,9 +146,7 @@ md_load_dual(char *args, vm_offset_t *modulep, vm_offset_t *dtb, int kern64) #endif kernend = 0; - kfp = file_findfile(NULL, kern64 ? "elf64 kernel" : "elf32 kernel"); - if (kfp == NULL) - kfp = file_findfile(NULL, "elf kernel"); + kfp = file_findfile(NULL, "elf kernel"); if (kfp == NULL) panic("can't find kernel file"); file_addmetadata(kfp, MODINFOMD_HOWTO, sizeof howto, &howto); diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c index 99a7b1444aca..b7d4070c2ffb 100644 --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -421,8 +421,6 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs) #endif kfp = file_findfile(NULL, "elf kernel"); - if (kfp == NULL) - kfp = file_findfile(NULL, "elf64 kernel"); if (kfp == NULL) panic("can't find kernel file"); kernend = 0; /* fill it in later */ diff --git a/stand/i386/libi386/bootinfo32.c b/stand/i386/libi386/bootinfo32.c index 535849011b6b..df715e547795 100644 --- a/stand/i386/libi386/bootinfo32.c +++ b/stand/i386/libi386/bootinfo32.c @@ -130,8 +130,6 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t addr = roundup(addr, PAGE_SIZE); kfp = file_findfile(NULL, "elf kernel"); - if (kfp == NULL) - kfp = file_findfile(NULL, "elf32 kernel"); if (kfp == NULL) panic("can't find kernel file"); kernend = 0; /* fill it in later */ diff --git a/stand/i386/libi386/bootinfo64.c b/stand/i386/libi386/bootinfo64.c index a55b86eb5ba7..4731b10325fe 100644 --- a/stand/i386/libi386/bootinfo64.c +++ b/stand/i386/libi386/bootinfo64.c @@ -144,8 +144,6 @@ bi_load64(char *args, vm_offset_t *modulep, module = *modulep = addr; kfp = file_findfile(NULL, "elf kernel"); - if (kfp == NULL) - kfp = file_findfile(NULL, "elf64 kernel"); if (kfp == NULL) panic("can't find kernel file"); kernend = 0; /* fill it in later */ diff --git a/stand/userboot/userboot/bootinfo32.c b/stand/userboot/userboot/bootinfo32.c index aae94e6a2370..91f1f81f1181 100644 --- a/stand/userboot/userboot/bootinfo32.c +++ b/stand/userboot/userboot/bootinfo32.c @@ -109,8 +109,6 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t addr = roundup(addr, PAGE_SIZE); kfp = file_findfile(NULL, "elf kernel"); - if (kfp == NULL) - kfp = file_findfile(NULL, "elf32 kernel"); if (kfp == NULL) panic("can't find kernel file"); kernend = 0; /* fill it in later */ diff --git a/stand/userboot/userboot/bootinfo64.c b/stand/userboot/userboot/bootinfo64.c index b7c07e152b8a..fb9fd0fb82f1 100644 --- a/stand/userboot/userboot/bootinfo64.c +++ b/stand/userboot/userboot/bootinfo64.c @@ -141,8 +141,6 @@ bi_load64(char *args, vm_offset_t *modulep, vm_offset_t *kernendp) addr = roundup(addr, PAGE_SIZE); kfp = file_findfile(NULL, "elf kernel"); - if (kfp == NULL) - kfp = file_findfile(NULL, "elf64 kernel"); if (kfp == NULL) panic("can't find kernel file"); kernend = 0; /* fill it in later */ From nobody Fri Jan 24 21:37:14 2025 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 4YfrkM3CLlz5lRn0; Fri, 24 Jan 2025 21:37: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 4YfrkM19wqz3jms; Fri, 24 Jan 2025 21:37:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737754635; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/2vyQfT1Gam8rcqMvglZidHUdnYAbUpmlW9OcDDpzPM=; b=dcb2oyQRxfN/6/l2SQzlMOq5WeQdoAv7L4uezU7TVl+qE/n0OCr1fMHdwbRv49GuK9/5XC 6BBwp6xLyNxsATTdlZWa6RjNiHXBJiyh0qQi1jVTyjJjL9dMu4CtHN2SzEiqpI1QeKMJEc 2EhxkiL7vL/ofCn0XILQk+fBFBBZ9YaEp0GmhacHKIKW19Xk49dI75MGqZ512bP56WJfg/ NGwY1po85jjkyN4Tx+ycWYCcW7gx/0RxwpJNrqhLR/LQh3MPxm6lziyf9SSpOZB1nylnve 0RTi5D77pPyAwlwQPs/UjJ6Z3Eef2NCKpWLBzByZnDzdQlg00mdzShDBfKDt+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737754635; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/2vyQfT1Gam8rcqMvglZidHUdnYAbUpmlW9OcDDpzPM=; b=DLhnNpHzTfCa+emhYZJwszEFu/w3WvbjItjDStTqoLirR3dd1/RGqbG5ixU4invxzaWWDA mdCItZiPpu0YGVAWGJ6YQoVwomUxzebFyBdffTLjeUtMKR1UP5YkaZYqwRXjvDcok1LwRO /PFRNQahuQ4qRDqVNi8+EbbH2bf6ODwdhfl63IuDBmaC2Lp7piZGJ4EpFiRCvee8VbnpV4 Iz5fFp/4rIKhxXgc1UjOCdZbf+IEw1Jdg2VnYIR0ElS/SslcAuAGbz/dAcRNKUMkA2b0kS LcsoulMYacsvxWc7786fMEgmLFBNuPPHopcdZLjCmFi7fOc4ASuO7UdX92kR+g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737754635; a=rsa-sha256; cv=none; b=LCM8HGUMf033xZmwWpIhSszkwTw0BIi9mzIrlHRM04Px5LUztJmAGknC+k2ue3PCOXK1zG h3yQttkI9Ci99Dowcz22VYj7T0k5wC8sVKLL3LLRLLno17uW+q0txq2j11baOnmHEi2BQT rnlbPvjJqkkZgQZz49nBiljch77+cpvsd4L/nuFdKVWpGnu3HXVupXDe5gQF9h5umFc6NL dTv9mQh/n7tsWXeK3ofohcUTzojXy4MxOIz/kp8oyDjpOzFhIuE5mfEP5H7bTJS1EWYeCe WadBTUsikn6yEK/+53qdW3AW68bjI0qsI6/AX8M5y4621utHpGI5GBJXBr6lLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfrkM0nGKzkDW; Fri, 24 Jan 2025 21:37: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 50OLbFDY094853; Fri, 24 Jan 2025 21:37:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OLbEur094850; Fri, 24 Jan 2025 21:37:14 GMT (envelope-from git) Date: Fri, 24 Jan 2025 21:37:14 GMT Message-Id: <202501242137.50OLbEur094850@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: 4d213c595ac3 - main - sys: use globals for the ELF kernel and module type strings 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: 4d213c595ac3247a85cea5d3ea521db14151a427 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4d213c595ac3247a85cea5d3ea521db14151a427 commit 4d213c595ac3247a85cea5d3ea521db14151a427 Author: Ahmad Khalifa AuthorDate: 2024-08-24 15:12:52 +0000 Commit: Warner Losh CommitDate: 2025-01-24 21:29:39 +0000 sys: use globals for the ELF kernel and module type strings Initialize the globals with macros so we can use the same values in the loader. Also remove unnecessary "elfN module" checks. Reviewed by: imp, kib Pull Request: https://github.com/freebsd/freebsd-src/pull/1394 --- sys/arm/arm/machdep_boot.c | 8 ++++---- sys/arm64/arm64/machdep_boot.c | 2 +- sys/kern/link_elf.c | 4 +--- sys/kern/link_elf_obj.c | 5 +---- sys/kern/subr_module.c | 6 +++++- sys/powerpc/powerpc/machdep.c | 9 ++++----- sys/riscv/riscv/machdep.c | 2 +- sys/sys/linker.h | 11 +++++++++++ 8 files changed, 28 insertions(+), 19 deletions(-) diff --git a/sys/arm/arm/machdep_boot.c b/sys/arm/arm/machdep_boot.c index 534d34acabe2..e2416f86ad23 100644 --- a/sys/arm/arm/machdep_boot.c +++ b/sys/arm/arm/machdep_boot.c @@ -356,12 +356,12 @@ fake_preload_metadata(struct arm_boot_params *abp __unused, void *dtb_ptr, fake_preload[i++] = MODINFO_NAME; fake_preload[i++] = strlen("kernel") + 1; - strcpy((char*)&fake_preload[i++], "kernel"); + strcpy((char *)&fake_preload[i++], "kernel"); i += 1; fake_preload[i++] = MODINFO_TYPE; - fake_preload[i++] = strlen("elf kernel") + 1; - strcpy((char*)&fake_preload[i++], "elf kernel"); - i += 2; + fake_preload[i++] = strlen(preload_kerntype) + 1; + strcpy((char *)&fake_preload[i], preload_kerntype); + i += howmany(fake_preload[i - 1], sizeof(uint32_t)); fake_preload[i++] = MODINFO_ADDR; fake_preload[i++] = sizeof(vm_offset_t); fake_preload[i++] = KERNVIRTADDR; diff --git a/sys/arm64/arm64/machdep_boot.c b/sys/arm64/arm64/machdep_boot.c index 029ae23530ff..83bd74ea7317 100644 --- a/sys/arm64/arm64/machdep_boot.c +++ b/sys/arm64/arm64/machdep_boot.c @@ -98,7 +98,7 @@ fake_preload_metadata(void *dtb_ptr, size_t dtb_size) PRELOAD_PUSH_STRING("kernel"); PRELOAD_PUSH_VALUE(uint32_t, MODINFO_TYPE); - PRELOAD_PUSH_STRING("elf kernel"); + PRELOAD_PUSH_STRING(preload_kerntype); PRELOAD_PUSH_VALUE(uint32_t, MODINFO_ADDR); PRELOAD_PUSH_VALUE(uint32_t, sizeof(vm_offset_t)); diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 23a924636ca2..53af1e164980 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -895,9 +895,7 @@ link_elf_link_preload(linker_class_t cls, const char *filename, sizeptr = preload_search_info(modptr, MODINFO_SIZE); dynptr = preload_search_info(modptr, MODINFO_METADATA | MODINFOMD_DYNAMIC); - if (type == NULL || - (strcmp(type, "elf" __XSTRING(__ELF_WORD_SIZE) " module") != 0 && - strcmp(type, "elf module") != 0)) + if (type == NULL || strcmp(type, preload_modtype) != 0) return (EFTYPE); if (baseptr == NULL || sizeptr == NULL || dynptr == NULL) return (EINVAL); diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index a7c7d4826322..02fd4caffcd9 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -365,11 +365,8 @@ link_elf_link_preload(linker_class_t cls, const char *filename, MODINFOMD_ELFHDR); shdr = (Elf_Shdr *)preload_search_info(modptr, MODINFO_METADATA | MODINFOMD_SHDR); - if (type == NULL || (strcmp(type, "elf" __XSTRING(__ELF_WORD_SIZE) - " obj module") != 0 && - strcmp(type, "elf obj module") != 0)) { + if (type == NULL || strcmp(type, preload_modtype_obj) != 0) return (EFTYPE); - } if (baseptr == NULL || sizeptr == NULL || hdr == NULL || shdr == NULL) return (EINVAL); diff --git a/sys/kern/subr_module.c b/sys/kern/subr_module.c index 14272bd913f8..596961606577 100644 --- a/sys/kern/subr_module.c +++ b/sys/kern/subr_module.c @@ -46,10 +46,14 @@ vm_offset_t preload_addr_relocate = 0; caddr_t preload_metadata, preload_kmdp; +const char preload_modtype[] = MODTYPE; +const char preload_kerntype[] = KERNTYPE; +const char preload_modtype_obj[] = MODTYPE_OBJ; + void preload_initkmdp(bool fatal) { - preload_kmdp = preload_search_by_type("elf kernel"); + preload_kmdp = preload_search_by_type(preload_kerntype); if (preload_kmdp == NULL && fatal) panic("unable to find kernel metadata"); diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c index 96f3b292854d..e9979712aa9c 100644 --- a/sys/powerpc/powerpc/machdep.c +++ b/sys/powerpc/powerpc/machdep.c @@ -644,15 +644,14 @@ fake_preload_metadata(void) { fake_preload[i++] = MODINFO_NAME; fake_preload[i++] = strlen("kernel") + 1; - strcpy((char*)&fake_preload[i], "kernel"); + strcpy((char *)&fake_preload[i], "kernel"); /* ['k' 'e' 'r' 'n'] ['e' 'l' '\0' ..] */ i += 2; fake_preload[i++] = MODINFO_TYPE; - fake_preload[i++] = strlen("elf kernel") + 1; - strcpy((char*)&fake_preload[i], "elf kernel"); - /* ['e' 'l' 'f' ' '] ['k' 'e' 'r' 'n'] ['e' 'l' '\0' ..] */ - i += 3; + fake_preload[i++] = strlen(preload_kerntype) + 1; + strcpy((char *)&fake_preload[i], preload_kerntype); + i += howmany(fake_preload[i - 1], sizeof(uint32_t)); #ifdef __powerpc64__ /* Padding -- Fields start on u_long boundaries */ diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c index a17cff55f2cc..8d32d348df7d 100644 --- a/sys/riscv/riscv/machdep.c +++ b/sys/riscv/riscv/machdep.c @@ -365,7 +365,7 @@ fake_preload_metadata(struct riscv_bootparams *rvbp) PRELOAD_PUSH_VALUE(uint32_t, MODINFO_NAME); PRELOAD_PUSH_STRING("kernel"); PRELOAD_PUSH_VALUE(uint32_t, MODINFO_TYPE); - PRELOAD_PUSH_STRING("elf kernel"); + PRELOAD_PUSH_STRING(preload_kerntype); PRELOAD_PUSH_VALUE(uint32_t, MODINFO_ADDR); PRELOAD_PUSH_VALUE(uint32_t, sizeof(vm_offset_t)); diff --git a/sys/sys/linker.h b/sys/sys/linker.h index 77dd437c7ffe..85c50be6c969 100644 --- a/sys/sys/linker.h +++ b/sys/sys/linker.h @@ -220,6 +220,14 @@ void linker_kldload_unbusy(int flags); #endif /* _KERNEL */ +/* + * ELF file types + */ +#define KERNTYPE_MB "elf multiboot kernel" +#define KERNTYPE "elf kernel" +#define MODTYPE_OBJ "elf obj module" +#define MODTYPE "elf module" + /* * Module information subtypes */ @@ -273,6 +281,9 @@ void linker_kldload_unbusy(int flags); */ extern vm_offset_t preload_addr_relocate; extern caddr_t preload_metadata, preload_kmdp; +extern const char preload_modtype[]; +extern const char preload_kerntype[]; +extern const char preload_modtype_obj[]; extern void * preload_fetch_addr(caddr_t _mod); extern size_t preload_fetch_size(caddr_t _mod); From nobody Fri Jan 24 21:37:16 2025 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 4YfrkN4hFcz5lS45; Fri, 24 Jan 2025 21:37: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 4YfrkN2ZVXz3jky; Fri, 24 Jan 2025 21:37:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737754636; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2EOwCvlbWuNWGbhNzW/jf8fosPNIG3YnnxkE585TCfk=; b=dUT9ahgyaKiZ1hTiQ14vwsxNCEtWtyMu7T6tKovelRU6kmi7gLBw26Xc8VS9d/slBg+oo8 4RyVwDyuBMjV8VVoFpgyUdHBHLQT1oPb2IbQTZLmqdDnEO8mIM2VWoC1FVbJhiWIfWrmkD vmM0skysDRNPmjTvJ3LpYDrA3b4soiTRbvs5EuUFxsitd7UihqXbKudLGZxqNZwUFzsXBA QGMq3f+dusiZ497456/LKttg/VUcUa5LzkzShlaFkwbU5Ol04vXICP7mTzD6WqrDdr5Bwl OFY7kiIKhbP6XCIbPx0KK9IMlUdM9YHbZxH/nsUuEuNDyyepGUC3YTnzaBMGjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737754636; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2EOwCvlbWuNWGbhNzW/jf8fosPNIG3YnnxkE585TCfk=; b=aBJUkQucR/7HvZrNaVIEYIu1TSyU6DLMfN+mmxGqljCT3gCoI9gYCKgJ3EaUxsBSIgIUch sbXVK/YHUkAO0ILcQ2yrw1NMffIPPhn178pAT5RwXsKN/U56jo96xM8KmyCGXhtaeA8pz5 esCH1tQVmvBj7Z4+tTtFDrpwxZugGdVOotIs9yzskoNsoq2HZbunmXV4k8mKB1cdHtd4YU mEwiSljJVqyjcCtjTjDpd98ZcPBz7O8e8ALObn1kf5fkSY1jHnFgtNVR4UpEhqvag/85PC JVTQtuwCmX9IpDeF8du55zrGecOBSode+mJKH8hqMIx7Zlfh6Us4MCavPV7Y7g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737754636; a=rsa-sha256; cv=none; b=TC7m5wGE29YbQrK7cOe3wYlyXPQnHr3Miy59AugMc/q20OeouPK/0GRslwwr95RaVtoSYx KPOXQMijmZLSLLp3q6upaEg8gsafe42rszrfFgKPzGwtMZNE6KocXK3QCF32i2oaHFIfYU u+tWHUNcgNQQkwig7UUR3K9xJxNN4bPE/80wFL+cf3duC1E1EXhShrF1JJAXhy1il/b8nH cYqyPP/Ze5AsJrRjMNcxY+s+uUtzGKfuVmvjXGGZYdNa9lTJR4ve1y/bdHLVNUMWdbNSAI tKEfNKRJtL8x3L20GVM2XGXNR+6JDrEMHdqBRIcbveVOQ00hATZLdS4hwNCTJQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfrkN1MP4zkDX; Fri, 24 Jan 2025 21:37: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 50OLbGYg094886; Fri, 24 Jan 2025 21:37:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OLbGRt094883; Fri, 24 Jan 2025 21:37:16 GMT (envelope-from git) Date: Fri, 24 Jan 2025 21:37:16 GMT Message-Id: <202501242137.50OLbGRt094883@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: c75ba31904e3 - main - stand: file_loadraw: make 'type' a const char * 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: c75ba31904e342443c89e4dfecf1aa1715c7e063 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c75ba31904e342443c89e4dfecf1aa1715c7e063 commit c75ba31904e342443c89e4dfecf1aa1715c7e063 Author: Ahmad Khalifa AuthorDate: 2024-08-30 23:36:06 +0000 Commit: Warner Losh CommitDate: 2025-01-24 21:29:39 +0000 stand: file_loadraw: make 'type' a const char * Reviewed by: imp, kib Pull Request: https://github.com/freebsd/freebsd-src/pull/1394 --- stand/common/bootstrap.h | 2 +- stand/common/module.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h index cc198490ac3b..0c6462f8d1a1 100644 --- a/stand/common/bootstrap.h +++ b/stand/common/bootstrap.h @@ -271,7 +271,7 @@ void unload(void); struct preloaded_file *file_alloc(void); struct preloaded_file *file_findfile(const char *name, const char *type); struct file_metadata *file_findmetadata(struct preloaded_file *fp, int type); -struct preloaded_file *file_loadraw(const char *name, char *type, int insert); +struct preloaded_file *file_loadraw(const char *name, const char *type, int insert); void file_discard(struct preloaded_file *fp); void file_addmetadata(struct preloaded_file *, int, size_t, void *); int file_addmodule(struct preloaded_file *, char *, int, diff --git a/stand/common/module.c b/stand/common/module.c index 29228f0de22a..0c9dbcb53c2e 100644 --- a/stand/common/module.c +++ b/stand/common/module.c @@ -652,7 +652,7 @@ file_load_dependencies(struct preloaded_file *base_file) * no arguments or anything. */ struct preloaded_file * -file_loadraw(const char *fname, char *type, int insert) +file_loadraw(const char *fname, const char *type, int insert) { struct preloaded_file *fp; char *name; From nobody Fri Jan 24 21:37:17 2025 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 4YfrkP4hg2z5lRn8; Fri, 24 Jan 2025 21:37: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 4YfrkP30bhz3jcb; Fri, 24 Jan 2025 21:37:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737754637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RoZPzTw2QsmJ9niSma738YfKITQ3bpRR6HXAQhTIBlA=; b=kH/eLFHtLdPV2uVM3Ctcyt3SawGSCuI3cIkbxMK6nAXKx0b3egqqRRrzF/e1zDlpF0KOOm 8F/VaFWtfSrWymTRXK/TwmPO6lPUCVZCqpstO9d2ush0NzXSLdoxqTcrMRIC2Mi327/xPj yhf0MxN4I7a7yzHPyS1wlTDw6Jx99KaZFtS0CNIlGWwPsBsdVI/PI9MIEZJYr6JShdnZho htF/8Oz5bnZLq0OhaDW2GzSGvRCXrKGBqjxxU4lblB5UYAuID+RelMNuAMJvNOaVQvtYaD n2WBJ7Sse/IlsGK8h8XmuZhPAK4tbEbQcROooLQeJfkR5v9EHsVMcpe9itYJHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737754637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RoZPzTw2QsmJ9niSma738YfKITQ3bpRR6HXAQhTIBlA=; b=LPKmKHO8xaOEHhwsqYRFwdoRQEun/t706hCXY5nd82Kj9RvKW+GV6CiHF373VZlqxT8pGz hl6Hbp21aG25wKsov5Tix5vtKwUtmTdhK/QUC3piCt9V8+kK/rKy3VxOteq1cWdR/4gh2S MQyCbz/O12AL/isaKXJT6NXcuUp9uXZOAgryRS3dJknnpebpPEa6w7kTgzuAolu/pPokY4 zkUh1ZtT2VEYT4JUGbrdaOYh2cIY7nglUXA7GTtQz7Jewrg8wz1lh4PNGjrEAGiinXfLb4 wWpxUvKdJfuwDt3UCLcq1a9nPNBfjS+9RVCufejpnI/EAiJtlykRrqSKzub8cw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737754637; a=rsa-sha256; cv=none; b=NQs+ecRMB83WIH0/O0fo9SUyQL7nQg+JljyNB0uQMrVvqgOOJIf4n54TP86qRRG9qDAWGQ 55cvtLEKGtHCT2NHH2kaxONyI0vQW9sek+qs7njfWtMmrW+E9t0WwtuLEBhi+/YBUN/y8j Ocqp8UHPS3dNYJ1JU9nt9DGXMBRzyLNE9O+9g6dqIgW4bPfo8zlSE1jUVqD0lo6ASpq9cz WuRkIPxOGIOZ0hOhK7K9biFgie9SkV2XBp5XU9LwEfUbMFbcmbqYsg+8tukneo3E/Or7H1 SEgo1SFwGuANTgJi2vAX/44nN0eg90tNRkuwXFN8+zpsGU+oThYZa+GemjruVg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YfrkP22vlzjfk; Fri, 24 Jan 2025 21:37: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 50OLbHDm094918; Fri, 24 Jan 2025 21:37:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OLbHWK094915; Fri, 24 Jan 2025 21:37:17 GMT (envelope-from git) Date: Fri, 24 Jan 2025 21:37:17 GMT Message-Id: <202501242137.50OLbHWK094915@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: 86077f4fd110 - main - stand: use globals for the kernel and module types 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: 86077f4fd11070518a6d04eee7fdb93cbbfb1b52 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=86077f4fd11070518a6d04eee7fdb93cbbfb1b52 commit 86077f4fd11070518a6d04eee7fdb93cbbfb1b52 Author: Ahmad Khalifa AuthorDate: 2024-08-24 15:16:09 +0000 Commit: Warner Losh CommitDate: 2025-01-24 21:29:39 +0000 stand: use globals for the kernel and module types Reviewed by: imp, kib Pull Request: https://github.com/freebsd/freebsd-src/pull/1394 --- stand/common/gfx_fb.c | 6 ++++-- stand/common/load_elf.c | 12 +++++------- stand/common/load_elf_obj.c | 8 +++----- stand/common/metadata.c | 2 +- stand/common/modinfo.c | 5 +++++ stand/common/modinfo.h | 5 +++++ stand/efi/loader/arch/amd64/multiboot2.c | 9 +++++---- stand/efi/loader/bootinfo.c | 2 +- stand/i386/libi386/bootinfo32.c | 2 +- stand/i386/libi386/bootinfo64.c | 2 +- stand/i386/libi386/multiboot.c | 9 +++++---- stand/powerpc/ofw/elf_freebsd.c | 2 +- stand/powerpc/ofw/ppc64_elf_freebsd.c | 2 +- stand/uboot/arch/powerpc/ppc64_elf_freebsd.c | 2 +- stand/uboot/elf_freebsd.c | 2 +- stand/userboot/userboot/bootinfo32.c | 2 +- stand/userboot/userboot/bootinfo64.c | 2 +- 17 files changed, 42 insertions(+), 32 deletions(-) diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 9bda0e7139a9..63036f3c07f6 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -102,6 +102,8 @@ #include #endif +#include "modinfo.h" + /* VGA text mode does use bold font. */ #if !defined(VGA_8X16_FONT) #define VGA_8X16_FONT "/boot/fonts/8x16b.fnt" @@ -2982,7 +2984,7 @@ build_font_module(vm_offset_t addr) fi.fi_checksum = -checksum; - fp = file_findfile(NULL, "elf kernel"); + fp = file_findfile(NULL, md_kerntype); if (fp == NULL) panic("can't find kernel file"); @@ -3024,7 +3026,7 @@ build_splash_module(vm_offset_t addr) return (addr); } - fp = file_findfile(NULL, "elf kernel"); + fp = file_findfile(NULL, md_kerntype); if (fp == NULL) panic("can't find kernel file"); diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c index d3775b9f0017..e19aefa121e7 100644 --- a/stand/common/load_elf.c +++ b/stand/common/load_elf.c @@ -37,6 +37,7 @@ #include #include "bootstrap.h" +#include "modinfo.h" #define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l) @@ -89,9 +90,6 @@ static int __elfN(parse_modmetadata)(struct preloaded_file *mp, elf_file_t ef, static symaddr_fn __elfN(symaddr); static char *fake_modname(const char *name); -const char *__elfN(kerneltype) = "elf kernel"; -const char *__elfN(moduletype) = "elf module"; - uint64_t __elfN(relocation_offset) = 0; #ifdef __powerpc__ @@ -384,7 +382,7 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest, /* * Check to see what sort of module we are. */ - kfp = file_findfile(NULL, __elfN(kerneltype)); + kfp = file_findfile(NULL, md_kerntype); #ifdef __powerpc__ /* * Kernels can be ET_DYN, so just assume the first loaded object is the @@ -435,7 +433,7 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest, err = EPERM; goto oerr; } - if (strcmp(__elfN(kerneltype), kfp->f_type)) { + if (strcmp(md_kerntype, kfp->f_type)) { printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: can't load module with kernel type '%s'\n", kfp->f_type); @@ -470,9 +468,9 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest, fp->f_name = strdup(filename); if (multiboot == 0) fp->f_type = strdup(ef.kernel ? - __elfN(kerneltype) : __elfN(moduletype)); + md_kerntype : md_modtype); else - fp->f_type = strdup("elf multiboot kernel"); + fp->f_type = strdup(md_kerntype_mb); if (module_verbose >= MODULE_VERBOSE_FULL) { if (ef.kernel) diff --git a/stand/common/load_elf_obj.c b/stand/common/load_elf_obj.c index 9ff1d238b8c8..1e07828dd8ac 100644 --- a/stand/common/load_elf_obj.c +++ b/stand/common/load_elf_obj.c @@ -37,6 +37,7 @@ #include #include "bootstrap.h" +#include "modinfo.h" #define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l) @@ -77,9 +78,6 @@ static int __elfN(obj_parse_modmetadata)(struct preloaded_file *mp, elf_file_t ef); static Elf_Addr __elfN(obj_symaddr)(struct elf_file *ef, Elf_Size symidx); -const char *__elfN(obj_kerneltype) = "elf kernel"; -const char *__elfN(obj_moduletype) = "elf obj module"; - /* * Attempt to load the file (file) as an ELF module. It will be stored at * (dest), and a pointer to a module structure describing the loaded object @@ -154,7 +152,7 @@ __elfN(obj_loadfile)(char *filename, uint64_t dest, } #endif - kfp = file_findfile(NULL, __elfN(obj_kerneltype)); + kfp = file_findfile(NULL, md_kerntype); if (kfp == NULL) { printf("elf" __XSTRING(__ELF_WORD_SIZE) "_obj_loadfile: can't load module before kernel\n"); @@ -178,7 +176,7 @@ __elfN(obj_loadfile)(char *filename, uint64_t dest, goto out; } fp->f_name = strdup(filename); - fp->f_type = strdup(__elfN(obj_moduletype)); + fp->f_type = strdup(md_modtype_obj); if (module_verbose > MODULE_VERBOSE_SILENT) printf("%s ", filename); diff --git a/stand/common/metadata.c b/stand/common/metadata.c index 8962763061dc..22df6f175791 100644 --- a/stand/common/metadata.c +++ b/stand/common/metadata.c @@ -146,7 +146,7 @@ md_load_dual(char *args, vm_offset_t *modulep, vm_offset_t *dtb, int kern64) #endif kernend = 0; - kfp = file_findfile(NULL, "elf kernel"); + kfp = file_findfile(NULL, md_kerntype); if (kfp == NULL) panic("can't find kernel file"); file_addmetadata(kfp, MODINFOMD_HOWTO, sizeof howto, &howto); diff --git a/stand/common/modinfo.c b/stand/common/modinfo.c index 381bd9dfd719..d00548c91c57 100644 --- a/stand/common/modinfo.c +++ b/stand/common/modinfo.c @@ -109,6 +109,11 @@ #define MOD_ALIGN(l) roundup(l, align) +const char md_modtype[] = MODTYPE; +const char md_kerntype[] = KERNTYPE; +const char md_modtype_obj[] = MODTYPE_OBJ; +const char md_kerntype_mb[] = KERNTYPE_MB; + vm_offset_t md_copymodules(vm_offset_t addr, bool kern64) { diff --git a/stand/common/modinfo.h b/stand/common/modinfo.h index 967367beeeb0..d26129089fb6 100644 --- a/stand/common/modinfo.h +++ b/stand/common/modinfo.h @@ -6,6 +6,11 @@ #ifndef COMMON_MODINFO_H #define COMMON_MODINFO_H +extern const char md_modtype[]; +extern const char md_kerntype[]; +extern const char md_modtype_obj[]; +extern const char md_kerntype_mb[]; + int md_load(char *args, vm_offset_t *modulep, vm_offset_t *dtb); int md_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtb); diff --git a/stand/efi/loader/arch/amd64/multiboot2.c b/stand/efi/loader/arch/amd64/multiboot2.c index d09b01fce1fc..eb7362293406 100644 --- a/stand/efi/loader/arch/amd64/multiboot2.c +++ b/stand/efi/loader/arch/amd64/multiboot2.c @@ -51,6 +51,7 @@ #include "bootstrap.h" #include "multiboot2.h" #include "loader_efi.h" +#include "modinfo.h" extern int elf32_loadfile_raw(char *filename, uint64_t dest, struct preloaded_file **result, int multiboot); @@ -436,7 +437,7 @@ exec(struct preloaded_file *fp) * module 0 module 1 */ - fp = file_findfile(NULL, "elf kernel"); + fp = file_findfile(NULL, md_kerntype); if (fp == NULL) { printf("No FreeBSD kernel provided, aborting\n"); error = EINVAL; @@ -498,7 +499,7 @@ obj_loadfile(char *filename, uint64_t dest, struct preloaded_file **result) int error; /* See if there's a multiboot kernel loaded */ - mfp = file_findfile(NULL, "elf multiboot kernel"); + mfp = file_findfile(NULL, md_kerntype_mb); if (mfp == NULL) return (EFTYPE); @@ -506,14 +507,14 @@ obj_loadfile(char *filename, uint64_t dest, struct preloaded_file **result) * We have a multiboot kernel loaded, see if there's a FreeBSD * kernel loaded also. */ - kfp = file_findfile(NULL, "elf kernel"); + kfp = file_findfile(NULL, md_kerntype); if (kfp == NULL) { /* * No kernel loaded, this must be it. The kernel has to * be loaded as a raw file, it will be processed by * Xen and correctly loaded as an ELF file. */ - rfp = file_loadraw(filename, "elf kernel", 0); + rfp = file_loadraw(filename, md_kerntype, 0); if (rfp == NULL) { printf( "Unable to load %s as a multiboot payload kernel\n", diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c index b7d4070c2ffb..3e74a9228b5e 100644 --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -420,7 +420,7 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs) addr += roundup(dtb_size, PAGE_SIZE); #endif - kfp = file_findfile(NULL, "elf kernel"); + kfp = file_findfile(NULL, md_kerntype); if (kfp == NULL) panic("can't find kernel file"); kernend = 0; /* fill it in later */ diff --git a/stand/i386/libi386/bootinfo32.c b/stand/i386/libi386/bootinfo32.c index df715e547795..37b227b913bd 100644 --- a/stand/i386/libi386/bootinfo32.c +++ b/stand/i386/libi386/bootinfo32.c @@ -129,7 +129,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t /* pad to a page boundary */ addr = roundup(addr, PAGE_SIZE); - kfp = file_findfile(NULL, "elf kernel"); + kfp = file_findfile(NULL, md_kerntype); if (kfp == NULL) panic("can't find kernel file"); kernend = 0; /* fill it in later */ diff --git a/stand/i386/libi386/bootinfo64.c b/stand/i386/libi386/bootinfo64.c index 4731b10325fe..f7181dcd599f 100644 --- a/stand/i386/libi386/bootinfo64.c +++ b/stand/i386/libi386/bootinfo64.c @@ -143,7 +143,7 @@ bi_load64(char *args, vm_offset_t *modulep, /* place the metadata before anything */ module = *modulep = addr; - kfp = file_findfile(NULL, "elf kernel"); + kfp = file_findfile(NULL, md_kerntype); if (kfp == NULL) panic("can't find kernel file"); kernend = 0; /* fill it in later */ diff --git a/stand/i386/libi386/multiboot.c b/stand/i386/libi386/multiboot.c index b69895de9706..e2bd44fe83f5 100644 --- a/stand/i386/libi386/multiboot.c +++ b/stand/i386/libi386/multiboot.c @@ -48,6 +48,7 @@ #include "bootstrap.h" #include "multiboot.h" #include "libi386.h" +#include "modinfo.h" #include #define MULTIBOOT_SUPPORTED_FLAGS \ @@ -256,7 +257,7 @@ multiboot_exec(struct preloaded_file *fp) * module 0 module 1 */ - fp = file_findfile(NULL, "elf kernel"); + fp = file_findfile(NULL, md_kerntype); if (fp == NULL) { printf("No FreeBSD kernel provided, aborting\n"); error = EINVAL; @@ -324,7 +325,7 @@ multiboot_obj_loadfile(char *filename, uint64_t dest, int error, mod_num; /* See if there's a multiboot kernel loaded */ - mfp = file_findfile(NULL, "elf multiboot kernel"); + mfp = file_findfile(NULL, md_kerntype_mb); if (mfp == NULL) return (EFTYPE); @@ -332,14 +333,14 @@ multiboot_obj_loadfile(char *filename, uint64_t dest, * We have a multiboot kernel loaded, see if there's a FreeBSD * kernel loaded also. */ - kfp = file_findfile(NULL, "elf kernel"); + kfp = file_findfile(NULL, md_kerntype); if (kfp == NULL) { /* * No kernel loaded, this must be it. The kernel has to * be loaded as a raw file, it will be processed by * Xen and correctly loaded as an ELF file. */ - rfp = file_loadraw(filename, "elf kernel", 0); + rfp = file_loadraw(filename, md_kerntype, 0); if (rfp == NULL) { printf( "Unable to load %s as a multiboot payload kernel\n", diff --git a/stand/powerpc/ofw/elf_freebsd.c b/stand/powerpc/ofw/elf_freebsd.c index 21ab834f76fa..4d34fa18c5dd 100644 --- a/stand/powerpc/ofw/elf_freebsd.c +++ b/stand/powerpc/ofw/elf_freebsd.c @@ -58,7 +58,7 @@ __elfN(ofw_loadfile)(char *filename, uint64_t dest, * No need to sync the icache for modules: this will * be done by the kernel after relocation. */ - if (!strcmp((*result)->f_type, "elf kernel")) + if (!strcmp((*result)->f_type, md_kerntype)) __syncicache((void *) (*result)->f_addr, (*result)->f_size); #endif return (0); diff --git a/stand/powerpc/ofw/ppc64_elf_freebsd.c b/stand/powerpc/ofw/ppc64_elf_freebsd.c index e0518abe2283..bc68d129f353 100644 --- a/stand/powerpc/ofw/ppc64_elf_freebsd.c +++ b/stand/powerpc/ofw/ppc64_elf_freebsd.c @@ -57,7 +57,7 @@ ppc64_ofw_elf_loadfile(char *filename, uint64_t dest, * No need to sync the icache for modules: this will * be done by the kernel after relocation. */ - if (!strcmp((*result)->f_type, "elf kernel")) + if (!strcmp((*result)->f_type, md_kerntype)) __syncicache((void *) (*result)->f_addr, (*result)->f_size); return (0); } diff --git a/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c b/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c index 291fe6b944fb..e500b862de2e 100644 --- a/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c +++ b/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c @@ -53,7 +53,7 @@ ppc64_uboot_elf_loadfile(char *filename, uint64_t dest, * No need to sync the icache for modules: this will * be done by the kernel after relocation. */ - if (!strcmp((*result)->f_type, "elf kernel")) + if (!strcmp((*result)->f_type, md_kerntype)) __syncicache((void *) (*result)->f_addr, (*result)->f_size); return (0); } diff --git a/stand/uboot/elf_freebsd.c b/stand/uboot/elf_freebsd.c index 6c764d143881..3b1bdc542538 100644 --- a/stand/uboot/elf_freebsd.c +++ b/stand/uboot/elf_freebsd.c @@ -53,7 +53,7 @@ __elfN(uboot_load)(char *filename, uint64_t dest, * No need to sync the icache for modules: this will * be done by the kernel after relocation. */ - if (!strcmp((*result)->f_type, "elf kernel")) + if (!strcmp((*result)->f_type, md_kerntype)) __syncicache((void *) (*result)->f_addr, (*result)->f_size); #endif return (0); diff --git a/stand/userboot/userboot/bootinfo32.c b/stand/userboot/userboot/bootinfo32.c index 91f1f81f1181..750574912172 100644 --- a/stand/userboot/userboot/bootinfo32.c +++ b/stand/userboot/userboot/bootinfo32.c @@ -108,7 +108,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t /* pad to a page boundary */ addr = roundup(addr, PAGE_SIZE); - kfp = file_findfile(NULL, "elf kernel"); + kfp = file_findfile(NULL, md_kerntype); if (kfp == NULL) panic("can't find kernel file"); kernend = 0; /* fill it in later */ diff --git a/stand/userboot/userboot/bootinfo64.c b/stand/userboot/userboot/bootinfo64.c index fb9fd0fb82f1..d20202bf4fbb 100644 --- a/stand/userboot/userboot/bootinfo64.c +++ b/stand/userboot/userboot/bootinfo64.c @@ -140,7 +140,7 @@ bi_load64(char *args, vm_offset_t *modulep, vm_offset_t *kernendp) /* pad to a page boundary */ addr = roundup(addr, PAGE_SIZE); - kfp = file_findfile(NULL, "elf kernel"); + kfp = file_findfile(NULL, md_kerntype); if (kfp == NULL) panic("can't find kernel file"); kernend = 0; /* fill it in later */ From nobody Fri Jan 24 21:43:03 2025 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 4Yfrs35ZKWz5lSN0; Fri, 24 Jan 2025 21:43: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 4Yfrs32S5Nz3lQy; Fri, 24 Jan 2025 21:43:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737754983; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=epzHe+UpRnfMHZDtwg6V6BuXMqcUJaUk5dAJ2n/GnYI=; b=F/litTajukGXxt1Pl3zXdIYGBED31dA7mg6rRsE/wfBDZNhZ1RJ1LaYEHa+k3G8Q+ipqXb kN9SBOb/98dmHCyOT2Qi/XblRDXc7Blv4qhpwbu8TlzpUlyeyXxToMcMzfLRZ9dYA/Np9T FpuiyDn6mIhk2lvMfPctEJa/kbkfhphfRGhaeHlbMh5PsRKms+J4bCjuIxhcd9jNIYyxfK ijWCdTh0HveEXHWNhh6HlBJi0O3I0/oCjQr1PPFLjw9+c431rZtVsaRFEh6mIeG/PZw97x GpGIgS0ysapRJYJBdTC4pk6Z/PoX3gSC56+25+O30nUAEgkr8MebWtk8T5DQbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737754983; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=epzHe+UpRnfMHZDtwg6V6BuXMqcUJaUk5dAJ2n/GnYI=; b=DBdam54MKd7rfJ1jm6cK/UfNe00+hntTf1o/Cctn20GS1zXMgUKYvoBAIVw4PXgKajXkV0 rLjfoIiXjme6vFos59lNdtmoJZ0E2zeMeWXU6Drtr5cDK+26WBA0UZTfrnkX4uDNNoKir/ 6v6G7tWYto3RObny6yZ1lRW+xYIJbfVytb9nlPeKQVkxhslRMnLH4ezuGrKegqY1Pcmsl5 zgsDRRy1+AredyuH2Vn+RVVbbtY+PGGzypr2ZbpdJXMZFRiaAhJvD3els2kkpRw09V+JNI h0YqoZScmzTEPJiihny0GFPugbdjQc+B1dbXKhn3zuvE1ouugacRyMEY46iDYA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737754983; a=rsa-sha256; cv=none; b=YJt3ZYYSj8iktkxGROkYtf8RXuGJFLrf+OXgpMNSiJCZxUs1o7ttibCt/qBAopYNxPbVn7 KcLcX0GDb6FwbBwl7+n59cXWFHvDRiaGgXtyUEIL/jyyDQwF0lYbELktpMxcmviukfeWAo LbrTB697KxC6ubjlW3X8LuX9GCvhsHXKlOeMke2HjewpL4QoHCH1bYGmDbEq49//4WtATP jGfwHeacfHtEpmxGDYNhmISzWLUqe1qQ6pN93KRAoywOl2IDGuWJEqCswmSh6H8fecTkB1 9QU6hY8XNPXPRalwudNXijbX2jROxH5laemSNvpG/QHY/jQgsGo2SRh1pj9SGg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfrs321Q7zjw0; Fri, 24 Jan 2025 21:43: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 50OLh3Hq012743; Fri, 24 Jan 2025 21:43:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50OLh3Kv012740; Fri, 24 Jan 2025 21:43:03 GMT (envelope-from git) Date: Fri, 24 Jan 2025 21:43:03 GMT Message-Id: <202501242143.50OLh3Kv012740@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: b2a49e88d1c6 - main - intpm: use MMIO for AMD EFCH CPUs 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: b2a49e88d1c65ee41279b593fe0d50ce4ec31f75 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b2a49e88d1c65ee41279b593fe0d50ce4ec31f75 commit b2a49e88d1c65ee41279b593fe0d50ce4ec31f75 Author: Brian Poole AuthorDate: 2024-10-07 13:09:35 +0000 Commit: Warner Losh CommitDate: 2025-01-24 21:42:40 +0000 intpm: use MMIO for AMD EFCH CPUs Recent AMD CPUs (SMBus PCI revision ID >= 0x51) can disable port-mapped IO and only support memory-mapped IO. In practice this was observed on a Zen 3 CPU where PMIO reads all returned 0xff. Update the driver to use MMIO for these processors while continuing to use PMIO by default. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1437 --- sys/dev/amdsbwd/amd_chipset.h | 2 ++ sys/dev/intpm/intpm.c | 44 ++++++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/sys/dev/amdsbwd/amd_chipset.h b/sys/dev/amdsbwd/amd_chipset.h index 1bc637a30845..44db7b3168d0 100644 --- a/sys/dev/amdsbwd/amd_chipset.h +++ b/sys/dev/amdsbwd/amd_chipset.h @@ -123,6 +123,7 @@ */ #define AMDFCH41_WDT_FIXED_ADDR 0xfeb00000u #define AMDFCH41_MMIO_ADDR 0xfed80000u +#define AMDFCH41_MMIO_PM_OFF 0x0300 #define AMDFCH41_MMIO_SMBUS_OFF 0x0a00 #define AMDFCH41_MMIO_WDT_OFF 0x0b00 @@ -143,5 +144,6 @@ #define AMDFCH41_SMBUS_REVID 0x41 #define AMDCZ_SMBUS_DEVID 0x790b1022 #define AMDCZ49_SMBUS_REVID 0x49 +#define AMDCZ51_SMBUS_REVID 0x51 #define HYGONCZ_SMBUS_DEVID 0x790b1d94 diff --git a/sys/dev/intpm/intpm.c b/sys/dev/intpm/intpm.c index 3aa76ff48263..2f12e0dcf49b 100644 --- a/sys/dev/intpm/intpm.c +++ b/sys/dev/intpm/intpm.c @@ -55,6 +55,7 @@ struct intsmb_softc { int cfg_irq9; int sb8xx; int poll; + int type; struct mtx lock; }; @@ -135,28 +136,44 @@ sb8xx_attach(device_t dev) struct resource *res; uint32_t devid; uint8_t revid; - uint16_t addr; + uint32_t addr; int rid; int rc; bool enabled; sc = device_get_softc(dev); + devid = pci_get_devid(dev); + revid = pci_get_revid(dev); + + /* + * Comment from Linux i2c-piix4.c: + * + * cd6h/cd7h port I/O accesses can be disabled on AMD processors + * w/ SMBus PCI revision ID 0x51 or greater. MMIO is supported on + * the same processors and is the recommended access method. + */ + if (devid == AMDCZ_SMBUS_DEVID && revid >= AMDCZ51_SMBUS_REVID) { + sc->type = SYS_RES_MEMORY; + addr = AMDFCH41_MMIO_ADDR + AMDFCH41_MMIO_PM_OFF; + } else { + sc->type = SYS_RES_IOPORT; + addr = AMDSB_PMIO_INDEX; + } + rid = 0; - rc = bus_set_resource(dev, SYS_RES_IOPORT, rid, AMDSB_PMIO_INDEX, + rc = bus_set_resource(dev, sc->type, rid, addr, AMDSB_PMIO_WIDTH); if (rc != 0) { device_printf(dev, "bus_set_resource for PM IO failed\n"); return (ENXIO); } - res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, + res = bus_alloc_resource_any(dev, sc->type, &rid, RF_ACTIVE); if (res == NULL) { device_printf(dev, "bus_alloc_resource for PM IO failed\n"); return (ENXIO); } - devid = pci_get_devid(dev); - revid = pci_get_revid(dev); if (devid == AMDSB_SMBUS_DEVID || (devid == AMDFCH_SMBUS_DEVID && revid < AMDFCH41_SMBUS_REVID) || (devid == AMDCZ_SMBUS_DEVID && revid < AMDCZ49_SMBUS_REVID)) { @@ -165,6 +182,10 @@ sb8xx_attach(device_t dev) addr |= amd_pmio_read(res, AMDSB8_PM_SMBUS_EN); enabled = (addr & AMDSB8_SMBUS_EN) != 0; addr &= AMDSB8_SMBUS_ADDR_MASK; + } else if (devid == AMDCZ_SMBUS_DEVID && revid >= AMDCZ51_SMBUS_REVID) { + addr = bus_read_1(res, AMDFCH41_PM_DECODE_EN0); + enabled = (addr & AMDFCH41_SMBUS_EN) != 0; + addr = AMDFCH41_MMIO_ADDR + AMDFCH41_MMIO_SMBUS_OFF; } else { addr = amd_pmio_read(res, AMDFCH41_PM_DECODE_EN0); enabled = (addr & AMDFCH41_SMBUS_EN) != 0; @@ -172,8 +193,8 @@ sb8xx_attach(device_t dev) addr <<= 8; } - bus_release_resource(dev, SYS_RES_IOPORT, rid, res); - bus_delete_resource(dev, SYS_RES_IOPORT, rid); + bus_release_resource(dev, sc->type, rid, res); + bus_delete_resource(dev, sc->type, rid); if (!enabled) { device_printf(dev, "SB8xx/SB9xx/FCH SMBus not enabled\n"); @@ -181,13 +202,13 @@ sb8xx_attach(device_t dev) } sc->io_rid = 0; - rc = bus_set_resource(dev, SYS_RES_IOPORT, sc->io_rid, addr, + rc = bus_set_resource(dev, sc->type, sc->io_rid, addr, AMDSB_SMBIO_WIDTH); if (rc != 0) { device_printf(dev, "bus_set_resource for SMBus IO failed\n"); return (ENXIO); } - sc->io_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &sc->io_rid, + sc->io_res = bus_alloc_resource_any(dev, sc->type, &sc->io_rid, RF_ACTIVE); if (sc->io_res == NULL) { device_printf(dev, "Could not allocate I/O space\n"); @@ -208,7 +229,7 @@ intsmb_release_resources(device_t dev) if (sc->irq_res) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); if (sc->io_res) - bus_release_resource(dev, SYS_RES_IOPORT, sc->io_rid, + bus_release_resource(dev, sc->type, sc->io_rid, sc->io_res); mtx_destroy(&sc->lock); } @@ -226,6 +247,7 @@ intsmb_attach(device_t dev) mtx_init(&sc->lock, device_get_nameunit(dev), "intsmb", MTX_DEF); sc->cfg_irq9 = 0; + sc->type = SYS_RES_IOPORT; switch (pci_get_devid(dev)) { #ifndef NO_CHANGE_PCICONF case 0x71138086: /* Intel 82371AB */ @@ -254,7 +276,7 @@ intsmb_attach(device_t dev) } sc->io_rid = PCI_BASE_ADDR_SMB; - sc->io_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &sc->io_rid, + sc->io_res = bus_alloc_resource_any(dev, sc->type, &sc->io_rid, RF_ACTIVE); if (sc->io_res == NULL) { device_printf(dev, "Could not allocate I/O space\n"); From nobody Fri Jan 24 21:53:57 2025 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 4Yfs5w2fZGz5lSk4 for ; Fri, 24 Jan 2025 21:54:12 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 4Yfs5w0vfrz3mbP for ; Fri, 24 Jan 2025 21:54:12 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-38789e5b6a7so1469477f8f.1 for ; Fri, 24 Jan 2025 13:54:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737755650; x=1738360450; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+atPXhcjdb+wiLPqosVItcbvpbpO5RxaV2onX1zPZMU=; b=boUXZlQuwavEBp4tv5U9TCYlQSslF5mJXD0MkkYuKcH85pu0XdISN57mSEUDizaxGK 4RuxDau0QxSHc46ZQbqk6vyDslinO2Ow6JC+McB88+0cmubGb7W0Pw6Viua3U/dAurDF unkXT0z2SWXfNePY7qrCBO0U0YFny+Xaxo5wMp9AzNIgsA10ZHoMnek9261G9jYeWWSm J36TBTQCv0oBB2kC3+XD/1Jhz6XBz8vAJEvpTgAxkWpLQZPanSCLVsiNC9LYYnjqoZbc B25gu/u4nYexl4KkTtWKuL1OsapM1Z3FmcbZJ4ga8RpMTFK1iqH6RiHHcs/cb+QvorV9 uxBg== X-Forwarded-Encrypted: i=1; AJvYcCWk67eeHlGmkCm6YZYCQJ49FTD9jy09C9pieRKJGekiYcYL4p250BKOkLqN0jayrG7s8g8D0XrVE65I6pJGelBYgNmaHg==@freebsd.org X-Gm-Message-State: AOJu0YxSUS1VKjAdJfYp84f6+oQlc++uZ9VFPgGRKQvB1OvaVuka868e ZWz4pEreTMpgjbZqkzIB7fCnyHLRUqCQdifx0WzNhLZJibaSb72sVkgHcOmAgIE= X-Gm-Gg: ASbGncuiThis8q6a29mQjip40b3iSkfcOTGJN7N6/xkRBYLXx7n986fcYp4cL0QC3UY wnVcFwy3T9hynbdOT60/7+s+Pzg1HfEMrjphyN4Gw9lPnRzyVbavLxKcOwNZFwBHTZd1bAXI8/i ExIoqOut5pFK+anCvHbMd/EkRlNmo+A/GcctubQXBAZIwqJ1Hv/rnU1SfsAkw8O8NPfWyL7QyMN rxF3G0SVQ9wImvZfetVILKd/kTQfI6doJclUlx23+nUPtRTwqEGlm4ABm5itHihM4eAFdJVLr5Z ZLBUmLHISSagIkpGWK1nVwc78ivoqg== X-Google-Smtp-Source: AGHT+IH2K2BTVALY2EBj5DUGShHoBclCbPlKKfietiKmkSNyyi17/FYJYxoE0I5H7nIgMepTqUa9aw== X-Received: by 2002:adf:e005:0:b0:38a:41f8:8abf with SMTP id ffacd0b85a97d-38bf566d296mr21829301f8f.31.1737755649484; Fri, 24 Jan 2025 13:54:09 -0800 (PST) Received: from smtpclient.apple ([131.111.5.201]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a176449sm3892529f8f.11.2025.01.24.13.54.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jan 2025 13:54:08 -0800 (PST) Content-Type: text/plain; charset=utf-8 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 (Mac OS X Mail 16.0 \(3826.300.87.4.3\)) Subject: Re: git: 4d213c595ac3 - main - sys: use globals for the ELF kernel and module type strings From: Jessica Clarke In-Reply-To: <202501242137.50OLbEur094850@gitrepo.freebsd.org> Date: Fri, 24 Jan 2025 21:53:57 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <5156861D-A6F2-4CB2-A0CD-C8568D3A6A6A@freebsd.org> References: <202501242137.50OLbEur094850@gitrepo.freebsd.org> To: Warner Losh X-Mailer: Apple Mail (2.3826.300.87.4.3) X-Rspamd-Queue-Id: 4Yfs5w0vfrz3mbP 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:15169, ipnet:209.85.128.0/17, country:US] On 24 Jan 2025, at 21:37, Warner Losh wrote: >=20 > The branch main has been updated by imp: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D4d213c595ac3247a85cea5d3ea521db1= 4151a427 >=20 > commit 4d213c595ac3247a85cea5d3ea521db14151a427 > Author: Ahmad Khalifa > AuthorDate: 2024-08-24 15:12:52 +0000 > Commit: Warner Losh > CommitDate: 2025-01-24 21:29:39 +0000 >=20 > sys: use globals for the ELF kernel and module type strings Why do we need the globals rather than just using the macros? String literals, via the macros, have the advantage that they can be merged by the linker, whereas initialising a global requires allocating a non-overlapping object for it. I see kib@ argued for doing this, but the justification is flawed. Unless you explicitly pass -O0 to the linker, string literals are at least as efficient as named globals. The only advantages of the named global are: (a) guaranteeing only one copy of the string exists (i.e. for when you require address equality), but any worthwhile linker will perform that optimisation for SHF_MERGE sections anyway so if it=E2=80=99s just for optimisation then that=E2=80=99s not worthwhile (b) guaranteeing the address is unique compared with other unrelated instances of the string The downside is it cannot be merged with other strings (and in some cases you can end up with less efficient code due to symbol preemption, though that=E2=80=99s not true here). That is, if you have: foo("more than a short string", "a short string"); then the string literals can, and with ld.lld -O2 (I believe the default in GNU ld; LLD defaults to -O1 which only merges identical strings) will, be combined such that the second is a pointer to the tail substring of the first. So I don=E2=80=99t see a good reason for using explicit globals here. = Using the macros directly should be just as performant whilst being simpler and shorter. Jess > Initialize the globals with macros so we can use the same values in = the > loader. >=20 > Also remove unnecessary "elfN module" checks. >=20 > Reviewed by: imp, kib > Pull Request: https://github.com/freebsd/freebsd-src/pull/1394 > --- > sys/arm/arm/machdep_boot.c | 8 ++++---- > sys/arm64/arm64/machdep_boot.c | 2 +- > sys/kern/link_elf.c | 4 +--- > sys/kern/link_elf_obj.c | 5 +---- > sys/kern/subr_module.c | 6 +++++- > sys/powerpc/powerpc/machdep.c | 9 ++++----- > sys/riscv/riscv/machdep.c | 2 +- > sys/sys/linker.h | 11 +++++++++++ > 8 files changed, 28 insertions(+), 19 deletions(-) >=20 > diff --git a/sys/arm/arm/machdep_boot.c b/sys/arm/arm/machdep_boot.c > index 534d34acabe2..e2416f86ad23 100644 > --- a/sys/arm/arm/machdep_boot.c > +++ b/sys/arm/arm/machdep_boot.c > @@ -356,12 +356,12 @@ fake_preload_metadata(struct arm_boot_params = *abp __unused, void *dtb_ptr, >=20 > fake_preload[i++] =3D MODINFO_NAME; > fake_preload[i++] =3D strlen("kernel") + 1; > - strcpy((char*)&fake_preload[i++], "kernel"); > + strcpy((char *)&fake_preload[i++], "kernel"); > i +=3D 1; > fake_preload[i++] =3D MODINFO_TYPE; > - fake_preload[i++] =3D strlen("elf kernel") + 1; > - strcpy((char*)&fake_preload[i++], "elf kernel"); > - i +=3D 2; > + fake_preload[i++] =3D strlen(preload_kerntype) + 1; > + strcpy((char *)&fake_preload[i], preload_kerntype); > + i +=3D howmany(fake_preload[i - 1], sizeof(uint32_t)); > fake_preload[i++] =3D MODINFO_ADDR; > fake_preload[i++] =3D sizeof(vm_offset_t); > fake_preload[i++] =3D KERNVIRTADDR; > diff --git a/sys/arm64/arm64/machdep_boot.c = b/sys/arm64/arm64/machdep_boot.c > index 029ae23530ff..83bd74ea7317 100644 > --- a/sys/arm64/arm64/machdep_boot.c > +++ b/sys/arm64/arm64/machdep_boot.c > @@ -98,7 +98,7 @@ fake_preload_metadata(void *dtb_ptr, size_t = dtb_size) > PRELOAD_PUSH_STRING("kernel"); >=20 > PRELOAD_PUSH_VALUE(uint32_t, MODINFO_TYPE); > - PRELOAD_PUSH_STRING("elf kernel"); > + PRELOAD_PUSH_STRING(preload_kerntype); >=20 > PRELOAD_PUSH_VALUE(uint32_t, MODINFO_ADDR); > PRELOAD_PUSH_VALUE(uint32_t, sizeof(vm_offset_t)); > diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c > index 23a924636ca2..53af1e164980 100644 > --- a/sys/kern/link_elf.c > +++ b/sys/kern/link_elf.c > @@ -895,9 +895,7 @@ link_elf_link_preload(linker_class_t cls, const = char *filename, > sizeptr =3D preload_search_info(modptr, MODINFO_SIZE); > dynptr =3D preload_search_info(modptr, > MODINFO_METADATA | MODINFOMD_DYNAMIC); > - if (type =3D=3D NULL || > - (strcmp(type, "elf" __XSTRING(__ELF_WORD_SIZE) " module") !=3D 0 = && > - strcmp(type, "elf module") !=3D 0)) > + if (type =3D=3D NULL || strcmp(type, preload_modtype) !=3D 0) > return (EFTYPE); > if (baseptr =3D=3D NULL || sizeptr =3D=3D NULL || dynptr =3D=3D NULL) > return (EINVAL); > diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c > index a7c7d4826322..02fd4caffcd9 100644 > --- a/sys/kern/link_elf_obj.c > +++ b/sys/kern/link_elf_obj.c > @@ -365,11 +365,8 @@ link_elf_link_preload(linker_class_t cls, const = char *filename, > MODINFOMD_ELFHDR); > shdr =3D (Elf_Shdr *)preload_search_info(modptr, MODINFO_METADATA | > MODINFOMD_SHDR); > - if (type =3D=3D NULL || (strcmp(type, "elf" = __XSTRING(__ELF_WORD_SIZE) > - " obj module") !=3D 0 && > - strcmp(type, "elf obj module") !=3D 0)) { > + if (type =3D=3D NULL || strcmp(type, preload_modtype_obj) !=3D 0) > return (EFTYPE); > - } > if (baseptr =3D=3D NULL || sizeptr =3D=3D NULL || hdr =3D=3D NULL || > shdr =3D=3D NULL) > return (EINVAL); > diff --git a/sys/kern/subr_module.c b/sys/kern/subr_module.c > index 14272bd913f8..596961606577 100644 > --- a/sys/kern/subr_module.c > +++ b/sys/kern/subr_module.c > @@ -46,10 +46,14 @@ > vm_offset_t preload_addr_relocate =3D 0; > caddr_t preload_metadata, preload_kmdp; >=20 > +const char preload_modtype[] =3D MODTYPE; > +const char preload_kerntype[] =3D KERNTYPE; > +const char preload_modtype_obj[] =3D MODTYPE_OBJ; > + > void > preload_initkmdp(bool fatal) > { > - preload_kmdp =3D preload_search_by_type("elf kernel"); > + preload_kmdp =3D preload_search_by_type(preload_kerntype); >=20 > if (preload_kmdp =3D=3D NULL && fatal) > panic("unable to find kernel metadata"); > diff --git a/sys/powerpc/powerpc/machdep.c = b/sys/powerpc/powerpc/machdep.c > index 96f3b292854d..e9979712aa9c 100644 > --- a/sys/powerpc/powerpc/machdep.c > +++ b/sys/powerpc/powerpc/machdep.c > @@ -644,15 +644,14 @@ fake_preload_metadata(void) { >=20 > fake_preload[i++] =3D MODINFO_NAME; > fake_preload[i++] =3D strlen("kernel") + 1; > - strcpy((char*)&fake_preload[i], "kernel"); > + strcpy((char *)&fake_preload[i], "kernel"); > /* ['k' 'e' 'r' 'n'] ['e' 'l' '\0' ..] */ > i +=3D 2; >=20 > fake_preload[i++] =3D MODINFO_TYPE; > - fake_preload[i++] =3D strlen("elf kernel") + 1; > - strcpy((char*)&fake_preload[i], "elf kernel"); > - /* ['e' 'l' 'f' ' '] ['k' 'e' 'r' 'n'] ['e' 'l' '\0' ..] */ > - i +=3D 3; > + fake_preload[i++] =3D strlen(preload_kerntype) + 1; > + strcpy((char *)&fake_preload[i], preload_kerntype); > + i +=3D howmany(fake_preload[i - 1], sizeof(uint32_t)); >=20 > #ifdef __powerpc64__ > /* Padding -- Fields start on u_long boundaries */ > diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c > index a17cff55f2cc..8d32d348df7d 100644 > --- a/sys/riscv/riscv/machdep.c > +++ b/sys/riscv/riscv/machdep.c > @@ -365,7 +365,7 @@ fake_preload_metadata(struct riscv_bootparams = *rvbp) > PRELOAD_PUSH_VALUE(uint32_t, MODINFO_NAME); > PRELOAD_PUSH_STRING("kernel"); > PRELOAD_PUSH_VALUE(uint32_t, MODINFO_TYPE); > - PRELOAD_PUSH_STRING("elf kernel"); > + PRELOAD_PUSH_STRING(preload_kerntype); >=20 > PRELOAD_PUSH_VALUE(uint32_t, MODINFO_ADDR); > PRELOAD_PUSH_VALUE(uint32_t, sizeof(vm_offset_t)); > diff --git a/sys/sys/linker.h b/sys/sys/linker.h > index 77dd437c7ffe..85c50be6c969 100644 > --- a/sys/sys/linker.h > +++ b/sys/sys/linker.h > @@ -220,6 +220,14 @@ void linker_kldload_unbusy(int flags); >=20 > #endif /* _KERNEL */ >=20 > +/* > + * ELF file types > + */ > +#define KERNTYPE_MB "elf multiboot kernel" > +#define KERNTYPE "elf kernel" > +#define MODTYPE_OBJ "elf obj module" > +#define MODTYPE "elf module" > + > /* > * Module information subtypes > */ > @@ -273,6 +281,9 @@ void linker_kldload_unbusy(int flags); > */ > extern vm_offset_t preload_addr_relocate; > extern caddr_t preload_metadata, preload_kmdp; > +extern const char preload_modtype[]; > +extern const char preload_kerntype[]; > +extern const char preload_modtype_obj[]; >=20 > extern void * preload_fetch_addr(caddr_t _mod); > extern size_t preload_fetch_size(caddr_t _mod); From nobody Fri Jan 24 21:54:58 2025 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 4Yfs746hnGz5lSkB for ; Fri, 24 Jan 2025 21:55:12 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 4Yfs744vmhz3mnZ for ; Fri, 24 Jan 2025 21:55:12 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-38a8b35e168so1760617f8f.1 for ; Fri, 24 Jan 2025 13:55:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737755711; x=1738360511; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KSuAQqOOl9206rGQ8LlCKeEAze2DIjInBoerxos+6Uk=; b=m/l1moYLZ2UXbeVZ6IqEuUEuylnnisABYndPxRxO15fB7ljpDa+vp8FXDuweYtXkEs pDcGiQOPvd7flGmLaAnT7UwdNni8JTA6CWLobFuFEiR/PslAbkwAasigfBB64uAeEXhh WRpX4VoHqRDfUVMrZ3WkWfDShECE9tPmuAkHgCq0ChkL+CL8cTSkdrEh84ZeqRNkYWMp sVoSwJ7BnWUXU5bso+N1m9E72nG64Y6JeXr/Qg5S5kQbtKTRy5YQC67KqivR35Mfs0Rj pnt41Svx63tJRA3+6ueGLmSLNb/SmBNc9PiMQKvZbKSE7Qfe+dsypZ9qM6Z1WAz45xkN 3koQ== X-Forwarded-Encrypted: i=1; AJvYcCVXyRKaQ7hUMw7YcFd9MwlvezY/bmMUEzX1qfnEpDw6R+qHcvPqGWaNEmPUrq5Uz7b5tBJL99J/XKt6EDNTXF6DlWhATw==@freebsd.org X-Gm-Message-State: AOJu0YzImwox3II38vczkYpwAmCgMTkNSUFT6gZFzZHoj4ACGjQx6thH +8uPFkIeSjLjJrz3NfQpdo5lul4kkbJS8LkDoPuALOCeEXN7GFR7/ZOpFPvL5WU= X-Gm-Gg: ASbGncu1iIZiekJ1C6bgobFNQRE0FYZ5qvMxBJDkdihVc0sR50g4b834GlsnGo4iHB4 XmwSQwCsYGKE2VTkBhi2uQ1wxMG+DDS9+V+VdfeqAEeSRk1FACk++mr2btaVVu9VnrrVSZ+yAcv 95hSPOJTvDfMvGv9PwnD0389HKsvVBv5ROF4IhvTWX+Mc6qI/SJPgO/sOLNVyNSgjUsUDzF+VQ0 UnwQT7yc/Ngj44rnwIzgwMNbnkfgZikO29RZ5R6Fp6bejqb3p3TKDmYytFnaXqdAyAS3fMEEThG KH/pVqzQcDpXsfiM4DM= X-Google-Smtp-Source: AGHT+IHuttRPMKDmwTGcGIUuvmlGFz1ROYnk34oNssmkYg7cjBLa/pU9b8cpKjDZl8L+AbhV9/iS2Q== X-Received: by 2002:a05:6000:ecd:b0:38a:888c:a635 with SMTP id ffacd0b85a97d-38c2227545emr7660908f8f.14.1737755711121; Fri, 24 Jan 2025 13:55:11 -0800 (PST) Received: from smtpclient.apple ([131.111.5.201]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a176449sm3892529f8f.11.2025.01.24.13.55.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jan 2025 13:55:09 -0800 (PST) Content-Type: text/plain; charset=us-ascii 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 (Mac OS X Mail 16.0 \(3826.300.87.4.3\)) Subject: Re: git: 86077f4fd110 - main - stand: use globals for the kernel and module types From: Jessica Clarke In-Reply-To: <202501242137.50OLbHWK094915@gitrepo.freebsd.org> Date: Fri, 24 Jan 2025 21:54:58 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <4ED8708B-32AF-4D7D-B1DC-6D790FB586C4@freebsd.org> References: <202501242137.50OLbHWK094915@gitrepo.freebsd.org> To: Warner Losh X-Mailer: Apple Mail (2.3826.300.87.4.3) X-Rspamd-Queue-Id: 4Yfs744vmhz3mnZ 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:15169, ipnet:209.85.128.0/17, country:US] On 24 Jan 2025, at 21:37, Warner Losh wrote: >=20 > The branch main has been updated by imp: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D86077f4fd11070518a6d04eee7fdb93c= bbfb1b52 >=20 > commit 86077f4fd11070518a6d04eee7fdb93cbbfb1b52 > Author: Ahmad Khalifa > AuthorDate: 2024-08-24 15:16:09 +0000 > Commit: Warner Losh > CommitDate: 2025-01-24 21:29:39 +0000 >=20 > stand: use globals for the kernel and module types As with the kernel, please just use the macros directly. Jess > Reviewed by: imp, kib > Pull Request: https://github.com/freebsd/freebsd-src/pull/1394 > --- > stand/common/gfx_fb.c | 6 ++++-- > stand/common/load_elf.c | 12 +++++------- > stand/common/load_elf_obj.c | 8 +++----- > stand/common/metadata.c | 2 +- > stand/common/modinfo.c | 5 +++++ > stand/common/modinfo.h | 5 +++++ > stand/efi/loader/arch/amd64/multiboot2.c | 9 +++++---- > stand/efi/loader/bootinfo.c | 2 +- > stand/i386/libi386/bootinfo32.c | 2 +- > stand/i386/libi386/bootinfo64.c | 2 +- > stand/i386/libi386/multiboot.c | 9 +++++---- > stand/powerpc/ofw/elf_freebsd.c | 2 +- > stand/powerpc/ofw/ppc64_elf_freebsd.c | 2 +- > stand/uboot/arch/powerpc/ppc64_elf_freebsd.c | 2 +- > stand/uboot/elf_freebsd.c | 2 +- > stand/userboot/userboot/bootinfo32.c | 2 +- > stand/userboot/userboot/bootinfo64.c | 2 +- > 17 files changed, 42 insertions(+), 32 deletions(-) >=20 > diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c > index 9bda0e7139a9..63036f3c07f6 100644 > --- a/stand/common/gfx_fb.c > +++ b/stand/common/gfx_fb.c > @@ -102,6 +102,8 @@ > #include > #endif >=20 > +#include "modinfo.h" > + > /* VGA text mode does use bold font. */ > #if !defined(VGA_8X16_FONT) > #define VGA_8X16_FONT "/boot/fonts/8x16b.fnt" > @@ -2982,7 +2984,7 @@ build_font_module(vm_offset_t addr) >=20 > fi.fi_checksum =3D -checksum; >=20 > - fp =3D file_findfile(NULL, "elf kernel"); > + fp =3D file_findfile(NULL, md_kerntype); > if (fp =3D=3D NULL) > panic("can't find kernel file"); >=20 > @@ -3024,7 +3026,7 @@ build_splash_module(vm_offset_t addr) > return (addr); > } >=20 > - fp =3D file_findfile(NULL, "elf kernel"); > + fp =3D file_findfile(NULL, md_kerntype); > if (fp =3D=3D NULL) > panic("can't find kernel file"); >=20 > diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c > index d3775b9f0017..e19aefa121e7 100644 > --- a/stand/common/load_elf.c > +++ b/stand/common/load_elf.c > @@ -37,6 +37,7 @@ > #include >=20 > #include "bootstrap.h" > +#include "modinfo.h" >=20 > #define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l) >=20 > @@ -89,9 +90,6 @@ static int __elfN(parse_modmetadata)(struct = preloaded_file *mp, elf_file_t ef, > static symaddr_fn __elfN(symaddr); > static char *fake_modname(const char *name); >=20 > -const char *__elfN(kerneltype) =3D "elf kernel"; > -const char *__elfN(moduletype) =3D "elf module"; > - > uint64_t __elfN(relocation_offset) =3D 0; >=20 > #ifdef __powerpc__ > @@ -384,7 +382,7 @@ __elfN(loadfile_raw)(char *filename, uint64_t = dest, > /* > * Check to see what sort of module we are. > */ > - kfp =3D file_findfile(NULL, __elfN(kerneltype)); > + kfp =3D file_findfile(NULL, md_kerntype); > #ifdef __powerpc__ > /* > * Kernels can be ET_DYN, so just assume the first loaded object is the > @@ -435,7 +433,7 @@ __elfN(loadfile_raw)(char *filename, uint64_t = dest, > err =3D EPERM; > goto oerr; > } > - if (strcmp(__elfN(kerneltype), kfp->f_type)) { > + if (strcmp(md_kerntype, kfp->f_type)) { > printf("elf" __XSTRING(__ELF_WORD_SIZE) > "_loadfile: can't load module with kernel type '%s'\n", > kfp->f_type); > @@ -470,9 +468,9 @@ __elfN(loadfile_raw)(char *filename, uint64_t = dest, > fp->f_name =3D strdup(filename); > if (multiboot =3D=3D 0) > fp->f_type =3D strdup(ef.kernel ? > - __elfN(kerneltype) : __elfN(moduletype)); > + md_kerntype : md_modtype); > else > - fp->f_type =3D strdup("elf multiboot kernel"); > + fp->f_type =3D strdup(md_kerntype_mb); >=20 > if (module_verbose >=3D MODULE_VERBOSE_FULL) { > if (ef.kernel) > diff --git a/stand/common/load_elf_obj.c b/stand/common/load_elf_obj.c > index 9ff1d238b8c8..1e07828dd8ac 100644 > --- a/stand/common/load_elf_obj.c > +++ b/stand/common/load_elf_obj.c > @@ -37,6 +37,7 @@ > #include >=20 > #include "bootstrap.h" > +#include "modinfo.h" >=20 > #define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l) >=20 > @@ -77,9 +78,6 @@ static int __elfN(obj_parse_modmetadata)(struct = preloaded_file *mp, > elf_file_t ef); > static Elf_Addr __elfN(obj_symaddr)(struct elf_file *ef, Elf_Size = symidx); >=20 > -const char *__elfN(obj_kerneltype) =3D "elf kernel"; > -const char *__elfN(obj_moduletype) =3D "elf obj module"; > - > /* > * Attempt to load the file (file) as an ELF module. It will be = stored at > * (dest), and a pointer to a module structure describing the loaded = object > @@ -154,7 +152,7 @@ __elfN(obj_loadfile)(char *filename, uint64_t = dest, > } > #endif >=20 > - kfp =3D file_findfile(NULL, __elfN(obj_kerneltype)); > + kfp =3D file_findfile(NULL, md_kerntype); > if (kfp =3D=3D NULL) { > printf("elf" __XSTRING(__ELF_WORD_SIZE) > "_obj_loadfile: can't load module before kernel\n"); > @@ -178,7 +176,7 @@ __elfN(obj_loadfile)(char *filename, uint64_t = dest, > goto out; > } > fp->f_name =3D strdup(filename); > - fp->f_type =3D strdup(__elfN(obj_moduletype)); > + fp->f_type =3D strdup(md_modtype_obj); >=20 > if (module_verbose > MODULE_VERBOSE_SILENT) > printf("%s ", filename); > diff --git a/stand/common/metadata.c b/stand/common/metadata.c > index 8962763061dc..22df6f175791 100644 > --- a/stand/common/metadata.c > +++ b/stand/common/metadata.c > @@ -146,7 +146,7 @@ md_load_dual(char *args, vm_offset_t *modulep, = vm_offset_t *dtb, int kern64) > #endif >=20 > kernend =3D 0; > - kfp =3D file_findfile(NULL, "elf kernel"); > + kfp =3D file_findfile(NULL, md_kerntype); > if (kfp =3D=3D NULL) > panic("can't find kernel file"); > file_addmetadata(kfp, MODINFOMD_HOWTO, sizeof howto, &howto); > diff --git a/stand/common/modinfo.c b/stand/common/modinfo.c > index 381bd9dfd719..d00548c91c57 100644 > --- a/stand/common/modinfo.c > +++ b/stand/common/modinfo.c > @@ -109,6 +109,11 @@ >=20 > #define MOD_ALIGN(l) roundup(l, align) >=20 > +const char md_modtype[] =3D MODTYPE; > +const char md_kerntype[] =3D KERNTYPE; > +const char md_modtype_obj[] =3D MODTYPE_OBJ; > +const char md_kerntype_mb[] =3D KERNTYPE_MB; > + > vm_offset_t > md_copymodules(vm_offset_t addr, bool kern64) > { > diff --git a/stand/common/modinfo.h b/stand/common/modinfo.h > index 967367beeeb0..d26129089fb6 100644 > --- a/stand/common/modinfo.h > +++ b/stand/common/modinfo.h > @@ -6,6 +6,11 @@ > #ifndef COMMON_MODINFO_H > #define COMMON_MODINFO_H >=20 > +extern const char md_modtype[]; > +extern const char md_kerntype[]; > +extern const char md_modtype_obj[]; > +extern const char md_kerntype_mb[]; > + > int md_load(char *args, vm_offset_t *modulep, vm_offset_t *dtb); > int md_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtb); >=20 > diff --git a/stand/efi/loader/arch/amd64/multiboot2.c = b/stand/efi/loader/arch/amd64/multiboot2.c > index d09b01fce1fc..eb7362293406 100644 > --- a/stand/efi/loader/arch/amd64/multiboot2.c > +++ b/stand/efi/loader/arch/amd64/multiboot2.c > @@ -51,6 +51,7 @@ > #include "bootstrap.h" > #include "multiboot2.h" > #include "loader_efi.h" > +#include "modinfo.h" >=20 > extern int elf32_loadfile_raw(char *filename, uint64_t dest, > struct preloaded_file **result, int multiboot); > @@ -436,7 +437,7 @@ exec(struct preloaded_file *fp) > * module 0 module 1 > */ >=20 > - fp =3D file_findfile(NULL, "elf kernel"); > + fp =3D file_findfile(NULL, md_kerntype); > if (fp =3D=3D NULL) { > printf("No FreeBSD kernel provided, aborting\n"); > error =3D EINVAL; > @@ -498,7 +499,7 @@ obj_loadfile(char *filename, uint64_t dest, struct = preloaded_file **result) > int error; >=20 > /* See if there's a multiboot kernel loaded */ > - mfp =3D file_findfile(NULL, "elf multiboot kernel"); > + mfp =3D file_findfile(NULL, md_kerntype_mb); > if (mfp =3D=3D NULL) > return (EFTYPE); >=20 > @@ -506,14 +507,14 @@ obj_loadfile(char *filename, uint64_t dest, = struct preloaded_file **result) > * We have a multiboot kernel loaded, see if there's a FreeBSD > * kernel loaded also. > */ > - kfp =3D file_findfile(NULL, "elf kernel"); > + kfp =3D file_findfile(NULL, md_kerntype); > if (kfp =3D=3D NULL) { > /* > * No kernel loaded, this must be it. The kernel has to > * be loaded as a raw file, it will be processed by > * Xen and correctly loaded as an ELF file. > */ > - rfp =3D file_loadraw(filename, "elf kernel", 0); > + rfp =3D file_loadraw(filename, md_kerntype, 0); > if (rfp =3D=3D NULL) { > printf( > "Unable to load %s as a multiboot payload kernel\n", > diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c > index b7d4070c2ffb..3e74a9228b5e 100644 > --- a/stand/efi/loader/bootinfo.c > +++ b/stand/efi/loader/bootinfo.c > @@ -420,7 +420,7 @@ bi_load(char *args, vm_offset_t *modulep, = vm_offset_t *kernendp, bool exit_bs) > addr +=3D roundup(dtb_size, PAGE_SIZE); > #endif >=20 > - kfp =3D file_findfile(NULL, "elf kernel"); > + kfp =3D file_findfile(NULL, md_kerntype); > if (kfp =3D=3D NULL) > panic("can't find kernel file"); > kernend =3D 0; /* fill it in later */ > diff --git a/stand/i386/libi386/bootinfo32.c = b/stand/i386/libi386/bootinfo32.c > index df715e547795..37b227b913bd 100644 > --- a/stand/i386/libi386/bootinfo32.c > +++ b/stand/i386/libi386/bootinfo32.c > @@ -129,7 +129,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, = vm_offset_t *bip, vm_offset_t > /* pad to a page boundary */ > addr =3D roundup(addr, PAGE_SIZE); >=20 > - kfp =3D file_findfile(NULL, "elf kernel"); > + kfp =3D file_findfile(NULL, md_kerntype); > if (kfp =3D=3D NULL) > panic("can't find kernel file"); > kernend =3D 0; /* fill it in later */ > diff --git a/stand/i386/libi386/bootinfo64.c = b/stand/i386/libi386/bootinfo64.c > index 4731b10325fe..f7181dcd599f 100644 > --- a/stand/i386/libi386/bootinfo64.c > +++ b/stand/i386/libi386/bootinfo64.c > @@ -143,7 +143,7 @@ bi_load64(char *args, vm_offset_t *modulep, > /* place the metadata before anything */ > module =3D *modulep =3D addr; >=20 > - kfp =3D file_findfile(NULL, "elf kernel"); > + kfp =3D file_findfile(NULL, md_kerntype); > if (kfp =3D=3D NULL) > panic("can't find kernel file"); > kernend =3D 0; /* fill it in later */ > diff --git a/stand/i386/libi386/multiboot.c = b/stand/i386/libi386/multiboot.c > index b69895de9706..e2bd44fe83f5 100644 > --- a/stand/i386/libi386/multiboot.c > +++ b/stand/i386/libi386/multiboot.c > @@ -48,6 +48,7 @@ > #include "bootstrap.h" > #include "multiboot.h" > #include "libi386.h" > +#include "modinfo.h" > #include >=20 > #define MULTIBOOT_SUPPORTED_FLAGS \ > @@ -256,7 +257,7 @@ multiboot_exec(struct preloaded_file *fp) > * module 0 module 1 > */ >=20 > - fp =3D file_findfile(NULL, "elf kernel"); > + fp =3D file_findfile(NULL, md_kerntype); > if (fp =3D=3D NULL) { > printf("No FreeBSD kernel provided, aborting\n"); > error =3D EINVAL; > @@ -324,7 +325,7 @@ multiboot_obj_loadfile(char *filename, uint64_t = dest, > int error, mod_num; >=20 > /* See if there's a multiboot kernel loaded */ > - mfp =3D file_findfile(NULL, "elf multiboot kernel"); > + mfp =3D file_findfile(NULL, md_kerntype_mb); > if (mfp =3D=3D NULL) > return (EFTYPE); >=20 > @@ -332,14 +333,14 @@ multiboot_obj_loadfile(char *filename, uint64_t = dest, > * We have a multiboot kernel loaded, see if there's a FreeBSD > * kernel loaded also. > */ > - kfp =3D file_findfile(NULL, "elf kernel"); > + kfp =3D file_findfile(NULL, md_kerntype); > if (kfp =3D=3D NULL) { > /* > * No kernel loaded, this must be it. The kernel has to > * be loaded as a raw file, it will be processed by > * Xen and correctly loaded as an ELF file. > */ > - rfp =3D file_loadraw(filename, "elf kernel", 0); > + rfp =3D file_loadraw(filename, md_kerntype, 0); > if (rfp =3D=3D NULL) { > printf( > "Unable to load %s as a multiboot payload kernel\n", > diff --git a/stand/powerpc/ofw/elf_freebsd.c = b/stand/powerpc/ofw/elf_freebsd.c > index 21ab834f76fa..4d34fa18c5dd 100644 > --- a/stand/powerpc/ofw/elf_freebsd.c > +++ b/stand/powerpc/ofw/elf_freebsd.c > @@ -58,7 +58,7 @@ __elfN(ofw_loadfile)(char *filename, uint64_t dest, > * No need to sync the icache for modules: this will > * be done by the kernel after relocation. > */ > - if (!strcmp((*result)->f_type, "elf kernel")) > + if (!strcmp((*result)->f_type, md_kerntype)) > __syncicache((void *) (*result)->f_addr, (*result)->f_size); > #endif > return (0); > diff --git a/stand/powerpc/ofw/ppc64_elf_freebsd.c = b/stand/powerpc/ofw/ppc64_elf_freebsd.c > index e0518abe2283..bc68d129f353 100644 > --- a/stand/powerpc/ofw/ppc64_elf_freebsd.c > +++ b/stand/powerpc/ofw/ppc64_elf_freebsd.c > @@ -57,7 +57,7 @@ ppc64_ofw_elf_loadfile(char *filename, uint64_t = dest, > * No need to sync the icache for modules: this will > * be done by the kernel after relocation. > */ > - if (!strcmp((*result)->f_type, "elf kernel")) > + if (!strcmp((*result)->f_type, md_kerntype)) > __syncicache((void *) (*result)->f_addr, (*result)->f_size); > return (0); > } > diff --git a/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c = b/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c > index 291fe6b944fb..e500b862de2e 100644 > --- a/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c > +++ b/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c > @@ -53,7 +53,7 @@ ppc64_uboot_elf_loadfile(char *filename, uint64_t = dest, > * No need to sync the icache for modules: this will > * be done by the kernel after relocation. > */ > - if (!strcmp((*result)->f_type, "elf kernel")) > + if (!strcmp((*result)->f_type, md_kerntype)) > __syncicache((void *) (*result)->f_addr, (*result)->f_size); > return (0); > } > diff --git a/stand/uboot/elf_freebsd.c b/stand/uboot/elf_freebsd.c > index 6c764d143881..3b1bdc542538 100644 > --- a/stand/uboot/elf_freebsd.c > +++ b/stand/uboot/elf_freebsd.c > @@ -53,7 +53,7 @@ __elfN(uboot_load)(char *filename, uint64_t dest, > * No need to sync the icache for modules: this will > * be done by the kernel after relocation. > */ > - if (!strcmp((*result)->f_type, "elf kernel")) > + if (!strcmp((*result)->f_type, md_kerntype)) > __syncicache((void *) (*result)->f_addr, (*result)->f_size); > #endif > return (0); > diff --git a/stand/userboot/userboot/bootinfo32.c = b/stand/userboot/userboot/bootinfo32.c > index 91f1f81f1181..750574912172 100644 > --- a/stand/userboot/userboot/bootinfo32.c > +++ b/stand/userboot/userboot/bootinfo32.c > @@ -108,7 +108,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, = vm_offset_t *bip, vm_offset_t > /* pad to a page boundary */ > addr =3D roundup(addr, PAGE_SIZE); >=20 > - kfp =3D file_findfile(NULL, "elf kernel"); > + kfp =3D file_findfile(NULL, md_kerntype); > if (kfp =3D=3D NULL) > panic("can't find kernel file"); > kernend =3D 0; /* fill it in later */ > diff --git a/stand/userboot/userboot/bootinfo64.c = b/stand/userboot/userboot/bootinfo64.c > index fb9fd0fb82f1..d20202bf4fbb 100644 > --- a/stand/userboot/userboot/bootinfo64.c > +++ b/stand/userboot/userboot/bootinfo64.c > @@ -140,7 +140,7 @@ bi_load64(char *args, vm_offset_t *modulep, = vm_offset_t *kernendp) > /* pad to a page boundary */ > addr =3D roundup(addr, PAGE_SIZE); >=20 > - kfp =3D file_findfile(NULL, "elf kernel"); > + kfp =3D file_findfile(NULL, md_kerntype); > if (kfp =3D=3D NULL) > panic("can't find kernel file"); > kernend =3D 0; /* fill it in later */ From nobody Fri Jan 24 22:13:19 2025 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 4YfsXF3Fpnz5lTvG for ; Fri, 24 Jan 2025 22:13:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) (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 4YfsXD5MJqz3ntJ for ; Fri, 24 Jan 2025 22:13:32 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2ee709715d9so3850901a91.3 for ; Fri, 24 Jan 2025 14:13:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1737756811; x=1738361611; 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=FaQ7nvOortELnV7zUsIVwAVvFb2XoGkSHmo6rtHc3m8=; b=C0zZQmHe1JNt1V/ZUEIMAwPiYu0pPHtV+LNKKanqrMHO0tBqJtZdvTFfEpeNRHThYv PFeCzzk+fZxjPR+S5CkP6JFiW3T36SreadL6T7IVRrKqUHBKTDsqdEwQXyqwV8eh0ba/ jOT/LScfrzBAPlUFPUdez0NuCFXBv8VZ0O+c7bpx8WfI4IGj4A6j0mZMtakKX6izawX9 7ycJcxq0Dn3kw0v0UH8Tqou8hnv+SSW7t6CzcypiKW9pkijXC6/p/g4EVpWnBAI32GHx 8lRtJRleZWwOEVXgKrPMdvlh74JJJqvQs1SeiUXcMaunWUk/kmbIWdNm1okS4sbQdzrC tAZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737756811; x=1738361611; 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=FaQ7nvOortELnV7zUsIVwAVvFb2XoGkSHmo6rtHc3m8=; b=GXrBK2pdGuUT+AY/KIxGFMSQJ7z3WLwqka6n3Bt2PerbOdeeB5zqxr4ZHk9fVboPjx eSW11OnieD668huBsVkQCyfbSbzTMSIbngzGqYyg25V75og9LfaOPicGJb2WHE3VxpRX Hi3oGKciONs9/UbwtRQGAq1rIhHkR6GtuluxFDygjmcH8YmVYQXp1djvgcuTkhPrsiQr RhlygVO+1J6g9HgIH+HnzyZRFbaeJ6vn/31nt/Q9cMw/2IdFXOMIvpJRVqJwzEHgkRf8 g24jEMZKM4AB0UE0Um5IoUU0VSITnhmB+wsDYvuBvclek/u0GoS009tdBMoSQOXTjNOx 6UGQ== X-Forwarded-Encrypted: i=1; AJvYcCVCzr9UT60Q5z1/E29iT20jftpkHiJRgpTXxtCEaFtYfzjTpSDI9YyPoNeB6C+/ClnfwzQTC8AxLjEwmBKVZjDJ7MZpcw==@freebsd.org X-Gm-Message-State: AOJu0Yw9R9GIIb1Mx7F1ZxgHvLmRL5nWAWmIHRwatM7Dxwx371L3QRtK PpPSRUO0HeTx5pk6486uL4A9OcDTJxlxyd29tn6BR1jvpaEvTTTHWRsGSe++vdNIWNLQVXu9rwQ m/PChCU1V0k028URJgL7BYZFJZ999UPKj4Nlopw== X-Gm-Gg: ASbGncsM2HiAz+cgwktyVq/GdB10RGY4LaCz6F4jf5bNHM+HIeU6F/KZraVS5j4nyrT NwvY1+G9Lmcmvy/8fZmE94WpM9L1TcqZIgszVR38EjgSQ3AuQdK3Jv97Zfy1H5w== X-Google-Smtp-Source: AGHT+IGPoSlKDoBm0DSemyqowfy4kPuiQxncqJPfmVAKcksMfo7e5bglCQMmX/eNX5du8DDLAhHZhghUZWzlEfWB8OE= X-Received: by 2002:a17:90b:3a0c:b0:2ee:e113:815d with SMTP id 98e67ed59e1d1-2f782c70168mr45162351a91.8.1737756811091; Fri, 24 Jan 2025 14:13:31 -0800 (PST) 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: <202501242137.50OLbHWK094915@gitrepo.freebsd.org> <4ED8708B-32AF-4D7D-B1DC-6D790FB586C4@freebsd.org> In-Reply-To: <4ED8708B-32AF-4D7D-B1DC-6D790FB586C4@freebsd.org> From: Warner Losh Date: Fri, 24 Jan 2025 15:13:19 -0700 X-Gm-Features: AWEUYZkC_TGpQcC_xcc0yRzctn5NuIv2H5AyBbK-xuxT0os4ka6pqw-p7cN7xxI Message-ID: Subject: Re: git: 86077f4fd110 - main - stand: use globals for the kernel and module types To: Jessica Clarke Cc: Warner Losh , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: multipart/alternative; boundary="0000000000006e7b3d062c7b090f" X-Rspamd-Queue-Id: 4YfsXD5MJqz3ntJ 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:15169, ipnet:2607:f8b0::/32, country:US] --0000000000006e7b3d062c7b090f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jan 24, 2025 at 2:55=E2=80=AFPM Jessica Clarke = wrote: > On 24 Jan 2025, at 21:37, Warner Losh wrote: > > > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D86077f4fd11070518a6d04eee7fdb93= cbbfb1b52 > > > > commit 86077f4fd11070518a6d04eee7fdb93cbbfb1b52 > > Author: Ahmad Khalifa > > AuthorDate: 2024-08-24 15:16:09 +0000 > > Commit: Warner Losh > > CommitDate: 2025-01-24 21:29:39 +0000 > > > > stand: use globals for the kernel and module types > > As with the kernel, please just use the macros directly. > Both are fine as is, which is why I didn't push the issue in the code review. Either a macro or global is fine, and doesn't materially change anything doing it one way or the other. But if someone wants to convert them to macros, that's cool too. It's likely marginally better, but both are light-years ahead of a dozen strings, some inexplicably different. Warner > Jess > > > Reviewed by: imp, kib > > Pull Request: https://github.com/freebsd/freebsd-src/pull/1394 > > --- > > stand/common/gfx_fb.c | 6 ++++-- > > stand/common/load_elf.c | 12 +++++------- > > stand/common/load_elf_obj.c | 8 +++----- > > stand/common/metadata.c | 2 +- > > stand/common/modinfo.c | 5 +++++ > > stand/common/modinfo.h | 5 +++++ > > stand/efi/loader/arch/amd64/multiboot2.c | 9 +++++---- > > stand/efi/loader/bootinfo.c | 2 +- > > stand/i386/libi386/bootinfo32.c | 2 +- > > stand/i386/libi386/bootinfo64.c | 2 +- > > stand/i386/libi386/multiboot.c | 9 +++++---- > > stand/powerpc/ofw/elf_freebsd.c | 2 +- > > stand/powerpc/ofw/ppc64_elf_freebsd.c | 2 +- > > stand/uboot/arch/powerpc/ppc64_elf_freebsd.c | 2 +- > > stand/uboot/elf_freebsd.c | 2 +- > > stand/userboot/userboot/bootinfo32.c | 2 +- > > stand/userboot/userboot/bootinfo64.c | 2 +- > > 17 files changed, 42 insertions(+), 32 deletions(-) > > > > diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c > > index 9bda0e7139a9..63036f3c07f6 100644 > > --- a/stand/common/gfx_fb.c > > +++ b/stand/common/gfx_fb.c > > @@ -102,6 +102,8 @@ > > #include > > #endif > > > > +#include "modinfo.h" > > + > > /* VGA text mode does use bold font. */ > > #if !defined(VGA_8X16_FONT) > > #define VGA_8X16_FONT "/boot/fonts/8x16b.fnt" > > @@ -2982,7 +2984,7 @@ build_font_module(vm_offset_t addr) > > > > fi.fi_checksum =3D -checksum; > > > > - fp =3D file_findfile(NULL, "elf kernel"); > > + fp =3D file_findfile(NULL, md_kerntype); > > if (fp =3D=3D NULL) > > panic("can't find kernel file"); > > > > @@ -3024,7 +3026,7 @@ build_splash_module(vm_offset_t addr) > > return (addr); > > } > > > > - fp =3D file_findfile(NULL, "elf kernel"); > > + fp =3D file_findfile(NULL, md_kerntype); > > if (fp =3D=3D NULL) > > panic("can't find kernel file"); > > > > diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c > > index d3775b9f0017..e19aefa121e7 100644 > > --- a/stand/common/load_elf.c > > +++ b/stand/common/load_elf.c > > @@ -37,6 +37,7 @@ > > #include > > > > #include "bootstrap.h" > > +#include "modinfo.h" > > > > #define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l) > > > > @@ -89,9 +90,6 @@ static int __elfN(parse_modmetadata)(struct > preloaded_file *mp, elf_file_t ef, > > static symaddr_fn __elfN(symaddr); > > static char *fake_modname(const char *name); > > > > -const char *__elfN(kerneltype) =3D "elf kernel"; > > -const char *__elfN(moduletype) =3D "elf module"; > > - > > uint64_t __elfN(relocation_offset) =3D 0; > > > > #ifdef __powerpc__ > > @@ -384,7 +382,7 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest, > > /* > > * Check to see what sort of module we are. > > */ > > - kfp =3D file_findfile(NULL, __elfN(kerneltype)); > > + kfp =3D file_findfile(NULL, md_kerntype); > > #ifdef __powerpc__ > > /* > > * Kernels can be ET_DYN, so just assume the first loaded object is the > > @@ -435,7 +433,7 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest, > > err =3D EPERM; > > goto oerr; > > } > > - if (strcmp(__elfN(kerneltype), kfp->f_type)) { > > + if (strcmp(md_kerntype, kfp->f_type)) { > > printf("elf" __XSTRING(__ELF_WORD_SIZE) > > "_loadfile: can't load module with kernel type '%s'\n", > > kfp->f_type); > > @@ -470,9 +468,9 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest, > > fp->f_name =3D strdup(filename); > > if (multiboot =3D=3D 0) > > fp->f_type =3D strdup(ef.kernel ? > > - __elfN(kerneltype) : __elfN(moduletype)); > > + md_kerntype : md_modtype); > > else > > - fp->f_type =3D strdup("elf multiboot kernel"); > > + fp->f_type =3D strdup(md_kerntype_mb); > > > > if (module_verbose >=3D MODULE_VERBOSE_FULL) { > > if (ef.kernel) > > diff --git a/stand/common/load_elf_obj.c b/stand/common/load_elf_obj.c > > index 9ff1d238b8c8..1e07828dd8ac 100644 > > --- a/stand/common/load_elf_obj.c > > +++ b/stand/common/load_elf_obj.c > > @@ -37,6 +37,7 @@ > > #include > > > > #include "bootstrap.h" > > +#include "modinfo.h" > > > > #define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l) > > > > @@ -77,9 +78,6 @@ static int __elfN(obj_parse_modmetadata)(struct > preloaded_file *mp, > > elf_file_t ef); > > static Elf_Addr __elfN(obj_symaddr)(struct elf_file *ef, Elf_Size > symidx); > > > > -const char *__elfN(obj_kerneltype) =3D "elf kernel"; > > -const char *__elfN(obj_moduletype) =3D "elf obj module"; > > - > > /* > > * Attempt to load the file (file) as an ELF module. It will be stored > at > > * (dest), and a pointer to a module structure describing the loaded > object > > @@ -154,7 +152,7 @@ __elfN(obj_loadfile)(char *filename, uint64_t dest, > > } > > #endif > > > > - kfp =3D file_findfile(NULL, __elfN(obj_kerneltype)); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) { > > printf("elf" __XSTRING(__ELF_WORD_SIZE) > > "_obj_loadfile: can't load module before kernel\n"); > > @@ -178,7 +176,7 @@ __elfN(obj_loadfile)(char *filename, uint64_t dest, > > goto out; > > } > > fp->f_name =3D strdup(filename); > > - fp->f_type =3D strdup(__elfN(obj_moduletype)); > > + fp->f_type =3D strdup(md_modtype_obj); > > > > if (module_verbose > MODULE_VERBOSE_SILENT) > > printf("%s ", filename); > > diff --git a/stand/common/metadata.c b/stand/common/metadata.c > > index 8962763061dc..22df6f175791 100644 > > --- a/stand/common/metadata.c > > +++ b/stand/common/metadata.c > > @@ -146,7 +146,7 @@ md_load_dual(char *args, vm_offset_t *modulep, > vm_offset_t *dtb, int kern64) > > #endif > > > > kernend =3D 0; > > - kfp =3D file_findfile(NULL, "elf kernel"); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) > > panic("can't find kernel file"); > > file_addmetadata(kfp, MODINFOMD_HOWTO, sizeof howto, &howto); > > diff --git a/stand/common/modinfo.c b/stand/common/modinfo.c > > index 381bd9dfd719..d00548c91c57 100644 > > --- a/stand/common/modinfo.c > > +++ b/stand/common/modinfo.c > > @@ -109,6 +109,11 @@ > > > > #define MOD_ALIGN(l) roundup(l, align) > > > > +const char md_modtype[] =3D MODTYPE; > > +const char md_kerntype[] =3D KERNTYPE; > > +const char md_modtype_obj[] =3D MODTYPE_OBJ; > > +const char md_kerntype_mb[] =3D KERNTYPE_MB; > > + > > vm_offset_t > > md_copymodules(vm_offset_t addr, bool kern64) > > { > > diff --git a/stand/common/modinfo.h b/stand/common/modinfo.h > > index 967367beeeb0..d26129089fb6 100644 > > --- a/stand/common/modinfo.h > > +++ b/stand/common/modinfo.h > > @@ -6,6 +6,11 @@ > > #ifndef COMMON_MODINFO_H > > #define COMMON_MODINFO_H > > > > +extern const char md_modtype[]; > > +extern const char md_kerntype[]; > > +extern const char md_modtype_obj[]; > > +extern const char md_kerntype_mb[]; > > + > > int md_load(char *args, vm_offset_t *modulep, vm_offset_t *dtb); > > int md_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtb); > > > > diff --git a/stand/efi/loader/arch/amd64/multiboot2.c > b/stand/efi/loader/arch/amd64/multiboot2.c > > index d09b01fce1fc..eb7362293406 100644 > > --- a/stand/efi/loader/arch/amd64/multiboot2.c > > +++ b/stand/efi/loader/arch/amd64/multiboot2.c > > @@ -51,6 +51,7 @@ > > #include "bootstrap.h" > > #include "multiboot2.h" > > #include "loader_efi.h" > > +#include "modinfo.h" > > > > extern int elf32_loadfile_raw(char *filename, uint64_t dest, > > struct preloaded_file **result, int multiboot); > > @@ -436,7 +437,7 @@ exec(struct preloaded_file *fp) > > * module 0 module 1 > > */ > > > > - fp =3D file_findfile(NULL, "elf kernel"); > > + fp =3D file_findfile(NULL, md_kerntype); > > if (fp =3D=3D NULL) { > > printf("No FreeBSD kernel provided, aborting\n"); > > error =3D EINVAL; > > @@ -498,7 +499,7 @@ obj_loadfile(char *filename, uint64_t dest, struct > preloaded_file **result) > > int error; > > > > /* See if there's a multiboot kernel loaded */ > > - mfp =3D file_findfile(NULL, "elf multiboot kernel"); > > + mfp =3D file_findfile(NULL, md_kerntype_mb); > > if (mfp =3D=3D NULL) > > return (EFTYPE); > > > > @@ -506,14 +507,14 @@ obj_loadfile(char *filename, uint64_t dest, struc= t > preloaded_file **result) > > * We have a multiboot kernel loaded, see if there's a FreeBSD > > * kernel loaded also. > > */ > > - kfp =3D file_findfile(NULL, "elf kernel"); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) { > > /* > > * No kernel loaded, this must be it. The kernel has to > > * be loaded as a raw file, it will be processed by > > * Xen and correctly loaded as an ELF file. > > */ > > - rfp =3D file_loadraw(filename, "elf kernel", 0); > > + rfp =3D file_loadraw(filename, md_kerntype, 0); > > if (rfp =3D=3D NULL) { > > printf( > > "Unable to load %s as a multiboot payload kernel\n", > > diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c > > index b7d4070c2ffb..3e74a9228b5e 100644 > > --- a/stand/efi/loader/bootinfo.c > > +++ b/stand/efi/loader/bootinfo.c > > @@ -420,7 +420,7 @@ bi_load(char *args, vm_offset_t *modulep, > vm_offset_t *kernendp, bool exit_bs) > > addr +=3D roundup(dtb_size, PAGE_SIZE); > > #endif > > > > - kfp =3D file_findfile(NULL, "elf kernel"); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) > > panic("can't find kernel file"); > > kernend =3D 0; /* fill it in later */ > > diff --git a/stand/i386/libi386/bootinfo32.c > b/stand/i386/libi386/bootinfo32.c > > index df715e547795..37b227b913bd 100644 > > --- a/stand/i386/libi386/bootinfo32.c > > +++ b/stand/i386/libi386/bootinfo32.c > > @@ -129,7 +129,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, > vm_offset_t *bip, vm_offset_t > > /* pad to a page boundary */ > > addr =3D roundup(addr, PAGE_SIZE); > > > > - kfp =3D file_findfile(NULL, "elf kernel"); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) > > panic("can't find kernel file"); > > kernend =3D 0; /* fill it in later */ > > diff --git a/stand/i386/libi386/bootinfo64.c > b/stand/i386/libi386/bootinfo64.c > > index 4731b10325fe..f7181dcd599f 100644 > > --- a/stand/i386/libi386/bootinfo64.c > > +++ b/stand/i386/libi386/bootinfo64.c > > @@ -143,7 +143,7 @@ bi_load64(char *args, vm_offset_t *modulep, > > /* place the metadata before anything */ > > module =3D *modulep =3D addr; > > > > - kfp =3D file_findfile(NULL, "elf kernel"); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) > > panic("can't find kernel file"); > > kernend =3D 0; /* fill it in later */ > > diff --git a/stand/i386/libi386/multiboot.c > b/stand/i386/libi386/multiboot.c > > index b69895de9706..e2bd44fe83f5 100644 > > --- a/stand/i386/libi386/multiboot.c > > +++ b/stand/i386/libi386/multiboot.c > > @@ -48,6 +48,7 @@ > > #include "bootstrap.h" > > #include "multiboot.h" > > #include "libi386.h" > > +#include "modinfo.h" > > #include > > > > #define MULTIBOOT_SUPPORTED_FLAGS \ > > @@ -256,7 +257,7 @@ multiboot_exec(struct preloaded_file *fp) > > * module 0 module 1 > > */ > > > > - fp =3D file_findfile(NULL, "elf kernel"); > > + fp =3D file_findfile(NULL, md_kerntype); > > if (fp =3D=3D NULL) { > > printf("No FreeBSD kernel provided, aborting\n"); > > error =3D EINVAL; > > @@ -324,7 +325,7 @@ multiboot_obj_loadfile(char *filename, uint64_t des= t, > > int error, mod_num; > > > > /* See if there's a multiboot kernel loaded */ > > - mfp =3D file_findfile(NULL, "elf multiboot kernel"); > > + mfp =3D file_findfile(NULL, md_kerntype_mb); > > if (mfp =3D=3D NULL) > > return (EFTYPE); > > > > @@ -332,14 +333,14 @@ multiboot_obj_loadfile(char *filename, uint64_t > dest, > > * We have a multiboot kernel loaded, see if there's a FreeBSD > > * kernel loaded also. > > */ > > - kfp =3D file_findfile(NULL, "elf kernel"); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) { > > /* > > * No kernel loaded, this must be it. The kernel has to > > * be loaded as a raw file, it will be processed by > > * Xen and correctly loaded as an ELF file. > > */ > > - rfp =3D file_loadraw(filename, "elf kernel", 0); > > + rfp =3D file_loadraw(filename, md_kerntype, 0); > > if (rfp =3D=3D NULL) { > > printf( > > "Unable to load %s as a multiboot payload kernel\n", > > diff --git a/stand/powerpc/ofw/elf_freebsd.c > b/stand/powerpc/ofw/elf_freebsd.c > > index 21ab834f76fa..4d34fa18c5dd 100644 > > --- a/stand/powerpc/ofw/elf_freebsd.c > > +++ b/stand/powerpc/ofw/elf_freebsd.c > > @@ -58,7 +58,7 @@ __elfN(ofw_loadfile)(char *filename, uint64_t dest, > > * No need to sync the icache for modules: this will > > * be done by the kernel after relocation. > > */ > > - if (!strcmp((*result)->f_type, "elf kernel")) > > + if (!strcmp((*result)->f_type, md_kerntype)) > > __syncicache((void *) (*result)->f_addr, (*result)->f_size); > > #endif > > return (0); > > diff --git a/stand/powerpc/ofw/ppc64_elf_freebsd.c > b/stand/powerpc/ofw/ppc64_elf_freebsd.c > > index e0518abe2283..bc68d129f353 100644 > > --- a/stand/powerpc/ofw/ppc64_elf_freebsd.c > > +++ b/stand/powerpc/ofw/ppc64_elf_freebsd.c > > @@ -57,7 +57,7 @@ ppc64_ofw_elf_loadfile(char *filename, uint64_t dest, > > * No need to sync the icache for modules: this will > > * be done by the kernel after relocation. > > */ > > - if (!strcmp((*result)->f_type, "elf kernel")) > > + if (!strcmp((*result)->f_type, md_kerntype)) > > __syncicache((void *) (*result)->f_addr, (*result)->f_size); > > return (0); > > } > > diff --git a/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c > b/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c > > index 291fe6b944fb..e500b862de2e 100644 > > --- a/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c > > +++ b/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c > > @@ -53,7 +53,7 @@ ppc64_uboot_elf_loadfile(char *filename, uint64_t des= t, > > * No need to sync the icache for modules: this will > > * be done by the kernel after relocation. > > */ > > - if (!strcmp((*result)->f_type, "elf kernel")) > > + if (!strcmp((*result)->f_type, md_kerntype)) > > __syncicache((void *) (*result)->f_addr, (*result)->f_size); > > return (0); > > } > > diff --git a/stand/uboot/elf_freebsd.c b/stand/uboot/elf_freebsd.c > > index 6c764d143881..3b1bdc542538 100644 > > --- a/stand/uboot/elf_freebsd.c > > +++ b/stand/uboot/elf_freebsd.c > > @@ -53,7 +53,7 @@ __elfN(uboot_load)(char *filename, uint64_t dest, > > * No need to sync the icache for modules: this will > > * be done by the kernel after relocation. > > */ > > - if (!strcmp((*result)->f_type, "elf kernel")) > > + if (!strcmp((*result)->f_type, md_kerntype)) > > __syncicache((void *) (*result)->f_addr, (*result)->f_size); > > #endif > > return (0); > > diff --git a/stand/userboot/userboot/bootinfo32.c > b/stand/userboot/userboot/bootinfo32.c > > index 91f1f81f1181..750574912172 100644 > > --- a/stand/userboot/userboot/bootinfo32.c > > +++ b/stand/userboot/userboot/bootinfo32.c > > @@ -108,7 +108,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, > vm_offset_t *bip, vm_offset_t > > /* pad to a page boundary */ > > addr =3D roundup(addr, PAGE_SIZE); > > > > - kfp =3D file_findfile(NULL, "elf kernel"); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) > > panic("can't find kernel file"); > > kernend =3D 0; /* fill it in later */ > > diff --git a/stand/userboot/userboot/bootinfo64.c > b/stand/userboot/userboot/bootinfo64.c > > index fb9fd0fb82f1..d20202bf4fbb 100644 > > --- a/stand/userboot/userboot/bootinfo64.c > > +++ b/stand/userboot/userboot/bootinfo64.c > > @@ -140,7 +140,7 @@ bi_load64(char *args, vm_offset_t *modulep, > vm_offset_t *kernendp) > > /* pad to a page boundary */ > > addr =3D roundup(addr, PAGE_SIZE); > > > > - kfp =3D file_findfile(NULL, "elf kernel"); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) > > panic("can't find kernel file"); > > kernend =3D 0; /* fill it in later */ > > --0000000000006e7b3d062c7b090f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Fri, Jan 24,= 2025 at 2:55=E2=80=AFPM Jessica Clarke <jrtc27@freebsd.org> wrote:
On 24 Jan 2025, at 21:37, Warner Losh <imp@Free= BSD.org> wrote:
>
> The branch main has been updated by imp:
>
> URL: https://= cgit.FreeBSD.org/src/commit/?id=3D86077f4fd11070518a6d04eee7fdb93cbbfb1b52<= /a>
>
> commit 86077f4fd11070518a6d04eee7fdb93cbbfb1b52
> Author:=C2=A0 =C2=A0 =C2=A0Ahmad Khalifa <
ahmadkhalifa570@gmail.com>
> AuthorDate: 2024-08-24 15:16:09 +0000
> Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org>
> CommitDate: 2025-01-24 21:29:39 +0000
>
>=C2=A0 =C2=A0 stand: use globals for the kernel and module types

As with the kernel, please just use the macros directly.

Both are fine as is, which is why I didn't push the i= ssue in the code review.
Either a macro or global is fine, and do= esn't materially change=C2=A0anything
doing it one way or the= other. But if someone wants to convert them to
macros, that'= s cool too. It's likely marginally better, but both are light-years
ahead of a dozen strings, some inexplicably=C2=A0different.

Warner
=C2=A0
Jess

>=C2=A0 =C2=A0 Reviewed by: imp, kib
>=C2=A0 =C2=A0 Pull Request: https://github.com/f= reebsd/freebsd-src/pull/1394
> ---
> stand/common/gfx_fb.c=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 6 ++++--
> stand/common/load_elf.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | 12 +++++-------
> stand/common/load_elf_obj.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 |=C2=A0 8 +++-----
> stand/common/metadata.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 2 +-
> stand/common/modinfo.c=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 5 +++++
> stand/common/modinfo.h=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 5 +++++
> stand/efi/loader/arch/amd64/multiboot2.c=C2=A0 =C2=A0 =C2=A0|=C2=A0 9 = +++++----
> stand/efi/loader/bootinfo.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 |=C2=A0 2 +-
> stand/i386/libi386/bootinfo32.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 |=C2=A0 2 +-
> stand/i386/libi386/bootinfo64.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 |=C2=A0 2 +-
> stand/i386/libi386/multiboot.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0|=C2=A0 9 +++++----
> stand/powerpc/ofw/elf_freebsd.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 |=C2=A0 2 +-
> stand/powerpc/ofw/ppc64_elf_freebsd.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2= =A0 2 +-
> stand/uboot/arch/powerpc/ppc64_elf_freebsd.c |=C2=A0 2 +-
> stand/uboot/elf_freebsd.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 2 +-
> stand/userboot/userboot/bootinfo32.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= |=C2=A0 2 +-
> stand/userboot/userboot/bootinfo64.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= |=C2=A0 2 +-
> 17 files changed, 42 insertions(+), 32 deletions(-)
>
> diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c
> index 9bda0e7139a9..63036f3c07f6 100644
> --- a/stand/common/gfx_fb.c
> +++ b/stand/common/gfx_fb.c
> @@ -102,6 +102,8 @@
> #include <vbe.h>
> #endif
>
> +#include "modinfo.h"
> +
> /* VGA text mode does use bold font. */
> #if !defined(VGA_8X16_FONT)
> #define VGA_8X16_FONT "/boot/fonts/8x16b.fnt"
> @@ -2982,7 +2984,7 @@ build_font_module(vm_offset_t addr)
>
> fi.fi_checksum =3D -checksum;
>
> - fp =3D file_findfile(NULL, "elf kernel");
> + fp =3D file_findfile(NULL, md_kerntype);
> if (fp =3D=3D NULL)
> panic("can't find kernel file");
>
> @@ -3024,7 +3026,7 @@ build_splash_module(vm_offset_t addr)
> return (addr);
> }
>
> - fp =3D file_findfile(NULL, "elf kernel");
> + fp =3D file_findfile(NULL, md_kerntype);
> if (fp =3D=3D NULL)
> panic("can't find kernel file");
>
> diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c
> index d3775b9f0017..e19aefa121e7 100644
> --- a/stand/common/load_elf.c
> +++ b/stand/common/load_elf.c
> @@ -37,6 +37,7 @@
> #include <sys/link_elf.h>
>
> #include "bootstrap.h"
> +#include "modinfo.h"
>
> #define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l)
>
> @@ -89,9 +90,6 @@ static int __elfN(parse_modmetadata)(struct preloade= d_file *mp, elf_file_t ef,
> static symaddr_fn __elfN(symaddr);
> static char *fake_modname(const char *name);
>
> -const char *__elfN(kerneltype) =3D "elf kernel";
> -const char *__elfN(moduletype) =3D "elf module";
> -
> uint64_t __elfN(relocation_offset) =3D 0;
>
> #ifdef __powerpc__
> @@ -384,7 +382,7 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest= ,
> /*
> * Check to see what sort of module we are.
> */
> - kfp =3D file_findfile(NULL, __elfN(kerneltype));
> + kfp =3D file_findfile(NULL, md_kerntype);
> #ifdef __powerpc__
> /*
> * Kernels can be ET_DYN, so just assume the first loaded object is the=
> @@ -435,7 +433,7 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest= ,
> err =3D EPERM;
> goto oerr;
> }
> - if (strcmp(__elfN(kerneltype), kfp->f_type)) {
> + if (strcmp(md_kerntype, kfp->f_type)) {
> printf("elf" __XSTRING(__ELF_WORD_SIZE)
> "_loadfile: can't load module with kernel type '%s'\n= ",
>=C2=A0 =C2=A0 kfp->f_type);
> @@ -470,9 +468,9 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest= ,
> fp->f_name =3D strdup(filename);
> if (multiboot =3D=3D 0)
> fp->f_type =3D strdup(ef.kernel ?
> -=C2=A0 =C2=A0 __elfN(kerneltype) : __elfN(moduletype));
> +=C2=A0 =C2=A0 md_kerntype : md_modtype);
> else
> - fp->f_type =3D strdup("elf multiboot kernel");
> + fp->f_type =3D strdup(md_kerntype_mb);
>
> if (module_verbose >=3D MODULE_VERBOSE_FULL) {
> if (ef.kernel)
> diff --git a/stand/common/load_elf_obj.c b/stand/common/load_elf_obj.c=
> index 9ff1d238b8c8..1e07828dd8ac 100644
> --- a/stand/common/load_elf_obj.c
> +++ b/stand/common/load_elf_obj.c
> @@ -37,6 +37,7 @@
> #include <sys/link_elf.h>
>
> #include "bootstrap.h"
> +#include "modinfo.h"
>
> #define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l)
>
> @@ -77,9 +78,6 @@ static int __elfN(obj_parse_modmetadata)(struct prel= oaded_file *mp,
>=C2=A0 =C2=A0 =C2=A0elf_file_t ef);
> static Elf_Addr __elfN(obj_symaddr)(struct elf_file *ef, Elf_Size symi= dx);
>
> -const char *__elfN(obj_kerneltype) =3D "elf kernel";
> -const char *__elfN(obj_moduletype) =3D "elf obj module"; > -
> /*
>=C2=A0 * Attempt to load the file (file) as an ELF module.=C2=A0 It wil= l be stored at
>=C2=A0 * (dest), and a pointer to a module structure describing the loa= ded object
> @@ -154,7 +152,7 @@ __elfN(obj_loadfile)(char *filename, uint64_t dest= ,
> }
> #endif
>
> - kfp =3D file_findfile(NULL, __elfN(obj_kerneltype));
> + kfp =3D file_findfile(NULL, md_kerntype);
> if (kfp =3D=3D NULL) {
> printf("elf" __XSTRING(__ELF_WORD_SIZE)
>=C2=A0 =C2=A0 "_obj_loadfile: can't load module before kernel\= n");
> @@ -178,7 +176,7 @@ __elfN(obj_loadfile)(char *filename, uint64_t dest= ,
> goto out;
> }
> fp->f_name =3D strdup(filename);
> - fp->f_type =3D strdup(__elfN(obj_moduletype));
> + fp->f_type =3D strdup(md_modtype_obj);
>
> if (module_verbose > MODULE_VERBOSE_SILENT)
> printf("%s ", filename);
> diff --git a/stand/common/metadata.c b/stand/common/metadata.c
> index 8962763061dc..22df6f175791 100644
> --- a/stand/common/metadata.c
> +++ b/stand/common/metadata.c
> @@ -146,7 +146,7 @@ md_load_dual(char *args, vm_offset_t *modulep, vm_= offset_t *dtb, int kern64)
> #endif
>
>=C2=A0 =C2=A0 =C2=A0kernend =3D 0;
> -=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, "elf kernel"); > +=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, md_kerntype);
>=C2=A0 =C2=A0 =C2=A0if (kfp =3D=3D NULL)
> panic("can't find kernel file");
>=C2=A0 =C2=A0 =C2=A0file_addmetadata(kfp, MODINFOMD_HOWTO, sizeof howto= , &howto);
> diff --git a/stand/common/modinfo.c b/stand/common/modinfo.c
> index 381bd9dfd719..d00548c91c57 100644
> --- a/stand/common/modinfo.c
> +++ b/stand/common/modinfo.c
> @@ -109,6 +109,11 @@
>
> #define MOD_ALIGN(l) roundup(l, align)
>
> +const char md_modtype[] =3D MODTYPE;
> +const char md_kerntype[] =3D KERNTYPE;
> +const char md_modtype_obj[] =3D MODTYPE_OBJ;
> +const char md_kerntype_mb[] =3D KERNTYPE_MB;
> +
> vm_offset_t
> md_copymodules(vm_offset_t addr, bool kern64)
> {
> diff --git a/stand/common/modinfo.h b/stand/common/modinfo.h
> index 967367beeeb0..d26129089fb6 100644
> --- a/stand/common/modinfo.h
> +++ b/stand/common/modinfo.h
> @@ -6,6 +6,11 @@
> #ifndef COMMON_MODINFO_H
> #define COMMON_MODINFO_H
>
> +extern const char md_modtype[];
> +extern const char md_kerntype[];
> +extern const char md_modtype_obj[];
> +extern const char md_kerntype_mb[];
> +
> int md_load(char *args, vm_offset_t *modulep, vm_offset_t *dtb);
> int md_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtb);
>
> diff --git a/stand/efi/loader/arch/amd64/multiboot2.c b/stand/efi/load= er/arch/amd64/multiboot2.c
> index d09b01fce1fc..eb7362293406 100644
> --- a/stand/efi/loader/arch/amd64/multiboot2.c
> +++ b/stand/efi/loader/arch/amd64/multiboot2.c
> @@ -51,6 +51,7 @@
> #include "bootstrap.h"
> #include "multiboot2.h"
> #include "loader_efi.h"
> +#include "modinfo.h"
>
> extern int elf32_loadfile_raw(char *filename, uint64_t dest,
>=C2=A0 =C2=A0 =C2=A0struct preloaded_file **result, int multiboot);
> @@ -436,7 +437,7 @@ exec(struct preloaded_file *fp)
> *=C2=A0 module 0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0module 1
> */
>
> - fp =3D file_findfile(NULL, "elf kernel");
> + fp =3D file_findfile(NULL, md_kerntype);
> if (fp =3D=3D NULL) {
> printf("No FreeBSD kernel provided, aborting\n");
> error =3D EINVAL;
> @@ -498,7 +499,7 @@ obj_loadfile(char *filename, uint64_t dest, struct= preloaded_file **result)
> int error;
>
> /* See if there's a multiboot kernel loaded */
> - mfp =3D file_findfile(NULL, "elf multiboot kernel");
> + mfp =3D file_findfile(NULL, md_kerntype_mb);
> if (mfp =3D=3D NULL)
> return (EFTYPE);
>
> @@ -506,14 +507,14 @@ obj_loadfile(char *filename, uint64_t dest, stru= ct preloaded_file **result)
> * We have a multiboot kernel loaded, see if there's a FreeBSD
> * kernel loaded also.
> */
> - kfp =3D file_findfile(NULL, "elf kernel");
> + kfp =3D file_findfile(NULL, md_kerntype);
> if (kfp =3D=3D NULL) {
> /*
> * No kernel loaded, this must be it. The kernel has to
> * be loaded as a raw file, it will be processed by
> * Xen and correctly loaded as an ELF file.
> */
> - rfp =3D file_loadraw(filename, "elf kernel", 0);
> + rfp =3D file_loadraw(filename, md_kerntype, 0);
> if (rfp =3D=3D NULL) {
> printf(
> "Unable to load %s as a multiboot payload kernel\n",
> diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c=
> index b7d4070c2ffb..3e74a9228b5e 100644
> --- a/stand/efi/loader/bootinfo.c
> +++ b/stand/efi/loader/bootinfo.c
> @@ -420,7 +420,7 @@ bi_load(char *args, vm_offset_t *modulep, vm_offse= t_t *kernendp, bool exit_bs)
> addr +=3D roundup(dtb_size, PAGE_SIZE);
> #endif
>
> - kfp =3D file_findfile(NULL, "elf kernel");
> + kfp =3D file_findfile(NULL, md_kerntype);
> if (kfp =3D=3D NULL)
> panic("can't find kernel file");
> kernend =3D 0; /* fill it in later */
> diff --git a/stand/i386/libi386/bootinfo32.c b/stand/i386/libi386/boot= info32.c
> index df715e547795..37b227b913bd 100644
> --- a/stand/i386/libi386/bootinfo32.c
> +++ b/stand/i386/libi386/bootinfo32.c
> @@ -129,7 +129,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, = vm_offset_t *bip, vm_offset_t
>=C2=A0 =C2=A0 =C2=A0/* pad to a page boundary */
>=C2=A0 =C2=A0 =C2=A0addr =3D roundup(addr, PAGE_SIZE);
>
> -=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, "elf kernel"); > +=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, md_kerntype);
>=C2=A0 =C2=A0 =C2=A0if (kfp =3D=3D NULL)
> panic("can't find kernel file");
>=C2=A0 =C2=A0 =C2=A0kernend =3D 0; /* fill it in later */
> diff --git a/stand/i386/libi386/bootinfo64.c b/stand/i386/libi386/boot= info64.c
> index 4731b10325fe..f7181dcd599f 100644
> --- a/stand/i386/libi386/bootinfo64.c
> +++ b/stand/i386/libi386/bootinfo64.c
> @@ -143,7 +143,7 @@ bi_load64(char *args, vm_offset_t *modulep,
>=C2=A0 =C2=A0 =C2=A0/* place the metadata before anything */
>=C2=A0 =C2=A0 =C2=A0module =3D *modulep =3D addr;
>
> -=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, "elf kernel"); > +=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, md_kerntype);
>=C2=A0 =C2=A0 =C2=A0if (kfp =3D=3D NULL)
> panic("can't find kernel file");
>=C2=A0 =C2=A0 =C2=A0kernend =3D 0; /* fill it in later */
> diff --git a/stand/i386/libi386/multiboot.c b/stand/i386/libi386/multi= boot.c
> index b69895de9706..e2bd44fe83f5 100644
> --- a/stand/i386/libi386/multiboot.c
> +++ b/stand/i386/libi386/multiboot.c
> @@ -48,6 +48,7 @@
> #include "bootstrap.h"
> #include "multiboot.h"
> #include "libi386.h"
> +#include "modinfo.h"
> #include <btxv86.h>
>
> #define MULTIBOOT_SUPPORTED_FLAGS \
> @@ -256,7 +257,7 @@ multiboot_exec(struct preloaded_file *fp)
> *=C2=A0 module 0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0module 1
> */
>
> - fp =3D file_findfile(NULL, "elf kernel");
> + fp =3D file_findfile(NULL, md_kerntype);
> if (fp =3D=3D NULL) {
> printf("No FreeBSD kernel provided, aborting\n");
> error =3D EINVAL;
> @@ -324,7 +325,7 @@ multiboot_obj_loadfile(char *filename, uint64_t de= st,
> int error, mod_num;
>
> /* See if there's a multiboot kernel loaded */
> - mfp =3D file_findfile(NULL, "elf multiboot kernel");
> + mfp =3D file_findfile(NULL, md_kerntype_mb);
> if (mfp =3D=3D NULL)
> return (EFTYPE);
>
> @@ -332,14 +333,14 @@ multiboot_obj_loadfile(char *filename, uint64_t = dest,
> * We have a multiboot kernel loaded, see if there's a FreeBSD
> * kernel loaded also.
> */
> - kfp =3D file_findfile(NULL, "elf kernel");
> + kfp =3D file_findfile(NULL, md_kerntype);
> if (kfp =3D=3D NULL) {
> /*
> * No kernel loaded, this must be it. The kernel has to
> * be loaded as a raw file, it will be processed by
> * Xen and correctly loaded as an ELF file.
> */
> - rfp =3D file_loadraw(filename, "elf kernel", 0);
> + rfp =3D file_loadraw(filename, md_kerntype, 0);
> if (rfp =3D=3D NULL) {
> printf(
> "Unable to load %s as a multiboot payload kernel\n",
> diff --git a/stand/powerpc/ofw/elf_freebsd.c b/stand/powerpc/ofw/elf_f= reebsd.c
> index 21ab834f76fa..4d34fa18c5dd 100644
> --- a/stand/powerpc/ofw/elf_freebsd.c
> +++ b/stand/powerpc/ofw/elf_freebsd.c
> @@ -58,7 +58,7 @@ __elfN(ofw_loadfile)(char *filename, uint64_t dest,<= br> > * No need to sync the icache for modules: this will
> * be done by the kernel after relocation.
> */
> - if (!strcmp((*result)->f_type, "elf kernel"))
> + if (!strcmp((*result)->f_type, md_kerntype))
> __syncicache((void *) (*result)->f_addr, (*result)->f_size);
> #endif
> return (0);
> diff --git a/stand/powerpc/ofw/ppc64_elf_freebsd.c b/stand/powerpc/ofw= /ppc64_elf_freebsd.c
> index e0518abe2283..bc68d129f353 100644
> --- a/stand/powerpc/ofw/ppc64_elf_freebsd.c
> +++ b/stand/powerpc/ofw/ppc64_elf_freebsd.c
> @@ -57,7 +57,7 @@ ppc64_ofw_elf_loadfile(char *filename, uint64_t dest= ,
> * No need to sync the icache for modules: this will
> * be done by the kernel after relocation.
> */
> - if (!strcmp((*result)->f_type, "elf kernel"))
> + if (!strcmp((*result)->f_type, md_kerntype))
> __syncicache((void *) (*result)->f_addr, (*result)->f_size);
> return (0);
> }
> diff --git a/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c b/stand/uboo= t/arch/powerpc/ppc64_elf_freebsd.c
> index 291fe6b944fb..e500b862de2e 100644
> --- a/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c
> +++ b/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c
> @@ -53,7 +53,7 @@ ppc64_uboot_elf_loadfile(char *filename, uint64_t de= st,
> * No need to sync the icache for modules: this will
> * be done by the kernel after relocation.
> */
> - if (!strcmp((*result)->f_type, "elf kernel"))
> + if (!strcmp((*result)->f_type, md_kerntype))
> __syncicache((void *) (*result)->f_addr, (*result)->f_size);
> return (0);
> }
> diff --git a/stand/uboot/elf_freebsd.c b/stand/uboot/elf_freebsd.c
> index 6c764d143881..3b1bdc542538 100644
> --- a/stand/uboot/elf_freebsd.c
> +++ b/stand/uboot/elf_freebsd.c
> @@ -53,7 +53,7 @@ __elfN(uboot_load)(char *filename, uint64_t dest, > * No need to sync the icache for modules: this will
> * be done by the kernel after relocation.
> */
> - if (!strcmp((*result)->f_type, "elf kernel"))
> + if (!strcmp((*result)->f_type, md_kerntype))
> __syncicache((void *) (*result)->f_addr, (*result)->f_size);
> #endif
> return (0);
> diff --git a/stand/userboot/userboot/bootinfo32.c b/stand/userboot/use= rboot/bootinfo32.c
> index 91f1f81f1181..750574912172 100644
> --- a/stand/userboot/userboot/bootinfo32.c
> +++ b/stand/userboot/userboot/bootinfo32.c
> @@ -108,7 +108,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, = vm_offset_t *bip, vm_offset_t
>=C2=A0 =C2=A0 =C2=A0/* pad to a page boundary */
>=C2=A0 =C2=A0 =C2=A0addr =3D roundup(addr, PAGE_SIZE);
>
> -=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, "elf kernel"); > +=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, md_kerntype);
>=C2=A0 =C2=A0 =C2=A0if (kfp =3D=3D NULL)
> panic("can't find kernel file");
>=C2=A0 =C2=A0 =C2=A0kernend =3D 0; /* fill it in later */
> diff --git a/stand/userboot/userboot/bootinfo64.c b/stand/userboot/use= rboot/bootinfo64.c
> index fb9fd0fb82f1..d20202bf4fbb 100644
> --- a/stand/userboot/userboot/bootinfo64.c
> +++ b/stand/userboot/userboot/bootinfo64.c
> @@ -140,7 +140,7 @@ bi_load64(char *args, vm_offset_t *modulep, vm_off= set_t *kernendp)
>=C2=A0 =C2=A0 =C2=A0/* pad to a page boundary */
>=C2=A0 =C2=A0 =C2=A0addr =3D roundup(addr, PAGE_SIZE);
>
> -=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, "elf kernel"); > +=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, md_kerntype);
>=C2=A0 =C2=A0 =C2=A0if (kfp =3D=3D NULL)
> panic("can't find kernel file");
>=C2=A0 =C2=A0 =C2=A0kernend =3D 0; /* fill it in later */

--0000000000006e7b3d062c7b090f-- From nobody Fri Jan 24 23:10:37 2025 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 4Yftp56fNpz5lY83; Fri, 24 Jan 2025 23:10:37 +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 4Yftp55BMSz3tkq; Fri, 24 Jan 2025 23:10:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737760237; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=geKoixrXUS7R9xAHP3wI4UUZzvf/gAd/PH4eWEMEkhE=; b=uw4unK0HebuO1NdHrINT6zJiXF0QCDqGOp3VE3+qQ4LQFXeTI+S+K4GVuJFw2MqWWaUfD1 Qk/rcxFUxwZYTY4so3VJQ3DyW90EipaiTDhxqHCrZT1Od1uF+l1UyDEI7sqoOJm8fKdR6o 7EH6FIRxfofHkEqloC0Ir3FQ7OcVW44PkLGhIVHb75BQG5OSzQo9h4DViAFsoN4DWngv5n OYGOiFUByR0KfHF+6wmmilhPyNv51b9a93/jp8BU08CmtKigys5/qieE8udvEouaDQGZ0E 0TBYBBui0u2DnnqtbdJ1tyXuSb2Is0fYvuPVZwnsooZxn1wzlNMrxNPn40fwtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737760237; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=geKoixrXUS7R9xAHP3wI4UUZzvf/gAd/PH4eWEMEkhE=; b=vZav0TF0xlR8WSNmCsuzEDSmWxMeNSAADlSk3pwgwCqudET2NQTUD3KEJa5al/gusTctzJ nDPYgA/9HzGRNhQ1ELlqVVfCR8Hq6d0YhuWqPpxky7X0Mx84A7Z5U87lvA9QdaC+8I96MZ Ln+3drawEWa8pDFWSN1x13aDOeBkSGgE7l8AecW7GL0KExMs29KzZKsiJnnaA7aM+QLem4 PDiUI4ddrGOTET8zbjOf3wkunoMNX81Nz0MLqy3SMiQOch5Bch+grhyOZsioo8CyAPnyli 7gnEzN4mQE3c+7Fb5Jb02ZHmRJNozrZWgwBc4KjaDXHXdyDvWY8zbn3r6lgOfQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737760237; a=rsa-sha256; cv=none; b=yQx+H/hJtju/FtASlY6QEr6l95wHnlXwuLacw5wiJg9Cdi0bQq/ZqhvYT1w5eCpwnf2918 xe9P2sIZ/kFUDir9cShIAp59tEM5m/92AYrM/gEahEAlAhhlZ64Swj5MuaxYEBSpz0kS8D wB/EWbyTWqm3hnaEcS8hOIpy06yqkz6RquQlBv6Bj/f282P56JUmVFzzmtcTA75PSN3VBj 01l5+8NELQRnQmUwlViRo6FrC9PirpzmT1xe7v3TZIcqj/iokkC6tXt8K1ki0f8xT0K+Sx vH5sS69nGSO7hDzKqlqJae2jBd8RmT2QR+H14ihr1aOv2s9V/hJouMW7wAu+Ow== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yftp54lrKzlvw; Fri, 24 Jan 2025 23:10:37 +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 50ONAbc8074512; Fri, 24 Jan 2025 23:10:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50ONAbvN074509; Fri, 24 Jan 2025 23:10:37 GMT (envelope-from git) Date: Fri, 24 Jan 2025 23:10:37 GMT Message-Id: <202501242310.50ONAbvN074509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: 01ff67f4bdf5 - main - mtree: TESTSBASE directory always starts with a / 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: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 01ff67f4bdf5959a719a6511a855f6a60c0e3a93 Auto-Submitted: auto-generated The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=01ff67f4bdf5959a719a6511a855f6a60c0e3a93 commit 01ff67f4bdf5959a719a6511a855f6a60c0e3a93 Author: Jose Luis Duran AuthorDate: 2025-01-24 23:10:05 +0000 Commit: Jose Luis Duran CommitDate: 2025-01-24 23:10:05 +0000 mtree: TESTSBASE directory always starts with a / Remove the extra forward slash ("/"), otherwise the mtree specification file will have the double slash and will not be parsed by makefs when attempting to build NanoBSD with NO_ROOT privileges. Fixes: 07670b30fa43 ("Create /usr/tests *.debug file directory hierarchy") Reviewed by: emaste Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D47722 --- Makefile.inc1 | 2 +- etc/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index efa1299b76a7..4383b4bfe30a 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1506,7 +1506,7 @@ distributeworld installworld stageworld: _installcheck_world .PHONY -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null .if ${MK_DEBUG_FILES} != "no" ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ - -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/${TESTSBASE} >/dev/null + -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug${TESTSBASE} >/dev/null .endif .endif ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \ diff --git a/etc/Makefile b/etc/Makefile index fdcad75911c8..d3cb6b679dc5 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -112,7 +112,7 @@ MTREES+= mtree/BSD.lib${libcompat}.dist /usr/lib/debug/usr .endfor .if ${MK_TESTS} != "no" MTREES+= mtree/BSD.tests.dist ${TESTSBASE} -MTREES+= mtree/BSD.tests.dist /usr/lib/debug/${TESTSBASE} +MTREES+= mtree/BSD.tests.dist /usr/lib/debug${TESTSBASE} .endif .if ${MK_SENDMAIL} != "no" MTREES+= mtree/BSD.sendmail.dist / From nobody Fri Jan 24 23:10:36 2025 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 4Yftp45h6xz5lYDp; Fri, 24 Jan 2025 23:10: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 4Yftp45FG4z3tR5; Fri, 24 Jan 2025 23:10:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737760236; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AV96HPw+eIWFT3k1jdAu9OHgSOPIZZK2sVns5H00Hug=; b=gRoHsHiIAhLarnkQJkBM/VWhNpqubgUpTVRQLpndbBmdrwJbreGg16CU0nbPxcGo44jxUk RjSPJxdTqO2C5W5arqvhNUcAxa9t/zJtZtf9tVZwYj2bpNoPXSlnomDB7ApQ3yRA5SllJQ /cHaLi7DHIlIEmkXKwZ0b/TIPiNkS+kx4oKyEcAlKrjEPFRX06lZNOFQDy7aaFlQT4LxD+ WbNeATcokpH40Y4QHiXBmNjfcjOfN4ipugSA4DaNmzk2C6k1pxAmlbvdl4vsHV3QWQTFF/ 6MKsHK1HjScaF5QzW97AJ9vRG+nws/DX2BCWhAF0qZ50fZbeUU+9pJ0cLY5mNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737760236; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AV96HPw+eIWFT3k1jdAu9OHgSOPIZZK2sVns5H00Hug=; b=N1WMxjrnby1fj7wNNdP+DSsant/xepANJvC88xnDy4H6GqIjSRC1uLJz2HGM5tetJ6lWYU uKkWa7VqLMvDUoqP3iuxX4YnIrhv1VsbdYWDUZ/RmcgsSIAlG+CmhLR25taWkl9/kcUSrr dkrfRDt8BflBm3To5R87ov+HkW8cTgPhKSXFJhvihriRPVyyvCGM4Ngge+lLNJQgK7iBly 0qyPVJyhg01HoWSrA/hQLA66a17AAtJyJTocSyDS/kwB5BZxgzgV/mkasamraFs0uvVQ3p OdNgsqFw9OGBmdDoA174dxSfRNoclSpGyvXVaJr5yIVCxQzF1mn1QJ6rFxCZVA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737760236; a=rsa-sha256; cv=none; b=p9FH9fLo1H+88juCzTktCcaEAuXGhe+u5xkn7LuoJ/PRczHdajSm7Rgpz0G51Mz3qrMei2 JvlAwkRcdrJLWEmK7C3eihFtQUU9Bzye6lKY7bi8RqyBbS7ZOFOUQ6bXM+WfeSWYHryRCb yR8R3C+TgObdz86EQ2tmSrbAlsOUi7ao9N7NXDQaRISnI4l3lEEZcf5NCrQ7QTI0WY1DWF 1Y2lSIWjtG5JNy8PXMsoSzCcFXcSyZaUxEtV0pyezMOITlOt9mH9c4TyeSs7NUqXTn8NtT ULhifNaDVgamE6SmZ1V/E6tlQ9jSMbpEMXpeOgSsgHKLmiMlrDJsUJ4J8MhUFQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yftp44NMFzmB9; Fri, 24 Jan 2025 23:10:36 +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 50ONAaUr074475; Fri, 24 Jan 2025 23:10:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50ONAa45074472; Fri, 24 Jan 2025 23:10:36 GMT (envelope-from git) Date: Fri, 24 Jan 2025 23:10:36 GMT Message-Id: <202501242310.50ONAa45074472@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: e7142d455eeb - main - mtree: Align BSD.usr.dist keywords 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: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e7142d455eeb6bce6e90e5e6031bf1e868e6f5b6 Auto-Submitted: auto-generated The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=e7142d455eeb6bce6e90e5e6031bf1e868e6f5b6 commit e7142d455eeb6bce6e90e5e6031bf1e868e6f5b6 Author: Jose Luis Duran AuthorDate: 2025-01-24 23:09:41 +0000 Commit: Jose Luis Duran CommitDate: 2025-01-24 23:09:41 +0000 mtree: Align BSD.usr.dist keywords Reviewed by: emaste Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D47721 --- etc/mtree/BSD.usr.dist | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index 9fd0cf326bdf..91500c99271c 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -210,9 +210,9 @@ calendar .. certs - trusted tags=package=caroot + trusted tags=package=caroot .. - untrusted tags=package=caroot + untrusted tags=package=caroot .. .. dict @@ -222,7 +222,7 @@ .. atf tags=package=tests .. - kyua tags=package=tests + kyua tags=package=tests .. legal .. @@ -318,7 +318,7 @@ .. .. .. - kyua tags=package=tests + kyua tags=package=tests .. libusb20 .. @@ -455,16 +455,16 @@ .. keys pkg - revoked tags=package=runtime + revoked tags=package=runtime .. - trusted tags=package=runtime + trusted tags=package=runtime .. .. .. - kyua tags=package=tests - misc tags=package=tests + kyua tags=package=tests + misc tags=package=tests .. - store tags=package=tests + store tags=package=tests .. .. locale From nobody Fri Jan 24 23:22:24 2025 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 4Yfv3y6XFpz5lYq3 for ; Fri, 24 Jan 2025 23:22:38 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 4Yfv3y3T97z3wBP for ; Fri, 24 Jan 2025 23:22:38 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4363ae65100so28005685e9.0 for ; Fri, 24 Jan 2025 15:22:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737760957; x=1738365757; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4yOIwFP9tIaXY3rlOwjSJHGZQH1vIu9fAgJsxenS3zg=; b=IXytceGhmsHRXQHAsolRpTk16KE6ucK+fAA9ztPa3XNFAcdVSpRYUrevnKeJH9oU02 jX3tUx4mPldctOi29p3uDcJFNfQ2/VT8SSZjbcIG0cwr3ilz63QBWTO7zkOhkhbyotRY zjLnz/ZjT02DpNfEOAupYcX5iHYpBKZC6Mv7U6uhTzCmxg2eYThdEqSH/GYPYo+cTHFx glgpxDSefx6YHrcP3jrcmh/RbA/1W86oH7WlfuhfqslD4Biz2AothAq6a6dcteZt2mx0 gMOPrwG68HLgL6sEmHKIZrUb4nxGS7wqW6utuSJpw9KckSQWkcUX96sRc/wETwtCOqBu gAjA== X-Forwarded-Encrypted: i=1; AJvYcCUKYJr+Snq5hqShOzuOnv6dEp3la/uahsJtddEALQtDOmqUm0NWDhm+8/5Ajxz5sT50AmXIQTXeyWp0MSO1gEEdMxvI4g==@freebsd.org X-Gm-Message-State: AOJu0YzdCtvrbPgjt8xbK5HKESSOTZB22RvrbqIJYHrUb5YIViAR+Kbu w9uygLD0NdR4O0qVHMsqcSfBjcLKaQnKGo+xZf1e3r8k1ykAjMWwScG2JaWpZfNJ9DeGjRiUBG+ 0 X-Gm-Gg: ASbGncvqxulHPPrb+R2Wn4my2pUqCp1qTTUB93KrcVS9shLADenqq3qDjOL0vKOs5hb MxBaiSUSHyaNThhZt2K0H3BcUEX8zG5ny6gSI3UAL6Thf3HErJNqiSsszBhmyUQkYmzVXDEg+82 yYzJuqMlWl230PIpjYGr4coOYtwGi5hR6nSAZ5IklNyXT5ld80zqfo0rg43jFl1uO4tM07DyiXG phwNfxaJ+o4Jejkw9eo7YNJi7jLXKhWUkYmsFV9cSZM4Luo1kf4mZ3L40a9qMdOm6ojHe9BmghC 8HuxYyYKcV3TQFcogDT+pJbFeCwQ7Q== X-Google-Smtp-Source: AGHT+IGk47TqCu7dfUmtjgzIwBYJ7EMcr4Yk76ix5uQMRH3S3dJI4hEVwpEJJMpprzeIpIO5XFyWrA== X-Received: by 2002:a05:600c:468d:b0:431:542d:2599 with SMTP id 5b1f17b1804b1-4389143b715mr289751535e9.22.1737760956480; Fri, 24 Jan 2025 15:22:36 -0800 (PST) Received: from smtpclient.apple ([131.111.5.201]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd501c2dsm40719945e9.13.2025.01.24.15.22.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jan 2025 15:22:35 -0800 (PST) Content-Type: text/plain; charset=utf-8 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 (Mac OS X Mail 16.0 \(3826.300.87.4.3\)) Subject: Re: git: 01ff67f4bdf5 - main - mtree: TESTSBASE directory always starts with a / From: Jessica Clarke In-Reply-To: <202501242310.50ONAbvN074509@gitrepo.freebsd.org> Date: Fri, 24 Jan 2025 23:22:24 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202501242310.50ONAbvN074509@gitrepo.freebsd.org> To: Jose Luis Duran X-Mailer: Apple Mail (2.3826.300.87.4.3) X-Rspamd-Queue-Id: 4Yfv3y3T97z3wBP 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:15169, ipnet:209.85.128.0/17, country:US] On 24 Jan 2025, at 23:10, Jose Luis Duran wrote: >=20 > The branch main has been updated by jlduran: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D01ff67f4bdf5959a719a6511a855f6a6= 0c0e3a93 >=20 > commit 01ff67f4bdf5959a719a6511a855f6a60c0e3a93 > Author: Jose Luis Duran > AuthorDate: 2025-01-24 23:10:05 +0000 > Commit: Jose Luis Duran > CommitDate: 2025-01-24 23:10:05 +0000 >=20 > mtree: TESTSBASE directory always starts with a / >=20 > Remove the extra forward slash ("/"), otherwise the mtree = specification > file will have the double slash and will not be parsed by makefs = when > attempting to build NanoBSD with NO_ROOT privileges. Not sure why you=E2=80=99re having issues with this. I can see the = duplicate slashes do indeed end up in CheriBSD=E2=80=99s METALOG, but the in-tree = makefs produces a disk image just fine from that. Doesn=E2=80=99t mean I=E2=80=99m against fixing our build though :) Jess > Fixes: 07670b30fa43 ("Create /usr/tests *.debug file directory = hierarchy") > Reviewed by: emaste > Approved by: emaste (mentor) > Differential Revision: https://reviews.freebsd.org/D47722 > --- > Makefile.inc1 | 2 +- > etc/Makefile | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/Makefile.inc1 b/Makefile.inc1 > index efa1299b76a7..4383b4bfe30a 100644 > --- a/Makefile.inc1 > +++ b/Makefile.inc1 > @@ -1506,7 +1506,7 @@ distributeworld installworld stageworld: = _installcheck_world .PHONY > -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null > .if ${MK_DEBUG_FILES} !=3D "no" > ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ > - -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/${TESTSBASE} = >/dev/null > + -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug${TESTSBASE} = >/dev/null > .endif > .endif > ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | = \ > diff --git a/etc/Makefile b/etc/Makefile > index fdcad75911c8..d3cb6b679dc5 100644 > --- a/etc/Makefile > +++ b/etc/Makefile > @@ -112,7 +112,7 @@ MTREES+=3D mtree/BSD.lib${libcompat}.dist = /usr/lib/debug/usr > .endfor > .if ${MK_TESTS} !=3D "no" > MTREES+=3D mtree/BSD.tests.dist ${TESTSBASE} > -MTREES+=3D mtree/BSD.tests.dist /usr/lib/debug/${TESTSBASE} > +MTREES+=3D mtree/BSD.tests.dist /usr/lib/debug${TESTSBASE} > .endif > .if ${MK_SENDMAIL} !=3D "no" > MTREES+=3D mtree/BSD.sendmail.dist / From nobody Fri Jan 24 23:39:51 2025 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 4YfvS45D4Fz5lZJC; Fri, 24 Jan 2025 23:40:04 +0000 (UTC) (envelope-from jlduran@gmail.com) Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) (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 4YfvS418Zmz3xmS; Fri, 24 Jan 2025 23:40:04 +0000 (UTC) (envelope-from jlduran@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-e3c88163a00so453864276.2; Fri, 24 Jan 2025 15:40:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737762003; x=1738366803; h=content-transfer-encoding:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=cHYA+1PUIDy1xM70KT++xD2NnG1PZv+Mv75fCj+YG20=; b=PePWi3cj6NbN5tdvROElbSMVt8+/nPLf6U/B4zNvrSR6IHkfEzHd6KrIewLUZDlx21 wg8n196os86tvl081qhK1YPMM6sBetpUSXs3mrANewMZ8yiL9gCzqJnLXYG3+YOgxwaS zV6xDHYmYl6FH3fkLuTTpRwPOw+cF2m+APAwQ2CGijf9PQxU+Yu0RIps9a1Q5rPqQH7y 6PEsqp3B/6Hyo4EQhVGrI9aQ7N0xV8TD/Bov8TfqdteK/LKls/XCOFcm/kCHLblDL+8i tAwxlrmTrUpxXHodT/SPIZrWCP7qew0fzAjkSRjCtQFxYgPC0MNMLWbVe1hG+alzVwdE Ry1Q== X-Forwarded-Encrypted: i=1; AJvYcCWJdKVOQ++34muveTk5/61ASKERZsMVj5Y9jsuIy4pxc/HWJG/Bu7O2pzrbQKjfwdUsrOe2GY4zVU2Ku05xEoDE68Oq3+4=@freebsd.org, AJvYcCWLgUkhEy6xGFoelLiKEIJiir73qczKV/Np/CKxSZ2KLfryvMe6bp8y2X91CRKNEHkhEOUKnXdWCZkWLPu1/TsfSytB@freebsd.org X-Gm-Message-State: AOJu0YxU4myfU/m6hSollf6nOL26vPYlJazDxqACIpxbyISBaik9/+v7 uQDoz0eLcvkjxH8k0CU8XlwccHWmjMqhH5qk5hEuvxy+k25p6CQGmGL0jg== X-Gm-Gg: ASbGncu7qqgceS2aR1NkCm7dhdL1E97N559/9cX1A95Nw7yqnJAoJffiwUVY9cxauAA G6LGZOs3S6sXi8f8Ch3VLccH82aIsrwiBPqrZMJmQA3ly55U8NSKynustD9kvhiSe7Mb8cfVC0q +UxNG84DxxaT4lBvRtWiSy+JsWnAzV0xzfnswobpSu6eaDj98IlZSCu50Iz+kp5V0sVJTLSeHXL BUs5omG5W/5msYRIbXeiBB96dpcr03+OVUP2PJLrVGVW39VEw83rFVwrq7T11hX4iM/bGm54SvG PKhiThnrxAl2L9JxUWFS6DNkDVmyUhzf2BMNZzaOm1awNw== X-Google-Smtp-Source: AGHT+IGNjPUj502m+WbTEphvFp4yDPKVvE3nMvf9jtdPqOxj++Qoe1fSQsoIOkXUr6yV0vCJwkFGeQ== X-Received: by 2002:a05:6902:1614:b0:e38:b7b8:51a8 with SMTP id 3f1490d57ef6-e57b1364842mr10618598276.7.1737762002860; Fri, 24 Jan 2025 15:40:02 -0800 (PST) Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com. [209.85.219.174]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e583b746626sm554152276.7.2025.01.24.15.40.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Jan 2025 15:40:02 -0800 (PST) Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-e422de4d1c5so425232276.3; Fri, 24 Jan 2025 15:40:02 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCX1KdfaBc3tPoeQ8asXBMHtYyBdKQYVjQMwRI6OTnQCTuf+XyEvVtBAz5LDNX/pbP8N9Sj90wG0+WHD7Sh7Sf4VzMmG@freebsd.org, AJvYcCXI6AlJ+0uTvdAWB/o+YJn9Fjfs3e4LJd5Hb5KFvL8rABPKzO4fA/5oTKRvRO9p1IJhGDLUYebv0b5BybnJH3aMZjH75yg=@freebsd.org X-Received: by 2002:a05:690c:7342:b0:6f2:9533:8fb6 with SMTP id 00721157ae682-6f6eb661175mr102909067b3.1.1737762002245; Fri, 24 Jan 2025 15:40:02 -0800 (PST) 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: <202501242310.50ONAbvN074509@gitrepo.freebsd.org> In-Reply-To: Reply-To: jlduran@freebsd.org From: Jose Luis Duran Date: Fri, 24 Jan 2025 20:39:51 -0300 X-Gmail-Original-Message-ID: X-Gm-Features: AWEUYZkQkULc-iVrJ_DxAmKP-Kx8sij6ZxrxI14x_g8I7IhYrHDZx5yK6HsBKa0 Message-ID: Subject: Re: git: 01ff67f4bdf5 - main - mtree: TESTSBASE directory always starts with a / To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4YfvS418Zmz3xmS 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:15169, ipnet:209.85.128.0/17, country:US] On Fri, Jan 24, 2025 at 8:22=E2=80=AFPM Jessica Clarke = wrote: > > On 24 Jan 2025, at 23:10, Jose Luis Duran wrote: > > > > The branch main has been updated by jlduran: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D01ff67f4bdf5959a719a6511= a855f6a60c0e3a93 > > > > commit 01ff67f4bdf5959a719a6511a855f6a60c0e3a93 > > Author: Jose Luis Duran > > AuthorDate: 2025-01-24 23:10:05 +0000 > > Commit: Jose Luis Duran > > CommitDate: 2025-01-24 23:10:05 +0000 > > > > mtree: TESTSBASE directory always starts with a / > > > > Remove the extra forward slash ("/"), otherwise the mtree specificat= ion > > file will have the double slash and will not be parsed by makefs whe= n > > attempting to build NanoBSD with NO_ROOT privileges. > > Not sure why you=E2=80=99re having issues with this. I can see the duplic= ate > slashes do indeed end up in CheriBSD=E2=80=99s METALOG, but the in-tree m= akefs > produces a disk image just fine from that. In my case, I receive the following error: makefs: ./usr/lib/debug//usr: missing directory in specification makefs: failed at line 5988 of the specification I have yet to dig deeper, as a double slash should not be considered invalid by makefs' mtree. The "right" thing to do is what brooks suggested, to create libmtree, and just use it for everything mtree-related. For now, the simplest thing is just to remove it. Regards, > > Doesn=E2=80=99t mean I=E2=80=99m against fixing our build though :) > > Jess > > > Fixes: 07670b30fa43 ("Create /usr/tests *.debug file directory hier= archy") > > Reviewed by: emaste > > Approved by: emaste (mentor) > > Differential Revision: https://reviews.freebsd.org/D47722 > > --- > > Makefile.inc1 | 2 +- > > etc/Makefile | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/Makefile.inc1 b/Makefile.inc1 > > index efa1299b76a7..4383b4bfe30a 100644 > > --- a/Makefile.inc1 > > +++ b/Makefile.inc1 > > @@ -1506,7 +1506,7 @@ distributeworld installworld stageworld: _install= check_world .PHONY > > -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null > > .if ${MK_DEBUG_FILES} !=3D "no" > > ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ > > - -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/${TESTSBASE} >/dev/= null > > + -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug${TESTSBASE} >/dev/n= ull > > .endif > > .endif > > ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \ > > diff --git a/etc/Makefile b/etc/Makefile > > index fdcad75911c8..d3cb6b679dc5 100644 > > --- a/etc/Makefile > > +++ b/etc/Makefile > > @@ -112,7 +112,7 @@ MTREES+=3D mtree/BSD.lib${libcompat}.dist /usr/lib/= debug/usr > > .endfor > > .if ${MK_TESTS} !=3D "no" > > MTREES+=3D mtree/BSD.tests.dist ${TESTSBASE} > > -MTREES+=3D mtree/BSD.tests.dist /usr/lib/debug/${TESTSBASE} > > +MTREES+=3D mtree/BSD.tests.dist /usr/lib/debug${TESTSBASE} > > .endif > > .if ${MK_SENDMAIL} !=3D "no" > > MTREES+=3D mtree/BSD.sendmail.dist / > --=20 Jose Luis Duran From nobody Sat Jan 25 00:10:00 2025 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 4Yfw6c6rLGz5lcgH; Sat, 25 Jan 2025 00:10: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 4Yfw6c66P7z45VW; Sat, 25 Jan 2025 00:10:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737763800; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uhVxWp5Ac6iWreiqJigkvpPnk15NVry3bwuu1+ArluI=; b=RJ2tUfFP6/jz9wol7CZjNPXt5Na1AcH55bvjY+PUrhCbTgPaSvXUsRbIHfI/dCwpUmw685 Q0XJU7DveWzTtPTDFB8yVt+MP6DPC6bvoCG7d7lpjHFFBpI0In44AqWA6st2MJ94MNdPHB nWqRX6OhI7pSW8PcL0ShKdkXwhhr1/O9TLo2jiaWJScVqxHk7BhB/bgR+1ceY1qG1aRtKd d9Ef1xn289ZHUaN5t7SPxKg8nGcSKF5dtSrDXsrsYLJGjLBr3KCq5qfBFk7ypLBeuAQHMA ZymesNr4EN4C5WNrKTj1QH4R2f25JsAOaVq9paTHvC2PZLosrSXj8oo4JYvNVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737763800; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uhVxWp5Ac6iWreiqJigkvpPnk15NVry3bwuu1+ArluI=; b=o6XAw032S1sBAF7+hRzE36BHcYtgvaWeEzM5yoN2FLq2UjUOVMrxGYvSC1M37uhZkOrr7W DGU8/La4z5bt3Mg1cV3Dy9RE6ZHv7I1J0/egGaR8Jvnf3t+NNRueI/9wB1T3fyM+PLh9mt +iqWvSSzHN7qgIgMaBwryJDRsbL4sIQEX+nxd0fbmGXju7IjJZpeUsXHmK2j6gepmAcqcq BCxZm7GxW9wVoMH6yKAzx1mM79amXvtU6DbqgNGxCPc6jR0HZPDGIgTja/WG2105LU1NdG uZe9CkwBGn5hxqkuwJbnyqOPZNk48HvtlRnjAdSWz4WgfqiQPBejXEFVGXN8zw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737763800; a=rsa-sha256; cv=none; b=xQpNcZNPnW6z2sc4jryr5drPTkSaqPlxwkYXvJJusSBbScMO/2ZM1ooAlR66oa+Hh/nEvN AwA0LwtxcO0G/4wnuMd5TTm+EvTO2kKj1vZDSfBa892K6CGlW3ZQI5ip3wqhz8OhbbP/IF HigSLNz8dxjqwzGQRd2hVpaJjNqXSSNlsvTpiBrNHAZUR5VUw6XB7cdd2m9COXa+AjD0WZ WtjzTyukC0FpT0OKCamnwOhuMdOyA+UTNSADb9GXF7FJ/AGsBsK8t3tB86LWpX9Pus/Q+C G5JwXpPAft6iOsGktNwYFS7AY4getfkgflJzUQCv4EmzVB70+2OS+50dy1PZGg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yfw6c58N9zp1q; Sat, 25 Jan 2025 00:10: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 50P0A0bF079303; Sat, 25 Jan 2025 00:10:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50P0A0te079279; Sat, 25 Jan 2025 00:10:00 GMT (envelope-from git) Date: Sat, 25 Jan 2025 00:10:00 GMT Message-Id: <202501250010.50P0A0te079279@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: 46a9fb7287f4 - main - man.1: Improve search + 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: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 46a9fb7287f41eedf321d81a68a826f231d11bfe Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=46a9fb7287f41eedf321d81a68a826f231d11bfe commit 46a9fb7287f41eedf321d81a68a826f231d11bfe Author: Alexander Ziaee AuthorDate: 2024-09-28 03:07:07 +0000 Commit: Alexander Ziaee CommitDate: 2025-01-25 00:07:01 +0000 man.1: Improve search + spdx People are often stunned by robust manual search functionality on the community discord, so improve introductory doc regarding search by: + explain what search related flags do instead of using similies + consolidate and standardize search options in synopsis and usage + mention that a page or file can be specified in synopsis and example + call regular expressions `expression`, which searches to re_format(7) + crossreference the regular expression manual instead of egrep(1) + improve MANPATH xref flow and explanation, matching MAILPATH in sh(1) + mark up aditional semantics for their inclusion in apropos While here: + use consistent spacing and form (Ql) for quoted literals + clean a few linter errors regarding self xref and nospace + reset a list width to indent for consistency with style.mdoc + tidy examples + align files + tag spdx Outstanding: - example 3 shows no results on a typical bsdinstall'd system MFC after: 3 days Reviewed by: elliejs, emaste, imp, Jessica Hawkwell, jlduran Approved by: imp --- usr.bin/man/man.1 | 140 ++++++++++++++++++++++++++--------------------------- usr.bin/man/man.sh | 5 +- 2 files changed, 71 insertions(+), 74 deletions(-) diff --git a/usr.bin/man/man.1 b/usr.bin/man/man.1 index 24d9214682f1..820d6a5b33a9 100644 --- a/usr.bin/man/man.1 +++ b/usr.bin/man/man.1 @@ -1,4 +1,6 @@ .\"- +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 2010 Gordon Tetlow .\" All rights reserved. .\" @@ -23,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 26, 2022 +.Dd January 24, 2025 .Dt MAN 1 .Os .Sh NAME @@ -39,16 +41,10 @@ .Op Fl m Ar arch Ns Op : Ns Ar machine .Op Fl p Op Ar eprtv .Op Ar mansect -.Ar page ... -.Nm -.Fl K -.Ar regexp ... -.Nm -.Fl f -.Ar keyword ... +.Ar page | Ar .Nm -.Fl k -.Ar keyword ... +.Fl K | f | k +.Ar expression ... .Sh DESCRIPTION The .Nm @@ -60,6 +56,7 @@ is provided, restricts the search to the specific section of the manual. .Pp The sections of the manual are: +.Pp .Bl -enum -offset indent -compact .It .Fx @@ -94,37 +91,36 @@ Options that .Nm understands: .Bl -tag -width indent -.It Fl K Ar regexp -Does a full text search in all manual pages. -.Ar regexp -is a regular expression as understood by -.Dq Li "grep -E" . +.It Fl K Ar expression +Search full text of all manual pages for an extended regular +.Ar expression , +as described in +.Xr re_format 7 . This option requires .Xr mandoc 1 . This is a slow operation. .It Fl M Ar manpath -Forces a specific colon separated manual path instead of the default +Force a specific colon separated manual path instead of the default search path. See -.Xr manpath 1 . -Overrides the .Ev MANPATH -environment variable. +in +.Sx ENVIRONMENT . .It Fl P Ar pager Use specified pager. Defaults to -.Dq Li "less -sR" +.Ql less -sR if color support is enabled, or -.Dq Li "less -s" . +.Ql less -s . Overrides the .Ev MANPAGER environment variable, which in turn overrides the .Ev PAGER environment variable. .It Fl S Ar mansect -Restricts manual sections searched to the specified colon delimited list. +Restrict manual sections searched to the specified colon delimited list. Defaults to -.Dq Li 1:8:2:3:3lua:n:4:5:6:7:9:l . +.Ql 1:8:2:3:3lua:n:4:5:6:7:9:l . Overrides the .Ev MANSECT environment variable. @@ -136,13 +132,17 @@ argument. Print extra debugging information. Repeat for increased verbosity. Does not display the manual page. -.It Fl f -Emulate +.It Fl f Ar expression +Search names of all manual pages for an extended regular +.Ar expression , +emulating .Xr whatis 1 . .It Fl h Display short help message and exit. -.It Fl k -Emulate +.It Fl k Ar expression +Search names and descriptions of all manual pages for an extended regular +.Ar expression , +emulating basic functionality of .Xr apropos 1 . .It Fl m Ar arch Ns Op : Ns Ar machine Override the default architecture and machine settings allowing lookup of @@ -212,17 +212,17 @@ will search for locale specific manual pages using the following logic: .Pp .Bl -item -offset indent -compact .It -.Va lang Ns _ Ns Va country Ns . Ns Va charset +.Va lang Ns _ Ns Va country . Ns Va charset .It -.Va lang Ns . Ns Va charset +.Va lang . Ns Va charset .It -.Li en Ns . Ns Va charset +.Li en . Ns Va charset .El .Pp For example, if .Ev LC_ALL is set to -.Dq Li ja_JP.eucJP , +.Ql ja_JP.eucJP , .Nm will search the following paths when considering section 1 manual pages in .Pa /usr/share/man : @@ -251,11 +251,11 @@ environment variables. For example, if .Ev MACHINE_ARCH is set to -.Dq Li aarch64 +.Ql aarch64 and .Ev MACHINE is set to -.Dq Li arm64 , +.Ql arm64 , .Nm will search the following paths when considering section 4 manual pages in .Pa /usr/share/man : @@ -278,8 +278,8 @@ character. .Sh ENVIRONMENT The following environment variables affect the execution of .Nm : -.Bl -tag -width ".Ev MANROFFSEQ" -.It Ev LC_ALL , LC_CTYPE , LANG +.Bl -tag -width indent +.It Ev LC_ALL , Ev LC_CTYPE , Ev LANG Used to find locale specific manual pages. Valid values can be found by running the .Xr locale 1 @@ -290,12 +290,12 @@ for details. Influenced by the .Fl o option. -.It Ev MACHINE_ARCH , MACHINE +.It Ev MACHINE_ARCH , Ev MACHINE Used to find platform specific manual pages. If unset, the output of -.Dq Li "sysctl hw.machine_arch" +.Ql sysctl Va hw.machine_arch and -.Dq Li "sysctl hw.machine" +.Ql sysctl Va hw.machine is used respectively. See .Sx IMPLEMENTATION NOTES @@ -304,11 +304,9 @@ Corresponds to the .Fl m option. .It Ev MANPATH -The standard search path used by -.Xr man 1 -may be changed by specifying a path in the -.Ev MANPATH -environment variable. +A colon +.Pq Ql \&: +separated list of directories to check for manual pages. Invalid paths, or paths without manual databases, are ignored. Overridden by .Fl M . @@ -320,6 +318,8 @@ or if it contains two adjacent colons, the standard search path is inserted between the colons. If none of these conditions are met, it overrides the standard search path. +See +.Xr manpath 1 . .It Ev MANROFFSEQ Used to determine the preprocessors for the manual source before running .Xr nroff 1 Pq Pa ports/textproc/groff @@ -338,7 +338,7 @@ option. .It Ev MANWIDTH If set to a numeric value, used as the width manpages should be displayed. Otherwise, if set to a special value -.Dq Li tty , +.Ql tty , and output is to a terminal, the pages may be displayed over the whole width of the screen. .It Ev MANCOLOR @@ -347,68 +347,65 @@ If set, enables color support. Program used to display files. .Pp If unset, and color support is enabled, -.Dq Li "less -sR" +.Ql less -sR is used. .Pp If unset, and color support is disabled, then .Ev PAGER is used. If that has no value either, -.Dq Li "less -s" +.Ql less -s is used. .El .Sh FILES -.Bl -tag -width indent -compact +.Bl -tag -width "/usr/local/etc/man.d/*.conf" -compact .It Pa /etc/man.conf -System configuration file. +System configuration file .It Pa /usr/local/etc/man.d/*.conf -Local configuration files. +Local configuration files .El .Sh EXIT STATUS .Ex -std .Sh EXAMPLES Show the manual page for .Xr stat 2 : -.Bd -literal -offset indent -$ man 2 stat -.Ed +.Pp +.Dl $ man 2 stat .Pp Show all manual pages for -.Ql stat . -.Bd -literal -offset indent -$ man -a stat -.Ed +.Ql stat : +.Pp +.Dl $ man -a stat .Pp List manual pages which match the regular expression either in the title or in the body: -.Bd -literal -offset indent -$ man -k '\e.*archive' -.Ed +.Pp +.Dl $ man -k '\e.*archive' .Pp Show the manual page for .Xr ls 1 -and use +using .Xr cat 1 -as pager: -.Bd -literal -offset indent -$ man -P cat ls -.Ed +as the pager: +.Pp +.Dl $ man -P cat ls .Pp Show the location of the .Xr ls 1 manual page: -.Bd -literal -offset indent -$ man -w ls -.Ed +.Pp +.Dl $ man -w ls +.Pp +Show a manual page in the current working directory: +.Pp +.Dl $ man ./man.1 .Pp Show the location of manual pages in sections 1 and 8 which contain the word .Ql arm : -.Bd -literal -offset indent -$ ./man -w -K '\e' -S 1:8 -.Ed +.Pp +.Dl $ man -w -K '\e' -S 1:8 .Sh SEE ALSO .Xr apropos 1 , -.Xr egrep 1 , .Xr intro 1 , .Xr mandoc 1 , .Xr manpath 1 , @@ -422,5 +419,6 @@ $ ./man -w -K '\e' -S 1:8 .Xr intro 6 , .Xr intro 7 , .Xr mdoc 7 , +.Xr re_format 7 , .Xr intro 8 , .Xr intro 9 diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh index f4037ed92215..68a4b3a40588 100755 --- a/usr.bin/man/man.sh +++ b/usr.bin/man/man.sh @@ -739,10 +739,9 @@ man_setup_locale() { # Display usage for the man utility. man_usage() { echo 'Usage:' - echo ' man [-adho] [-t | -w] [-K regexp] [-M manpath] [-P pager] [-S mansect]' + echo ' man [-adho] [-t | -w] [-M manpath] [-P pager] [-S mansect]' echo ' [-m arch[:machine]] [-p [eprtv]] [mansect] page [...]' - echo ' man -f page [...] -- Emulates whatis(1)' - echo ' man -k page [...] -- Emulates apropos(1)' + echo ' man -K | -f | -k expression [...] -- Search manual pages' # When exit'ing with -h, it's not an error. exit ${1:-1} From nobody Sat Jan 25 03:41:21 2025 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 4Yg0pf0wW4z5lt1f; Sat, 25 Jan 2025 03:41:30 +0000 (UTC) (envelope-from maxim@freebsd.org) Received: from maxim.int.ru (maxim.int.ru [167.71.75.67]) (using TLSv1.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 (2048 bits) client-digest SHA256) (Client CN "maxim.int.ru", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yg0pd5S1xz43Cf; Sat, 25 Jan 2025 03:41:29 +0000 (UTC) (envelope-from maxim@freebsd.org) Authentication-Results: mx1.freebsd.org; none Received: from localhost (localhost [127.0.0.1]) by maxim.int.ru (8.18.1/8.18.1) with ESMTPS id 50P3fLRL040343 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 25 Jan 2025 03:41:21 GMT (envelope-from maxim@freebsd.org) Date: Sat, 25 Jan 2025 03:41:21 +0000 (UTC) From: Maxim Konovalov To: Mark Johnston cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 04a3ca71ead6 - main - netcat: Add a flag to enable the use of SO_REUSEPORT_LB In-Reply-To: <202501241648.50OGmSre051436@gitrepo.freebsd.org> Message-ID: <2a951d1e-8796-6096-19ad-d0d98a84e5ec@maxim.int.ru> References: <202501241648.50OGmSre051436@gitrepo.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=US-ASCII X-Rspamd-Queue-Id: 4Yg0pd5S1xz43Cf 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:14061, ipnet:167.71.64.0/20, country:US] On Fri, 24 Jan 2025, 16:48-0000, Mark Johnston wrote: > The branch main has been updated by markj: > > URL: https://cgit.FreeBSD.org/src/commit/?id=04a3ca71ead61b4ced23a791d3a5e2633ca1ef72 > > commit 04a3ca71ead61b4ced23a791d3a5e2633ca1ef72 > Author: Mark Johnston > AuthorDate: 2025-01-24 16:37:43 +0000 > Commit: Mark Johnston > CommitDate: 2025-01-24 16:37:43 +0000 > > netcat: Add a flag to enable the use of SO_REUSEPORT_LB > > This is handy for testing purposes. Hide it behind a long option so > that it doesn't conflict with upstream, like we do with several other > flags. > > Reviewed by: imp, glebius, delphij > MFC after: 2 weeks > Sponsored by: Klara, Inc. > Sponsored by: Stormshield > Differential Revision: https://reviews.freebsd.org/D48543 [...] A nice one! -- Maxim Konovalov From nobody Sat Jan 25 10:32:43 2025 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 4Yg9x80ylYz5mMcC; Sat, 25 Jan 2025 10:32: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 4Yg9x80PtQz3cbp; Sat, 25 Jan 2025 10:32:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737801164; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Hs7eH2Fy6k+MqT0mXuvovmvYZdFvu7jyE5QGpsBtOVw=; b=IBjNk/gJfBMG/chH4Vk6Yl6tB/q0w58BR38YQxNJerX5RNezjd89OCLWlqOdDChEPBvMJy c0gRE5/qRIewNEQ5jxbV0WvquF7+0qyjKDDb+RcQN764okzTR0tDsGbevN21cozncfmFjZ MiELNo42tQfCfFk7BhD3Y5D6TRDE7tEWftJCZomeAS376fmq0pcrUQa7y7soXD+OC9mqIc ydxd2vZWc1BhGTrJiK2lcMzw5AwpIjsdkSE96IQA6ZmzPqVfEakScP3JYfLJrLqKXxt2Ww dbbWQO0bikp8Kwot56Rqoda/e1dCVQJPlXm9sdcz7G+zRlF7vgbr05JXAzN7pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737801164; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Hs7eH2Fy6k+MqT0mXuvovmvYZdFvu7jyE5QGpsBtOVw=; b=XFvt5+kq24Pd8GOjIqhx43plcRWnpUHf4IMk2+Aae5eqPcyJu+EZ/dFcoN86uDS+8mYT87 z2glr4CRqM/r5fVWitv+0YQGvE/jNi9sIK2GPL5+bqHWlRfXOH43gDNCydNUuW6MOGqnUA SADxlLM3pCzoVA58VlHyDdLzFOX4Z4NTx7MWWE7mEYjGh0U0zin8d4JJ0XzezylMSxj2Mx rFjd+HbtchgWz7yY1BTOTzjuVGQFXMDQJsYHVthRw3jImmdMHn5kiFRLZEEJGAM8c2JuKm BxIxv91AOirvPrXH6xJX8VHJTrUqGX/j+flXYokfcEzVj7p6uuJbbUnP+pNTvw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737801164; a=rsa-sha256; cv=none; b=GYAaZ7wDg66qR0HGUymtUDg5aSrXfNO3FVN/Rq8F1V/URXD0izxUog5Bhg2SPRf9o/Zssx H9OnrzOxZXLDtisRuG8hb0OAioa9PRA+L2OcI39zL2Ukyx8blTX4N3dCf+poM3y28q2HVZ 9+XOOVtdzyciwxwuJe6AebDOLcfvqypsxamtWfp7UqcUkPGB14+HtemGuonc93/Ycxqyt/ Meu0+D4QnpBPa43KloodQBDIhHd98lAJmSJcQr8AifDi/3nIk8GjxiIMsetfE21l8fiZkK fHiYMLq31RPHUu8W0uno5XWYJAC1CGoXjTwSV2mjGbQ2lh3lyTNc+UsfRiwxVg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yg9x800wTz17QV; Sat, 25 Jan 2025 10:32: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 50PAWhnO057766; Sat, 25 Jan 2025 10:32:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50PAWhFG057763; Sat, 25 Jan 2025 10:32:43 GMT (envelope-from git) Date: Sat, 25 Jan 2025 10:32:43 GMT Message-Id: <202501251032.50PAWhFG057763@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 7bb9ba61d357 - main - ip6addrctl(8): Use static initializer 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7bb9ba61d35703c8a819c3745b8a2b1feb56923d Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=7bb9ba61d35703c8a819c3745b8a2b1feb56923d commit 7bb9ba61d35703c8a819c3745b8a2b1feb56923d Author: Zhenlei Huang AuthorDate: 2025-01-25 10:31:55 +0000 Commit: Zhenlei Huang CommitDate: 2025-01-25 10:31:55 +0000 ip6addrctl(8): Use static initializer MFC after: 1 week --- usr.sbin/ip6addrctl/ip6addrctl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/usr.sbin/ip6addrctl/ip6addrctl.c b/usr.sbin/ip6addrctl/ip6addrctl.c index 13413fefa8ce..146b2f1ad3e0 100644 --- a/usr.sbin/ip6addrctl/ip6addrctl.c +++ b/usr.sbin/ip6addrctl/ip6addrctl.c @@ -58,7 +58,7 @@ struct policyqueue { struct in6_addrpolicy pc_policy; }; TAILQ_HEAD(policyhead, policyqueue); -static struct policyhead policyhead; +static struct policyhead policyhead = TAILQ_HEAD_INITIALIZER(policyhead); static void usage(void) __dead2; static void get_policy(void); @@ -75,8 +75,6 @@ static void flush_policy(void); int main(int argc, char *argv[]) { - TAILQ_INIT(&policyhead); - if (argc == 1 || strcasecmp(argv[1], "show") == 0) { get_policy(); dump_policy(); From nobody Sat Jan 25 13:08:26 2025 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 4YgFNp4qr3z5lKFJ; Sat, 25 Jan 2025 13:08:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YgFNp49lrz3vGT; Sat, 25 Jan 2025 13:08:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737810506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BwAoiZW+R18xuKuhwnEDcTt+QDCD/93WMBa7ewAMc2w=; b=HWTcy4GRDucufR6Ml2SY26dho1imRMCR9wvL+WvY/u2zT0zr/hFt2fzj2r+7tBENkm52fP YM84vjoUjFUryHfh5OVelddNelB1sPDUUbWrdBQhgfgAoLnhR17PCoHL+SKN25OYom4mCC HvI1+OZazVCS0qABN4IXMOe2JD//62OUYO2x9CEh9h4A5h0guKMBi4tg/p4pqC7ZTebdmU q0gNIukIZ434RcqtkOx8yicSCNSyAqfcAuXi1E7adH15Vlg14tQpbdwR/R9wP6uQP5eRjs UflS4LZFPD1gwo7NJhAzVXau7DaTXafMKzH1QOup7gpWIcNKbF+vUm+ou5LJ5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737810506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BwAoiZW+R18xuKuhwnEDcTt+QDCD/93WMBa7ewAMc2w=; b=Qg3YVO+zDcAAZObr++QuxfLDzgTK5YpvWZjZjCxan8wsVGkXAfKOV4FgTDh0LZcKJZi4lv 5LoguLIbV2fx9do6cY9k6OPmL7B5mrBYWWnWcLbHJ5XYFqDVkb8wECy+kQ2V/gO7YmK/kO jJHsGVKAC2pGS7bWU3JbI+yM1If9vqsfuzSkke/O5bWu7O+y1ZwG2Nc4sKu0yL+X120Xpl bPzgytJ2kQKhuc5xItDmGuk5VQJuyq8F+3vD3MLqpKhGg6WNbo/ejyELNpwHl0BEBWCSTU /wpPB/OpxQxv8wRbmpLzvcjN6xZkdNxarPgjUAe9mnULiSQxDTGa+1fDVqpBJg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737810506; a=rsa-sha256; cv=none; b=k5ieFdaka88Ubw4nH+in3PGkwowF6pHsBN93FphnzjUcOMo4Fipv+XN8nWQ7yFJDR+kkDN 8DRNIEFaywLXtUbOCtk8D08PPVOMj0SlVhjQxoyRfBd9PC0YHsps0y8lhcHSqPgoGd6ujd PNnDDVq4ugLCFEx+cHbeNAKpzhuQtlkls1R4oCsMImXx1Xs/NozjEiDMf2yl0GdzgSDYAs lwHhqhPtd6lGGAJuwlMXftwaL1wujj7v+tlkRYy6m+0s/zxPkISUYKxqT/lFHvakRXJ9FE BOd9VYUuzEgR412DbDolepgAmFtB9g4vHO2jiRYEtzgoz2Fy4lUkUn0659UIVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YgFNp3G4Qz1CPQ; Sat, 25 Jan 2025 13:08: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 50PD8QjO042263; Sat, 25 Jan 2025 13:08:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50PD8Qsg042260; Sat, 25 Jan 2025 13:08:26 GMT (envelope-from git) Date: Sat, 25 Jan 2025 13:08:26 GMT Message-Id: <202501251308.50PD8Qsg042260@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Leidinger Subject: git: f934e629dc22 - main - Add stack clash protection to the WITH_SSP flag 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: netchild X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f934e629dc22b859efabd3cdebc23b63b04fa2bb Auto-Submitted: auto-generated The branch main has been updated by netchild: URL: https://cgit.FreeBSD.org/src/commit/?id=f934e629dc22b859efabd3cdebc23b63b04fa2bb commit f934e629dc22b859efabd3cdebc23b63b04fa2bb Author: Alexander Leidinger AuthorDate: 2025-01-25 12:43:39 +0000 Commit: Alexander Leidinger CommitDate: 2025-01-25 12:45:53 +0000 Add stack clash protection to the WITH_SSP flag Some background info availabe in: https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html https://developers.redhat.com/blog/2020/05/22/stack-clash-mitigation-in-gcc-part-3 https://blog.llvm.org/posts/2021-01-05-stack-clash-protection/ Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D48651 --- share/man/man7/mitigations.7 | 14 ++++++++++---- share/mk/bsd.sys.mk | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/share/man/man7/mitigations.7 b/share/man/man7/mitigations.7 index c487e4e1000b..4db6589cdcf1 100644 --- a/share/man/man7/mitigations.7 +++ b/share/man/man7/mitigations.7 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 23, 2024 +.Dd January 25, 2025 .Dt MITIGATIONS 7 .Os .Sh NAME @@ -244,9 +244,13 @@ and it is possible that some applications may not function correctly. .Fx supports stack overflow protection using the Stack Smashing Protector .Pq SSP -compiler feature. +compiler feature, +and stack clash protection. In userland, SSP adds a per-process randomized canary at the end of every stack -frame which is checked for corruption upon return from the function. +frame which is checked for corruption upon return from the function, +and stack probing in +.Dv PAGE_SIZE +chunks. In the kernel, a single randomized canary is used globally except on aarch64, which has a .Dv PERTHREAD_SSP @@ -264,7 +268,9 @@ When .Va WITH_SSP is enabled, which is the default, world is built with the .Fl fstack-protector-strong -compiler option. +and +.Fl fstack-clash-protection +compiler options. The kernel is built with the .Fl fstack-protector option. diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 63774e857167..06f8e6e9fe78 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -304,7 +304,7 @@ CXXFLAGS.clang+= -Wno-c++11-extensions FORTIFY_SOURCE?= 0 .if ${MK_SSP} != "no" # Don't use -Wstack-protector as it breaks world with -Werror. -SSP_CFLAGS?= -fstack-protector-strong +SSP_CFLAGS?= -fstack-protector-strong -fstack-clash-protection CFLAGS+= ${SSP_CFLAGS} .endif # SSP .if ${FORTIFY_SOURCE} > 0 From nobody Sat Jan 25 16:02:59 2025 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 4YgKGD04brz5lY7d; Sat, 25 Jan 2025 16:03:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YgKGC6SFBz4BLP; Sat, 25 Jan 2025 16:02:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737820979; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=14im0GGkfkhSF2R4qblpXX9T9z/OYUbgvrfl6hPEW8g=; b=VLHa7/RAGYUk976TjAsbzx/A4zyAHiEyIVm/+8c61Vt6x0gceTZgdetlYscxARzsLnC9gB WvME0VInZyR/+6xu0VebDEUJ1xf8kYsWmFW0RrkzCwWwxEK/iMxpZF9yACmC3xEsHFkgFs Xn5518X1lITcFgO39AkNvmsxNd+//WoKLQwjpVRoO0NhRk7dVv0KMQLD4gnnK+MBXKawBV EBgC+DG7D2bnjzvCnLAEQiQyz74fUuVn1felJTqG520dqewXu0EBtYiNIjFpcjz08+Ef2B ipij4MwKRQLekGUc7MoEo3/fc+ROULlIRJqkVRNwbzrSTIUKFeMBPkOGfDTtCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737820979; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=14im0GGkfkhSF2R4qblpXX9T9z/OYUbgvrfl6hPEW8g=; b=pic3AxN2j6yeT5TdCtHi0XLFYNE34utcEwGkSGa2BzW2koOmz07x5ImphA/UUR3DjW+NlO CH6ViKVcpg2CEtnsJ3d66YU7qGtWPjOSfYvLrgX5dKLHy/yyyIa71shbKun08Tx4fAg9HM Tb5VwxMjXW9Esfd+aT8du8fZzLwe7BQh09akx86pke4zQak9DttZn90kShsGDly654AWLd Cg25YDjHGf8RfS5QmGwCZx1CoMFwTJhQWgjU5kl29NSmCzQvKYcGIe/Zvf/VEuy7OueLDD A98NyIhfyjCLFizmXF+xPq5TJrAbTy+Bri3sOwXihl9/VbFTNre4ScRI62fMbw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737820979; a=rsa-sha256; cv=none; b=kXzSkty2D0ZpUWaY47ocPFabRqYpmqpJ6CE45wtvaSp6rwN4FizRy5ZIM9ygVmhYFpFead /FN6Nl3kKAMWgdjaia59hP06vsraMvx0dgsGs0tnhRkpOSTyCIOHf80+6fc8Ou0UjEg+2P 37Uf6nrPdZWZ1vbkXKQz1CqYeHq5QqkLCSP8nueTTo28kyRv4VzFAT/0yk9ZzEBVrMdLiC a2vJ3DyeHBw+IEDAuYShddGD5MurhSoBRaGrkoCrJYkVLAM9KOki3Kxkp7GYq2CVNEuPaV 7UhhAT1Qi5L6cekgq3MvRRkZynnw25+8o6KBG6WPSscIbOQZz+c/hETbaPKhmw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YgKGC5vbbz1J6y; Sat, 25 Jan 2025 16:02:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50PG2xwX076809; Sat, 25 Jan 2025 16:02:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50PG2xLk076806; Sat, 25 Jan 2025 16:02:59 GMT (envelope-from git) Date: Sat, 25 Jan 2025 16:02:59 GMT Message-Id: <202501251602.50PG2xLk076806@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: 096a5c6cd28c - main - libdtrace: Generalize handling of data models a bit 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: 096a5c6cd28c417456d5ce3598be15e6b656af5c Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=096a5c6cd28c417456d5ce3598be15e6b656af5c commit 096a5c6cd28c417456d5ce3598be15e6b656af5c Author: Mark Johnston AuthorDate: 2025-01-25 15:57:37 +0000 Commit: Mark Johnston CommitDate: 2025-01-25 16:02:41 +0000 libdtrace: Generalize handling of data models a bit Make it easier to support data models other than ILP32 and LP64 by avoiding constructs which assume that it must be one or the other. No functional change intended. MFC after: 2 weeks Sponsored by: Innovate UK --- cddl/contrib/opensolaris/cmd/dtrace/dtrace.c | 7 +++---- cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c | 8 +++++++- cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c index dc68c6ef5f72..162224478ec0 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c @@ -1378,7 +1378,7 @@ main(int argc, char *argv[]) argv[0], optarg); return (usage(stderr)); } - g_oflags &= ~DTRACE_O_LP64; + g_oflags &= ~DTRACE_O_MODEL_MASK; g_oflags |= DTRACE_O_ILP32; break; @@ -1389,7 +1389,7 @@ main(int argc, char *argv[]) argv[0], optarg); return (usage(stderr)); } - g_oflags &= ~DTRACE_O_ILP32; + g_oflags &= ~DTRACE_O_MODEL_MASK; g_oflags |= DTRACE_O_LP64; break; @@ -1460,8 +1460,7 @@ main(int argc, char *argv[]) * files. We ignore certain errors since we'll catch them later when * we actually process the object files. */ - if (g_mode == DMODE_LINK && - (g_oflags & (DTRACE_O_ILP32 | DTRACE_O_LP64)) == 0 && + if (g_mode == DMODE_LINK && (g_oflags & DTRACE_O_MODEL_MASK) == 0 && elf_version(EV_CURRENT) != EV_NONE) { int fd; Elf *elf; diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c index 8f8d20298e4c..40200771fd4d 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c @@ -1073,8 +1073,14 @@ dt_vopen(int version, int flags, int *errp, if (flags & ~DTRACE_O_MASK) return (set_open_errno(dtp, errp, EINVAL)); - if ((flags & DTRACE_O_LP64) && (flags & DTRACE_O_ILP32)) + switch (flags & DTRACE_O_MODEL_MASK) { + case 0: /* native model */ + case DTRACE_O_ILP32: + case DTRACE_O_LP64: + break; + default: return (set_open_errno(dtp, errp, EINVAL)); + } if (vector == NULL && arg != NULL) return (set_open_errno(dtp, errp, EINVAL)); diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h index b380f5eb3313..1f4c5a2efd6b 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h @@ -70,6 +70,7 @@ typedef struct dtrace_aggdata dtrace_aggdata_t; #define DTRACE_O_NOSYS 0x02 /* do not load /system/object modules */ #define DTRACE_O_LP64 0x04 /* force D compiler to be LP64 */ #define DTRACE_O_ILP32 0x08 /* force D compiler to be ILP32 */ +#define DTRACE_O_MODEL_MASK (DTRACE_O_LP64 | DTRACE_O_ILP32) #define DTRACE_O_MASK 0x0f /* mask of valid flags to dtrace_open */ extern dtrace_hdl_t *dtrace_open(int, int, int *); From nobody Sat Jan 25 17:34:09 2025 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 4YgMHQ11jqz5lfVw; Sat, 25 Jan 2025 17:34: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 4YgMHQ0G7qz4PfW; Sat, 25 Jan 2025 17:34:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737826450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CZc2+jybeAXs3RzHzs9+04Lq47zTec2SLrGsaYfyfDE=; b=dYK75maHPufh4Bpop4WupNKoiCAQ9TGxcKlP/Y7exRqSuuird9YT5rjXzG102zyTgNKat/ a7mNWrmsVbJ5NtbLGV/39mWXi29gHSqLrybx2MELuqShEiONBSkiUqX6s9BRDAw/YFU4cL ClnBYoKEcEh4sGmSqgaFJJwYd5/K/8OZhSTO2ZaBlB0XVGFcVj3QA9UgFA2dO8mTodjyB9 PCD4ncen940KszZkjR8VsO3ZvPhrZY98DpUrmVFbquT/C7x+r+Y9YisQnj6JzcJ8fQl18X R/tHM48/USam1VjweEMLQyGVpl9VvMjePlF+kwTqoGqxGNJyGmFuPsfNMUueBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737826450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CZc2+jybeAXs3RzHzs9+04Lq47zTec2SLrGsaYfyfDE=; b=pEl3sYmet2DKXOFxaCWU4SHjoaxkDvmz8vQuXj+J3/hJ4cIM1l52+UVnfIl4Afye742IE0 jAP43xH1t2EAc6YN2lz6t2IH8fbRVF2fsbQyt3gORoJdDnfG/jFcVCjweaqkztFk3xGnOa HsgU4y4xq0Y/XYSrXu07Dil4QqPvoZtpZTd60lrQuUE4bMdleXTwxiFShJl0aoZOCFWXED F88dtMxMvCvutj1ES8EMV+zFasuWGCRbGr+wTZwpy66HKLjgG+FmA3SeAGMqn/ww9dcmLk wilSVe4yfSWWM8A91fie0gScaBzn6vOLmQQozqKgXeJD+4NfL106iid1ETscKA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737826450; a=rsa-sha256; cv=none; b=Xmc4qXVkYSN5TR1WJaXrgh65w8hKNTMMyJBz8c05QZt/6vSHbawmJVJq6AREIm/DDvbe2d P8nDlkTJssMFY09RNOqbYNq7ri/Ld0za1Nj0riGfdMf9ShEweG99Y2Da3CvaGsK3Sohd/o RmyHmnnEsOKPhNBcyuY7YzEZgOBexDzm/N5P4mUAx/NwDFWAW1mCLrS7FdMs7SAudNgHDL yH4AlX8+GwcCj7H/J/ZsVhE4zQDD1bSTxxoKQHUXvW1TIekRV4fYNQbQawZrsmVBcB03ri 3CtunyUDFGVq/q5MVOsr/8EMtSeqhDZ1h8Wd9UfvGqAZYgqwV6kPfXOIgpzGQQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YgMHP6mT5z1LDy; Sat, 25 Jan 2025 17:34: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 50PHY9KR044716; Sat, 25 Jan 2025 17:34:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50PHY9No044713; Sat, 25 Jan 2025 17:34:09 GMT (envelope-from git) Date: Sat, 25 Jan 2025 17:34:09 GMT Message-Id: <202501251734.50PHY9No044713@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: 853cd8723494 - main - arm64: Clean up usage of the dtrace invop handler 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: 853cd8723494ccc2e972aaa09e7d04ede1508c95 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=853cd8723494ccc2e972aaa09e7d04ede1508c95 commit 853cd8723494ccc2e972aaa09e7d04ede1508c95 Author: Mark Johnston AuthorDate: 2025-01-25 16:17:03 +0000 Commit: Mark Johnston CommitDate: 2025-01-25 16:17:03 +0000 arm64: Clean up usage of the dtrace invop handler - Don't consume the breakpoint if all invop handlers returned a non-zero value. - Fix style nits. MFC after: 2 weeks Sponsored by: Innovate UK --- sys/arm64/arm64/trap.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 544189964ef0..d612905b77c8 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -548,11 +548,10 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) break; case EXCP_BRK: #ifdef KDTRACE_HOOKS - if ((esr & ESR_ELx_ISS_MASK) == 0x40d && \ - dtrace_invop_jump_addr != 0) { - dtrace_invop_jump_addr(frame); + if ((esr & ESR_ELx_ISS_MASK) == 0x40d /* BRK_IMM16_VAL */ && + dtrace_invop_jump_addr != NULL && + dtrace_invop_jump_addr(frame) == 0) break; - } #endif #ifdef KDB kdb_trap(exception, 0, frame); From nobody Sat Jan 25 17:34:10 2025 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 4YgMHR2PJLz5lfFK; Sat, 25 Jan 2025 17:34: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 4YgMHR17HVz4PfX; Sat, 25 Jan 2025 17:34:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737826451; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qMdgVzdAbY1sCyZpPMsmoQbd+/Dgva9woVSvdD8IN8g=; b=BwzORlpDj6DIMqBWeT9nsrcUO22Mfuub3E2/mNUmQuUjU8+k9Yj21dxSAkmhnPaf7/sGTu DqIOdFNAfYEm+dNGoV0MMppIaQaPnw9O6Jyph61kPukxztv0pph/Qy9BP9sIl+TT4cUKSp C+smQYoh0uWZYnhUnf+AKnqWYcAZgCkPD1+1WTBKi0BVB+6Y77G8jvwSndIieYNZMK/rQ4 R2RLMJOHfAhJSrfzRxgnS0XfIOAEQmqmsOCYlveLPFthyOe/SsYPfp+wDgARyCYBYpnE/Y DUCgtvVjRKEj4USisUX19MM6/cvucCzWaCjfZ03ZVqYJTPtGTQ8kKWNuwkuW5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737826451; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qMdgVzdAbY1sCyZpPMsmoQbd+/Dgva9woVSvdD8IN8g=; b=nYekHQeGCQ+M7QID2Kd3IpJwMpig06qjGsuHAAyFQXO9Gl27knaVqmdcsAajOaAK5wFryW o5dT1lLXsKCb9zrPlW9c3kOn3fEVlaxEyE5IbbM/dZw79C2HNJ3LS0y7RTDpJNcjMSbSgx 6hKqMCqQMt/MfHBfubWJkUuuKWMqR+em6zf+6hkUvAny/348h/9X8sIzIYsd+9ObDRjhwU ickeCKZHTjmGbMz/I2QMkdMkfhy+c9nEEzvKmp6rquhJIPuIzHLROtrGgk5vqHNmZtOZhv qGT08aFkdmAxWwwu2LI7CcH6jxXvjHSE9gS/g+en2XuN40yPIsJT+J8OBp/Sjw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737826451; a=rsa-sha256; cv=none; b=yjK0/N1HJyYmwfODUBtscePZdQ5+JozVCjp+35GrOeNLUqGadzRAS4crjB0hgTCDI6iMSM I4J4Bf1IqUZD897xyFv26GfdxBWIQOH0fuh6hDPM2SaUD1IoTgtFDPM2TIzDMg6AfcMERT 4d8vVjCmC6PwZkvkrdKS7XDocbAN+u+EKXzG2AJg63XyaAJQH1VKWVeE+il6K6kaNVa2QA v8emiWpovPOmzLhTUUp82729kHXTJJnAR0OpQmgZPzesEC+A6jK1aFPZU5Qtcuuj+4PBWO 2cit7vKP/6hNGkh9aIEE7RQaSgg1JtdEpMoJNCvuEMflTuisU82Ct2Bt7sf3cA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YgMHR0bGTz1L4k; Sat, 25 Jan 2025 17:34:11 +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 50PHYA0N044748; Sat, 25 Jan 2025 17:34:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50PHYA5s044745; Sat, 25 Jan 2025 17:34:10 GMT (envelope-from git) Date: Sat, 25 Jan 2025 17:34:10 GMT Message-Id: <202501251734.50PHYA5s044745@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: 494a2b14722e - main - dtrace: Remove the noinline qualifier from dtrace_getarg() 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: 494a2b14722e8955af54e306305f462e5765c1e4 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=494a2b14722e8955af54e306305f462e5765c1e4 commit 494a2b14722e8955af54e306305f462e5765c1e4 Author: Mark Johnston AuthorDate: 2025-01-25 17:22:02 +0000 Commit: Mark Johnston CommitDate: 2025-01-25 17:33:43 +0000 dtrace: Remove the noinline qualifier from dtrace_getarg() It serves no purpose after commit 82283cad12a4. No functional change intended. Fixes: 82283cad12a4 ("dtrace: Avoid including dtrace_isa.c directly into dtrace.c") MFC after: 2 weeks --- sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h index 222f8e206da1..10ba0d37ac1b 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h @@ -1272,11 +1272,7 @@ typedef struct dtrace_toxrange { uintptr_t dtt_limit; /* limit of toxic range */ } dtrace_toxrange_t; -#ifdef illumos extern uint64_t dtrace_getarg(int, int); -#else -extern uint64_t __noinline dtrace_getarg(int, int); -#endif extern greg_t dtrace_getfp(void); extern int dtrace_getipl(void); extern uintptr_t dtrace_caller(int); From nobody Sat Jan 25 18:00:18 2025 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 4YgMsb1FXYz5lh8x; Sat, 25 Jan 2025 18: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 4YgMsZ6vNdz3FJn; Sat, 25 Jan 2025 18:00:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737828019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BfMEyyPMgIMpLORkhr8Dq0J7QDApL8hRO1ZqZgbtJqQ=; b=sRfIwRpIxDLT4KWJlukWFQJyLKOrfDZksRq3wWs7ftgpAPlo8QZbwQIBCQ/sxCikbyQkxJ IkaU7h90JANX2Ft4juoCgo1uMBdkyxuWBmmvd7wNJ1dnthm5v/AXwjkhshWguPv1C39Wpa cKo7pHYL3kogOpeaeFTlKafwA7PM/riMXym3E7L2VOIcZOsDlAv1IRxdLGCuRMC4EG6z9J z3Pjh1FWJ+Vrv2gEV8e/5NXDr+CCfP6mBbV49vXSzN+wzSfYbg2sQVbbnaGCWoDs6LUWmW Fxj8Z9/P0dXCWS49cUSD6MsD+vijssraLEL2xxa1MTHCYxg2TpPEfTj/5bOLdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737828019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BfMEyyPMgIMpLORkhr8Dq0J7QDApL8hRO1ZqZgbtJqQ=; b=F7isNVC5TWYuPvBiwJsNy4WyAUzCJG6yvHAjP3kfDeX/nsF8J88Snnm46mivx0nomElIOW NpHFZ1CaJcPe9xLMU9PMiU4zrFz9URA4eHDTUNBKZo4sraTku2mglYS5lbz/9KNRKVrG0U u8rMifcb5wyCwlBhMwBACG5tWRzTTGScLru66IWgT8YZKyYZkNdf83I4Up5ZcuE/dMSSCN Sd10zZXpGPlzYwXXcV+bY/DPV63dgWNXgADnRP4JVlD0NmvFKDvFeniuXiRyNdUvFm/W9O RK54/hN4AVhaqJRvJhPskcbUPa27PXfPV+MRvp0WwOxu0q7IZvgCPcMQg8jC6A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737828019; a=rsa-sha256; cv=none; b=P7g+hLzK0sFQ1DZa9u+VjYe6GMat2cKVmKmwfvZX3l7amaRfn15c9bxucyxf5UhTAmcoJy +RmVWRiZdrmvVrYPWKgJNlAnxeBVBOZ5dE9FO4HAtnI+oWoOpJQkwro8QiIXiyMTFTANvT 74hW0q1cpEtUy65XGBl6AD0kFY2ruJLw74bRuphoubwwy+XfWnBrj8wvwNkqv/elIGXFLv Gpnw8hby+WJl4nUk+YFMcR/I7yASDlTfhHoaGcYaLNzdpKi9jacBYAvki08d8JaJpfKS2C VRdUgXdhJ04OMtDGNvqP+FxbZaTzNvUkBa+NlvZfesZAvJ8cI5cDxlLAqghgmw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YgMsZ6FX6z1LWJ; Sat, 25 Jan 2025 18:00: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 50PI0I3l093056; Sat, 25 Jan 2025 18:00:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50PI0IO2093053; Sat, 25 Jan 2025 18:00:18 GMT (envelope-from git) Date: Sat, 25 Jan 2025 18:00:18 GMT Message-Id: <202501251800.50PI0IO2093053@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: faa845aab611 - main - kern_sysctl: Fix printing function name in the re-use sysctl leaf warning 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: faa845aab6113190ba8c75a171b2cca8673a6214 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=faa845aab6113190ba8c75a171b2cca8673a6214 commit faa845aab6113190ba8c75a171b2cca8673a6214 Author: Zhenlei Huang AuthorDate: 2025-01-25 17:59:33 +0000 Commit: Zhenlei Huang CommitDate: 2025-01-25 17:59:33 +0000 kern_sysctl: Fix printing function name in the re-use sysctl leaf warning The helper function sysctl_warn_reuse() is intended to print the name of the caller rather than that of itself. PR: 221853 Fixes: 4ae2ade11426 Enhance debugibility of sysctl leaf re-use warnings MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D48645 --- sys/kern/kern_sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 9d824fbd3cbd..da09aaed5558 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -411,7 +411,7 @@ sysctl_warn_reuse(const char *func, struct sysctl_oid *leaf) (void)sbuf_new(&sb, buf, sizeof(buf), SBUF_FIXEDLEN | SBUF_INCLUDENUL); sbuf_set_drain(&sb, sbuf_printf_drain, NULL); - sbuf_printf(&sb, "%s: can't re-use a leaf (", __func__); + sbuf_printf(&sb, "%s: can't re-use a leaf (", func); rc = sysctl_search_oid(nodes, leaf); if (rc > 0) { From nobody Sat Jan 25 18:32:15 2025 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 4YgNZj2hvZz5lkln for ; Sat, 25 Jan 2025 18:32:29 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 4YgNZh4cRNz3KMs for ; Sat, 25 Jan 2025 18:32:28 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4361f664af5so35659955e9.1 for ; Sat, 25 Jan 2025 10:32:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737829947; x=1738434747; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qsYfUNl64lPxOW/AlxpPZJEM7nSj/mRKIfvUirn+BAM=; b=Qphcsxrx6IkQA8TgXUBv/xZgsS8zNE4tLjRqmC5IEHSDEBpD+yNykZvAWyatEOqK/M psHTU1vDUlos4vpOhOYB4MjGkChKTVMfTSBEDuMjIBNLVNkRLtI6ujGobzUWZ3crZrTV LccFpMO1axLuWb7NdNhiJiUVZMIjHWAOAR3LNrPdwg/GWRL5+UVacKo9qFaC3VOVriYk 33nzPnbS9/ENYDaQ6DoA9weq0BO7TZBDMsNTdHqaIlW6s7Fj1+we4yIrdrA7MTk/9q40 d8Mwq60uQnTMbr59RWULEfUyZPJbh6GMKDs4cChKVsaGWhNXOkdsUdCgyXjd/Cn/UHrc vbaQ== X-Forwarded-Encrypted: i=1; AJvYcCUCbQT8IaNKSGBynvrIpzo1SkHPIFwLNVI8ugKTYRgyN9iWEW+nKNSekLonGQjDSdhmkXOvlnD35oAwkVMz985brqhQtQ==@freebsd.org X-Gm-Message-State: AOJu0YwIi3So5A7uIs6SGUc8jWD6RmE6XroLmspXv2DZJwT1Pjh1dDdl gTc/YR4cPtcT7BG10j3T3Coa8u4uZzV1HHeu/JT5oGMzhWzHhMO4W95SUQOv7No= X-Gm-Gg: ASbGncsdMQx/n9e2nYhgKNqB++PQuxISpsfw/eoFSObcgfM/vPFsATexuaxMbYtWoNj a7hEvxExB8so6aVFqCwevylDHUkI/FOhB6lUG6wrFgd6X9k8q+uGaQr45MdC9QmNpRAKOprBA9F UhXUlhq5Mh9WnXSKtOxxutRejWne2C5E9Q05RJAGBkOWp0n4azruh5bZczI4hi/BvRAYaR9wXu9 d8dq5zwW1hlocz0273joPgQKlOv+Jd9vlw3oYY/4tDcl5cc8oAEfrGCeEMxdLzX3jxMyBhGZaC2 hrq6dSmj56yY/EaSx/E= X-Google-Smtp-Source: AGHT+IFKo5XZvDuY1BN8ykcl4MlrE8vID70XlTgRLh6KSIX1DtmNeatvZ4Db3Y8TGzLwkYsVg1yiKw== X-Received: by 2002:a05:600c:4c86:b0:436:6ddf:7a27 with SMTP id 5b1f17b1804b1-4389141c412mr297158285e9.23.1737829946970; Sat, 25 Jan 2025 10:32:26 -0800 (PST) Received: from smtpclient.apple ([131.111.5.201]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd54bfa5sm68415115e9.25.2025.01.25.10.32.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Jan 2025 10:32:25 -0800 (PST) Content-Type: text/plain; charset=utf-8 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 (Mac OS X Mail 16.0 \(3826.300.87.4.3\)) Subject: Re: git: f934e629dc22 - main - Add stack clash protection to the WITH_SSP flag From: Jessica Clarke In-Reply-To: <202501251308.50PD8Qsg042260@gitrepo.freebsd.org> Date: Sat, 25 Jan 2025 18:32:15 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <81A8E695-5034-4945-8D07-DF95E76904D0@freebsd.org> References: <202501251308.50PD8Qsg042260@gitrepo.freebsd.org> To: Alexander Leidinger X-Mailer: Apple Mail (2.3826.300.87.4.3) X-Rspamd-Queue-Id: 4YgNZh4cRNz3KMs 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:15169, ipnet:209.85.128.0/17, country:US] On 25 Jan 2025, at 13:08, Alexander Leidinger = wrote: >=20 > The branch main has been updated by netchild: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Df934e629dc22b859efabd3cdebc23b63= b04fa2bb >=20 > commit f934e629dc22b859efabd3cdebc23b63b04fa2bb > Author: Alexander Leidinger > AuthorDate: 2025-01-25 12:43:39 +0000 > Commit: Alexander Leidinger > CommitDate: 2025-01-25 12:45:53 +0000 >=20 > Add stack clash protection to the WITH_SSP flag >=20 > Some background info availabe in: > = https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Harden= ing-Guide-for-C-and-C++.html > = https://developers.redhat.com/blog/2020/05/22/stack-clash-mitigation-in-gc= c-part-3 > https://blog.llvm.org/posts/2021-01-05-stack-clash-protection/ >=20 > Reviewed by: emaste > Differential Revision: https://reviews.freebsd.org/D48651 Uh, it does require architecture-specific compiler support, which = isn=E2=80=99t implemented for all architectures in LLVM at least. RISC-V has only recently (as in 1.5 months ago so not even released yet) gained support, for example. So this is just going to spew out -Wunused-command-line-argument warnings, and errors with -Werror, no? Jess > --- > share/man/man7/mitigations.7 | 14 ++++++++++---- > share/mk/bsd.sys.mk | 2 +- > 2 files changed, 11 insertions(+), 5 deletions(-) >=20 > diff --git a/share/man/man7/mitigations.7 = b/share/man/man7/mitigations.7 > index c487e4e1000b..4db6589cdcf1 100644 > --- a/share/man/man7/mitigations.7 > +++ b/share/man/man7/mitigations.7 > @@ -28,7 +28,7 @@ > .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE = POSSIBILITY OF > .\" SUCH DAMAGE. > .\" > -.Dd July 23, 2024 > +.Dd January 25, 2025 > .Dt MITIGATIONS 7 > .Os > .Sh NAME > @@ -244,9 +244,13 @@ and it is possible that some applications may not = function correctly. > .Fx > supports stack overflow protection using the Stack Smashing Protector > .Pq SSP > -compiler feature. > +compiler feature, > +and stack clash protection. > In userland, SSP adds a per-process randomized canary at the end of = every stack > -frame which is checked for corruption upon return from the function. > +frame which is checked for corruption upon return from the function, > +and stack probing in > +.Dv PAGE_SIZE > +chunks. > In the kernel, a single randomized canary is used globally except on = aarch64, > which has a > .Dv PERTHREAD_SSP > @@ -264,7 +268,9 @@ When > .Va WITH_SSP > is enabled, which is the default, world is built with the > .Fl fstack-protector-strong > -compiler option. > +and > +.Fl fstack-clash-protection > +compiler options. > The kernel is built with the > .Fl fstack-protector > option. > diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk > index 63774e857167..06f8e6e9fe78 100644 > --- a/share/mk/bsd.sys.mk > +++ b/share/mk/bsd.sys.mk > @@ -304,7 +304,7 @@ CXXFLAGS.clang+=3D -Wno-c++11-extensions > FORTIFY_SOURCE?=3D 0 > .if ${MK_SSP} !=3D "no" > # Don't use -Wstack-protector as it breaks world with -Werror. > -SSP_CFLAGS?=3D -fstack-protector-strong > +SSP_CFLAGS?=3D -fstack-protector-strong -fstack-clash-protection > CFLAGS+=3D ${SSP_CFLAGS} > .endif # SSP > .if ${FORTIFY_SOURCE} > 0 From nobody Sat Jan 25 19:09:14 2025 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 4YgPPZ5mVfz5lmH5; Sat, 25 Jan 2025 19:09:38 +0000 (UTC) (envelope-from netchild@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 4YgPPZ58cgz3Pg7; Sat, 25 Jan 2025 19:09:38 +0000 (UTC) (envelope-from netchild@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737832178; 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: in-reply-to:in-reply-to:references:references; bh=VdYxXwGRLdlTN9KjJtViEzZ49sVVEpkFy3O11IKzeHo=; b=w54Kg1t+qpL+90bdDqVBlsodStXx6gNY5CeOHT+2S4SG72Wal8Pk5u1EPZMFRwwo8KDl8p hcLaqKM8m03U7hVRBgbsMkxhhW1GSTe2SxQqsC44D8/Xlg4LyWck+0dK/J6d7+pP6yUH73 g7XA7o7V92iuVittbKVnTk6xPzATCP3Nnuru2etpN1KPxoC/G7KREXczwEmELboaZrvyMM v451X8WWkuYwcxrF7kBeiY6zd5b42WBX2Y5xgRHcfxrUWhRDnt7doTrGSribj7TcWotWN9 KRxBoSe37GsopQ26K6bPf6+O8FjsqI3sDX3ZQSp4s6ztQ99LzwSIQf5YVarYrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737832178; 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: in-reply-to:in-reply-to:references:references; bh=VdYxXwGRLdlTN9KjJtViEzZ49sVVEpkFy3O11IKzeHo=; b=O5mg/YOGQIe+bBQIdG6u6XSxvJuzrHG8fcfY1ZtpFU5+jj+OYKxbHCJvbAlpicgBJOUDBb fmON36jyoNgDgHK+t+zxFTcAugo7qhi6ycW8jG0hQBzWTolJzeI/Io3zQ5bMJU3kOacIgf hNtQYEHSFn6PXrVS9J+ht9oKLeZWLv6m3Bk0V/YYmvKu5o6c/6HucRGd+nVkvgF+zmV9wV ZiNfsbg3K8TTXMi0cjeWB+m0gKv4vF8rW7f1bEzTVozerlx6lr6ss6Bgtt5Lb+g5zvabRp WQJvNPzxC9EyjtvqpUmke5avUr8GcPePjo3NbVDjcfSVdNilNQ9qJ2WU/Ct/Gw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737832178; a=rsa-sha256; cv=none; b=TpUPwwznf2flBZxfiCZOUhWpiTAp4OOXGvN/naXRQAXkC/Rh8Lj5AE5q6ASJEpYEpxCDRy 60z3FOaEadJ6/VVjEs0f+lgI1EwowR2wMjkM+tu3cGrZU6OYcbZ0zaAb9CgJivAD/XAafd WAKllx5KtmqiGX1juNIInc5tG1NHVBlaPx9Z+XcH7FGl2d5KosKz5F+cQ7PE5tlC/NFwbJ qDkiUI9+uU/Y4jp2d54QaOxMhyylXlGfJnUOvt5g+T8oxWbL7/vtgw29STADOvx5Rtkvun FBEHESRc4mUb147VgqRF+0Sx/GTa2NujFXWJchFemqS8+vw9MAs5+BVgyjRR/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from outgoing.leidinger.net (p5b16583a.dip0.t-ipconnect.de [91.22.88.58]) (using TLSv1.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 ECDSA (prime256v1) client-digest SHA256) (Client CN "outgoing.leidinger.net", Issuer "E5" (verified OK)) (Authenticated sender: netchild) by smtp.freebsd.org (Postfix) with ESMTPSA id 4YgPPZ2KDQzFHm; Sat, 25 Jan 2025 19:09:38 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from webmail.leidinger.net (roundcube.Leidinger.net [192.168.1.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: alexander@leidinger.net) by outgoing.leidinger.net (Postfix) with ESMTPSA id 84F383A0; Sat, 25 Jan 2025 20:09:32 +0100 (CET) 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 Date: Sat, 25 Jan 2025 20:09:14 +0100 From: Alexander Leidinger To: Jessica Clarke Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: f934e629dc22 - main - Add stack clash protection to the WITH_SSP flag In-Reply-To: <81A8E695-5034-4945-8D07-DF95E76904D0@freebsd.org> References: <202501251308.50PD8Qsg042260@gitrepo.freebsd.org> <81A8E695-5034-4945-8D07-DF95E76904D0@freebsd.org> Message-ID: <9fec6bfae287dfc123a359c3e1164ae2@FreeBSD.org> Organization: FreeBSD Content-Type: multipart/signed; protocol="application/pgp-signature"; boundary="=_dfebb1064ab7e7467e9facd0bf4792ce"; micalg=pgp-sha256 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --=_dfebb1064ab7e7467e9facd0bf4792ce Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8; format=flowed Am 2025-01-25 19:32, schrieb Jessica Clarke: > On 25 Jan 2025, at 13:08, Alexander Leidinger > wrote: >> >> The branch main has been updated by netchild: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=f934e629dc22b859efabd3cdebc23b63b04fa2bb >> >> commit f934e629dc22b859efabd3cdebc23b63b04fa2bb >> Author: Alexander Leidinger >> AuthorDate: 2025-01-25 12:43:39 +0000 >> Commit: Alexander Leidinger >> CommitDate: 2025-01-25 12:45:53 +0000 >> >> Add stack clash protection to the WITH_SSP flag >> >> Some background info availabe in: >> >> https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html >> >> https://developers.redhat.com/blog/2020/05/22/stack-clash-mitigation-in-gcc-part-3 >> https://blog.llvm.org/posts/2021-01-05-stack-clash-protection/ >> >> Reviewed by: emaste >> Differential Revision: https://reviews.freebsd.org/D48651 > > Uh, it does require architecture-specific compiler support, which isn’t > implemented for all architectures in LLVM at least. RISC-V has only > recently (as in 1.5 months ago so not even released yet) gained > support, for example. So this is just going to spew out > -Wunused-command-line-argument warnings, and errors with -Werror, no? The online docs for gcc (https://gcc.gnu.org/onlinedocs/gcc//Instrumentation-Options.html) tell this: ---snip--- Most targets do not fully support stack clash protection. However, on those targets -fstack-clash-protection will protect dynamic stack allocations. -fstack-clash-protection may also provide limited protection for static stack allocations if the target supports -fstack-check=specific. ---snip--- I read this as it should not spill such warnings. Additionally other options there are listed as limited to some architectures, but this one is not listed as such. The online docs of clang (https://clang.llvm.org/docs/ClangCommandLineReference.html) do not limit this option for some architectures while for other options (e.g. -fzero-call-used-regs) it tells about architecture limits. In a discussion on -current in November there was the opinion it may depend on run time support, as I've searched but I've read only that this option depends on stack guard pages in the kernel. I have not found info about any required run-time support in e.g. libc or such (like for -fstack-protector(-strong)). If those docs are missing listing limits for this option, we can off course enable this with a little bit of code in bsd.compiler.mk only for those architectures where we do not get such warnings. Bye, Alexander. -- http://www.Leidinger.net Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF http://www.FreeBSD.org netchild@FreeBSD.org : PGP 0x8F31830F9F2772BF --=_dfebb1064ab7e7467e9facd0bf4792ce Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc; size=833 Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEER9UlYXp1PSd08nWXEg2wmwP42IYFAmeVNusACgkQEg2wmwP4 2Ib1Lg/+NG5tAoqBMw2gnKjEMAV7P9lIgTE4k7M0aK019rJykVPiqdGS9VZpUMWD geO6jpocQ5E2yiLzoRJyBmwHpIdiz4Ic+GTgHS9U2MqdPUa+JDh9owbM/1UHNBHD t9cGBXtcFjowP05iNJ7xnidH1ey0o99aVWvv0ymm4yCCu538EBW5Ra2ZA7Z1qEZd buSLxGE+A6UT+/lA6LGmkLLtZXwDm5IkWbr01JxrGCv19vh9QyNZ9zNj45TuPhcd xc0jtiUmNu0ReFw8oXklwcR5wVtcN7CUTzH4Ua+GuyGvmEHn6cM7fRBsHH8eNSqY kLZqit4iyt2sBA3zBGAhFNhhxIoRLuKG8oVf+1qbDyYe97tAPwPqiGyYaZ45gwvS CcTCy+jVzcyWawlJdiO5dvxzANRwKRAeMHLQJ2i+NtO0+qPx4M5mCYP4nm6zYYOE Qf1WcLeqZPXqx+F66ziKT9kUSm6vzZjIiKSIHkVdDfd+ZPebgEdAxO62Bc+vr6rb fWje0SAytOOQmDXxvKQRuCUBc0eSTThspNL+RisKYp/XHAuAK5ULO4eKoLC37ket Oi4ZfD+7FYEDe/+jK6xV5PN1PIUMsjPa8vU9zxhboHzXuAbpogFyv4STJdAF3ijG 1bFmT3YCirr8NG9K8kpqtxQuxjGLHGoScjw5zk5zQQFZpgjtOqo= =aYvF -----END PGP SIGNATURE----- --=_dfebb1064ab7e7467e9facd0bf4792ce-- From nobody Sat Jan 25 19:21:11 2025 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 4YgPg858JNz5lnN3 for ; Sat, 25 Jan 2025 19:21:24 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 4YgPg82Lzqz3R6T for ; Sat, 25 Jan 2025 19:21:24 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4361e89b6daso20265835e9.3 for ; Sat, 25 Jan 2025 11:21:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737832883; x=1738437683; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VclXzKBju5iabiBtttyZeeDfBXmN/CGWIY8MYZijmqg=; b=nsEP0Pt0wBgg5180yfE192pkd7kCHPVuqK1KHOxO/r/jSiuPN0bjMoSijiqp0xK6DL Czb1QGEGDmU5RsCx7epec4lAxJS4ZvgEAOMkiU3qiycNdyU3n85nLASVHA7eOUlSMeRh 0dtd19Hv0GG5BBac+bt5uhmEEo/KczndadPpNIEzfLDxP8IWxV73rBUw7dBYrSc6bUCe lBBjhH4kIB09W3VZO5C3OCYn4hVUnMuyaIX6VW4zrUfordV6KefaTEnOmOTnkJZfOvsA JPmDoYVX7S3yAADSDVDs0OFcdMcZyNgr14aCw064qmP3gDhfKZ/uSrq0tsz2F+oocCTM 25pw== X-Forwarded-Encrypted: i=1; AJvYcCWSSNJqT2izhGwLUUNzrCk6T3/316Os0uooKn/Gc3AvlxpPVEDxWPUT39nK/648s6leCeoiHP8nL15I84DXNgrfBMzshg==@freebsd.org X-Gm-Message-State: AOJu0YyCHLu9M0hvVARwpmLaP4QF3LWAqUMD3LKA5JmK3Nq9RQBYn5Nf PHRf7emupf0IpRVswpXOZMoOvFdzYRJhbRLnoRqRI429AMeGbXYUn4W9h8caHm6OTdjjSTvAlxK a X-Gm-Gg: ASbGnctCJM2efHu4jYOXLhwIT1gusyRkOlCp8WWtHK/rOkZg/oilGzp5OqmOOX7h8zE rFsLdR6xG2ngcTxpWurD73ahH4B5QrVEr/jKDqxPw50/PYJsUdmEafVBKh5MLWpj/KLQbiHg6Uv zCdUD76gXCiI9X68CAKXyqFq7ZWQqm9tH1QPf48T5LJng61llEsUNwHtDp7eZLfxDE43ST3oMyG 8ZiMrQ0ySt+0uyoIWm6Mlf8M6VQSA6PVfV9hO9dH1n1Gv+2jzVu36iS6P5H8FsKf3ex32a75Ofp i7R1hU6MCC8mfM/FKCk= X-Google-Smtp-Source: AGHT+IFzhRqQQnxznawyLk7leh5fUEMixsDLRBoEbEFO06kBHUvT/u/1U0z+PiKJ+GqFZ7uj4JO55g== X-Received: by 2002:a7b:c00f:0:b0:434:f5c0:32b1 with SMTP id 5b1f17b1804b1-4389eecb1f5mr311059915e9.15.1737832882700; Sat, 25 Jan 2025 11:21:22 -0800 (PST) Received: from smtpclient.apple ([131.111.5.201]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd4b9984sm70125435e9.28.2025.01.25.11.21.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Jan 2025 11:21:22 -0800 (PST) Content-Type: text/plain; charset=utf-8 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 (Mac OS X Mail 16.0 \(3826.300.87.4.3\)) Subject: Re: git: f934e629dc22 - main - Add stack clash protection to the WITH_SSP flag From: Jessica Clarke In-Reply-To: <9fec6bfae287dfc123a359c3e1164ae2@FreeBSD.org> Date: Sat, 25 Jan 2025 19:21:11 +0000 Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <6C70A3E0-CC6D-4B0B-96A8-70636F08AC6B@freebsd.org> References: <202501251308.50PD8Qsg042260@gitrepo.freebsd.org> <81A8E695-5034-4945-8D07-DF95E76904D0@freebsd.org> <9fec6bfae287dfc123a359c3e1164ae2@FreeBSD.org> To: Alexander Leidinger X-Mailer: Apple Mail (2.3826.300.87.4.3) X-Rspamd-Queue-Id: 4YgPg82Lzqz3R6T 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:15169, ipnet:209.85.128.0/17, country:US] On 25 Jan 2025, at 19:09, Alexander Leidinger = wrote: >=20 > Am 2025-01-25 19:32, schrieb Jessica Clarke: >> On 25 Jan 2025, at 13:08, Alexander Leidinger = wrote: >>> The branch main has been updated by netchild: >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Df934e629dc22b859efabd3cdebc23b63= b04fa2bb >>> commit f934e629dc22b859efabd3cdebc23b63b04fa2bb >>> Author: Alexander Leidinger >>> AuthorDate: 2025-01-25 12:43:39 +0000 >>> Commit: Alexander Leidinger >>> CommitDate: 2025-01-25 12:45:53 +0000 >>> Add stack clash protection to the WITH_SSP flag >>> Some background info availabe in: >>> = https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Harden= ing-Guide-for-C-and-C++.html >>> = https://developers.redhat.com/blog/2020/05/22/stack-clash-mitigation-in-gc= c-part-3 >>> https://blog.llvm.org/posts/2021-01-05-stack-clash-protection/ >>> Reviewed by: emaste >>> Differential Revision: https://reviews.freebsd.org/D48651 >> Uh, it does require architecture-specific compiler support, which = isn=E2=80=99t >> implemented for all architectures in LLVM at least. RISC-V has only >> recently (as in 1.5 months ago so not even released yet) gained >> support, for example. So this is just going to spew out >> -Wunused-command-line-argument warnings, and errors with -Werror, no? >=20 > The online docs for gcc = (https://gcc.gnu.org/onlinedocs/gcc//Instrumentation-Options.html) tell = this: > ---snip--- > Most targets do not fully support stack clash protection. However, on = those targets -fstack-clash-protection will protect dynamic stack = allocations. -fstack-clash-protection may also provide limited = protection for static stack allocations if the target supports = -fstack-check=3Dspecific. > ---snip--- >=20 > I read this as it should not spill such warnings. Additionally other = options there are listed as limited to some architectures, but this one = is not listed as such. >=20 > The online docs of clang = (https://clang.llvm.org/docs/ClangCommandLineReference.html) do not = limit this option for some architectures while for other options (e.g. = -fzero-call-used-regs) it tells about architecture limits. >=20 > In a discussion on -current in November there was the opinion it may = depend on run time support, as I've searched but I've read only that = this option depends on stack guard pages in the kernel. I have not found = info about any required run-time support in e.g. libc or such (like for = -fstack-protector(-strong)). >=20 > If those docs are missing listing limits for this option, we can off = course enable this with a little bit of code in bsd.compiler.mk only for = those architectures where we do not get such warnings. Clang=E2=80=99s docs are just deficient here. If you go and read the = actual code[1] you can see that architectures have to opt in to the flag even being checked. Even AArch64 didn=E2=80=99t support it until LLVM 18, if = you look at the history. It looks like with Clang we end up using -Qunused-arguments so the warning/error is suppressed. That at least means the build doesn=E2=80=99t= fail, which I suppose is good, but I=E2=80=99m not sure we should be = promising that WITH_SSP will protect against stack clash then having the compiler silently emit unprotected code (for which we=E2=80=99re to blame, by = telling it to ignore the fact it=E2=80=99s not supported). This at least needs to = be documented that the protection will only be provided if supported by the compiler. Jess [1] = https://github.com/llvm/llvm-project/blob/4bcd8184a093d2d9f0aad1053dbb1367= 891da6a5/clang/lib/Driver/ToolChains/Clang.cpp#L3790 From nobody Sun Jan 26 12:11:47 2025 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 4Ygr4z38DJz5ljPK; Sun, 26 Jan 2025 12:11: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 4Ygr4z1t3zz3wpr; Sun, 26 Jan 2025 12:11:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737893507; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GlmZk75mKk2OnXtbkgmJVi0mxicdXncciyMSSfyIZPU=; b=e+nLdrdAT4OcwkFk9teO3bkLzsuK2lA/gxgZbcY66tkT3yxBqrfoaUmY2fFD4+RtovgUJ9 g/WA0QGpfRXaQuCbufeLX5yHZb2GGYZxdIRqEYloxJxqHAULqhIUQBgh2EVG4bPacTHAkR /YhclZc5HgQvdXe0iooQ47B/EBFvXfrDJ6xLiE+dWiqgxERNz7fZ4SDHlhHGy/HfXKbxHF I7hGHR4Jc7iZ1J0mSk9147wLT5D9tdFeN7GSNBFmtQ3gCAzY+St4nmUGSR2AIR4HSUJJ2M ESSEo809z6SKOVvI6MclrzAtZI+bNycqE2hjohESRn+jZl7xvy+6YgZihTt41A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737893507; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GlmZk75mKk2OnXtbkgmJVi0mxicdXncciyMSSfyIZPU=; b=AQFCUi0JNRAhbWF+w7OfqKBYhy7TL2ITI/Gi68bGoYHtDx34W/0Vop+xdDrUGrnTII/6db mZhraz4UxPP5MKiGI1lGD4PvGoDQHvmS8Mpfvkle4CNFK3MGMjXxVIHIMyKEThbGsRoWDu REercg9j2jjqEvkoT8KY9QfqFzJb3Z/KqdS7RIo07xQ+6R+2fD1+X8GPnVH8dEbXWNR0ZU aSvlRfKrKGmx9cAR3mimkF9zNMUCrLadn3/tCNuIO06+YVARKH+jVz/jPifjxqlv/uVw0u /36oom4Nput/EVcMqjBN0JU+RWe1n+6l6LsNbQfevJiWwhonthoB58AzruIOpA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737893507; a=rsa-sha256; cv=none; b=WV9kaslU4O24ICHOCt2zHECPP0IkcBzhHOwGuwSCvXWCNb3ZkYeype6Do5i/NJTpMo5ayO 9ZmYxSZZwmgfRZ7svMgW77mIbx6euluRGTvYoDSGNoUTNf+I6DdWOoSxt9DtsX8XUJRoEi 43r84D5iQFg8zbEKJbLVyhGpg6W6hTkomkzmSr/gi1KOp6bpa4UxavyUANtf8WzOovgPcv faMldY6N2fIwoKZ794gxpfNEB+lIXzLbG2XWPvJ0kzsi1pjxFMIk+SAaOUo6LniyzWN02W xIL0Efb6NquoqVRJL8f5zH4b+fM41cHlM6dNaWEKLqhGDQTsonhRt9bRpW5H5A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ygr4z1PfBzhR2; Sun, 26 Jan 2025 12:11:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50QCBlLp025231; Sun, 26 Jan 2025 12:11:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50QCBloS025228; Sun, 26 Jan 2025 12:11:47 GMT (envelope-from git) Date: Sun, 26 Jan 2025 12:11:47 GMT Message-Id: <202501261211.50QCBloS025228@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 5da0eee3d842 - main - bootptest: Fix a typo in a source code 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: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5da0eee3d842bd0bef2c95553e75e462cda27ee6 Auto-Submitted: auto-generated The branch main has been updated by gbe: URL: https://cgit.FreeBSD.org/src/commit/?id=5da0eee3d842bd0bef2c95553e75e462cda27ee6 commit 5da0eee3d842bd0bef2c95553e75e462cda27ee6 Author: Gordon Bergling AuthorDate: 2025-01-26 12:06:55 +0000 Commit: Gordon Bergling CommitDate: 2025-01-26 12:06:55 +0000 bootptest: Fix a typo in a source code comment - s/tralier/trailer/ MFC after: 3 days --- libexec/bootpd/tools/bootptest/print-bootp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/bootpd/tools/bootptest/print-bootp.c b/libexec/bootpd/tools/bootptest/print-bootp.c index ba1c02563ab0..dabab8115313 100644 --- a/libexec/bootpd/tools/bootptest/print-bootp.c +++ b/libexec/bootpd/tools/bootptest/print-bootp.c @@ -242,7 +242,7 @@ rfc1048_opts[] = { "iIP-routes", /* 33: IP static routes (dst,router) */ /* Link Layer parameters, per-interface (RFC-1533, sect. 6) */ - "bLL-trailer", /* 34: do tralier encapsulation */ + "bLL-trailer", /* 34: do trailer encapsulation */ "lLL-arp-tmo", /* 35: ARP cache timeout */ "bLL-ether2", /* 36: Ethernet version 2 (IEEE 802.3) */ From nobody Sun Jan 26 12:11:48 2025 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 4Ygr504hJhz5ljMC; Sun, 26 Jan 2025 12:11: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 4Ygr502l2Pz3wps; Sun, 26 Jan 2025 12:11:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737893508; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AZ3kC1HMEpJ3bjC2VTJcZ+slLhJQOwitw7IL1LnJILY=; b=ZvMbYPuKx07UfAjAKCGQM7Zn3eFFAFPFDDAKU2EpS/AmQnK+6RGpwe37mCKwpQd0J9fgIG 0YQAckFS4SBSeHim0OG+W+GHFBsDxvkKIdQKKT/sejzCoPzCOoJBvVZgqTvhYYXKL0x/Vs xIM/TU/Xlz0dEyEOvbwEe0elGSbafXMSFqBOZ2SYNhntASTvKLkAEmWIxeGmu402MSiHUp GO+3SA7wU8/6JM6V58E8/+q0ARA8R47ufAMZoGSMqRJFEcnIqBVZSXCPPoX2yYS74DV/oz MP2mSHAvTDU4FpGV/Mv2VDJbgZ8rCy8x+B8DRzcVww1H2+4JM7qURLJPfF5VSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737893508; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AZ3kC1HMEpJ3bjC2VTJcZ+slLhJQOwitw7IL1LnJILY=; b=KsRFhv1SmmlAe/s8p8XNxrD2PU47MUHZ9FemEjfQnwe3zuZjYURLQXOhm4RK2QI+UOQ7+u VmgaUEUtIsxClG0PnyU5VfedkBGleeamuXpAll8dGwMWvyMbzcKJZHZ6k9ewYZ7Kqzrw0Q yIyA033LRBOKR8NmJ0N0INBTh/UiBvMgOG68Ogo0qjymsRFIOEcxOcR8lYizQqwTMcGDws P7S2tNrclWn4r86gBGNDQiDk/pr2Ibu7bP1gJvi2U5JpFnuctsL3yJhYtJgl895/tjt5+U abAJBXp5jymx0+X7WyRb9NYhtM0ia1Z2z9nqxENQNUrck+YsmIDSwiyWYTM80g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737893508; a=rsa-sha256; cv=none; b=ntDlG4O/A4hRMRkNwWYTvuir/eWL5+iQSd+ttOLtZ1k596SZj8tBJo5S6tH0smi2A8aES7 +1JACuitDwTx9KPjEX3iJWVs5jKpgUzLV21QgRpDSnv1X/1HpiyxorBUHrD9TtMlKIdSwd F8IyzUITnkNNJixsiBYyGuAUIHtD5p3Gmc5UuDUsTc2YPdXzxRr9gEvSeTjqTMAYnvFj0D 9WAL88nOW3wplMjP0oj745DmLU4pMCg8Ae7bXxncLyVcptUfY2Xh3NnNjSln5aWPs+zOV6 BUpZvi4kq+ZnY3sVy9p7WjKoRCyD5W3PF0ZVn/GqRQSJAsViodX2rfha0uf+vg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ygr502M2Xzhdf; Sun, 26 Jan 2025 12:11: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 50QCBmUJ025264; Sun, 26 Jan 2025 12:11:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50QCBmBD025261; Sun, 26 Jan 2025 12:11:48 GMT (envelope-from git) Date: Sun, 26 Jan 2025 12:11:48 GMT Message-Id: <202501261211.50QCBmBD025261@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 6fbf8502a500 - main - ath(4): Fix a typo in a source code 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: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6fbf8502a5004a99847bda57b4875b567c7ca018 Auto-Submitted: auto-generated The branch main has been updated by gbe: URL: https://cgit.FreeBSD.org/src/commit/?id=6fbf8502a5004a99847bda57b4875b567c7ca018 commit 6fbf8502a5004a99847bda57b4875b567c7ca018 Author: Gordon Bergling AuthorDate: 2025-01-26 12:08:23 +0000 Commit: Gordon Bergling CommitDate: 2025-01-26 12:08:23 +0000 ath(4): Fix a typo in a source code comment - s/isnt/isn’t/ MFC after: 3 days --- sys/dev/ath/if_ath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 094517da5689..934024ddfbcf 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -2446,7 +2446,7 @@ ath_bmiss_vap(struct ieee80211vap *vap) * against the next beacon. * * This handles three common beacon miss cases in STA powersave mode - - * (a) the beacon TBTT isnt a multiple of bintval; + * (a) the beacon TBTT isn't a multiple of bintval; * (b) the beacon was missed; and * (c) the beacons are being delayed because the AP is busy and * isn't reliably able to meet its TBTT. From nobody Sun Jan 26 12:11:49 2025 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 4Ygr515zSSz5ljBG; Sun, 26 Jan 2025 12:11:49 +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 4Ygr514NlVz3wmb; Sun, 26 Jan 2025 12:11:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737893509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Hqny1Y4RaxnpuiaBsNz4XFZmabpweXOHizQ+MHZ8Z+8=; b=tWuGb27Wrc9mLnm9MvEEG9RKj1Vrh/F8qWf4aAnBpI6gNJVr78s0lExR+wL7D9js+9o0NC L/GIVp7Koxc0zAxo7blbtuT+LH4aoKQ3V+bMesx6/4x4oIwd2+TEuu5wd/3g76O7Hk5Bo/ ZZmeZ74i0ZD6B9+hBu3oWTvSxbMn1mG1v0wr4rgzwM3IbJm/vZMCj9mI/pkchCLrmIbs6U 2XaDVlcQdh9ZwrEkV6eD2/J9y7HPYo/hRG2yOPvEYbZqO8mmMFYX6pzdNsh6IxgvNJVT4W T8i8hZFwqZz5TUT5OqzOo6UReU+71ENywX9ZQZxXTYNBXza5+uVe6lKvgJDgaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737893509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Hqny1Y4RaxnpuiaBsNz4XFZmabpweXOHizQ+MHZ8Z+8=; b=mx2bByaThIePzenR8QQ6gzjl++Uh3qQo3xV+uT+vRGPnK1gMe5r3yVMYqgyf8reHz7Lzjg LFiMQ4CDfOOjyDlju7Z6nYenIUbu8VcyczWUUbRl4kCp1mG3YNSzyCpwBDym569eaRH7Tf KLzYGmtYm+zWinlR6mYsmfsbJVlRgO3SIBnknvkQ6HCNQ8Q6JAQmcNhF0N2gR73yl1vWnG 6YnktGWsgZ4h652re2VtOZ7+hAJLDHfT2OyAy8hFqsAMYL/yYoi5Abl2/2yFEiEgFTCYt5 fKeJla+P51lKYgA+5E8vq/LLcSNGjMqNq5XhD9e2QA3r9+1Yv1OGGBc0VJ2jxw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737893509; a=rsa-sha256; cv=none; b=aosG522SjJJTgaAZBFCHAeG8M5S4hQqf2p2WyhznyUInWwbR05ogrlzMDS9ATBDGFQ1I0J nrWKovHbKxaH/POxuSz+OhmHO/V2jQ5ExiHR2U16msD/1rEEe/u8f4uwAjMboch4ggCxE2 4KW1MFZWdSIpwdhBOgcBxyQuRCkp/kjyQy3UsjozMjt2BNS3H8lEVhGnEkA45fw5CCwXd8 TNWWl+u4tEcKPrfRy1sKcFntePdBPHdHARXQO3DhyIReiIUEr72floNxmxc6OybwPlP8K6 6y1YkwtkqcjS72gt31JfW2+COwauKxpYmF7OKlvS4gXE5R4ZZe7SQFftS7eiAA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ygr513Ptzzj4V; Sun, 26 Jan 2025 12:11:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50QCBn76025297; Sun, 26 Jan 2025 12:11:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50QCBnTV025294; Sun, 26 Jan 2025 12:11:49 GMT (envelope-from git) Date: Sun, 26 Jan 2025 12:11:49 GMT Message-Id: <202501261211.50QCBnTV025294@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: b0c318efdde7 - main - smartpqi(4): Fix a typo in a source code 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: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b0c318efdde7c1b059b26f1ab6d4c75e838b6652 Auto-Submitted: auto-generated The branch main has been updated by gbe: URL: https://cgit.FreeBSD.org/src/commit/?id=b0c318efdde7c1b059b26f1ab6d4c75e838b6652 commit b0c318efdde7c1b059b26f1ab6d4c75e838b6652 Author: Gordon Bergling AuthorDate: 2025-01-26 12:09:34 +0000 Commit: Gordon Bergling CommitDate: 2025-01-26 12:09:34 +0000 smartpqi(4): Fix a typo in a source code comment - s/isnt/isn’t/ MFC after: 3 days --- sys/dev/smartpqi/smartpqi_request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/smartpqi/smartpqi_request.c b/sys/dev/smartpqi/smartpqi_request.c index 1c0bbc2a1db5..d3c4fb989a99 100644 --- a/sys/dev/smartpqi/smartpqi_request.c +++ b/sys/dev/smartpqi/smartpqi_request.c @@ -1284,7 +1284,7 @@ pqisrc_calc_disk_params(pqisrc_softstate_t *softs, aio_req_locator_t *l, rcb_t return true; } -/* Not AIO-eligible if it isnt' a single row/column. */ +/* Not AIO-eligible if it isn't a single row/column. */ static inline boolean_t pqisrc_is_single_row_column(pqisrc_softstate_t *softs, aio_req_locator_t *l) { From nobody Sun Jan 26 12:11:50 2025 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 4Ygr531DLFz5ljMG; Sun, 26 Jan 2025 12:11: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 4Ygr524Sjfz3x0w; Sun, 26 Jan 2025 12:11:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737893510; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lWLtCcMi8UAFO+HZA6es9+hre8/iqETxltf6oj9oLxQ=; b=bDLf9S8m08r1+tz6Ed+GjImKf+gioKiQqwErkbWbLkuZ+IE0DeP1zQnFs9pNhupav+aKYE 43SruzkK1eRxNcOf+hiYyz1G1B0EQFvBWJ1csAyEA2Bu0xkUlqAlw0pC4K+hF6d4O8ik3m bOm2FufcnHU0dlKhN+5iZ9gnojIEPsp2htOB8OEDV/DUA8B+4DxiJmiu7995gXdiOSxt+J YASZFazvXWdgYehUh67QJekUeMoYct9OW7EvvK6p/FvUO2O/JAdnJHSqCoAY1Y8EeZpPOT 4L4/jhNUruKe7PNBXgrz7KOAPavT2xdZucJPGFOZr4OsCt9lFj1zgft6LVwoaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737893510; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lWLtCcMi8UAFO+HZA6es9+hre8/iqETxltf6oj9oLxQ=; b=OVq1Ax8QPDnwb2OMExZA6uwlsUVFaZCheW7bDFkyTujjHytAStBvoAkp1+RGdlEEPBRSrD 81mDfltqZ3+S4APjiGDLcwXRanLVPaKTRb0PFsu/u17ww1595O8tNK9dZMtae7nQ8wtmn4 9T0T5C7uPXpp78m3opN2WbSbIeFh/c320AuH38VB5NmgkiUqdmls2kAcQ01nMazpVH1vt8 EqPbzVbgS08pA/HY501qZQcjpSzrOI58hRjQYw9CtHdRkI0JXTBh+PoMWHDXlqkfR2Sw/3 UpHOXfyOZcsqSjAXT/1B6uBzt16MbTGXKYtA/QdVSCqT2xNwSxiVG1NLCk7Vew== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737893510; a=rsa-sha256; cv=none; b=T5010PR36PmH3Wodp5UcKodKbSMKxBnDnKn8rVZhuZZ7qxOKg29vlRX5278lkN6RTTesBl IPXBz6BMrfb/XjHVaLOCgRpC9rSwp8NY9Dbp8mCZtyePZJ4mhUMp+D/xK4LMd49q7D1YAT RMj4/YuA1EOB2FXBv506AxeUg3dA49bwcleCOL7nXTy7RoKsgucTnOu9eEF5Ky3AOhUHMI qE7R2LdbT71MO5aeqHwesR4TcdNyr4cFau6daA6by7itg3e50KFuH4eg5G+eR3fI8qymLs HiBjHg/ltSdgTylLxTyL4rdCgHaRyNNdNxOc/mkuuqXFAVouiwvTIIVGr173JQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Ygr523yCSzj4W; Sun, 26 Jan 2025 12:11: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 50QCBo8q025331; Sun, 26 Jan 2025 12:11:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50QCBoMv025328; Sun, 26 Jan 2025 12:11:50 GMT (envelope-from git) Date: Sun, 26 Jan 2025 12:11:50 GMT Message-Id: <202501261211.50QCBoMv025328@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: abcbde5d68f1 - main - net80211: Fix a typo in a source code 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: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: abcbde5d68f1fb6fa21fe2c24e04901a53f15798 Auto-Submitted: auto-generated The branch main has been updated by gbe: URL: https://cgit.FreeBSD.org/src/commit/?id=abcbde5d68f1fb6fa21fe2c24e04901a53f15798 commit abcbde5d68f1fb6fa21fe2c24e04901a53f15798 Author: Gordon Bergling AuthorDate: 2025-01-26 12:10:14 +0000 Commit: Gordon Bergling CommitDate: 2025-01-26 12:10:14 +0000 net80211: Fix a typo in a source code comment - s/isnt/isn’t/ MFC after: 3 days --- sys/net80211/ieee80211_sta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c index ca06546abdb9..9e4e1013fd2f 100644 --- a/sys/net80211/ieee80211_sta.c +++ b/sys/net80211/ieee80211_sta.c @@ -1373,7 +1373,7 @@ startbgscan(struct ieee80211vap *vap) /* * Compare two quiet IEs and return if they are equivalent. * - * The tbttcount isnt checked - that's not part of the configuration. + * The tbttcount isn't checked - that's not part of the configuration. */ static int compare_quiet_ie(const struct ieee80211_quiet_ie *q1, From nobody Sun Jan 26 12:38:00 2025 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 4Ygrgh6YWPz5ll0N; Sun, 26 Jan 2025 12:38:24 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.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 4Ygrgh5jr0z43v5; Sun, 26 Jan 2025 12:38:24 +0000 (UTC) (envelope-from netchild@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737895104; 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: in-reply-to:in-reply-to:references:references; bh=px3kIxz7Y252xmbT3lpLYmt3x9vSjULT5Z2/Q/b9q8g=; b=igx+WQkcKpj0NXd/zQexdqfpQFhVgtlELOxhRtLePZcewLHnBhYzWrIJNjLmmrnJ3MWP2O bLMyt2YFPZ1UfpsLFxXMm6IY77Awi5slxuJK/PYgklPBJ1lQ/wkqLLXEdIe80USIbGmNh1 TsDVwpj+UeLvh+p+hosDC+Yy/t6QcYNP5BDGr74HkQhrooAgMjjFROByKvN6BKP9cY9qrT 2juZHXL4isTQKiNAXQhUAsHs/K9w2j0L+tt5PEOUJz8pnp09fbPQHI/ZwS8KiSDjXG2fBd iwpmYOSgqCTl3dY9GHstG232/lSOE66ENpLPqM9Y97RMHrVPa3D2KzzeMjtZWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737895104; 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: in-reply-to:in-reply-to:references:references; bh=px3kIxz7Y252xmbT3lpLYmt3x9vSjULT5Z2/Q/b9q8g=; b=yw5EBfuNt3H57b8pmnfG8k1Az2M0d8WIzZ069OO/KQ/VhVDUn27SzqdrcM9MrkB4/WgM+F qTa6K2TOve+T/j57xlEnbyoPOp98U2ZhczDaJvYX/Al2Q948XCixj8lupWhaZmVJUAm0F8 f4eugbwvivrSxB3rDWW5d3+wlWzJ1ob8upOm+JuiS3Uujpao4vb/1FPChNPAWs92uo2sdK RUikaTJJd2/A0nY5ZoSzdS5kYGrshO7eijydewUQGR6Qyc6V6phaa74dmbr/s5zWhdw3U5 +FUKPY2VpIlTGEKUsdJsE+lUO0kG1h7aPSrVqGDrhy+X0yOHoMwWG2gSGAQEWw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737895104; a=rsa-sha256; cv=none; b=omxLR/sxkkKRjwp1ZyqVa2BBB2cTyy9SPIqE1WOtU8fjE40lP456F+niVgwlo0sg5NO6Hc lzaeXX4c/xvSUFRq5UhcErj7BLLv5VLIW173+8UMKPKufSiwBxNea1Jrs+r9Jay+zqr0Uy wLmekjhyhAcDE3RP2Q4/eKxCXOWUn4CFhCgPmrmszlPpXK4DjClWtVAdLPKVwoMPpvRIAY i5F3ShXKY8cWMN50sljCRaEpDBo0D/Pt+Vf9I94dZnwBqrtFxJIhagc/gZkLmjEDyI8Pud XNGtkfpxfHs/K5wX3mBp3FrjiSeeWvPPFs/d+B++FuhcTMdtTXz9jB1IIsuE7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from outgoing.leidinger.net (p5b165f59.dip0.t-ipconnect.de [91.22.95.89]) (using TLSv1.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 ECDSA (prime256v1) client-digest SHA256) (Client CN "outgoing.leidinger.net", Issuer "E5" (verified OK)) (Authenticated sender: netchild) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Ygrgg2ZJzzvHM; Sun, 26 Jan 2025 12:38:23 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from webmail.leidinger.net (roundcube.Leidinger.net [192.168.1.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: alexander@leidinger.net) by outgoing.leidinger.net (Postfix) with ESMTPSA id 557037AE; Sun, 26 Jan 2025 13:38:20 +0100 (CET) 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 Date: Sun, 26 Jan 2025 13:38:00 +0100 From: Alexander Leidinger To: Jessica Clarke Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: f934e629dc22 - main - Add stack clash protection to the WITH_SSP flag In-Reply-To: <6C70A3E0-CC6D-4B0B-96A8-70636F08AC6B@freebsd.org> References: <202501251308.50PD8Qsg042260@gitrepo.freebsd.org> <81A8E695-5034-4945-8D07-DF95E76904D0@freebsd.org> <9fec6bfae287dfc123a359c3e1164ae2@FreeBSD.org> <6C70A3E0-CC6D-4B0B-96A8-70636F08AC6B@freebsd.org> Message-ID: <3e0e88c0031d9c3e1f6232f2949f8909@FreeBSD.org> Organization: FreeBSD Content-Type: multipart/signed; protocol="application/pgp-signature"; boundary="=_5085ee47075ddbc0f028b7423686aebd"; micalg=pgp-sha256 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --=_5085ee47075ddbc0f028b7423686aebd Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8; format=flowed Am 2025-01-25 20:21, schrieb Jessica Clarke: > It looks like with Clang we end up using -Qunused-arguments so the > warning/error is suppressed. That at least means the build doesn’t > fail, which I suppose is good, but I’m not sure we should be promising > that WITH_SSP will protect against stack clash then having the compiler > silently emit unprotected code (for which we’re to blame, by telling it > to ignore the fact it’s not supported). This at least needs to be > documented that the protection will only be provided if supported by > the compiler. Like this? diff --git share/man/man7/mitigations.7 share/man/man7/mitigations.7 index 4db6589cdcf1..82a8e3a2c1c2 100644 --- share/man/man7/mitigations.7 +++ share/man/man7/mitigations.7 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 25, 2025 +.Dd January 26, 2025 .Dt MITIGATIONS 7 .Os .Sh NAME @@ -245,7 +245,7 @@ and it is possible that some applications may not function correctly. supports stack overflow protection using the Stack Smashing Protector .Pq SSP compiler feature, -and stack clash protection. +and stack clash protection (if supported by the compiler for the given architecture). In userland, SSP adds a per-process randomized canary at the end of every stack frame which is checked for corruption upon return from the function, and stack probing in Bye, Alexander. -- http://www.Leidinger.net Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF http://www.FreeBSD.org netchild@FreeBSD.org : PGP 0x8F31830F9F2772BF --=_5085ee47075ddbc0f028b7423686aebd Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc; size=833 Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEER9UlYXp1PSd08nWXEg2wmwP42IYFAmeWLLoACgkQEg2wmwP4 2IYDzw/6A11VzeYbkFH/RqFHF+IzX47mBT7YUzNqB9Ipf0ahw3STb6irrjpkPNVD Jc2SL77VkRgBLR5aadYgPSpuTUeT/tfZMg0J40erZZn7+VAdDlYHpz39zzVAXDPe c5NJA98IE4JpiKn1J2h24j44a6mYIhTL0j94UsUJiw4yMV8qyRlwd7hRinK/qcC+ jw/5xQnKruM8W06S4+3EOwO/Dnx4CSlQOQAE75FskArRXDpb5wraUUM4oVRriWHf rzQU3XEp9cjjEn+BqQ03yzeClKbzWf9L2+gGcTriFDAn/LlQw0yYHjaNsrGZkBX1 H7mgdaUXanjnn30upYhhaQWG7WFTmpyso2neg3K3lMhiZLjQlWeJsqymeMS00VAV nvlVvLwsBMFJpMXYskF5g/v42nUOxl2I25IzdBy7aY+z6CHRQdSyR3y3eeBFj43n ZmUWlh9+QqIqb4yEpzaAds9wjjK+f4KRT810WlXrZMqK3k1bmWhzjZvqwy3gE4uR zJExfTk2B2gTNn6IB7aGfcpmyv7jG4d1OsRZyPmJtoQP9u/g9FG36irgQ3feP1jL EtzCI8w8IAozZbCzzY9Bz3OmI/6ckKOxZIDV88Z1rC6KOxT46qw4H4iHvGIC+02I sZO3CgVIn61fGfAslyrnhA27ibL8assvjmXGTD01X1WPZuqIJkA= =ORyb -----END PGP SIGNATURE----- --=_5085ee47075ddbc0f028b7423686aebd-- From nobody Sun Jan 26 17:36:19 2025 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 4YgzHR5G1Fz5m4kP; Sun, 26 Jan 2025 17:36: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 4YgzHR4gYWz3sBS; Sun, 26 Jan 2025 17:36:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737912979; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ztdmw5560le/0j3HaGoIt0ixrYlz0jTT2YIpvOTAAM4=; b=nspKFJBmGAfAxicVzm2OlAMPsmrHjLoa5lroPhnF0DshfXGsa709Mqd9dKdiLp/Efoowhn 4iyvJeKqpTvURQj4FWAvY8Wm74Eu/4vLu7XXr2DA2oBsuzb+kwTEcJEuNr9U8HyyO5NK7y 75gBGNm+gPUJCtT9wK9VJXd4LqNDKIQN1HEKRbyrpsue6TIyHZT3W3DHop9/4o9u8hRquz 9FTt2vfnmd0npHrw7CYgVnsnTSPYjM9Al8gLoquqNcBdfqoND/Eh9tS7Q/u1kwV73iytfS LfEaH8gyClCJ4zmj1KRZzux0stnjYWUu/jVME9y++fZ4+1hyK3CdB4OyOon6Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737912979; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ztdmw5560le/0j3HaGoIt0ixrYlz0jTT2YIpvOTAAM4=; b=nF6Jj4kHPftE44pa6K8ZvYxehDEESGPulc+cymUCw40OsXjp3xntoWcioitz+jZ4pSRBHr Uvs2cOTcmrERC6iwQn+xQY3PvnlKRJkHd73u/bWPEne4TFqMD5Y+u57sJfu8zWlzgB3Xh7 YW59ZBoA+Jkatd4DSQvpjnPc/ujosx2vJnk596I9IgoiUHVeIXmkDFexB7b+Mfw9XdGgg7 1/m2+ozVAOV60CsabwUV0NtqK7FwkWehuGJMeolYb+Pcro36tG3xbYi3znuGSUerxH4lnI /uniS8XTUtK1Qa+MuvOC4plNRYs505v5xKnsUGv67+OL1JENbq7FvpmN2xmVTw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737912979; a=rsa-sha256; cv=none; b=r89EcbGLr9Ox2m/ExN/CMktbprTkBfArQEWNoKLcxym3nZ84VMp4z287U0ldMytzGu1ptA wEZW76v4kAcR2USWnotL0mqy+X85+iCL0C0pz9eeI77X3KBQ9zYt0lDvykEw9hmZ3sUunc KRuuROQhBGN+3cx1/uY7XS7NuxjLv6TLBRQtlnv7yOasY7dfV/OQETHT+pDXyavipz+LHF PO+AqTjLT1VAkBFmEHJ/mpac+WinxoYc7L5lzE92vulY0O+dhdPf3bv5kYCj+pL23nI7Vt fYR7kq20+UJ9a6IiGaO8OkSRNQXWljjFh5OXnkWaXJSaFUOC5LXgsklvoHwvdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YgzHR3nHTzsQT; Sun, 26 Jan 2025 17:36: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 50QHaJZ2028480; Sun, 26 Jan 2025 17:36:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50QHaJqt028477; Sun, 26 Jan 2025 17:36:19 GMT (envelope-from git) Date: Sun, 26 Jan 2025 17:36:19 GMT Message-Id: <202501261736.50QHaJqt028477@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Igor Ostapenko Subject: git: 68206add1173 - main - kyuafile.5: ATF metadata mapping reference 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: igoro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 68206add1173920065092c06eea40c90bb73b5c5 Auto-Submitted: auto-generated The branch main has been updated by igoro: URL: https://cgit.FreeBSD.org/src/commit/?id=68206add1173920065092c06eea40c90bb73b5c5 commit 68206add1173920065092c06eea40c90bb73b5c5 Author: Igor Ostapenko AuthorDate: 2025-01-26 17:15:32 +0000 Commit: Igor Ostapenko CommitDate: 2025-01-26 17:15:32 +0000 kyuafile.5: ATF metadata mapping reference Reviewed by: ngie MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D48190 --- contrib/kyua/doc/kyuafile.5.in | 45 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/contrib/kyua/doc/kyuafile.5.in b/contrib/kyua/doc/kyuafile.5.in index a667f5dc2816..4fe5f12fd9b1 100644 --- a/contrib/kyua/doc/kyuafile.5.in +++ b/contrib/kyua/doc/kyuafile.5.in @@ -122,6 +122,7 @@ of the test program and a collection of optional metadata settings for all the test cases in the test program. Any metadata properties defined by the test cases themselves override the metadata values defined here. +The mapping to ATF metadata naming for each property is provided below. .Pp .Em Plain test programs are those that return 0 on success and non-0 on failure; in general, most test @@ -153,10 +154,16 @@ The following metadata properties can be passed to any test program definition: Whitespace-separated list of machine architecture names allowed by the test. If empty or not defined, the test is allowed to run on any machine architecture. +.Pp +ATF: +.Va require.arch .It Va allowed_platforms Whitespace-separated list of machine platform names allowed by the test. If empty or not defined, the test is allowed to run on any machine platform. +.Pp +ATF: +.Va require.machine .It Va custom.NAME Custom variable defined by the test where .Sq NAME @@ -171,8 +178,14 @@ in it, you will have to use a special Lua syntax to define the property. Refer to the .Sx EXAMPLES section below for clarification. +.Pp +ATF: +.Va X-NAME .It Va description Textual description of the test. +.Pp +ATF: +.Va descr .It Va execenv The name of the execution environment to be used for running the test. If empty or not defined, the @@ -220,6 +233,9 @@ All non-alphanumeric characters are replaced with .Sq kyua_usr_tests_sys_netpfil_pf_pass_block_v4 is an example for /usr/tests/sys/netpfil/pf/pass_block:v4 test case. .El +.Pp +ATF: +.Va execenv .It Va execenv_jail_params Additional test-specific whitespace-separated parameters of .Fx @@ -242,6 +258,9 @@ configuration. It can be overridden via .Va execenv_jail_params if needed. +.Pp +ATF: +.Va execenv.jail.params .It Va is_exclusive If true, indicates that this test program cannot be executed along any other programs at the same time. @@ -251,19 +270,36 @@ value of a setting, must set themselves as exclusive to prevent failures due to race conditions. Defaults to false. +.Pp +ATF: +.Va is.exclusive .It Va required_configs Whitespace-separated list of configuration variables that the test requires to be defined before it can run. +.Pp +ATF: +.Va require.config .It Va required_disk_space Amount of available disk space that the test needs to run successfully. +.Pp +ATF: not mapped .It Va required_files Whitespace-separated list of paths that the test requires to exist before it can run. +.Pp +ATF: +.Va require.files .It Va required_memory Amount of physical memory that the test needs to run successfully. +.Pp +ATF: +.Va require.memory .It Va required_programs Whitespace-separated list of basenames or absolute paths pointing to executable binaries that the test requires to exist before it can run. +.Pp +ATF: +.Va require.progs .It Va required_user If empty, the test has no restrictions on the calling user for it to run. If set to @@ -272,8 +308,14 @@ the test needs to not run as root. If set to .Sq root , the test must run as root. +.Pp +ATF: +.Va require.user .It Va timeout Amount of seconds that the test is allowed to execute before being killed. +.Pp +ATF: +.Va timeout .El .Ss Recursion To reference test programs in another subdirectory, a different @@ -450,7 +492,8 @@ but required_user='root' metadata property reminds that the jail execution environment requires .Xr kyua 1 being running with root privileges, and the test is skipped otherwise with -the respective message. The combination of +the respective message. +The combination of .Va execenv set to .Sq jail From nobody Sun Jan 26 21:27:58 2025 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 4Yh4Ql3RMgz5lbwC; Sun, 26 Jan 2025 21:27: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 4Yh4Qk5VMbz3hfQ; Sun, 26 Jan 2025 21:27:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737926878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zA6k6vWExKoGr+8NeVSj2E1P6soXprgkvB3wPxzv84M=; b=en9RRjXDGoCtenI8uow1r3rF73OVD59KXlDXMDO+ETBCgWkXLcmV6iZp0TvKRRoar99Bnc zWk8a31SZQU2IIRleLPUiLKcIRkyOaZJkhUJCGBTOzlB2eWtPdwq3+kmgMfOzgHST17ozJ Y2uTdwJs62k2Zjc4g5dIl/5yXkgq9ddPOz1uKbudgFBOeD/FhTVlGPsRVCppGtr4+CgJjT Sa1X+v0F4vCGUCXvXNc545aAh9BecFShuWF7ZNpH54qzYTaro/1U3hJQm62RtFJe0m2xHJ gmqQ4QryzpEIHprvG+JGwyOGBPaGssQXWYO03hY/d6R1B2f2CB1B3eRN2VAcZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737926878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zA6k6vWExKoGr+8NeVSj2E1P6soXprgkvB3wPxzv84M=; b=Wx6LHjizcd9gczMS6CXEYPEPXyxIDXP/rjT4xAjZCwKd3J+znT9/6wGj3b4gktdUR15+3L 7670UK+xFUc7l0y+RvEsmYlNvNevz3QJsMI7tCNsZZZikvi6eeNJk47g5XhpywbaO6q2ub KHtspm0kxHOKW7YUIOv3dLdkQcvP6+kb8D97Aml/X3/eeFgFIP7H5AIIdvbZ35mFLHSVIA m9a5xa+iUJRTYASRXaErJNik3lleiL6oKCsDG4aIvAAzOMneoAI1Npt6MW8P5EDNTI1Uok 1rhBXzqtz5MlM2bW4vPojU/1xkU5nrru7MmA/DbTLoyQE7QyOJugUcQoQAyi+w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737926878; a=rsa-sha256; cv=none; b=UGzB2XvB0WdVqDXtoQ+YtXML5DdfzTTxtXAJR4PfDPu1yeKlVkvbDCUtuzS2MtxstGaEOn rewtIq5FPhF9ulh4qEOT7KnZwhsO/PGFt5DRVgpfVbUTkPvXZ5QTLFu15WNiJ1OCCaqoPg NqvD8zqrzeS3400DUcMt71nadjV0xfoUbYc/Gvxcd/rAUdK1kBk2XkZHCMblhxNvOGn/NH zKwDBcbKCTZksN6XVm2by6Ss3e07f/fv0lsJtuDnMY4qiZ3Lyfrlg+kMDB23nrcNOy7DAi RBWaRqBTLngu6UoYGG9LLMeA3Ofq3VC0w/FBIQa31xuKEvR/uOeGD3Eh/ySsFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4Yh4Qk4NQCz10gw; Sun, 26 Jan 2025 21:27: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 50QLRwB2059022; Sun, 26 Jan 2025 21:27:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50QLRwdf059019; Sun, 26 Jan 2025 21:27:58 GMT (envelope-from git) Date: Sun, 26 Jan 2025 21:27:58 GMT Message-Id: <202501262127.50QLRwdf059019@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Austin Shafer Subject: git: bd0510a4213e - main - Add myself as ports committer with mentor kbowling 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: ashafer X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd0510a4213e34470a6987f51a5d89958550963e Auto-Submitted: auto-generated The branch main has been updated by ashafer: URL: https://cgit.FreeBSD.org/src/commit/?id=bd0510a4213e34470a6987f51a5d89958550963e commit bd0510a4213e34470a6987f51a5d89958550963e Author: Austin Shafer AuthorDate: 2025-01-26 19:06:06 +0000 Commit: Austin Shafer CommitDate: 2025-01-26 21:26:20 +0000 Add myself as ports committer with mentor kbowling This completes step 5 from Committer's Guide. Approved by: kbowling Differential Revision: https://reviews.freebsd.org/D48695 --- share/misc/committers-ports.dot | 3 +++ 1 file changed, 3 insertions(+) diff --git a/share/misc/committers-ports.dot b/share/misc/committers-ports.dot index f13e6d3a7984..3fd8d12796c6 100644 --- a/share/misc/committers-ports.dot +++ b/share/misc/committers-ports.dot @@ -35,6 +35,7 @@ alonso [label="Alonso Schaich\nalonso@FreeBSD.org\n2014/08/14\n2017/08/07"] anray [label="Andrey Slusar\nanray@FreeBSD.org\n2005/12/11\n2011/01/14"] araujo [label="Marcelo Araujo\naraujo@FreeBSD.org\n2007/04/26\n2020/11/03"] asami [label="Satoshi Asami\nasami@FreeBSD.org\n1994/11/18\n2001/09/11"] +ashafer [label="Austin Shafer\nashafer@FreeBSD.org\n2025/01/26"] avilla [label="Alberto Villa\navilla@FreeBSD.org\n2010/01/24\n2018/10/01"] avl [label="Alexander Logvinov\navl@FreeBSD.org\n2009/05/27\n2013/12/02"] az [label="Andrej Zverev\naz@FreeBSD.org\n2005/10/03\n2019/11/04"] @@ -546,6 +547,8 @@ jrm -> michaelo junovitch -> tz +kbowling -> ashafer + kmoore -> jhixson knu -> daichi