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:	Wed, 8 Feb 2012 08:22:11 -0400
From:	Kevin Winchester <kjwinchester@...il.com>
To:	Borislav Petkov <bp@...en8.de>, Ingo Molnar <mingo@...e.hu>,
	Nick Bowler <nbowler@...iptictech.com>,
	Randy Dunlap <rdunlap@...otime.net>,
	"H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	LKML <linux-kernel@...r.kernel.org>,
	Kevin Winchester <kjwinchester@...il.com>
Subject: Re: MCE, AMD: Hide smp-only code around CONFIG_SMP

On 8 February 2012 06:19, Borislav Petkov <bp@...en8.de> wrote:
> On Tue, Feb 07, 2012 at 10:57:46AM +0100, Ingo Molnar wrote:
>> Could we please just define an obvious cpu_llc_shared_mask on UP
>> (one bit long and set to 1) and not reintroduce the ugly
>> #ifdef CONFIG_SMP?
>
> Ok, here's a tentative proposed solution where I was trying not to
> fatfinger the cpumask magic. Let me know if this is similar to what you
> had in mind. The call to cpu_llc_shared_mask(int cpu) on UP might cause
> a problem if the cpu arg is not 0 but it should not happen anyway and
> there should be other problems with the caller side anyway.
>
> Thanks.
>
> --
> From: Borislav Petkov <bp@...en8.de>
> Date: Tue, 7 Feb 2012 21:40:22 +0100
> Subject: [PATCH] MCE, AMD: Fix !CONFIG_SMP build
>
> 141168c36cde ("x86: Simplify code by removing a !SMP #ifdefs from
> 'struct cpuinfo_x86'") removed a bunch of CONFIG_SMP ifdefs around
> code touching struct cpuinfo_x86 members but also caused the
> following build error with Randy's randconfigs:
>
> mce_amd.c:(.cpuinit.text+0x4723): undefined reference to `cpu_llc_shared_map'
>
> Fix that by adding a UP version of the cpu_llc_shared_map, as Ingo
> suggested.
>
> Cc: Kevin Winchester <kjwinchester@...il.com>
> Cc: Ingo Molnar <mingo@...e.hu>
> Cc: Randy Dunlap <rdunlap@...otime.net>
> Link: http://lkml.kernel.org/r/4F298A6C.6010101@xenotime.net
> Signed-off-by: Borislav Petkov <bp@...en8.de>
> ---
>  arch/x86/include/asm/smp.h |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
> index 0434c40..118754f 100644
> --- a/arch/x86/include/asm/smp.h
> +++ b/arch/x86/include/asm/smp.h
> @@ -33,8 +33,15 @@ static inline bool cpu_has_ht_siblings(void)
>
>  DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_map);
>  DECLARE_PER_CPU(cpumask_var_t, cpu_core_map);
> -/* cpus sharing the last level cache: */
> +
> +#ifdef CONFIG_SMP
> +/* CPUs sharing the last level cache: */
>  DECLARE_PER_CPU(cpumask_var_t, cpu_llc_shared_map);
> +#else
> +static DECLARE_BITMAP(cpu_llc_shared_bits, NR_CPUS) __read_mostly = { [0] = 1UL };
> +static struct cpumask *const cpu_llc_shared_map = to_cpumask(cpu_llc_shared_bits);
> +#endif
> +
>  DECLARE_PER_CPU(u16, cpu_llc_id);
>  DECLARE_PER_CPU(int, cpu_number);
>
> --
> 1.7.9
>

Does this work?  arch/x86/kernel/cpu/mcheck/mce_amd.c includes
<linux/smp.h> rather than <asm/smp.h> directly.  And <linux/smp.h>
only includes <asm/smp.h> for the CONFIG_SMP case.  Or perhaps one of
the other includes in mce_amd.c includes <asm/smp.h>?

-- 
Kevin Winchester
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ