lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 16 Jun 2020 11:33:41 +0200
From:   Christoph Hellwig <hch@....de>
To:     Vitaly Kuznetsov <vkuznets@...hat.com>
Cc:     Dexuan Cui <decui@...rosoft.com>, Christoph Hellwig <hch@....de>,
        Stephen Hemminger <stephen@...workplumber.org>,
        Andy Lutomirski <luto@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Andy Lutomirski <luto@...capital.net>,
        Michael Kelley <mikelley@...rosoft.com>,
        Ju-Hyoung Lee <juhlee@...rosoft.com>,
        "x86@...nel.org" <x86@...nel.org>,
        "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        KY Srinivasan <kys@...rosoft.com>
Subject: Re: hv_hypercall_pg page permissios

On Tue, Jun 16, 2020 at 11:29:33AM +0200, Vitaly Kuznetsov wrote:
> it seems we need something like PAGE_KERNEL_READONLY_EXEC but we don't
> seem to have one on x86. Hypercall page is special in a way that the
> guest doesn't need to write there at all. vmalloc_exec() seems to have
> only one other user on x86: module_alloc() and it has other needs.

module_alloc actually is a weak function and overriden on x86 (and many
other architectures) , so it isn't used either (did I mention that I hate
weak functions?)

> On
> ARM, alloc_insn_page() does the following:



> 
> arch/arm64/kernel/probes/kprobes.c:     page = vmalloc_exec(PAGE_SIZE);
> arch/arm64/kernel/probes/kprobes.c-     if (page) {
> arch/arm64/kernel/probes/kprobes.c-             set_memory_ro((unsigned long)page, 1);
> arch/arm64/kernel/probes/kprobes.c-             set_vm_flush_reset_perms(page);
> arch/arm64/kernel/probes/kprobes.c-     }
> 
> What if we do the same? (almost untested):
> 
> diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
> index e2137070386a..31aadfea589b 100644
> --- a/arch/x86/hyperv/hv_init.c
> +++ b/arch/x86/hyperv/hv_init.c
> @@ -23,6 +23,7 @@
>  #include <linux/kernel.h>
>  #include <linux/cpuhotplug.h>
>  #include <linux/syscore_ops.h>
> +#include <linux/set_memory.h>
>  #include <clocksource/hyperv_timer.h>
>  
>  void *hv_hypercall_pg;
> @@ -383,6 +384,8 @@ void __init hyperv_init(void)
>                 wrmsrl(HV_X64_MSR_GUEST_OS_ID, 0);
>                 goto remove_cpuhp_state;
>         }
> +       set_memory_ro((unsigned long)hv_hypercall_pg, 1);
> +       set_vm_flush_reset_perms(hv_hypercall_pg);

This should work and might be the best for 5.8, but I think we need
to sort this whole mess out for real.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ