#linux
21 articles tagged #linux. All tags
A terminal case of Linux
Has this ever happened to you? You want to look at a JSON file in your terminal, so you pipe it into jq so you can look at it with colors and stuff. That’s a useless use of cat. …oh hey cool bear. No…
29 min
Fine, we'll relocate our own binary!
Welcome back to the eighteenth and final part of “Making our own executable packer”. In the last article, we had a lot of fun. We already had a “packer” executable, minipak, which joined together…
37 min
Running a self-relocatable ELF from memory
Welcome back! In the last article, we did foundational work on minipak, our ELF packer. It is now able to receive command-line arguments, environment variables, and auxiliary vectors. It can parse…
27 min
Everything but ELF
And we’re back! In the last article, we thanked our old code and bade it adieu, for it did not spark joy. And then we made a new, solid foundation, on which we planned to actually make an executable…
26 min
Between libcore and libstd
You’re still here! Fantastic. I have good news, and bad news. The good news is, we’re actually going to make an executable packer now! Hurray! I know right? No lie, we’re actually really going to…
35 min
In the bowels of glibc
Good morning, and welcome back to “how many executables can we run with our custom dynamic loader before things get really out of control”. In Part 13, we “implemented” thread-local storage. I’m…
48 min
Making our own executable packer
In this series, we’ll attempt to understand how Linux executables are organized, how they are executed, and how to make a program that takes an executable fresh off the linker and compresses it -…
8 h 53 min
A dynamic linker murder mystery
I write a ton of articles about rust. And in those articles, the main focus is about writing Rust code that compiles. Once it compiles, well, we’re basically in the clear! Especially if it compiles…
23 min
Thread-local storage
Welcome back and thanks for joining us for the reads notes… the thirteenth installment of our series on ELF files, what they are, what they can do, what does the dynamic linker do to them, and how…
42 min
A no_std Rust binary
In Part 11, we spent some time clarifying mechanisms we had previously glossed over: how variables and functions from other ELF objects were accessed at runtime. We saw that doing so “proper”…
27 min
More ELF relocations
In our last installment of “Making our own executable packer”, we did some code cleanups. We got rid of a bunch of unsafe code, and found a way to represent memory-mapped data structures safely. But…
28 min
Dynamic linker speed and correctness
In the last article, we managed to load a program (hello-dl) that uses a single dynamic library (libmsg.so) containing a single exported symbol, msg. Our program, hello-dl.asm, looked like this:…
28 min
Dynamic symbol resolution
Let’s pick up where we left off: we had just taught elk to load not only an executable, but also its dependencies, and then their dependencies as well. We discovered that ld-linux walked the…
26 min
Loading multiple ELF objects
Up until now, we’ve been loading a single ELF file, and there wasn’t much structure to how we did it: everyhing just kinda happened in main, in no particular order. But now that shared libraries are…
32 min
The simplest shared library
In our last article, we managed to load and execute a PIE (position-independent executable) compiled from the following code: ; in `samples/hello-pie.asm`. global _start. section .text. _start: mov…
29 min
ELF relocations
The last article, Position-independent code, was a mess. But who could blame us? We looked at the world, and found it to be a chaotic and seemingly nonsensical place. So, in order to blend in, we had…
17 min
Position-independent code
In the last article, we found where code was hiding in our samples/hello executable, by disassembling the whole file and then looking for syscalls. Later on, we learned how to inspect which memory…
28 min
Running an executable without exec
In part 1, we’ve looked at three executables: sample, an assembly program that prints “hi there” using the write system call. entry_point, a C program that prints the address of main using printf.…
22 min
What's in a Linux executable?
Executables have been fascinating to me ever since I discovered, as a kid, that they were just files. If you renamed a .exe to something else, you could open it in notepad! And if you renamed…
22 min
Reading files the hard way - Part 1 (node.js, C, rust, strace)
Everybody knows how to use files. You just open up File Explorer, the Finder, or a File Manager, and bam - it’s chock-full of files. There’s folders and files as far as the eye can see. It’s a…
15 min
Cross-compilation notes
I’ll keep updating this article as I go, just to put stuff in all the same place. Platforms. Cross-compiling for Linux. I’m pretty sure it’s possible to cross-compile for Linux on other OSes, seeing…
8 min