rust/src/tools/miri/tests
Matthias Krüger 43134714f5
Rollup merge of #106661 - mjguzik:linux_statx, r=Mark-Simulacrum
Stop probing for statx unless necessary

As is the current toy program:
fn main() -> std::io::Result<()> {
    use std::fs;

    let metadata = fs::metadata("foo.txt")?;

    assert!(!metadata.is_dir());
    Ok(())
}

... observed under strace will issue:
[snip]
statx(0, NULL, AT_STATX_SYNC_AS_STAT, STATX_ALL, NULL) = -1 EFAULT (Bad address) statx(AT_FDCWD, "foo.txt", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=0, ...}) = 0

While statx is not necessarily always present, checking for it can be delayed to the first error condition. Said condition may very well never happen, in which case the check got avoided altogether.

Note this is still suboptimal as there still will be programs issuing it, but bulk of the problem is removed.

Tested by forbidding the syscall for the binary and observing it correctly falls back to newfstatat.

While here tidy up the commentary, in particular by denoting some problems with the current approach.
2023-01-14 18:45:26 +01:00
..
extern-so handle unknown targets more gracefully 2022-12-28 10:51:13 +01:00
fail tweaks to retag diagnostic handling 2023-01-02 16:05:49 +01:00
many-seeds add many-seeds capabilities to CI 2022-11-28 08:58:21 +01:00
panic handle unknown targets more gracefully 2022-12-28 10:51:13 +01:00
pass Stabilize ::{core,std}::pin::pin! 2023-01-11 14:09:14 -08:00
pass-dep Fix up stat test in libc-fs-with-isolation 2023-01-11 17:09:12 +00:00
avr.json test using a JSON target file 2022-12-28 18:01:20 +01:00
compiletest.rs Bump ui test 2022-11-08 15:05:02 +00:00