diff options
author | Sabyrzhan Tasbolatov <[email protected]> | 2024-10-11 08:53:10 +0500 |
---|---|---|
committer | Andrew Morton <[email protected]> | 2024-11-06 20:11:14 -0800 |
commit | e4137f08816bbf91fe76d1b60fa16862a4827ac1 (patch) | |
tree | cd6f89fa0421a923bf15140261e392721e08d4c5 /tools/perf/scripts/python/exported-sql-viewer.py | |
parent | 908378a30b0972e5bf8fae3cf38affc162fe8e3b (diff) |
mm, kasan, kmsan: instrument copy_from/to_kernel_nofault
Instrument copy_from_kernel_nofault() with KMSAN for uninitialized kernel
memory check and copy_to_kernel_nofault() with KASAN, KCSAN to detect the
memory corruption.
syzbot reported that bpf_probe_read_kernel() kernel helper triggered KASAN
report via kasan_check_range() which is not the expected behaviour as
copy_from_kernel_nofault() is meant to be a non-faulting helper.
Solution is, suggested by Marco Elver, to replace KASAN, KCSAN check in
copy_from_kernel_nofault() with KMSAN detection of copying uninitilaized
kernel memory. In copy_to_kernel_nofault() we can retain
instrument_write() explicitly for the memory corruption instrumentation.
copy_to_kernel_nofault() is tested on x86_64 and arm64 with
CONFIG_KASAN_SW_TAGS. On arm64 with CONFIG_KASAN_HW_TAGS, kunit test
currently fails. Need more clarification on it.
[[email protected]: fix comment layout, per checkpatch
Link: https://lore.kernel.org/linux-mm/CANpmjNMAVFzqnCZhEity9cjiqQ9CVN1X7qeeeAp_6yKjwKo8iw@mail.gmail.com/
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Sabyrzhan Tasbolatov <[email protected]>
Reviewed-by: Marco Elver <[email protected]>
Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=61123a5daeb9f7454599
Reported-by: Andrey Konovalov <[email protected]>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=210505
Reviewed-by: Andrey Konovalov <[email protected]> [KASAN]
Tested-by: Andrey Konovalov <[email protected]> [KASAN]
Cc: Alexander Potapenko <[email protected]>
Cc: Andrey Ryabinin <[email protected]>
Cc: Dmitry Vyukov <[email protected]>
Cc: Vincenzo Frascino <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions