linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: syzbot <syzbot+83e7f982ca045ab4405c@syzkaller.appspotmail.com>,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	andrii@kernel.org, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [bpf?] [trace?] possible deadlock in force_sig_info_to_task
Date: Mon, 29 Apr 2024 07:23:02 +0800	[thread overview]
Message-ID: <20240428232302.4035-1-hdanton@sina.com> (raw)
In-Reply-To: <CAHk-=wjBvNvVggy14p9rkHA8W1ZVfoKXvW0oeX5NZWxWUv8gfQ@mail.gmail.com>

On Sun, 28 Apr 2024 13:01:19 -0700 Linus Torvalds wrote:
> On Sat, 27 Apr 2024 at 16:13, Hillf Danton <hdanton@sina.com> wrote:
> >
> > > -> #0 (&sighand->siglock){....}-{2:2}:
> > >        check_prev_add kernel/locking/lockdep.c:3134 [inline]
> > >        check_prevs_add kernel/locking/lockdep.c:3253 [inline]
> > >        validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
> > >        __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
> > >        lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
> > >        __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
> > >        _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162
> > >        force_sig_info_to_task+0x68/0x580 kernel/signal.c:1334
> > >        force_sig_fault_to_task kernel/signal.c:1733 [inline]
> > >        force_sig_fault+0x12c/0x1d0 kernel/signal.c:1738
> > >        __bad_area_nosemaphore+0x127/0x780 arch/x86/mm/fault.c:814
> > >        handle_page_fault arch/x86/mm/fault.c:1505 [inline]
> >
> > Given page fault with runqueue locked, bpf makes trouble instead of
> > helping anything in this case.
> 
> That's not the odd thing here.
> 
> Look, the callchain is:
> 
> > >        exc_page_fault+0x612/0x8e0 arch/x86/mm/fault.c:1563
> > >        asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623
> > >        rep_movs_alternative+0x22/0x70 arch/x86/lib/copy_user_64.S:48
> > >        copy_user_generic arch/x86/include/asm/uaccess_64.h:110 [inline]
> > >        raw_copy_from_user arch/x86/include/asm/uaccess_64.h:125 [inline]
> > >        __copy_from_user_inatomic include/linux/uaccess.h:87 [inline]
> > >        copy_from_user_nofault+0xbc/0x150 mm/maccess.c:125
> 
> IOW, this is all doing a copy from user with page faults disabled, and
> it shouldn't have caused a signal to be sent, so the whole
> __bad_area_nosemaphore -> force_sig_fault path is bad.
> 
So is game like copying from/putting to user with runqueue locked
at the first place.

Plus as per another syzbot report [1], bpf could make trouble with
workqueue pool locked.

[1] https://lore.kernel.org/lkml/00000000000051348606171f61a1@google.com/

  parent reply	other threads:[~2024-04-28 23:23 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-25  9:05 [syzbot] [bpf?] [trace?] possible deadlock in force_sig_info_to_task syzbot
2024-04-25 17:54 ` Jiri Olsa
2024-04-27 20:00 ` syzbot
2024-04-27 23:13   ` Hillf Danton
2024-04-28 20:01     ` Linus Torvalds
2024-04-28 20:22       ` Linus Torvalds
2024-04-28 23:23       ` Hillf Danton [this message]
2024-04-29  0:50         ` Linus Torvalds
2024-04-29  1:00           ` Tetsuo Handa
2024-04-29  1:33           ` Linus Torvalds
2024-04-29  8:00             ` [PATCH] x86/mm: Remove broken vsyscall emulation code from the page fault code Ingo Molnar
2024-04-29 13:51               ` Jiri Olsa
2024-04-29 23:30                 ` Andy Lutomirski
2024-04-29 15:51               ` Linus Torvalds
2024-04-29 18:47                 ` Linus Torvalds
2024-04-29 19:07                   ` Linus Torvalds
2024-04-29 23:29                     ` Andy Lutomirski
2024-04-30  0:05                       ` Linus Torvalds
2024-04-30  6:10                     ` Ingo Molnar
2024-05-01  7:43                       ` Ingo Molnar
2024-04-30 14:53               ` kernel test robot
2024-04-29 10:39             ` [syzbot] [bpf?] [trace?] possible deadlock in force_sig_info_to_task Hillf Danton
2024-04-29 11:35               ` syzbot
2024-04-30  6:16             ` [tip: x86/urgent] x86/mm: Remove broken vsyscall emulation code from the page fault code tip-bot2 for Linus Torvalds
2024-05-01  7:50             ` tip-bot2 for Linus Torvalds
2024-04-29 14:17           ` [syzbot] [bpf?] [trace?] possible deadlock in force_sig_info_to_task Tetsuo Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240428232302.4035-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=syzbot+83e7f982ca045ab4405c@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).