Skip to content

Commit 8cf10f8

Browse files
committed
fix: support libc interposition
1 parent 9a089c2 commit 8cf10f8

6 files changed

Lines changed: 6 additions & 94 deletions

File tree

‎.github/workflows/CICD.yml‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -984,23 +984,6 @@ jobs:
984984
- name: Run safe traversal verification
985985
run: ./util/check-safe-traversal.sh
986986

987-
test_libc_interposition:
988-
name: libc Interposition Check
989-
runs-on: ubuntu-latest
990-
needs: [ min_version, deps ]
991-
992-
steps:
993-
- uses: actions/checkout@v7.0.1
994-
with:
995-
persist-credentials: false
996-
- uses: Swatinem/rust-cache@v2
997-
- name: Install fakeroot
998-
run: sudo apt-get update && sudo apt-get install -y fakeroot
999-
- name: Build utilities that must stay interposable
1000-
run: cargo build --profile=release-small -p uu_chmod -p uu_chown
1001-
- name: Run libc interposition verification
1002-
run: ./util/check-libc-interposition.sh
1003-
1004987
test_open_once:
1005988
name: Redundant Open Check
1006989
runs-on: ubuntu-latest

‎Cargo.toml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ rlimit = "0.11.0"
118118
rstest = "0.29.0"
119119
rstest_reuse = "0.7.2"
120120
rustc-hash = "2.1.1"
121-
rustix = { version = "1.1.4", default-features = false }
121+
rustix = { version = "1.1.4", default-features = false, features = [
122+
"use-libc",
123+
] }
122124
self_cell = "1.0.4"
123125
selinux = "0.6"
124126
syn = { version = "3.0", features = ["full"] }
@@ -383,8 +385,7 @@ rstest.workspace = true
383385
rstest_reuse.workspace = true
384386

385387
[target.'cfg(all(any(target_os = "linux", all(target_os = "android", target_pointer_width = "64")), not(target_env = "musl")))'.dependencies]
386-
# raw-backend's linux_execfn is not supported on linux < 6.4 if /proc is not mounted. So use-libc-auxv is needed
387-
rustix = { workspace = true, features = ["param", "use-libc-auxv"] }
388+
rustix = { workspace = true, features = ["param"] }
388389

389390
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
390391
selinux = { workspace = true, optional = true }

‎docs/src/packaging.md‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,6 @@ It is also possible to split the debuginfo into a separate package. See the
7272
[`split-debuginfo`](https://doc.rust-lang.org/cargo/reference/profiles.html#split-debuginfo)
7373
option in `cargo`.
7474

75-
On Linux, rustix's raw syscall backend bypasses libc function interposition.
76-
An `LD_PRELOAD` interceptor such as `fakeroot` cannot override affected calls
77-
in some utilities. For example, under `fakeroot`, `id -u` still reports the
78-
real UID. To ship the multicall binary with rustix's libc wrappers, build with:
79-
80-
```bash
81-
cargo build --release --features unix,rustix/use-libc
82-
```
83-
8475
## Profile-Guided Optimization (PGO)
8576

8677
The release binaries we publish are built with [Profile-Guided

‎fuzz/uufuzz/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ license.workspace = true
1010
[dependencies]
1111
console = "0.16.0"
1212
rand = { version = "0.10.1", features = ["std_rng"] }
13-
rustix = { version = "1.1.4", features = ["stdio", "pipe"] }
13+
rustix = { version = "1.1.4", features = ["stdio", "pipe", "use-libc"] }
1414
similar = "3.0.0"
1515
tempfile = "3.15.0"
1616
uucore = { version = "0.13.0", path = "../../src/uucore", features = [

‎util/check-common.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
#
33
# Shared setup for the util/check-*.sh syscall verification scripts
4-
# (check-safe-traversal.sh, check-toctou.sh, check-libc-interposition.sh).
4+
# (check-safe-traversal.sh, check-toctou.sh).
55
#
66
# Source it after setting CHECK_UTILS to the utilities the caller exercises:
77
#

‎util/check-libc-interposition.sh‎

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)