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:	Fri, 4 Sep 2009 08:57:45 +0200
From:	Ingo Molnar <mingo@...e.hu>
To:	Catalin Marinas <catalin.marinas@....com>
Cc:	x86@...nel.org, linux-kernel@...r.kernel.org,
	Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH 1/2] kmemleak: Inform kmemleak about kernel stack
	allocation


* Catalin Marinas <catalin.marinas@....com> wrote:

> On Mon, 2009-08-31 at 10:45 +0200, Ingo Molnar wrote:
> > * Catalin Marinas <catalin.marinas@....com> wrote:
> > 
> > > On Sat, 2009-08-29 at 15:29 +0200, Ingo Molnar wrote:
> > > > * Catalin Marinas <catalin.marinas@....com> wrote:
> [...]
> > > > > diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
> > > > > index fad7d40..f26432a 100644
> > > > > --- a/arch/x86/include/asm/thread_info.h
> > > > > +++ b/arch/x86/include/asm/thread_info.h
> > > > > @@ -162,7 +162,12 @@ struct thread_info {
> > > > >  #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
> > > > >  
> > > > >  #define alloc_thread_info(tsk)						\
> > > > > -	((struct thread_info *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER))
> > > > > +({									\
> > > > > +	struct thread_info *ti = (struct thread_info *)			\
> > > > > +		__get_free_pages(THREAD_FLAGS, THREAD_ORDER);		\
> > > > > +	kmemleak_alloc(ti, THREAD_SIZE, 1, THREAD_FLAGS);		\
> > > > > +	ti;								\
> > > > > +})
> > > > 
> > > > Sidenote:this used to be a trivial wrapper to gfp so it was 
> > > > borderline OK as a CPP macro - now it's a non-trivial CPP wrapper 
> > > > macro which is not OK. Mind converting it to an inline function?
> > > 
> > > I tried this first but got compilation errors in files that didn't 
> > > even call this function. To make it workable, thread_info.h would 
> > > need to include additional headers. If that's acceptable, I can 
> > > post an updated patch.
> > 
> > I havent tried the patch myself, but by your description those build 
> > problems seem to be pre-existing include file dependency problems 
> > that should be tracked down and resolved - instead of widening them 
> > by adding even more hidden dependencies via CPP macros.
> 
> I tried to move to an inline function and linux/gfp.h is needed for
> __get_free_pages() and GFP_* macros. This leads to some complicated
> circular dependencies like below:
> 
>   CC      arch/x86/kernel/asm-offsets.s
> In file included from /work/Linux/2.6/linux-2.6-arm/include/linux/mmzone.h:9,
>                  from /work/Linux/2.6/linux-2.6-arm/include/linux/gfp.h:4,
>                  from /work/Linux/2.6/linux-2.6-arm/arch/x86/include/asm/thread_info.h:22,
>                  from /work/Linux/2.6/linux-2.6-arm/include/linux/thread_info.h:56,
>                  from /work/Linux/2.6/linux-2.6-arm/include/linux/preempt.h:9,
>                  from /work/Linux/2.6/linux-2.6-arm/include/linux/spinlock.h:50,
>                  from /work/Linux/2.6/linux-2.6-arm/include/linux/seqlock.h:29,
>                  from /work/Linux/2.6/linux-2.6-arm/include/linux/time.h:8,
>                  from /work/Linux/2.6/linux-2.6-arm/include/linux/stat.h:60,
>                  from /work/Linux/2.6/linux-2.6-arm/include/linux/module.h:10,
>                  from /work/Linux/2.6/linux-2.6-arm/include/linux/crypto.h:21,
>                  from /work/Linux/2.6/linux-2.6-arm/arch/x86/kernel/asm-offsets_32.c:7,
>                  from /work/Linux/2.6/linux-2.6-arm/arch/x86/kernel/asm-offsets.c:2:
> include/linux/wait.h|51| error: expected specifier-qualifier-list before ???spinlock_t???
> 
> The linux/mmzone.h file normally includes linux/spinlock.h but the 
> reverse is also true when the latter includes the former via 
> thread_info.h and gfp.h. Because of the (correct) guards in the 
> header files, the spinlock_t definition is no longer available in 
> mmzone.h.

mmzone.h probably should not include spinlock.h (which is heavy) - 
it should include spinlock_types.h (which is lighter). It only needs 
the type definitions and none of the API definitions.

	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