[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250226182610.7f5313ca@p-imbrenda>
Date: Wed, 26 Feb 2025 18:26:10 +0100
From: Claudio Imbrenda <imbrenda@...ux.ibm.com>
To: David Hildenbrand <david@...hat.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, seiden@...ux.ibm.com,
nsg@...ux.ibm.com, schlameuss@...ux.ibm.com, hca@...ux.ibm.com
Subject: Re: [PATCH v2 1/1] KVM: s390: pv: fix race when making a page
secure
On Wed, 26 Feb 2025 18:01:04 +0100
David Hildenbrand <david@...hat.com> wrote:
> On 26.02.25 17:58, Claudio Imbrenda wrote:
> > On Wed, 26 Feb 2025 16:05:11 +0100
> > David Hildenbrand <david@...hat.com> wrote:
> >
> >>> +int make_hva_secure(struct mm_struct *mm, unsigned long hva, struct uv_cb_header *uvcb)
> >>> +{
> >>> + struct folio *folio;
> >>> + spinlock_t *ptelock;
> >>> + pte_t *ptep;
> >>> + int rc;
> >>> +
> >>> + ptep = get_locked_valid_pte(mm, hva, &ptelock);
> >>> + if (!ptep)
> >>> + return -ENXIO;
> >>
> >> You very likely need a pte_write() check we had there before, as you
> >> might effectively modify page content by clearing the page.
> >
> > it's not really needed, but it doesn't hurt either, I'll add a check
>
> Can you elaborate why it is not needed? Would the HW enforce that
> writability check already?
as I have discovered the hard way while working on this v2, yes
but as I said, it looks better with the check, so I'll add it
Powered by blists - more mailing lists