From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "42.hyeyoo@gmail.com" <42.hyeyoo@gmail.com>
Cc: "peterz@infradead.org" <peterz@infradead.org>,
"rppt@kernel.org" <rppt@kernel.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"Williams, Dan J" <dan.j.williams@intel.com>,
"x86@kernel.org" <x86@kernel.org>,
"hpa@zytor.com" <hpa@zytor.com>,
"mingo@redhat.com" <mingo@redhat.com>, "Christopherson,,
Sean" <seanjc@google.com>, "Lutomirski, Andy" <luto@kernel.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"bp@alien8.de" <bp@alien8.de>,
"Tianyu.Lan@microsoft.com" <Tianyu.Lan@microsoft.com>,
"aneesh.kumar@linux.ibm.com" <aneesh.kumar@linux.ibm.com>,
"chu, jane" <jane.chu@oracle.com>
Subject: Re: [RFC 1/2] x86/mm/cpa: always fail when user address is passed
Date: Wed, 15 Jun 2022 18:17:44 +0000 [thread overview]
Message-ID: <3e34b5a523a9b56a30e1bde2978f5808fb8427b5.camel@intel.com> (raw)
In-Reply-To: <YqlRY97X6eE2XpxZ@hyeyoo>
On Wed, 2022-06-15 at 12:26 +0900, Hyeonggon Yoo wrote:
> On Tue, Jun 14, 2022 at 05:52:31PM +0000, Edgecombe, Rick P wrote:
> > On Tue, 2022-06-14 at 15:39 +0900, Hyeonggon Yoo wrote:
> > > Currently CPA is not used for user mappings (only pgd of init_mm
> > > or and efi_mm is used). For simplicity, always fail when user
> > > address
> > > is passed.
> > >
> > > Note that efi_mm uses 1:1 mapping so its address should not be
> > > considered as user address.
> > >
> > > Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
> > > ---
> > > arch/x86/mm/pat/set_memory.c | 6 ++++++
> > > 1 file changed, 6 insertions(+)
> > >
> > > diff --git a/arch/x86/mm/pat/set_memory.c
> > > b/arch/x86/mm/pat/set_memory.c
> > > index 1abd5438f126..67cf969fed0d 100644
> > > --- a/arch/x86/mm/pat/set_memory.c
> > > +++ b/arch/x86/mm/pat/set_memory.c
> > > @@ -20,6 +20,7 @@
> > > #include <linux/kernel.h>
> > > #include <linux/cc_platform.h>
> > > #include <linux/set_memory.h>
> > > +#include <linux/efi.h>
> > >
> > > #include <asm/e820/api.h>
> > > #include <asm/processor.h>
> > > @@ -1514,6 +1515,11 @@ static int __change_page_attr(struct
> > > cpa_data
> > > *cpa, int primary)
> >
> > I guess having it here instead of __change_page_attr_set_clr() will
> > result in the direct map alias addresses getting checked as well.
> > Since
> > these are determined inside of CPA, I'm not sure if it's needed as
> > much.
>
> It does not check alias address when it failed.
> I put it in __change_page_attr() with CPA_ARRAY in mind.
> Because it may not be a single continuous area.
Makes sense.
>
> >
> > > pte_t *kpte, old_pte;
> > >
> > > address = __cpa_addr(cpa, cpa->curpage);
> > > +
> > > + if (WARN((IS_ENABLED(CONFIG_EFI) ? cpa->pgd != efi_mm.pgd :
> > > true)
> >
> > Could it be?
> >
> > (!IS_ENABLED(CONFIG_EFI) || cpa->pgd != efi_mm.pgd)
>
> Looks better, will update in v2.
Christoph's seems better to me.
next prev parent reply other threads:[~2022-06-15 18:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-14 6:39 [RFC 0/2] CPA improvements Hyeonggon Yoo
2022-06-14 6:39 ` [RFC 1/2] x86/mm/cpa: always fail when user address is passed Hyeonggon Yoo
2022-06-14 17:52 ` Edgecombe, Rick P
2022-06-15 3:26 ` Hyeonggon Yoo
2022-06-15 18:17 ` Edgecombe, Rick P [this message]
2022-06-14 18:31 ` Dave Hansen
2022-06-16 8:49 ` Hyeonggon Yoo
2022-06-16 14:20 ` Dave Hansen
2022-06-20 8:08 ` Hyeonggon Yoo
2022-07-07 20:24 ` Dave Hansen
2022-06-15 13:11 ` Christoph Hellwig
2022-06-16 8:51 ` Hyeonggon Yoo
2022-06-14 6:39 ` [RFC 2/2] x86/mm/cpa: drop pgprot_clear_protnone_bits() Hyeonggon Yoo
2022-06-14 6:53 ` Hyeonggon Yoo
2022-06-14 18:23 ` Edgecombe, Rick P
2022-06-15 3:47 ` Hyeonggon Yoo
2022-06-15 18:18 ` Edgecombe, Rick P
2022-06-19 12:20 ` Hyeonggon Yoo
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=3e34b5a523a9b56a30e1bde2978f5808fb8427b5.camel@intel.com \
--to=rick.p.edgecombe@intel.com \
--cc=42.hyeyoo@gmail.com \
--cc=Tianyu.Lan@microsoft.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=bp@alien8.de \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jane.chu@oracle.com \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=rppt@kernel.org \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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