On Tue, Feb 11, 2025 at 8:49 AM Kevin Hao <[email protected]> wrote:

> On Tue, Feb 11, 2025 at 02:24:54PM +0800, Wang, Jinfeng (CN) via
> lists.yoctoproject.org wrote:
> > Hi,
> >
> >
> > I found a kernel hang issue when run ltp test cases(/opt/ltp/wrLinux_ltp/
> > wr-runltp -f syscalls -s memfd_create03), the stack is following:
> >
> > CPU: 28 PID: 357890 Comm: memfd_create03 Tainted: G      D
> > 5.10.232-yocto-standard #1
> > Hardware name: Intel Corporation S2600CP/S2600CP, BIOS
> > RMLSDP.86I.R4.26.D674.1304190022 04/19/2013
> > RIP: 0010:fput_many+0x7/0xa0
> > Code: 8b 83 f0 00 00 00 49 89 84 24 f0 00 00 00 5b 4c 89 e0 41 5c 5d c3
> cc cc
> > cc cc 66 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 89 f6 <f0> 48 29 77 38
> 75 60 55
> > 48 89 e5 41 54 49 89 fc 65 48 8b 3c 25 00
> > RSP: 0018:ffffbaae0992bd40 EFLAGS: 00010282
> > RAX: 00000000fffffff4 RBX: 0000000000000000 RCX: 000000000504011c
> > RDX: 000000000000076c RSI: 0000000000000001 RDI: 0000000000000000
> > RBP: ffffbaae0992bd48 R08: ffffffffa9b1a8b0 R09: 0000000000000001
> > R10: ffff9efb88475450 R11: ffff9efb88475838 R12: 0000000000000000
> > R13: 00007fb774400000 R14: 0000000000000000 R15: ffff9efc7eead940
> > FS:  00007fb774902740(0000) GS:ffff9f025ec00000(0000)
> knlGS:0000000000000000
> > CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > CR2: 0000000000000038 CR3: 0000000111ea8002 CR4: 00000000001706e0
> > Call Trace:
> >  ? __die_body.cold+0x1a/0x1f
> >  ? __die+0x2b/0x37
> >  ? no_context.constprop.0+0x11e/0x300
> >  ? memory_failure_queue_kick+0x40/0x40
> >  ? __bad_area_nosemaphore+0x45/0x150
> >  ? preempt_count_add+0x54/0xc0
> >  ? bad_area_nosemaphore+0x16/0x20
> >  ? do_user_addr_fault+0x253/0x3f0
> >  ? kmemleak_free+0x35/0x40
> >  ? exc_page_fault+0x56/0x130
> >  ? asm_exc_page_fault+0x1e/0x30
> >  ? fput_many+0x7/0xa0
> >  ? fput+0x13/0x20
> >  vma_do_fput+0x22/0x50
> >  mmap_region+0x651/0x710
> >  do_mmap+0x46a/0x5d0
> >  vm_mmap_pgoff+0xc6/0x100
> >  ksys_mmap_pgoff+0x1e9/0x230
> >  ? fpregs_assert_state_consistent+0x2a/0x50
> >  ? exit_to_user_mode_prepare+0x36/0x130
> >  __x64_sys_mmap+0x33/0x50
> >  do_syscall_64+0x38/0x50
> >  entry_SYSCALL_64_after_hwframe+0x67/0xd1
> >
> >
> > After some debugs, I found cause is the following lines in merge commit
> > a62d8c9cbabb11f1ddf081814589293f439dfabf
> >
> > +unmap_and_free_file_vma:
> > vma->vm_file = NULL;
> > + vma_fput(vma);--this line
> >
> > I tried to change this line to fput(file), there is no hang.
>
> No, we should not change the vma_fput(vma) to fput(vma->vm_file). We can
> fix this
> by setting vma->vm_file to NULL after calling vma_fput(vma). Something
> like the following:
> unmap_and_free_file_vma:
>           vma_fput(vma);
>           vma->vm_file = NULL;
>
>
Agreed, and this is related to aufs.  Newer versions of linux yocto have
hints
on how the similar issue was resolved.

I'm glad that the test caught the issue, we'll get it fixed ASAP!

Bruce



> Thanks,
> Kevin
>
> >
> > But I'm not sure whether it is ok to do this. As there are many other
> vma_fput
> > conflict fix in mmap.c file.  And there is fput also.
> >
> > Could you please help check this?
> >
> >
> > Regards,
> >
> > Jinfeng
> >
>
> >
> > 
> >
>
>

-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#14770): 
https://lists.yoctoproject.org/g/linux-yocto/message/14770
Mute This Topic: https://lists.yoctoproject.org/mt/111118196/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to