From: Huacai Chen <chenhc@lemote.com>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>,
"open list:MIPS" <linux-mips@vger.kernel.org>,
kvm <kvm@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/4] MIPS: kvm: Use vm_get_page_prot to get protection bits
Date: Sat, 14 Nov 2020 15:34:14 +0800 [thread overview]
Message-ID: <CAAhV-H7Sc6tmsfRcxOkx3rPk85Ey6XtxqhDB0RWokk+XSGVJ9A@mail.gmail.com> (raw)
In-Reply-To: <20201113110952.68086-2-tsbogend@alpha.franken.de>
Hi, Thomas,
On Fri, Nov 13, 2020 at 7:13 PM Thomas Bogendoerfer
<tsbogend@alpha.franken.de> wrote:
>
> MIPS protection bits are setup during runtime so using defines like
> PAGE_SHARED ignores this runtime changes. Using vm_get_page_prot
> to get correct page protection fixes this.
Is there some visible bugs if without this fix?
Huacai
>
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> ---
> arch/mips/kvm/mmu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/mips/kvm/mmu.c b/arch/mips/kvm/mmu.c
> index 28c366d307e7..3dabeda82458 100644
> --- a/arch/mips/kvm/mmu.c
> +++ b/arch/mips/kvm/mmu.c
> @@ -1074,6 +1074,7 @@ int kvm_mips_handle_commpage_tlb_fault(unsigned long badvaddr,
> {
> kvm_pfn_t pfn;
> pte_t *ptep;
> + pgprot_t prot;
>
> ptep = kvm_trap_emul_pte_for_gva(vcpu, badvaddr);
> if (!ptep) {
> @@ -1083,7 +1084,8 @@ int kvm_mips_handle_commpage_tlb_fault(unsigned long badvaddr,
>
> pfn = PFN_DOWN(virt_to_phys(vcpu->arch.kseg0_commpage));
> /* Also set valid and dirty, so refill handler doesn't have to */
> - *ptep = pte_mkyoung(pte_mkdirty(pfn_pte(pfn, PAGE_SHARED)));
> + prot = vm_get_page_prot(VM_READ|VM_WRITE|VM_SHARED);
> + *ptep = pte_mkyoung(pte_mkdirty(pfn_pte(pfn, prot)));
>
> /* Invalidate this entry in the TLB, guest kernel ASID only */
> kvm_mips_host_tlb_inv(vcpu, badvaddr, false, true);
> --
> 2.16.4
>
next prev parent reply other threads:[~2020-11-14 7:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 11:09 [PATCH 1/4] MIPS: vdso: Use vma page protection for remapping Thomas Bogendoerfer
2020-11-13 11:09 ` [PATCH 2/4] MIPS: kvm: Use vm_get_page_prot to get protection bits Thomas Bogendoerfer
2020-11-14 7:34 ` Huacai Chen [this message]
2020-11-16 12:30 ` Thomas Bogendoerfer
2020-11-17 1:18 ` Huacai Chen
2020-11-17 10:40 ` Thomas Bogendoerfer
2020-11-19 12:54 ` Thomas Bogendoerfer
2020-11-13 11:09 ` [PATCH 3/4] MIPS: mm: shorten lines by using macro Thomas Bogendoerfer
2020-11-19 12:54 ` Thomas Bogendoerfer
2020-11-13 11:09 ` [PATCH 4/4] MIPS: mm: Clean up setup of protection map Thomas Bogendoerfer
2020-11-19 12:54 ` Thomas Bogendoerfer
2020-12-12 16:29 ` Guenter Roeck
2020-12-14 15:32 ` Thomas Bogendoerfer
2020-11-19 12:53 ` [PATCH 1/4] MIPS: vdso: Use vma page protection for remapping Thomas Bogendoerfer
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=CAAhV-H7Sc6tmsfRcxOkx3rPk85Ey6XtxqhDB0RWokk+XSGVJ9A@mail.gmail.com \
--to=chenhc@lemote.com \
--cc=aleksandar.qemu.devel@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=tsbogend@alpha.franken.de \
/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;
as well as URLs for NNTP newsgroup(s).