SELF Format Turns an ELF Binary Into a Queryable SQLite File
SELF is a Linux technique that sets a SQLite file's 4-byte application ID and arranges ELF executable components into SQLite tables so one file is both a valid binary and a queryable database.
What it is
SELF (Structured Executable & Linkable Format), described by Farid Zakaria in a writeup linked from Simon Willison's post, is a way to build a Linux binary that is simultaneously a valid SQLite database file.
What it does
It sets the SQLite file format's 4-byte application ID, 68 bytes into the file, to SELF, then arranges the various components of an ELF executable (sections, symbols, segments) into a set of SQLite tables inside the same file, instead of the usual opaque binary blob.
Why it matters
It turns binary introspection into a SQL query instead of a custom parser, letting you ask questions like which symbols exist or how big a section is with plain SELECT statements against the executable itself.