Revision b5db73fb18257cd5d9cb59bc4b779fffa629566a authored by Jisheng Zhang on 23 June 2024, 23:53:16 UTC, committed by Palmer Dabbelt on 26 July 2024, 12:50:47 UTC
Add support for the stackleak feature. Whenever the kernel returns to user
space the kernel stack is filled with a poison value.

At the same time, disables the plugin in EFI stub code because EFI stub
is out of scope for the protection.

Tested on qemu and milkv duo:
/ # echo STACKLEAK_ERASING > /sys/kernel/debug/provoke-crash/DIRECT
[   38.675575] lkdtm: Performing direct entry STACKLEAK_ERASING
[   38.678448] lkdtm: stackleak stack usage:
[   38.678448]   high offset: 288 bytes
[   38.678448]   current:     496 bytes
[   38.678448]   lowest:      1328 bytes
[   38.678448]   tracked:     1328 bytes
[   38.678448]   untracked:   448 bytes
[   38.678448]   poisoned:    14312 bytes
[   38.678448]   low offset:  8 bytes
[   38.689887] lkdtm: OK: the rest of the thread stack is properly erased

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
Link: https://lore.kernel.org/r/20240623235316.2010-1-jszhang@kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 1d20e5d
Raw File
.editorconfig
# SPDX-License-Identifier: GPL-2.0-only

root = true

[{*.{awk,c,dts,dtsi,dtso,h,mk,s,S},Kconfig,Makefile,Makefile.*}]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 8

[*.{json,py,rs}]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4

# this must be below the general *.py to overwrite it
[tools/{perf,power,rcu,testing/kunit}/**.py,]
indent_style = tab
indent_size = 8

[*.yaml]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
back to top