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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250717104811.3773-1-lianux.mm@gmail.com>
Date: Thu, 17 Jul 2025 18:48:11 +0800
From: wang lian <lianux.mm@...il.com>
To: akpm@...ux-foundation.org
Cc: Liam.Howlett@...cle.com,
	brauner@...nel.org,
	broonie@...nel.org,
	david@...hat.com,
	gkwang@...x-info.com,
	jannh@...gle.com,
	lianux.mm@...il.com,
	linux-kernel@...r.kernel.org,
	linux-mm@...ck.org,
	lorenzo.stoakes@...cle.com,
	ludovico.zy.wu@...il.com,
	p1ucky0923@...il.com,
	ryncsn@...il.com,
	shuah@...nel.org,
	sj@...nel.org,
	vbabka@...e.cz,
	zijing.zhang@...ton.me,
	ziy@...dia.com
Subject: Re: [PATCH] selftests/mm: reuse FORCE_READ to replace "asm volatile("" : "+r" (XXX));"

> On Wed, 16 Jul 2025 20:31:26 +0800 wang lian <lianux.mm@...il.com> wrote:

> > Several mm selftests use the `asm volatile("" : "+r" (variable));`
> > construct to force a read of a variable, preventing the compiler from
> > optimizing away the memory access. This idiom is cryptic and duplicated
> > across multiple test files.
> >
> > Following a suggestion from David[1], this patch refactors this
> > common pattern into a FORCE_READ() macro
> > 
> >  tools/testing/selftests/mm/cow.c              | 30 +++++++++----------
> >  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 +--
> >  5 files changed, 24 insertions(+), 32 deletions(-)

> The patch forgot to move the FORCE_READ definition into a header?

Hi Andrew,
You are absolutely right. My apologies for the inconvenience.
This patch was sent standalone based on a suggestion from David during 
the discussion of a previous, larger patch series. In that original series, 
I had already moved the FORCE_READ() macro definition into vm_util.h.

You can find the original patch series and discussion at this link:
https://lore.kernel.org/lkml/20250714130009.14581-1-lianux.mm@gmail.com/
It should also be in your mailing list archive.

To make this easier to review and apply, I can send a new, small patch series 
that first introduces the FORCE_READ() macro in vm_util.h and then applies this refactoring. 
Please let me know if you'd prefer that.
Sorry again for the confusion.


Best regards,
wang lian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ