]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 May 2021 15:32:05 +0000 (17:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 May 2021 15:32:05 +0000 (17:32 +0200)
added patches:
btrfs-fix-metadata-extent-leak-after-failure-to-create-subvolume.patch
cifs-return-correct-error-code-from-smb2_get_enc_key.patch
intel_th-pci-add-rocket-lake-cpu-support.patch
irqchip-gic-v3-do-not-enable-irqs-when-handling-spurious-interrups.patch
modules-inherit-taint_proprietary_module.patch
modules-mark-each_symbol_section-static.patch
modules-mark-find_symbol-static.patch
modules-mark-ref_module-static.patch
modules-rename-the-licence-field-in-struct-symsearch-to-license.patch
modules-return-licensing-information-from-find_symbol.patch
modules-unexport-__module_address.patch
modules-unexport-__module_text_address.patch

13 files changed:
queue-5.4/btrfs-fix-metadata-extent-leak-after-failure-to-create-subvolume.patch [new file with mode: 0644]
queue-5.4/cifs-return-correct-error-code-from-smb2_get_enc_key.patch [new file with mode: 0644]
queue-5.4/intel_th-pci-add-rocket-lake-cpu-support.patch [new file with mode: 0644]
queue-5.4/irqchip-gic-v3-do-not-enable-irqs-when-handling-spurious-interrups.patch [new file with mode: 0644]
queue-5.4/modules-inherit-taint_proprietary_module.patch [new file with mode: 0644]
queue-5.4/modules-mark-each_symbol_section-static.patch [new file with mode: 0644]
queue-5.4/modules-mark-find_symbol-static.patch [new file with mode: 0644]
queue-5.4/modules-mark-ref_module-static.patch [new file with mode: 0644]
queue-5.4/modules-rename-the-licence-field-in-struct-symsearch-to-license.patch [new file with mode: 0644]
queue-5.4/modules-return-licensing-information-from-find_symbol.patch [new file with mode: 0644]
queue-5.4/modules-unexport-__module_address.patch [new file with mode: 0644]
queue-5.4/modules-unexport-__module_text_address.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/btrfs-fix-metadata-extent-leak-after-failure-to-create-subvolume.patch b/queue-5.4/btrfs-fix-metadata-extent-leak-after-failure-to-create-subvolume.patch
new file mode 100644 (file)
index 0000000..30bd185
--- /dev/null
@@ -0,0 +1,95 @@
+From 67addf29004c5be9fa0383c82a364bb59afc7f84 Mon Sep 17 00:00:00 2001
+From: Filipe Manana <fdmanana@suse.com>
+Date: Tue, 20 Apr 2021 10:55:12 +0100
+Subject: btrfs: fix metadata extent leak after failure to create subvolume
+
+From: Filipe Manana <fdmanana@suse.com>
+
+commit 67addf29004c5be9fa0383c82a364bb59afc7f84 upstream.
+
+When creating a subvolume we allocate an extent buffer for its root node
+after starting a transaction. We setup a root item for the subvolume that
+points to that extent buffer and then attempt to insert the root item into
+the root tree - however if that fails, due to ENOMEM for example, we do
+not free the extent buffer previously allocated and we do not abort the
+transaction (as at that point we did nothing that can not be undone).
+
+This means that we effectively do not return the metadata extent back to
+the free space cache/tree and we leave a delayed reference for it which
+causes a metadata extent item to be added to the extent tree, in the next
+transaction commit, without having backreferences. When this happens
+'btrfs check' reports the following:
+
+  $ btrfs check /dev/sdi
+  Opening filesystem to check...
+  Checking filesystem on /dev/sdi
+  UUID: dce2cb9d-025f-4b05-a4bf-cee0ad3785eb
+  [1/7] checking root items
+  [2/7] checking extents
+  ref mismatch on [30425088 16384] extent item 1, found 0
+  backref 30425088 root 256 not referenced back 0x564a91c23d70
+  incorrect global backref count on 30425088 found 1 wanted 0
+  backpointer mismatch on [30425088 16384]
+  owner ref check failed [30425088 16384]
+  ERROR: errors found in extent allocation tree or chunk allocation
+  [3/7] checking free space cache
+  [4/7] checking fs roots
+  [5/7] checking only csums items (without verifying data)
+  [6/7] checking root refs
+  [7/7] checking quota groups skipped (not enabled on this FS)
+  found 212992 bytes used, error(s) found
+  total csum bytes: 0
+  total tree bytes: 131072
+  total fs tree bytes: 32768
+  total extent tree bytes: 16384
+  btree space waste bytes: 124669
+  file data blocks allocated: 65536
+   referenced 65536
+
+So fix this by freeing the metadata extent if btrfs_insert_root() returns
+an error.
+
+CC: stable@vger.kernel.org # 4.4+
+Signed-off-by: Filipe Manana <fdmanana@suse.com>
+Reviewed-by: David Sterba <dsterba@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/ioctl.c |   18 +++++++++++++++---
+ 1 file changed, 15 insertions(+), 3 deletions(-)
+
+--- a/fs/btrfs/ioctl.c
++++ b/fs/btrfs/ioctl.c
+@@ -667,8 +667,6 @@ static noinline int create_subvol(struct
+       btrfs_set_root_otransid(root_item, trans->transid);
+       btrfs_tree_unlock(leaf);
+-      free_extent_buffer(leaf);
+-      leaf = NULL;
+       btrfs_set_root_dirid(root_item, new_dirid);
+@@ -677,8 +675,22 @@ static noinline int create_subvol(struct
+       key.type = BTRFS_ROOT_ITEM_KEY;
+       ret = btrfs_insert_root(trans, fs_info->tree_root, &key,
+                               root_item);
+-      if (ret)
++      if (ret) {
++              /*
++               * Since we don't abort the transaction in this case, free the
++               * tree block so that we don't leak space and leave the
++               * filesystem in an inconsistent state (an extent item in the
++               * extent tree without backreferences). Also no need to have
++               * the tree block locked since it is not in any tree at this
++               * point, so no other task can find it and use it.
++               */
++              btrfs_free_tree_block(trans, root, leaf, 0, 1);
++              free_extent_buffer(leaf);
+               goto fail;
++      }
++
++      free_extent_buffer(leaf);
++      leaf = NULL;
+       key.offset = (u64)-1;
+       new_root = btrfs_read_fs_root_no_name(fs_info, &key);
diff --git a/queue-5.4/cifs-return-correct-error-code-from-smb2_get_enc_key.patch b/queue-5.4/cifs-return-correct-error-code-from-smb2_get_enc_key.patch
new file mode 100644 (file)
index 0000000..02a7031
--- /dev/null
@@ -0,0 +1,50 @@
+From 83728cbf366e334301091d5b808add468ab46b27 Mon Sep 17 00:00:00 2001
+From: Paul Aurich <paul@darkrain42.org>
+Date: Tue, 13 Apr 2021 14:25:27 -0700
+Subject: cifs: Return correct error code from smb2_get_enc_key
+
+From: Paul Aurich <paul@darkrain42.org>
+
+commit 83728cbf366e334301091d5b808add468ab46b27 upstream.
+
+Avoid a warning if the error percolates back up:
+
+[440700.376476] CIFS VFS: \\otters.example.com crypt_message: Could not get encryption key
+[440700.386947] ------------[ cut here ]------------
+[440700.386948] err = 1
+[440700.386977] WARNING: CPU: 11 PID: 2733 at /build/linux-hwe-5.4-p6lk6L/linux-hwe-5.4-5.4.0/lib/errseq.c:74 errseq_set+0x5c/0x70
+...
+[440700.397304] CPU: 11 PID: 2733 Comm: tar Tainted: G           OE     5.4.0-70-generic #78~18.04.1-Ubuntu
+...
+[440700.397334] Call Trace:
+[440700.397346]  __filemap_set_wb_err+0x1a/0x70
+[440700.397419]  cifs_writepages+0x9c7/0xb30 [cifs]
+[440700.397426]  do_writepages+0x4b/0xe0
+[440700.397444]  __filemap_fdatawrite_range+0xcb/0x100
+[440700.397455]  filemap_write_and_wait+0x42/0xa0
+[440700.397486]  cifs_setattr+0x68b/0xf30 [cifs]
+[440700.397493]  notify_change+0x358/0x4a0
+[440700.397500]  utimes_common+0xe9/0x1c0
+[440700.397510]  do_utimes+0xc5/0x150
+[440700.397520]  __x64_sys_utimensat+0x88/0xd0
+
+Fixes: 61cfac6f267d ("CIFS: Fix possible use after free in demultiplex thread")
+Signed-off-by: Paul Aurich <paul@darkrain42.org>
+CC: stable@vger.kernel.org
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/cifs/smb2ops.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/fs/cifs/smb2ops.c
++++ b/fs/cifs/smb2ops.c
+@@ -3693,7 +3693,7 @@ smb2_get_enc_key(struct TCP_Server_Info
+       }
+       spin_unlock(&cifs_tcp_ses_lock);
+-      return 1;
++      return -EAGAIN;
+ }
+ /*
+  * Encrypt or decrypt @rqst message. @rqst[0] has the following format:
diff --git a/queue-5.4/intel_th-pci-add-rocket-lake-cpu-support.patch b/queue-5.4/intel_th-pci-add-rocket-lake-cpu-support.patch
new file mode 100644 (file)
index 0000000..d4d7fe3
--- /dev/null
@@ -0,0 +1,35 @@
+From 9f7f2a5e01ab4ee56b6d9c0572536fe5fd56e376 Mon Sep 17 00:00:00 2001
+From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Date: Wed, 14 Apr 2021 20:12:50 +0300
+Subject: intel_th: pci: Add Rocket Lake CPU support
+
+From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+
+commit 9f7f2a5e01ab4ee56b6d9c0572536fe5fd56e376 upstream.
+
+This adds support for the Trace Hub in Rocket Lake CPUs.
+
+Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Cc: stable <stable@vger.kernel.org> # v4.14+
+Link: https://lore.kernel.org/r/20210414171251.14672-7-alexander.shishkin@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/hwtracing/intel_th/pci.c |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/hwtracing/intel_th/pci.c
++++ b/drivers/hwtracing/intel_th/pci.c
+@@ -268,6 +268,11 @@ static const struct pci_device_id intel_
+               PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x1bcc),
+               .driver_data = (kernel_ulong_t)&intel_th_2x,
+       },
++      {
++              /* Rocket Lake CPU */
++              PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4c19),
++              .driver_data = (kernel_ulong_t)&intel_th_2x,
++      },
+       { 0 },
+ };
diff --git a/queue-5.4/irqchip-gic-v3-do-not-enable-irqs-when-handling-spurious-interrups.patch b/queue-5.4/irqchip-gic-v3-do-not-enable-irqs-when-handling-spurious-interrups.patch
new file mode 100644 (file)
index 0000000..da5102b
--- /dev/null
@@ -0,0 +1,116 @@
+From a97709f563a078e259bf0861cd259aa60332890a Mon Sep 17 00:00:00 2001
+From: He Ying <heying24@huawei.com>
+Date: Fri, 23 Apr 2021 04:35:16 -0400
+Subject: irqchip/gic-v3: Do not enable irqs when handling spurious interrups
+
+From: He Ying <heying24@huawei.com>
+
+commit a97709f563a078e259bf0861cd259aa60332890a upstream.
+
+We triggered the following error while running our 4.19 kernel
+with the pseudo-NMI patches backported to it:
+
+[   14.816231] ------------[ cut here ]------------
+[   14.816231] kernel BUG at irq.c:99!
+[   14.816232] Internal error: Oops - BUG: 0 [#1] SMP
+[   14.816232] Process swapper/0 (pid: 0, stack limit = 0x(____ptrval____))
+[   14.816233] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G           O      4.19.95.aarch64 #14
+[   14.816233] Hardware name: evb (DT)
+[   14.816234] pstate: 80400085 (Nzcv daIf +PAN -UAO)
+[   14.816234] pc : asm_nmi_enter+0x94/0x98
+[   14.816235] lr : asm_nmi_enter+0x18/0x98
+[   14.816235] sp : ffff000008003c50
+[   14.816235] pmr_save: 00000070
+[   14.816237] x29: ffff000008003c50 x28: ffff0000095f56c0
+[   14.816238] x27: 0000000000000000 x26: ffff000008004000
+[   14.816239] x25: 00000000015e0000 x24: ffff8008fb916000
+[   14.816240] x23: 0000000020400005 x22: ffff0000080817cc
+[   14.816241] x21: ffff000008003da0 x20: 0000000000000060
+[   14.816242] x19: 00000000000003ff x18: ffffffffffffffff
+[   14.816243] x17: 0000000000000008 x16: 003d090000000000
+[   14.816244] x15: ffff0000095ea6c8 x14: ffff8008fff5ab40
+[   14.816244] x13: ffff8008fff58b9d x12: 0000000000000000
+[   14.816245] x11: ffff000008c8a200 x10: 000000008e31fca5
+[   14.816246] x9 : ffff000008c8a208 x8 : 000000000000000f
+[   14.816247] x7 : 0000000000000004 x6 : ffff8008fff58b9e
+[   14.816248] x5 : 0000000000000000 x4 : 0000000080000000
+[   14.816249] x3 : 0000000000000000 x2 : 0000000080000000
+[   14.816250] x1 : 0000000000120000 x0 : ffff0000095f56c0
+[   14.816251] Call trace:
+[   14.816251]  asm_nmi_enter+0x94/0x98
+[   14.816251]  el1_irq+0x8c/0x180                    (IRQ C)
+[   14.816252]  gic_handle_irq+0xbc/0x2e4
+[   14.816252]  el1_irq+0xcc/0x180                    (IRQ B)
+[   14.816253]  arch_timer_handler_virt+0x38/0x58
+[   14.816253]  handle_percpu_devid_irq+0x90/0x240
+[   14.816253]  generic_handle_irq+0x34/0x50
+[   14.816254]  __handle_domain_irq+0x68/0xc0
+[   14.816254]  gic_handle_irq+0xf8/0x2e4
+[   14.816255]  el1_irq+0xcc/0x180                    (IRQ A)
+[   14.816255]  arch_cpu_idle+0x34/0x1c8
+[   14.816255]  default_idle_call+0x24/0x44
+[   14.816256]  do_idle+0x1d0/0x2c8
+[   14.816256]  cpu_startup_entry+0x28/0x30
+[   14.816256]  rest_init+0xb8/0xc8
+[   14.816257]  start_kernel+0x4c8/0x4f4
+[   14.816257] Code: 940587f1 d5384100 b9401001 36a7fd01 (d4210000)
+[   14.816258] Modules linked in: start_dp(O) smeth(O)
+[   15.103092] ---[ end trace 701753956cb14aa8 ]---
+[   15.103093] Kernel panic - not syncing: Fatal exception in interrupt
+[   15.103099] SMP: stopping secondary CPUs
+[   15.103100] Kernel Offset: disabled
+[   15.103100] CPU features: 0x36,a2400218
+[   15.103100] Memory Limit: none
+
+which is cause by a 'BUG_ON(in_nmi())' in nmi_enter().
+
+From the call trace, we can find three interrupts (noted A, B, C above):
+interrupt (A) is preempted by (B), which is further interrupted by (C).
+
+Subsequent investigations show that (B) results in nmi_enter() being
+called, but that it actually is a spurious interrupt. Furthermore,
+interrupts are reenabled in the context of (B), and (C) fires with
+NMI priority. We end-up with a nested NMI situation, something
+we definitely do not want to (and cannot) handle.
+
+The bug here is that spurious interrupts should never result in any
+state change, and we should just return to the interrupted context.
+Moving the handling of spurious interrupts as early as possible in
+the GICv3 handler fixes this issue.
+
+Fixes: 3f1f3234bc2d ("irqchip/gic-v3: Switch to PMR masking before calling IRQ handler")
+Acked-by: Mark Rutland <mark.rutland@arm.com>
+Signed-off-by: He Ying <heying24@huawei.com>
+[maz: rewrote commit message, corrected Fixes: tag]
+Signed-off-by: Marc Zyngier <maz@kernel.org>
+Link: https://lore.kernel.org/r/20210423083516.170111-1-heying24@huawei.com
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/irqchip/irq-gic-v3.c |    8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/drivers/irqchip/irq-gic-v3.c
++++ b/drivers/irqchip/irq-gic-v3.c
+@@ -621,6 +621,10 @@ static asmlinkage void __exception_irq_e
+       irqnr = gic_read_iar();
++      /* Check for special IDs first */
++      if ((irqnr >= 1020 && irqnr <= 1023))
++              return;
++
+       if (gic_supports_nmi() &&
+           unlikely(gic_read_rpr() == GICD_INT_NMI_PRI)) {
+               gic_handle_nmi(irqnr, regs);
+@@ -632,10 +636,6 @@ static asmlinkage void __exception_irq_e
+               gic_arch_enable_irqs();
+       }
+-      /* Check for special IDs first */
+-      if ((irqnr >= 1020 && irqnr <= 1023))
+-              return;
+-
+       /* Treat anything but SGIs in a uniform way */
+       if (likely(irqnr > 15)) {
+               int err;
diff --git a/queue-5.4/modules-inherit-taint_proprietary_module.patch b/queue-5.4/modules-inherit-taint_proprietary_module.patch
new file mode 100644 (file)
index 0000000..d80d8e9
--- /dev/null
@@ -0,0 +1,82 @@
+From 262e6ae7081df304fc625cf368d5c2cbba2bb991 Mon Sep 17 00:00:00 2001
+From: Christoph Hellwig <hch@lst.de>
+Date: Tue, 28 Jul 2020 23:33:33 +0200
+Subject: modules: inherit TAINT_PROPRIETARY_MODULE
+
+From: Christoph Hellwig <hch@lst.de>
+
+commit 262e6ae7081df304fc625cf368d5c2cbba2bb991 upstream.
+
+If a TAINT_PROPRIETARY_MODULE exports symbol, inherit the taint flag
+for all modules importing these symbols, and don't allow loading
+symbols from TAINT_PROPRIETARY_MODULE modules if the module previously
+imported gplonly symbols.  Add a anti-circumvention devices so people
+don't accidentally get themselves into trouble this way.
+
+Comment from Greg:
+  "Ah, the proven-to-be-illegal "GPL Condom" defense :)"
+
+[jeyu: pr_info -> pr_err and pr_warn as per discussion]
+Link: http://lore.kernel.org/r/20200730162957.GA22469@lst.de
+Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Jessica Yu <jeyu@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/module.h |    1 +
+ kernel/module.c        |   26 ++++++++++++++++++++++++++
+ 2 files changed, 27 insertions(+)
+
+--- a/include/linux/module.h
++++ b/include/linux/module.h
+@@ -376,6 +376,7 @@ struct module {
+       unsigned int num_gpl_syms;
+       const struct kernel_symbol *gpl_syms;
+       const s32 *gpl_crcs;
++      bool using_gplonly_symbols;
+ #ifdef CONFIG_UNUSED_SYMBOLS
+       /* unused exported symbols. */
+--- a/kernel/module.c
++++ b/kernel/module.c
+@@ -1429,6 +1429,24 @@ static int verify_namespace_is_imported(
+       return 0;
+ }
++static bool inherit_taint(struct module *mod, struct module *owner)
++{
++      if (!owner || !test_bit(TAINT_PROPRIETARY_MODULE, &owner->taints))
++              return true;
++
++      if (mod->using_gplonly_symbols) {
++              pr_err("%s: module using GPL-only symbols uses symbols from proprietary module %s.\n",
++                      mod->name, owner->name);
++              return false;
++      }
++
++      if (!test_bit(TAINT_PROPRIETARY_MODULE, &mod->taints)) {
++              pr_warn("%s: module uses symbols from proprietary module %s, inheriting taint.\n",
++                      mod->name, owner->name);
++              set_bit(TAINT_PROPRIETARY_MODULE, &mod->taints);
++      }
++      return true;
++}
+ /* Resolve a symbol for this module.  I.e. if we find one, record usage. */
+ static const struct kernel_symbol *resolve_symbol(struct module *mod,
+@@ -1454,6 +1472,14 @@ static const struct kernel_symbol *resol
+       if (!sym)
+               goto unlock;
++      if (license == GPL_ONLY)
++              mod->using_gplonly_symbols = true;
++
++      if (!inherit_taint(mod, owner)) {
++              sym = NULL;
++              goto getname;
++      }
++
+       if (!check_version(info, name, mod, crc)) {
+               sym = ERR_PTR(-EINVAL);
+               goto getname;
diff --git a/queue-5.4/modules-mark-each_symbol_section-static.patch b/queue-5.4/modules-mark-each_symbol_section-static.patch
new file mode 100644 (file)
index 0000000..d920e74
--- /dev/null
@@ -0,0 +1,56 @@
+From a54e04914c211b5678602a46b3ede5d82ec1327d Mon Sep 17 00:00:00 2001
+From: Christoph Hellwig <hch@lst.de>
+Date: Thu, 30 Jul 2020 08:10:22 +0200
+Subject: modules: mark each_symbol_section static
+
+From: Christoph Hellwig <hch@lst.de>
+
+commit a54e04914c211b5678602a46b3ede5d82ec1327d upstream.
+
+each_symbol_section is only used inside of module.c.
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Jessica Yu <jeyu@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/module.h |    9 ---------
+ kernel/module.c        |    3 +--
+ 2 files changed, 1 insertion(+), 11 deletions(-)
+
+--- a/include/linux/module.h
++++ b/include/linux/module.h
+@@ -569,15 +569,6 @@ struct symsearch {
+       bool unused;
+ };
+-/*
+- * Walk the exported symbol table
+- *
+- * Must be called with module_mutex held or preemption disabled.
+- */
+-bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
+-                                  struct module *owner,
+-                                  void *data), void *data);
+-
+ /* Returns 0 and fills in value, defined and namebuf, or -ERANGE if
+    symnum out of range. */
+ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
+--- a/kernel/module.c
++++ b/kernel/module.c
+@@ -420,7 +420,7 @@ static bool each_symbol_in_section(const
+ }
+ /* Returns true as soon as fn returns true, otherwise false. */
+-bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
++static bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
+                                   struct module *owner,
+                                   void *data),
+                        void *data)
+@@ -482,7 +482,6 @@ bool each_symbol_section(bool (*fn)(cons
+       }
+       return false;
+ }
+-EXPORT_SYMBOL_GPL(each_symbol_section);
+ struct find_symbol_arg {
+       /* Input */
diff --git a/queue-5.4/modules-mark-find_symbol-static.patch b/queue-5.4/modules-mark-find_symbol-static.patch
new file mode 100644 (file)
index 0000000..bd844e1
--- /dev/null
@@ -0,0 +1,58 @@
+From 773110470e2fa3839523384ae014f8a723c4d178 Mon Sep 17 00:00:00 2001
+From: Christoph Hellwig <hch@lst.de>
+Date: Thu, 30 Jul 2020 08:10:21 +0200
+Subject: modules: mark find_symbol static
+
+From: Christoph Hellwig <hch@lst.de>
+
+commit 773110470e2fa3839523384ae014f8a723c4d178 upstream.
+
+find_symbol is only used in module.c.
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Jessica Yu <jeyu@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/module.h |   11 -----------
+ kernel/module.c        |    3 +--
+ 2 files changed, 1 insertion(+), 13 deletions(-)
+
+--- a/include/linux/module.h
++++ b/include/linux/module.h
+@@ -570,17 +570,6 @@ struct symsearch {
+ };
+ /*
+- * Search for an exported symbol by name.
+- *
+- * Must be called with module_mutex held or preemption disabled.
+- */
+-const struct kernel_symbol *find_symbol(const char *name,
+-                                      struct module **owner,
+-                                      const s32 **crc,
+-                                      bool gplok,
+-                                      bool warn);
+-
+-/*
+  * Walk the exported symbol table
+  *
+  * Must be called with module_mutex held or preemption disabled.
+--- a/kernel/module.c
++++ b/kernel/module.c
+@@ -583,7 +583,7 @@ static bool find_exported_symbol_in_sect
+ /* Find an exported symbol and return it, along with, (optional) crc and
+  * (optional) module which owns it.  Needs preempt disabled or module_mutex. */
+-const struct kernel_symbol *find_symbol(const char *name,
++static const struct kernel_symbol *find_symbol(const char *name,
+                                       struct module **owner,
+                                       const s32 **crc,
+                                       bool gplok,
+@@ -606,7 +606,6 @@ const struct kernel_symbol *find_symbol(
+       pr_debug("Failed to find symbol %s\n", name);
+       return NULL;
+ }
+-EXPORT_SYMBOL_GPL(find_symbol);
+ /*
+  * Search for module by name: must hold module_mutex (or preempt disabled
diff --git a/queue-5.4/modules-mark-ref_module-static.patch b/queue-5.4/modules-mark-ref_module-static.patch
new file mode 100644 (file)
index 0000000..91a63c3
--- /dev/null
@@ -0,0 +1,61 @@
+From 7ef5264de773279b9f23b6cc8afb5addb30e970b Mon Sep 17 00:00:00 2001
+From: Christoph Hellwig <hch@lst.de>
+Date: Thu, 30 Jul 2020 08:10:20 +0200
+Subject: modules: mark ref_module static
+
+From: Christoph Hellwig <hch@lst.de>
+
+commit 7ef5264de773279b9f23b6cc8afb5addb30e970b upstream.
+
+ref_module isn't used anywhere outside of module.c.
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Jessica Yu <jeyu@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/module.h |    1 -
+ kernel/module.c        |    6 ++----
+ 2 files changed, 2 insertions(+), 5 deletions(-)
+
+--- a/include/linux/module.h
++++ b/include/linux/module.h
+@@ -636,7 +636,6 @@ static inline void __module_get(struct m
+ #define symbol_put_addr(p) do { } while (0)
+ #endif /* CONFIG_MODULE_UNLOAD */
+-int ref_module(struct module *a, struct module *b);
+ /* This is a #define so the string doesn't get put in every .o file */
+ #define module_name(mod)                      \
+--- a/kernel/module.c
++++ b/kernel/module.c
+@@ -867,7 +867,7 @@ static int add_module_usage(struct modul
+ }
+ /* Module a uses b: caller needs module_mutex() */
+-int ref_module(struct module *a, struct module *b)
++static int ref_module(struct module *a, struct module *b)
+ {
+       int err;
+@@ -886,7 +886,6 @@ int ref_module(struct module *a, struct
+       }
+       return 0;
+ }
+-EXPORT_SYMBOL_GPL(ref_module);
+ /* Clear the unload stuff of the module. */
+ static void module_unload_free(struct module *mod)
+@@ -1167,11 +1166,10 @@ static inline void module_unload_free(st
+ {
+ }
+-int ref_module(struct module *a, struct module *b)
++static int ref_module(struct module *a, struct module *b)
+ {
+       return strong_try_module_get(b);
+ }
+-EXPORT_SYMBOL_GPL(ref_module);
+ static inline int module_unload_init(struct module *mod)
+ {
diff --git a/queue-5.4/modules-rename-the-licence-field-in-struct-symsearch-to-license.patch b/queue-5.4/modules-rename-the-licence-field-in-struct-symsearch-to-license.patch
new file mode 100644 (file)
index 0000000..7b85f05
--- /dev/null
@@ -0,0 +1,44 @@
+From cd8732cdcc37d7077c4fa2c966b748c0662b607e Mon Sep 17 00:00:00 2001
+From: Christoph Hellwig <hch@lst.de>
+Date: Thu, 30 Jul 2020 08:10:25 +0200
+Subject: modules: rename the licence field in struct symsearch to license
+
+From: Christoph Hellwig <hch@lst.de>
+
+commit cd8732cdcc37d7077c4fa2c966b748c0662b607e upstream.
+
+Use the same spelling variant as the rest of the file.
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Jessica Yu <jeyu@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/module.h |    2 +-
+ kernel/module.c        |    4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+--- a/include/linux/module.h
++++ b/include/linux/module.h
+@@ -565,7 +565,7 @@ struct symsearch {
+               NOT_GPL_ONLY,
+               GPL_ONLY,
+               WILL_BE_GPL_ONLY,
+-      } licence;
++      } license;
+       bool unused;
+ };
+--- a/kernel/module.c
++++ b/kernel/module.c
+@@ -502,9 +502,9 @@ static bool check_exported_symbol(const
+       struct find_symbol_arg *fsa = data;
+       if (!fsa->gplok) {
+-              if (syms->licence == GPL_ONLY)
++              if (syms->license == GPL_ONLY)
+                       return false;
+-              if (syms->licence == WILL_BE_GPL_ONLY && fsa->warn) {
++              if (syms->license == WILL_BE_GPL_ONLY && fsa->warn) {
+                       pr_warn("Symbol %s is being used by a non-GPL module, "
+                               "which will not be allowed in the future\n",
+                               fsa->name);
diff --git a/queue-5.4/modules-return-licensing-information-from-find_symbol.patch b/queue-5.4/modules-return-licensing-information-from-find_symbol.patch
new file mode 100644 (file)
index 0000000..855886e
--- /dev/null
@@ -0,0 +1,118 @@
+From ef1dac6021cc8ec5de02ce31722bf26ac4ed5523 Mon Sep 17 00:00:00 2001
+From: Christoph Hellwig <hch@lst.de>
+Date: Thu, 30 Jul 2020 08:10:26 +0200
+Subject: modules: return licensing information from find_symbol
+
+From: Christoph Hellwig <hch@lst.de>
+
+commit ef1dac6021cc8ec5de02ce31722bf26ac4ed5523 upstream.
+
+Report the GPLONLY status through a new argument.
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Jessica Yu <jeyu@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/module.h |    2 +-
+ kernel/module.c        |   16 +++++++++++-----
+ 2 files changed, 12 insertions(+), 6 deletions(-)
+
+--- a/include/linux/module.h
++++ b/include/linux/module.h
+@@ -561,7 +561,7 @@ struct module *find_module(const char *n
+ struct symsearch {
+       const struct kernel_symbol *start, *stop;
+       const s32 *crcs;
+-      enum {
++      enum mod_license {
+               NOT_GPL_ONLY,
+               GPL_ONLY,
+               WILL_BE_GPL_ONLY,
+--- a/kernel/module.c
++++ b/kernel/module.c
+@@ -493,6 +493,7 @@ struct find_symbol_arg {
+       struct module *owner;
+       const s32 *crc;
+       const struct kernel_symbol *sym;
++      enum mod_license license;
+ };
+ static bool check_exported_symbol(const struct symsearch *syms,
+@@ -526,6 +527,7 @@ static bool check_exported_symbol(const
+       fsa->owner = owner;
+       fsa->crc = symversion(syms->crcs, symnum);
+       fsa->sym = &syms->start[symnum];
++      fsa->license = syms->license;
+       return true;
+ }
+@@ -585,6 +587,7 @@ static bool find_exported_symbol_in_sect
+ static const struct kernel_symbol *find_symbol(const char *name,
+                                       struct module **owner,
+                                       const s32 **crc,
++                                      enum mod_license *license,
+                                       bool gplok,
+                                       bool warn)
+ {
+@@ -599,6 +602,8 @@ static const struct kernel_symbol *find_
+                       *owner = fsa.owner;
+               if (crc)
+                       *crc = fsa.crc;
++              if (license)
++                      *license = fsa.license;
+               return fsa.sym;
+       }
+@@ -1072,7 +1077,7 @@ void __symbol_put(const char *symbol)
+       struct module *owner;
+       preempt_disable();
+-      if (!find_symbol(symbol, &owner, NULL, true, false))
++      if (!find_symbol(symbol, &owner, NULL, NULL, true, false))
+               BUG();
+       module_put(owner);
+       preempt_enable();
+@@ -1350,7 +1355,7 @@ static inline int check_modstruct_versio
+        * locking is necessary -- use preempt_disable() to placate lockdep.
+        */
+       preempt_disable();
+-      if (!find_symbol("module_layout", NULL, &crc, true, false)) {
++      if (!find_symbol("module_layout", NULL, &crc, NULL, true, false)) {
+               preempt_enable();
+               BUG();
+       }
+@@ -1434,6 +1439,7 @@ static const struct kernel_symbol *resol
+       struct module *owner;
+       const struct kernel_symbol *sym;
+       const s32 *crc;
++      enum mod_license license;
+       int err;
+       /*
+@@ -1443,7 +1449,7 @@ static const struct kernel_symbol *resol
+        */
+       sched_annotate_sleep();
+       mutex_lock(&module_mutex);
+-      sym = find_symbol(name, &owner, &crc,
++      sym = find_symbol(name, &owner, &crc, &license,
+                         !(mod->taints & (1 << TAINT_PROPRIETARY_MODULE)), true);
+       if (!sym)
+               goto unlock;
+@@ -2258,7 +2264,7 @@ void *__symbol_get(const char *symbol)
+       const struct kernel_symbol *sym;
+       preempt_disable();
+-      sym = find_symbol(symbol, &owner, NULL, true, true);
++      sym = find_symbol(symbol, &owner, NULL, NULL, true, true);
+       if (sym && strong_try_module_get(owner))
+               sym = NULL;
+       preempt_enable();
+@@ -2294,7 +2300,7 @@ static int verify_exported_symbols(struc
+       for (i = 0; i < ARRAY_SIZE(arr); i++) {
+               for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) {
+                       if (find_symbol(kernel_symbol_name(s), &owner, NULL,
+-                                      true, false)) {
++                                      NULL, true, false)) {
+                               pr_err("%s: exports duplicate symbol %s"
+                                      " (owned by %s)\n",
+                                      mod->name, kernel_symbol_name(s),
diff --git a/queue-5.4/modules-unexport-__module_address.patch b/queue-5.4/modules-unexport-__module_address.patch
new file mode 100644 (file)
index 0000000..1d0ad91
--- /dev/null
@@ -0,0 +1,28 @@
+From 34e64705ad415ed7a816e60ef62b42fe6d1729d9 Mon Sep 17 00:00:00 2001
+From: Christoph Hellwig <hch@lst.de>
+Date: Thu, 30 Jul 2020 08:10:24 +0200
+Subject: modules: unexport __module_address
+
+From: Christoph Hellwig <hch@lst.de>
+
+commit 34e64705ad415ed7a816e60ef62b42fe6d1729d9 upstream.
+
+__module_address is only used by built-in code.
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Jessica Yu <jeyu@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/module.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/kernel/module.c
++++ b/kernel/module.c
+@@ -4616,7 +4616,6 @@ struct module *__module_address(unsigned
+       }
+       return mod;
+ }
+-EXPORT_SYMBOL_GPL(__module_address);
+ /*
+  * is_module_text_address - is this address inside module code?
diff --git a/queue-5.4/modules-unexport-__module_text_address.patch b/queue-5.4/modules-unexport-__module_text_address.patch
new file mode 100644 (file)
index 0000000..bb46cb6
--- /dev/null
@@ -0,0 +1,28 @@
+From 3fe1e56d0e68b623dd62d8d38265d2a052e7e185 Mon Sep 17 00:00:00 2001
+From: Christoph Hellwig <hch@lst.de>
+Date: Thu, 30 Jul 2020 08:10:23 +0200
+Subject: modules: unexport __module_text_address
+
+From: Christoph Hellwig <hch@lst.de>
+
+commit 3fe1e56d0e68b623dd62d8d38265d2a052e7e185 upstream.
+
+__module_text_address is only used by built-in code.
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Jessica Yu <jeyu@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/module.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/kernel/module.c
++++ b/kernel/module.c
+@@ -4655,7 +4655,6 @@ struct module *__module_text_address(uns
+       }
+       return mod;
+ }
+-EXPORT_SYMBOL_GPL(__module_text_address);
+ /* Don't grab lock, we're oopsing. */
+ void print_modules(void)
index 6c84a9e009ed96bf14cd06b9b23b51c868fe49f2..efe0294883ffcebc1fee3dd7eb4bf9d125a550ef 100644 (file)
@@ -21,3 +21,15 @@ mmc-block-issue-a-cache-flush-only-when-it-s-enabled.patch
 mmc-core-do-a-power-cycle-when-the-cmd11-fails.patch
 mmc-core-set-read-only-for-sd-cards-with-permanent-write-protect-bit.patch
 mmc-core-fix-hanging-on-i-o-during-system-suspend-for-removable-cards.patch
+modules-mark-ref_module-static.patch
+modules-mark-find_symbol-static.patch
+modules-mark-each_symbol_section-static.patch
+modules-unexport-__module_text_address.patch
+modules-unexport-__module_address.patch
+modules-rename-the-licence-field-in-struct-symsearch-to-license.patch
+modules-return-licensing-information-from-find_symbol.patch
+modules-inherit-taint_proprietary_module.patch
+irqchip-gic-v3-do-not-enable-irqs-when-handling-spurious-interrups.patch
+cifs-return-correct-error-code-from-smb2_get_enc_key.patch
+btrfs-fix-metadata-extent-leak-after-failure-to-create-subvolume.patch
+intel_th-pci-add-rocket-lake-cpu-support.patch