[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZEvIE9eqfRKrpZyt@nvidia.com>
Date: Fri, 28 Apr 2023 10:20:19 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Claudio Imbrenda <imbrenda@...ux.ibm.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-s390@...r.kernel.org, frankja@...ux.ibm.com,
borntraeger@...ibm.com, nrb@...ux.ibm.com, nsg@...ux.ibm.com,
seiden@...ux.ibm.com, hca@...ux.ibm.com
Subject: Re: [PATCH v3 1/1] KVM: s390: fix race in gmap_make_secure()
On Fri, Apr 28, 2023 at 11:27:53AM +0200, Claudio Imbrenda wrote:
> Fix a potential race in gmap_make_secure() and remove the last user of
> follow_page() without FOLL_GET.
>
> The old code is locking something it doesn't have a reference to, and
> as explained by Jason and David in this discussion:
> https://lore.kernel.org/linux-mm/Y9J4P%2FRNvY1Ztn0Q@nvidia.com/
> it can lead to all kind of bad things, including the page getting
> unmapped (MADV_DONTNEED), freed, reallocated as a larger folio and the
> unlock_page() would target the wrong bit.
> There is also another race with the FOLL_WRITE, which could race
> between the follow_page() and the get_locked_pte().
>
> The main point is to remove the last use of follow_page() without
> FOLL_GET or FOLL_PIN, removing the races can be considered a nice
> bonus.
>
> Signed-off-by: Claudio Imbrenda <imbrenda@...ux.ibm.com>
> Link: https://lore.kernel.org/linux-mm/Y9J4P%2FRNvY1Ztn0Q@nvidia.com/
> Suggested-by: Jason Gunthorpe <jgg@...dia.com>
> Fixes: 214d9bbcd3a6 ("s390/mm: provide memory management functions for protected KVM guests")
> ---
> arch/s390/kernel/uv.c | 32 +++++++++++---------------------
> 1 file changed, 11 insertions(+), 21 deletions(-)
Reviewed-by: Jason Gunthorpe <jgg@...dia.com>
Jason
Powered by blists - more mailing lists