release 6.16.3 (preliminary)
This commit is contained in:
45
debian/patches/bugfix/all/bootconfig-fix-negative-seeks-on-32-bit-with-lfs-ena.patch
vendored
Normal file
45
debian/patches/bugfix/all/bootconfig-fix-negative-seeks-on-32-bit-with-lfs-ena.patch
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
From: Ben Hutchings <benh@debian.org>
|
||||
Date: Sun, 17 Aug 2025 16:06:28 +0200
|
||||
Subject: bootconfig: Fix negative seeks on 32-bit with LFS enabled
|
||||
Forwarded: https://lore.kernel.org/linux-trace-kernel/aKHlevxeg6Y7UQrz@decadent.org.uk/T/
|
||||
|
||||
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.
|
||||
|
||||
Fixes: 26dda5769509 ("tools/bootconfig: Cleanup bootconfig footer size calculations")
|
||||
Signed-off-by: Ben Hutchings <benh@debian.org>
|
||||
---
|
||||
tools/bootconfig/main.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/tools/bootconfig/main.c
|
||||
+++ b/tools/bootconfig/main.c
|
||||
@@ -193,7 +193,7 @@ static int load_xbc_from_initrd(int fd,
|
||||
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,
|
||||
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)
|
71
debian/patches/bugfix/all/bootconfig-fix-unaligned-access-when-building-footer.patch
vendored
Normal file
71
debian/patches/bugfix/all/bootconfig-fix-unaligned-access-when-building-footer.patch
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
From: Ben Hutchings <benh@debian.org>
|
||||
Date: Wed, 23 Jul 2025 12:17:14 +0200
|
||||
Subject: bootconfig: Fix unaligned access when building footer
|
||||
Forwarded: https://lore.kernel.org/linux-trace-kernel/aIC-NTw-cdm9ZGFw@decadent.org.uk/T/
|
||||
|
||||
Currently we add padding between the bootconfig text and footer to
|
||||
ensure that the footer is aligned within the initramfs image.
|
||||
However, because only the bootconfig data is held in memory, not the
|
||||
full initramfs image, the footer may not be naturally aligned in
|
||||
memory.
|
||||
|
||||
This can result in an alignment fault (SIGBUS) when writing the footer
|
||||
on some architectures, such as sparc.
|
||||
|
||||
Build the footer in a struct on the stack before adding it to the
|
||||
buffer.
|
||||
|
||||
References: https://buildd.debian.org/status/fetch.php?pkg=linux&arch=sparc64&ver=6.16%7Erc7-1%7Eexp1&stamp=1753209801&raw=0
|
||||
Signed-off-by: Ben Hutchings <benh@debian.org>
|
||||
---
|
||||
tools/bootconfig/main.c | 24 +++++++++++++-----------
|
||||
1 file changed, 13 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/tools/bootconfig/main.c
|
||||
+++ b/tools/bootconfig/main.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <endian.h>
|
||||
+#include <assert.h>
|
||||
|
||||
#include <linux/bootconfig.h>
|
||||
|
||||
@@ -363,7 +364,12 @@ static int delete_xbc(const char *path)
|
||||
|
||||
static int apply_xbc(const char *path, const char *xbc_path)
|
||||
{
|
||||
- char *buf, *data, *p;
|
||||
+ struct {
|
||||
+ uint32_t size;
|
||||
+ uint32_t csum;
|
||||
+ char magic[BOOTCONFIG_MAGIC_LEN];
|
||||
+ } footer;
|
||||
+ char *buf, *data;
|
||||
size_t total_size;
|
||||
struct stat stat;
|
||||
const char *msg;
|
||||
@@ -433,17 +439,13 @@ static int apply_xbc(const char *path, c
|
||||
size += pad;
|
||||
|
||||
/* Add a footer */
|
||||
- p = data + size;
|
||||
- *(uint32_t *)p = htole32(size);
|
||||
- p += sizeof(uint32_t);
|
||||
+ footer.size = htole32(size);
|
||||
+ footer.csum = htole32(csum);
|
||||
+ memcpy(footer.magic, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN);
|
||||
+ static_assert(sizeof(footer) == BOOTCONFIG_FOOTER_SIZE);
|
||||
+ memcpy(data + size, &footer, BOOTCONFIG_FOOTER_SIZE);
|
||||
|
||||
- *(uint32_t *)p = htole32(csum);
|
||||
- p += sizeof(uint32_t);
|
||||
-
|
||||
- memcpy(p, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN);
|
||||
- p += BOOTCONFIG_MAGIC_LEN;
|
||||
-
|
||||
- total_size = p - data;
|
||||
+ total_size = size + BOOTCONFIG_FOOTER_SIZE;
|
||||
|
||||
ret = write(fd, data, total_size);
|
||||
if (ret < total_size) {
|
45
debian/patches/bugfix/all/ext4-don-t-try-to-clear-the-orphan_present-feature-b.patch
vendored
Normal file
45
debian/patches/bugfix/all/ext4-don-t-try-to-clear-the-orphan_present-feature-b.patch
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
From: Theodore Ts'o <tytso@mit.edu>
|
||||
Date: Thu, 7 Aug 2025 09:35:20 -0400
|
||||
Subject: ext4: don't try to clear the orphan_present feature block device is
|
||||
r/o
|
||||
Origin: https://git.kernel.org/linus/c5e104a91e7b6fa12c1dc2d8bf84abb7ef9b89ad
|
||||
Bug-Debian: https://bugs.debian.org/1108271
|
||||
|
||||
When the file system is frozen in preparation for taking an LVM
|
||||
snapshot, the journal is checkpointed and if the orphan_file feature
|
||||
is enabled, and the orphan file is empty, we clear the orphan_present
|
||||
feature flag. But if there are pending inodes that need to be removed
|
||||
the orphan_present feature flag can't be cleared.
|
||||
|
||||
The problem comes if the block device is read-only. In that case, we
|
||||
can't process the orphan inode list, so it is skipped in
|
||||
ext4_orphan_cleanup(). But then in ext4_mark_recovery_complete(),
|
||||
this results in the ext4 error "Orphan file not empty on read-only fs"
|
||||
firing and the file system mount is aborted.
|
||||
|
||||
Fix this by clearing the needs_recovery flag in the block device is
|
||||
read-only. We do this after the call to ext4_load_and_init-journal()
|
||||
since there are some error checks need to be done in case the journal
|
||||
needs to be replayed and the block device is read-only, or if the
|
||||
block device containing the externa journal is read-only, etc.
|
||||
|
||||
Cc: stable@kernel.org
|
||||
Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1108271
|
||||
Cc: stable@vger.kernel.org
|
||||
Fixes: 02f310fcf47f ("ext4: Speedup ext4 orphan inode handling")
|
||||
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
||||
---
|
||||
fs/ext4/super.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/fs/ext4/super.c
|
||||
+++ b/fs/ext4/super.c
|
||||
@@ -5414,6 +5414,8 @@ static int __ext4_fill_super(struct fs_c
|
||||
err = ext4_load_and_init_journal(sb, es, ctx);
|
||||
if (err)
|
||||
goto failed_mount3a;
|
||||
+ if (bdev_read_only(sb->s_bdev))
|
||||
+ needs_recovery = 0;
|
||||
} else if (test_opt(sb, NOLOAD) && !sb_rdonly(sb) &&
|
||||
ext4_has_feature_journal_needs_recovery(sb)) {
|
||||
ext4_msg(sb, KERN_ERR, "required journal recovery "
|
@@ -18,7 +18,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
||||
|
||||
--- a/fs/btrfs/super.c
|
||||
+++ b/fs/btrfs/super.c
|
||||
@@ -2630,7 +2630,7 @@ module_exit(exit_btrfs_fs)
|
||||
@@ -2622,7 +2622,7 @@ module_exit(exit_btrfs_fs)
|
||||
|
||||
MODULE_DESCRIPTION("B-Tree File System (BTRFS)");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -29,7 +29,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
||||
MODULE_SOFTDEP("pre: blake2b-256");
|
||||
--- a/fs/jbd2/journal.c
|
||||
+++ b/fs/jbd2/journal.c
|
||||
@@ -3158,6 +3158,7 @@ static void __exit journal_exit(void)
|
||||
@@ -3157,6 +3157,7 @@ static void __exit journal_exit(void)
|
||||
|
||||
MODULE_DESCRIPTION("Generic filesystem journal-writing module");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -39,7 +39,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
||||
|
||||
--- a/fs/nfsd/nfsctl.c
|
||||
+++ b/fs/nfsd/nfsctl.c
|
||||
@@ -2349,5 +2349,8 @@ static void __exit exit_nfsd(void)
|
||||
@@ -2353,5 +2353,8 @@ static void __exit exit_nfsd(void)
|
||||
MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");
|
||||
MODULE_DESCRIPTION("In-kernel NFS server");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@@ -24,7 +24,7 @@ Signed-off-by: Ben Hutchings <benh@debian.org>
|
||||
pahole-flags-$(call test-ge, $(pahole-ver), 125) += --skip_encoding_btf_inconsistent_proto --btf_gen_optimized
|
||||
|
||||
else
|
||||
@@ -29,6 +27,18 @@ endif
|
||||
@@ -31,6 +29,18 @@ endif
|
||||
|
||||
endif
|
||||
|
||||
|
@@ -9,7 +9,7 @@ sources.
|
||||
|
||||
--- a/scripts/Makefile.build
|
||||
+++ b/scripts/Makefile.build
|
||||
@@ -184,6 +184,11 @@ cmd_record_mcount = $(if $(findstring $(
|
||||
@@ -268,6 +268,11 @@ cmd_record_mcount = $(if $(findstring $(
|
||||
$(sub_cmd_record_mcount))
|
||||
endif # CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
|
||||
|
||||
|
90
debian/patches/bugfix/all/tools-bootconfig-cleanup-bootconfig-footer-size-calc.patch
vendored
Normal file
90
debian/patches/bugfix/all/tools-bootconfig-cleanup-bootconfig-footer-size-calc.patch
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
|
||||
Date: Thu, 10 Jul 2025 11:24:17 +0900
|
||||
Subject: tools/bootconfig: Cleanup bootconfig footer size calculations
|
||||
Origin: https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git/commit?id=26dda57695090e05c1a99c3e8f802f862d1ac474
|
||||
|
||||
There are many same pattern of 8 + BOOTCONFIG_MAGIC_LEN for calculating
|
||||
the size of bootconfig footer. Use BOOTCONFIG_FOOTER_SIZE macro to
|
||||
clean up those magic numbers.
|
||||
|
||||
Link: https://lore.kernel.org/all/175211425693.2591046.16029516706923643510.stgit@mhiramat.tok.corp.google.com/
|
||||
|
||||
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
|
||||
---
|
||||
tools/bootconfig/main.c | 19 +++++++++++--------
|
||||
1 file changed, 11 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/tools/bootconfig/main.c
|
||||
+++ b/tools/bootconfig/main.c
|
||||
@@ -16,6 +16,10 @@
|
||||
|
||||
#define pr_err(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
|
||||
|
||||
+/* Bootconfig footer is [size][csum][BOOTCONFIG_MAGIC]. */
|
||||
+#define BOOTCONFIG_FOOTER_SIZE \
|
||||
+ (sizeof(uint32_t) * 2 + BOOTCONFIG_MAGIC_LEN)
|
||||
+
|
||||
static int xbc_show_value(struct xbc_node *node, bool semicolon)
|
||||
{
|
||||
const char *val, *eol;
|
||||
@@ -185,7 +189,7 @@ static int load_xbc_from_initrd(int fd,
|
||||
if (ret < 0)
|
||||
return -errno;
|
||||
|
||||
- if (stat.st_size < 8 + BOOTCONFIG_MAGIC_LEN)
|
||||
+ if (stat.st_size < BOOTCONFIG_FOOTER_SIZE)
|
||||
return 0;
|
||||
|
||||
if (lseek(fd, -BOOTCONFIG_MAGIC_LEN, SEEK_END) < 0)
|
||||
@@ -198,7 +202,7 @@ static int load_xbc_from_initrd(int fd,
|
||||
if (memcmp(magic, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN) != 0)
|
||||
return 0;
|
||||
|
||||
- if (lseek(fd, -(8 + BOOTCONFIG_MAGIC_LEN), SEEK_END) < 0)
|
||||
+ if (lseek(fd, -BOOTCONFIG_FOOTER_SIZE, SEEK_END) < 0)
|
||||
return pr_errno("Failed to lseek for size", -errno);
|
||||
|
||||
if (read(fd, &size, sizeof(uint32_t)) < 0)
|
||||
@@ -210,12 +214,12 @@ static int load_xbc_from_initrd(int fd,
|
||||
csum = le32toh(csum);
|
||||
|
||||
/* Wrong size error */
|
||||
- if (stat.st_size < size + 8 + BOOTCONFIG_MAGIC_LEN) {
|
||||
+ if (stat.st_size < size + BOOTCONFIG_FOOTER_SIZE) {
|
||||
pr_err("bootconfig size is too big\n");
|
||||
return -E2BIG;
|
||||
}
|
||||
|
||||
- if (lseek(fd, stat.st_size - (size + 8 + BOOTCONFIG_MAGIC_LEN),
|
||||
+ if (lseek(fd, stat.st_size - (size + BOOTCONFIG_FOOTER_SIZE),
|
||||
SEEK_SET) < 0)
|
||||
return pr_errno("Failed to lseek", -errno);
|
||||
|
||||
@@ -346,7 +350,7 @@ static int delete_xbc(const char *path)
|
||||
ret = fstat(fd, &stat);
|
||||
if (!ret)
|
||||
ret = ftruncate(fd, stat.st_size
|
||||
- - size - 8 - BOOTCONFIG_MAGIC_LEN);
|
||||
+ - size - BOOTCONFIG_FOOTER_SIZE);
|
||||
if (ret)
|
||||
ret = -errno;
|
||||
} /* Ignore if there is no boot config in initrd */
|
||||
@@ -376,8 +380,7 @@ static int apply_xbc(const char *path, c
|
||||
csum = xbc_calc_checksum(buf, size);
|
||||
|
||||
/* Backup the bootconfig data */
|
||||
- data = calloc(size + BOOTCONFIG_ALIGN +
|
||||
- sizeof(uint32_t) + sizeof(uint32_t) + BOOTCONFIG_MAGIC_LEN, 1);
|
||||
+ data = calloc(size + BOOTCONFIG_ALIGN + BOOTCONFIG_FOOTER_SIZE, 1);
|
||||
if (!data)
|
||||
return -ENOMEM;
|
||||
memcpy(data, buf, size);
|
||||
@@ -425,7 +428,7 @@ static int apply_xbc(const char *path, c
|
||||
}
|
||||
|
||||
/* To align up the total size to BOOTCONFIG_ALIGN, get padding size */
|
||||
- total_size = stat.st_size + size + sizeof(uint32_t) * 2 + BOOTCONFIG_MAGIC_LEN;
|
||||
+ total_size = stat.st_size + size + BOOTCONFIG_FOOTER_SIZE;
|
||||
pad = ((total_size + BOOTCONFIG_ALIGN - 1) & (~BOOTCONFIG_ALIGN_MASK)) - total_size;
|
||||
size += pad;
|
||||
|
@@ -26,7 +26,7 @@ Tested-by: Michal Kubecek <mkubecek@suse.cz>
|
||||
|
||||
--- a/arch/powerpc/boot/Makefile
|
||||
+++ b/arch/powerpc/boot/Makefile
|
||||
@@ -97,7 +97,7 @@ BOOTCFLAGS += -fno-stack-protector
|
||||
@@ -98,7 +98,7 @@ BOOTCFLAGS += -fno-stack-protector
|
||||
endif
|
||||
|
||||
BOOTCFLAGS += -include $(srctree)/include/linux/compiler_attributes.h
|
||||
|
Reference in New Issue
Block a user