Commit Graph

263821 Commits

Author SHA1 Message Date
bors
c74ffd88cb Auto merge of #3820 - tiif:epoller, r=RalfJung
Add epollerr support

Fixes #3816

For socketpair, if the peer fd is closed while having data in its read buffer, ``EPOLLER`` will be thrown.

This is still WIP because I am currently finding a way to check if peer fd still has something in its ``readbuf`` when it is closed and add the ``EPOLLER`` flag In ``get_epoll_ready_events``.
2024-08-18 10:26:13 +00:00
tiif
483120d6ce Add EPOLLER support 2024-08-18 18:18:07 +08:00
bors
93700208a8 Auto merge of #3818 - tiif:loseevents, r=RalfJung
epoll: iterate through output buffer then fetch an event from ready list

Fixes #3812
2024-08-18 09:45:00 +00:00
tiif
6702f158fd epoll: iterate through output buffer then fetch an event from ready list 2024-08-18 17:12:57 +08:00
bors
8f2768b507 Auto merge of #3825 - RalfJung:epoll-miri, r=RalfJung
epoll test_socketpair_read: explicitly check real and Miri behavior
2024-08-18 09:09:58 +00:00
Ralf Jung
e614d7d51b epoll test_socketpair_read: explicitly check real and Miri behavior 2024-08-18 10:49:56 +02:00
bors
aea3cfd867 Auto merge of #3824 - tiif:maxeventeinval, r=RalfJung
Set EINVAL for epoll_wait maxevent value 0

Fixes #3821
2024-08-18 08:43:22 +00:00
Ralf Jung
f918de8c4a make sure we read all arguments before returning early 2024-08-18 10:41:58 +02:00
tiif
8ae118dc0a Move the maxevents.try_into().unwrap() after value check 2024-08-18 13:36:56 +08:00
tiif
c0e799db1a Set EINVAL for epoll_wait maxevent value 0 2024-08-18 13:11:06 +08:00
bors
8821108bf1 Auto merge of #3813 - tiif:epollfix, r=RalfJung
Testcase fix for epoll

Fixes #3811

This PR:
- Fixed the error in ``epoll_ctl_del`` test
- Simplified the logic in ``epoll_ctl_mod`` test
- Added a new test to check if flag that we don't register won't trigger notification (double negation sounds a bit confusing here, feel free to suggest a better one ;) )
- Use assert_eq(0) for epoll_ctl test
2024-08-17 22:49:47 +00:00
tiif
56eee8e870 Apply test fix
- Fix epoll_ctl_del test
- Simplified epoll_ctl_mod test and add test_no_notification_for_unregister_flag
- Use assert_eq(0) for epoll_ctl
2024-08-18 01:19:07 +08:00
bors
6ac5bbbe02 Auto merge of #3823 - RalfJung:sync, r=RalfJung
simplify synchronization object creation logic
2024-08-17 15:42:23 +00:00
Ralf Jung
7c811203cd simplify synchronization object creation logic 2024-08-17 17:39:22 +02:00
bors
3e698d0287 Auto merge of #3822 - RalfJung:tls, r=RalfJung
tls_leak_main_thread_allowed: make test check target_thread_local

Instead of ignoring the test entirely on some targets, make the test check the `target_thread_local` flag to determine whether `thread_local!` statics can be tracked by Miri and hence can have main-thread-TLS leaks ignored.
2024-08-17 14:45:42 +00:00
Ralf Jung
bd4ef64a60 run TLS tests on Solarish 2024-08-17 16:44:05 +02:00
Ralf Jung
34e8245e4c tls_leak_main_thread_allowed: make test check target_thread_local 2024-08-17 16:41:53 +02:00
bors
0058752986 Auto merge of #3819 - RalfJung:epoll-test, r=RalfJung
epoll test: further clean up check_epoll_wait

Given that `check_epoll_wait` compared the length of the two slices, I don't think it was possible for it to ever return `false`. It's also strange to have some requirements checked inside the function and some checked by the caller, so let's just move it all inside the function.

Cc `@tiif` -- did I miss anything?
2024-08-17 10:24:29 +00:00
bors
a4222b97ca Auto merge of #3815 - RalfJung:pipe, r=RalfJung
implement pipe and pipe2

Fixes https://github.com/rust-lang/miri/issues/3746
2024-08-17 09:59:37 +00:00
Ralf Jung
465df5656f epoll test: further clean up check_epoll_wait 2024-08-17 11:47:29 +02:00
bors
db9a97fbb0 Auto merge of #3817 - rust-lang:rustup-2024-08-17, r=RalfJung
Automatic Rustup
2024-08-17 09:33:36 +00:00
Ralf Jung
02a11668a3 SocketPair -> AnonSocket, because a single FD is not a pair 2024-08-17 11:32:19 +02:00
Ralf Jung
5d59bdefb4 test cleanup 2024-08-17 11:32:18 +02:00
Ralf Jung
5402be8f99 socketpair: test behavior when one end got closed 2024-08-17 11:32:18 +02:00
Ralf Jung
99d742e9b0 implement pipe and pipe2 2024-08-17 11:32:17 +02:00
bors
78dfb8a108 Auto merge of #3814 - tiif:epollhup, r=RalfJung
Add epoll EPOLLHUP flag support

Related discussion in https://github.com/rust-lang/miri/issues/3811#issuecomment-2293854742.

This PR added support for ``EPOLLHUP`` flag.
2024-08-17 08:57:07 +00:00
Ralf Jung
cab81d3fa9
extend comments on HUP vs RDHUP 2024-08-17 10:36:46 +02:00
bors
94e57fcf54 Auto merge of #3807 - RalfJung:projects, r=oli-obk
add 'project' process guidlines for larger contributions

Fixes https://github.com/rust-lang/miri/issues/3443

I am honestly not entirely sure what the consensus from what issue was. I feel like the epoll PR worked reasonably well, and not having been closely involved I am not sure which process `@oli-obk` followed there. Compared to the first draft in #3443 I tried to make this less formal and framed more as guidelines than hard rules.
2024-08-17 08:30:56 +00:00
The Miri Cronjob Bot
dc0faecfcf Merge from rustc 2024-08-17 05:02:50 +00:00
The Miri Cronjob Bot
23b57e8994 Preparing for merge from rustc 2024-08-17 04:54:54 +00:00
tiif
f9a7d6ec6f Move epoll_ready_events.epollhup = true up 2024-08-17 12:02:23 +08:00
bors
f24a6ba06f Auto merge of #106943 - mina86:exact_size_take_repeat, r=dtolnay
Implement DoubleEnded and ExactSize for Take<Repeat> and Take<RepeatWith>

Repeat iterator always returns the same element and behaves the same way
backwards and forwards.  Take iterator can trivially implement backwards
iteration over Repeat inner iterator by simply doing forwards iteration.

DoubleEndedIterator is not currently implemented for Take<Repeat<T>>
because Repeat doesn’t implement ExactSizeIterator which is a required
bound on DEI implementation for Take.

Similarly, since Repeat is an infinite iterator which never stops, Take
can trivially know how many elements it’s going to return.  This allows
implementing ExactSizeIterator on Take<Repeat<T>>.

While at it, observe that ExactSizeIterator can also be implemented for
Take<RepeatWhile<F>> so add that implementation too.  Since in contrast
to Repeat, RepeatWhile doesn’t guarante to always return the same value,
DoubleEndedIterator isn’t implemented.

Those changes render core::iter::repeat_n somewhat redundant.

Issue: https://github.com/rust-lang/rust/issues/104434
Issue: https://github.com/rust-lang/rust/issues/104729

- [ ] ACP: https://github.com/rust-lang/libs-team/issues/120 (this is actually ACP for repeat_n but this is nearly the same functionality so hijacking it so both approaches can be discussed in one place)
2024-08-17 01:46:24 +00:00
bors
67d09736ea Auto merge of #116528 - daxpedda:stabilize-ready-into-inner, r=dtolnay
Stabilize `Ready::into_inner()`

This PR stabilizes `Ready::into_inner()`.

Tracking issue: #101196.
Implementation PR: #101189.

Closes #101196.
2024-08-16 23:20:38 +00:00
bors
506052d49d Auto merge of #129162 - matthiaskrgr:rollup-r0oxdev, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #128990 (Re-enable more debuginfo tests on freebsd)
 - #129042 (Special-case alias ty during the delayed bug emission in `try_from_lit`)
 - #129086 (Stabilize `is_none_or`)
 - #129149 (Migrate `validate_json.py` script to rust in `run-make/rustdoc-map-file` test)
 - #129154 (Fix wrong source location for some incorrect macro definitions)
 - #129161 (Stabilize std:🧵:Builder::spawn_unchecked)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-16 20:19:00 +00:00
tiif
0951107881 Add epoll EPOLLHUP flag support 2024-08-17 02:08:31 +08:00
Matthias Krüger
a9bf86a5f2
Rollup merge of #129161 - dtolnay:spawnunck, r=Noratrieb
Stabilize std:🧵:Builder::spawn_unchecked

Closes #55132.
2024-08-16 19:59:00 +02:00
Matthias Krüger
5bceee4762
Rollup merge of #129154 - wafarm:fix-95463, r=estebank
Fix wrong source location for some incorrect macro definitions

Fixes #95463

Currently the code will consume the next token tree after `var` when trying to parse `$var:some_type` even when it's not a `:` (e.g. a `$` when input is `($foo $bar:tt) => {}`). Additionally it will return the wrong span when it's not a `:`.

This PR fixes these problems.
2024-08-16 19:58:59 +02:00
Matthias Krüger
7177a0eeef
Rollup merge of #129149 - GuillaumeGomez:migrate-python-script, r=jieyouxu
Migrate `validate_json.py` script to rust in `run-make/rustdoc-map-file` test

This PR fixes the FIXME I added for future-me who become present-me. :')

Since there are multiple `run-make` tests using python scripts, I suppose more of them will migrate to Rust, hence why I added the `jzon` public reexport to the `run-make-support` crate.

cc `@jieyouxu`
r? `@Kobzol`
2024-08-16 19:58:59 +02:00
Matthias Krüger
9d57e46f81
Rollup merge of #129086 - slanterns:is_none_or, r=dtolnay
Stabilize `is_none_or`

Closes: https://github.com/rust-lang/rust/issues/126383.

`@rustbot` label: +T-libs-api

r? libs-api
2024-08-16 19:58:58 +02:00
Matthias Krüger
f04d25fa91
Rollup merge of #129042 - Jaic1:fix-116308, r=BoxyUwU
Special-case alias ty during the delayed bug emission in `try_from_lit`

This PR tries to fix #116308.

A delayed bug in `try_from_lit` will not be emitted so that the compiler will not ICE when it sees the pair `(ast::LitKind::Int, ty::TyKind::Alias)` in `lit_to_const` (called from `try_from_lit`).

This PR is related to an unstable feature `adt_const_params` (#95174).

r? ``@BoxyUwU``
2024-08-16 19:58:58 +02:00
Matthias Krüger
19d32e4e23
Rollup merge of #128990 - saethlin:freebsd-debuginfo-tests, r=compiler-errors
Re-enable more debuginfo tests on freebsd

These ignores are _ancient_, we don't run freebsd tests in CI, and even if we did they'd probably pass because the test suite passes with the latest gdb release on Linux.
2024-08-16 19:58:57 +02:00
bors
569d7e3d15 Auto merge of #128456 - Oneirical:clantestine-operations, r=jieyouxu
Migrate `reproducible-build` `run-make` test to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

This will likely fail. Locally, rustc errors with `linker 'linker' not found` on line 36 while the file exists according to the dir-debug statement before it.

If this gets fixed and the test passes, further developments may include:

- [x] There may be some leftovers from each test - `test_in_tmpdir` may therefore be required.
- [ ] Try jobs on all ignored architectures.
- [x] A potential refactor with a struct and a custom function like #128410 so this isn't just a huge stream of `rfs` and `rustc`. This is a little bit harder to do in this test considering the variability present in each test case.

// try-job: x86_64-msvc // windows jobs passed in a prior run
// try-job: x86_64-mingw
// try-job: i686-msvc
// try-job: i686-mingw
try-job: aarch64-apple
try-job: aarch64-gnu
try-job: armhf-gnu
try-job: test-various
try-job: dist-various-1
2024-08-16 17:53:53 +00:00
David Tolnay
e6ac503ec1
Stabilize std:🧵:Builder::spawn_unchecked 2024-08-16 10:43:47 -07:00
bors
83f1b38082 Auto merge of #3809 - RalfJung:fd-refcell, r=oli-obk
FD: remove big surrounding RefCell, simplify socketpair

A while ago, I added the big implicit RefCell for all file descriptions since it avoided interior mutability in `eventfd`. However, this requires us to hold the RefCell "lock" around the entire invocation of the `read`/`write` methods on an FD, which is not great. For instance, if an FD wants to update epoll notifications from inside its `read`/`write`, it is very crucial that the notification check does not end up accessing the FD itself. Such cycles, however, occur naturally:
- eventfd wants to update notifications for itself
- socketfd wants to update notifications on its "peer", which will in turn check *its* peer to see whether that buffer is empty -- and my peer's peer is myself.

This then also lets us simplify socketpair, which currently holds a weak reference to its peer *and* a weak reference to the peer's buffer -- that was previously needed precisely to avoid this issue.
2024-08-16 16:14:42 +00:00
bors
1a51dd9247 Auto merge of #3754 - Vanille-N:master, r=RalfJung
Make unused states of Reserved unrepresentable

In the [previous TB update](https://github.com/rust-lang/miri/pull/3742) we discovered that the existence of `Reserved + !ty_is_freeze + protected` is undesirable.

This has the side effect of making `Reserved { conflicted: true, ty_is_freeze: false }` unreachable.
As such it is desirable that this state would also be unrepresentable.

This PR eliminates the unused configuration by changing
```rs
enum PermissionPriv {
    Reserved { ty_is_freeze: bool, conflicted: bool },
    ...
}
```
into
```rs
enum PermissionPriv {
    ReservedFrz { conflicted: bool },
    ReservedIM,
    ...
}
```
but this is not the only solution and `Reserved(Activable | Conflicted | InteriorMut)` could be discussed.
In addition to making the unreachable state not representable anymore, this change has the nice side effect of enabling `foreign_read` to no longer depend explicitly on the `protected` flag.

Currently waiting for
- `@JoJoDeveloping` to confirm that this is the same representation of `Reserved` as what is being implemented in simuliris,
- `@RalfJung` to approve that this does not introduce too much overhead in the trusted codebase.
2024-08-16 15:48:55 +00:00
Ralf Jung
883e4773b3 explain the behavior on closed peers 2024-08-16 17:44:01 +02:00
Ralf Jung
9184eb54ea more epoll test cleanup 2024-08-16 16:58:49 +02:00
Ralf Jung
edd1efb136 comment and test regarding notifications on writes that dont change readiness 2024-08-16 16:55:57 +02:00
Ralf Jung
b4ab820e5e epoll test cleanup 2024-08-16 16:55:56 +02:00
Ben Kimock
c6815c04cb Re-enable debuginfo tests on freebsd 2024-08-16 10:37:16 -04:00