Skip to content

Make the scheduler stack end check selectable at boot

Chris Down linux-arm-kernel linux-doc linux-kselftest linux-riscv lkml 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 0 repliesNew
  2. v13 patches 6 repliesSuperseded

Changes in v2 from the cover letter

- Check scs_is_enabled() inside task_scs_end_corrupted() rather than in schedule_debug() (Peter)
- Return 1 when sched_stack_end_check= can't be parsed (Randy)
- Say in the changelog why the other task_stack_end_corrupted() callers are left alone (Peter)
- Rebase onto tip/sched/core

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3scs: Skip the shadow stack end check when SCS is disabledinclude/linux/scs.h+11 -80 replies
2/3sched/core: Add sched_stack_end_check= boot parameterDocumentation/admin-guide/kernel-parameters.txt kernel/sched/core.c+35 -60 replies
3/3lkdtm/bugs: Add CORRUPT_STACK_END to test the scheduler stack end checkdrivers/misc/lkdtm/bugs.c tools/testing/selftests/lkdtm/tests.txt+22 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] Make the scheduler stack end check selectable at boot

At Meta, some of our host types enable CONFIG_SCHED_STACK_END_CHECK, but we don't want it generally on because of the extra work on every context switch.

Right now this is only configurable by setting the Kconfig option at build time. Let's make it so we can also select it at boot with sched_stack_end_check=, so that those hosts can share one kernel image.

(Patch 1 is a cleanup I happened upon while working on this, it can also be taken independently.)

v2:

- Check scs_is_enabled() inside task_scs_end_corrupted() rather than in schedule_debug() (Peter)
- Return 1 when sched_stack_end_check= can't be parsed (Randy)
- Say in the changelog why the other task_stack_end_corrupted() callers are left alone (Peter)
- Rebase onto tip/sched/core

v1: https://lore.kernel.org/r/[email protected]

Chris Down (3):
scs: Skip the shadow stack end check when SCS is disabled sched/core: Add sched_stack_end_check= boot parameter lkdtm/bugs: Add CORRUPT_STACK_END to test the scheduler stack end
check

 .../admin-guide/kernel-parameters.txt         |  8 +++++
 drivers/misc/lkdtm/bugs.c                     | 21 ++++++++++++
 include/linux/scs.h                           | 19 ++++++-----
 kernel/sched/core.c                           | 33 +++++++++++++++----
 tools/testing/selftests/lkdtm/tests.txt       |  1 +
 5 files changed, 68 insertions(+), 14 deletions(-)

base-commit: d7e670601af6c564ccf6d3b2ddf70ee4f41a6d1c

Signature · 1 line
2.56.1