mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chuck Ebbert <cebbert@redhat.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Arjan van de Ven <arjan@infradead.org>,
	Dave Jones <davej@redhat.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	esandeen@redhat.com, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: XFS stack overhead
Date: Wed, 21 Oct 2009 16:22:31 -0400	[thread overview]
Message-ID: <20091021162231.0238a79c@katamari.usersys.redhat.com> (raw)
In-Reply-To: <4ADF5F52.10508@redhat.com>

On Wed, 21 Oct 2009 14:21:54 -0500
Eric Sandeen <sandeen@redhat.com> wrote:

> > Also, the posting apparently mixes 'stack overhead' with 'runtime 
> > overhead'.
> 
> right, that's why I asked, I'm not sure if stackprotector has runtime
> overhead as well.
> 

A bigger stack causes runtime overhead too because it increases the cache
footprint of the workload.

For the function I looked at the insn overhead was substantial:

On entry:
ffffffff8113ffa0:       48 83 ec 10             sub    $0x10,%rsp
...
ffffffff8113ffa9:       65 48 8b 04 25 28 00    mov    %gs:0x28,%rax
ffffffff8113ffb0:       00 00
ffffffff8113ffb2:       48 89 45 f8             mov    %rax,-0x8(%rbp)

On exit:
ffffffff81140000:       48 8b 55 f8             mov    -0x8(%rbp),%rdx
ffffffff81140004:       65 48 33 14 25 28 00    xor    %gs:0x28,%rdx
ffffffff8114000b:       00 00
ffffffff8114000d:       74 13                   je     ffffffff81140022 <mem_cgroup_get_reclaim_stat_from_page+0x86>
...
ffffffff8114001d:       e8 ef 42 f2 ff          callq  ffffffff81064311 <__stack_chk_fail>

So that's 37 extra bytes of code: 1 subtract, 4 reg/mem moves, an xor
and a conditional jump that always get executed -- on every function
call.

And all that, in this case, for a function that doesn't even have any
on-stack variables and can hardly be expected to be vulnerable to
stack-smashing attacks.

  reply	other threads:[~2009-10-21 20:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-15 18:35 Unnecessary overhead with stack protector Dave Jones
2009-10-15 19:07 ` Ingo Molnar
2009-10-21 15:50   ` Eric Sandeen
2009-10-21 18:00     ` Arjan van de Ven
2009-10-21 18:59       ` Eric Sandeen
2009-10-21 19:09         ` Eric Sandeen
2009-10-21 19:24           ` Eric Sandeen
2009-10-21 21:08             ` Chuck Ebbert
2009-10-21 19:16         ` XFS stack overhead Ingo Molnar
2009-10-21 19:21           ` Eric Sandeen
2009-10-21 20:22             ` Chuck Ebbert [this message]
2009-10-22  1:26 ` Unnecessary overhead with stack protector Andrew Morton
2009-10-26 16:30   ` Chuck Ebbert
2009-10-26 16:37     ` Andrew Morton
2009-10-26 16:56       ` Chuck Ebbert
2009-10-26 20:03         ` Ingo Molnar

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=20091021162231.0238a79c@katamari.usersys.redhat.com \
    --to=cebbert@redhat.com \
    --cc=arjan@infradead.org \
    --cc=davej@redhat.com \
    --cc=esandeen@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sandeen@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome