public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Dave Hansen <dave.hansen@intel.com>,
	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,
	Pavel Begunkov <asml.silence@gmail.com>,
	io-uring@vger.kernel.org
Subject: Re: WARNING in get_pat_info
Date: Tue, 15 Oct 2024 15:56:29 -0600	[thread overview]
Message-ID: <fc3a0edc-f2fb-488a-81d9-016f78b5671d@kernel.dk> (raw)
In-Reply-To: <f02a96a2-9f3a-4bed-90a5-b3309eb91d94@intel.com>

On 10/15/24 2:04 PM, Dave Hansen wrote:
> 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.

Doesn't ring a bell, and haven't had anyone report that before. The
older io_uring code does indeed use remap_pfn_range(), this is gone in
newer kernels. But in any case, I can't seem to trigger this on
5.15-stable, I might be missing something in my .config...

-- 
Jens Axboe

  reply	other threads:[~2024-10-15 21:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18 20:11 WARNING in get_pat_info Marius Fleischer
2024-10-15 18:55 ` Marius Fleischer
2024-10-15 20:04   ` Dave Hansen
2024-10-15 21:56     ` Jens Axboe [this message]
2024-10-15 22:29       ` Marius Fleischer
2024-10-15 23:40         ` Dave Hansen
2024-10-17  3:39           ` Marius Fleischer
  -- strict thread matches above, loose matches on Subject: below --
2024-08-16  9:44 lee bruce
2024-10-17 19:27 ` David Hildenbrand
2024-10-17 22:25   ` Peter Xu
2024-10-18 10:48     ` David Hildenbrand
2024-10-18 11:20 ` David Hildenbrand
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=fc3a0edc-f2fb-488a-81d9-016f78b5671d@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --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