Self – The Structured Executable and Linkable Format

gjvc1 pts0 comments

GitHub - fzakaria/selfdb · GitHub

/" data-turbo-transient="true" />

Skip to content

Search/

Sign in<br>Sign upAppearance settings

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

fzakaria

selfdb

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star<br>16

main

BranchesTags

Go to file

CodeOpen more actions menu

Latest commit

History<br>8 Commits<br>8 Commits

Folders and files<br>NameNameLast commit message<br>Last commit date<br>bench

bench

converter

converter

loader

loader

nix

nix

schema

schema

tests

tests

.gitignore

.gitignore

DESIGN.md

DESIGN.md

README.md

README.md

flake.lock

flake.lock

flake.nix

flake.nix

View all files

Repository files navigation

selfdb

SELF — the Structured Executable & Linkable Format: a program that is a<br>SQLite database instead of an ELF file, and the machinery to actually run it<br>on Linux/NixOS.

sqlelf (arXiv:2405.03883)<br>put a SQL view over ELF. This project inverts it: the rows are the format,<br>a binfmt_misc interpreter executes them, and nixpkgs/NixOS is the vehicle to<br>run a real slice of a system on it.

$ file hello<br>hello: SQLite 3.x database, application id 0x53454c46, user version 1<br>$ ./hello<br>Hello, world!<br>$ sqlite3 hello 'SELECT soname FROM ldd' # ldd, as a query<br>$ sqlite3 hello 'DELETE FROM sections; VACUUM' # strip, as a transaction<br>$ ./hello # still runs<br>Hello, world!

What's here

converter/ — elf2self, self2elf, and the self CLI (Python + LIEF).

loader/ — self-exec, the binfmt interpreter, with three modes:<br>memfd (rebuild ELF → execveat), native (map segments + hand off to<br>ld.so), selfld (be the dynamic linker, bind via SQL). Plus<br>libself-audit.so, an LD_AUDIT library that makes stock glibc load<br>.self shared libraries resolved through SQL.

nix/ — packages, a selfify hook, a NixOS module (programs.self), and<br>self-vm.

schema/self.sql — the format DDL (generated from selfconv/schema.py).

bench/, tests/ — the evaluation harness and the M0–M3b test suite.

Read DESIGN.md; §13 tracks implementation status.

Try it

$ nix develop # dev shell (converter + loader + tools)<br>$ nix develop -c bash tests/all.sh # run M0..M3b end to end<br>$ nix develop -c bash tests/showcase.sh<br>$ nix run .#self-vm # a NixOS VM where ./hello.self just runs<br># (login: root, empty password)

About<br>No description, website, or topics provided.<br>Resources<br>Readme<br>Activity<br>Stars<br>16 stars<br>Watchers<br>0 watching<br>Forks<br>0 forks<br>Report repository

Releases

Packages

Contributors

Languages

You can’t perform that action at this time.

self hello tests format converter loader

Related Articles