Hacker Blogs
Work in progress: 15,409 of 181,233 sites checked so far, more every week · updated 2 Nov 2026Missing a blog? Tell us

Top all-time · #1796

M

main is usually a function

Personal blog · mainisusuallyafunction.blogspot.comprogrammingsystems

main is usually a function is a personal blog at mainisusuallyafunction.blogspot.com about programming and systems. Since 2010, 43 different Hacker News readers have linked it 58 times, most often “151-byte static Linux binary in Rust”. The last post was in 2017, but the archive is still widely read.

Visit the blog
58mentions?
43HN people?
2010–2023first – last linked?
Links on Hacker News per year · peak 11 in 2012

Most-linked posts?

  1. 151-byte static Linux binary in Rust
    10 people · 14 mentions · first linked 2015-01-11
  2. Scheme without special forms
    4 people · 4 mentions · first linked 2012-04-29
  3. x86 is Turing-complete with no registers
    4 people · 4 mentions · first linked 2014-02-12
  4. Raw system calls for Rust
    3 people · 3 mentions · first linked 2014-09-21
  5. Attacking hardened Linux systems with kernel JIT spraying
    2 people · 5 mentions · first linked 2012-11-19
  6. A Rust View on Effective Modern C++
    2 people · 2 mentions · first linked 2017-06-22
  7. Attacking hardened Linux systems with kernel JIT spraying (2012)
    2 people · 2 mentions · first linked 2019-07-05
  8. On depression, privilege, and online activism
    2 people · 2 mentions · first linked 2014-06-11

What Hacker News says?

  1. https://github.com/tormol/tiny-rust-executable got it to 137, but here's a blog post explaining the process to get it to 151: http://mainisusuallyafunction.blogspot.com/2015/01/151-byte-...

    Comment linking /2015/01/151-byte-static-linux-binary-in-rust.html

    on “This shouldn't have happened: A vulnerability postmortem”
  2. Submitted 151-byte static Linux binary in Rust as a story · 191 points

    HN discussion
  3. I guess the examples use the default std libs, and runtimes of the languages. So in this sense your D example is the misrepresentation, by directly calling libc. If these kinds of low level size optimizations are enabled then both Nim and Rust can be more than 50 times smaller than your D example ;) : 150 byte Nim: https://hookrace.net/blog/nim-binary-size/ 151 byte Rust: http://mainisusuallyafunction.blogspot.com/2…

    Comment linking /2015/01/151-byte-static-linux-binary-in-rust.html

    on “Nim 1.0”
  4. Submitted A taste of Rust for C/C++ programmers as a story · 155 points

    HN discussion
  5. SolarNet addresses one aspect of the issue but there's another important one here for PowerPC. Every instruction has to start on a 4-byte boundary[1] so if a sequence of bytes that make up the Evil Instruction is present but at a 1 byte offset you're still perfectly safe. This isn't true for x86, where if you start executing at byte 1000 you might get one valid sequence of instructions but if you start executing at…

    Comment linking /2012/11/attacking-hardened-linux-systems-with.html

    on “Finding a CPU Design Bug in the Xbox 360”
  6. Submitted x86 is Turing-complete with no registers as a story · 89 points

    HN discussion
  7. > I am sure that it's quite possible to generate small Rust > binaries as well. Indeed, here's a 151-byte hello world[0] in Rust: http://mainisusuallyafunction.blogspot.com/2015/01/151-byte-...

    Comment linking /2015/01/151-byte-static-linux-binary-in-rust.html

    on “Announcing Rust 1.12”
  8. Submitted Attacking hardened Linux systems with kernel JIT spraying as a story · 84 points

    HN discussion
  9. Incidentally, in Rust this kind of thing could get you 151 bytes out of Rust: http://mainisusuallyafunction.blogspot.com/2015/01/151-byte-... (linked in that post) But that was before 1.0. Updating the example and applying some more tweaks, it’s down to 145: https://github.com/tormol/tiny-rust-executable

    Comment linking /2015/01/151-byte-static-linux-binary-in-rust.html

    on “A Programming Language Underdog”
  10. Submitted Animating quasicrystals in parallel Haskell as a story · 73 points

    HN discussion
  11. > UNIX is married with C, so any attempt to replace C, means breaking with the UNIX mindset, which has proven very hard to do. I don't believe this is particularly true, although I haven't explored it very far. UNIX is married with the API/ABI exposed by the so-called "C" library. So far, there have been no languages that offer native interoperability with C and have gained significant popularity, other than C++, an…

    Comment linking /2015/01/151-byte-static-linux-binary-in-rust.html

    on “Google discloses three severe vulnerabilities in Apple OS X”
  12. Submitted Self-modifying code for debug tracing in quasi-C as a story · 55 points

    HN discussion
  13. > Could I perform linking myself as a workaround? You can but it requires lots of black magic, and certainly a nightly rather than beta Rust ;) http://mainisusuallyafunction.blogspot.com/2015/01/151-byte-... is an old blog post that can get you started.

    Comment linking /2015/01/151-byte-static-linux-binary-in-rust.html

    on “Announcing Rust 1.0 Beta”
  14. Submitted On depression, privilege, and online activism as a story · 42 points

    HN discussion
  15. Here's an example http://mainisusuallyafunction.blogspot.com/2012/11/attacking...

    Comment linking /2012/11/attacking-hardened-linux-systems-with.html

    on “The State of Software Security in 2019”
  16. Submitted Attacking hardened Linux systems with kernel JIT spraying (2012) as a story · 39 points

    HN discussion
  17. A direct comparison like that is somewhat comparing apples to oranges. Don't get me wrong, defaults matter, but Rust still does offer the control required to get small binaries, and, those defaults are not nearly as bad for low-level domains where one isn't using the standard library, which is where binary size is most critical. See also https://lifthrasiir.github.io/rustlog/why-is-a-rust-executab... and even http:/…

    Comment linking /2015/01/151-byte-static-linux-binary-in-rust.html

    on “The cost of forsaking C”
  18. Submitted Tour of a real toy Haskell program as a story · 35 points

    HN discussion
  19. Hmm, my favorite vulnerability is x86's lack of self-synchronization meaning that the same byte-stream could be two different streams of valid instructions depending on where you start reading. http://mainisusuallyafunction.blogspot.com/2012/11/attacking...

    Comment linking /2012/11/attacking-hardened-linux-systems-with.html

    on “Intel x86 considered harmful – survey of attacks against x86 over last 10 years”
  20. Submitted Scheme without special forms as a story · 13 points

    HN discussion
  21. Rust has inline asm support, so system calls are easy and efficient, e.g. http://mainisusuallyafunction.blogspot.com/2014/09/raw-syste... . If you quibble that it's not in the standard library, note that we are talking about the actual languages here, not their standard libraries (that crate could easily be pulled into the official distribution if it was deemed sensible to do so).

    Comment linking /2014/09/raw-system-calls-for-rust.html

    on “Rust lifetimes: Getting away with things that would be reckless in C++”
  22. Submitted Scheme without special forms: a metacircular adventure as a story · 10 points

    HN discussion
  23. https://github.com/tormol/tiny-rust-executable (See also http://mainisusuallyafunction.blogspot.com/2015/01/151-byte-... which was the original implementation, this shaved a few more bytes off)

    Comment linking /2015/01/151-byte-static-linux-binary-in-rust.html

    on “Hello World”
  24. Submitted Raw system calls for Rust as a story · 9 points

    HN discussion
  25. Rust's standard library is statically linked, C's is not. You have to compare the total size. Additionally, Rust includes jemalloc by default on many platforms. If you really want to get extreme with this, http://mainisusuallyafunction.blogspot.com/2015/01/151-byte-... , while a bit old, talks about various things that are still true, though some stuff has changed a bit. There's also https://www.rust-lang.org/en-US/…

    Comment linking /2015/01/151-byte-static-linux-binary-in-rust.html

    on “The benefits and costs of writing a POSIX kernel in a high-level language”
  26. Submitted Calling a Rust library from C (or anything else) as a story · 8 points

    HN discussion
  27. As with everything, there are tradeoffs - For instance this from a few years ago: http://mainisusuallyafunction.blogspot.com/2012/11/attacking... Which allows bpf-jit to be part of a larger privilege escalation scheme. (To properly use this attack you need to gain control of an applicaion first, then you can maybe use this attack, and if successful you own the box). I haven't kept up with this at all, so I don't kno…

    Comment linking /2012/11/attacking-hardened-linux-systems-with.html

    on “BPF: The Forgotten Bytecode”
  28. Submitted A Rust View on Effective Modern C++ as a story · 5 points

    HN discussion
  29. > (I was not able to figure out how to pass a static option to rustc) We statically link by default, actually: https://gist.github.com/steveklabnik/e9e744d23a7a14edcd47 Everything but glibc. Experimental support for musl landed a few days ago. You can take this _really_ far: http://mainisusuallyafunction.blogspot.com/2015/01/151-byte-...

    Comment linking /2015/01/151-byte-static-linux-binary-in-rust.html

    on “Nim Programming Language 0.11.0 released”
  30. Submitted A Rust View on Effective Modern C++ as a story · 4 points

    HN discussion

Search all of HN for mainisusuallyafunction.blogspot.com

Linked by the same people?