From nobody Fri Mar 22 13:55:25 2024 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 4V1P3d5c6vz5F0M6; Fri, 22 Mar 2024 13:55: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4V1P3d54wvz4Dsp; Fri, 22 Mar 2024 13:55:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711115725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ym//LYTrehtPW+6jlCutnXN5JAs4uz+tZOQcaWP9eT4=; b=ZC1nslHnmZpAu4kLtL0m/uoKPhfjPrcGUIiWXX7KvSrrvW/SNblt/BHa0lR0EV082QnFsD 4M3dOKsDCmV6U7VzBME+IJliGSR/Nr5s6HBKtmWxXFF1qrFIIbl5OIHu5iCeyGz9mPLnDE j9gaj7aePuMQcronImnYiTsiPr2E2wFrjJQA7pSpkSe03+TB8415aNQ8g9LkAr+ZFSOlgQ Z6rZ8H4SJU2YAqZAi8LA5tO35Hwa4+G0S863C599Lai65A68uMKiL/YFbv+xi8lDriRlh1 WqUWWZS9E51UMkmufNIsjr0mahGKDQ32VlSLlfBs/GMYLABRg537nCnqEPilDw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711115725; a=rsa-sha256; cv=none; b=yHR1NLup0WI9wZjHBWm1cFyI8Sxm5wJB183mv3QKt2P1nuw6vo2ili0EMFHEAwceOsqtsY QeEB5bTmucw/i8H+U+k+KHFELmojBbWuAYgvXQgk4pfv5INN/zRy1ZiqsKg/vda+6zb8FU YjMqQMcoX0LHL1jYCXj+QRDb4Dfdxuur18tYeeHt63C+h2Ndi+/4tbW8DTaIKantVOKahU QAbnOShGp93gmZy88pCkeHveD9raB/UhDd6t+jE+0p7++ft6UmDUWilmmpDzTZM6LM5Bn/ X0IQkAwrW5Wf6ZIwijbyicSGA64NrlTClOnYdd50MHvV1F6U4oeiFJY4M4/VGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711115725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ym//LYTrehtPW+6jlCutnXN5JAs4uz+tZOQcaWP9eT4=; b=eRdVfK93GL3/v6UmLpWP6071gkfDhlNOjsF6MkT+PjCZIVt8GUN10c7T8KTLT/G2HaaHef i1egIU1FxQzQd/G8PFJzLVuu+wXlRqEE9wA4JHSVAiQIRWwvCEaoL7+R0E05PqOrPr4qCB Se+rvbYvkXIQ4/w9H3YmqO7BMhW90ZaOxHXBxmsDrTqILcNdaktEyOY1KCiPfV+uOSBjvD dgny5GJPnzlHBeH45EteDFo4A0RupSIroTmYOYf3cNzLsHJwv+H/pV5l7B2jBxcmBZRaK7 oNYmyC/0YgQhpNJzHFe8heO2uXQdEFNS0rmYc7sc62EJvWxkFxdkzgAkmX8iCg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4V1P3d4gQJz1LwT; Fri, 22 Mar 2024 13:55:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 42MDtPx1037737; Fri, 22 Mar 2024 13:55:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42MDtPF3037735; Fri, 22 Mar 2024 13:55:25 GMT (envelope-from git) Date: Fri, 22 Mar 2024 13:55:25 GMT Message-Id: <202403221355.42MDtPF3037735@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: da2d6e2815d7 - main - rtld: fix check for endianess of elf hints file 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: da2d6e2815d7694e3ccbd561508074c547b02dd6 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=da2d6e2815d7694e3ccbd561508074c547b02dd6 commit da2d6e2815d7694e3ccbd561508074c547b02dd6 Author: Michael Tuexen AuthorDate: 2024-03-22 13:50:25 +0000 Commit: Michael Tuexen CommitDate: 2024-03-22 13:50:25 +0000 rtld: fix check for endianess of elf hints file Don't check if the elf hints file is in host byte order, but check if it is in little endian by looking at the magic number. This fixes rtld on big endian platforms. Reviewed by: se, kib (prior version of the patch) Fixes: 7b77d37a561b ("rtld-elf: support either byte-order of hints") MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D44472 --- libexec/rtld-elf/rtld.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index fbf5b3e20a1f..3071eacbc995 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -2081,7 +2081,7 @@ gethints(bool nostdlib) uint32_t strtab; /* Offset of string table in file */ uint32_t dirlist; /* Offset of directory list in string table */ uint32_t dirlistlen; /* strlen(dirlist) */ - bool is_le; + bool is_le; /* Does the hints file use little endian */ bool skip; /* First call, read the hints file */ @@ -2108,7 +2108,7 @@ cleanup1: hdr.dirlistlen = 0; return (NULL); } - is_le = /*le32toh(1) == 1 || */ hdr.magic == ELFHINTS_MAGIC; + is_le = /*htole32(1) == 1 || */ hdr.magic == htole32(ELFHINTS_MAGIC); dbg("host byte-order: %s-endian", le32toh(1) == 1 ? "little" : "big"); dbg("hints file byte-order: %s-endian", is_le ? "little" : "big"); dbg("verify swap macros: le32toh(0x12345678) == %#010x, "