lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250821082026.9fbbfeaf2952437514b29dc8@kernel.org>
Date: Thu, 21 Aug 2025 08:20:26 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Ben Hutchings <benh@...ian.org>, Steven Rostedt <rostedt@...dmis.org>,
 Masami Hiramatsu <mhiramat@...nel.org>, linux-kernel@...r.kernel.org
Subject: [GIT PULL] bootconfig: Fixes for v6.17-rc2

Hi Linus,

Bootconfig fixes for v6.17-rc2:

- bootconfig: Fix negative seeks on 32-bit with LFS enabled
  On 32bit architecture, -BOOTCONFIG_FOOTER_SIZE (size_t, 32bit)
  becomes a positive value when it is passed to lseek() because it
  is casted to off_t (64bit). Thus, add type casts.


Please pull the latest bootconfig-fixes-v6.17-rc2 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
bootconfig-fixes-v6.17-rc2

Tag SHA1: abef3dc0b6727f3ce96b51349ca15ff5d3e5d7d6
Head SHA1: 729dc340a4ed1267774fc8518284e976e2210bdc


Ben Hutchings (1):
      bootconfig: Fix negative seeks on 32-bit with LFS enabled

----
 tools/bootconfig/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---------------------------
commit 729dc340a4ed1267774fc8518284e976e2210bdc
Author: Ben Hutchings <benh@...ian.org>
Date:   Sun Aug 17 16:21:46 2025 +0200

    bootconfig: Fix negative seeks on 32-bit with LFS enabled
    
    Commit 26dda5769509 "tools/bootconfig: Cleanup bootconfig footer size
    calculations" replaced some expressions of type int with the
    BOOTCONFIG_FOOTER_SIZE macro, which expands to an expression of type
    size_t, which is unsigned.
    
    On 32-bit architectures with LFS enabled (i.e. off_t is 64-bit), the
    seek offset of -BOOTCONFIG_FOOTER_SIZE now turns into a positive
    value.
    
    Fix this by casting the size to off_t before negating it.
    
    Just in case someone changes BOOTCONFIG_MAGIC_LEN to have type size_t
    later, do the same thing to the seek offset of -BOOTCONFIG_MAGIC_LEN.
    
    Link: https://lore.kernel.org/all/aKHlevxeg6Y7UQrz@decadent.org.uk/
    
    Fixes: 26dda5769509 ("tools/bootconfig: Cleanup bootconfig footer size calculations")
    Signed-off-by: Ben Hutchings <benh@...ian.org>
    Signed-off-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>

diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
index 57c669d2aa90..55d59ed507d5 100644
--- a/tools/bootconfig/main.c
+++ b/tools/bootconfig/main.c
@@ -193,7 +193,7 @@ static int load_xbc_from_initrd(int fd, char **buf)
 	if (stat.st_size < BOOTCONFIG_FOOTER_SIZE)
 		return 0;
 
-	if (lseek(fd, -BOOTCONFIG_MAGIC_LEN, SEEK_END) < 0)
+	if (lseek(fd, -(off_t)BOOTCONFIG_MAGIC_LEN, SEEK_END) < 0)
 		return pr_errno("Failed to lseek for magic", -errno);
 
 	if (read(fd, magic, BOOTCONFIG_MAGIC_LEN) < 0)
@@ -203,7 +203,7 @@ static int load_xbc_from_initrd(int fd, char **buf)
 	if (memcmp(magic, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN) != 0)
 		return 0;
 
-	if (lseek(fd, -BOOTCONFIG_FOOTER_SIZE, SEEK_END) < 0)
+	if (lseek(fd, -(off_t)BOOTCONFIG_FOOTER_SIZE, SEEK_END) < 0)
 		return pr_errno("Failed to lseek for size", -errno);
 
 	if (read(fd, &size, sizeof(uint32_t)) < 0)

-- 
Masami Hiramatsu (Google) <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ