@@ -12,7 +12,7 @@ use shims::unix::linux::mem::EvalContextExt as _;
12
12
use shims:: unix:: linux:: sync:: futex;
13
13
14
14
pub fn is_dyn_sym ( name : & str ) -> bool {
15
- matches ! ( name, "getrandom" )
15
+ matches ! ( name, "getrandom" | "statx" )
16
16
}
17
17
18
18
impl < ' mir , ' tcx : ' mir > EvalContextExt < ' mir , ' tcx > for crate :: MiriInterpCx < ' mir , ' tcx > { }
@@ -29,7 +29,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
29
29
// See `fn emulate_foreign_item_inner` in `shims/foreign_items.rs` for the general pattern.
30
30
31
31
match link_name. as_str ( ) {
32
- // File related shims (but also see "syscall" below for statx)
32
+ // File related shims
33
33
"readdir64" => {
34
34
let [ dirp] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
35
35
let result = this. linux_readdir64 ( dirp) ?;
@@ -41,6 +41,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
41
41
let result = this. sync_file_range ( fd, offset, nbytes, flags) ?;
42
42
this. write_scalar ( result, dest) ?;
43
43
}
44
+ "statx" => {
45
+ let [ dirfd, pathname, flags, mask, statxbuf] =
46
+ this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
47
+ let result = this. linux_statx ( dirfd, pathname, flags, mask, statxbuf) ?;
48
+ this. write_scalar ( Scalar :: from_i32 ( result) , dest) ?;
49
+ }
44
50
45
51
// epoll, eventfd
46
52
"epoll_create1" => {
@@ -113,7 +119,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
113
119
// have the right type.
114
120
115
121
let sys_getrandom = this. eval_libc ( "SYS_getrandom" ) . to_target_usize ( this) ?;
116
- let sys_statx = this. eval_libc ( "SYS_statx" ) . to_target_usize ( this) ?;
117
122
let sys_futex = this. eval_libc ( "SYS_futex" ) . to_target_usize ( this) ?;
118
123
119
124
if args. is_empty ( ) {
@@ -134,20 +139,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
134
139
}
135
140
getrandom ( this, & args[ 1 ] , & args[ 2 ] , & args[ 3 ] , dest) ?;
136
141
}
137
- // `statx` is used by `libstd` to retrieve metadata information on `linux`
138
- // instead of using `stat`,`lstat` or `fstat` as on `macos`.
139
- id if id == sys_statx => {
140
- // The first argument is the syscall id, so skip over it.
141
- if args. len ( ) < 6 {
142
- throw_ub_format ! (
143
- "incorrect number of arguments for `statx` syscall: got {}, expected at least 6" ,
144
- args. len( )
145
- ) ;
146
- }
147
- let result =
148
- this. linux_statx ( & args[ 1 ] , & args[ 2 ] , & args[ 3 ] , & args[ 4 ] , & args[ 5 ] ) ?;
149
- this. write_scalar ( Scalar :: from_target_isize ( result. into ( ) , this) , dest) ?;
150
- }
151
142
// `futex` is used by some synchronization primitives.
152
143
id if id == sys_futex => {
153
144
futex ( this, & args[ 1 ..] , dest) ?;
0 commit comments