[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <138A0E3D-4794-43C7-861A-4011534A09A8@intel.com>
Date: Mon, 29 Mar 2021 18:14:48 +0000
From: "Bae, Chang Seok" <chang.seok.bae@...el.com>
To: Jann Horn <jannh@...gle.com>
CC: Borislav Petkov <bp@...e.de>, Andy Lutomirski <luto@...nel.org>,
"Thomas Gleixner" <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
"the arch/x86 maintainers" <x86@...nel.org>,
"Brown, Len" <len.brown@...el.com>,
"Hansen, Dave" <dave.hansen@...el.com>,
"Liu, Jing2" <jing2.liu@...el.com>,
"Shankar, Ravi V" <ravi.v.shankar@...el.com>,
kernel list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 14/22] x86/fpu/xstate: Expand the xstate buffer on the
first use of dynamic user state
On Mar 26, 2021, at 09:34, Jann Horn <jannh@...gle.com> wrote:
> On Sun, Feb 21, 2021 at 7:56 PM Chang S. Bae <chang.seok.bae@...el.com> wrote:
>>
>> + if (handle_xfirstuse_event(¤t->thread.fpu))
>> + return;
>
> What happens if handle_xfirstuse_event() fails because vmalloc()
> failed in alloc_xstate_buffer()? I think that should probably kill the
> task with something like force_sig() - but as far as I can tell, at
> the moment, it will instead end up at die(), which should only be used
> for kernel bugs.
This question was raised on v1 before [1].
In the end, people suggested to handle the failure, e.g., with tracepoints or
stats. So, proposed this on the allocation site:
+ state_ptr = vmalloc(newsz);
+ if (!state_ptr) {
+ trace_x86_fpu_xstate_alloc_failed(fpu);
+ return -ENOMEM;
+ }
Also, I tried to justify this to Boris [2]:
>> Maybe it is possible to backtrack this allocation failure out of #NM
>> handling. But the tracepoint can provide a clear context, although limited
>> to those using it.
> Yes, add it when it is really needed. Not slapping it proactively and
> hoping for any potential usage.
Let me know if you have a better way.
Thanks,
Chang
[1] https://lore.kernel.org/lkml/c4669d5f-11b8-3879-562c-78a791b86229@intel.com/
[2] https://lore.kernel.org/lkml/20210204131002.GA17068@zn.tnic/
Powered by blists - more mailing lists