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: <20120212111914.GC21493@elte.hu>
Date:	Sun, 12 Feb 2012 12:19:15 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Kevin Winchester <kjwinchester@...il.com>
Cc:	"H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Borislav Petkov <bp@...en8.de>,
	Randy Dunlap <rdunlap@...otime.net>,
	Nick Bowler <nbowler@...iptictech.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86: Move per cpu cpu_llc_shared_map to a field in
 struct cpuinfo_x86


* Kevin Winchester <kjwinchester@...il.com> wrote:

> On 11 February 2012 20:24, Kevin Winchester <kjwinchester@...il.com> wrote:
> > Commit 141168c36cde ("x86: Simplify code by removing a !SMP #ifdefs from
> > 'struct cpuinfo_x86'") caused the compilation error:
> >
> > mce_amd.c:(.cpuinit.text+0x4723): undefined reference to 'cpu_llc_shared_map'
> >
> > by removing an #ifdef CONFIG_SMP around a block containing a reference
> > to cpu_llc_shared_map.  Rather than replace the #ifdef, move
> > cpu_llc_shared_map to be a new field llc_shared_map in struct
> > cpuinfo_x86 and adjust all references to cpu_llc_shared_map.
> >
> > Signed-off-by: Kevin Winchester <kjwinchester@...il.com>
> > ---
> >  arch/x86/include/asm/processor.h      |    1 +
> >  arch/x86/include/asm/smp.h            |    6 ------
> >  arch/x86/kernel/cpu/intel_cacheinfo.c |    4 ++--
> >  arch/x86/kernel/cpu/mcheck/mce_amd.c  |    7 ++++---
> >  arch/x86/kernel/smpboot.c             |   15 ++++++---------
> >  arch/x86/xen/smp.c                    |    1 -
> >  6 files changed, 13 insertions(+), 21 deletions(-)
> >
> >
> >  static void impress_friends(void)
> > @@ -1053,7 +1051,6 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
> >        for_each_possible_cpu(i) {
> >                zalloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL);
> >                zalloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL);
> > -               zalloc_cpumask_var(&per_cpu(cpu_llc_shared_map, i), GFP_KERNEL);
> >        }
> >        set_cpu_sibling_map(0);
> >
> > diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
> > index 041d4fe..a898ed5 100644
> > --- a/arch/x86/xen/smp.c
> > +++ b/arch/x86/xen/smp.c
> > @@ -225,7 +225,6 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
> >        for_each_possible_cpu(i) {
> >                zalloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL);
> >                zalloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL);
> > -               zalloc_cpumask_var(&per_cpu(cpu_llc_shared_map, i), GFP_KERNEL);
> >        }
> >        set_cpu_sibling_map(0);
> >
> 
> I just realized that I took out a couple of allocations here 
> for cpu_llc_shared_map, without replacing them.  Am I leaving 
> cpuinfo_x86.llc_shared_map unallocated then, and just writing 
> to whatever address that field happened to get?

That will probably crash CONFIG_CPUMASK_OFFSTACK=y kernels.

The simplest approach would be to use a cpumask_t (i.e. not a 
variable cpumask_var_t one), on the [valid looking] assumption 
that cpuinfo_x86 gets allocated in sane ways - i.e. never on the 
kernel stack and such.

The before/after vmlinux 'size' result should be inspected, with 
NR_CPUs set to 4096 and OFFSTACK activated in the .config, to 
see how bad the size effect is - but I think it should not be 
too bad.

Thanks,

	Ingo
--
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