From: "Chang S. Bae" <chang.seok.bae@intel.com>
To: Guixiong Wei <weiguixiong@bytedance.com>, <x86@kernel.org>
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H . Peter Anvin" <hpa@zytor.com>, <linux-kernel@vger.kernel.org>,
<stable@vger.kernel.org>
Subject: Re: [PATCH] x86/fpu: Free dynamic fpstate on exec()
Date: Tue, 29 Sep 2026 23:50:53 -0700 [thread overview]
Message-ID: <e3cba491-9fdb-4907-9843-c427c96c3237@intel.com> (raw)
In-Reply-To: <20260929151013.81562-2-weiguixiong@bytedance.com>
On 9/29/2026 8:10 AM, Guixiong Wei wrote:
> The fpstate embedded in struct fpu only accommodates the default
> xfeatures. When a task first uses a dynamically enabled xfeature,
> fpstate_realloc() installs a larger fpstate allocated with vzalloc().
>
> fpu_flush_thread() resets fpu->fpstate to the embedded fpstate on exec()
> without freeing the dynamically allocated one. Once the pointer is
> overwritten, arch_release_task_struct() cannot free the allocation when
> the task exits.
Thanks for the finding and fixing this. I see Dave has given good
suggestions. I think you can follow those into a revision.
...
> On an AMX-capable system, 1000 iterations of requesting XTILEDATA
> permission, executing TILEZERO and calling execve() on the same image
> left 1000 16 KiB allocations attributed to __xfd_enable_feature() in
> /proc/vmallocinfo. None remained after this change.
I would be interested in turning this into a selftest if possible. It
would be great if you could.
Otherwise, I wrote a case (using XRSTOR instead) and then saw that
amount from fpstate_relloac() in vmallocinfo:
Caller/Module Difference
---------------------------------------------------
fpstate_realloc.constprop.0 (pages=3) +16384000
...
BTW, just curious if it happens with real-world applications. The
permission is revoked on exec(), that is a very edge of the TMUL use if
so. Is it a case running another application right after matrix
multiplications?
Thanks,
Chang
next prev parent reply other threads:[~2026-09-30 6:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 15:10 Guixiong Wei
2026-09-29 15:57 ` Dave Hansen
2026-09-29 16:53 ` Dave Hansen
2026-09-30 8:58 ` 魏桂雄
2026-09-30 6:50 ` Chang S. Bae [this message]
2026-09-30 9:44 ` 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=e3cba491-9fdb-4907-9843-c427c96c3237@intel.com \
--to=chang.seok.bae@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tglx@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 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®