id: rustix crate bypasses libc breaking LD_PRELOAD based tools
Open
Nobody has claimed this yet.
U - id
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
Problem
- https://github.com/uutils/coreutils/commit/37c42a29caa9f20a7d509cf59b9f3d177075aa5c replaced the
nixcrate withrustixforid. rustixuses raw syscalls for functions such asgetuid(), rather than the libc wrapper.- Tools like
fakerootrely on the libc wrapper to intercept function calls usingLD_PRELOADin order to return fake values.
Reproduce
- Build uutils/coreutils version 0.9.0 using the release profile
- Install
fakeroot:
# Debian / Ubuntu
sudo apt install fakeroot
# Fedora / RHEL
sudo dnf install fakeroot
# Arch Linux
sudo pacman -S fakeroot
- Run the built
id:
id
Output:
1000
- Run
fakerootagainst the builtid:
fakeroot ./target/release/coreutils id -u
Output:
1000
Expected behavior
fakeroot should be able to intercept the id command and instead print:
0
as if it were root.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Build uutils/coreutils 0.9.0 with the release profile and reproduce the issue using fakeroot ./target/release/coreutils id -u. Start by locating the id implementation and its rustix-based calls, then investigate how fakeroot intercepts the corresponding libc wrappers. Done means fakeroot causes id -u to print 0 instead of 1000.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100