LWN: Comments on "Ktap — yet another kernel tracer" https://lwn.net/Articles/551314/ This is a special feed containing comments posted to the individual LWN article titled "Ktap — yet another kernel tracer". en-us Mon, 20 Oct 2025 21:43:36 +0000 Mon, 20 Oct 2025 21:43:36 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Loops https://lwn.net/Articles/552361/ https://lwn.net/Articles/552361/ bluss <div class="FormattedComment"> I looked into the ktap code, it's interesting to see how much of the Lua VM and seeminly its table implementation is there.<br> <p> So if it's like Lua's tables, then you can delete key-value pairs during iteration fine, but you shouldn't add key-value pairs during iteration; if you do, I think iteration is unpredictable.<br> <p> I think it's a bit misleading that no notice is given in the license header of the files with copies of lua code (even if lua authors are credited elsewhere). It becomes misleading when the file lists 'Author:' without declaring all of them.<br> <p> <a rel="nofollow" href="https://github.com/ktap/ktap/blob/master/interpreter/table.c">https://github.com/ktap/ktap/blob/master/interpreter/table.c</a><br> <p> <a rel="nofollow" href="http://www.lua.org/source/5.2/ltable.c.html">http://www.lua.org/source/5.2/ltable.c.html</a><br> </div> Fri, 31 May 2013 02:46:58 +0000 Loops https://lwn.net/Articles/551940/ https://lwn.net/Articles/551940/ nix <div class="FormattedComment"> As long as the integer iteration and table iteration don't contain a way for the current loop value to be changed during the loop, that should be OK. I wonder what happens if you change a table while iterating over it... you *can* make that have defined, consistent, and always-terminating behaviour (I did it in a C hash table once) but it tends to lead to rather complex iterators which I doubt have been implemented here. (In my case, about 40% of the code of the iterator was to deal with the stable-iteration-over-mutation case.)<br> <p> </div> Mon, 27 May 2013 20:52:28 +0000 Loops https://lwn.net/Articles/551614/ https://lwn.net/Articles/551614/ corbet From what I can tell, ktap's loops are limited to bounded integer iteration (a Fortran "DO" loop, essentially) or iterating over a table. So, while the execution time could be unacceptably high, everything <i>should</i> terminate. Thu, 23 May 2013 13:31:45 +0000 Ktap — yet another kernel tracer https://lwn.net/Articles/551569/ https://lwn.net/Articles/551569/ nix <div class="FormattedComment"> I note that, unlike DTrace, the ktap language implements loops, which were intentionally left out of D (the DTrace language) because as soon as your language has loops and conditionals you cannot prove that execution will terminate in the general case without slamming into the halting problem, and that also constrains proof of all sorts of other properties about the code, since an awful lot of them reduce to the halting problem again. The most you can do in a constrained environment like the kernel is to impose a timeout on script execution.<br> <p> Of course, in a privileged tracer there are lots of other ways to cause trouble inside the kernel, and there is not yet any DTrace port for Linux which implements unprivileged tracing -- but at least unprivileged tracing is implementable there. I don't see how it could be implemented in ktap without a crude timeout or something of that ilk. Nonetheless, ktap looks very interesting and I am cheering from the sidelines, since a bytecode interpreter is much more elegant than the module-compilation approach taken by SystemTap.<br> <p> (one note: DTrace for Linux is available to everyone, not just paying customers, though you do need to use the UEK2 kernel. The source for the userspace component I work on is not available, though :( )<br> <p> </div> Thu, 23 May 2013 09:05:27 +0000