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, 21 Nov 2017 09:29:28 +0100 (CET)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Andy Lutomirski <luto@...nel.org>
cc:     X86 ML <x86@...nel.org>, Borislav Petkov <bpetkov@...e.de>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Brian Gerst <brgerst@...il.com>,
        Dave Hansen <dave.hansen@...el.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH 04/16] x86/fixmap: Generalize the GDT fixmap mechanism

On Mon, 20 Nov 2017, Andy Lutomirski wrote:
> On Mon, Nov 20, 2017 at 2:01 PM, Thomas Gleixner <tglx@...utronix.de> wrote:
> > On Mon, 20 Nov 2017, Andy Lutomirski wrote:
> >> + * to avoid circular header dependencies.
> >
> > :(
> 
> Hmm.  I could probably fix this, but it involves (at least) moving a
> struct definition and adding several new includes, and I'm not sure
> it'll actually converge to something  working.

Yeah, it's include hell. Looked at it and it's major churn.

> >> + */
> >> +struct cpu_entry_area
> >> +{
> >> +     char gdt[PAGE_SIZE];
> >> +};
> >> +
> >> +#define CPU_ENTRY_AREA_PAGES (sizeof(struct cpu_entry_area) / PAGE_SIZE)
> >
> >> +static inline unsigned int __get_cpu_entry_area_page_index(int cpu, int page)
> >> +{
> >> +     BUILD_BUG_ON(sizeof(struct cpu_entry_area) % PAGE_SIZE != 0);
> >> +
> >> +     return FIX_CPU_ENTRY_AREA_BOTTOM - cpu*CPU_ENTRY_AREA_PAGES - page;
> >> +}
> >> +
> >> +#define __get_cpu_entry_area_offset_index(cpu, offset) ({            \
> >> +     BUILD_BUG_ON(offset % PAGE_SIZE != 0);                          \
> >> +     __get_cpu_entry_area_page_index(cpu, offset / PAGE_SIZE);       \
> >> +     })
> >> +
> >> +#define get_cpu_entry_area_index(cpu, field)                         \
> >> +     __get_cpu_entry_area_offset_index((cpu), offsetof(struct cpu_entry_area, field))
> >
> > Any reason why those need to be macros?
> 
> The former is a macro because I doubt that BUILD_BUG_ON is valid in
> that context in a function.

Fair enough.

> The latter is a macro because 'field' is a name, not a value.

Bah. right. 

Thanks,

	tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ