My Own Private Binary: An Idiosyncratic Introduction to Linux Kernel Modules
muppetlabs.com
muppetlabs.com
The kernel module does not check any binary meta data, instead it just checks for the file extension ("*.com"). There is no actual format, only a flat binary that is loaded into memory and executed, just like *.com executables on MS DOS.
This allows the author to create really tiny exectuables.
See also this series on ELF binaries, and a really small (the smallest?) ELF executable.
Ah.. also, I usually scan these HN posts on my iPhone SE, a small screen, and I mark up the ones I might want to dig into, usually on a larger device. The Muppet Labs style is intentionally a very simple, text-heavy design, which is great for study but can be a tough wall o' text on my little phone.
I simply didn't catch that that first link, in the second paragraph, was a link to the ELF series.
He explains why this is uninteresting and does not work toward his goal.
It just calls an interpreter, which is no better than any ordinary script except that you can supply a smaller interpreter than say bash, but no matter how small the interpreter, the binary plus interpreter is obviously and unavoidably larger than the binary alone.
Also check out <restatement of something from the article>.
By the same reasoning, this article is cheating, since all you are doing is putting your interpreter binary in the kernel. So you have to add the size of your kernel module at least ;P
Not hard to write a "runcom" or the like loader entirely in userspace, btw.
By that measure, then a dynamically linked ELF binary is not an “executable” either, since it uses the dynamic linker ld.so to load itself.