Re: [mm] 408579cd62: WARNING:suspicious_RCU_usage

From: Oliver Sang
Date: Mon Jul 03 2023 - 21:48:00 EST


hi, Linus,

On Sun, Jul 02, 2023 at 09:34:35PM -0700, Linus Torvalds wrote:
> On Sun, 2 Jul 2023 at 19:04, kernel test robot <oliver.sang@xxxxxxxxx> wrote:
> >
> > commit: 408579cd627a15bd703fe3eeb8485fd02726e9d3 ("mm: Update do_vmi_align_munmap() return semantics")
> > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
> >
> > in testcase: boot
> >
> > on test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G
> >
> > caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):
> >
> >
> >
> > If you fix the issue, kindly add following tag
> > Reported-by: kernel test robot <oliver.sang@xxxxxxxxx>
> >
> >
> > [ 215.088258][ T1] WARNING: suspicious RCU usage
>
> I think the
>
> validate_mm(mm);
>
> call (mm/mmap.c:2561) needs to be moved up to before the
>
> if (unlock)
> mmap_read_unlock(mm);
>
> that is just a couple of lines earlier.
>
> Can you verify that that fixes the warning?

by patch [1], we found the warning is not fixed.


we also found there are some changes in stack backtrace. now it's as below:
(detail dmesg is attached)

[ 26.412372][ T1] stack backtrace:
[ 26.412846][ T1] CPU: 0 PID: 1 Comm: systemd Not tainted 6.4.0-09908-gcb226fb1fb7a #1
[ 26.413506][ T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[ 26.414326][ T1] Call Trace:
[ 26.414605][ T1] <TASK>
[ 26.414847][ T1] dump_stack_lvl+0x73/0xc0
[ 26.415225][ T1] lockdep_rcu_suspicious+0x1b7/0x280
[ 26.415669][ T1] mas_start+0x280/0x400
[ 26.416037][ T1] mas_find+0x27a/0x400
[ 26.416391][ T1] validate_mm+0x8b/0x2c0
[ 26.416757][ T1] __se_sys_brk+0xa35/0xc00
[ 26.417141][ T1] ? vtime_user_exit+0x1a6/0x280
[ 26.417563][ T1] do_syscall_64+0x2b/0x80
[ 26.417935][ T1] entry_SYSCALL_64_after_hwframe+0x5e/0xc8
[ 26.418410][ T1] RIP: 0033:0x7f8a92160bb7

as a contrast, for commit 408579cd62:

[ 215.095989][ T1] stack backtrace:
[ 215.097067][ T1] CPU: 0 PID: 1 Comm: init Not tainted 6.4.0-09907-g408579cd627a #1
[ 215.098372][ T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[ 215.099963][ T1] Call Trace:
[ 215.100474][ T1] <TASK>
[ 215.101027][ T1] dump_stack_lvl+0x73/0xc0
[ 215.101807][ T1] lockdep_rcu_suspicious+0x1b7/0x280
[ 215.102688][ T1] mas_start+0x280/0x400
[ 215.103355][ T1] mas_find+0x27a/0x400
[ 215.104024][ T1] validate_mm+0x8b/0x2c0
[ 215.104777][ T1] do_vmi_align_munmap+0xf92/0x1180
[ 215.105691][ T1] do_vmi_munmap+0x1a4/0x240
[ 215.106384][ T1] __vm_munmap+0x19f/0x300
[ 215.107145][ T1] __x64_sys_munmap+0x60/0x80
[ 215.107962][ T1] do_syscall_64+0x2b/0x80
[ 215.108784][ T1] entry_SYSCALL_64_after_hwframe+0x5e/0xc8
[ 215.109733][ T1] RIP: 0033:0x7f5ef4577e07



[1]
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2554,11 +2554,12 @@ do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma,
mas_set(&mas_detach, start);
remove_mt(mm, &mas_detach);
__mt_destroy(&mt_detach);
+
+ validate_mm(mm);
+
if (unlock)
mmap_read_unlock(mm);

-
- validate_mm(mm);
return 0;

clear_tree_failed:


>
> Linus

Attachment: dmesg.xz
Description: application/xz