From: Greg Kroah-Hartman Date: Tue, 16 Aug 2022 12:22:22 +0000 (+0200) Subject: 5.19-stable patches X-Git-Tag: v5.15.61~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=be72d6e03e3e22bb6ed9064b801cca44f974be72;p=thirdparty%2Fkernel%2Fstable-queue.git 5.19-stable patches added patches: asoc-intel-avs-use-lookup-table-to-create-modules.patch mm-introduce-clear_highpage_kasan_tagged.patch --- diff --git a/queue-5.19/asoc-intel-avs-use-lookup-table-to-create-modules.patch b/queue-5.19/asoc-intel-avs-use-lookup-table-to-create-modules.patch new file mode 100644 index 00000000000..43bfb118d1e --- /dev/null +++ b/queue-5.19/asoc-intel-avs-use-lookup-table-to-create-modules.patch @@ -0,0 +1,116 @@ +From 1e744351bcb9c4cee81300de5a6097100d835386 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= + +Date: Fri, 22 Jul 2022 13:19:59 +0200 +Subject: ASoC: Intel: avs: Use lookup table to create modules +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Amadeusz Sławiński + +commit 1e744351bcb9c4cee81300de5a6097100d835386 upstream. + +As reported by Nathan, when building avs driver using clang with: + CONFIG_COMPILE_TEST=y + CONFIG_FORTIFY_SOURCE=y + CONFIG_KASAN=y + CONFIG_PCI=y + CONFIG_SOUND=y + CONFIG_SND=y + CONFIG_SND_SOC=y + CONFIG_SND_SOC_INTEL_AVS=y + +there are reports of too big stack use, like: + sound/soc/intel/avs/path.c:815:18: error: stack frame size (2176) exceeds limit (2048) in 'avs_path_create' [-Werror,-Wframe-larger-than] + struct avs_path *avs_path_create(struct avs_dev *adev, u32 dma_id, + ^ + 1 error generated. + +This is apparently caused by inlining many calls to guid_equal which +inlines fortified memcpy, using 2 size_t variables. + +Instead of hardcoding many calls to guid_equal, use lookup table with +one call, this improves stack usage. + +Link: https://lore.kernel.org/alsa-devel/YtlzY9aYdbS4Y3+l@dev-arch.thelio-3990X/T/ +Link: https://github.com/ClangBuiltLinux/linux/issues/1642 +Signed-off-by: Amadeusz Sławiński +Reported-by: Nathan Chancellor +Build-tested-by: Nathan Chancellor +Reviewed-by: Cezary Rojewski +Link: https://lore.kernel.org/r/20220722111959.2588597-1-amadeuszx.slawinski@linux.intel.com +Signed-off-by: Mark Brown +Cc: Naresh Kamboju +Signed-off-by: Greg Kroah-Hartman +--- + sound/soc/intel/avs/path.c | 54 ++++++++++++++++++++++++--------------------- + 1 file changed, 29 insertions(+), 25 deletions(-) + +--- a/sound/soc/intel/avs/path.c ++++ b/sound/soc/intel/avs/path.c +@@ -449,35 +449,39 @@ static int avs_modext_create(struct avs_ + return ret; + } + ++static int avs_probe_create(struct avs_dev *adev, struct avs_path_module *mod) ++{ ++ dev_err(adev->dev, "Probe module can't be instantiated by topology"); ++ return -EINVAL; ++} ++ ++struct avs_module_create { ++ guid_t *guid; ++ int (*create)(struct avs_dev *adev, struct avs_path_module *mod); ++}; ++ ++static struct avs_module_create avs_module_create[] = { ++ { &AVS_MIXIN_MOD_UUID, avs_modbase_create }, ++ { &AVS_MIXOUT_MOD_UUID, avs_modbase_create }, ++ { &AVS_KPBUFF_MOD_UUID, avs_modbase_create }, ++ { &AVS_COPIER_MOD_UUID, avs_copier_create }, ++ { &AVS_MICSEL_MOD_UUID, avs_micsel_create }, ++ { &AVS_MUX_MOD_UUID, avs_mux_create }, ++ { &AVS_UPDWMIX_MOD_UUID, avs_updown_mix_create }, ++ { &AVS_SRCINTC_MOD_UUID, avs_src_create }, ++ { &AVS_AEC_MOD_UUID, avs_aec_create }, ++ { &AVS_ASRC_MOD_UUID, avs_asrc_create }, ++ { &AVS_INTELWOV_MOD_UUID, avs_wov_create }, ++ { &AVS_PROBE_MOD_UUID, avs_probe_create }, ++}; ++ + static int avs_path_module_type_create(struct avs_dev *adev, struct avs_path_module *mod) + { + const guid_t *type = &mod->template->cfg_ext->type; + +- if (guid_equal(type, &AVS_MIXIN_MOD_UUID) || +- guid_equal(type, &AVS_MIXOUT_MOD_UUID) || +- guid_equal(type, &AVS_KPBUFF_MOD_UUID)) +- return avs_modbase_create(adev, mod); +- if (guid_equal(type, &AVS_COPIER_MOD_UUID)) +- return avs_copier_create(adev, mod); +- if (guid_equal(type, &AVS_MICSEL_MOD_UUID)) +- return avs_micsel_create(adev, mod); +- if (guid_equal(type, &AVS_MUX_MOD_UUID)) +- return avs_mux_create(adev, mod); +- if (guid_equal(type, &AVS_UPDWMIX_MOD_UUID)) +- return avs_updown_mix_create(adev, mod); +- if (guid_equal(type, &AVS_SRCINTC_MOD_UUID)) +- return avs_src_create(adev, mod); +- if (guid_equal(type, &AVS_AEC_MOD_UUID)) +- return avs_aec_create(adev, mod); +- if (guid_equal(type, &AVS_ASRC_MOD_UUID)) +- return avs_asrc_create(adev, mod); +- if (guid_equal(type, &AVS_INTELWOV_MOD_UUID)) +- return avs_wov_create(adev, mod); +- +- if (guid_equal(type, &AVS_PROBE_MOD_UUID)) { +- dev_err(adev->dev, "Probe module can't be instantiated by topology"); +- return -EINVAL; +- } ++ for (int i = 0; i < ARRAY_SIZE(avs_module_create); i++) ++ if (guid_equal(type, avs_module_create[i].guid)) ++ return avs_module_create[i].create(adev, mod); + + return avs_modext_create(adev, mod); + } diff --git a/queue-5.19/mm-introduce-clear_highpage_kasan_tagged.patch b/queue-5.19/mm-introduce-clear_highpage_kasan_tagged.patch new file mode 100644 index 00000000000..a648455753e --- /dev/null +++ b/queue-5.19/mm-introduce-clear_highpage_kasan_tagged.patch @@ -0,0 +1,64 @@ +From d9da8f6cf55eeca642c021912af1890002464c64 Mon Sep 17 00:00:00 2001 +From: Andrey Konovalov +Date: Thu, 9 Jun 2022 20:18:46 +0200 +Subject: mm: introduce clear_highpage_kasan_tagged + +From: Andrey Konovalov + +commit d9da8f6cf55eeca642c021912af1890002464c64 upstream. + +Add a clear_highpage_kasan_tagged() helper that does clear_highpage() on a +page potentially tagged by KASAN. + +This helper is used by the following patch. + +Link: https://lkml.kernel.org/r/4471979b46b2c487787ddcd08b9dc5fedd1b6ffd.1654798516.git.andreyknvl@google.com +Signed-off-by: Andrey Konovalov +Cc: Alexander Potapenko +Cc: Andrey Ryabinin +Cc: Dmitry Vyukov +Cc: Marco Elver +Signed-off-by: Andrew Morton +Cc: Jiri Slaby +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/highmem.h | 10 ++++++++++ + mm/page_alloc.c | 8 ++------ + 2 files changed, 12 insertions(+), 6 deletions(-) + +--- a/include/linux/highmem.h ++++ b/include/linux/highmem.h +@@ -243,6 +243,16 @@ static inline void clear_highpage(struct + kunmap_local(kaddr); + } + ++static inline void clear_highpage_kasan_tagged(struct page *page) ++{ ++ u8 tag; ++ ++ tag = page_kasan_tag(page); ++ page_kasan_tag_reset(page); ++ clear_highpage(page); ++ page_kasan_tag_set(page, tag); ++} ++ + #ifndef __HAVE_ARCH_TAG_CLEAR_HIGHPAGE + + static inline void tag_clear_highpage(struct page *page) +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -1302,12 +1302,8 @@ static void kernel_init_free_pages(struc + + /* s390's use of memset() could override KASAN redzones. */ + kasan_disable_current(); +- for (i = 0; i < numpages; i++) { +- u8 tag = page_kasan_tag(page + i); +- page_kasan_tag_reset(page + i); +- clear_highpage(page + i); +- page_kasan_tag_set(page + i, tag); +- } ++ for (i = 0; i < numpages; i++) ++ clear_highpage_kasan_tagged(page + i); + kasan_enable_current(); + } + diff --git a/queue-5.19/series b/queue-5.19/series index b4e266abb57..1ddf3d66b31 100644 --- a/queue-5.19/series +++ b/queue-5.19/series @@ -762,6 +762,7 @@ kernfs-fix-potential-null-dereference-in-__kernfs_re.patch mm-rmap-use-the-correct-parameter-name-for-define_pa.patch mm-migration-return-errno-when-isolate_huge_page-fai.patch mm-migration-fix-potential-pte_unmap-on-an-not-mappe.patch +mm-introduce-clear_highpage_kasan_tagged.patch kasan-fix-zeroing-vmalloc-memory-with-hw_tags.patch mm-mempolicy-fix-get_nodes-out-of-bound-access.patch phy-ti-tusb1210-don-t-check-for-write-errors-when-po.patch @@ -1153,3 +1154,4 @@ revert-s390-smp-enforce-lowcore-protection-on-cpu-restart.patch powerpc-kexec-fix-build-failure-from-uninitialised-variable.patch io_uring-mem-account-pbuf-buckets.patch bluetooth-l2cap-fix-l2cap_global_chan_by_psm-regression.patch +asoc-intel-avs-use-lookup-table-to-create-modules.patch