linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH stable 6.1] mm: Fix is_zero_page() usage in try_grab_page()
@ 2025-04-16 20:24 Alex Williamson
  2025-04-16 21:49 ` Salvatore Bonaccorso
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Alex Williamson @ 2025-04-16 20:24 UTC (permalink / raw)
  Cc: Alex Williamson, Salvatore Bonaccorso, Milan Broz, stable,
	linux-kernel, linux-mm, Sasha Levin

The backport of upstream commit c8070b787519 ("mm: Don't pin ZERO_PAGE
in pin_user_pages()") into v6.1.130 noted below in Fixes does not
account for commit 0f0892356fa1 ("mm: allow multiple error returns in
try_grab_page()"), which changed the return value of try_grab_page()
from bool to int.  Therefore returning 0, success in the upstream
version, becomes an error here.  Fix the return value.

Fixes: 476c1dfefab8 ("mm: Don't pin ZERO_PAGE in pin_user_pages()")
Link: https://lore.kernel.org/all/Z_6uhLQjJ7SSzI13@eldamar.lan
Reported-by: Salvatore Bonaccorso <carnil@debian.org>
Reported-by: Milan Broz <gmazyland@gmail.com>
Cc: stable@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: Sasha Levin <sashal@kernel.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
 mm/gup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/gup.c b/mm/gup.c
index b1daaa9d89aa..76a2b0943e2d 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -232,7 +232,7 @@ bool __must_check try_grab_page(struct page *page, unsigned int flags)
 		 * and it is used in a *lot* of places.
 		 */
 		if (is_zero_page(page))
-			return 0;
+			return true;
 
 		/*
 		 * Similar to try_grab_folio(): be sure to *also*
-- 
2.48.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH stable 6.1] mm: Fix is_zero_page() usage in try_grab_page()
  2025-04-16 20:24 [PATCH stable 6.1] mm: Fix is_zero_page() usage in try_grab_page() Alex Williamson
@ 2025-04-16 21:49 ` Salvatore Bonaccorso
  2025-04-22  8:01   ` Greg KH
  2025-04-17  7:12 ` David Hildenbrand
  2025-04-22  8:05 ` Patch "mm: Fix is_zero_page() usage in try_grab_page()" has been added to the 6.1-stable tree gregkh
  2 siblings, 1 reply; 7+ messages in thread
From: Salvatore Bonaccorso @ 2025-04-16 21:49 UTC (permalink / raw)
  To: Alex Williamson; +Cc: Milan Broz, stable, linux-kernel, linux-mm, Sasha Levin

Hi Alex,

On Wed, Apr 16, 2025 at 02:24:39PM -0600, Alex Williamson wrote:
> The backport of upstream commit c8070b787519 ("mm: Don't pin ZERO_PAGE
> in pin_user_pages()") into v6.1.130 noted below in Fixes does not
> account for commit 0f0892356fa1 ("mm: allow multiple error returns in
> try_grab_page()"), which changed the return value of try_grab_page()
> from bool to int.  Therefore returning 0, success in the upstream
> version, becomes an error here.  Fix the return value.
> 
> Fixes: 476c1dfefab8 ("mm: Don't pin ZERO_PAGE in pin_user_pages()")
> Link: https://lore.kernel.org/all/Z_6uhLQjJ7SSzI13@eldamar.lan
> Reported-by: Salvatore Bonaccorso <carnil@debian.org>
> Reported-by: Milan Broz <gmazyland@gmail.com>
> Cc: stable@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: Sasha Levin <sashal@kernel.org>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
>  mm/gup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/gup.c b/mm/gup.c
> index b1daaa9d89aa..76a2b0943e2d 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -232,7 +232,7 @@ bool __must_check try_grab_page(struct page *page, unsigned int flags)
>  		 * and it is used in a *lot* of places.
>  		 */
>  		if (is_zero_page(page))
> -			return 0;
> +			return true;
>  
>  		/*
>  		 * Similar to try_grab_folio(): be sure to *also*
> -- 
> 2.48.1

Thank you, with your patch applied one test VM with a PCI passhtrough
configuration start again.

Tested-by: Salvatore Bonaccorso <carnil@debian.org>

Regards,
Salvatore


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH stable 6.1] mm: Fix is_zero_page() usage in try_grab_page()
  2025-04-16 20:24 [PATCH stable 6.1] mm: Fix is_zero_page() usage in try_grab_page() Alex Williamson
  2025-04-16 21:49 ` Salvatore Bonaccorso
@ 2025-04-17  7:12 ` David Hildenbrand
  2025-04-22  8:05 ` Patch "mm: Fix is_zero_page() usage in try_grab_page()" has been added to the 6.1-stable tree gregkh
  2 siblings, 0 replies; 7+ messages in thread
From: David Hildenbrand @ 2025-04-17  7:12 UTC (permalink / raw)
  To: Alex Williamson
  Cc: Salvatore Bonaccorso, Milan Broz, stable, linux-kernel, linux-mm,
	Sasha Levin

On 16.04.25 22:24, Alex Williamson wrote:
> The backport of upstream commit c8070b787519 ("mm: Don't pin ZERO_PAGE
> in pin_user_pages()") into v6.1.130 noted below in Fixes does not
> account for commit 0f0892356fa1 ("mm: allow multiple error returns in
> try_grab_page()"), which changed the return value of try_grab_page()
> from bool to int.  Therefore returning 0, success in the upstream
> version, becomes an error here.  Fix the return value.
> 
> Fixes: 476c1dfefab8 ("mm: Don't pin ZERO_PAGE in pin_user_pages()")
> Link: https://lore.kernel.org/all/Z_6uhLQjJ7SSzI13@eldamar.lan
> Reported-by: Salvatore Bonaccorso <carnil@debian.org>
> Reported-by: Milan Broz <gmazyland@gmail.com>
> Cc: stable@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: Sasha Levin <sashal@kernel.org>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
>   mm/gup.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/gup.c b/mm/gup.c
> index b1daaa9d89aa..76a2b0943e2d 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -232,7 +232,7 @@ bool __must_check try_grab_page(struct page *page, unsigned int flags)
>   		 * and it is used in a *lot* of places.
>   		 */
>   		if (is_zero_page(page))
> -			return 0;
> +			return true;
>   
>   		/*
>   		 * Similar to try_grab_folio(): be sure to *also*

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH stable 6.1] mm: Fix is_zero_page() usage in try_grab_page()
  2025-04-16 21:49 ` Salvatore Bonaccorso
@ 2025-04-22  8:01   ` Greg KH
  0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2025-04-22  8:01 UTC (permalink / raw)
  To: Salvatore Bonaccorso
  Cc: Alex Williamson, Milan Broz, stable, linux-kernel, linux-mm, Sasha Levin

On Wed, Apr 16, 2025 at 11:49:24PM +0200, Salvatore Bonaccorso wrote:
> Hi Alex,
> 
> On Wed, Apr 16, 2025 at 02:24:39PM -0600, Alex Williamson wrote:
> > The backport of upstream commit c8070b787519 ("mm: Don't pin ZERO_PAGE
> > in pin_user_pages()") into v6.1.130 noted below in Fixes does not
> > account for commit 0f0892356fa1 ("mm: allow multiple error returns in
> > try_grab_page()"), which changed the return value of try_grab_page()
> > from bool to int.  Therefore returning 0, success in the upstream
> > version, becomes an error here.  Fix the return value.
> > 
> > Fixes: 476c1dfefab8 ("mm: Don't pin ZERO_PAGE in pin_user_pages()")
> > Link: https://lore.kernel.org/all/Z_6uhLQjJ7SSzI13@eldamar.lan
> > Reported-by: Salvatore Bonaccorso <carnil@debian.org>
> > Reported-by: Milan Broz <gmazyland@gmail.com>
> > Cc: stable@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org
> > Cc: linux-mm@kvack.org
> > Cc: Sasha Levin <sashal@kernel.org>
> > Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> > ---
> >  mm/gup.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/mm/gup.c b/mm/gup.c
> > index b1daaa9d89aa..76a2b0943e2d 100644
> > --- a/mm/gup.c
> > +++ b/mm/gup.c
> > @@ -232,7 +232,7 @@ bool __must_check try_grab_page(struct page *page, unsigned int flags)
> >  		 * and it is used in a *lot* of places.
> >  		 */
> >  		if (is_zero_page(page))
> > -			return 0;
> > +			return true;
> >  
> >  		/*
> >  		 * Similar to try_grab_folio(): be sure to *also*
> > -- 
> > 2.48.1
> 
> Thank you, with your patch applied one test VM with a PCI passhtrough
> configuration start again.
> 
> Tested-by: Salvatore Bonaccorso <carnil@debian.org>

Now queued up, thanks.

greg k-h


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Patch "mm: Fix is_zero_page() usage in try_grab_page()" has been added to the 6.1-stable tree
  2025-04-16 20:24 [PATCH stable 6.1] mm: Fix is_zero_page() usage in try_grab_page() Alex Williamson
  2025-04-16 21:49 ` Salvatore Bonaccorso
  2025-04-17  7:12 ` David Hildenbrand
@ 2025-04-22  8:05 ` gregkh
  2025-04-22  8:47   ` David Hildenbrand
  2 siblings, 1 reply; 7+ messages in thread
From: gregkh @ 2025-04-22  8:05 UTC (permalink / raw)
  To: alex.williamson, carnil, gmazyland, gregkh, linux-mm, sashal
  Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    mm: Fix is_zero_page() usage in try_grab_page()

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mm-fix-is_zero_page-usage-in-try_grab_page.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From alex.williamson@redhat.com  Tue Apr 22 10:00:53 2025
From: Alex Williamson <alex.williamson@redhat.com>
Date: Wed, 16 Apr 2025 14:24:39 -0600
Subject: mm: Fix is_zero_page() usage in try_grab_page()
Cc: Alex Williamson <alex.williamson@redhat.com>, Salvatore Bonaccorso <carnil@debian.org>, Milan Broz <gmazyland@gmail.com>, stable@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sasha Levin <sashal@kernel.org>
Message-ID: <20250416202441.3911142-1-alex.williamson@redhat.com>

From: Alex Williamson <alex.williamson@redhat.com>

The backport of upstream commit c8070b787519 ("mm: Don't pin ZERO_PAGE
in pin_user_pages()") into v6.1.130 noted below in Fixes does not
account for commit 0f0892356fa1 ("mm: allow multiple error returns in
try_grab_page()"), which changed the return value of try_grab_page()
from bool to int.  Therefore returning 0, success in the upstream
version, becomes an error here.  Fix the return value.

Fixes: 476c1dfefab8 ("mm: Don't pin ZERO_PAGE in pin_user_pages()")
Link: https://lore.kernel.org/all/Z_6uhLQjJ7SSzI13@eldamar.lan
Reported-by: Salvatore Bonaccorso <carnil@debian.org>
Reported-by: Milan Broz <gmazyland@gmail.com>
Cc: stable@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: Sasha Levin <sashal@kernel.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 mm/gup.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/gup.c
+++ b/mm/gup.c
@@ -232,7 +232,7 @@ bool __must_check try_grab_page(struct p
 		 * and it is used in a *lot* of places.
 		 */
 		if (is_zero_page(page))
-			return 0;
+			return true;
 
 		/*
 		 * Similar to try_grab_folio(): be sure to *also*


Patches currently in stable-queue which might be from alex.williamson@redhat.com are

queue-6.1/mm-fix-is_zero_page-usage-in-try_grab_page.patch
queue-6.1/revert-pci-avoid-reset-when-disabled-via-sysfs.patch


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Patch "mm: Fix is_zero_page() usage in try_grab_page()" has been added to the 6.1-stable tree
  2025-04-22  8:05 ` Patch "mm: Fix is_zero_page() usage in try_grab_page()" has been added to the 6.1-stable tree gregkh
@ 2025-04-22  8:47   ` David Hildenbrand
  2025-04-22  9:02     ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: David Hildenbrand @ 2025-04-22  8:47 UTC (permalink / raw)
  To: gregkh, alex.williamson, carnil, gmazyland, linux-mm, sashal
  Cc: stable-commits

On 22.04.25 10:05, gregkh@linuxfoundation.org wrote:
> 
> This is a note to let you know that I've just added the patch titled
> 
>      mm: Fix is_zero_page() usage in try_grab_page()
> 
> to the 6.1-stable tree which can be found at:
>      http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> 
> The filename of the patch is:
>       mm-fix-is_zero_page-usage-in-try_grab_page.patch
> and it can be found in the queue-6.1 subdirectory.
> 
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable@vger.kernel.org> know about it.
> 
> 
>  From alex.williamson@redhat.com  Tue Apr 22 10:00:53 2025
> From: Alex Williamson <alex.williamson@redhat.com>
> Date: Wed, 16 Apr 2025 14:24:39 -0600
> Subject: mm: Fix is_zero_page() usage in try_grab_page()
> Cc: Alex Williamson <alex.williamson@redhat.com>, Salvatore Bonaccorso <carnil@debian.org>, Milan Broz <gmazyland@gmail.com>, stable@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sasha Levin <sashal@kernel.org>
> Message-ID: <20250416202441.3911142-1-alex.williamson@redhat.com>
> 
> From: Alex Williamson <alex.williamson@redhat.com>
> 
> The backport of upstream commit c8070b787519 ("mm: Don't pin ZERO_PAGE
> in pin_user_pages()") into v6.1.130 noted below in Fixes does not
> account for commit 0f0892356fa1 ("mm: allow multiple error returns in
> try_grab_page()"), which changed the return value of try_grab_page()
> from bool to int.  Therefore returning 0, success in the upstream
> version, becomes an error here.  Fix the return value.
> 
> Fixes: 476c1dfefab8 ("mm: Don't pin ZERO_PAGE in pin_user_pages()")
> Link: https://lore.kernel.org/all/Z_6uhLQjJ7SSzI13@eldamar.lan
> Reported-by: Salvatore Bonaccorso <carnil@debian.org>
> Reported-by: Milan Broz <gmazyland@gmail.com>
> Cc: stable@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: Sasha Levin <sashal@kernel.org>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>   mm/gup.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -232,7 +232,7 @@ bool __must_check try_grab_page(struct p
>   		 * and it is used in a *lot* of places.
>   		 */
>   		if (is_zero_page(page))
> -			return 0;
> +			return true;
>   
>   		/*
>   		 * Similar to try_grab_folio(): be sure to *also*
> 
> 
> Patches currently in stable-queue which might be from alex.williamson@redhat.com are
> 
> queue-6.1/mm-fix-is_zero_page-usage-in-try_grab_page.patch
> queue-6.1/revert-pci-avoid-reset-when-disabled-via-sysfs.patch
> 

FWIW

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Patch "mm: Fix is_zero_page() usage in try_grab_page()" has been added to the 6.1-stable tree
  2025-04-22  8:47   ` David Hildenbrand
@ 2025-04-22  9:02     ` Greg KH
  0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2025-04-22  9:02 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: alex.williamson, carnil, gmazyland, linux-mm, sashal, stable-commits

On Tue, Apr 22, 2025 at 10:47:02AM +0200, David Hildenbrand wrote:
> On 22.04.25 10:05, gregkh@linuxfoundation.org wrote:
> > 
> > This is a note to let you know that I've just added the patch titled
> > 
> >      mm: Fix is_zero_page() usage in try_grab_page()
> > 
> > to the 6.1-stable tree which can be found at:
> >      http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> > 
> > The filename of the patch is:
> >       mm-fix-is_zero_page-usage-in-try_grab_page.patch
> > and it can be found in the queue-6.1 subdirectory.
> > 
> > If you, or anyone else, feels it should not be added to the stable tree,
> > please let <stable@vger.kernel.org> know about it.
> > 
> > 
> >  From alex.williamson@redhat.com  Tue Apr 22 10:00:53 2025
> > From: Alex Williamson <alex.williamson@redhat.com>
> > Date: Wed, 16 Apr 2025 14:24:39 -0600
> > Subject: mm: Fix is_zero_page() usage in try_grab_page()
> > Cc: Alex Williamson <alex.williamson@redhat.com>, Salvatore Bonaccorso <carnil@debian.org>, Milan Broz <gmazyland@gmail.com>, stable@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sasha Levin <sashal@kernel.org>
> > Message-ID: <20250416202441.3911142-1-alex.williamson@redhat.com>
> > 
> > From: Alex Williamson <alex.williamson@redhat.com>
> > 
> > The backport of upstream commit c8070b787519 ("mm: Don't pin ZERO_PAGE
> > in pin_user_pages()") into v6.1.130 noted below in Fixes does not
> > account for commit 0f0892356fa1 ("mm: allow multiple error returns in
> > try_grab_page()"), which changed the return value of try_grab_page()
> > from bool to int.  Therefore returning 0, success in the upstream
> > version, becomes an error here.  Fix the return value.
> > 
> > Fixes: 476c1dfefab8 ("mm: Don't pin ZERO_PAGE in pin_user_pages()")
> > Link: https://lore.kernel.org/all/Z_6uhLQjJ7SSzI13@eldamar.lan
> > Reported-by: Salvatore Bonaccorso <carnil@debian.org>
> > Reported-by: Milan Broz <gmazyland@gmail.com>
> > Cc: stable@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org
> > Cc: linux-mm@kvack.org
> > Cc: Sasha Levin <sashal@kernel.org>
> > Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >   mm/gup.c |    2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > --- a/mm/gup.c
> > +++ b/mm/gup.c
> > @@ -232,7 +232,7 @@ bool __must_check try_grab_page(struct p
> >   		 * and it is used in a *lot* of places.
> >   		 */
> >   		if (is_zero_page(page))
> > -			return 0;
> > +			return true;
> >   		/*
> >   		 * Similar to try_grab_folio(): be sure to *also*
> > 
> > 
> > Patches currently in stable-queue which might be from alex.williamson@redhat.com are
> > 
> > queue-6.1/mm-fix-is_zero_page-usage-in-try_grab_page.patch
> > queue-6.1/revert-pci-avoid-reset-when-disabled-via-sysfs.patch
> > 
> 
> FWIW
> 
> Reviewed-by: David Hildenbrand <david@redhat.com>

Thanks!



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-04-22  9:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-16 20:24 [PATCH stable 6.1] mm: Fix is_zero_page() usage in try_grab_page() Alex Williamson
2025-04-16 21:49 ` Salvatore Bonaccorso
2025-04-22  8:01   ` Greg KH
2025-04-17  7:12 ` David Hildenbrand
2025-04-22  8:05 ` Patch "mm: Fix is_zero_page() usage in try_grab_page()" has been added to the 6.1-stable tree gregkh
2025-04-22  8:47   ` David Hildenbrand
2025-04-22  9:02     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox