<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/linux-kernel-will-support-origin-sort-of-bzag7lotz" -->

---
title: Linux kernel will support $ORIGIN, sort of | daily.dev
description: A developer working on relocatable binaries in Nix proposed adding $ORIGIN support to the Linux kernel's VFS subsystem. Instead of a direct implementation, VFS...
canonical: https://daily.dev/posts/linux-kernel-will-support-origin-sort-of-bzag7lotz
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Linux kernel will support $ORIGIN, sort of | daily.dev
og:description: A developer working on relocatable binaries in Nix proposed adding $ORIGIN support to the Linux kernel's VFS subsystem. Instead of a direct implementation, VFS...
og:url: https://daily.dev/posts/linux-kernel-will-support-origin-sort-of-bzag7lotz
og:image: https://api.daily.dev/og/posts/BZAg7loTZ.png
og:image:alt: Linux kernel will support $ORIGIN, sort of
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Linux kernel will support $ORIGIN, sort of

**[Farid Zakaria’s Blog](https://daily.dev/sources/fzakaria)** · 6 min read · 1 upvotes · 0 comments

## Summary

A developer working on relocatable binaries in Nix proposed adding $ORIGIN support to the Linux kernel's VFS subsystem. Instead of a direct implementation, VFS maintainer Christian Brauner suggested using eBPF as a programmable interpreter selector via binfmt_misc. The resulting patch series allows an eBPF program to dynamically determine the ELF interpreter at load time, enabling $ORIGIN-style path resolution. A new 'loader substitution' (L) dispatch mode was also developed, which overrides PT_INTERP without changing process identity — solving issues with /proc/self/exe and argv[0]. The plan is to upstream a NixOS module that registers $ORIGIN support at boot, gated on a new PT_INTERP_NIX segment for opt-in backwards compatibility.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://fzakaria.com/2026/07/20/linux-kernel-will-support-origin-sort-of>

## Questions this post answers

### How can I add $ORIGIN support to PT_INTERP or shebangs on Linux without patching the VFS directly?

You can register an eBPF program with binfmt_misc that intercepts ELF binary loading and dynamically resolves the interpreter path, including $ORIGIN-relative paths. Christian Brauner, the VFS maintainer, proposed this approach after a direct kernel patch was floated; a resulting patch series adds struct_ops hooks (match and load) so a BPF program can call bpf_binprm_set_interp to set a computed interpreter path at exec time, heading toward the -next branch.

_Developers tracking this kernel change for Nix or Bazel-style relocatable binaries can follow related coverage on daily.dev._

### What is the loader substitution (L) flag mode being added to binfmt_misc?

The L dispatch mode lets the kernel execute the matched binary natively as the main process image while only substituting the registered interpreter for the loader named in the binary's PT_INTERP, instead of the interpreter taking over the process identity. This avoids the traditional binfmt_misc problem where argv[0], /proc/pid/cmdline, and /proc/self/exe show the interpreter rather than the actual executed binary, so a stock dynamic loader works unchanged.

_Teams debugging broken /proc/self/exe or argv[0] behavior in custom loaders can track this kernel work via daily.dev._

### Why did a proposal to add $ORIGIN support directly in the Linux VFS subsystem turn into an eBPF-based binfmt_misc solution instead?

VFS maintainer Christian Brauner responded constructively to a direct kernel patch proposal for $ORIGIN support and, after hearing rationale from Nix and build-tool contributors (relevant to Buck and Bazel too), suggested a more general programmable approach using eBPF through binfmt_misc rather than a narrow, fixed VFS change. This resulted in a broader patch series enabling arbitrary interpreter-selection logic, not just $ORIGIN substitution.

_Anyone weighing kernel-level fixes versus programmable eBPF hooks can follow this design discussion on daily.dev._

## Similar posts on daily.dev

- [Nix needs relocatable binaries](https://daily.dev/posts/nix-needs-relocatable-binaries-rlipayhxa) · Farid Zakaria’s Blog · 0 upvotes · 0 comments
- [Linux 7.3 binfmt\_misc To Allow BPF Programs To Dynamically Choose Execution Environments](https://daily.dev/posts/linux-7-3-binfmt-misc-to-allow-bpf-programs-to-dynamically-choose-execution-environments-c4kuy2anw) · Phoronix · 0 upvotes · 0 comments
- [Hijacking ELF entry points for NixOS compatibility or WTF is wrap-buddy?](https://daily.dev/posts/hijacking-elf-entry-points-for-nixos-compatibility-or-wtf-is-wrap-buddy--scgexslvh) · Farid Zakaria’s Blog · 0 upvotes · 0 comments
- [Linux is an interpreter](https://daily.dev/posts/linux-is-an-interpreter-tntoyg2k2) · Hacker News · 0 upvotes · 0 comments
- [How eBPF Empowers Developers to Observe Inside the Linux Kernel in a Safe and Unintrusive Way](https://daily.dev/posts/how-ebpf-empowers-developers-to-observe-inside-the-linux-kernel-in-a-safe-and-unintrusive-way-jhmpnwjer) · InfoQ · 0 upvotes · 0 comments

---

Tags: [#linux](https://daily.dev/tags/linux)

[View this post on daily.dev](https://daily.dev/posts/linux-kernel-will-support-origin-sort-of-bzag7lotz)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Linux kernel will support $ORIGIN, sort of","url":"https://daily.dev/posts/linux-kernel-will-support-origin-sort-of-bzag7lotz","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/linux-kernel-will-support-origin-sort-of-bzag7lotz"},"datePublished":"2026-07-21T03:26:22.538Z","dateModified":"2026-09-14T08:03:13.276Z","description":"A developer working on relocatable binaries in Nix proposed adding $ORIGIN support to the Linux kernel's VFS subsystem. Instead of a direct implementation, VFS...","image":"https://media.daily.dev/image/upload/s--2-1xRawN--/f_auto/v1722860399/public/Placeholder%2011","thumbnailUrl":"https://media.daily.dev/image/upload/s--2-1xRawN--/f_auto/v1722860399/public/Placeholder%2011","isAccessibleForFree":true,"articleSection":"Farid Zakaria’s Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Farid Zakaria’s Blog","logo":"https://media.daily.dev/image/upload/s--YqqvRt90--/f_auto/v1723789280/logos/fzakaria","url":"https://daily.dev/sources/fzakaria"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/linux-kernel-will-support-origin-sort-of-bzag7lotz","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"linux","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Farid Zakaria’s Blog","item":"https://daily.dev/sources/fzakaria"},{"@type":"ListItem","position":3,"name":"Linux kernel will support $ORIGIN, sort of"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/linux-kernel-will-support-origin-sort-of-bzag7lotz#faq","mainEntity":[{"@type":"Question","name":"How can I add $ORIGIN support to PT_INTERP or shebangs on Linux without patching the VFS directly?","acceptedAnswer":{"@type":"Answer","text":"You can register an eBPF program with binfmt_misc that intercepts ELF binary loading and dynamically resolves the interpreter path, including $ORIGIN-relative paths. Christian Brauner, the VFS maintainer, proposed this approach after a direct kernel patch was floated; a resulting patch series adds struct_ops hooks (match and load) so a BPF program can call bpf_binprm_set_interp to set a computed interpreter path at exec time, heading toward the -next branch. Developers tracking this kernel change for Nix or Bazel-style relocatable binaries can follow related coverage on daily.dev."}},{"@type":"Question","name":"What is the loader substitution (L) flag mode being added to binfmt_misc?","acceptedAnswer":{"@type":"Answer","text":"The L dispatch mode lets the kernel execute the matched binary natively as the main process image while only substituting the registered interpreter for the loader named in the binary's PT_INTERP, instead of the interpreter taking over the process identity. This avoids the traditional binfmt_misc problem where argv[0], /proc/pid/cmdline, and /proc/self/exe show the interpreter rather than the actual executed binary, so a stock dynamic loader works unchanged. Teams debugging broken /proc/self/exe or argv[0] behavior in custom loaders can track this kernel work via daily.dev."}},{"@type":"Question","name":"Why did a proposal to add $ORIGIN support directly in the Linux VFS subsystem turn into an eBPF-based binfmt_misc solution instead?","acceptedAnswer":{"@type":"Answer","text":"VFS maintainer Christian Brauner responded constructively to a direct kernel patch proposal for $ORIGIN support and, after hearing rationale from Nix and build-tool contributors (relevant to Buck and Bazel too), suggested a more general programmable approach using eBPF through binfmt_misc rather than a narrow, fixed VFS change. This resulted in a broader patch series enabling arbitrary interpreter-selection logic, not just $ORIGIN substitution. Anyone weighing kernel-level fixes versus programmable eBPF hooks can follow this design discussion on daily.dev."}}]}
```

