From bf7956d375dfa9cc90cf6cc7210da37ba07ca6da Mon Sep 17 00:00:00 2001 From: Nikolay Borisov Date: May 02 2023 09:05:02 +0000 Subject: x86/tools/relocs: Fix non-POSIX regexp (git-fixes). --- diff --git a/patches.suse/x86-tools-relocs-fix-non-posix-regexp.patch b/patches.suse/x86-tools-relocs-fix-non-posix-regexp.patch new file mode 100644 index 0000000..4855af7 --- /dev/null +++ b/patches.suse/x86-tools-relocs-fix-non-posix-regexp.patch @@ -0,0 +1,60 @@ +From: "H. Nikolaus Schaller" +Date: Thu, 8 Jul 2021 10:57:09 +0200 +Subject: x86/tools/relocs: Fix non-POSIX regexp +Git-commit: fa953adfad7cf9c7e30d9ea0e4ccfd38cfb5495d +Patch-mainline: v5.14-rc5 +References: git-fixes + +Trying to run a cross-compiled x86 relocs tool on a BSD based +HOSTCC leads to errors like + + VOFFSET arch/x86/boot/compressed/../voffset.h - due to: vmlinux + CC arch/x86/boot/compressed/misc.o - due to: arch/x86/boot/compressed/../voffset.h + OBJCOPY arch/x86/boot/compressed/vmlinux.bin - due to: vmlinux + RELOCS arch/x86/boot/compressed/vmlinux.relocs - due to: vmlinux +empty (sub)expressionarch/x86/boot/compressed/Makefile:118: recipe for target 'arch/x86/boot/compressed/vmlinux.relocs' failed +make[3]: *** [arch/x86/boot/compressed/vmlinux.relocs] Error 1 + +It turns out that relocs.c uses patterns like + + "something(|_end)" + +This is not valid syntax or gives undefined results according +to POSIX 9.5.3 ERE Grammar + + https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html + +It seems to be silently accepted by the Linux regexp() implementation +while a BSD host complains. + +Such patterns can be replaced by a transformation like + + "(|p1|p2)" -> "(p1|p2)?" + +Fixes: fd952815307f ("x86-32, relocs: Whitelist more symbols for ld bug workaround") +Signed-off-by: H. Nikolaus Schaller +Signed-off-by: Masahiro Yamada +Acked-by: Nikolay Borisov +--- + arch/x86/tools/relocs.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/x86/tools/relocs.c ++++ b/arch/x86/tools/relocs.c +@@ -54,12 +54,12 @@ static const char * const sym_regex_kern + [S_REL] = + "^(__init_(begin|end)|" + "__x86_cpu_dev_(start|end)|" +- "(__parainstructions|__alt_instructions)(|_end)|" +- "(__iommu_table|__apicdrivers|__smp_locks)(|_end)|" ++ "(__parainstructions|__alt_instructions)(_end)?|" ++ "(__iommu_table|__apicdrivers|__smp_locks)(_end)?|" + "__(start|end)_pci_.*|" + "__(start|end)_builtin_fw|" +- "__(start|stop)___ksymtab(|_gpl|_unused|_unused_gpl|_gpl_future)|" +- "__(start|stop)___kcrctab(|_gpl|_unused|_unused_gpl|_gpl_future)|" ++ "__(start|stop)___ksymtab(_gpl|_unused|_unused_gpl|_gpl_future)?|" ++ "__(start|stop)___kcrctab(_gpl|_unused|_unused_gpl|_gpl_future)?|" + "__(start|stop)___param|" + "__(start|stop)___modver|" + "__(start|stop)___bug_table|" diff --git a/series.conf b/series.conf index aaa4f6c..31e212c 100644 --- a/series.conf +++ b/series.conf @@ -61289,6 +61289,7 @@ patches.suse/RDMA-rxe-Use-the-correct-size-of-wqe-when-processing.patch patches.suse/RDMA-rxe-Restore-setting-tot_len-in-the-IPv4-header.patch patches.suse/spi-mediatek-Fix-fifo-transfer.patch + patches.suse/x86-tools-relocs-fix-non-posix-regexp.patch patches.suse/0011-md-raid10-properly-indicate-failure-when-ending-a-fa.patch patches.suse/USB-usbtmc-Fix-RCU-stall-warning.patch patches.suse/USB-serial-ch341-fix-character-loss-at-high-transfer.patch