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: <20081203115954.GH11656@erda.amd.com>
Date:	Wed, 3 Dec 2008 12:59:54 +0100
From:	Robert Richter <robert.richter@....com>
To:	Ingo Molnar <mingo@...e.hu>
CC:	Eric Dumazet <dada1@...mosbay.com>,
	Andi Kleen <ak@...ux.intel.com>,
	linux kernel <linux-kernel@...r.kernel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH] oprofile: fix CPU unplug panic in ppro_stop()

On 02.12.08 09:17:29, Ingo Molnar wrote:
> 
> * Eric Dumazet <dada1@...mosbay.com> wrote:
> 
> > If oprofile statically compiled in kernel, a cpu unplug triggers
> > a panic in ppro_stop(), because a NULL pointer is dereferenced.
> >
> > Signed-off-by: Eric Dumazet <dada1@...mosbay.com>
> > ---
> > arch/x86/oprofile/op_model_ppro.c |    4 ++++
> > 1 files changed, 4 insertions(+)
> 
> > diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
> > index 716d26f..e9f80c7 100644
> > --- a/arch/x86/oprofile/op_model_ppro.c
> > +++ b/arch/x86/oprofile/op_model_ppro.c
> > @@ -156,6 +156,8 @@ static void ppro_start(struct op_msrs const * const msrs)
> >  	unsigned int low, high;
> >  	int i;
> >  
> > +	if (!reset_value)
> > +		return;
> >
> > 	for (i = 0; i < num_counters; ++i) {
> >  		if (reset_value[i]) {
> >  			CTRL_READ(low, high, msrs, i);

The patch fixes the null pointer access and this ok. But the root
cause seems to be in the cpu hotplug and initialization
code. xxx_start() should not be called before xxx_setup_ctrs() or
after xxx_shutdown(). Also, running only xxx_start() and xxx_stop() in
the cpu notifier functions is not sufficient. There is at least some
on_each_cpu code in nmi_setup() that should be called also in the cpu
notifier functions. I have to review that code.

[...]

> It was absolutely unnecessary to add kmalloc to this rarely executed 
> codepath - and the way it was added was absolutely horrible as well, it 
> was tacked on in the middle of an existing codepath, instead of factoring 
> it out nicely. Perfmon will eventually replace PMC management anyway, so 
> there was no "this way it's cleaner" argument either. So this code should 
> have been changed minimally, instead of slapping in a full kmalloc for a 
> simple array extension from 2 to 4 entries ...

Ingo, you are right that using kmalloc is unnecessary for
reset_value. So, Andi, maybe you could make this code easier?

-Robert

-- 
Advanced Micro Devices, Inc.
Operating System Research Center
email: robert.richter@....com

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