From: Greg Kroah-Hartman Date: Sun, 22 Jan 2023 14:24:33 +0000 (+0100) Subject: 5.15-stable patches X-Git-Tag: v4.14.304~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=daca023d96d547685dcfbe0c3ff658a384aa9e6c;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: arch-fix-broken-buildid-for-arm64-and-riscv.patch revert-drm-amdgpu-make-display-pinning-more-flexible-v2.patch tracing-use-alignof__-struct-type-b-instead-of-offsetof.patch x86-fpu-use-_alignof-to-avoid-undefined-behavior-in-type_align.patch --- diff --git a/queue-5.15/arch-fix-broken-buildid-for-arm64-and-riscv.patch b/queue-5.15/arch-fix-broken-buildid-for-arm64-and-riscv.patch new file mode 100644 index 00000000000..074ac117ead --- /dev/null +++ b/queue-5.15/arch-fix-broken-buildid-for-arm64-and-riscv.patch @@ -0,0 +1,56 @@ +From 99cb0d917ffa1ab628bb67364ca9b162c07699b1 Mon Sep 17 00:00:00 2001 +From: Masahiro Yamada +Date: Tue, 27 Dec 2022 03:45:37 +0900 +Subject: arch: fix broken BuildID for arm64 and riscv + +From: Masahiro Yamada + +commit 99cb0d917ffa1ab628bb67364ca9b162c07699b1 upstream. + +Dennis Gilmore reports that the BuildID is missing in the arm64 vmlinux +since commit 994b7ac1697b ("arm64: remove special treatment for the +link order of head.o"). + +The issue is that the type of .notes section, which contains the BuildID, +changed from NOTES to PROGBITS. + +Ard Biesheuvel figured out that whichever object gets linked first gets +to decide the type of a section. The PROGBITS type is the result of the +compiler emitting .note.GNU-stack as PROGBITS rather than NOTE. + +While Ard provided a fix for arm64, I want to fix this globally because +the same issue is happening on riscv since commit 2348e6bf4421 ("riscv: +remove special treatment for the link order of head.o"). This problem +will happen in general for other architectures if they start to drop +unneeded entries from scripts/head-object-list.txt. + +Discard .note.GNU-stack in include/asm-generic/vmlinux.lds.h. + +Link: https://lore.kernel.org/lkml/CAABkxwuQoz1CTbyb57n0ZX65eSYiTonFCU8-LCQc=74D=xE=rA@mail.gmail.com/ +Fixes: 994b7ac1697b ("arm64: remove special treatment for the link order of head.o") +Fixes: 2348e6bf4421 ("riscv: remove special treatment for the link order of head.o") +Cc: Tom Saeger +Reported-by: Dennis Gilmore +Suggested-by: Ard Biesheuvel +Signed-off-by: Masahiro Yamada +Acked-by: Palmer Dabbelt +Signed-off-by: Greg Kroah-Hartman +--- + include/asm-generic/vmlinux.lds.h | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/include/asm-generic/vmlinux.lds.h ++++ b/include/asm-generic/vmlinux.lds.h +@@ -903,7 +903,12 @@ + #define PRINTK_INDEX + #endif + ++/* ++ * Discard .note.GNU-stack, which is emitted as PROGBITS by the compiler. ++ * Otherwise, the type of .notes section would become PROGBITS instead of NOTES. ++ */ + #define NOTES \ ++ /DISCARD/ : { *(.note.GNU-stack) } \ + .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \ + __start_notes = .; \ + KEEP(*(.note.*)) \ diff --git a/queue-5.15/revert-drm-amdgpu-make-display-pinning-more-flexible-v2.patch b/queue-5.15/revert-drm-amdgpu-make-display-pinning-more-flexible-v2.patch new file mode 100644 index 00000000000..80ffa4f000d --- /dev/null +++ b/queue-5.15/revert-drm-amdgpu-make-display-pinning-more-flexible-v2.patch @@ -0,0 +1,41 @@ +From alexander.deucher@amd.com Sun Jan 22 15:15:38 2023 +From: Alex Deucher +Date: Mon, 16 Jan 2023 16:44:11 -0500 +Subject: Revert "drm/amdgpu: make display pinning more flexible (v2)" +To: , +Cc: Alex Deucher , , , +Message-ID: <20230116214411.1091288-1-alexander.deucher@amd.com> + +From: Alex Deucher + +This reverts commit 78623b10fc9f8231802536538c85527dc54640a0 which is +commit 81d0bcf9900932633d270d5bc4a54ff599c6ebdb upstream. + +This commit causes hiberation regressions on some platforms on kernels +older than 6.1.x (6.1.x and newer kernels works fine) so let's revert it +from 5.15 and older stable kernels. This should be reverted from 6.0.x +as well, but that kernel is no longer supported. + +Bug: https://bugzilla.kernel.org/show_bug.cgi?id=216917 +Signed-off-by: Alex Deucher +Cc: kolAflash@kolahilft.de +Cc: jrf@mailbox.org +Cc: mario.limonciello@amd.com +Cc: stable@vger.kernel.org # 5.15.x +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +@@ -1510,8 +1510,7 @@ u64 amdgpu_bo_gpu_offset_no_check(struct + uint32_t amdgpu_bo_get_preferred_domain(struct amdgpu_device *adev, + uint32_t domain) + { +- if ((domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) && +- ((adev->asic_type == CHIP_CARRIZO) || (adev->asic_type == CHIP_STONEY))) { ++ if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) { + domain = AMDGPU_GEM_DOMAIN_VRAM; + if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD) + domain = AMDGPU_GEM_DOMAIN_GTT; diff --git a/queue-5.15/series b/queue-5.15/series index 95a3db6755f..dfd8a25ca31 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -100,3 +100,7 @@ drm-amdgpu-drop-experimental-flag-on-aldebaran.patch fs-ntfs3-fix-attr_punch_hole-null-pointer-derenference.patch arm64-efi-execute-runtime-services-from-a-dedicated-stack.patch efi-rt-wrapper-add-missing-include.patch +revert-drm-amdgpu-make-display-pinning-more-flexible-v2.patch +x86-fpu-use-_alignof-to-avoid-undefined-behavior-in-type_align.patch +tracing-use-alignof__-struct-type-b-instead-of-offsetof.patch +arch-fix-broken-buildid-for-arm64-and-riscv.patch diff --git a/queue-5.15/tracing-use-alignof__-struct-type-b-instead-of-offsetof.patch b/queue-5.15/tracing-use-alignof__-struct-type-b-instead-of-offsetof.patch new file mode 100644 index 00000000000..1516ce4ac28 --- /dev/null +++ b/queue-5.15/tracing-use-alignof__-struct-type-b-instead-of-offsetof.patch @@ -0,0 +1,41 @@ +From 34027bb69f5a3e69cf9082f38f486745a4fc5643 Mon Sep 17 00:00:00 2001 +From: "Steven Rostedt (Google)" +Date: Tue, 2 Aug 2022 15:44:12 -0400 +Subject: tracing: Use alignof__(struct {type b;}) instead of offsetof() + +From: "Steven Rostedt (Google)" + +commit 09794a5a6c348f629b35fc1687071a1622ef4265 upstream. + +Simplify: + + #define ALIGN_STRUCTFIELD(type) ((int)(offsetof(struct {char a; type b;}, b))) + +with + + #define ALIGN_STRUCTFIELD(type) __alignof__(struct {type b;}) + +Which works just the same. + +Link: https://lore.kernel.org/all/a7d202457150472588df0bd3b7334b3f@AcuMS.aculab.com/ +Link: https://lkml.kernel.org/r/20220802154412.513c50e3@gandalf.local.home + +Suggested-by: David Laight +Signed-off-by: Steven Rostedt (Google) +Signed-off-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + include/trace/trace_events.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/include/trace/trace_events.h ++++ b/include/trace/trace_events.h +@@ -479,7 +479,7 @@ static struct trace_event_functions trac + + #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) + +-#define ALIGN_STRUCTFIELD(type) ((int)(offsetof(struct {char a; type b;}, b))) ++#define ALIGN_STRUCTFIELD(type) ((int)(__alignof__(struct {type b;}))) + + #undef __field_ext + #define __field_ext(_type, _item, _filter_type) { \ diff --git a/queue-5.15/x86-fpu-use-_alignof-to-avoid-undefined-behavior-in-type_align.patch b/queue-5.15/x86-fpu-use-_alignof-to-avoid-undefined-behavior-in-type_align.patch new file mode 100644 index 00000000000..b6850e5d3ed --- /dev/null +++ b/queue-5.15/x86-fpu-use-_alignof-to-avoid-undefined-behavior-in-type_align.patch @@ -0,0 +1,63 @@ +From b3e3778c5939f77318ab62d404846bb0526f8079 Mon Sep 17 00:00:00 2001 +From: YingChi Long +Date: Fri, 18 Nov 2022 08:55:35 +0800 +Subject: x86/fpu: Use _Alignof to avoid undefined behavior in TYPE_ALIGN + +From: YingChi Long + +commit 55228db2697c09abddcb9487c3d9fa5854a932cd upstream. + +WG14 N2350 specifies that it is an undefined behavior to have type +definitions within offsetof", see + + https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm + +This specification is also part of C23. + +Therefore, replace the TYPE_ALIGN macro with the _Alignof builtin to +avoid undefined behavior. (_Alignof itself is C11 and the kernel is +built with -gnu11). + +ISO C11 _Alignof is subtly different from the GNU C extension +__alignof__. Latter is the preferred alignment and _Alignof the +minimal alignment. For long long on x86 these are 8 and 4 +respectively. + +The macro TYPE_ALIGN's behavior matches _Alignof rather than +__alignof__. + + [ bp: Massage commit message. ] + +Signed-off-by: YingChi Long +Signed-off-by: Borislav Petkov +Reviewed-by: Nick Desaulniers +Link: https://lore.kernel.org/r/20220925153151.2467884-1-me@inclyc.cn +Signed-off-by: Nathan Chancellor +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/kernel/fpu/init.c | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +--- a/arch/x86/kernel/fpu/init.c ++++ b/arch/x86/kernel/fpu/init.c +@@ -138,9 +138,6 @@ static void __init fpu__init_system_gene + unsigned int fpu_kernel_xstate_size __ro_after_init; + EXPORT_SYMBOL_GPL(fpu_kernel_xstate_size); + +-/* Get alignment of the TYPE. */ +-#define TYPE_ALIGN(TYPE) offsetof(struct { char x; TYPE test; }, test) +- + /* + * Enforce that 'MEMBER' is the last field of 'TYPE'. + * +@@ -148,8 +145,8 @@ EXPORT_SYMBOL_GPL(fpu_kernel_xstate_size + * because that's how C aligns structs. + */ + #define CHECK_MEMBER_AT_END_OF(TYPE, MEMBER) \ +- BUILD_BUG_ON(sizeof(TYPE) != ALIGN(offsetofend(TYPE, MEMBER), \ +- TYPE_ALIGN(TYPE))) ++ BUILD_BUG_ON(sizeof(TYPE) != \ ++ ALIGN(offsetofend(TYPE, MEMBER), _Alignof(TYPE))) + + /* + * We append the 'struct fpu' to the task_struct: