public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Rich Felker <dalias@libc.org>
To: Jeff Law <law@redhat.com>
Cc: Szabolcs Nagy <szabolcs.nagy@arm.com>,
	Florian Weimer <fweimer@redhat.com>,
	James Greenhalgh <james.greenhalgh@arm.com>,
	nd@arm.com, GNU C Library <libc-alpha@sourceware.org>,
	Richard Earnshaw <Richard.Earnshaw@arm.com>,
	Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Subject: Re: [RFC] nptl: change default stack guard size of threads
Date: Wed, 20 Dec 2017 04:49:00 -0000	[thread overview]
Message-ID: <20171220044744.GV1627@brightrain.aerifal.cx> (raw)
In-Reply-To: <5194e219-78fd-80a0-e91a-9af7ac86dbe0@redhat.com>

On Tue, Dec 19, 2017 at 09:41:03PM -0700, Jeff Law wrote:
> On 12/19/2017 01:34 PM, Rich Felker wrote:
> > On Tue, Dec 19, 2017 at 06:21:32PM +0000, Szabolcs Nagy wrote:
> >> On 19/12/17 13:06, Florian Weimer wrote:
> >>> On 12/19/2017 01:34 PM, James Greenhalgh wrote:
> >>>
> >>>> Option 1: 64k guard pages for LP64 on AArch64.
> >>>
> >>>> Option 2: 4k guard pages for LP64 for AArch64
> >>>
> >>>> Our proposal then, having spoken things through with the Arm engineers
> >>>> here, and taken in to consideration the opinions on this thread, is that
> >>>> we move to two "blessed" configurations of the GCC support for AArch64.
> >>>
> >>> Are there any Arm engineers who prefer Option 2, or is that just there to accommodate feedback on libc-alpha?
> >>>
> >>> My main concern was the variance in configurations with Option 1 (compared to Option 2).  To some extent, the
> >>> variance with Option 1 is temporary.  If both Option 1 and 2 are offered, we have permanent variance.  From my
> >>> point of view, that's worth that just going with Option 1.
> >>>
> >>> So if this is some sort of consensus proposal, as opposed to actual technical requirements which favor Option 2
> >>> in some deployments, I think that's not a good idea, and we should go with Option 1 instead.
> >>>
> >>
> >> well glibc can pretend that only Option 1 is available,
> >> my latest patch assumes 64k probe interval:
> >> https://sourceware.org/ml/libc-alpha/2017-12/msg00451.html
> >>
> >> however Option 1 requires generic code to be changed
> >> for aarch64 only (in the libc and elsewhere) and we
> >> cannot easily do that on all (non-glibc) systems.
> >>
> >> it seems to me if there are systems where Option 1
> >> may not provide guaranteed trap on stack overflow
> >> then gcc should have Option 2 for those systems.
> > 
> > For what it's worth, I would prefer having the assumed minimum guard
> > size be 4k for musl targets. Even if we do increase the default guard
> > to 64k for 64-bit archs (seems likely), applications that manually set
> > it lower for whatever reason should still be handled safely.
> > 
> > I'm utterly unconvinced that there's any practical measurable
> > performance difference either way, unless someone can demonstrate an
> > existing real-world program (not artificial benchmark) where the
> > difference is measurable.
> I've believed all along that stack clash probing as implemented by GCC
> is pretty damn cheap -- cheap enough that we ought to just turn it on by
> default and move on to other more useful work items.  And I hold that
> position regardless of whether or not the guard is 4k or 64k.
> 
> 64k is marginally better simply because there's less probing,
> particularly in a functions that allocate something like char array of
> MAXPATHLEN entries.  Based on what I've looked at on a distro-wide
> basis, MAXPATHLEN arrays on the stack are the single biggest reasons we
> have to probe in prologues.

They're also almost certainly indicative of the function making
syscalls, in which case <10 instructions for a probe are completely
dominated by the syscall time (hundreds if not thousands of times
larger).

Rich

  reply	other threads:[~2017-12-20  4:49 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-29 14:59 Szabolcs Nagy
2017-11-29 15:18 ` Florian Weimer
2017-11-29 18:17   ` Carlos O'Donell
2017-11-29 18:29     ` Rich Felker
2017-11-29 20:33       ` Florian Weimer
2017-11-29 18:40   ` Szabolcs Nagy
2017-11-29 20:44     ` Florian Weimer
2017-11-29 20:52       ` Rich Felker
2017-11-29 21:02         ` Florian Weimer
2017-11-29 23:13           ` Szabolcs Nagy
2017-12-05 10:55           ` James Greenhalgh
2017-12-06 12:51             ` Florian Weimer
2017-12-11 23:49             ` Jeff Law
2017-12-12 11:43               ` Szabolcs Nagy
2017-12-12 16:36                 ` Rich Felker
2017-12-12 18:07                   ` Szabolcs Nagy
2017-12-12 19:30               ` Florian Weimer
2017-12-13 11:58                 ` Szabolcs Nagy
2017-12-19 12:35             ` James Greenhalgh
2017-12-19 13:06               ` Florian Weimer
2017-12-19 18:21                 ` Szabolcs Nagy
2017-12-19 20:34                   ` Rich Felker
2017-12-20  4:42                     ` Jeff Law
2017-12-20  4:49                       ` Rich Felker [this message]
2017-12-27 13:08                         ` Wilco Dijkstra
2017-12-20  4:45                 ` Jeff Law
2017-11-29 22:28       ` Wilco Dijkstra
2017-11-29 22:38         ` Carlos O'Donell
2017-12-06 12:53           ` Florian Weimer
2017-12-06 13:10             ` Wilco Dijkstra
2017-12-06 13:13               ` Florian Weimer
2017-11-29 23:02         ` Rich Felker
2017-12-06 13:16         ` Florian Weimer
2017-12-06 13:40           ` Joseph Myers
2017-12-06 13:51             ` Florian Weimer
2017-12-06 14:44             ` Jeff Law
2017-12-06 14:27           ` Wilco Dijkstra
2017-12-06 20:41             ` Szabolcs Nagy
2017-12-06 21:24               ` Adhemerval Zanella
2017-12-06 22:08               ` Rich Felker
2017-12-08 18:28                 ` Szabolcs Nagy
2017-11-29 22:45       ` Szabolcs Nagy

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=20171220044744.GV1627@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=Richard.Earnshaw@arm.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=fweimer@redhat.com \
    --cc=james.greenhalgh@arm.com \
    --cc=law@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=nd@arm.com \
    --cc=szabolcs.nagy@arm.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).