From: Greg Kroah-Hartman Date: Mon, 22 Jan 2024 15:02:40 +0000 (-0800) Subject: 5.15-stable patches X-Git-Tag: v4.19.306~112 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1b542d5403c07ec4dd995170a842f8a6311a72d1;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: keys-dns-fix-size-check-of-v1-server-list-header.patch selftests-bpf-add-assert-for-user-stacks-in-test_task_stack.patch --- diff --git a/queue-5.15/keys-dns-fix-size-check-of-v1-server-list-header.patch b/queue-5.15/keys-dns-fix-size-check-of-v1-server-list-header.patch new file mode 100644 index 00000000000..1f034168e93 --- /dev/null +++ b/queue-5.15/keys-dns-fix-size-check-of-v1-server-list-header.patch @@ -0,0 +1,41 @@ +From acc657692aed438e9931438f8c923b2b107aebf9 Mon Sep 17 00:00:00 2001 +From: David Howells +Date: Wed, 10 Jan 2024 21:11:40 +0000 +Subject: keys, dns: Fix size check of V1 server-list header + +From: David Howells + +commit acc657692aed438e9931438f8c923b2b107aebf9 upstream. + +Fix the size check added to dns_resolver_preparse() for the V1 server-list +header so that it doesn't give EINVAL if the size supplied is the same as +the size of the header struct (which should be valid). + +This can be tested with: + + echo -n -e '\0\0\01\xff\0\0' | keyctl padd dns_resolver desc @p + +which will give "add_key: Invalid argument" without this fix. + +Fixes: 1997b3cb4217 ("keys, dns: Fix missing size check of V1 server-list header") +Reported-by: Pengfei Xu +Link: https://lore.kernel.org/r/ZZ4fyY4r3rqgZL+4@xpf.sh.intel.com/ +Signed-off-by: David Howells +Signed-off-by: Linus Torvalds +Cc: Petr Vorel +Signed-off-by: Greg Kroah-Hartman +--- + net/dns_resolver/dns_key.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/net/dns_resolver/dns_key.c ++++ b/net/dns_resolver/dns_key.c +@@ -104,7 +104,7 @@ dns_resolver_preparse(struct key_prepars + const struct dns_server_list_v1_header *v1; + + /* It may be a server list. */ +- if (datalen <= sizeof(*v1)) ++ if (datalen < sizeof(*v1)) + return -EINVAL; + + v1 = (const struct dns_server_list_v1_header *)data; diff --git a/queue-5.15/selftests-bpf-add-assert-for-user-stacks-in-test_task_stack.patch b/queue-5.15/selftests-bpf-add-assert-for-user-stacks-in-test_task_stack.patch new file mode 100644 index 00000000000..500e1790af6 --- /dev/null +++ b/queue-5.15/selftests-bpf-add-assert-for-user-stacks-in-test_task_stack.patch @@ -0,0 +1,57 @@ +From 727a92d62fd6a382b4c5972008e45667e707b0e4 Mon Sep 17 00:00:00 2001 +From: Jordan Rome +Date: Sat, 11 Nov 2023 18:30:10 -0800 +Subject: selftests/bpf: Add assert for user stacks in test_task_stack + +From: Jordan Rome + +commit 727a92d62fd6a382b4c5972008e45667e707b0e4 upstream. + +This is a follow up to: +commit b8e3a87a627b ("bpf: Add crosstask check to __bpf_get_stack"). + +This test ensures that the task iterator only gets a single +user stack (for the current task). + +Signed-off-by: Jordan Rome +Signed-off-by: Andrii Nakryiko +Acked-by: Stanislav Fomichev +Link: https://lore.kernel.org/bpf/20231112023010.144675-1-linux@jordanrome.com +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 2 ++ + tools/testing/selftests/bpf/progs/bpf_iter_task_stack.c | 5 +++++ + 2 files changed, 7 insertions(+) + +--- a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c ++++ b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c +@@ -150,6 +150,8 @@ static void test_task_stack(void) + do_dummy_read(skel->progs.dump_task_stack); + do_dummy_read(skel->progs.get_task_user_stacks); + ++ ASSERT_EQ(skel->bss->num_user_stacks, 1, "num_user_stacks"); ++ + bpf_iter_task_stack__destroy(skel); + } + +--- a/tools/testing/selftests/bpf/progs/bpf_iter_task_stack.c ++++ b/tools/testing/selftests/bpf/progs/bpf_iter_task_stack.c +@@ -35,6 +35,8 @@ int dump_task_stack(struct bpf_iter__tas + return 0; + } + ++int num_user_stacks = 0; ++ + SEC("iter/task") + int get_task_user_stacks(struct bpf_iter__task *ctx) + { +@@ -51,6 +53,9 @@ int get_task_user_stacks(struct bpf_iter + if (res <= 0) + return 0; + ++ /* Only one task, the current one, should succeed */ ++ ++num_user_stacks; ++ + buf_sz += res; + + /* If the verifier doesn't refine bpf_get_task_stack res, and instead diff --git a/queue-5.15/series b/queue-5.15/series index 49862a2a2c9..29a7f266fc1 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -238,3 +238,5 @@ drm-amd-pm-smu7-fix-a-memleak-in-smu7_hwmgr_backend_.patch ksmbd-validate-the-zero-field-of-packet-header.patch of-fix-double-free-in-of_parse_phandle_with_args_map.patch of-unittest-fix-of_count_phandle_with_args-expected-.patch +selftests-bpf-add-assert-for-user-stacks-in-test_task_stack.patch +keys-dns-fix-size-check-of-v1-server-list-header.patch