lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250717112407.13507-1-lianux.mm@gmail.com>
Date: Thu, 17 Jul 2025 19:24:05 +0800
From: wang lian <lianux.mm@...il.com>
To: akpm@...ux-foundation.org,
	broonie@...nel.org,
	david@...hat.com,
	lorenzo.stoakes@...cle.com,
	sj@...nel.org,
	ziy@...dia.com,
	linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Cc: brauner@...nel.org,
	gkwang@...x-info.com,
	jannh@...gle.com,
	Liam.Howlett@...cle.com,
	lianux.mm@...il.com,
	ludovico.zy.wu@...il.com,
	p1ucky0923@...il.com,
	richard.weiyang@...il.com,
	ryncsn@...il.com,
	shuah@...nel.org,
	vbabka@...e.cz,
	zijing.zhang@...ton.me
Subject: [PATCH v2 0/2] selftests/mm: reuse FORCE_READ to replace "asm volatile("" : "+r" (XXX));"

This series introduces a common FORCE_READ() macro to replace 
the cryptic asm volatile("" : "+r" (variable)); 
construct used in several mm selftests. This improves code readability and 
maintainability by removing duplicated, hard-to-understand code.

I previously sent the refactoring patch [1] as a standalone change, following a suggestion from David. 
As Andrew Morton and Wei Yang correctly pointed out, 
that patch was incomplete as it was missing the macro definition itself, 
causing build warnings. My apologies for the noise.

[1] https://lore.kernel.org/lkml/20250716123126.3851-1-lianux.mm@gmail.com/

This v2 series corrects that mistake by properly structuring the changes:
- The first patch introduces the FORCE_READ() macro into the shared vm_util.h header 
  and includes a minor cleanup for another test.
- The second patch then uses this new macro to refactor the selftests.

changes to v2:
- collected Acked-by and Reviewed-by from  David and Lorenzo Stoakes.

wang lian (2):
  selftests/mm: refactor common code and improve test skipping in
    guard_region
  selftests/mm: reuse FORCE_READ to replace "asm volatile("" : "+r"
    (XXX));"

 tools/testing/selftests/mm/cow.c              | 30 +++++++++----------
 tools/testing/selftests/mm/guard-regions.c    |  9 +-----
 tools/testing/selftests/mm/hugetlb-madvise.c  |  5 +---
 tools/testing/selftests/mm/migration.c        | 13 ++++----
 tools/testing/selftests/mm/pagemap_ioctl.c    |  4 +--
 .../selftests/mm/split_huge_page_test.c       |  4 +--
 tools/testing/selftests/mm/vm_util.h          |  7 +++++
 7 files changed, 32 insertions(+), 40 deletions(-)

-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ