]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.11-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 29 Mar 2021 07:18:26 +0000 (09:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 29 Mar 2021 07:18:26 +0000 (09:18 +0200)
added patches:
can-peak_usb-revert-can-peak_usb-add-forgotten-supported-devices.patch
nvme-fix-the-nsid-value-to-print-in-nvme_validate_or_alloc_ns.patch
selftest-bpf-add-a-test-to-check-trampoline-freeing-logic.patch

queue-5.11/can-peak_usb-revert-can-peak_usb-add-forgotten-supported-devices.patch [new file with mode: 0644]
queue-5.11/nvme-fix-the-nsid-value-to-print-in-nvme_validate_or_alloc_ns.patch [new file with mode: 0644]
queue-5.11/selftest-bpf-add-a-test-to-check-trampoline-freeing-logic.patch [new file with mode: 0644]
queue-5.11/series

diff --git a/queue-5.11/can-peak_usb-revert-can-peak_usb-add-forgotten-supported-devices.patch b/queue-5.11/can-peak_usb-revert-can-peak_usb-add-forgotten-supported-devices.patch
new file mode 100644 (file)
index 0000000..e245b9a
--- /dev/null
@@ -0,0 +1,37 @@
+From 5d7047ed6b7214fbabc16d8712a822e256b1aa44 Mon Sep 17 00:00:00 2001
+From: Marc Kleine-Budde <mkl@pengutronix.de>
+Date: Sat, 20 Mar 2021 20:21:54 +0100
+Subject: can: peak_usb: Revert "can: peak_usb: add forgotten supported devices"
+
+From: Marc Kleine-Budde <mkl@pengutronix.de>
+
+commit 5d7047ed6b7214fbabc16d8712a822e256b1aa44 upstream.
+
+In commit 6417f03132a6 ("module: remove never implemented
+MODULE_SUPPORTED_DEVICE") the MODULE_SUPPORTED_DEVICE macro was
+removed from the kerne entirely. Shortly before this patch was applied
+mainline the commit 59ec7b89ed3e ("can: peak_usb: add forgotten
+supported devices") was added to net/master. As this would result in a
+merge conflict, let's revert this patch.
+
+Fixes: 59ec7b89ed3e ("can: peak_usb: add forgotten supported devices")
+Link: https://lore.kernel.org/r/20210320192649.341832-1-mkl@pengutronix.de
+Suggested-by: Leon Romanovsky <leon@kernel.org>
+Cc: Stephane Grosjean <s.grosjean@peak-system.com>
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/can/usb/peak_usb/pcan_usb_fd.c |    2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
++++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
+@@ -18,8 +18,6 @@
+ MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB FD adapter");
+ MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB Pro FD adapter");
+-MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-Chip USB");
+-MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB X6 adapter");
+ #define PCAN_USBPROFD_CHANNEL_COUNT   2
+ #define PCAN_USBFD_CHANNEL_COUNT      1
diff --git a/queue-5.11/nvme-fix-the-nsid-value-to-print-in-nvme_validate_or_alloc_ns.patch b/queue-5.11/nvme-fix-the-nsid-value-to-print-in-nvme_validate_or_alloc_ns.patch
new file mode 100644 (file)
index 0000000..783c224
--- /dev/null
@@ -0,0 +1,31 @@
+From f4f9fc29e56b6fa9d7fa65ec51d3c82aff99c99b Mon Sep 17 00:00:00 2001
+From: Christoph Hellwig <hch@lst.de>
+Date: Fri, 12 Mar 2021 20:55:36 +0100
+Subject: nvme: fix the nsid value to print in nvme_validate_or_alloc_ns
+
+From: Christoph Hellwig <hch@lst.de>
+
+commit f4f9fc29e56b6fa9d7fa65ec51d3c82aff99c99b upstream.
+
+ns can be NULL at this point, and my move of the check from
+the original patch by Chaitanya broke this.
+
+Fixes: 0ec84df4953b ("nvme-core: check ctrl css before setting up zns")
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/nvme/host/core.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/nvme/host/core.c
++++ b/drivers/nvme/host/core.c
+@@ -4072,7 +4072,7 @@ static void nvme_validate_or_alloc_ns(st
+               if (!nvme_multi_css(ctrl)) {
+                       dev_warn(ctrl->device,
+                               "command set not reported for nsid: %d\n",
+-                              ns->head->ns_id);
++                              nsid);
+                       break;
+               }
+               nvme_alloc_ns(ctrl, nsid, &ids);
diff --git a/queue-5.11/selftest-bpf-add-a-test-to-check-trampoline-freeing-logic.patch b/queue-5.11/selftest-bpf-add-a-test-to-check-trampoline-freeing-logic.patch
new file mode 100644 (file)
index 0000000..9857a06
--- /dev/null
@@ -0,0 +1,143 @@
+From eddbe8e6521401003e37e7848ef72e75c10ee2aa Mon Sep 17 00:00:00 2001
+From: Alexei Starovoitov <ast@kernel.org>
+Date: Wed, 17 Mar 2021 17:45:23 -0700
+Subject: selftest/bpf: Add a test to check trampoline freeing logic.
+
+From: Alexei Starovoitov <ast@kernel.org>
+
+commit eddbe8e6521401003e37e7848ef72e75c10ee2aa upstream.
+
+Add a selftest for commit e21aa341785c ("bpf: Fix fexit trampoline.")
+to make sure that attaching fexit prog to a sleeping kernel function
+will trigger appropriate trampoline and program destruction.
+
+Signed-off-by: Alexei Starovoitov <ast@kernel.org>
+Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
+Link: https://lore.kernel.org/bpf/20210318004523.55908-1-alexei.starovoitov@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/bpf/prog_tests/fexit_sleep.c |   82 +++++++++++++++++++
+ tools/testing/selftests/bpf/progs/fexit_sleep.c      |   31 +++++++
+ 2 files changed, 113 insertions(+)
+ create mode 100644 tools/testing/selftests/bpf/prog_tests/fexit_sleep.c
+ create mode 100644 tools/testing/selftests/bpf/progs/fexit_sleep.c
+
+--- /dev/null
++++ b/tools/testing/selftests/bpf/prog_tests/fexit_sleep.c
+@@ -0,0 +1,82 @@
++// SPDX-License-Identifier: GPL-2.0
++/* Copyright (c) 2021 Facebook */
++#define _GNU_SOURCE
++#include <sched.h>
++#include <test_progs.h>
++#include <time.h>
++#include <sys/mman.h>
++#include <sys/syscall.h>
++#include "fexit_sleep.skel.h"
++
++static int do_sleep(void *skel)
++{
++      struct fexit_sleep *fexit_skel = skel;
++      struct timespec ts1 = { .tv_nsec = 1 };
++      struct timespec ts2 = { .tv_sec = 10 };
++
++      fexit_skel->bss->pid = getpid();
++      (void)syscall(__NR_nanosleep, &ts1, NULL);
++      (void)syscall(__NR_nanosleep, &ts2, NULL);
++      return 0;
++}
++
++#define STACK_SIZE (1024 * 1024)
++static char child_stack[STACK_SIZE];
++
++void test_fexit_sleep(void)
++{
++      struct fexit_sleep *fexit_skel = NULL;
++      int wstatus, duration = 0;
++      pid_t cpid;
++      int err, fexit_cnt;
++
++      fexit_skel = fexit_sleep__open_and_load();
++      if (CHECK(!fexit_skel, "fexit_skel_load", "fexit skeleton failed\n"))
++              goto cleanup;
++
++      err = fexit_sleep__attach(fexit_skel);
++      if (CHECK(err, "fexit_attach", "fexit attach failed: %d\n", err))
++              goto cleanup;
++
++      cpid = clone(do_sleep, child_stack + STACK_SIZE, CLONE_FILES | SIGCHLD, fexit_skel);
++      if (CHECK(cpid == -1, "clone", strerror(errno)))
++              goto cleanup;
++
++      /* wait until first sys_nanosleep ends and second sys_nanosleep starts */
++      while (READ_ONCE(fexit_skel->bss->fentry_cnt) != 2);
++      fexit_cnt = READ_ONCE(fexit_skel->bss->fexit_cnt);
++      if (CHECK(fexit_cnt != 1, "fexit_cnt", "%d", fexit_cnt))
++              goto cleanup;
++
++      /* close progs and detach them. That will trigger two nop5->jmp5 rewrites
++       * in the trampolines to skip nanosleep_fexit prog.
++       * The nanosleep_fentry prog will get detached first.
++       * The nanosleep_fexit prog will get detached second.
++       * Detaching will trigger freeing of both progs JITed images.
++       * There will be two dying bpf_tramp_image-s, but only the initial
++       * bpf_tramp_image (with both _fentry and _fexit progs will be stuck
++       * waiting for percpu_ref_kill to confirm). The other one
++       * will be freed quickly.
++       */
++      close(bpf_program__fd(fexit_skel->progs.nanosleep_fentry));
++      close(bpf_program__fd(fexit_skel->progs.nanosleep_fexit));
++      fexit_sleep__detach(fexit_skel);
++
++      /* kill the thread to unwind sys_nanosleep stack through the trampoline */
++      kill(cpid, 9);
++
++      if (CHECK(waitpid(cpid, &wstatus, 0) == -1, "waitpid", strerror(errno)))
++              goto cleanup;
++      if (CHECK(WEXITSTATUS(wstatus) != 0, "exitstatus", "failed"))
++              goto cleanup;
++
++      /* The bypassed nanosleep_fexit prog shouldn't have executed.
++       * Unlike progs the maps were not freed and directly accessible.
++       */
++      fexit_cnt = READ_ONCE(fexit_skel->bss->fexit_cnt);
++      if (CHECK(fexit_cnt != 1, "fexit_cnt", "%d", fexit_cnt))
++              goto cleanup;
++
++cleanup:
++      fexit_sleep__destroy(fexit_skel);
++}
+--- /dev/null
++++ b/tools/testing/selftests/bpf/progs/fexit_sleep.c
+@@ -0,0 +1,31 @@
++// SPDX-License-Identifier: GPL-2.0
++/* Copyright (c) 2021 Facebook */
++#include "vmlinux.h"
++#include <bpf/bpf_helpers.h>
++#include <bpf/bpf_tracing.h>
++
++char LICENSE[] SEC("license") = "GPL";
++
++int pid = 0;
++int fentry_cnt = 0;
++int fexit_cnt = 0;
++
++SEC("fentry/__x64_sys_nanosleep")
++int BPF_PROG(nanosleep_fentry, const struct pt_regs *regs)
++{
++      if ((int)bpf_get_current_pid_tgid() != pid)
++              return 0;
++
++      fentry_cnt++;
++      return 0;
++}
++
++SEC("fexit/__x64_sys_nanosleep")
++int BPF_PROG(nanosleep_fexit, const struct pt_regs *regs, int ret)
++{
++      if ((int)bpf_get_current_pid_tgid() != pid)
++              return 0;
++
++      fexit_cnt++;
++      return 0;
++}
index 944408d3dfd8eb6c85c152ae3d9af712515394d6..58814c33e5f7fbeae627bc2c42fc0f0819f9525b 100644 (file)
@@ -249,3 +249,6 @@ mac80211-fix-double-free-in-ibss_leave.patch
 ext4-add-reclaim-checks-to-xattr-code.patch
 fs-ext4-fix-integer-overflow-in-s_log_groups_per_flex.patch
 revert-xen-fix-p2m-size-in-dom0-for-disabled-memory-hotplug-case.patch
+nvme-fix-the-nsid-value-to-print-in-nvme_validate_or_alloc_ns.patch
+can-peak_usb-revert-can-peak_usb-add-forgotten-supported-devices.patch
+selftest-bpf-add-a-test-to-check-trampoline-freeing-logic.patch