From 800fb80684e2fc13b506efad3da0d118472c369b Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Mon, 12 Oct 2026 00:52:06 -0700 Subject: [PATCH 1/2] docs: document id rustix LD_PRELOAD compatibility The build section of README.md and the packaging guide now explain that this backend skips libc interposition, with fakeroot and `id -u` as the case that still reports the real UID. Both pages document `cargo build --release --features unix,rustix/use-libc` to build the multicall binary with rustix's libc wrappers, and they note that the backend is a compile-time Cargo feature, that a statically linked executable still cannot be interposed this way, and that the libc backend does not cover every operation. The spell-checker ignore lists in both files include fakeroot. Refs #13399 --- README.md | 21 ++++++++++++++++++++- docs/src/packaging.md | 16 +++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fea644f011c..7ce8eed7ba9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ - +
@@ -171,6 +171,25 @@ build selected individual utilities, use the `--package` [aka `-p`] option. For cargo build -p uu_base32 -p uu_cat -p uu_echo -p uu_rm ``` +#### libc interposition (`LD_PRELOAD`) + +On Linux, rustix's raw syscall backend bypasses libc function interposition, so +an `LD_PRELOAD` interceptor such as `fakeroot` cannot override affected calls. +`id` is one of those utilities: `fakeroot coreutils id -u` reports the real UID +instead of `0`. + +To build the multicall binary with rustix's libc wrappers, enable the libc +backend: + +```shell +cargo build --release --features unix,rustix/use-libc +``` + +That choice is fixed at build time. No runtime setting selects the rustix +backend. Selecting the libc backend does not enable `LD_PRELOAD` for a +statically linked executable, and it does not guarantee interception of every +operation. + ### GNU Make Building using `make` is a simple process as well. diff --git a/docs/src/packaging.md b/docs/src/packaging.md index 222c8c5de78..7765877e319 100644 --- a/docs/src/packaging.md +++ b/docs/src/packaging.md @@ -1,6 +1,6 @@ # Packaging coreutils - + > **Note**: This page is intended as a guide for packaging the uutils coreutils > for package maintainers. Normal users probably do not need to read this. If you @@ -72,6 +72,20 @@ It is also possible to split the debuginfo into a separate package. See the [`split-debuginfo`](https://doc.rust-lang.org/cargo/reference/profiles.html#split-debuginfo) option in `cargo`. +On Linux, rustix's raw syscall backend bypasses libc function interposition. +An `LD_PRELOAD` interceptor such as `fakeroot` cannot override affected calls +in `id` (`id -u` still reports the real UID). To ship the multicall binary +with rustix's libc wrappers, build with: + +```bash +cargo build --release --features unix,rustix/use-libc +``` + +This is a compile-time Cargo feature. No runtime setting selects the rustix +backend. Selecting the libc backend does not enable `LD_PRELOAD` for a +statically linked executable, and it does not guarantee interception of every +operation. + ## Profile-Guided Optimization (PGO) The release binaries we publish are built with [Profile-Guided From 7d35ab1a295ecd9be6bcf444774cb20813601d58 Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Thu, 15 Oct 2026 16:18:00 -0700 Subject: [PATCH 2/2] docs: keep the rustix libc backend note only in packaging.md Per review: drop the duplicate README section, say the libc interposition limit affects some utilities with id as an example, and remove the paragraph that repeated that the backend is a Cargo feature. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KFTE4BHbGYzgf8Uhzcppdh --- README.md | 21 +-------------------- docs/src/packaging.md | 9 ++------- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 7ce8eed7ba9..fea644f011c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ - +
@@ -171,25 +171,6 @@ build selected individual utilities, use the `--package` [aka `-p`] option. For cargo build -p uu_base32 -p uu_cat -p uu_echo -p uu_rm ``` -#### libc interposition (`LD_PRELOAD`) - -On Linux, rustix's raw syscall backend bypasses libc function interposition, so -an `LD_PRELOAD` interceptor such as `fakeroot` cannot override affected calls. -`id` is one of those utilities: `fakeroot coreutils id -u` reports the real UID -instead of `0`. - -To build the multicall binary with rustix's libc wrappers, enable the libc -backend: - -```shell -cargo build --release --features unix,rustix/use-libc -``` - -That choice is fixed at build time. No runtime setting selects the rustix -backend. Selecting the libc backend does not enable `LD_PRELOAD` for a -statically linked executable, and it does not guarantee interception of every -operation. - ### GNU Make Building using `make` is a simple process as well. diff --git a/docs/src/packaging.md b/docs/src/packaging.md index 7765877e319..1920d1909a7 100644 --- a/docs/src/packaging.md +++ b/docs/src/packaging.md @@ -74,18 +74,13 @@ option in `cargo`. On Linux, rustix's raw syscall backend bypasses libc function interposition. An `LD_PRELOAD` interceptor such as `fakeroot` cannot override affected calls -in `id` (`id -u` still reports the real UID). To ship the multicall binary -with rustix's libc wrappers, build with: +in some utilities. For example, under `fakeroot`, `id -u` still reports the +real UID. To ship the multicall binary with rustix's libc wrappers, build with: ```bash cargo build --release --features unix,rustix/use-libc ``` -This is a compile-time Cargo feature. No runtime setting selects the rustix -backend. Selecting the libc backend does not enable `LD_PRELOAD` for a -statically linked executable, and it does not guarantee interception of every -operation. - ## Profile-Guided Optimization (PGO) The release binaries we publish are built with [Profile-Guided