From: Sasha Levin Date: Mon, 15 Mar 2021 03:01:11 +0000 (-0400) Subject: Fixes for 4.19 X-Git-Tag: v4.4.262~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f898db0645996b27af16584c698e4d2a8cbb5156;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/block-rsxx-fix-error-return-code-of-rsxx_pci_probe.patch b/queue-4.19/block-rsxx-fix-error-return-code-of-rsxx_pci_probe.patch new file mode 100644 index 00000000000..4aa899e6909 --- /dev/null +++ b/queue-4.19/block-rsxx-fix-error-return-code-of-rsxx_pci_probe.patch @@ -0,0 +1,39 @@ +From 458c928172df46b10c7dc3227f126923ec408709 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 9 Mar 2021 19:30:17 -0800 +Subject: block: rsxx: fix error return code of rsxx_pci_probe() + +From: Jia-Ju Bai + +[ Upstream commit df66617bfe87487190a60783d26175b65d2502ce ] + +When create_singlethread_workqueue returns NULL to card->event_wq, no +error return code of rsxx_pci_probe() is assigned. + +To fix this bug, st is assigned with -ENOMEM in this case. + +Fixes: 8722ff8cdbfa ("block: IBM RamSan 70/80 device driver") +Reported-by: TOTE Robot +Signed-off-by: Jia-Ju Bai +Link: https://lore.kernel.org/r/20210310033017.4023-1-baijiaju1990@gmail.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/block/rsxx/core.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c +index d8ef8b16fb2e..08acfe11752b 100644 +--- a/drivers/block/rsxx/core.c ++++ b/drivers/block/rsxx/core.c +@@ -883,6 +883,7 @@ static int rsxx_pci_probe(struct pci_dev *dev, + card->event_wq = create_singlethread_workqueue(DRIVER_NAME"_event"); + if (!card->event_wq) { + dev_err(CARD_TO_DEV(card), "Failed card event setup.\n"); ++ st = -ENOMEM; + goto failed_event_handler; + } + +-- +2.30.1 + diff --git a/queue-4.19/configfs-fix-a-use-after-free-in-__configfs_open_fil.patch b/queue-4.19/configfs-fix-a-use-after-free-in-__configfs_open_fil.patch new file mode 100644 index 00000000000..4c19279fbaf --- /dev/null +++ b/queue-4.19/configfs-fix-a-use-after-free-in-__configfs_open_fil.patch @@ -0,0 +1,132 @@ +From adc97ecaac4612a7391a3b49fcea4a8cc6df27d3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 1 Mar 2021 14:10:53 +0800 +Subject: configfs: fix a use-after-free in __configfs_open_file + +From: Daiyue Zhang + +[ Upstream commit 14fbbc8297728e880070f7b077b3301a8c698ef9 ] + +Commit b0841eefd969 ("configfs: provide exclusion between IO and removals") +uses ->frag_dead to mark the fragment state, thus no bothering with extra +refcount on config_item when opening a file. The configfs_get_config_item +was removed in __configfs_open_file, but not with config_item_put. So the +refcount on config_item will lost its balance, causing use-after-free +issues in some occasions like this: + +Test: +1. Mount configfs on /config with read-only items: +drwxrwx--- 289 root root 0 2021-04-01 11:55 /config +drwxr-xr-x 2 root root 0 2021-04-01 11:54 /config/a +--w--w--w- 1 root root 4096 2021-04-01 11:53 /config/a/1.txt +...... + +2. Then run: +for file in /config +do +echo $file +grep -R 'key' $file +done + +3. __configfs_open_file will be called in parallel, the first one +got called will do: +if (file->f_mode & FMODE_READ) { + if (!(inode->i_mode & S_IRUGO)) + goto out_put_module; + config_item_put(buffer->item); + kref_put() + package_details_release() + kfree() + +the other one will run into use-after-free issues like this: +BUG: KASAN: use-after-free in __configfs_open_file+0x1bc/0x3b0 +Read of size 8 at addr fffffff155f02480 by task grep/13096 +CPU: 0 PID: 13096 Comm: grep VIP: 00 Tainted: G W 4.14.116-kasan #1 +TGID: 13096 Comm: grep +Call trace: +dump_stack+0x118/0x160 +kasan_report+0x22c/0x294 +__asan_load8+0x80/0x88 +__configfs_open_file+0x1bc/0x3b0 +configfs_open_file+0x28/0x34 +do_dentry_open+0x2cc/0x5c0 +vfs_open+0x80/0xe0 +path_openat+0xd8c/0x2988 +do_filp_open+0x1c4/0x2fc +do_sys_open+0x23c/0x404 +SyS_openat+0x38/0x48 + +Allocated by task 2138: +kasan_kmalloc+0xe0/0x1ac +kmem_cache_alloc_trace+0x334/0x394 +packages_make_item+0x4c/0x180 +configfs_mkdir+0x358/0x740 +vfs_mkdir2+0x1bc/0x2e8 +SyS_mkdirat+0x154/0x23c +el0_svc_naked+0x34/0x38 + +Freed by task 13096: +kasan_slab_free+0xb8/0x194 +kfree+0x13c/0x910 +package_details_release+0x524/0x56c +kref_put+0xc4/0x104 +config_item_put+0x24/0x34 +__configfs_open_file+0x35c/0x3b0 +configfs_open_file+0x28/0x34 +do_dentry_open+0x2cc/0x5c0 +vfs_open+0x80/0xe0 +path_openat+0xd8c/0x2988 +do_filp_open+0x1c4/0x2fc +do_sys_open+0x23c/0x404 +SyS_openat+0x38/0x48 +el0_svc_naked+0x34/0x38 + +To fix this issue, remove the config_item_put in +__configfs_open_file to balance the refcount of config_item. + +Fixes: b0841eefd969 ("configfs: provide exclusion between IO and removals") +Signed-off-by: Daiyue Zhang +Signed-off-by: Yi Chen +Signed-off-by: Ge Qiu +Reviewed-by: Chao Yu +Acked-by: Al Viro +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + fs/configfs/file.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/fs/configfs/file.c b/fs/configfs/file.c +index bb0a427517e9..50b7c4c4310e 100644 +--- a/fs/configfs/file.c ++++ b/fs/configfs/file.c +@@ -392,7 +392,7 @@ static int __configfs_open_file(struct inode *inode, struct file *file, int type + + attr = to_attr(dentry); + if (!attr) +- goto out_put_item; ++ goto out_free_buffer; + + if (type & CONFIGFS_ITEM_BIN_ATTR) { + buffer->bin_attr = to_bin_attr(dentry); +@@ -405,7 +405,7 @@ static int __configfs_open_file(struct inode *inode, struct file *file, int type + /* Grab the module reference for this attribute if we have one */ + error = -ENODEV; + if (!try_module_get(buffer->owner)) +- goto out_put_item; ++ goto out_free_buffer; + + error = -EACCES; + if (!buffer->item->ci_type) +@@ -449,8 +449,6 @@ static int __configfs_open_file(struct inode *inode, struct file *file, int type + + out_put_module: + module_put(buffer->owner); +-out_put_item: +- config_item_put(buffer->item); + out_free_buffer: + up_read(&frag->frag_sem); + kfree(buffer); +-- +2.30.1 + diff --git a/queue-4.19/hrtimer-update-softirq_expires_next-correctly-after-.patch b/queue-4.19/hrtimer-update-softirq_expires_next-correctly-after-.patch new file mode 100644 index 00000000000..a68035f33ab --- /dev/null +++ b/queue-4.19/hrtimer-update-softirq_expires_next-correctly-after-.patch @@ -0,0 +1,155 @@ +From d9b81d4c3e9992da840a1198c66231a7a5631276 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 23 Feb 2021 17:02:40 +0100 +Subject: hrtimer: Update softirq_expires_next correctly after + __hrtimer_get_next_event() + +From: Anna-Maria Behnsen + +[ Upstream commit 46eb1701c046cc18c032fa68f3c8ccbf24483ee4 ] + +hrtimer_force_reprogram() and hrtimer_interrupt() invokes +__hrtimer_get_next_event() to find the earliest expiry time of hrtimer +bases. __hrtimer_get_next_event() does not update +cpu_base::[softirq_]_expires_next to preserve reprogramming logic. That +needs to be done at the callsites. + +hrtimer_force_reprogram() updates cpu_base::softirq_expires_next only when +the first expiring timer is a softirq timer and the soft interrupt is not +activated. That's wrong because cpu_base::softirq_expires_next is left +stale when the first expiring timer of all bases is a timer which expires +in hard interrupt context. hrtimer_interrupt() does never update +cpu_base::softirq_expires_next which is wrong too. + +That becomes a problem when clock_settime() sets CLOCK_REALTIME forward and +the first soft expiring timer is in the CLOCK_REALTIME_SOFT base. Setting +CLOCK_REALTIME forward moves the clock MONOTONIC based expiry time of that +timer before the stale cpu_base::softirq_expires_next. + +cpu_base::softirq_expires_next is cached to make the check for raising the +soft interrupt fast. In the above case the soft interrupt won't be raised +until clock monotonic reaches the stale cpu_base::softirq_expires_next +value. That's incorrect, but what's worse it that if the softirq timer +becomes the first expiring timer of all clock bases after the hard expiry +timer has been handled the reprogramming of the clockevent from +hrtimer_interrupt() will result in an interrupt storm. That happens because +the reprogramming does not use cpu_base::softirq_expires_next, it uses +__hrtimer_get_next_event() which returns the actual expiry time. Once clock +MONOTONIC reaches cpu_base::softirq_expires_next the soft interrupt is +raised and the storm subsides. + +Change the logic in hrtimer_force_reprogram() to evaluate the soft and hard +bases seperately, update softirq_expires_next and handle the case when a +soft expiring timer is the first of all bases by comparing the expiry times +and updating the required cpu base fields. Split this functionality into a +separate function to be able to use it in hrtimer_interrupt() as well +without copy paste. + +Fixes: 5da70160462e ("hrtimer: Implement support for softirq based hrtimers") +Reported-by: Mikael Beckius +Suggested-by: Thomas Gleixner +Tested-by: Mikael Beckius +Signed-off-by: Anna-Maria Behnsen +Signed-off-by: Thomas Gleixner +Signed-off-by: Ingo Molnar +Link: https://lore.kernel.org/r/20210223160240.27518-1-anna-maria@linutronix.de +Signed-off-by: Sasha Levin +--- + kernel/time/hrtimer.c | 60 ++++++++++++++++++++++++++++--------------- + 1 file changed, 39 insertions(+), 21 deletions(-) + +diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c +index 7362554416fd..ccde4dc8462c 100644 +--- a/kernel/time/hrtimer.c ++++ b/kernel/time/hrtimer.c +@@ -536,8 +536,11 @@ static ktime_t __hrtimer_next_event_base(struct hrtimer_cpu_base *cpu_base, + } + + /* +- * Recomputes cpu_base::*next_timer and returns the earliest expires_next but +- * does not set cpu_base::*expires_next, that is done by hrtimer_reprogram. ++ * Recomputes cpu_base::*next_timer and returns the earliest expires_next ++ * but does not set cpu_base::*expires_next, that is done by ++ * hrtimer[_force]_reprogram and hrtimer_interrupt only. When updating ++ * cpu_base::*expires_next right away, reprogramming logic would no longer ++ * work. + * + * When a softirq is pending, we can ignore the HRTIMER_ACTIVE_SOFT bases, + * those timers will get run whenever the softirq gets handled, at the end of +@@ -578,6 +581,37 @@ __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base, unsigned int active_ + return expires_next; + } + ++static ktime_t hrtimer_update_next_event(struct hrtimer_cpu_base *cpu_base) ++{ ++ ktime_t expires_next, soft = KTIME_MAX; ++ ++ /* ++ * If the soft interrupt has already been activated, ignore the ++ * soft bases. They will be handled in the already raised soft ++ * interrupt. ++ */ ++ if (!cpu_base->softirq_activated) { ++ soft = __hrtimer_get_next_event(cpu_base, HRTIMER_ACTIVE_SOFT); ++ /* ++ * Update the soft expiry time. clock_settime() might have ++ * affected it. ++ */ ++ cpu_base->softirq_expires_next = soft; ++ } ++ ++ expires_next = __hrtimer_get_next_event(cpu_base, HRTIMER_ACTIVE_HARD); ++ /* ++ * If a softirq timer is expiring first, update cpu_base->next_timer ++ * and program the hardware with the soft expiry time. ++ */ ++ if (expires_next > soft) { ++ cpu_base->next_timer = cpu_base->softirq_next_timer; ++ expires_next = soft; ++ } ++ ++ return expires_next; ++} ++ + static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base) + { + ktime_t *offs_real = &base->clock_base[HRTIMER_BASE_REALTIME].offset; +@@ -618,23 +652,7 @@ hrtimer_force_reprogram(struct hrtimer_cpu_base *cpu_base, int skip_equal) + { + ktime_t expires_next; + +- /* +- * Find the current next expiration time. +- */ +- expires_next = __hrtimer_get_next_event(cpu_base, HRTIMER_ACTIVE_ALL); +- +- if (cpu_base->next_timer && cpu_base->next_timer->is_soft) { +- /* +- * When the softirq is activated, hrtimer has to be +- * programmed with the first hard hrtimer because soft +- * timer interrupt could occur too late. +- */ +- if (cpu_base->softirq_activated) +- expires_next = __hrtimer_get_next_event(cpu_base, +- HRTIMER_ACTIVE_HARD); +- else +- cpu_base->softirq_expires_next = expires_next; +- } ++ expires_next = hrtimer_update_next_event(cpu_base); + + if (skip_equal && expires_next == cpu_base->expires_next) + return; +@@ -1520,8 +1538,8 @@ void hrtimer_interrupt(struct clock_event_device *dev) + + __hrtimer_run_queues(cpu_base, now, flags, HRTIMER_ACTIVE_HARD); + +- /* Reevaluate the clock bases for the next expiry */ +- expires_next = __hrtimer_get_next_event(cpu_base, HRTIMER_ACTIVE_ALL); ++ /* Reevaluate the clock bases for the [soft] next expiry */ ++ expires_next = hrtimer_update_next_event(cpu_base); + /* + * Store the new expiry value so the migration code can verify + * against it. +-- +2.30.1 + diff --git a/queue-4.19/include-linux-sched-mm.h-use-rcu_dereference-in-in_v.patch b/queue-4.19/include-linux-sched-mm.h-use-rcu_dereference-in-in_v.patch new file mode 100644 index 00000000000..603c88a64bb --- /dev/null +++ b/queue-4.19/include-linux-sched-mm.h-use-rcu_dereference-in-in_v.patch @@ -0,0 +1,43 @@ +From 153745698839687858c7eab1e8b2fdb0f5eafadc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 Mar 2021 21:08:03 -0800 +Subject: include/linux/sched/mm.h: use rcu_dereference in in_vfork() + +From: Matthew Wilcox (Oracle) + +[ Upstream commit 149fc787353f65b7e72e05e7b75d34863266c3e2 ] + +Fix a sparse warning by using rcu_dereference(). Technically this is a +bug and a sufficiently aggressive compiler could reload the `real_parent' +pointer outside the protection of the rcu lock (and access freed memory), +but I think it's pretty unlikely to happen. + +Link: https://lkml.kernel.org/r/20210221194207.1351703-1-willy@infradead.org +Fixes: b18dc5f291c0 ("mm, oom: skip vforked tasks from being selected") +Signed-off-by: Matthew Wilcox (Oracle) +Reviewed-by: Miaohe Lin +Acked-by: Michal Hocko +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + include/linux/sched/mm.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h +index 8d3b7e731b74..ef54f4b3f1e4 100644 +--- a/include/linux/sched/mm.h ++++ b/include/linux/sched/mm.h +@@ -167,7 +167,8 @@ static inline bool in_vfork(struct task_struct *tsk) + * another oom-unkillable task does this it should blame itself. + */ + rcu_read_lock(); +- ret = tsk->vfork_done && tsk->real_parent->mm == tsk->mm; ++ ret = tsk->vfork_done && ++ rcu_dereference(tsk->real_parent)->mm == tsk->mm; + rcu_read_unlock(); + + return ret; +-- +2.30.1 + diff --git a/queue-4.19/nfsv4.2-fix-return-value-of-_nfs4_get_security_label.patch b/queue-4.19/nfsv4.2-fix-return-value-of-_nfs4_get_security_label.patch new file mode 100644 index 00000000000..365993da82d --- /dev/null +++ b/queue-4.19/nfsv4.2-fix-return-value-of-_nfs4_get_security_label.patch @@ -0,0 +1,43 @@ +From 32a676152a03a1b72b02ea8d0633905e223d85d4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Jan 2021 18:43:56 +0100 +Subject: NFSv4.2: fix return value of _nfs4_get_security_label() + +From: Ondrej Mosnacek + +[ Upstream commit 53cb245454df5b13d7063162afd7a785aed6ebf2 ] + +An xattr 'get' handler is expected to return the length of the value on +success, yet _nfs4_get_security_label() (and consequently also +nfs4_xattr_get_nfs4_label(), which is used as an xattr handler) returns +just 0 on success. + +Fix this by returning label.len instead, which contains the length of +the result. + +Fixes: aa9c2669626c ("NFS: Client implementation of Labeled-NFS") +Signed-off-by: Ondrej Mosnacek +Reviewed-by: James Morris +Reviewed-by: Paul Moore +Signed-off-by: Anna Schumaker +Signed-off-by: Sasha Levin +--- + fs/nfs/nfs4proc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c +index d89a815f7c31..d63b248582d1 100644 +--- a/fs/nfs/nfs4proc.c ++++ b/fs/nfs/nfs4proc.c +@@ -5611,7 +5611,7 @@ static int _nfs4_get_security_label(struct inode *inode, void *buf, + return ret; + if (!(fattr.valid & NFS_ATTR_FATTR_V4_SECURITY_LABEL)) + return -ENOENT; +- return 0; ++ return label.len; + } + + static int nfs4_get_security_label(struct inode *inode, void *buf, +-- +2.30.1 + diff --git a/queue-4.19/prctl-fix-pr_set_mm_auxv-kernel-stack-leak.patch b/queue-4.19/prctl-fix-pr_set_mm_auxv-kernel-stack-leak.patch new file mode 100644 index 00000000000..c673dc3aed0 --- /dev/null +++ b/queue-4.19/prctl-fix-pr_set_mm_auxv-kernel-stack-leak.patch @@ -0,0 +1,45 @@ +From a1fd7d2e22b7f94b9bc2e83180d2880a0974b89a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 14 Mar 2021 23:51:14 +0300 +Subject: prctl: fix PR_SET_MM_AUXV kernel stack leak + +From: Alexey Dobriyan + +[ Upstream commit c995f12ad8842dbf5cfed113fb52cdd083f5afd1 ] + +Doing a + + prctl(PR_SET_MM, PR_SET_MM_AUXV, addr, 1); + +will copy 1 byte from userspace to (quite big) on-stack array +and then stash everything to mm->saved_auxv. +AT_NULL terminator will be inserted at the very end. + +/proc/*/auxv handler will find that AT_NULL terminator +and copy original stack contents to userspace. + +This devious scheme requires CAP_SYS_RESOURCE. + +Signed-off-by: Alexey Dobriyan +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + kernel/sys.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/sys.c b/kernel/sys.c +index baf60a3aa34b..81ed6023d01b 100644 +--- a/kernel/sys.c ++++ b/kernel/sys.c +@@ -2069,7 +2069,7 @@ static int prctl_set_auxv(struct mm_struct *mm, unsigned long addr, + * up to the caller to provide sane values here, otherwise userspace + * tools which use this vector might be unhappy. + */ +- unsigned long user_auxv[AT_VECTOR_SIZE]; ++ unsigned long user_auxv[AT_VECTOR_SIZE] = {}; + + if (len > sizeof(user_auxv)) + return -EINVAL; +-- +2.30.1 + diff --git a/queue-4.19/series b/queue-4.19/series index 532f80c6f4c..501040e5dbd 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -129,3 +129,11 @@ staging-comedi-dmm32at-fix-endian-problem-for-ai-command-data.patch staging-comedi-me4000-fix-endian-problem-for-ai-command-data.patch staging-comedi-pcl711-fix-endian-problem-for-ai-command-data.patch staging-comedi-pcl818-fix-endian-problem-for-ai-command-data.patch +sh_eth-fix-trscer-mask-for-r7s72100.patch +nfsv4.2-fix-return-value-of-_nfs4_get_security_label.patch +block-rsxx-fix-error-return-code-of-rsxx_pci_probe.patch +configfs-fix-a-use-after-free-in-__configfs_open_fil.patch +hrtimer-update-softirq_expires_next-correctly-after-.patch +stop_machine-mark-helpers-__always_inline.patch +include-linux-sched-mm.h-use-rcu_dereference-in-in_v.patch +prctl-fix-pr_set_mm_auxv-kernel-stack-leak.patch diff --git a/queue-4.19/sh_eth-fix-trscer-mask-for-r7s72100.patch b/queue-4.19/sh_eth-fix-trscer-mask-for-r7s72100.patch new file mode 100644 index 00000000000..bb8c7b3ac10 --- /dev/null +++ b/queue-4.19/sh_eth-fix-trscer-mask-for-r7s72100.patch @@ -0,0 +1,38 @@ +From e74c1d6dfe4a83c7b546b0526aeb0dacb6c0674b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 28 Feb 2021 23:26:34 +0300 +Subject: sh_eth: fix TRSCER mask for R7S72100 + +From: Sergey Shtylyov + +[ Upstream commit 75be7fb7f978202c4c3a1a713af4485afb2ff5f6 ] + +According to the RZ/A1H Group, RZ/A1M Group User's Manual: Hardware, +Rev. 4.00, the TRSCER register has bit 9 reserved, hence we can't use +the driver's default TRSCER mask. Add the explicit initializer for +sh_eth_cpu_data::trscer_err_mask for R7S72100. + +Fixes: db893473d313 ("sh_eth: Add support for r7s72100") +Signed-off-by: Sergey Shtylyov +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/renesas/sh_eth.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c +index bc38f0aa4b31..24638cb157ca 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -610,6 +610,8 @@ static struct sh_eth_cpu_data r7s72100_data = { + EESR_TDE, + .fdr_value = 0x0000070f, + ++ .trscer_err_mask = DESC_I_RINT8 | DESC_I_RINT5, ++ + .no_psr = 1, + .apr = 1, + .mpr = 1, +-- +2.30.1 + diff --git a/queue-4.19/stop_machine-mark-helpers-__always_inline.patch b/queue-4.19/stop_machine-mark-helpers-__always_inline.patch new file mode 100644 index 00000000000..ccc4ce9b78b --- /dev/null +++ b/queue-4.19/stop_machine-mark-helpers-__always_inline.patch @@ -0,0 +1,83 @@ +From 1b0d8a2e58312f37d15fd0e521da89eec7d89eb4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 Mar 2021 21:07:04 -0800 +Subject: stop_machine: mark helpers __always_inline + +From: Arnd Bergmann + +[ Upstream commit cbf78d85079cee662c45749ef4f744d41be85d48 ] + +With clang-13, some functions only get partially inlined, with a +specialized version referring to a global variable. This triggers a +harmless build-time check for the intel-rng driver: + +WARNING: modpost: drivers/char/hw_random/intel-rng.o(.text+0xe): Section mismatch in reference from the function stop_machine() to the function .init.text:intel_rng_hw_init() +The function stop_machine() references +the function __init intel_rng_hw_init(). +This is often because stop_machine lacks a __init +annotation or the annotation of intel_rng_hw_init is wrong. + +In this instance, an easy workaround is to force the stop_machine() +function to be inline, along with related interfaces that did not show the +same behavior at the moment, but theoretically could. + +The combination of the two patches listed below triggers the behavior in +clang-13, but individually these commits are correct. + +Link: https://lkml.kernel.org/r/20210225130153.1956990-1-arnd@kernel.org +Fixes: fe5595c07400 ("stop_machine: Provide stop_machine_cpuslocked()") +Fixes: ee527cd3a20c ("Use stop_machine_run in the Intel RNG driver") +Signed-off-by: Arnd Bergmann +Cc: Nathan Chancellor +Cc: Nick Desaulniers +Cc: Thomas Gleixner +Cc: Sebastian Andrzej Siewior +Cc: "Paul E. McKenney" +Cc: Ingo Molnar +Cc: Prarit Bhargava +Cc: Daniel Bristot de Oliveira +Cc: Peter Zijlstra +Cc: Valentin Schneider +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + include/linux/stop_machine.h | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h +index 6d3635c86dbe..ccdaa8fd5657 100644 +--- a/include/linux/stop_machine.h ++++ b/include/linux/stop_machine.h +@@ -138,7 +138,7 @@ int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, + const struct cpumask *cpus); + #else /* CONFIG_SMP || CONFIG_HOTPLUG_CPU */ + +-static inline int stop_machine_cpuslocked(cpu_stop_fn_t fn, void *data, ++static __always_inline int stop_machine_cpuslocked(cpu_stop_fn_t fn, void *data, + const struct cpumask *cpus) + { + unsigned long flags; +@@ -149,14 +149,15 @@ static inline int stop_machine_cpuslocked(cpu_stop_fn_t fn, void *data, + return ret; + } + +-static inline int stop_machine(cpu_stop_fn_t fn, void *data, +- const struct cpumask *cpus) ++static __always_inline int ++stop_machine(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus) + { + return stop_machine_cpuslocked(fn, data, cpus); + } + +-static inline int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, +- const struct cpumask *cpus) ++static __always_inline int ++stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, ++ const struct cpumask *cpus) + { + return stop_machine(fn, data, cpus); + } +-- +2.30.1 +