Skip to content

Commit 58e106e

Browse files
balbir-awsKAGA-KOKO
authored andcommitted
sched: Add task_work callback for paranoid L1D flush
The upcoming paranoid L1D flush infrastructure allows to conditionally (opt-in) flush L1D in switch_mm() as a defense against potential new side channels or for paranoia reasons. As the flush makes only sense when a task runs on a non-SMT enabled core, because SMT siblings share L1, the switch_mm() logic will kill a task which is flagged for L1D flush when it is running on a SMT thread. Add a taskwork callback so switch_mm() can queue a SIG_KILL command which is invoked when the task tries to return to user space. Signed-off-by: Balbir Singh <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 371b09c commit 58e106e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

arch/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,6 +1282,9 @@ config ARCH_SPLIT_ARG64
12821282
config ARCH_HAS_ELFCORE_COMPAT
12831283
bool
12841284

1285+
config ARCH_HAS_PARANOID_L1D_FLUSH
1286+
bool
1287+
12851288
source "kernel/gcov/Kconfig"
12861289

12871290
source "scripts/gcc-plugins/Kconfig"

include/linux/sched.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,16 @@ struct task_struct {
14001400
struct llist_head kretprobe_instances;
14011401
#endif
14021402

1403+
#ifdef CONFIG_ARCH_HAS_PARANOID_L1D_FLUSH
1404+
/*
1405+
* If L1D flush is supported on mm context switch
1406+
* then we use this callback head to queue kill work
1407+
* to kill tasks that are not running on SMT disabled
1408+
* cores
1409+
*/
1410+
struct callback_head l1d_flush_kill;
1411+
#endif
1412+
14031413
/*
14041414
* New fields for task_struct should be added above here, so that
14051415
* they are included in the randomized portion of task_struct.

0 commit comments

Comments
 (0)