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: <20250305231329.136686-1-sj@kernel.org>
Date: Wed,  5 Mar 2025 15:13:29 -0800
From: SeongJae Park <sj@...nel.org>
To: Shakeel Butt <shakeel.butt@...ux.dev>
Cc: SeongJae Park <sj@...nel.org>,
	"Liam R. Howlett" <howlett@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	David Hildenbrand <david@...hat.com>,
	Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
	Vlastimil Babka <vbabka@...e.cz>,
	kernel-team@...a.com,
	linux-kernel@...r.kernel.org,
	linux-mm@...ck.org
Subject: Re: [RFC PATCH 01/16] mm/madvise: use is_memory_failure() from madvise_do_behavior()

On Wed, 5 Mar 2025 12:25:51 -0800 Shakeel Butt <shakeel.butt@...ux.dev> wrote:

> On Wed, Mar 05, 2025 at 10:15:56AM -0800, SeongJae Park wrote:
> > To reduce redundant open-coded checks of CONFIG_MEMORY_FAILURE and
> > MADV_{HWPOISON,SOFT_OFFLINE} in madvise_[un]lock(), is_memory_failure()
> > has introduced.  madvise_do_behavior() is still doing the same
> > open-coded check, though.  Use is_memory_failure() instead.
> > 
> > Signed-off-by: SeongJae Park <sj@...nel.org>
> > ---
> >  mm/madvise.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/mm/madvise.c b/mm/madvise.c
> > index 388dc289b5d1..dbc8fec05cc6 100644
> > --- a/mm/madvise.c
> > +++ b/mm/madvise.c
> > @@ -1640,10 +1640,8 @@ static int madvise_do_behavior(struct mm_struct *mm,
> >  	unsigned long end;
> >  	int error;
> >  
> > -#ifdef CONFIG_MEMORY_FAILURE
> > -	if (behavior == MADV_HWPOISON || behavior == MADV_SOFT_OFFLINE)
> > +	if (is_memory_failure(behavior))
> >  		return madvise_inject_error(behavior, start, start + len_in);
> 
> You might want to either define empty madvise_inject_error() for
> !CONFIG_MEMORY_FAILURE or keep CONFIG_MEMORY_FAILURE here.

Good catch.  I confirmed build fails when !CONFIG_MEMORY_FAILURE.  I will
define empty madvise_inject_error().

> 
> > -#endif
> >  	start = untagged_addr_remote(mm, start);
> >  	end = start + len;
> >  
> > -- 
> > 2.39.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ