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: <YukGwkzicp+aNLXx@gmail.com>
Date:   Tue, 2 Aug 2022 13:13:06 +0200
From:   Ingo Molnar <mingo@...nel.org>
To:     Sander Vanheule <sander@...nheule.net>
Cc:     linux-kernel@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Brendan Higgins <brendanhiggins@...gle.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        David Gow <davidgow@...gle.com>,
        Borislav Petkov <bp@...en8.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "H . Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
        MaĆ­ra Canal <mairacanal@...eup.net>,
        Marco Elver <elver@...gle.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Valentin Schneider <vschneid@...hat.com>,
        Yury Norov <yury.norov@...il.com>
Subject: Re: [PATCH v5 1/5] x86/cacheinfo: move shared cache map definitions


* Sander Vanheule <sander@...nheule.net> wrote:

> The maps to keep track of shared caches between CPUs on SMP systems are
> declared in asm/smp.h, among them specifically cpu_llc_shared_map.  These
> maps are externally defined in cpu/smpboot.c.  The latter is only compiled
> on CONFIG_SMP=y, which means the declared extern symbols from asm/smp.h do
> not have a corresponding definition on uniprocessor builds.
> 
> The inline cpu_llc_shared_mask() function from asm/smp.h refers to the map
> declaration mentioned above.  This function is referenced in cacheinfo.c
> inside for_each_cpu() loop macros, to provide cpumask for the loop.  On
> uniprocessor builds, the symbol for the cpu_llc_shared_map does not exist.
> However, the current implementation of for_each_cpu() also (wrongly)
> ignores the provided mask.
> 
> By sheer luck, the compiler thus optimises out this unused reference to
> cpu_llc_shared_map, and the linker therefore does not require the
> cpu_llc_shared_mask to actually exist on uniprocessor builds.  Only on SMP
> bulids does smpboot.o exist to provide the required symbols.
> 
> To no longer rely on compiler optimisations for successful uniprocessor
> builds, move the definitions of cpu_llc_shared_map and cpu_l2c_shared_map
> from smpboot.c to cacheinfo.c.
> 
> Signed-off-by: Sander Vanheule <sander@...nheule.net>
> Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Cc: Marco Elver <elver@...gle.com>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Valentin Schneider <vschneid@...hat.com>
> Cc: Yury Norov <yury.norov@...il.com>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: "H. Peter Anvin" <hpa@...or.com>
> ---
> Changes since v3:
> - New patch
> 
>  arch/x86/kernel/cpu/cacheinfo.c | 6 ++++++
>  arch/x86/kernel/smpboot.c       | 4 ----
>  2 files changed, 6 insertions(+), 4 deletions(-)

Reviewed-by: Ingo Molnar <mingo@...nel.org>

I'm also fine with you guys carrying this in the bitmap tree - the x86 
impact is incidental.

Thanks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ