Skip to content

usercopy: Convert test_user_copy to KUnit test

Kees Cook linux-hardening linux-kselftest lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 9 repliesIn review
  2. v22 patches 6 repliesSuperseded

Changes in v3 from the cover letter

- use MEMEQ KUnit helper (David)
- exclude pathological address confusion test for systems with separate address spaces, noticed by David
- add KUnit-conditional exports for alloc_mm() and arch_pick_mmap_layout() noticed by 0day
v2: https://lore.kernel.org/lkml/[email protected]/
v1: https://lore.kernel.org/lkml/[email protected]/

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2kunit: test: Add vm_mmap() allocation resource managerinclude/kunit/test.h kernel/fork.c lib/kunit/Makefile +2 more+137 -02 replies
2/2usercopy: Convert test_user_copy to KUnit testMAINTAINERS lib/Kconfig.debug lib/Makefile +1 more+151 -1555 replies

Reviews trailers per patch

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

PatchDavid GowIvan Orlov
1/2R-b
2/2R-b T-b

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

Read the v3 thread

Cover letter [PATCH v3 0/2] usercopy: Convert test_user_copy to KUnit test

Hi,

This builds on the proposal[1] from Mark and lets me convert the existing usercopy selftest to KUnit. Besides adding this basic test to the KUnit collection, it also opens the door for execve testing (which depends on having a functional current->mm), and should provide the basic infrastructure for adding Mark's much more complete usercopy tests.

v3:
- use MEMEQ KUnit helper (David)
- exclude pathological address confusion test for systems with separate address spaces, noticed by David
- add KUnit-conditional exports for alloc_mm() and arch_pick_mmap_layout() noticed by 0day
v2: https://lore.kernel.org/lkml/[email protected]/
v1: https://lore.kernel.org/lkml/[email protected]/

-Kees

[1] https://lore.kernel.org/lkml/[email protected]/

Kees Cook (2):
kunit: test: Add vm_mmap() allocation resource manager
usercopy: Convert test_user_copy to KUnit test

 MAINTAINERS                                |   1 +
 include/kunit/test.h                       |  17 ++
 kernel/fork.c                              |   3 +
 lib/Kconfig.debug                          |  21 +-
 lib/Makefile                               |   2 +-
 lib/kunit/Makefile                         |   1 +
 lib/kunit/user_alloc.c                     | 113 +++++++++
 lib/{test_user_copy.c => usercopy_kunit.c} | 282 ++++++++++-----------
 mm/util.c                                  |   3 +
 9 files changed, 288 insertions(+), 155 deletions(-)
 create mode 100644 lib/kunit/user_alloc.c
 rename lib/{test_user_copy.c => usercopy_kunit.c} (46%)
Signature · 1 line
2.34.1