]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Jan 2025 16:32:50 +0000 (17:32 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Jan 2025 16:32:50 +0000 (17:32 +0100)
added patches:
dm-ebs-don-t-set-the-flag-dm_target_passes_integrity.patch
dm-thin-make-get_first_thin-use-rcu-safe-list-first-function.patch
drm-amd-display-add-check-for-granularity-in-dml-ceil-floor-helpers.patch
sctp-sysctl-auth_enable-avoid-using-current-nsproxy.patch
sctp-sysctl-cookie_hmac_alg-avoid-using-current-nsproxy.patch

queue-5.10/dm-ebs-don-t-set-the-flag-dm_target_passes_integrity.patch [new file with mode: 0644]
queue-5.10/dm-thin-make-get_first_thin-use-rcu-safe-list-first-function.patch [new file with mode: 0644]
queue-5.10/drm-amd-display-add-check-for-granularity-in-dml-ceil-floor-helpers.patch [new file with mode: 0644]
queue-5.10/sctp-sysctl-auth_enable-avoid-using-current-nsproxy.patch [new file with mode: 0644]
queue-5.10/sctp-sysctl-cookie_hmac_alg-avoid-using-current-nsproxy.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/dm-ebs-don-t-set-the-flag-dm_target_passes_integrity.patch b/queue-5.10/dm-ebs-don-t-set-the-flag-dm_target_passes_integrity.patch
new file mode 100644 (file)
index 0000000..fc0941f
--- /dev/null
@@ -0,0 +1,33 @@
+From 47f33c27fc9565fb0bc7dfb76be08d445cd3d236 Mon Sep 17 00:00:00 2001
+From: Mikulas Patocka <mpatocka@redhat.com>
+Date: Tue, 7 Jan 2025 17:47:01 +0100
+Subject: dm-ebs: don't set the flag DM_TARGET_PASSES_INTEGRITY
+
+From: Mikulas Patocka <mpatocka@redhat.com>
+
+commit 47f33c27fc9565fb0bc7dfb76be08d445cd3d236 upstream.
+
+dm-ebs uses dm-bufio to process requests that are not aligned on logical
+sector size. dm-bufio doesn't support passing integrity data (and it is
+unclear how should it do it), so we shouldn't set the
+DM_TARGET_PASSES_INTEGRITY flag.
+
+Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
+Cc: stable@vger.kernel.org
+Fixes: d3c7b35c20d6 ("dm: add emulated block size target")
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/dm-ebs-target.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/md/dm-ebs-target.c
++++ b/drivers/md/dm-ebs-target.c
+@@ -437,7 +437,7 @@ static int ebs_iterate_devices(struct dm
+ static struct target_type ebs_target = {
+       .name            = "ebs",
+       .version         = {1, 0, 1},
+-      .features        = DM_TARGET_PASSES_INTEGRITY,
++      .features        = 0,
+       .module          = THIS_MODULE,
+       .ctr             = ebs_ctr,
+       .dtr             = ebs_dtr,
diff --git a/queue-5.10/dm-thin-make-get_first_thin-use-rcu-safe-list-first-function.patch b/queue-5.10/dm-thin-make-get_first_thin-use-rcu-safe-list-first-function.patch
new file mode 100644 (file)
index 0000000..4f4376b
--- /dev/null
@@ -0,0 +1,64 @@
+From 80f130bfad1dab93b95683fc39b87235682b8f72 Mon Sep 17 00:00:00 2001
+From: Krister Johansen <kjlx@templeofstupid.com>
+Date: Tue, 7 Jan 2025 15:24:58 -0800
+Subject: dm thin: make get_first_thin use rcu-safe list first function
+
+From: Krister Johansen <kjlx@templeofstupid.com>
+
+commit 80f130bfad1dab93b95683fc39b87235682b8f72 upstream.
+
+The documentation in rculist.h explains the absence of list_empty_rcu()
+and cautions programmers against relying on a list_empty() ->
+list_first() sequence in RCU safe code.  This is because each of these
+functions performs its own READ_ONCE() of the list head.  This can lead
+to a situation where the list_empty() sees a valid list entry, but the
+subsequent list_first() sees a different view of list head state after a
+modification.
+
+In the case of dm-thin, this author had a production box crash from a GP
+fault in the process_deferred_bios path.  This function saw a valid list
+head in get_first_thin() but when it subsequently dereferenced that and
+turned it into a thin_c, it got the inside of the struct pool, since the
+list was now empty and referring to itself.  The kernel on which this
+occurred printed both a warning about a refcount_t being saturated, and
+a UBSAN error for an out-of-bounds cpuid access in the queued spinlock,
+prior to the fault itself.  When the resulting kdump was examined, it
+was possible to see another thread patiently waiting in thin_dtr's
+synchronize_rcu.
+
+The thin_dtr call managed to pull the thin_c out of the active thins
+list (and have it be the last entry in the active_thins list) at just
+the wrong moment which lead to this crash.
+
+Fortunately, the fix here is straight forward.  Switch get_first_thin()
+function to use list_first_or_null_rcu() which performs just a single
+READ_ONCE() and returns NULL if the list is already empty.
+
+This was run against the devicemapper test suite's thin-provisioning
+suites for delete and suspend and no regressions were observed.
+
+Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
+Fixes: b10ebd34ccca ("dm thin: fix rcu_read_lock being held in code that can sleep")
+Cc: stable@vger.kernel.org
+Acked-by: Ming-Hung Tsai <mtsai@redhat.com>
+Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/dm-thin.c |    5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+--- a/drivers/md/dm-thin.c
++++ b/drivers/md/dm-thin.c
+@@ -2317,10 +2317,9 @@ static struct thin_c *get_first_thin(str
+       struct thin_c *tc = NULL;
+       rcu_read_lock();
+-      if (!list_empty(&pool->active_thins)) {
+-              tc = list_entry_rcu(pool->active_thins.next, struct thin_c, list);
++      tc = list_first_or_null_rcu(&pool->active_thins, struct thin_c, list);
++      if (tc)
+               thin_get(tc);
+-      }
+       rcu_read_unlock();
+       return tc;
diff --git a/queue-5.10/drm-amd-display-add-check-for-granularity-in-dml-ceil-floor-helpers.patch b/queue-5.10/drm-amd-display-add-check-for-granularity-in-dml-ceil-floor-helpers.patch
new file mode 100644 (file)
index 0000000..47c4154
--- /dev/null
@@ -0,0 +1,63 @@
+From 0881fbc4fd62e00a2b8e102725f76d10351b2ea8 Mon Sep 17 00:00:00 2001
+From: Roman Li <Roman.Li@amd.com>
+Date: Fri, 13 Dec 2024 13:51:07 -0500
+Subject: drm/amd/display: Add check for granularity in dml ceil/floor helpers
+
+From: Roman Li <Roman.Li@amd.com>
+
+commit 0881fbc4fd62e00a2b8e102725f76d10351b2ea8 upstream.
+
+[Why]
+Wrapper functions for dcn_bw_ceil2() and dcn_bw_floor2()
+should check for granularity is non zero to avoid assert and
+divide-by-zero error in dcn_bw_ functions.
+
+[How]
+Add check for granularity 0.
+
+Cc: Mario Limonciello <mario.limonciello@amd.com>
+Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
+Signed-off-by: Roman Li <Roman.Li@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+(cherry picked from commit f6e09701c3eb2ccb8cb0518e0b67f1c69742a4ec)
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h |    8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
++++ b/drivers/gpu/drm/amd/display/dc/dml/dml_inline_defs.h
+@@ -66,11 +66,15 @@ static inline double dml_max5(double a,
+ static inline double dml_ceil(double a, double granularity)
+ {
++      if (granularity == 0)
++              return 0;
+       return (double) dcn_bw_ceil2(a, granularity);
+ }
+ static inline double dml_floor(double a, double granularity)
+ {
++      if (granularity == 0)
++              return 0;
+       return (double) dcn_bw_floor2(a, granularity);
+ }
+@@ -119,11 +123,15 @@ static inline double dml_ceil_2(double f
+ static inline double dml_ceil_ex(double x, double granularity)
+ {
++      if (granularity == 0)
++              return 0;
+       return (double) dcn_bw_ceil2(x, granularity);
+ }
+ static inline double dml_floor_ex(double x, double granularity)
+ {
++      if (granularity == 0)
++              return 0;
+       return (double) dcn_bw_floor2(x, granularity);
+ }
diff --git a/queue-5.10/sctp-sysctl-auth_enable-avoid-using-current-nsproxy.patch b/queue-5.10/sctp-sysctl-auth_enable-avoid-using-current-nsproxy.patch
new file mode 100644 (file)
index 0000000..2c64291
--- /dev/null
@@ -0,0 +1,49 @@
+From 15649fd5415eda664ef35780c2013adeb5d9c695 Mon Sep 17 00:00:00 2001
+From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
+Date: Wed, 8 Jan 2025 16:34:34 +0100
+Subject: sctp: sysctl: auth_enable: avoid using current->nsproxy
+
+From: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+
+commit 15649fd5415eda664ef35780c2013adeb5d9c695 upstream.
+
+As mentioned in a previous commit of this series, using the 'net'
+structure via 'current' is not recommended for different reasons:
+
+- Inconsistency: getting info from the reader's/writer's netns vs only
+  from the opener's netns.
+
+- current->nsproxy can be NULL in some cases, resulting in an 'Oops'
+  (null-ptr-deref), e.g. when the current task is exiting, as spotted by
+  syzbot [1] using acct(2).
+
+The 'net' structure can be obtained from the table->data using
+container_of().
+
+Note that table->data could also be used directly, but that would
+increase the size of this fix, while 'sctp.ctl_sock' still needs to be
+retrieved from 'net' structure.
+
+Fixes: b14878ccb7fa ("net: sctp: cache auth_enable per endpoint")
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/67769ecb.050a0220.3a8527.003f.GAE@google.com [1]
+Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Link: https://patch.msgid.link/20250108-net-sysctl-current-nsproxy-v1-6-5df34b2083e8@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/sctp/sysctl.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/sctp/sysctl.c
++++ b/net/sctp/sysctl.c
+@@ -462,7 +462,7 @@ static int proc_sctp_do_alpha_beta(struc
+ static int proc_sctp_do_auth(struct ctl_table *ctl, int write,
+                            void *buffer, size_t *lenp, loff_t *ppos)
+ {
+-      struct net *net = current->nsproxy->net_ns;
++      struct net *net = container_of(ctl->data, struct net, sctp.auth_enable);
+       struct ctl_table tbl;
+       int new_value, ret;
diff --git a/queue-5.10/sctp-sysctl-cookie_hmac_alg-avoid-using-current-nsproxy.patch b/queue-5.10/sctp-sysctl-cookie_hmac_alg-avoid-using-current-nsproxy.patch
new file mode 100644 (file)
index 0000000..78b34b1
--- /dev/null
@@ -0,0 +1,51 @@
+From ea62dd1383913b5999f3d16ae99d411f41b528d4 Mon Sep 17 00:00:00 2001
+From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
+Date: Wed, 8 Jan 2025 16:34:32 +0100
+Subject: sctp: sysctl: cookie_hmac_alg: avoid using current->nsproxy
+
+From: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+
+commit ea62dd1383913b5999f3d16ae99d411f41b528d4 upstream.
+
+As mentioned in a previous commit of this series, using the 'net'
+structure via 'current' is not recommended for different reasons:
+
+- Inconsistency: getting info from the reader's/writer's netns vs only
+  from the opener's netns.
+
+- current->nsproxy can be NULL in some cases, resulting in an 'Oops'
+  (null-ptr-deref), e.g. when the current task is exiting, as spotted by
+  syzbot [1] using acct(2).
+
+The 'net' structure can be obtained from the table->data using
+container_of().
+
+Note that table->data could also be used directly, as this is the only
+member needed from the 'net' structure, but that would increase the size
+of this fix, to use '*data' everywhere 'net->sctp.sctp_hmac_alg' is
+used.
+
+Fixes: 3c68198e7511 ("sctp: Make hmac algorithm selection for cookie generation dynamic")
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/67769ecb.050a0220.3a8527.003f.GAE@google.com [1]
+Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
+Link: https://patch.msgid.link/20250108-net-sysctl-current-nsproxy-v1-4-5df34b2083e8@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/sctp/sysctl.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/net/sctp/sysctl.c
++++ b/net/sctp/sysctl.c
+@@ -350,7 +350,8 @@ static struct ctl_table sctp_net_table[]
+ static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write,
+                                void *buffer, size_t *lenp, loff_t *ppos)
+ {
+-      struct net *net = current->nsproxy->net_ns;
++      struct net *net = container_of(ctl->data, struct net,
++                                     sctp.sctp_hmac_alg);
+       struct ctl_table tbl;
+       bool changed = false;
+       char *none = "none";
index 2ed7b06c425aad341592851e8ef24dc487f7a99d..eee7f0e931e72ccb802d8b4c9efa9c52b78079c7 100644 (file)
@@ -17,3 +17,8 @@ net-hns3-initialize-reset_timer-before-hclgevf_misc_.patch
 netfilter-nf_tables-imbalance-in-flowtable-binding.patch
 netfilter-conntrack-clamp-maximum-hashtable-size-to-.patch
 afs-fix-the-maximum-cell-name-length.patch
+dm-thin-make-get_first_thin-use-rcu-safe-list-first-function.patch
+dm-ebs-don-t-set-the-flag-dm_target_passes_integrity.patch
+sctp-sysctl-cookie_hmac_alg-avoid-using-current-nsproxy.patch
+sctp-sysctl-auth_enable-avoid-using-current-nsproxy.patch
+drm-amd-display-add-check-for-granularity-in-dml-ceil-floor-helpers.patch