All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	linux-kernel@vger.kernel.org,
	Arjan van de Ven <arjan@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v2] task_struct: stack_canary is not needed without CC_STACKPROTECTOR
Date: Tue, 18 Aug 2009 15:43:28 +0200	[thread overview]
Message-ID: <20090818134328.GA28366@elte.hu> (raw)
In-Reply-To: <4A8A5FD4.5070908@ct.jp.nec.com>


* Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> wrote:

> Andi Kleen wrote:
> > Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> writes:
> > 
> >> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> >>
> >> The field stack_canary is only used with CC_STACKPROTECTOR.
> >> This patch reduces task_struct size without CC_STACKPROTECTOR.
> > 
> > Adding a ifdef in the middle of a widely used structure is 
> > nasty.  It means that if someone changes the option then the 
> > newly loaded modules don't work anymore (yes that's not 
> > officially supported, but works most of the time and is often 
> > convenient in practice)

( Ugh. Not having clean builds and clean modules is utterly 
  dangerous and taints the kernel. I ignore all bugreports from
  people that do that - a kernel that has been butchered like that
  is just not trustable. )

> > So when you add a ifdef please move the field to the end at 
> > least.

Moving the stack canary it last is futile and makes no sense 
whatsoever, for three independent reasons:

It's stupidly shortsighted: there's 20 other config options in the 
middle of struct task struct already. Half of struct task_struct is
#ifdef-ed, and there can only be one 'last' field.

It's merge unfriendly: moving fields last in structs can cause 
patch conflict problems: new subsystems/features tend to append to 
task_struct, colliding with this patch. task_struct is frequently 
patched.

It hurts performance: the canary is used very frequently on 
stackprotector kernels and has been placed on a hot cacheline 
intentionally. Moving it last just adds a small but real 
performance regression.

Really, Andi, if you give 'advice' like this you should be declared 
armed and dangerous ... ;-)

> Here's the update.

I've applied v1, thanks Hiroshi!

	Ingo

  reply	other threads:[~2009-08-18 13:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-18  6:06 [PATCH] task_struct: stack_canary is not needed without CC_STACKPROTECTOR Hiroshi Shimamoto
2009-08-18  7:34 ` Andi Kleen
2009-08-18  8:01   ` [PATCH v2] " Hiroshi Shimamoto
2009-08-18 13:43     ` Ingo Molnar [this message]
2009-08-18 13:48 ` [tip:sched/core] sched, " tip-bot for Hiroshi Shimamoto

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=20090818134328.GA28366@elte.hu \
    --to=mingo@elte.hu \
    --cc=andi@firstfloor.org \
    --cc=arjan@infradead.org \
    --cc=h-shimamoto@ct.jp.nec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.