mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Alexander Monakov <amonakov@ispras.ru>
To: Rob Landley <rob@landley.net>
Cc: Rich Felker <dalias@aerifal.cx>, musl@lists.openwall.com
Subject: Re: Re: sysconf(_SC_ARG_MAX) broken in musl.
Date: Mon, 15 Aug 2016 01:11:23 +0300 (MSK)	[thread overview]
Message-ID: <alpine.LNX.2.20.13.1608150031190.11152@monopod.intra.ispras.ru> (raw)
In-Reply-To: <1524ba55-d337-e8a2-070a-ac554328fdf0@landley.net>

On Sun, 14 Aug 2016, Rob Landley wrote:
> What happens if your stack size is smaller than 131072? (Not
> stacksize/4, but stacksize total?) I haven't tried, but a quick glance
> looks like Bad Things. And on nommu systems, that may actually come up.

From reading the kernel source, I'm not sure what happens on nommu, but on mmu,
from what I see, what's left for the program is rlimit, minus argv/env/auxv size,
minus variable amount lost due to stack base randomization. In particular, yes,
if rlimit_stack is below 128K and cumulative argv size is high, execve can fail.

So is the concern that the reported sysconf(_SC_ARG_MAX) value is not useful
when stack limit is low? But to know how many arguments you can pass in this
highly constrained situation, you'd have to get rlimit, subtract environment
size (and not even the current environment size, but the environment you're
passing via execve), subtract the worst-case randomization loss, and finally
subtract the amount of stack the invoked program is going to need.

Alexander


      reply	other threads:[~2016-08-14 22:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bcf8d4b8-aee7-da0e-dffa-0f7cd9fdc30e@landley.net>
2016-08-10 20:36 ` Rich Felker
2016-08-14 20:20   ` Alexander Monakov
2016-08-14 20:41     ` Rob Landley
2016-08-14 22:11       ` Alexander Monakov [this message]

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.LNX.2.20.13.1608150031190.11152@monopod.intra.ispras.ru \
    --to=amonakov@ispras.ru \
    --cc=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    --cc=rob@landley.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).