From: Thomas Gleixner <tglx@linutronix.de>
To: Jann Horn <jannh@google.com>, Rik van Riel <riel@surriel.com>,
yury.norov@gmail.com
Cc: syzbot <syzbot+084b6e5bc1016723a9c4@syzkaller.appspotmail.com>,
bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com,
linux-kernel@vger.kernel.org, luto@kernel.org, mingo@redhat.com,
neeraj.upadhyay@kernel.org, paulmck@kernel.org,
peterz@infradead.org, syzkaller-bugs@googlegroups.com,
x86@kernel.org, kernel-team <kernel-team@meta.com>,
David Hildenbrand <david@redhat.com>
Subject: Re: [syzbot] [kernel?] KASAN: slab-use-after-free Write in flush_tlb_func
Date: Wed, 02 Jul 2025 19:12:31 +0200 [thread overview]
Message-ID: <874ivuldog.ffs@tglx> (raw)
In-Reply-To: <CAG48ez1VMw=aE88eTfk9BscrmS7axJG=j_TrTui+htLF9-4Wqw@mail.gmail.com>
On Wed, Jul 02 2025 at 19:00, Jann Horn wrote:
> On Wed, Jul 2, 2025 at 6:53 PM Jann Horn <jannh@google.com> wrote:
>> TLB flushes via IPIs on x86 are always synchronous, right?
>> flush_tlb_func is only referenced from native_flush_tlb_multi() in
>> calls to on_each_cpu_mask() (with wait=true) or
>> on_each_cpu_cond_mask() (with wait=1).
>> So I think this is not an issue, unless you're claiming that we call
>> native_flush_tlb_multi() with an already-freed info->mm?
>>
>> And I think the bisected commit really is the buggy one: It looks at
>> "nr_cpus", which tracks *how many CPUs we have to IPI*, but assumes
>> that "nr_cpus" tracks *how many CPUs we posted work to*. Those numbers
>> are not the same: If we post work to a CPU that already had IPI work
>> pending, we just add a list entry without sending another IPI.
>
> Or in other words: After that blamed commit, if CPU 1 posts a TLB
> flush to CPU 3, and then CPU 2 also quickly posts a TLB flush to CPU
> 3, then CPU 2 will erroneously not wait for the TLB flush to complete
> before reporting flush completion, which AFAICS means we can get both
> stale TLB entries and (less often) UAF.
Right you are. Well analyzed and I missed it when taking the lot.
> I think the correct version of that commit would be to revert that
> commit and instead just move the "run_remote = true;" line down, below
> the cond_func() check.
I remove it from the relevant tip branch
Thanks,
tglx
next prev parent reply other threads:[~2025-07-02 17:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-02 13:50 [syzbot] [kernel?] KASAN: slab-use-after-free Write in flush_tlb_func syzbot
2025-07-02 15:20 ` Rik van Riel
2025-07-02 16:53 ` Jann Horn
2025-07-02 17:00 ` Jann Horn
2025-07-02 17:12 ` Thomas Gleixner [this message]
2025-07-02 17:44 ` Yury Norov
2025-07-02 17:59 ` [PATCH] smp: Wait for enqueued work regardless of IPI sent Rik van Riel
2025-07-03 13:52 ` Yury Norov
2025-07-03 16:56 ` Thomas Gleixner
2025-07-04 0:30 ` [PATCH v2] " Rik van Riel
2025-07-06 10:01 ` [tip: smp/core] smp: Wait only if work was enqueued tip-bot2 for Rik van Riel
2025-07-02 17:09 ` [syzbot] [kernel?] KASAN: slab-use-after-free Write in flush_tlb_func Rik van Riel
2025-07-02 17:23 ` Jann Horn
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=874ivuldog.ffs@tglx \
--to=tglx@linutronix.de \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=david@redhat.com \
--cc=hpa@zytor.com \
--cc=jannh@google.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=neeraj.upadhyay@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=riel@surriel.com \
--cc=syzbot+084b6e5bc1016723a9c4@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=x86@kernel.org \
--cc=yury.norov@gmail.com \
/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