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: <20060921204242.53a88487.akpm@osdl.org>
Date:	Thu, 21 Sep 2006 20:42:42 -0700
From:	Andrew Morton <akpm@...l.org>
To:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc:	kmannth@...ibm.com, linux-kernel@...r.kernel.org,
	clameter@...r.sgi.com
Subject: Re: [BUG] i386 2.6.18 cpu_up: attempt to bring up CPU 4 failed :
 kernel BUG at mm/slab.c:2698!

On Fri, 22 Sep 2006 12:30:45 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:

> On Thu, 21 Sep 2006 20:08:06 -0700
> Andrew Morton <akpm@...l.org> wrote:
> 
> > But why did the kmalloc() fail?
> > 
> > 
> from this:
> 
> ==
> #define NOTIFY_DONE             0x0000          /* Don't care */
> #define NOTIFY_OK               0x0001          /* Suits me */
> #define NOTIFY_STOP_MASK        0x8000          /* Don't call further */
> #define NOTIFY_BAD              (NOTIFY_STOP_MASK|0x0002)
> ==
> 
> I gues someone returns NOTIFY_BAD before pageset_cpuup_callback() is called.
> When CPU_UP_CANCELED comes, pageset_cpuup_callback() can't know zone_pcp()
> is kmalloced or not. Is this ugly ?
> 
> -Kame
> 
> Before kfree(), we should check zone_pcp() is not boot_pageset[].
> 
> Signed-Off-By KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
> 
> Index: linux-2.6.18/mm/page_alloc.c
> ===================================================================
> --- linux-2.6.18.orig/mm/page_alloc.c	2006-09-20 12:42:06.000000000 +0900
> +++ linux-2.6.18/mm/page_alloc.c	2006-09-22 12:22:03.000000000 +0900
> @@ -1844,9 +1844,11 @@
>  
>  	for_each_zone(zone) {
>  		struct per_cpu_pageset *pset = zone_pcp(zone, cpu);
> -
> -		zone_pcp(zone, cpu) = NULL;
> -		kfree(pset);
> +		/* When canceled, zone_pcp still points to boot_pageset[] */
> +		if (zone_pcp(zone, cpu) != &boot_pageset[cpu]) {
> +			zone_pcp(zone, cpu) = NULL;
> +			kfree(pset);
> +		}
>  	}
>  }
>  

No, that's OK as it is now.  The above code is numa-only, in which case
zone_pcp(zone, cpu) is known to be kmalloced.  These functions won't even
compile on !NUMA because in that case, zone_pcp() isn't an lvalue.

OBCodingStyleNit: could we pleeeeeze not go and use macros as lvalues like
this?  It looks just too weird.  Simply do zone_pcp(zone, cpu) and
set_zone_pcp(zone, cpu, val).
-
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