Skip to content

coreutils: Protect against env -a for security#10773

Open
oech3 wants to merge 1 commit intouutils:mainfrom
oech3:auxval
Open

coreutils: Protect against env -a for security#10773
oech3 wants to merge 1 commit intouutils:mainfrom
oech3:auxval

Conversation

@oech3
Copy link
Contributor

@oech3 oech3 commented Feb 6, 2026

env -a false ls does not fail. Works under masked /proc.
Closes #10135

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/tty/tty-eof (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/usage_vs_getopt (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/shuf/shuf-reservoir (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/sort/sort-stale-thread-mem (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/basenc/bounded-memory is now being skipped but was previously passing.

@oech3 oech3 marked this pull request as ready for review February 6, 2026 19:18
@oech3 oech3 force-pushed the auxval branch 3 times, most recently from 01b6655 to 753f86c Compare February 7, 2026 07:47
@github-actions
Copy link

github-actions bot commented Feb 7, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/shuf/shuf-reservoir (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/sort/sort-stale-thread-mem (fails in this run but passes in the 'main' branch)

@oech3

This comment was marked as resolved.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 7, 2026

Merging this PR will not alter performance

✅ 35 untouched benchmarks
⏩ 287 skipped benchmarks1


Comparing oech3:auxval (40581ee) with main (194d980)

Open in CodSpeed

Footnotes

  1. 287 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@oech3 oech3 force-pushed the auxval branch 2 times, most recently from 59e307c to ac75ff7 Compare February 8, 2026 15:58
@github-actions
Copy link

github-actions bot commented Feb 8, 2026

GNU testsuite comparison:

GNU test failed: tests/cut/bounded-memory. tests/cut/bounded-memory is passing on 'main'. Maybe you have to rebase?
Congrats! The gnu test tests/pr/bounded-memory is no longer failing!

@ChrisDryden
Copy link
Collaborator

I think it would make sense for this code to go into the validation.rs file instead of in the main.rs, then you don't have to worry about importing libc.

It would be good to have an additional integration test that shows the env -a working

@oech3
Copy link
Contributor Author

oech3 commented Feb 8, 2026

It would be good to have an additional integration test that shows the env -a working

Did you mean coreutils is protected against env -a?

@oech3
Copy link
Contributor Author

oech3 commented Feb 8, 2026

/// Gets the binary path from command line arguments
/// # Panics
/// Panics if the binary path cannot be determined
pub fn binary_path(args: &mut impl Iterator<Item = OsString>) -> PathBuf {
match args.next() {
Some(ref s) if !s.is_empty() => PathBuf::from(s),
_ => std::env::current_exe().unwrap(),
}
}

Wait! Why are we using std::env::current_exe at here which depends on /proc?
cc: @Ecordonnier

@oech3
Copy link
Contributor Author

oech3 commented Feb 8, 2026

So should I imprement fn binary_path on Linux by auxval only?

@oech3 oech3 force-pushed the auxval branch 2 times, most recently from e3320d4 to 1337cbc Compare February 8, 2026 21:43
@github-actions
Copy link

github-actions bot commented Feb 8, 2026

GNU testsuite comparison:

Congrats! The gnu test tests/tail/tail-n0f is now passing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ubuntu patch prevents custom argv[0]

2 participants