Keegan McAllister

mainisusuallyafunction.blogspot.com · Personal blog · on HN since 2010

Keegan McAllister writes technical posts on Rust, low-level Linux and x86 tricks, and kernel exploitation, plus some essays on depression and online activism.

What HN saysHN links it for the tiny Rust binary and the x86 no-registers Turing-completeness posts, and commenters cite its kernel JIT spraying write-up.
52HN people shared it
17linked it in comments
40stories submitted
859story points
3 years agolast shared
2010people per year2026

Most-shared posts

  1. 1
    151-byte static Linux binary in Rust
    10 people · 192 points · first shared 2015 · 57 comments on HN
  2. 2
    Scheme without special forms
    5 people · 28 points · first shared 2012 · 1 comments on HN
  3. 3
    x86 is Turing-complete with no registers
    4 people · 90 points · first shared 2014 · 23 comments on HN
  4. 4
    Attacking hardened Linux systems with kernel JIT spraying
    3 people · 123 points · first shared 2012 · 17 comments on HN
  5. 5
    Raw system calls for Rust
    3 people · 11 points · first shared 2014 · discussion on HN
  6. 6
    A Rust View on Effective Modern C++
    3 people · 10 points · first shared 2017 · discussion on HN
  7. 7
    On depression, privilege, and online activism
    2 people · 42 points · first shared 2014 · 13 comments on HN
  8. 8
    A taste of Rust for C/C++ programmers
    1 people · 155 points · first shared 2014 · 93 comments on HN
  9. 9
    Animating quasicrystals in parallel Haskell
    1 people · 73 points · first shared 2011 · 13 comments on HN
  10. 10
    Self-modifying code for debug tracing in quasi-C
    1 people · 55 points · first shared 2011 · 6 comments on HN
  11. 11
    Tour of a real toy Haskell program
    1 people · 35 points · first shared 2010 · 6 comments on HN
  12. 12
    Calling a Rust library from C (or anything else)
    1 people · 8 points · first shared 2014 · discussion on HN
  13. 13
    Quantification in types
    1 people · 3 points · first shared 2010 · discussion on HN
  14. 14
    A Rust View on “Effective Modern C++”
    1 people · 3 points · first shared 2017 · 1 comments on HN
  15. 15

What HN people wrote when they linked it

Symmetry · 2015-10-27
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-hardened-…
parennoob · 2015-03-13
"To complicate matters, most of the people in the industry are young men, a cohort not good at acknowledging their own problems, or understanding other people’s." Does this not seem like oversimplification and rampant stereotyping? I am a "young man" (well, below 30 anyway, though in SV I'm probably a bit long in the tooth), and it hurts to be constantly and systematically belittled in this manner. I have problems, and other people in the industry do too. Singling out one particular gender and age group and making them the bad party doesn't help anyone. A great related article: (http://mainisusuallyafunction.blogspot.com/2014/06/on-depression-privi…
eat_veggies · 2021-12-01
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-static-lin…
steveklabnik · 2020-01-05
https://github.com/tormol/tiny-rust-executable (See also http://mainisusuallyafunction.blogspot.com/2015/01/151-byte-static-lin… which was the original implementation, this shaved a few more bytes off)
szemet · 2019-09-24
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/2015/01/151-byte-static-lin…
spillnoil7 · 2017-09-10
Another related link: http://mainisusuallyafunction.blogspot.com/2012/04/scheme-without-spec… fun article with implementation included
dbaupp · 2016-10-05
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-executable-large.h… and even http://mainisusuallyafunction.blogspot.com/2015/01/151-byte-static-lin… .
kibwen · 2016-09-30
> 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-static-lin…
fsaintjacques · 2016-04-29
You can somewhat do it with GCC, but it requires a linker script: http://mainisusuallyafunction.blogspot.ca/2011/11/self-modifying-code-…
Ygg2 · 2016-03-04
You can go 151 bytes if you are ready to do some link shenanigans: http://mainisusuallyafunction.blogspot.rs/2015/01/151-byte-static-linu…
progman · 2015-09-23
In embedded systems pointers make some sense but not in usual applications. This is the way how Rust can work: http://mainisusuallyafunction.blogspot.de/2015/01/151-byte-static-linu…
sophacles · 2014-05-22
As with everything, there are tradeoffs - For instance this from a few years ago: http://mainisusuallyafunction.blogspot.com/2012/11/attacking-hardened-… 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 know if it has been fixed (or even is fixable) but it is interesting.
cheatercheater · 2012-06-12
Make sure to check out pi calculus for a different model of concurrency without locks: http://mainisusuallyafunction.blogspot.com/2011/09/lambda-to-pi.html
CyberShadow · 2015-08-29
> Being pragmatic is a very questionable claim. Its exact meaning varies from time to time, and a property that a certain people consider to be pragmatic can be considered to be not pragmatic by another people. It's mostly meaningless. I disagree that it is meaningless. It's simply subjective. I've used D since 2006 and tried most new programming languages that appeared since, and it seems like they all tried to solve a specific problem (e.g. Go - concurrency, Rust - memory safety) while giving less attention to everything else. > For example, for embedded devices D is a no-go from the beginning. Existing D projects contradict that. They simply don't use the standard D runtime when it's not appropriate. Alternative runtimes exist. Rust users do the same thing: http://mainisusuallyafunction.blogspot.com/2015/01/151-byte-static-lin… > D and Rust have different kinds of expressiveness. While D has much better compile-time metaprogramming, how do you express affine type in D? In Rust affine type is very fundamental and we can utilize it to define the exact meaning of our programs. Can you provide a good example of affine types and how they help with expressiveness? My view of expressiveness in D does not stop at compile-time metaprogramming. For example, here's an excerpt from one of my programs: http://dump.thecybershadow.net/fb6c5a080c7a42ecd8d1f062b58a540d/000000… > How can a GC'ed language be faster than a non-GC'ed language? It is entirely…
geofft · 2015-01-24
> 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++, and C++ is certainly pretty popular on UNIX (Qt, gcc, etc.). Rust does offer that and is (evidently) picking up a ton of steam, and you can get to the point where stupid tricks that previously required a C derivative can be done in Rust. http://mainisusuallyafunction.blogspot.com/2015/01/151-byte-static-lin… In fairness, this often also requires things like "C" strings, the "C" locale, etc. But those things can either be done smoothly enough from Rust, or are wrong anyway, that I think there's a chance to break the C stranglehold here.

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close