mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Chang S. Bae" <chang.seok.bae@intel.com>
To: Dave Hansen <dave.hansen@intel.com>,
	Marco Elver <elver@google.com>,
	syzbot <syzbot+b07ec23d35be305855be@syzkaller.appspotmail.com>
Cc: <arnd@arndb.de>, <binbin.wu@linux.intel.com>, <bp@alien8.de>,
	<chao.gao@intel.com>, <dapeng1.mi@linux.intel.com>,
	<dave.hansen@linux.intel.com>, <ebiggers@kernel.org>,
	<hpa@zytor.com>, <linux-kernel@vger.kernel.org>,
	<mingo@redhat.com>, <seanjc@google.com>,
	<syzkaller-bugs@googlegroups.com>, <tglx@kernel.org>,
	<x86@kernel.org>
Subject: Re: [syzbot] [kernel?] KCSAN: data-race in fpu_flush_thread / skb_copy_bits
Date: Sat, 21 Nov 2026 14:08:40 -0800	[thread overview]
Message-ID: <88456eb3-9c58-47b5-8dee-fc6ad79334e6@intel.com> (raw)
In-Reply-To: <cf3c512d-5b02-46fa-b1d3-a1a10a1f3a8d@intel.com>

On 11/19/2026 1:11 PM, Dave Hansen wrote:
> 
> Chang, any chance you'd want to dig in and make sure this is a real issue?

Commit c20942ce5128 ("x86/fpu/core: Convert to fpstate") had the update:
  /*
- * Use fpregs_lock() while editing CPU's FPU registers or fpu->state.
+ * Use fpregs_lock() while editing CPU's FPU registers or fpu->fpstate.
   * A context switch will (and softirq might) save CPU's FPU register to
- * fpu->state and set TIF_NEED_FPU_LOAD leaving CPU's FPU registers in
+ * fpu->fpstate.regs and set TIF_NEED_FPU_LOAD leaving CPU's FPU ...

Previously fpregs_lock() was required whenever either the FPU registers 
or the XSAVE buffer itself being updated. With AMX, fpstate was 
introduced as a container for the XSTATE. fpstate.regs holds the actual 
storage, but size/feature/permission attributes are metadata much like 
the XSAVE header.

Thus, the comment change makes sense and most likely intentional, so the 
attached change does. Now, commit e61d6310a0f8 ("x86/fpu: Reset 
permission and fpstate on exec()") which looks really ugly and mistep in 
this sense.

Then including fpstate_reset(), fpu_reset_fpstate_regs() could be 
renamed to fpu_reset_fpstate() perhaps, as it now has only one caller 
following the recent cleanup: ab05214025ee ("x86/fpu: Remove 
MATH_EMULATION and related glue code").

The resulting sequence then becomes almost the same to the one in 
fpu_clone(). Given these subtleties, it might be better to combine and 
centralize the reset sequence if possible.

I also think freeing the old vmalloc'ed memory after the lock release 
could be included there. So a bit of surgery seems warranted rather than 
the on-going one:
https://lore.kernel.org/all/cover.1793604327.git.weiguixiong@bytedance.com/

Let me prepare a set of patches if anything else.

Thanks,
Chang

      reply	other threads:[~2026-11-21 22:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 20:26 syzbot
2026-11-19 20:53 ` Marco Elver
2026-11-19 21:11   ` Dave Hansen
2026-11-21 22:08     ` Chang S. Bae [this message]

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=88456eb3-9c58-47b5-8dee-fc6ad79334e6@intel.com \
    --to=chang.seok.bae@intel.com \
    --cc=arnd@arndb.de \
    --cc=binbin.wu@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=chao.gao@intel.com \
    --cc=dapeng1.mi@linux.intel.com \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=ebiggers@kernel.org \
    --cc=elver@google.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=seanjc@google.com \
    --cc=syzbot+b07ec23d35be305855be@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®