From: Jiri Kosina <jikos@kernel.org>
To: Kees Cook <keescook@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Andy Lutomirski <luto@kernel.org>, Jann Horn <jannh@google.com>,
Ingo Molnar <mingo@kernel.org>, Laura Abbott <labbott@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Al Viro <viro@zeniv.linux.org.uk>,
Sahara <keun-o.park@darkmatter.ae>,
"Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>,
Michal Hocko <mhocko@suse.com>,
Andrea Arcangeli <aarcange@redhat.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
linux-kernel@vger.kernel.org,
kernel-hardening@lists.openwall.com
Subject: [kernel-hardening] Re: [PATCH] fork: Allow stack to be wiped on fork
Date: Fri, 26 Jan 2018 23:31:01 +0100 (CET) [thread overview]
Message-ID: <alpine.LRH.2.00.1801262330200.27010@gjva.wvxbf.pm> (raw)
In-Reply-To: <alpine.LRH.2.00.1801262259300.27010@gjva.wvxbf.pm>
On Fri, 26 Jan 2018, Jiri Kosina wrote:
> > diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
> > index 34f053a150a9..091f53fe31cc 100644
> > --- a/include/linux/thread_info.h
> > +++ b/include/linux/thread_info.h
> > @@ -43,7 +43,9 @@ enum {
> > #define THREAD_ALIGN THREAD_SIZE
> > #endif
> >
> > -#if IS_ENABLED(CONFIG_DEBUG_STACK_USAGE) || IS_ENABLED(CONFIG_DEBUG_KMEMLEAK)
> > +#if IS_ENABLED(CONFIG_DEBUG_STACK_USAGE) || \
> > + IS_ENABLED(CONFIG_DEBUG_KMEMLEAK) || \
> > + IS_ENABLED(CONFIG_CLEAR_STACK_FORK)
> > # define THREADINFO_GFP (GFP_KERNEL_ACCOUNT | __GFP_ZERO)
> > #else
> > # define THREADINFO_GFP (GFP_KERNEL_ACCOUNT)
> > diff --git a/kernel/fork.c b/kernel/fork.c
> > index 2295fc69717f..215b1ce2b2cd 100644
> > --- a/kernel/fork.c
> > +++ b/kernel/fork.c
> > @@ -215,7 +215,7 @@ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node)
> > if (!s)
> > continue;
> >
> > -#ifdef CONFIG_DEBUG_KMEMLEAK
> > +#if IS_ENABLED(CONFIG_DEBUG_KMEMLEAK) || IS_ENABLED(CONFIG_CLEAR_STACK_FORK)
> > /* Clear stale pointers from reused stack. */
> > memset(s->addr, 0, THREAD_SIZE);
> > #endif
>
> Is there any good reason not to do it symmetricaly also for non-vmapped
> stacks? (by passing __GFP_ZERO to alloc_pages_node())?
Ah, of course you already do by extending THREADINFO_GFP, sorry for the
noise.
--
Jiri Kosina
next prev parent reply other threads:[~2018-01-26 22:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-17 5:50 Kees Cook
2018-01-17 9:17 ` Michal Hocko
2018-01-19 19:16 ` [kernel-hardening] " Laura Abbott
2018-01-26 22:01 ` Jiri Kosina
2018-01-26 22:31 ` Jiri Kosina [this message]
2018-02-21 0:31 ` Andrew Morton
2018-02-21 1:56 ` Andy Lutomirski
2018-02-22 9:47 ` Mel Gorman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LRH.2.00.1801262330200.27010@gjva.wvxbf.pm \
--to=jikos@kernel.org \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.levin@verizon.com \
--cc=jannh@google.com \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=keun-o.park@darkmatter.ae \
--cc=kirill.shutemov@linux.intel.com \
--cc=labbott@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mhocko@suse.com \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®