diff options
Diffstat (limited to 'patches')
22 files changed, 855 insertions, 185 deletions
diff --git a/patches/boot/check-console-device-file-on-fs-when-booting.patch b/patches/boot/check-console-device-file-on-fs-when-booting.patch index 811db271..d1f3a339 100644 --- a/patches/boot/check-console-device-file-on-fs-when-booting.patch +++ b/patches/boot/check-console-device-file-on-fs-when-booting.patch @@ -1,4 +1,4 @@ -From 7788d947f61304e6c2273b5f252b2f4bb43408ce Mon Sep 17 00:00:00 2001 +From 2f9c3e4ee446d66e110973eb5bf9f4f00220f186 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield <bruce.ashfield@windriver.com> Date: Thu, 8 Apr 2010 23:44:21 -0700 Subject: [PATCH] check console device file on fs when booting @@ -8,45 +8,45 @@ the tell tale signs is /dev/console not being a character file. To save a whole class of questions, let's just test for the condition and let the user know. +vfs_lstat() which was used previously would fail with certain +configurations. This was likely due to the involved functions being +marked __init at some point in the past. + Signed-off-by: Richard Laroque <rlarocqu@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> +Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> +Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com> --- - init/main.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) + init/main.c | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/init/main.c b/init/main.c -index 2cd736059416..ba93222f2999 100644 +index 649d9e4201a8..4e6af76ca199 100644 --- a/init/main.c +++ b/init/main.c -@@ -1157,6 +1157,18 @@ static int __ref kernel_init(void *unused) - - void console_on_rootfs(void) +@@ -1574,7 +1574,21 @@ static int __ref kernel_init(void *unused) + /* Open /dev/console, for stdin/stdout/stderr, this should never fail */ + void __init console_on_rootfs(void) { +- struct file *file = filp_open("/dev/console", O_RDWR, 0); ++ struct file *file; ++ +#ifndef CONFIG_BLK_DEV_INITRD -+ /* -+ * Use /dev/console to infer if the rootfs is setup properly. -+ * In case of initrd or initramfs /dev/console might be instantiated -+ * later by /init so don't do this check for CONFIG_BLK_DEV_INITRD -+ */ -+ if (vfs_lstat((char __user *) "/dev/console", (struct kstat __user *) &console_stat) -+ || !S_ISCHR(console_stat.mode)) { ++ /* ++ * Use /dev/console to infer if the rootfs is setup properly. ++ * In case of initrd or initramfs /dev/console might be instantiated ++ * later by /init so don't do this check for CONFIG_BLK_DEV_INITRD ++ */ ++ struct kstat stat; ++ if (init_stat("/dev/console", &stat, 0) || !S_ISCHR(stat.mode)) { + panic("/dev/console is missing or not a character device!\nPlease ensure your rootfs is properly configured\n"); + } +#endif + - /* Open the /dev/console as stdin, this should never fail */ - if (ksys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) - pr_err("Warning: unable to open an initial console.\n"); -@@ -1168,6 +1180,9 @@ void console_on_rootfs(void) ++ file = filp_open("/dev/console", O_RDWR, 0); - static noinline void __init kernel_init_freeable(void) - { -+#ifndef CONFIG_BLK_DEV_INITRD -+ struct kstat console_stat; -+#endif - /* - * Wait until kthreadd is all set-up. - */ + if (IS_ERR(file)) { + pr_err("Warning: unable to open an initial console.\n"); -- 2.19.1 diff --git a/patches/boot/mount_root-clarify-error-messages-for-when-no-rootfs.patch b/patches/boot/mount_root-clarify-error-messages-for-when-no-rootfs.patch index 64809d68..286993ea 100644 --- a/patches/boot/mount_root-clarify-error-messages-for-when-no-rootfs.patch +++ b/patches/boot/mount_root-clarify-error-messages-for-when-no-rootfs.patch @@ -1,4 +1,4 @@ -From 02b8e9894174f57d64db04d3cf190415abc0ea43 Mon Sep 17 00:00:00 2001 +From ca14e0ea8ac29797e9eedfda5456b818a83626e8 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker <paul.gortmaker@windriver.com> Date: Thu, 26 Nov 2009 07:32:09 -0800 Subject: [PATCH] mount_root: clarify error messages for when no rootfs found @@ -20,33 +20,36 @@ any background that it is an end user configuration issue. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com> +--- + init/do_mounts.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/init/do_mounts.c b/init/do_mounts.c -index dea5de95c2dd..8b35204910be 100644 +index 5fdef94f0864..73d5b89d0c24 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c -@@ -418,7 +418,9 @@ retry: - printk("DEBUG_BLOCK_EXT_DEVT is enabled, you need to specify " - "explicit textual name for \"root=\" boot option.\n"); - #endif +@@ -231,7 +231,9 @@ void __init mount_root_generic(char *name, char *pretty_name, int flags) + pr_err("\n"); + } + - panic("VFS: Unable to mount root fs on %s", b); + printk(KERN_EMERG "VFS: Unable to mount root fs on %s\n", b); + printk(KERN_EMERG "User configuration error - no valid root filesystem found\n"); + panic("Invalid configuration from end user prevents continuing"); } - if (!(flags & MS_RDONLY)) { - flags |= MS_RDONLY; -@@ -434,7 +436,9 @@ retry: - #ifdef CONFIG_BLOCK - __bdevname(ROOT_DEV, b); - #endif -- panic("VFS: Unable to mount root fs on %s", b); -+ printk(KERN_EMERG "VFS: Unable to mount root fs on %s\n", b); + if (!(flags & SB_RDONLY)) { + flags |= SB_RDONLY; +@@ -244,7 +246,9 @@ void __init mount_root_generic(char *name, char *pretty_name, int flags) + for (i = 0, p = fs_names; i < num_fs; i++, p += strlen(p)+1) + printk(" %s", p); + printk("\n"); +- panic("VFS: Unable to mount root fs on \"%s\" or %s", pretty_name, b); ++ printk(KERN_EMERG "VFS: Unable to mount root fs on \"%s\" or %s\n", pretty_name, b); + printk(KERN_EMERG "User configuration error - no valid root filesystem found\n"); + panic("Invalid configuration from end user prevents continuing"); out: put_page(page); } -- -2.10.1 +2.34.1 diff --git a/patches/build/build.scc b/patches/build/build.scc index 181da38c..367c0cc2 100644 --- a/patches/build/build.scc +++ b/patches/build/build.scc @@ -8,3 +8,7 @@ patch kbuild-exclude-meta-directory-from-distclean-processi.patch patch modpost-mask-trivial-warnings.patch patch menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch + +# solved in 6.x by removing the need for ASM_GOTO as an arch dependency +#patch init-Kconfig-fix-CC_HAS_ASM_GOTO_TIED_OUTPUT-test-wi.patch +patch mconf-fix-output-of-cflags-and-libraries.patch diff --git a/patches/build/init-Kconfig-fix-CC_HAS_ASM_GOTO_TIED_OUTPUT-test-wi.patch b/patches/build/init-Kconfig-fix-CC_HAS_ASM_GOTO_TIED_OUTPUT-test-wi.patch new file mode 100644 index 00000000..13bfce6d --- /dev/null +++ b/patches/build/init-Kconfig-fix-CC_HAS_ASM_GOTO_TIED_OUTPUT-test-wi.patch @@ -0,0 +1,103 @@ +From e0e977e1b098d96389f2ab657849456ded9189c9 Mon Sep 17 00:00:00 2001 +From: Alexandre Belloni <alexandre.belloni@bootlin.com> +Date: Thu, 4 Aug 2022 21:03:20 +0200 +Subject: [PATCH] init/Kconfig: fix CC_HAS_ASM_GOTO_TIED_OUTPUT test with dash +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When using dash as /bin/sh, the CC_HAS_ASM_GOTO_TIED_OUTPUT test fails +with a syntax error which is not the one we are looking for: + +<stdin>: In function ‘foo’: +<stdin>:1:29: warning: missing terminating " character +<stdin>:1:29: error: missing terminating " character +<stdin>:2:5: error: expected ‘:’ before ‘+’ token +<stdin>:2:7: warning: missing terminating " character +<stdin>:2:7: error: missing terminating " character +<stdin>:2:5: error: expected declaration or statement at end of input + +Move all the CC_HAS_ASM_GOTO tests to scripts/gcc-goto.sh to solve the +escaping issues. + +Fixes: 1aa0e8b144b6 ("Kconfig: Add option for asm goto w/ tied outputs to workaround clang-13 bug") +Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> +Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> +--- + init/Kconfig | 6 +++--- + scripts/gcc-goto.sh | 31 +++++++++++++++++++++++++++++++ + 2 files changed, 34 insertions(+), 3 deletions(-) + +diff --git a/init/Kconfig b/init/Kconfig +index c7900e8975f1..80b252ba58b0 100644 +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -71,16 +71,16 @@ config CC_CAN_LINK_STATIC + default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m32-flag) -static) + + config CC_HAS_ASM_GOTO +- def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC)) ++ def_bool $(success,$(srctree)/scripts/gcc-goto.sh goto $(CC)) + + config CC_HAS_ASM_GOTO_OUTPUT + depends on CC_HAS_ASM_GOTO +- def_bool $(success,echo 'int foo(int x) { asm goto ("": "=r"(x) ::: bar); return x; bar: return 0; }' | $(CC) -x c - -c -o /dev/null) ++ def_bool $(success,$(srctree)/scripts/gcc-goto.sh goto_output $(CC)) + + config CC_HAS_ASM_GOTO_TIED_OUTPUT + depends on CC_HAS_ASM_GOTO_OUTPUT + # Detect buggy gcc and clang, fixed in gcc-11 clang-14. +- def_bool $(success,echo 'int foo(int *x) { asm goto (".long (%l[bar]) - .\n": "+m"(*x) ::: bar); return *x; bar: return 0; }' | $CC -x c - -c -o /dev/null) ++ def_bool $(success,$(srctree)/scripts/gcc-goto.sh goto_tied_output $(CC)) + + config TOOLS_SUPPORT_RELR + def_bool $(success,env "CC=$(CC)" "LD=$(LD)" "NM=$(NM)" "OBJCOPY=$(OBJCOPY)" $(srctree)/scripts/tools-support-relr.sh) +diff --git a/scripts/gcc-goto.sh b/scripts/gcc-goto.sh +index 8b980fb2270a..aa9498b74df8 100755 +--- a/scripts/gcc-goto.sh ++++ b/scripts/gcc-goto.sh +@@ -3,6 +3,11 @@ + # Test for gcc 'asm goto' support + # Copyright (C) 2010, Jason Baron <jbaron@redhat.com> + ++TEST=$1 ++shift ++ ++case $TEST in ++ "goto") + cat << "END" | $@ -x c - -fno-PIE -c -o /dev/null + int main(void) + { +@@ -20,3 +25,29 @@ entry: + return 0; + } + END ++ ;; ++ ++ "goto_output") ++cat << "END" | $@ -x c - -c -o /dev/null ++int foo(int x) { ++ asm goto ("": "=r"(x) ::: bar); ++ return x; ++ bar: return 0; ++} ++END ++ ;; ++ ++ "goto_tied_output") ++cat << "END" | $@ -x c - -c -o /dev/null ++int foo(int *x) { ++ asm goto (".long (%l[bar]) - .\n": "+m"(*x) ::: bar); ++ return *x; ++ bar: return 0; ++} ++END ++ ;; ++ ++ *) ++ exit -1 ++ ;; ++esac +-- +2.19.1 + diff --git a/patches/build/mconf-fix-output-of-cflags-and-libraries.patch b/patches/build/mconf-fix-output-of-cflags-and-libraries.patch new file mode 100644 index 00000000..565f51dd --- /dev/null +++ b/patches/build/mconf-fix-output-of-cflags-and-libraries.patch @@ -0,0 +1,38 @@ +From dee78ad1963cff9c063fba486d43fc9670285883 Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield <bruce.ashfield@gmail.com> +Date: Mon, 17 Jul 2023 17:17:55 -0400 +Subject: [PATCH] mconf: fix output of cflags and libraries + +commit 3122c84409d578a5df8bcb1 [kconfig: refactor Makefile to reduce +process forks] changes the way that flags are detected. They are +no longer just echo'd and captured, they are written to a file and +later read. + +We adjust our CROSS ncurses patch accordingly. + +We'll eventually be able to drop this patch, but not quite yet. + +Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> +--- + scripts/kconfig/mconf-cfg.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/scripts/kconfig/mconf-cfg.sh b/scripts/kconfig/mconf-cfg.sh +index 38cf8304bb31..a5ae56e08b07 100755 +--- a/scripts/kconfig/mconf-cfg.sh ++++ b/scripts/kconfig/mconf-cfg.sh +@@ -8,9 +8,9 @@ PKG="ncursesw" + PKG2="ncurses" + + if [ "$CROSS_CURSES_LIB" != "" ]; then +- echo libs=\'$CROSS_CURSES_LIB\' ++ echo $CROSS_CURSES_LIB > ${libs} + if [ x"$CROSS_CURSES_INC" != x ]; then +- echo cflags=\'$CROSS_CURSES_INC\' ++ echo $CROSS_CURSES_INC > ${cflags} + fi + exit 0 + fi +-- +2.34.1 + diff --git a/patches/build/menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch b/patches/build/menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch index dde1554d..9a301b63 100644 --- a/patches/build/menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch +++ b/patches/build/menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch @@ -1,4 +1,4 @@ -From b50cad575d2b9d3f8fc0b01e83a5c7fd3cddb684 Mon Sep 17 00:00:00 2001 +From 660178adc3529a6cb06bd0bfdfd22c5cb24cee5c Mon Sep 17 00:00:00 2001 From: Bruce Ashfield <bruce.ashfield@windriver.com> Date: Mon, 2 Jul 2018 23:10:28 -0400 Subject: [PATCH] menuconfig,mconf-cfg: Allow specification of ncurses location @@ -26,9 +26,7 @@ Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> mode change 100755 => 100644 scripts/kconfig/mconf-cfg.sh diff --git a/scripts/kconfig/mconf-cfg.sh b/scripts/kconfig/mconf-cfg.sh -old mode 100755 -new mode 100644 -index c812872d7f9d..65a9b9e5b8a6 +index 025b565e0b7c..a3c59b360ca3 --- a/scripts/kconfig/mconf-cfg.sh +++ b/scripts/kconfig/mconf-cfg.sh @@ -4,6 +4,14 @@ @@ -43,9 +41,9 @@ index c812872d7f9d..65a9b9e5b8a6 + exit 0 +fi + - if [ -n "$(command -v pkg-config)" ]; then - if pkg-config --exists $PKG; then - echo cflags=\"$(pkg-config --cflags $PKG)\" + if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then + if ${HOSTPKG_CONFIG} --exists $PKG; then + echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG)\" -- -2.5.0 +2.19.1 diff --git a/patches/build/modpost-mask-trivial-warnings.patch b/patches/build/modpost-mask-trivial-warnings.patch index e7c86823..1b202f5d 100644 --- a/patches/build/modpost-mask-trivial-warnings.patch +++ b/patches/build/modpost-mask-trivial-warnings.patch @@ -1,4 +1,4 @@ -From 1de72de61de403c164a6e0cf8e2b2fbe7379518b Mon Sep 17 00:00:00 2001 +From 14ad0a1925fad537a485227a5d89eb4329975e97 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker <paul.gortmaker@windriver.com> Date: Sun, 25 Jan 2009 17:58:09 -0500 Subject: [PATCH] modpost: mask trivial warnings @@ -11,14 +11,14 @@ once the kernel build kicks off. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> --- - scripts/mod/modpost.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) + scripts/mod/modpost.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c -index 6e892c93d104..80e998155459 100644 +index 620dc8c4c814..618c4a9e83ed 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c -@@ -2010,7 +2010,7 @@ static void read_symbols(const char *modname) +@@ -1964,7 +1964,7 @@ static void read_symbols(const char *modname) char *license; char *namespace; struct module *mod; @@ -27,24 +27,15 @@ index 6e892c93d104..80e998155459 100644 Elf_Sym *sym; if (!parse_elf(&info, modname)) -@@ -2502,7 +2502,7 @@ static int dump_sym(struct symbol *sym) +@@ -2455,7 +2455,7 @@ static void read_dump(const char *fname) static void write_dump(const char *fname) { - struct buffer buf = { }; + struct buffer buf = { NULL, 0, 0 }; - struct symbol *symbol; - const char *namespace; - int n; -@@ -2556,7 +2556,7 @@ struct ext_sym_list { - int main(int argc, char **argv) - { struct module *mod; -- struct buffer buf = { }; -+ struct buffer buf = { NULL, 0, 0 }; - char *kernel_read = NULL; - char *missing_namespace_deps = NULL; - char *dump_write = NULL, *files_source = NULL; + struct symbol *sym; + -- 2.19.1 diff --git a/patches/drivers/drivers.scc b/patches/drivers/drivers.scc index 548d2d44..4d7a225e 100644 --- a/patches/drivers/drivers.scc +++ b/patches/drivers/drivers.scc @@ -1 +1,2 @@ # SPDX-License-Identifier: MIT +patch mtd_blkdevs-add-mtd_table_mutex-lock-back-to-blktran.patch diff --git a/patches/drivers/mtd_blkdevs-add-mtd_table_mutex-lock-back-to-blktran.patch b/patches/drivers/mtd_blkdevs-add-mtd_table_mutex-lock-back-to-blktran.patch new file mode 100644 index 00000000..6d36effb --- /dev/null +++ b/patches/drivers/mtd_blkdevs-add-mtd_table_mutex-lock-back-to-blktran.patch @@ -0,0 +1,89 @@ +From 30350f237490eb52050647b2a75f6f4e91b2e44d Mon Sep 17 00:00:00 2001 +From: LiweiSong <liwei.song@windriver.com> +Date: Wed, 31 May 2023 17:31:35 +0800 +Subject: [PATCH] mtd_blkdevs: add mtd_table_mutex lock back to blktrans_{open, + release} to avoid race condition + +without lock mtd_table_mutex in blktrans_{open, release}, there will +be a race condition when access devices /dev/mtd1 and /dev/mtdblock1 +at the same time with a high frequency open and close test: + +kernel BUG at drivers/mtd/mtdcore.c:1221! +Internal error: Oops - BUG: 0 1 PREEMPT_RT SMP +CPU: 0 PID: 15349 Comm: mtd-test Not tainted 5.15.52-rt41-yocto-preempt-rt #1 +Hardware name: SoCFPGA Stratix 10 SoCDK (DT) +pstate: 60000005put_mtd_device+0x4c/0x84 +lr : blktrans_release+0xb0/0x120 +Call trace: +__put_mtd_device+0x4c/0x84 +blktrans_release+0xb0/0x120 +blkdev_put+0xd4/0x210 +blkdev_close+0x34/0x50 +__fput+0x8c/0x240 +____fput+0x1c/0x30 +task_work_run+0x98/00t_64_sync_handler+0xa4/0x130 +el0t_64_sync+0x1a0/0x1a4 + +since the original purpose of commit 799ae31c58ae ("mtd_blkdevs: +don't hold del_mtd_blktrans_dev in blktrans_{open, release}") is +to fix a DEADLOCK issue, here convert mutex_lock to mutex_trylock +and return immediately if failed acquire mtd_table_mutex, then +both race condition and DEADLOCK can be avoided. + +Fixes: 799ae31c58ae ("mtd_blkdevs: don't hold del_mtd_blktrans_dev in blktrans_{open, release}") +Signed-off-by: Liwei Song <liwei.song@windriver.com> +Signed-off-by: He Zhe <zhe.he@windriver.com> +Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> +--- + drivers/mtd/mtd_blkdevs.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c +index 60b222799871..31967ff4b826 100644 +--- a/drivers/mtd/mtd_blkdevs.c ++++ b/drivers/mtd/mtd_blkdevs.c +@@ -189,6 +189,8 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode) + + kref_get(&dev->ref); + ++ if (!mutex_trylock(&mtd_table_mutex)) ++ return ret; + mutex_lock(&dev->lock); + + if (dev->open) +@@ -213,6 +215,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode) + unlock: + dev->open++; + mutex_unlock(&dev->lock); ++ mutex_unlock(&mtd_table_mutex); + return ret; + + error_release: +@@ -221,6 +224,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode) + error_put: + module_put(dev->tr->owner); + mutex_unlock(&dev->lock); ++ mutex_unlock(&mtd_table_mutex); + blktrans_dev_put(dev); + return ret; + } +@@ -229,6 +233,8 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode) + { + struct mtd_blktrans_dev *dev = disk->private_data; + ++ if (!mutex_trylock(&mtd_table_mutex)) ++ return; + mutex_lock(&dev->lock); + + if (--dev->open) +@@ -243,6 +249,7 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode) + } + unlock: + mutex_unlock(&dev->lock); ++ mutex_unlock(&mtd_table_mutex); + blktrans_dev_put(dev); + } + +-- +2.34.1 + diff --git a/patches/misc/arm64-perf-Fix-wrong-cast-that-may-cause-wrong-trunc.patch b/patches/misc/arm64-perf-Fix-wrong-cast-that-may-cause-wrong-trunc.patch new file mode 100644 index 00000000..e310275c --- /dev/null +++ b/patches/misc/arm64-perf-Fix-wrong-cast-that-may-cause-wrong-trunc.patch @@ -0,0 +1,43 @@ +From 7fcb1380d3fa751a1559a2632a23ebf23f404077 Mon Sep 17 00:00:00 2001 +From: He Zhe <zhe.he@windriver.com> +Date: Fri, 21 Aug 2020 00:52:50 +0800 +Subject: [PATCH] arm64/perf: Fix wrong cast that may cause wrong truncation + +tail is a pointer while buftail.fp is a u32. + +arch/arm64/kernel/perf_callchain.c:100:6: warning: cast from pointer to +integer of different size [-Wpointer-to-int-cast] + 100 | if ((u32)tail + 4 >= buftail.fp) + | ^ +arch/arm64/kernel/perf_callchain.c:103:9: warning: cast to pointer from +integer of different size [-Wint-to-pointer-cast]{noformat} + 103 | return (struct compat_frame_tail __user *)(buftail.fp - 4); + | ^ + +Fixes: 8818670c17d2 ("arm64/perf: fix backtrace for AAPCS with FP enabled") +Signed-off-by: He Zhe <zhe.he@windriver.com> +Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> +--- + arch/arm64/kernel/perf_callchain.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/kernel/perf_callchain.c b/arch/arm64/kernel/perf_callchain.c +index 1be96e3631ea..a4b0864c4e32 100644 +--- a/arch/arm64/kernel/perf_callchain.c ++++ b/arch/arm64/kernel/perf_callchain.c +@@ -97,10 +97,10 @@ compat_user_backtrace(struct compat_frame_tail __user *tail, + * Frame pointers should strictly progress back up the stack + * (towards higher addresses). + */ +- if ((u32)tail + 4 >= buftail.fp) ++ if ((u64)tail + 4 >= (u64)buftail.fp) + return NULL; + +- return (struct compat_frame_tail __user *)(buftail.fp - 4); ++ return (struct compat_frame_tail __user *)((u64)buftail.fp - 4); + } + #endif /* CONFIG_COMPAT */ + +-- +2.19.1 + diff --git a/patches/misc/arm64-perf-fix-backtrace-for-AAPCS-with-FP-enabled.patch b/patches/misc/arm64-perf-fix-backtrace-for-AAPCS-with-FP-enabled.patch new file mode 100644 index 00000000..4c1e78cf --- /dev/null +++ b/patches/misc/arm64-perf-fix-backtrace-for-AAPCS-with-FP-enabled.patch @@ -0,0 +1,93 @@ +From cbbce37ccc6041d3ae3d3cb3b1918a61a39820a0 Mon Sep 17 00:00:00 2001 +From: Fang Jia <fang.jia@windriver.com> +Date: Fri, 28 Dec 2018 16:28:34 +0800 +Subject: [PATCH] arm64/perf: fix backtrace for AAPCS with FP enabled + +This change is for arm64 platform compat mode. +The change for arm32 platform has been included in this commit "perf: fix +backtrace for AAPCS with FP enabled". + +This change replaces code designed for the obsolete ARM APCS ABI, which +causes failures of the perf backtrace logic unless the gcc option +-mapcs-frame is used to build all binaries on the platform. This +obsolete gcc option forces the compiler to include the stack pointer +along with the frame pointer and link register in the stack frame +for each funciton call. The current AAPCS ABI document, doesn't +explicitly describe the frame structure when the gcc frame pointer +option, -fno-omit-frame-pointer, is enabled. However, with this option +enabled, examination of the emitted prologue instructions shows that +1) R11 is used as the frame pointer, +2) only the R11 and LR are saved onto the stack, not the stack pointer, +3) after this prologue setup, the frame pointer, R11 points to the +saved location of LR on the stack. + +The use of unsigned int arithmetic in the commit is required since +the gcc emitted pointer arithmetic uses 8-byte pointer sizes, which are +incorrect addresses for the 4-byte stack address size. + +Signed-off-by: Fang Jia <fang.jia@windriver.com> +Reviewed-by: Jiwei Sun <jiwei.sun@windriver.com> +Signed-off-by: De Huo <de.huo@windriver.com> +--- + arch/arm64/kernel/perf_callchain.c | 25 +++++++++++++++---------- + 1 file changed, 15 insertions(+), 10 deletions(-) + +diff --git a/arch/arm64/kernel/perf_callchain.c b/arch/arm64/kernel/perf_callchain.c +index 9d63514b9836..b9bbe0b04fc1 100644 +--- a/arch/arm64/kernel/perf_callchain.c ++++ b/arch/arm64/kernel/perf_callchain.c +@@ -54,16 +54,22 @@ user_backtrace(struct frame_tail __user *tail, + + #ifdef CONFIG_COMPAT + /* +- * The registers we're interested in are at the end of the variable +- * length saved register structure. The fp points at the end of this +- * structure so the address of this struct is: +- * (struct compat_frame_tail *)(xxx->fp)-1 ++ * The AAPCS ABI, the most current replacing the obsolete APCS ABI, ++ * does not specifically describe the stack frame with respect to the ++ * frame pointer. However, the examination of emitted prologue ++ * instructions for ARM implies that with -fno-omit-framepointer, ++ * register R11 is used as the frame pointer register and saved on the ++ * stack, with LR. + * +- * This code has been adapted from the ARM OProfile support. ++ * After the prolog, the FP points to the location of the saved LR and ++ * FP+4 points to the previous frames FP as shown below: ++ * Stack Hi Mem ++ * (Value of FP)+4 Saved FP for caller ++ * (Value of FP) LR set by caller ++ * Stack Lo Mem + */ + struct compat_frame_tail { + compat_uptr_t fp; /* a (struct compat_frame_tail *) in compat mode */ +- u32 sp; + u32 lr; + } __attribute__((packed)); + +@@ -91,11 +97,10 @@ compat_user_backtrace(struct compat_frame_tail __user *tail, + * Frame pointers should strictly progress back up the stack + * (towards higher addresses). + */ +- if (tail + 1 >= (struct compat_frame_tail __user *) +- compat_ptr(buftail.fp)) ++ if ((u32)tail + 4 >= buftail.fp) + return NULL; + +- return (struct compat_frame_tail __user *)compat_ptr(buftail.fp) - 1; ++ return (struct compat_frame_tail __user *)(buftail.fp - 4); + } + #endif /* CONFIG_COMPAT */ + +@@ -123,7 +128,7 @@ void perf_callchain_user(struct perf_callchain_entry_ctx *entry, + /* AARCH32 compat mode */ + struct compat_frame_tail __user *tail; + +- tail = (struct compat_frame_tail __user *)regs->compat_fp - 1; ++ tail = (struct compat_frame_tail __user *)(regs->compat_fp - 4); + + while ((entry->nr < entry->max_stack) && + tail && !((unsigned long)tail & 0x3)) +-- +2.17.1 + diff --git a/patches/misc/defconfigs-drop-obselete-options.patch b/patches/misc/defconfigs-drop-obselete-options.patch new file mode 100644 index 00000000..9005ff6f --- /dev/null +++ b/patches/misc/defconfigs-drop-obselete-options.patch @@ -0,0 +1,137 @@ +From 681badc58988e7d15aaf4b4b239b352b1601c3c2 Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield <bruce.ashfield@gmail.com> +Date: Mon, 10 Aug 2020 22:40:22 -0400 +Subject: [PATCH] defconfigs: drop obselete options + +Remove the following options from the various defconfigs, since +they are no longer valid, and will be reported as such by the +tools: + + CONFIG_TYPEC_HD3SS3220 + CONFIG_MFD_CROS_EC_CHARDEV + CONFIG_MTD_M25P80 + +Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> +--- + arch/arm/configs/axm55xx_defconfig | 1 - + arch/arm/configs/davinci_all_defconfig | 1 - + arch/arm/configs/dove_defconfig | 1 - + arch/arm/configs/keystone_defconfig | 1 - + arch/arm/configs/mvebu_v5_defconfig | 1 - + arch/arm/configs/mxs_defconfig | 1 - + arch/arm/configs/pxa_defconfig | 1 - + arch/arm/configs/qcom_defconfig | 1 - + arch/arm/configs/socfpga_defconfig | 1 - + 9 files changed, 9 deletions(-) + +diff --git a/arch/arm/configs/axm55xx_defconfig b/arch/arm/configs/axm55xx_defconfig +index 46075216ee6d..c731d4ade857 100644 +--- a/arch/arm/configs/axm55xx_defconfig ++++ b/arch/arm/configs/axm55xx_defconfig +@@ -88,7 +88,6 @@ CONFIG_MTD_CFI_AMDSTD=y + CONFIG_MTD_CFI_STAA=y + CONFIG_MTD_PHYSMAP=y + CONFIG_MTD_PHYSMAP_OF=y +-CONFIG_MTD_M25P80=y + CONFIG_PROC_DEVICETREE=y + CONFIG_BLK_DEV_LOOP=y + CONFIG_BLK_DEV_RAM=y +diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig +index e849367c0566..4d8f6f647dc6 100644 +--- a/arch/arm/configs/davinci_all_defconfig ++++ b/arch/arm/configs/davinci_all_defconfig +@@ -75,7 +75,6 @@ CONFIG_MTD_CFI=m + CONFIG_MTD_CFI_INTELEXT=m + CONFIG_MTD_CFI_AMDSTD=m + CONFIG_MTD_PHYSMAP=m +-CONFIG_MTD_M25P80=m + CONFIG_MTD_RAW_NAND=m + CONFIG_MTD_NAND_DAVINCI=m + CONFIG_MTD_SPI_NOR=m +diff --git a/arch/arm/configs/dove_defconfig b/arch/arm/configs/dove_defconfig +index 33074fdab2ea..7a548296ea8c 100644 +--- a/arch/arm/configs/dove_defconfig ++++ b/arch/arm/configs/dove_defconfig +@@ -44,7 +44,6 @@ CONFIG_MTD_CFI_GEOMETRY=y + CONFIG_MTD_CFI_INTELEXT=y + CONFIG_MTD_CFI_STAA=y + CONFIG_MTD_PHYSMAP=y +-CONFIG_MTD_M25P80=y + CONFIG_MTD_SPI_NOR=y + CONFIG_BLK_DEV_LOOP=y + CONFIG_BLK_DEV_RAM=y +diff --git a/arch/arm/configs/keystone_defconfig b/arch/arm/configs/keystone_defconfig +index 33c917df7b32..081cd5fa2358 100644 +--- a/arch/arm/configs/keystone_defconfig ++++ b/arch/arm/configs/keystone_defconfig +@@ -120,7 +120,6 @@ CONFIG_MTD=y + CONFIG_MTD_CMDLINE_PARTS=y + CONFIG_MTD_BLOCK=y + CONFIG_MTD_PLATRAM=y +-CONFIG_MTD_M25P80=y + CONFIG_MTD_RAW_NAND=y + CONFIG_MTD_NAND_DAVINCI=y + CONFIG_MTD_SPI_NOR=y +diff --git a/arch/arm/configs/mvebu_v5_defconfig b/arch/arm/configs/mvebu_v5_defconfig +index d57ff30dabff..3feef3fbc918 100644 +--- a/arch/arm/configs/mvebu_v5_defconfig ++++ b/arch/arm/configs/mvebu_v5_defconfig +@@ -74,7 +74,6 @@ CONFIG_MTD_CFI_GEOMETRY=y + CONFIG_MTD_CFI_INTELEXT=y + CONFIG_MTD_CFI_STAA=y + CONFIG_MTD_PHYSMAP=y +-CONFIG_MTD_M25P80=y + CONFIG_MTD_RAW_NAND=y + CONFIG_MTD_NAND_ORION=y + CONFIG_MTD_SPI_NOR=y +diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig +index ca32446b187f..bd87306385ad 100644 +--- a/arch/arm/configs/mxs_defconfig ++++ b/arch/arm/configs/mxs_defconfig +@@ -46,7 +46,6 @@ CONFIG_MTD=y + CONFIG_MTD_CMDLINE_PARTS=y + CONFIG_MTD_BLOCK=y + CONFIG_MTD_DATAFLASH=y +-CONFIG_MTD_M25P80=y + CONFIG_MTD_SST25L=y + CONFIG_MTD_RAW_NAND=y + CONFIG_MTD_NAND_GPMI_NAND=y +diff --git a/arch/arm/configs/pxa_defconfig b/arch/arm/configs/pxa_defconfig +index 58f4834289e6..87bbad9b3055 100644 +--- a/arch/arm/configs/pxa_defconfig ++++ b/arch/arm/configs/pxa_defconfig +@@ -178,7 +178,6 @@ CONFIG_MTD_RAM=m + CONFIG_MTD_ROM=m + CONFIG_MTD_COMPLEX_MAPPINGS=y + CONFIG_MTD_PXA2XX=m +-CONFIG_MTD_M25P80=m + CONFIG_MTD_BLOCK2MTD=y + CONFIG_MTD_DOCG3=m + CONFIG_MTD_RAW_NAND=m +diff --git a/arch/arm/configs/qcom_defconfig b/arch/arm/configs/qcom_defconfig +index 0daa9c0d298e..f03cf1f465fb 100644 +--- a/arch/arm/configs/qcom_defconfig ++++ b/arch/arm/configs/qcom_defconfig +@@ -61,7 +61,6 @@ CONFIG_DEVTMPFS=y + CONFIG_DEVTMPFS_MOUNT=y + CONFIG_MTD=y + CONFIG_MTD_BLOCK=y +-CONFIG_MTD_M25P80=y + CONFIG_MTD_RAW_NAND=y + CONFIG_MTD_NAND_QCOM=y + CONFIG_MTD_SPI_NOR=y +diff --git a/arch/arm/configs/socfpga_defconfig b/arch/arm/configs/socfpga_defconfig +index 2d9404ea52c6..f7ae6f5867ed 100644 +--- a/arch/arm/configs/socfpga_defconfig ++++ b/arch/arm/configs/socfpga_defconfig +@@ -47,7 +47,6 @@ CONFIG_DEVTMPFS=y + CONFIG_DEVTMPFS_MOUNT=y + CONFIG_MTD=y + CONFIG_MTD_BLOCK=y +-CONFIG_MTD_M25P80=y + CONFIG_MTD_RAW_NAND=y + CONFIG_MTD_NAND_DENALI_DT=y + CONFIG_MTD_SPI_NOR=y +-- +2.19.1 + diff --git a/patches/misc/iwlwifi-select-MAC80211_LEDS-conditionally.patch b/patches/misc/iwlwifi-select-MAC80211_LEDS-conditionally.patch new file mode 100644 index 00000000..2db53044 --- /dev/null +++ b/patches/misc/iwlwifi-select-MAC80211_LEDS-conditionally.patch @@ -0,0 +1,36 @@ +From 4e50d844ef9f358236e3c711b5a669ca721623e8 Mon Sep 17 00:00:00 2001 +From: Liwei Song <liwei.song@windriver.com> +Date: Mon, 28 Jun 2021 17:04:40 +0800 +Subject: [PATCH] iwlwifi: select MAC80211_LEDS conditionally + +MAC80211_LEDS depends on LEDS_CLASS=y or LEDS_CLASS=MAC80211, +add condition to enable it in iwlwifi/Kconfig to avoid below +compile warning when LEDS_CLASS was set to m: + +WARNING: unmet direct dependencies detected for MAC80211_LEDS + Depends on [n]: NET [=y] && WIRELESS [=y] && MAC80211 [=y] && (LEDS_CLASS [=m]=y || LEDS_CLASS [=m]=MAC80211 [=y]) + Selected by [m]: + - IWLWIFI_LEDS [=y] && NETDEVICES [=y] && WLAN [=y] && WLAN_VENDOR_INTEL [=y] && IWLWIFI [=m] && (LEDS_CLASS [=m]=y || LEDS_CLASS [=m]=IWLWIFI [=m]) && (IWLMVM [=m] || IWLDVM [=m]) + +Signed-off-by: Liwei Song <liwei.song@windriver.com> +Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> +--- + drivers/net/wireless/intel/iwlwifi/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/intel/iwlwifi/Kconfig b/drivers/net/wireless/intel/iwlwifi/Kconfig +index 1085afbefba8..0e1de69c259f 100644 +--- a/drivers/net/wireless/intel/iwlwifi/Kconfig ++++ b/drivers/net/wireless/intel/iwlwifi/Kconfig +@@ -50,7 +50,7 @@ config IWLWIFI_LEDS + depends on LEDS_CLASS=y || LEDS_CLASS=IWLWIFI + depends on IWLMVM || IWLDVM + select LEDS_TRIGGERS +- select MAC80211_LEDS ++ select MAC80211_LEDS if (LEDS_CLASS=y || LEDS_CLASS=MAC80211) + default y + + config IWLDVM +-- +2.19.1 + diff --git a/patches/misc/lib-build_OID_registry-fix-reproducibility-issues.patch b/patches/misc/lib-build_OID_registry-fix-reproducibility-issues.patch new file mode 100644 index 00000000..da04c927 --- /dev/null +++ b/patches/misc/lib-build_OID_registry-fix-reproducibility-issues.patch @@ -0,0 +1,43 @@ +From 2fca0fd719812ea2ff67630b01355aa80481623e Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield <bruce.ashfield@gmail.com> +Date: Sun, 10 Jul 2022 22:56:53 -0400 +Subject: [PATCH] lib/build_OID_registry: fix reproducibility issues + +The script build_OID_registry captures the full path of itself +in the generated data. This causes reproduciblity issues as the +path is captured and packaged. + +We use the basename of the script instead, and that allows us +to be reprodicible, with slightly less information captured in +the output data (but the generating script can still easily +be found). + +Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> +--- + lib/build_OID_registry | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/lib/build_OID_registry b/lib/build_OID_registry +index d7fc32ea8ac2..f6de0a7f7457 100755 +--- a/lib/build_OID_registry ++++ b/lib/build_OID_registry +@@ -8,6 +8,7 @@ + # + + use strict; ++use File::Basename; + + my @names = (); + my @oids = (); +@@ -35,7 +36,7 @@ close IN_FILE || die; + # + open C_FILE, ">$ARGV[1]" or die; + print C_FILE "/*\n"; +-print C_FILE " * Automatically generated by ", $0, ". Do not edit\n"; ++print C_FILE " * Automatically generated by ", basename $0, ". Do not edit\n"; + print C_FILE " */\n"; + + # +-- +2.19.1 + diff --git a/patches/misc/linux-yocto-Handle-bin-awk-issues.patch b/patches/misc/linux-yocto-Handle-bin-awk-issues.patch index 88739fb8..6c524699 100644 --- a/patches/misc/linux-yocto-Handle-bin-awk-issues.patch +++ b/patches/misc/linux-yocto-Handle-bin-awk-issues.patch @@ -1,4 +1,4 @@ -From 8bbf2b4e5a9d91bf465b4a370591abec1ba397bb Mon Sep 17 00:00:00 2001 +From 3e7a2ca72d99a2277ac42c578bd8f55ef9ef9141 Mon Sep 17 00:00:00 2001 From: Richard Purdie <richard.purdie@linuxfoundation.org> Date: Tue, 22 Aug 2017 09:50:50 +0100 Subject: [PATCH] linux-yocto: Handle /bin/awk issues @@ -11,14 +11,12 @@ Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> --- - arch/arm/tools/gen-mach-types | 2 +- - arch/sh/tools/gen-mach-types | 2 +- - arch/x86/tools/gen-insn-attr-x86.awk | 2 +- - tools/arch/x86/tools/gen-insn-attr-x86.awk | 2 +- - tools/perf/arch/x86/tests/gen-insn-x86-dat.awk | 2 +- - .../selftests/rcutorture/formal/srcu-cbmc/modify_srcu.awk | 0 - 6 files changed, 5 insertions(+), 5 deletions(-) - mode change 100755 => 100644 tools/testing/selftests/rcutorture/formal/srcu-cbmc/modify_srcu.awk + arch/arm/tools/gen-mach-types | 2 +- + arch/sh/tools/gen-mach-types | 2 +- + arch/x86/tools/gen-insn-attr-x86.awk | 2 +- + tools/arch/x86/tools/gen-insn-attr-x86.awk | 2 +- + tools/perf/arch/x86/tests/gen-insn-x86-dat.awk | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/tools/gen-mach-types b/arch/arm/tools/gen-mach-types index cbe1c33bb871..cb2b69f2a39d 100644 @@ -41,7 +39,7 @@ index 6d7c2d8eaf55..2a4a42a6d70c 100644 # # Awk script to generate include/generated/machtypes.h diff --git a/arch/x86/tools/gen-insn-attr-x86.awk b/arch/x86/tools/gen-insn-attr-x86.awk -index a42015b305f4..1c2832e9f77d 100644 +index af38469afd14..21a7a5db887e 100644 --- a/arch/x86/tools/gen-insn-attr-x86.awk +++ b/arch/x86/tools/gen-insn-attr-x86.awk @@ -1,4 +1,4 @@ @@ -51,7 +49,7 @@ index a42015b305f4..1c2832e9f77d 100644 # gen-insn-attr-x86.awk: Instruction attribute table generator # Written by Masami Hiramatsu <mhiramat@redhat.com> diff --git a/tools/arch/x86/tools/gen-insn-attr-x86.awk b/tools/arch/x86/tools/gen-insn-attr-x86.awk -index a42015b305f4..1c2832e9f77d 100644 +index af38469afd14..21a7a5db887e 100644 --- a/tools/arch/x86/tools/gen-insn-attr-x86.awk +++ b/tools/arch/x86/tools/gen-insn-attr-x86.awk @@ -1,4 +1,4 @@ @@ -70,9 +68,6 @@ index 1a29f6379bde..6285ff7158a5 100644 # SPDX-License-Identifier: GPL-2.0-only # gen-insn-x86-dat.awk: script to convert data for the insn-x86 test # Copyright (c) 2015, Intel Corporation. -diff --git a/tools/testing/selftests/rcutorture/formal/srcu-cbmc/modify_srcu.awk b/tools/testing/selftests/rcutorture/formal/srcu-cbmc/modify_srcu.awk -old mode 100755 -new mode 100644 -- -2.19.1 +2.34.1 diff --git a/patches/misc/misc.scc b/patches/misc/misc.scc index dc091c36..904f41c0 100644 --- a/patches/misc/misc.scc +++ b/patches/misc/misc.scc @@ -6,5 +6,12 @@ patch compiler.h-Undef-before-redefining-__attribute_const.patch patch uvesafb-print-error-message-when-task-timeout-occurs.patch patch uvesafb-provide-option-to-specify-timeout-for-task-c.patch patch linux-yocto-Handle-bin-awk-issues.patch -patch modpost-srcversion-sometimes-incorrect.patch -patch x86-boot-compressed-64-Define-__force_order-only-whe.patch +patch arm64-perf-fix-backtrace-for-AAPCS-with-FP-enabled.patch +patch defconfigs-drop-obselete-options.patch +patch arm64-perf-Fix-wrong-cast-that-may-cause-wrong-trunc.patch +patch net-dccp-make-it-depend-on-CONFIG_BROKEN-CVE-2020-16.patch +patch iwlwifi-select-MAC80211_LEDS-conditionally.patch +patch vt-conmakehash-improve-reproducibility.patch +patch lib-build_OID_registry-fix-reproducibility-issues.patch +patch tools-use-basename-to-identify-file-in-gen-mach-type.patch +patch pnmtologo-use-relocatable-file-name.patch diff --git a/patches/misc/modpost-srcversion-sometimes-incorrect.patch b/patches/misc/modpost-srcversion-sometimes-incorrect.patch deleted file mode 100644 index ab8d1b7c..00000000 --- a/patches/misc/modpost-srcversion-sometimes-incorrect.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 74f6cd2b6976e37491779fcb1bc4966d3a61492c Mon Sep 17 00:00:00 2001 -From: Juro Bystricky <juro.bystricky@intel.com> -Date: Fri, 30 Mar 2018 10:14:05 -0700 -Subject: [PATCH] modpost: srcversion sometimes incorrect - -"srcversion" field inserted into module modinfo section contains a -sum of the source files which made it. However, this field can -be incorrect. Building the same module can end up having inconsistent -srcversion field eventhough the sources remain the same. -This can be reproduced by building modules in a deeply nested directory, -but other factors contribute as well. - -The reason for incorrect srcversion is that some source files can be -simply silently skipped from the checksum calculation due to limited -buffer space for line parsing. - -This patch addresses two issues: - -1. Allocates a larger line buffer (32k vs 4k). -2. Issues a warning if a line length exceeds the line buffer. - -Signed-off-by: Juro Bystricky <juro.bystricky@intel.com> -Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> ---- - scripts/mod/modpost.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c -index b9bd26f3e6c9..7d2f1d659a43 100644 ---- a/scripts/mod/modpost.c -+++ b/scripts/mod/modpost.c -@@ -385,9 +385,10 @@ void *grab_file(const char *filename, unsigned long *size) - * spaces in the beginning of the line is trimmed away. - * Return a pointer to a static buffer. - **/ -+#define MODPOST_MAX_LINE 32768 - char *get_next_line(unsigned long *pos, void *file, unsigned long size) - { -- static char line[4096]; -+ static char line[MODPOST_MAX_LINE]; - int skip = 1; - size_t len = 0; - signed char *p = (signed char *)file + *pos; -@@ -402,8 +403,11 @@ char *get_next_line(unsigned long *pos, void *file, unsigned long size) - if (*p != '\n' && (*pos < size)) { - len++; - *s++ = *p++; -- if (len > 4095) -+ if (len > (sizeof(line)-1)) { -+ warn(" %s: line exceeds buffer size %zu bytes\n" -+ , __func__, sizeof(line)); - break; /* Too long, stop */ -+ } - } else { - /* End of string */ - *s = '\0'; --- -2.5.0 - diff --git a/patches/misc/net-dccp-make-it-depend-on-CONFIG_BROKEN-CVE-2020-16.patch b/patches/misc/net-dccp-make-it-depend-on-CONFIG_BROKEN-CVE-2020-16.patch new file mode 100644 index 00000000..263c6190 --- /dev/null +++ b/patches/misc/net-dccp-make-it-depend-on-CONFIG_BROKEN-CVE-2020-16.patch @@ -0,0 +1,45 @@ +From 56fd8c36614e9aaeadec647ce3d07f1ceb16a0a4 Mon Sep 17 00:00:00 2001 +From: Paul Gortmaker <paul.gortmaker@windriver.com> +Date: Wed, 5 May 2021 00:11:29 -0400 +Subject: [PATCH] net/dccp: make it depend on CONFIG_BROKEN (CVE-2020-16119) + +There were some proposed fixes for this back in 2020, but the discussion +largely fizzled out[1] and never got picked up again. + +We can see other distros are either blacklisting it from user space[2] +or explicitly calling it out as "is not set" in their base config[3] but +that really doesn't bind the workaround to the kernel source in any +robust transportable way. + +So I've done the tried and true "depends on BROKEN" to ensure the +workaround goes wherever the kernel source goes. + +We can revert this if a real fix eventually appears, but given that it +was marked "EXPERIMENTAL" back when we had that, I don't expect we'll +need to. Also note that none of our base ktypes or BSPs enabled it. + +[1] https://lore.kernel.org/netdev/20201013171849.236025-1-kleber.souza@canonical.com/T/ +[2] https://access.redhat.com/security/cve/cve-2020-16119 +[3] https://github.com/archlinux/svntogit-packages/commit/c07751100e1d64d9aa5789881ddc2ef68e43aed4 + +Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> +Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> +--- + net/dccp/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/net/dccp/Kconfig b/net/dccp/Kconfig +index 0c7d2f66ba27..efa01566da0f 100644 +--- a/net/dccp/Kconfig ++++ b/net/dccp/Kconfig +@@ -2,6 +2,7 @@ + menuconfig IP_DCCP + tristate "The DCCP Protocol" + depends on INET ++ depends on BROKEN + help + Datagram Congestion Control Protocol (RFC 4340) + +-- +2.19.1 + diff --git a/patches/misc/pnmtologo-use-relocatable-file-name.patch b/patches/misc/pnmtologo-use-relocatable-file-name.patch new file mode 100644 index 00000000..bcfb5904 --- /dev/null +++ b/patches/misc/pnmtologo-use-relocatable-file-name.patch @@ -0,0 +1,52 @@ +From 4da597cafebb4d6743da1dd54099dadb6c356e08 Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield <bruce.ashfield@gmail.com> +Date: Thu, 14 Jul 2022 14:43:46 -0400 +Subject: [PATCH] pnmtologo: use relocatable file name + +The logo generation utility is capturing the source of the logo +in the generated .c file. The source file is absolute (as passed +by make), so the full path is captured. + +This makes the source fail reproducibility tests. + +We use basename() to just get the source file name, and use +that in the generated .c file. + +Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> +--- + drivers/video/logo/pnmtologo.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/video/logo/pnmtologo.c b/drivers/video/logo/pnmtologo.c +index ada5ef6e51b7..7527be845443 100644 +--- a/drivers/video/logo/pnmtologo.c ++++ b/drivers/video/logo/pnmtologo.c +@@ -13,7 +13,7 @@ + #include <stdlib.h> + #include <string.h> + #include <unistd.h> +- ++#include <libgen.h> + + static const char *programname; + static const char *filename; +@@ -223,6 +223,7 @@ static inline int is_equal(struct color c1, struct color c2) + + static void write_header(void) + { ++ char *filename_basename = basename(filename); + /* open logo file */ + if (outputname) { + out = fopen(outputname, "w"); +@@ -235,7 +236,7 @@ static void write_header(void) + fputs("/*\n", out); + fputs(" * DO NOT EDIT THIS FILE!\n", out); + fputs(" *\n", out); +- fprintf(out, " * It was automatically generated from %s\n", filename); ++ fprintf(out, " * It was automatically generated from %s\n", filename_basename); + fputs(" *\n", out); + fprintf(out, " * Linux logo %s\n", logoname); + fputs(" */\n\n", out); +-- +2.34.1 + diff --git a/patches/misc/tools-use-basename-to-identify-file-in-gen-mach-type.patch b/patches/misc/tools-use-basename-to-identify-file-in-gen-mach-type.patch new file mode 100644 index 00000000..cd091361 --- /dev/null +++ b/patches/misc/tools-use-basename-to-identify-file-in-gen-mach-type.patch @@ -0,0 +1,41 @@ +From 6c085baf183868ed45d8c1d44408d7b24724cde5 Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield <bruce.ashfield@gmail.com> +Date: Wed, 13 Jul 2022 12:18:15 -0400 +Subject: [PATCH] tools: use basename to identify file in gen-mach-types + +FILENAME is replaced by the full path to the executing script. If +the script is executed via a fully specified path, that is captured +in the output. Although it doesn't impact the output, it does trigger +reproducibility warnings/errors. + +So we introduce a basename() function in the script and use it to +make sure the output file contains only the name of the awk script. + +Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> +--- + arch/arm/tools/gen-mach-types | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/tools/gen-mach-types b/arch/arm/tools/gen-mach-types +index cb2b69f2a39d..1fcdba948623 100644 +--- a/arch/arm/tools/gen-mach-types ++++ b/arch/arm/tools/gen-mach-types +@@ -21,10 +21,14 @@ NF == 3 { + num[nr] = ""; nr++ + } + ++ function basename(file) { ++ sub(".*/", "", file) ++ return file ++ } + + END { + printf("/*\n"); +- printf(" * This was automagically generated from %s!\n", FILENAME); ++ printf(" * This was automagically generated from %s!\n", basename(FILENAME)); + printf(" * Do NOT edit\n"); + printf(" */\n\n"); + printf("#ifndef __ASM_ARM_MACH_TYPE_H\n"); +-- +2.19.1 + diff --git a/patches/misc/vt-conmakehash-improve-reproducibility.patch b/patches/misc/vt-conmakehash-improve-reproducibility.patch new file mode 100644 index 00000000..cf663271 --- /dev/null +++ b/patches/misc/vt-conmakehash-improve-reproducibility.patch @@ -0,0 +1,53 @@ +From 0f586f4ee8adacac79b64d1f3d47799a5eb7fbea Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield <bruce.ashfield@gmail.com> +Date: Sun, 10 Jul 2022 21:37:07 -0400 +Subject: [PATCH] vt/conmakehash: improve reproducibility + +The file generated by conmakehash capture the application +path used to generate the file. While that can be informative, +it varies based on where the kernel was built, as the full +path is captured. + +We tweak the application to use a second input as the "capture +name", and then modify the Makefile to pass the basename of +the source, making it reproducible. + +This could be improved by using some sort of path mapping, +or the application manipualing argv[1] itself, but for now +this solves the reprodicibility issue. + +Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> +--- + drivers/tty/vt/Makefile | 2 +- + drivers/tty/vt/conmakehash.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/tty/vt/Makefile b/drivers/tty/vt/Makefile +index fe30ce512819..cb51c21b58f9 100644 +--- a/drivers/tty/vt/Makefile ++++ b/drivers/tty/vt/Makefile +@@ -15,7 +15,7 @@ clean-files := consolemap_deftbl.c defkeymap.c + hostprogs += conmakehash + + quiet_cmd_conmk = CONMK $@ +- cmd_conmk = $(obj)/conmakehash $< > $@ ++ cmd_conmk = $(obj)/conmakehash $< $(shell basename $<) > $@ + + $(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE) $(obj)/conmakehash + $(call cmd,conmk) +diff --git a/drivers/tty/vt/conmakehash.c b/drivers/tty/vt/conmakehash.c +index cddd789fe46e..d62510b280e9 100644 +--- a/drivers/tty/vt/conmakehash.c ++++ b/drivers/tty/vt/conmakehash.c +@@ -253,7 +253,7 @@ int main(int argc, char *argv[]) + #include <linux/types.h>\n\ + \n\ + u8 dfont_unicount[%d] = \n\ +-{\n\t", argv[1], fontlen); ++{\n\t", argv[2], fontlen); + + for ( i = 0 ; i < fontlen ; i++ ) + { +-- +2.19.1 + diff --git a/patches/misc/x86-boot-compressed-64-Define-__force_order-only-whe.patch b/patches/misc/x86-boot-compressed-64-Define-__force_order-only-whe.patch deleted file mode 100644 index c7b61b58..00000000 --- a/patches/misc/x86-boot-compressed-64-Define-__force_order-only-whe.patch +++ /dev/null @@ -1,43 +0,0 @@ -From ac6cf33b0484a6cedafb19fe999f5570e969cdbe Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Fri, 20 Dec 2019 17:42:02 -0800 -Subject: [PATCH] x86/boot/compressed/64: Define __force_order only when - CONFIG_RANDOMIZE_BASE is unset - -kaslr_64.c also defines the same variable, however when both files are -included into final link, linker complains about multiple definition of -`__force_order' which is coming from kaslr_64.o and pgtable_64.o, its -possible that kaslr_64.o is disabled via CONFIG_RANDOMIZE_BASE config -option, therefore define it conditionally only when -CONFIG_RANDOMIZE_BASE is not set - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> -Cc: Kees Cook <keescook@chromium.org> -Cc: "H. Peter Anvin" <hpa@zytor.com> -Cc: Ingo Molnar <mingo@redhat.com> -Cc: Thomas Gleixner <tglx@linutronix.de> -Cc: x86-ml <x86@kernel.org> -Cc: Arnd Bergmann <arnd@arndb.de> -Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> ---- - arch/x86/boot/compressed/pgtable_64.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/arch/x86/boot/compressed/pgtable_64.c b/arch/x86/boot/compressed/pgtable_64.c -index c8862696a47b..077d19268b0b 100644 ---- a/arch/x86/boot/compressed/pgtable_64.c -+++ b/arch/x86/boot/compressed/pgtable_64.c -@@ -12,7 +12,9 @@ - * It is not referenced from the code, but GCC < 5 with -fPIE would fail - * due to an undefined symbol. Define it to make these ancient GCCs work. - */ -+#ifndef CONFIG_RANDOMIZE_BASE - unsigned long __force_order; -+#endif - - #define BIOS_START_MIN 0x20000U /* 128K, less than this is insane */ - #define BIOS_START_MAX 0x9f000U /* 640K, absolute maximum */ --- -2.19.1 - |