]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Dec 2022 13:13:33 +0000 (14:13 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Dec 2022 13:13:33 +0000 (14:13 +0100)
added patches:
gcov-add-support-for-checksum-field.patch
ovl-fix-use-inode-directly-in-rcu-walk-mode.patch

queue-5.10/gcov-add-support-for-checksum-field.patch [new file with mode: 0644]
queue-5.10/ovl-fix-use-inode-directly-in-rcu-walk-mode.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/gcov-add-support-for-checksum-field.patch b/queue-5.10/gcov-add-support-for-checksum-field.patch
new file mode 100644 (file)
index 0000000..2d5265f
--- /dev/null
@@ -0,0 +1,49 @@
+From e96b95c2b7a63a454b6498e2df67aac14d046d13 Mon Sep 17 00:00:00 2001
+From: Rickard x Andersson <rickaran@axis.com>
+Date: Tue, 20 Dec 2022 11:23:18 +0100
+Subject: gcov: add support for checksum field
+
+From: Rickard x Andersson <rickaran@axis.com>
+
+commit e96b95c2b7a63a454b6498e2df67aac14d046d13 upstream.
+
+In GCC version 12.1 a checksum field was added.
+
+This patch fixes a kernel crash occurring during boot when using
+gcov-kernel with GCC version 12.2.  The crash occurred on a system running
+on i.MX6SX.
+
+Link: https://lkml.kernel.org/r/20221220102318.3418501-1-rickaran@axis.com
+Fixes: 977ef30a7d88 ("gcov: support GCC 12.1 and newer compilers")
+Signed-off-by: Rickard x Andersson <rickaran@axis.com>
+Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
+Tested-by: Peter Oberparleiter <oberpar@linux.ibm.com>
+Reviewed-by: Martin Liska <mliska@suse.cz>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/gcov/gcc_4_7.c |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/kernel/gcov/gcc_4_7.c
++++ b/kernel/gcov/gcc_4_7.c
+@@ -85,6 +85,7 @@ struct gcov_fn_info {
+  * @version: gcov version magic indicating the gcc version used for compilation
+  * @next: list head for a singly-linked list
+  * @stamp: uniquifying time stamp
++ * @checksum: unique object checksum
+  * @filename: name of the associated gcov data file
+  * @merge: merge functions (null for unused counter type)
+  * @n_functions: number of instrumented functions
+@@ -97,6 +98,10 @@ struct gcov_info {
+       unsigned int version;
+       struct gcov_info *next;
+       unsigned int stamp;
++ /* Since GCC 12.1 a checksum field is added. */
++#if (__GNUC__ >= 12)
++      unsigned int checksum;
++#endif
+       const char *filename;
+       void (*merge[GCOV_COUNTERS])(gcov_type *, unsigned int);
+       unsigned int n_functions;
diff --git a/queue-5.10/ovl-fix-use-inode-directly-in-rcu-walk-mode.patch b/queue-5.10/ovl-fix-use-inode-directly-in-rcu-walk-mode.patch
new file mode 100644 (file)
index 0000000..e49ff25
--- /dev/null
@@ -0,0 +1,45 @@
+From 672e4268b2863d7e4978dfed29552b31c2f9bd4e Mon Sep 17 00:00:00 2001
+From: Chen Zhongjin <chenzhongjin@huawei.com>
+Date: Mon, 28 Nov 2022 11:33:05 +0100
+Subject: ovl: fix use inode directly in rcu-walk mode
+
+From: Chen Zhongjin <chenzhongjin@huawei.com>
+
+commit 672e4268b2863d7e4978dfed29552b31c2f9bd4e upstream.
+
+ovl_dentry_revalidate_common() can be called in rcu-walk mode.  As document
+said, "in rcu-walk mode, d_parent and d_inode should not be used without
+care".
+
+Check inode here to protect access under rcu-walk mode.
+
+Fixes: bccece1ead36 ("ovl: allow remote upper")
+Reported-and-tested-by: syzbot+a4055c78774bbf3498bb@syzkaller.appspotmail.com
+Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
+Cc: <stable@vger.kernel.org> # v5.7
+Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/overlayfs/super.c |    7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+--- a/fs/overlayfs/super.c
++++ b/fs/overlayfs/super.c
+@@ -138,11 +138,16 @@ static int ovl_dentry_revalidate_common(
+                                       unsigned int flags, bool weak)
+ {
+       struct ovl_entry *oe = dentry->d_fsdata;
++      struct inode *inode = d_inode_rcu(dentry);
+       struct dentry *upper;
+       unsigned int i;
+       int ret = 1;
+-      upper = ovl_dentry_upper(dentry);
++      /* Careful in RCU mode */
++      if (!inode)
++              return -ECHILD;
++
++      upper = ovl_i_dentry_upper(inode);
+       if (upper)
+               ret = ovl_revalidate_real(upper, flags, weak);
index deb752ac7950ee0dbcd3974d21c13f44babe6da0..62cf9c5108f33f4357d374e303db81e1e0d6e0f6 100644 (file)
@@ -568,3 +568,5 @@ reiserfs-add-missing-calls-to-reiserfs_security_free.patch
 iio-adc-ad_sigma_delta-do-not-use-internal-iio_dev-lock.patch
 iio-adc128s052-add-proper-.data-members-in-adc128_of_match-table.patch
 regulator-core-fix-deadlock-on-regulator-enable.patch
+gcov-add-support-for-checksum-field.patch
+ovl-fix-use-inode-directly-in-rcu-walk-mode.patch