Skip to content

kasan: migrate the last module test to kunit

Sabyrzhan Tasbolatov linux-doc linux-mm linux-next lkml llvm oe-kbuild-all workflows 3 versions – Applied

Status from this message: [merged mm-stable] kasan-delete-config_kasan_module_test.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 0 repliesApplied 3/3
  2. v33 patches 6 repliesSuperseded
  3. v23 patches 3 repliesSuperseded

Changes in v4 from the cover letter

- moved checks from do_strncpy_from_user to strncpy_from_user due to "call to __check_object_size() with UACCESS enabled" warning, during the kernel build.

Patches in v4 All 3 applied

#Subject and filesSizeRepliesApplied
1/3kasan: move checks to do_strncpy_from_userlib/strncpy_from_user.c+3 -20 repliesApplied
2/3kasan: migrate copy_user_test to kunitmm/kasan/Makefile mm/kasan/kasan_test_c.c mm/kasan/kasan_test_module.c+47 -830 repliesApplied
3/3kasan: delete CONFIG_KASAN_MODULE_TESTDocumentation/dev-tools/kasan.rst Documentation/translations/zh_CN/dev-tools/kasan.rst Documentation/translations/zh_TW/dev-tools/kasan.rst +3 more+28 -471 replyApplied

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchAndrey Konovalov
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/3] kasan: migrate the last module test to kunit

copy_user_test() is the last KUnit-incompatible test with CONFIG_KASAN_MODULE_TEST requirement, which we are going to migrate to KUnit framework and delete the former test and Kconfig as well.

In this patch series:

- [1/3] move kasan_check_write() and check_object_size() to do_strncpy_from_user() to cover with KASAN checks with
multiple conditions in strncpy_from_user().

- [2/3] migrated copy_user_test() to KUnit, where we can also test strncpy_from_user() due to [1/4].

KUnits have been tested on:
- x86_64 with CONFIG_KASAN_GENERIC. Passed
- arm64 with CONFIG_KASAN_SW_TAGS. 1 fail. See [1]
- arm64 with CONFIG_KASAN_HW_TAGS. 1 fail. See [1]
[1] https://lore.kernel.org/linux-mm/CACzwLxj21h7nCcS2-KA_q7ybe+5pxH0uCDwu64q_9pPsydneWQ@mail.gmail.com/

- [3/3] delete CONFIG_KASAN_MODULE_TEST and documentation occurrences.

Changes v3 -> v4:
- moved checks from do_strncpy_from_user to strncpy_from_user due to "call to __check_object_size() with UACCESS enabled" warning, during the kernel build.

Changes v2 -> v3:
- added in [1/3] Reviewed-by: Andrey Konovalov.
- added a long string in usermem for strncpy_from_user. Suggested by Andrey.
- applied Andrey's patch to modify further kasan.rst.

Changes v1 -> v2:
- moved the sanitization to do_strncpy_from_user and as the separate commit per Andrey's review.
- deleted corresponding entries of kasan_test_module.o in Makefile
- deleted CONFIG_KASAN_MODULE_TEST at all with the documentation in separate commit.
- added Documentation maintainers in CC.

Sabyrzhan Tasbolatov (3):
kasan: move checks to do_strncpy_from_user
kasan: migrate copy_user_test to kunit
kasan: delete CONFIG_KASAN_MODULE_TEST

 Documentation/dev-tools/kasan.rst             |  9 +--
 .../translations/zh_CN/dev-tools/kasan.rst    |  6 +-
 .../translations/zh_TW/dev-tools/kasan.rst    |  6 +-
 lib/Kconfig.kasan                             |  7 --
 lib/strncpy_from_user.c                       |  5 +-
 mm/kasan/Makefile                             |  2 -
 mm/kasan/kasan.h                              |  2 +-
 mm/kasan/kasan_test_c.c                       | 39 +++++++++
 mm/kasan/kasan_test_module.c                  | 81 -------------------
 mm/kasan/report.c                             |  2 +-
 10 files changed, 48 insertions(+), 111 deletions(-)
 delete mode 100644 mm/kasan/kasan_test_module.c
Signature · 1 line
2.34.1