From nobody Fri Dec 19 09:19:00 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dXhmp0d5kz6LBBh for ; Fri, 19 Dec 2025 09:19: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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dXhmn5FBSz44km for ; Fri, 19 Dec 2025 09:19:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766135945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8ypnvNt+4ZJ3nquvUpsG9j49MyKTEHFDgS+cUKC3o8Q=; b=k2aVY90S9JDTpxugqvAiFskGjGUbp+NJujw53LBtTXYXOB0F2la9Lf/pYO8oxl+UGi9pB7 6E2H2nOamUApVBeM4gyRz8QrWypf4v9/pw2KH2p9FwOA9ShFJabIYz0Edm1TB8HhZDfRXL Smxo11Z+As7KPndp6y2NRRTwxgb4kMkboUDb95O7si2EkQS04srWxyh4C5326uflrB49JD IOiWfrffyTCXLbMKz+tf7DbhxGy8N1WgCrV/7hAQ9CBPV3lqPK4/FfxQ5lWLW5aWU079cS CuS3Uq5Lc6BsfyX5cDk5QX2DlnifqweX/3btv9iGMQ1On1MpvFNisvhFAwK2bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766135945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8ypnvNt+4ZJ3nquvUpsG9j49MyKTEHFDgS+cUKC3o8Q=; b=fri4ATafRxIpgJL2H8dGkDYhis2tDO1RNB9DocvFQQK5p3gaInogXBCX7rTa/+ieb5vU/g 458OawFQ6YbRz3A0PPtOFFIN3MzelkIbQHg07jdrWtLmgYy5wxssqWcZbhJB8FvrKqKgy/ xkdFOYg7rtrQAancfYRir7ptdJtu8f7bVmXQc2fYkBPFjRIhyfyySOQ0z+55X/dCQ4a6S7 zuZCYQI2JU9joOYXnAOWo4OtFAYj0MJjB6tERtGVI+EgoggKIsjkxdK8iP53GW3SHYfIEP tyNpCrXCZaNt86nIKfzSu1kIKAl4MBqG7p+VJrOJbM95AqNemQd2nTl+M6rddg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1766135945; a=rsa-sha256; cv=none; b=Yj6lt8uXJkF+oDL0BL0ZzXregzmpbQSVBYnzfxchu8qSyW/7MegBxOGZcKtPk3DckGxHWg 6eATKZbM4kLBgv8YnJS+Sb9eEvxKeHTqb4LNckg4cSbCgvokqnq7nnOile413omb8U5EID /wzutokdbtMQ9Yxk+LY0H/37oQRmW7t8V1fTHg2nLRm0p2Dqm13eEfbjHxBb74+3mt2z5e DvB09mgaw0Ema45EQepv2xAOAf6HaHA+NdeP0peid4/zd5juJmhleEOYKxzhIMg151edaS VA7MfWXFvCohO9ci/63vHZt+H1cSwFXF8+amRJcwlkPiqak+Zh1lgFrOm/sVjA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dXhmn4kYKz1H02 for ; Fri, 19 Dec 2025 09:19:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3cdd4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 19 Dec 2025 09:19:00 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: fecb79a5a83e - stable/14 - libsa: smbios: Detect less-than-64-bit platforms via __SIZEOF_SIZE_T__ List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org 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/stable/14 X-Git-Reftype: branch X-Git-Commit: fecb79a5a83e1207c773df113b5d855634809107 Auto-Submitted: auto-generated Date: Fri, 19 Dec 2025 09:19:00 +0000 Message-Id: <69451884.3cdd4.7294bfac@gitrepo.freebsd.org> The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=fecb79a5a83e1207c773df113b5d855634809107 commit fecb79a5a83e1207c773df113b5d855634809107 Author: Olivier Certner AuthorDate: 2025-03-11 16:56:20 +0000 Commit: Olivier Certner CommitDate: 2025-12-19 09:16:37 +0000 libsa: smbios: Detect less-than-64-bit platforms via __SIZEOF_SIZE_T__ What we really want here is to know if pointers can refer to 64-bit addresses, regardless of whether they also hold other information (such as capabilities in CHERI). __SIZEOF_SIZE_T__ is probably the closest indication to that piece of information, so let's use it. __ILP32__ wasn't wrong in practice though, as we don't support 32-bit CHERI hardware (and likely never will). Consistently with this change, test whether we can actually address the 64-bit SMBIOS's structure table by converting the end address to 'size_t' and checking whether its value is preserved. Suggested by: jhb (for the __ILP32__ => __SIZEOF_SIZE_T__ part) Reviewed by: jhb, imp MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49318 (cherry picked from commit d3bfcd66409befc2d545e5449963b41c25c369a9) --- stand/libsa/smbios.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/stand/libsa/smbios.c b/stand/libsa/smbios.c index 32cd198a9537..73b49a111f89 100644 --- a/stand/libsa/smbios.c +++ b/stand/libsa/smbios.c @@ -186,14 +186,17 @@ smbios_sigsearch(const caddr_t addr, const uint32_t len) */ SMBIOS_GET8(cp, 0x0a) != 0 && smbios_checksum(cp, SMBIOS_GET8(cp, 0x06)) == 0) { -#ifdef __ILP32__ +#if __SIZEOF_SIZE_T__ < 8 uint64_t end_addr; end_addr = SMBIOS_GET64(cp, 0x10) + /* Start address. */ SMBIOS_GET32(cp, 0x0c); /* Maximum size. */ - /* Is the table (or part of it) located above 4G? */ - if (end_addr >= (uint64_t)1 << 32) - /* Can't access it with 32-bit addressing. */ + /* + * Is the table (or part of it) located above what we + * can address? + */ + if ((size_t)end_addr != end_addr) + /* Yes, give it up. */ continue; #endif smbios.is_64bit_ep = 1;