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:	Sat, 29 Aug 2009 15:28:03 +0100
From:	Catalin Marinas <catalin.marinas@....com>
To:	Ingo Molnar <mingo@...e.hu>
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

On Sat, 2009-08-29 at 15:29 +0200, Ingo Molnar wrote:
> * Catalin Marinas <catalin.marinas@....com> wrote:
> 
> > Traversing all the tasks in the system for scanning the kernel 
> > stacks requires locking which increases the kernel latency 
> > considerably. This patch informs kmemleak about newly allocated or 
> > freed stacks so that they are treated as any other allocated 
> > object. Subsequent patch will remove the explicit stack scanning 
> > from mm/kmemleak.c.
> > 
> > Signed-off-by: Catalin Marinas <catalin.marinas@....com>
> > Cc: Ingo Molnar <mingo@...hat.com>
> > ---
> >  arch/x86/include/asm/thread_info.h |    7 ++++++-
> >  arch/x86/kernel/process.c          |    2 ++
> >  kernel/fork.c                      |    7 ++++++-
> >  3 files changed, 14 insertions(+), 2 deletions(-)
> > 
> > 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.

Thanks.

-- 
Catalin

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