From: Jason Gunthorpe <jgg@nvidia.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-s390@vger.kernel.org, frankja@linux.ibm.com,
borntraeger@de.ibm.com, nrb@linux.ibm.com, nsg@linux.ibm.com,
seiden@linux.ibm.com, hca@linux.ibm.com
Subject: Re: [PATCH v3 1/1] KVM: s390: fix race in gmap_make_secure()
Date: Fri, 28 Apr 2023 10:20:19 -0300 [thread overview]
Message-ID: <ZEvIE9eqfRKrpZyt@nvidia.com> (raw)
In-Reply-To: <20230428092753.27913-2-imbrenda@linux.ibm.com>
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@linux.ibm.com>
> Link: https://lore.kernel.org/linux-mm/Y9J4P%2FRNvY1Ztn0Q@nvidia.com/
> Suggested-by: Jason Gunthorpe <jgg@nvidia.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@nvidia.com>
Jason
prev parent reply other threads:[~2023-04-28 13:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-28 9:27 [PATCH v3 0/1] fix race in gmap_make_secure() Claudio Imbrenda
2023-04-28 9:27 ` [PATCH v3 1/1] KVM: s390: " Claudio Imbrenda
2023-04-28 13:20 ` Jason Gunthorpe [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZEvIE9eqfRKrpZyt@nvidia.com \
--to=jgg@nvidia.com \
--cc=borntraeger@de.ibm.com \
--cc=frankja@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nrb@linux.ibm.com \
--cc=nsg@linux.ibm.com \
--cc=seiden@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox