I did the same thing in my directory indexing patch, but with a much
larger buffer: 2728 bytes. I traced the path from the syscall and all
the paths out as well. I did cause a stack overflow with this because
gcc took the union of two such allocations in different control blocks
instead of the intersection, much to my surprise. This was cured by
using fancier code to eliminate one of the allocations. Al since broke
this out into a separate function, making it more obviously safe, but
note: it has to be broken out further so that there are no complex
trees of calls descending from the stack storage pig.
This call appends a new block to a file then splits the contents of
some other block into the new block using some workspace on the stack.
The block has to be appended outside the function, otherwise the big
stack allocation gets carried arbitrarily far through the kernel (think
recursive allocation). Similarly for mark_buffer_dirty and just to be
safe, brelse as well. Mark_buffer_dirty didn't use to have a big hairy
call chain attached to it but it does now. Even lowly brelse might
evolve this way without warning. The only safe thing to do is avoid
all calls outside the subystem and comment the others.
My question: assuming the entire call chain is documented, exactly how
much of the 8K kernel stack is safe to use?
-- Daniel - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/