mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* arch_set_user_pkey_access only works on the current task_struct
@ 2021-06-05 13:10 Jiashuo Liang
  2021-06-07 17:52 ` Dave Hansen
  0 siblings, 1 reply; 5+ messages in thread
From: Jiashuo Liang @ 2021-06-05 13:10 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
	H. Peter Anvin, Dave Hansen
  Cc: linux-kernel, Jiashuo Liang

Hi,

I am learning the kernel implementation of the x86 PKU feature. I find the
arch_set_user_pkey_access function in arch/x86/kernel/fpu/xstate.c does not
use its first parameter. So it is perhaps a bug?

The arch_set_user_pkey_access function is supposed to set the PKRU register
for the task_struct specified by its first parameter tsk. But it is only
implemented for the current task_struct.

Fortunately, it has been called only with current task_struct in the kernel
code, so it appears to be okay. However, it can introduce bugs in the
future because people may expect it working on other task_struct.

This commit seems to be related: b79daf8589921 ("x86/mm/pkeys: Fix compact
mode by removing protection keys' XSAVE buffer manipulation").

Thank you!
liangjs


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-08 19:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-05 13:10 arch_set_user_pkey_access only works on the current task_struct Jiashuo Liang
2021-06-07 17:52 ` Dave Hansen
2021-06-08  3:16   ` liangjs
2021-06-08 14:55     ` Dave Hansen
2021-06-08 19:05     ` Thomas Gleixner

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®