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]
Message-ID: <alpine.DEB.2.20.1711012231250.1942@nanos>
Date:   Wed, 1 Nov 2017 22:47:54 +0100 (CET)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Dave Hansen <dave.hansen@...ux.intel.com>
cc:     linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        moritz.lipp@...k.tugraz.at, daniel.gruss@...k.tugraz.at,
        michael.schwarz@...k.tugraz.at, luto@...nel.org,
        torvalds@...ux-foundation.org, keescook@...gle.com,
        hughd@...gle.com, x86@...nel.org
Subject: Re: [PATCH 06/23] x86, kaiser: introduce user-mapped percpu areas

On Tue, 31 Oct 2017, Dave Hansen wrote:

> 
> These patches are based on work from a team at Graz University of
> Technology posted here: https://github.com/IAIK/KAISER
> 
> The KAISER approach keeps two copies of the page tables: one for running
> in the kernel and one for running userspace.  But, there are a few
> structures that are needed for switching in and out of the kernel and
> a good subset of *those* are per-cpu data.
> 
> This patch creates a new kind of per-cpu data that is mapped and can be
> used no matter which copy of the page tables we are using.

Please split out the percpu-defs.h change into a seperate patch.
 
> -DECLARE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page);
> +DECLARE_PER_CPU_PAGE_ALIGNED_USER_MAPPED(struct gdt_page, gdt_page);

Ok.

>  /* Provide the original GDT */
>  static inline struct desc_struct *get_cpu_gdt_rw(unsigned int cpu)
> diff -puN arch/x86/include/asm/hw_irq.h~kaiser-prep-user-mapped-percpu arch/x86/include/asm/hw_irq.h
> --- a/arch/x86/include/asm/hw_irq.h~kaiser-prep-user-mapped-percpu	2017-10-31 15:03:51.048146366 -0700
> +++ b/arch/x86/include/asm/hw_irq.h	2017-10-31 15:03:51.066147217 -0700
> @@ -160,7 +160,7 @@ extern char irq_entries_start[];
>  #define VECTOR_RETRIGGERED	((void *)~0UL)
>  
>  typedef struct irq_desc* vector_irq_t[NR_VECTORS];
> -DECLARE_PER_CPU(vector_irq_t, vector_irq);
> +DECLARE_PER_CPU_USER_MAPPED(vector_irq_t, vector_irq);

Why? The vector_irq array has nothing to do with user space. It's a
software handled storage which is used in the irq dispatcher way after the
exception entry happened.

I think you confused that with the IDT, which is missing here.

> -DECLARE_PER_CPU_SHARED_ALIGNED(struct tss_struct, cpu_tss);
> +DECLARE_PER_CPU_SHARED_ALIGNED_USER_MAPPED(struct tss_struct, cpu_tss);

Ok.

> -DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = {
> +DEFINE_PER_CPU_PAGE_ALIGNED_USER_MAPPED(struct gdt_page, gdt_page) = { .gdt = {

Ok.

> -static DEFINE_PER_CPU_PAGE_ALIGNED(char, exception_stacks
> +DEFINE_PER_CPU_PAGE_ALIGNED_USER_MAPPED(char, exception_stacks
>  	[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ]);

Hmm. I don't think that's a good idea. We discussed that in Prague with
Andy and the Peters and came to the conclusion that we want a stub stack in
the user mapping and switch to the kernel stacks in software after
switching back to the kernel mappings. Andys 'Pile o' entry...' series
paves the way to that already. So can we please put kaiser on top of those
and do it proper right away?

> -DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
> +DEFINE_PER_CPU_USER_MAPPED(vector_irq_t, vector_irq) = {
>  	[0 ... NR_VECTORS - 1] = VECTOR_UNUSED,
>  };

See above.

Thanks,

	tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ