- Add a set of thread_info.flags accessors which snapshot it before
accesing it in order to prevent any potential data races, and convert all users to those new accessors -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmHcgFoACgkQEsHwGGHe VUqXeRAAvcNEfFw6BvXeGfFTxKmOrsRtu2WCkAkjvamyhXMCrjBqqHlygLJFCH5i 2mc6HBohzo4vBFcgi3R5tVkGazqlthY1KUM9Jpk7rUuUzi0phTH7n/MafZOm9Es/ BHYcAAyT/NwZRbCN0geccIzBtbc4xr8kxtec7vkRfGDx8B9/uFN86xm7cKAaL62G UDs0IquDPKEns3A7uKNuvKztILtuZWD1WcSkbOULJzXgLkb+cYKO1Lm9JK9rx8Ds 8tjezrJgOYGLQyyv0i3pWelm3jCZOKUChPslft0opvVUbrNd8piehvOm9CWopHcB QsYOWchnULTE9o4ZAs/1PkxC0LlFEWZH8bOLxBMTDVEY+xvmDuj1PdBUpncgJbOh dunHzsvaWproBSYUXA9nKhZWTVGl+CM8Ks7jXjl3IPynLd6cpYZ/5gyBVWEX7q3e 8htG95NzdPPo7doxMiNSKGSmSm0Np1TJ/i89vsYeGfefsvsq53Fyjhu7dIuTWHmU 2YUe6qHs6dF9x1bkHAAZz6T9Hs4BoGQBcXUnooT9JbzVdv2RfTPsrawdu8dOnzV1 RhwCFdFcll0AIEl0T9fCYzUI/Ga8ZS0roXs5NZ4wl0lwr0BGFwiU8WC1FUdGsZo9 0duaa0Tpv0OWt6rIMMB/E9QsqCDsQ4CMHuQpVVw+GOO5ux9kMms= =v6Xn -----END PGP SIGNATURE----- Merge tag 'core_entry_for_v5.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull thread_info flag accessor helper updates from Borislav Petkov: "Add a set of thread_info.flags accessors which snapshot it before accesing it in order to prevent any potential data races, and convert all users to those new accessors" * tag 'core_entry_for_v5.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: powerpc: Snapshot thread flags powerpc: Avoid discarding flags in system_call_exception() openrisc: Snapshot thread flags microblaze: Snapshot thread flags arm64: Snapshot thread flags ARM: Snapshot thread flags alpha: Snapshot thread flags sched: Snapshot thread flags entry: Snapshot thread flags x86: Snapshot thread flags thread_info: Add helpers to snapshot thread flags
This commit is contained in:
commit
48a60bdb2b
19 changed files with 46 additions and 34 deletions
|
|
@ -75,7 +75,7 @@ static inline void xfer_to_guest_mode_prepare(void)
|
|||
*/
|
||||
static inline bool __xfer_to_guest_mode_work_pending(void)
|
||||
{
|
||||
unsigned long ti_work = READ_ONCE(current_thread_info()->flags);
|
||||
unsigned long ti_work = read_thread_flags();
|
||||
|
||||
return !!(ti_work & XFER_TO_GUEST_MODE_WORK);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,6 +118,15 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
|
|||
return test_bit(flag, (unsigned long *)&ti->flags);
|
||||
}
|
||||
|
||||
/*
|
||||
* This may be used in noinstr code, and needs to be __always_inline to prevent
|
||||
* inadvertent instrumentation.
|
||||
*/
|
||||
static __always_inline unsigned long read_ti_thread_flags(struct thread_info *ti)
|
||||
{
|
||||
return READ_ONCE(ti->flags);
|
||||
}
|
||||
|
||||
#define set_thread_flag(flag) \
|
||||
set_ti_thread_flag(current_thread_info(), flag)
|
||||
#define clear_thread_flag(flag) \
|
||||
|
|
@ -130,6 +139,11 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
|
|||
test_and_clear_ti_thread_flag(current_thread_info(), flag)
|
||||
#define test_thread_flag(flag) \
|
||||
test_ti_thread_flag(current_thread_info(), flag)
|
||||
#define read_thread_flags() \
|
||||
read_ti_thread_flags(current_thread_info())
|
||||
|
||||
#define read_task_thread_flags(t) \
|
||||
read_ti_thread_flags(task_thread_info(t))
|
||||
|
||||
#ifdef CONFIG_GENERIC_ENTRY
|
||||
#define set_syscall_work(fl) \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue