|
Message-ID: <alpine.LNX.2.20.13.1608150031190.11152@monopod.intra.ispras.ru> Date: Mon, 15 Aug 2016 01:11:23 +0300 (MSK) From: Alexander Monakov <amonakov@...ras.ru> To: Rob Landley <rob@...dley.net> cc: Rich Felker <dalias@...ifal.cx>, musl@...ts.openwall.com Subject: Re: Re: sysconf(_SC_ARG_MAX) broken in musl. 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
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.