[PATCH v2 0/2] selftests/mm: refactor pkey helpers and fix mmap error handling

Hongfu Li posted 2 patches 2 weeks ago
There is a newer version of this series
tools/testing/selftests/mm/pkey-helpers.h     |  5 +-
tools/testing/selftests/mm/pkey-powerpc.h     |  2 +-
.../selftests/mm/pkey_sighandler_tests.c      | 20 ++--
tools/testing/selftests/mm/pkey_util.c        | 81 +++++++++++++++
tools/testing/selftests/mm/protection_keys.c  | 98 ++-----------------
5 files changed, 109 insertions(+), 97 deletions(-)
[PATCH v2 0/2] selftests/mm: refactor pkey helpers and fix mmap error handling
Posted by Hongfu Li 2 weeks ago
This series is version 2 of the previous patch [0].  In v2, the changes are
split into two patches for easier review.
[0] https://lore.kernel.org/all/20260518082120.3890552-1-lihongfu@kylinos.cn/

The main changes in this series are to refactor shared tracing and assertion
helpers into a common file, unify both pkey selftests on pkey_assert() and 
per-test tracing for consistent diagnostics, and add missing mmap() return 
checks with MAP_FAILED used throughout for readability and consistency.

Hongfu Li (2):
  selftests/mm: Refactor pkey test helpers and unify assertions
  selftests/mm: add missing mmap() return checks in pkey tests

 tools/testing/selftests/mm/pkey-helpers.h     |  5 +-
 tools/testing/selftests/mm/pkey-powerpc.h     |  2 +-
 .../selftests/mm/pkey_sighandler_tests.c      | 20 ++--
 tools/testing/selftests/mm/pkey_util.c        | 81 +++++++++++++++
 tools/testing/selftests/mm/protection_keys.c  | 98 ++-----------------
 5 files changed, 109 insertions(+), 97 deletions(-)

---
v2:
- Update commit message
- Move shared tracing and assertion helpers to a common file,
  replace assert() with pkey_assert() in sighandler tests
- Drop assert() from main() in protection_keys.c and add a proper error
  message instead.
-- 
2.50.1
Re: [PATCH v2 0/2] selftests/mm: refactor pkey helpers and fix mmap error handling
Posted by Andrew Morton 2 weeks ago
On Mon, 25 May 2026 15:30:24 +0800 Hongfu Li <lihongfu@kylinos.cn> wrote:

> This series is version 2 of the previous patch [0].  In v2, the changes are
> split into two patches for easier review.
> [0] https://lore.kernel.org/all/20260518082120.3890552-1-lihongfu@kylinos.cn/
> 
> The main changes in this series are to refactor shared tracing and assertion
> helpers into a common file, unify both pkey selftests on pkey_assert() and 
> per-test tracing for consistent diagnostics, and add missing mmap() return 
> checks with MAP_FAILED used throughout for readability and consistency.

Thanks.  AI review seems to have found a legitimate problem:
	https://sashiko.dev/#/patchset/20260525073026.27594-1-lihongfu@kylinos.cn
Re: [PATCH v2 0/2] selftests/mm: refactor pkey helpers and fix mmap error handling
Posted by Hongfu Li 1 week, 6 days ago
> > This series is version 2 of the previous patch [0].  In v2, the changes are
> > split into two patches for easier review.
> > [0] https://lore.kernel.org/all/20260518082120.3890552-1-lihongfu@kylinos.cn/
> > 
> > The main changes in this series are to refactor shared tracing and assertion
> > helpers into a common file, unify both pkey selftests on pkey_assert() and 
> > per-test tracing for consistent diagnostics, and add missing mmap() return 
> > checks with MAP_FAILED used throughout for readability and consistency.
> 
> Thanks.  AI review seems to have found a legitimate problem:
> 	https://sashiko.dev/#/patchset/20260525073026.27594-1-lihongfu@kylinos.cn

Thanks. I'll go through the problem reported by the AI review and make
corresponding fixes in v2.

Best regards,
Hongfu
Re: [PATCH v2 0/2] selftests/mm: refactor pkey helpers and fix mmap error handling
Posted by Lorenzo Stoakes 1 week, 5 days ago
On Tue, May 26, 2026 at 03:05:18PM +0800, Hongfu Li wrote:
> > > This series is version 2 of the previous patch [0].  In v2, the changes are
> > > split into two patches for easier review.
> > > [0] https://lore.kernel.org/all/20260518082120.3890552-1-lihongfu@kylinos.cn/
> > >
> > > The main changes in this series are to refactor shared tracing and assertion
> > > helpers into a common file, unify both pkey selftests on pkey_assert() and
> > > per-test tracing for consistent diagnostics, and add missing mmap() return
> > > checks with MAP_FAILED used throughout for readability and consistency.
> >
> > Thanks.  AI review seems to have found a legitimate problem:
> > 	https://sashiko.dev/#/patchset/20260525073026.27594-1-lihongfu@kylinos.cn
>
> Thanks. I'll go through the problem reported by the AI review and make
> corresponding fixes in v2.

You mean v3? :P

>
> Best regards,
> Hongfu
>

Cheers, Lorenzo
Re: [PATCH v2 0/2] selftests/mm: refactor pkey helpers and fix mmap error handling
Posted by Hongfu Li 1 week, 4 days ago
> > > > This series is version 2 of the previous patch [0].  In v2, the changes are
> > > > split into two patches for easier review.
> > > > [0] https://lore.kernel.org/all/20260518082120.3890552-1-lihongfu@kylinos.cn/
> > > >
> > > > The main changes in this series are to refactor shared tracing and assertion
> > > > helpers into a common file, unify both pkey selftests on pkey_assert() and
> > > > per-test tracing for consistent diagnostics, and add missing mmap() return
> > > > checks with MAP_FAILED used throughout for readability and consistency.
> > >
> > > Thanks.  AI review seems to have found a legitimate problem:
> > > 	https://sashiko.dev/#/patchset/20260525073026.27594-1-lihongfu@kylinos.cn
> >
> > Thanks. I'll go through the problem reported by the AI review and make
> > corresponding fixes in v2.
> 
> You mean v3? :P

Oh sorry, my mistake. It should be v3, and I've already sent it out.
Here is the link:
https://lore.kernel.org/all/20260527013825.1134225-1-lihongfu@kylinos.cn/

Best regards,
Hongfu