LWN.net Logo

Conservative Automatic Stack Size Check

Conservative Automatic Stack Size Check

Posted Sep 9, 2005 1:58 UTC (Fri) by sethml (subscriber, #8471)
In reply to: Conservative Automatic Stack Size Check by pkolloch
Parent article: 4K stacks for everyone?

Clever idea, but you missed a case that's hard to deal with: calling through function pointers. The kernel uses function pointers extensively, especially for device drivers. I suspect the case mentioned involving RAID involves calling through quite a few levels of function pointers. Figuring out the maximum possible call stack depth, even very conservatively, is probably pretty difficult, and the conservative answer is probably "infinite" because there are pathways you could construct that would recurse, even if that never happens in practice.


(Log in to post comments)

Conservative Automatic Stack Size Check

Posted Sep 9, 2005 9:29 UTC (Fri) by pkolloch (subscriber, #21709) [Link]

hmmm, you are right, I knew I had been naive, but I couldn't see what I missed.

Since from what I saw about the VFS, it's a shame that it is not expressed in an object oriented fashion. That could at least limit the amount of candidates. Maybe one could provide some annotations?

But I can well imagine that especially concepts as unionfs which wrap other file systems could in principle be wrapped around each other infinitely. You would have too make up some clever notation to tell the stack analyzer that this really isn't possible. (If there is even such a check ;) ) Or is it done in some clever fashion that the wrapped and the wrapper are not called in a nested fashion, but in some kind of chaining way for exactly the purpose of saving stack space?

[Disclaimer: Again, I have no real clue about the kernel source, so I hope my assumptions are not totally off the beat.]

Conservative Automatic Stack Size Check

Posted Sep 10, 2005 21:03 UTC (Sat) by joern (subscriber, #22392) [Link]

FYI: Function pointers are not that hard to follow. See
http://wh.fh-wedel.de/~joern/quality.pdf

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds