@@ -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,9 +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
-
117
- let sys_statx = this. eval_libc ( "SYS_statx" ) . to_target_usize ( this) ?;
118
-
119
122
let sys_futex = this. eval_libc ( "SYS_futex" ) . to_target_usize ( this) ?;
120
123
121
124
if args. is_empty ( ) {
@@ -136,20 +139,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
136
139
}
137
140
getrandom ( this, & args[ 1 ] , & args[ 2 ] , & args[ 3 ] , dest) ?;
138
141
}
139
- // `statx` is used by `libstd` to retrieve metadata information on `linux`
140
- // instead of using `stat`,`lstat` or `fstat` as on `macos`.
141
- id if id == sys_statx => {
142
- // The first argument is the syscall id, so skip over it.
143
- if args. len ( ) < 6 {
144
- throw_ub_format ! (
145
- "incorrect number of arguments for `statx` syscall: got {}, expected at least 6" ,
146
- args. len( )
147
- ) ;
148
- }
149
- let result =
150
- this. linux_statx ( & args[ 1 ] , & args[ 2 ] , & args[ 3 ] , & args[ 4 ] , & args[ 5 ] ) ?;
151
- this. write_scalar ( Scalar :: from_target_isize ( result. into ( ) , this) , dest) ?;
152
- }
153
142
// `futex` is used by some synchronization primitives.
154
143
id if id == sys_futex => {
155
144
futex ( this, & args[ 1 ..] , dest) ?;
0 commit comments