diff options
| author | bors <bors@rust-lang.org> | 2024-10-22 08:21:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-10-22 08:21:37 +0000 |
| commit | f8448f9e0cef8cb48741d7584b2f39eea150d6ed (patch) | |
| tree | 04fdddfeb9aac43311af5402c43eef4d8cf7c0e9 | |
| parent | 3d9d3933603b1ab97aa1039bd39d90f44af38f88 (diff) | |
| parent | e51eded01a866b06edac644bba1ff10a73e069c6 (diff) | |
| download | rust-f8448f9e0cef8cb48741d7584b2f39eea150d6ed.tar.gz rust-f8448f9e0cef8cb48741d7584b2f39eea150d6ed.zip | |
Auto merge of #3982 - RalfJung:epoll_ctl, r=RalfJung
epoll_ctl: throw unsupported error on unsupported opcode `@tiif` this is a somewhat suspicious "return -1" without setting the `errno` -- what is the reasoning behind that? Throwing a clear error seems better to me.
| -rw-r--r-- | src/tools/miri/src/shims/unix/linux/epoll.rs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/tools/miri/src/shims/unix/linux/epoll.rs b/src/tools/miri/src/shims/unix/linux/epoll.rs index 539231743ae..d6788efbba4 100644 --- a/src/tools/miri/src/shims/unix/linux/epoll.rs +++ b/src/tools/miri/src/shims/unix/linux/epoll.rs @@ -256,14 +256,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let epollhup = this.eval_libc_u32("EPOLLHUP"); let epollerr = this.eval_libc_u32("EPOLLERR"); - // Fail on unsupported operations. - if op & epoll_ctl_add != epoll_ctl_add - && op & epoll_ctl_mod != epoll_ctl_mod - && op & epoll_ctl_del != epoll_ctl_del - { - throw_unsup_format!("epoll_ctl: encountered unknown unsupported operation {:#x}", op); - } - // Throw EINVAL if epfd and fd have the same value. if epfd_value == fd { return this.set_last_error_and_return_i32(LibcError("EINVAL")); @@ -363,7 +355,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // Notification will be returned for current epfd if there is event in the file // descriptor we registered. check_and_update_one_event_interest(&fd_ref, interest, id, this)?; - return interp_ok(Scalar::from_i32(0)); + interp_ok(Scalar::from_i32(0)) } else if op == epoll_ctl_del { let epoll_key = (id, fd); @@ -387,9 +379,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { .unwrap() .retain(|event| event.upgrade().is_some()); - return interp_ok(Scalar::from_i32(0)); + interp_ok(Scalar::from_i32(0)) + } else { + throw_unsup_format!("unsupported epoll_ctl operation: {op}"); } - interp_ok(Scalar::from_i32(-1)) } /// The `epoll_wait()` system call waits for events on the `Epoll` |
