Linux io-uring development
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Marius Fleischer <fleischermarius@gmail.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	linux-kernel@vger.kernel.org
Cc: syzkaller@googlegroups.com, harrisonmichaelgreen@gmail.com,
	Jens Axboe <axboe@kernel.dk>,
	Pavel Begunkov <asml.silence@gmail.com>,
	io-uring@vger.kernel.org
Subject: Re: WARNING in get_pat_info
Date: Tue, 15 Oct 2024 13:04:19 -0700	[thread overview]
Message-ID: <f02a96a2-9f3a-4bed-90a5-b3309eb91d94@intel.com> (raw)
In-Reply-To: <CAJg=8jxg=hCxTeNMmtUTKeBhP=4ryoAb0ekoP05FOLjmDN5G0g@mail.gmail.com>

On 10/15/24 11:55, Marius Fleischer wrote:
> Hope you are doing well!
> 
> Quick update from our side: The reproducer from the previous email
> still triggers a WARNING on v5.15 (commit hash
> 3a5928702e7120f83f703fd566082bfb59f1a57e). Happy to also test on
> other kernel versions if that helps.
> 
> Please let us know if there is any other helpful information we can provide.

I don't know for sure, but I suspect that io_uring is triggering this.
The reproducer is:

	syz_io_uring_setup(0x6f7e, &(0x7f0000000080), 0x0, 0x0)
	syz_clone(0x24080, 0x0, 0x0, 0x0, 0x0, 0x0) (fail_nth: 40)

and the stack trace shows:

 untrack_pfn+0xdc/0x240 arch/x86/mm/pat/memtype.c:1122
 ...
 __mmput+0x122/0x4b0 kernel/fork.c:1126
 ...
 __do_sys_clone+0xc8/0x110 kernel/fork.c:2721

So whatever is happening is going on with a VM_PFNMAP VMA.  Those aren't
super common except when you're mmap()'ing something from a device
driver.  I would randomly guess that io_uring_setup() is setting up a
VM_PFNMAP VMA and untrack_pfn() is getting called when that VMA is
getting torn down.

The other goofiness is that the copy_mm() path is ending up in
exit_mmap().  I think the only way to end up doing that is in the
failure path of dup_mm().

So I *think* what happens is that a io_uring VMA gets created in
dup_mmap(), but never gets any pages faulted in.  Some later setup fails
and the new mm needs to be torn down.  *Something* about the io_uring
VMA screws up the untrack_pfn() code.

I'm hoping that this rings a bell with the io_uring folks and this is a
bug they've found and fixed in mainline that just got missed backporting
to stable.

       reply	other threads:[~2024-10-15 20:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAJg=8jwijTP5fre8woS4JVJQ8iUA6v+iNcsOgtj9Zfpc3obDOQ@mail.gmail.com>
     [not found] ` <CAJg=8jxg=hCxTeNMmtUTKeBhP=4ryoAb0ekoP05FOLjmDN5G0g@mail.gmail.com>
2024-10-15 20:04   ` Dave Hansen [this message]
2024-10-15 21:56     ` WARNING in get_pat_info Jens Axboe
2024-10-15 22:29       ` Marius Fleischer
2024-10-15 23:40         ` Dave Hansen
2024-10-17  3:39           ` Marius Fleischer
2024-12-13 17:35 chase xd
2024-12-13 17:40 ` Jens Axboe
2024-12-13 17:47   ` chase xd
2024-12-13 17:49     ` Jens Axboe
2024-12-13 17:55       ` chase xd
2024-12-13 17:57         ` Jens Axboe

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=f02a96a2-9f3a-4bed-90a5-b3309eb91d94@intel.com \
    --to=dave.hansen@intel.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=fleischermarius@gmail.com \
    --cc=harrisonmichaelgreen@gmail.com \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=syzkaller@googlegroups.com \
    --cc=tglx@linutronix.de \
    /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