From: "Maciej S. Szmigiero" <maciej.szmigiero(a)oracle.com>
The stable kernel version backport of the patch disabling XSAVES on AMD
Zen family 0x17 applied this change to the wrong function (init_amd_k6()),
one which isn't called for Zen CPUs.
Move the erratum to the init_amd_zn() function instead.
Add an explicit family 0x17 check to the erratum so nothing will break if
someone naively makes this kernel version call init_amd_zn() also for
family 0x19 in the future (as the current upstream code does).
Fixes: f028a7db9824 ("x86/CPU/AMD: Disable XSAVES on AMD family 0x17")
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero(a)oracle.com>
---
arch/x86/kernel/cpu/amd.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 84667781c41d..5b75a4ff6802 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -271,15 +271,6 @@ static void init_amd_k6(struct cpuinfo_x86 *c)
return;
}
#endif
- /*
- * Work around Erratum 1386. The XSAVES instruction malfunctions in
- * certain circumstances on Zen1/2 uarch, and not all parts have had
- * updated microcode at the time of writing (March 2023).
- *
- * Affected parts all have no supervisor XSAVE states, meaning that
- * the XSAVEC instruction (which works fine) is equivalent.
- */
- clear_cpu_cap(c, X86_FEATURE_XSAVES);
}
static void init_amd_k7(struct cpuinfo_x86 *c)
@@ -979,6 +970,17 @@ static void init_amd_zn(struct cpuinfo_x86 *c)
if (c->x86 == 0x19 && !cpu_has(c, X86_FEATURE_BTC_NO))
set_cpu_cap(c, X86_FEATURE_BTC_NO);
}
+
+ /*
+ * Work around Erratum 1386. The XSAVES instruction malfunctions in
+ * certain circumstances on Zen1/2 uarch, and not all parts have had
+ * updated microcode at the time of writing (March 2023).
+ *
+ * Affected parts all have no supervisor XSAVE states, meaning that
+ * the XSAVEC instruction (which works fine) is equivalent.
+ */
+ if (c->x86 == 0x17)
+ clear_cpu_cap(c, X86_FEATURE_XSAVES);
}
static bool cpu_has_zenbleed_microcode(void)
This is a backport of two upstream patch-sets:
1. "exact states comparison for iterator convergence checks"
https://lore.kernel.org/all/20231024000917.12153-1-eddyz87@gmail.com/
2. "verify callbacks as if they are called unknown number of times"
https://lore.kernel.org/all/20231121020701.26440-1-eddyz87@gmail.com/
Both patch-sets fix BPF verifier logic related to handling loops:
for bpf iterators, and for helper functions that accept callback
functions.
The backport of (2) was requested as a response to bug report by
Mateusz Gienieczko <mat.gienieczko(a)tum.de>.
The (1) is a dependency of (2).
The patch-set was tested by running BPF verifier selftests on my local
qemu-based setup.
Most of the commits could be cherry-picked but three required merging:
| Action | Upstream commit |
|--------+-------------------------------------------------------------------------------------------------|
| pick | 3c4e420cb653 ("bpf: move explored_state() closer to the beginning of verifier.c ") |
| pick | 4c97259abc9b ("bpf: extract same_callsites() as utility function ") |
| merge | 2793a8b015f7 ("bpf: exact states comparison for iterator convergence checks ") |
| pick | 389ede06c297 ("selftests/bpf: tests with delayed read/precision makrs in loop body ") |
| pick | 2a0992829ea3 ("bpf: correct loop detection for iterators convergence ") |
| pick | 64870feebecb ("selftests/bpf: test if state loops are detected in a tricky case ") |
| pick | b4d8239534fd ("bpf: print full verifier states on infinite loop detection ") |
| drop | dedd6c894110 ("Merge branch 'exact-states-comparison-for-iterator-convergence-checks' ") |
|--------+-------------------------------------------------------------------------------------------------|
| pick | 977bc146d4eb ("selftests/bpf: track tcp payload offset as scalar in xdp_synproxy ") |
| pick | 87eb0152bcc1 ("selftests/bpf: track string payload offset as scalar in strobemeta ") |
| pick | 683b96f9606a ("bpf: extract __check_reg_arg() utility function ") |
| pick | 58124a98cb8e ("bpf: extract setup_func_entry() utility function ") |
| merge | ab5cfac139ab ("bpf: verify callbacks as if they are called unknown number of times ") |
| pick | 958465e217db ("selftests/bpf: tests for iterating callbacks ") |
| pick | cafe2c21508a ("bpf: widening for callback iterators ") |
| pick | 9f3330aa644d ("selftests/bpf: test widening for iterating callbacks ") |
| merge | bb124da69c47 ("bpf: keep track of max number of bpf_loop callback iterations ") |
| pick | 57e2a52deeb1 ("selftests/bpf: check if max number of bpf_loop iterations is tracked ") |
| drop | acb12c859ac7 ("Merge branch 'verify-callbacks-as-if-they-are-called-unknown-number-of-times' ") |
Note:
I don't know how deal with merge commits, so I just dropped those.
These commits are empty but contain cover letters for both series,
so it might be useful to pick those (how?).
Eduard Zingerman (17):
bpf: move explored_state() closer to the beginning of verifier.c
bpf: extract same_callsites() as utility function
bpf: exact states comparison for iterator convergence checks
selftests/bpf: tests with delayed read/precision makrs in loop body
bpf: correct loop detection for iterators convergence
selftests/bpf: test if state loops are detected in a tricky case
bpf: print full verifier states on infinite loop detection
selftests/bpf: track tcp payload offset as scalar in xdp_synproxy
selftests/bpf: track string payload offset as scalar in strobemeta
bpf: extract __check_reg_arg() utility function
bpf: extract setup_func_entry() utility function
bpf: verify callbacks as if they are called unknown number of times
selftests/bpf: tests for iterating callbacks
bpf: widening for callback iterators
selftests/bpf: test widening for iterating callbacks
bpf: keep track of max number of bpf_loop callback iterations
selftests/bpf: check if max number of bpf_loop iterations is tracked
include/linux/bpf_verifier.h | 32 +
kernel/bpf/verifier.c | 875 ++++++++++++++----
.../selftests/bpf/prog_tests/verifier.c | 2 +
tools/testing/selftests/bpf/progs/cb_refs.c | 1 +
tools/testing/selftests/bpf/progs/iters.c | 695 ++++++++++++++
.../testing/selftests/bpf/progs/strobemeta.h | 78 +-
.../bpf/progs/verifier_iterating_callbacks.c | 242 +++++
.../bpf/progs/verifier_subprog_precision.c | 86 +-
.../selftests/bpf/progs/xdp_synproxy_kern.c | 84 +-
9 files changed, 1830 insertions(+), 265 deletions(-)
create mode 100644 tools/testing/selftests/bpf/progs/verifier_iterating_callbacks.c
--
2.43.0
This commit is for linux-4.19.y only, it has no direct upstream
equivalent.
Prior to commit 5f2fb52fac15 ("kbuild: rename hostprogs-y/always to
hostprogs/always-y"), always-y did not exist, making the backport of
mainline commit 1b1e38002648 ("powerpc: add crtsavres.o to always-y
instead of extra-y") to linux-4.19.y as commit b7b85ec5ec15 ("powerpc:
add crtsavres.o to always-y instead of extra-y") incorrect, breaking the
build with linkers that need crtsavres.o:
ld.lld: error: cannot open arch/powerpc/lib/crtsavres.o: No such file or directory
Backporting the aforementioned kbuild commit is not suitable for stable
due to its size and number of conflicts, so transform the always-y usage
to an equivalent form using always, which resolves the build issues.
Fixes: b7b85ec5ec15 ("powerpc: add crtsavres.o to always-y instead of extra-y")
Signed-off-by: Nathan Chancellor <nathan(a)kernel.org>
---
arch/powerpc/lib/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 6f1e57182876..f0aa6fc8c6b2 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -21,8 +21,8 @@ obj-$(CONFIG_PPC32) += div64.o copy_32.o crtsavres.o strlen_32.o
# 64-bit linker creates .sfpr on demand for final link (vmlinux),
# so it is only needed for modules, and only for older linkers which
# do not support --save-restore-funcs
-ifeq ($(call ld-ifversion, -lt, 225000000, y),y)
-always-$(CONFIG_PPC64) += crtsavres.o
+ifeq ($(call ld-ifversion, -lt, 225000000, y)$(CONFIG_PPC64),yy)
+always += crtsavres.o
endif
obj-$(CONFIG_PPC_BOOK3S_64) += copyuser_power7.o copypage_power7.o \
---
base-commit: b060cfd3f707ad3c8ae8322e1b149ba7e2cf33e0
change-id: 20240126-4-19-fix-lib-powerpc-backport-6f4a823adf1a
Best regards,
--
Nathan Chancellor <nathan(a)kernel.org>
These patches are a follow up fixes for CVE-2021-4037 &
CVE-2018-13405, LTP test creat09.c & openat04.c reproduces the
privilege escalation in v5.4, the two patches solves this and they are
already backported to the other stable kernels.
Hi stable team, JFYI, yesterdays mainline commit 556857aa1d0855 ("wifi:
ath11k: rely on mac80211 debugfs handling for vif") from Benjamin
contains no stable tag, but a Fixes: tag for a 6.7 commit. So it guess
you will pick it up anyway. Might be worth picking up rather sooner than
later, as it fixes a regression that according to Kalle causes ath11k to
crash during suspend:
https://lore.kernel.org/all/874jfjiolh.fsf@kernel.org/https://bugzilla.kernel.org/show_bug.cgi?id=218364
Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat)
--
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
That page also explains what to do if mails like this annoy you.