On Oct 28, 2009, at 10:01 AM, Christoph Baumann wrote:

On 28.10.2009 14:39, Allon Stern wrote:
What's the stack size of the SSH client?
Remember, the uclinux runtime does not have a dynamic stack size.

currently it's 32k


Run "<toolchain-prefix>flthdr" on your target FLAT executable to read
the header.
flthdr -s lets you change the stack size. Try increasing the stack size.

Once you find an appropriate size, you can put it into the compile flags.

Are there any "good" known values for ssh?


Well, stack usage varies according to program structure, as well as call structure at runtime, so while static analysis can be a good starting point, if there is any recursion, it becomes non-deterministic.

For security critical functions, like OpenSSH, I'd question whether a non-mmu system is a good choice, especially without memory protection.

In any case, I'd recommend doubling the stack until you find a value that works, then back off by powers of two until it doesn't, then back up a couple of steps as a safety margin. Or, depending on how memory- rich you are, you can just leave it with a bunch of extra memory. So if 64K works, give it 128K of stack, for a good safety margin (which is still no guarantee you won't be vulnerable to a stack overflow).


-
allon
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to