From nobody Tue Oct 07 08:15: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 4cgppY0MX6z69kfN; Tue, 07 Oct 2025 08:15: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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cgppX6s5nz3sDX; Tue, 07 Oct 2025 08:15:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759824901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OtEKTn0RvuxfnqonD5ZAsT6BQJU4l5idgN+/E+1VQ0E=; b=OXiMqkJXCfVm/dhU+kpVGS8NR6flbds5+qM4AuQFCn38MG8iT+xYRcEdEpIWySQbDN31wc fre736AphAekTfGL1f25zXRXnjPALNIqaCPquYqnSu/CmOPI0mQ+scLd27fR5DLkWa39LE qPVRI4IKgWv+5gayBs9n9TBtY/kQ7AJAS7/G4IBHrUeCMswUk0Oyp1tZbuq3gBubbnYY93 7XiUXHCU8NZY3IK2I9JHvlrGfCeuRL1BPpqLzH6Z4XUDGqkyvOZuCi2yzwpesyQgiM+/SC AWgsPVQDsVNG5r6rSvCbAOUjI2EJRnZhDf3IdrZCm1zDjwDQzuJ4DpBbRIxNug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759824901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OtEKTn0RvuxfnqonD5ZAsT6BQJU4l5idgN+/E+1VQ0E=; b=PZGJRe0skGDmzs9K681tuEckeTByTkmh02Dcf9hSJ0D8aKXN84u7jabxTaY4OBrcbLRFcK GGOcX16a9NGaB2SPsVsvpRZQLzEM/049geGezFQfIQLKZR2xuzpqx60hmjRq7VJuYZWO25 /jwHQv7YNe7zM2JtMppJcoCgYO3sbi0WT6BnL209OusA83kx8d39DVEb3cmT/jveI0tpc2 6uKPtE7HyK6Qpi+8pAV4ovnOBpvcEh2fj2olq4J43zsB6s8mqzTBeCqkcFQDpuXNT/SCgJ /++8DFapF3Oe1OQ4a1BIHwyDLf1wtR+2ReOq8GKsm0bQDISLJ5SA2DR9er/glg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759824901; a=rsa-sha256; cv=none; b=AFyhvFjyFSh7+ZHBjf4y4dDjSROXvEFIvWFJK+K8zaL5k8SFFXi7rXIyOH7G/Y0ERje2d3 Vl7008VodGDMf4g8KNQb8dvRm2A5qXAy9pyjaOGzkoYq+BY9OQomZ1rjMR60KR22jUsvQm tFfufVoctTKD1GEFemVmS5dTe7vw9kAVdkzx3QneiwDof84MpSb3J6Z5CX5fkudn9mVCOC QSAzKqq+ZAw5DHbOpI28Oyq5s+XvkGqttEBlZYGgdCfC6LeByxnhgqFGA0dXG/V1UwgrNN paA/TgmG2jNk56oY1C+5ys8eX4JFL2zReRCys5b/YgoxsmvwMBIuLn9dxAjc5A== 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 4cgppX6S31zddr; Tue, 07 Oct 2025 08:15: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 5978F0IL051626; Tue, 7 Oct 2025 08:15:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5978F0Rc051623; Tue, 7 Oct 2025 08:15:00 GMT (envelope-from git) Date: Tue, 7 Oct 2025 08:15:00 GMT Message-Id: <202510070815.5978F0Rc051623@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: d3bfcd66409b - main - libsa: smbios: Detect less-than-64-bit platforms via __SIZEOF_SIZE_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: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d3bfcd66409befc2d545e5449963b41c25c369a9 Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=d3bfcd66409befc2d545e5449963b41c25c369a9 commit d3bfcd66409befc2d545e5449963b41c25c369a9 Author: Olivier Certner AuthorDate: 2025-03-11 16:56:20 +0000 Commit: Olivier Certner CommitDate: 2025-10-07 08:14:41 +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 --- 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;