From: "Chang S. Bae" <chang.seok.bae@intel.com>
To: Guixiong Wei <weiguixiong@bytedance.com>, <x86@kernel.org>
Cc: <stable@vger.kernel.org>
Subject: Re: [PATCH v4 1/2] x86/fpu: Fix memory leak with dynamic fpstate and exec()
Date: Wed, 18 Nov 2026 12:16:40 -0800 [thread overview]
Message-ID: <f913184a-0386-417e-84a2-7bdc72629eee@intel.com> (raw)
In-Reply-To: <728ed963f43b44c97f4807a2060f77c0b362521e.1793604327.git.weiguixiong@bytedance.com>
On 11/2/2026 2:10 AM, Guixiong Wei wrote:
> Using an XFD-controlled xfeature can allocate a larger fpstate. On
> exec(), fpstate_reset() replaces fpu->fpstate with the embedded buffer
> without freeing the dynamic allocation. Once the pointer is overwritten,
> the allocation cannot be freed on task exit.
>
> Free dynamic state at the start of fpstate_reset(). In fpu_clone(),
> clear the new task's fpstate pointer before resetting its state, so the
> parent's allocation is not freed.
>
> fpstate_reset() may now free the current task's buffer. fpu_flush_thread()
> calls it before fpu_reset_fpstate_regs() sets TIF_NEED_FPU_LOAD. If a
> context switch or a kernel FPU user happens in that window, the register
> state still looks live and gets saved into the freed buffer. Set
> TIF_NEED_FPU_LOAD before the reset so that nothing saves the hardware
> state until it is reloaded from the reset in-memory state.
Nit: this paragraph reads wordy, could be trimmed a bit.
>
> Fixes: 500afbf645a0 ("x86/fpu/xstate: Add fpstate_realloc()/free()")
> Suggested-by: Chang S. Bae <chang.seok.bae@intel.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Guixiong Wei <weiguixiong@bytedance.com>
Looks like here you missed maintainers the whole and oh, even LKML...
Please include them all.
Other than that,
Reviewed-by: Chang S. Bae <chang.seok.bae@intel.com>
next prev parent reply other threads:[~2026-11-18 20:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 10:08 [PATCH v4 0/2] x86/fpu: Fix dynamic fpstate leak on exec() Guixiong Wei
2026-11-02 10:10 ` [PATCH v4 1/2] x86/fpu: Fix memory leak with dynamic fpstate and exec() Guixiong Wei
2026-11-02 10:32 ` Guixiong Wei
2026-11-18 20:16 ` Chang S. Bae [this message]
2026-11-21 22:11 ` Chang S. Bae
2026-11-02 10:30 ` [PATCH v4 2/2] selftests/x86/amx: Test dynamic fpstate cleanup across exec() Guixiong Wei
2026-11-06 16:40 ` Chang S. Bae
2026-11-08 13:19 ` Guixiong Wei
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=f913184a-0386-417e-84a2-7bdc72629eee@intel.com \
--to=chang.seok.bae@intel.com \
--cc=stable@vger.kernel.org \
--cc=weiguixiong@bytedance.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.