Re: [PATCH RESEND] x86/fpu: Use vmemdup_user() in xstateregs_set()
From: Ingo Molnar
Date: Sun Aug 02 2026 - 09:21:19 EST
* Thorsten Blum <thorsten.blum@xxxxxxxxx> wrote:
> > Replace the open-coded vmalloc() and copy_from_user() with
> > vmemdup_user() to simplify xstateregs_set().
> >
> > vmemdup_user() returns an ERR_PTR() on failure, preserving the existing
> > -ENOMEM and -EFAULT error codes. Since vmemdup_user() is backed by
> > kvmalloc(), use kvfree() to free the buffer instead.
> >
> > Return early on error and drop the obsolete out label.
> I've resent this cleanup a few times and haven't received feedback. Is
> this still something you would consider, or would you prefer that I drop
> it? It's intended to be a mechanical cleanup with no functional changes.
>
> Happy to rerun the relevant x86 XSAVE selftests if it helps.
So the changelog is silent on any potential side-effects of this change.
vmalloc will return page-aligned addresses. kmalloc won't. Will this
have any effects on performance?
Are there other examples of vmalloc() -> kvmalloc() conversions in
the tree, is it a recommended and well-tested technique to simplify
the code?
A very quick git log investigation does not seem to be showing
any such recent conversion examples:
starship:~/tip> git log -E --grep='kvmalloc' --since=one-year-ago | grep -w vmalloc
I'm not opposed to it in principle, I just think the 'analysis'
side of the patch description is basically non-existent.
Thanks,
Ingo