# 开发者展示将 ELF 可执行文件嵌入 SQLite 数据库，并利用 binfmt_misc 让内核直接执行该格式文件

- 来源：Simon Willison
- 发布时间：2026-08-24 19:38
- AIWatch 分数：37
- AIWatch 标记：未精选
- AIWatch 链接：https://aiwatch.icu/events/evt_01m0ssrc2rwdyfcrz6bjkmemd4
- 原文链接：https://simonwillison.net/2026/Aug/24/your-executable-is-a-sqlite-database/

## 精选理由

低价值或偏离 AI-Dev

## AI 摘要

开发者展示将 ELF 可执行文件嵌入 SQLite 数据库，并利用 binfmt_misc 让内核直接执行该格式文件。

## 正文

Your executable is a SQLite database

The trick sets the SQLite file format's 4-byte application ID (68 bytes into the file) to SELF, standing for Structured Executable & Linkable Format. The various components of the ELF executable format are then arranged into a number of different SQLite tables, using this schema.

Their self-exec interpreter (C code here) can then extract and execute the necessary pieces.

You can additionally use a Linux mechanism called binfmt_misc to teach the kernel to execute that any time it encounters an executable matching that binary pattern. Farid uses NixOS here, but without NixOS I think registration looks something like this:

printf '%s\n' ':self:M:68:SELF::/usr/local/bin/self-exec:' \
  > /proc/sys/fs/binfmt_misc/register

Via Hacker News

Tags: c, linux, sqlite
