Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport v3.4-branch] posix: eventfd: fix waking up poll() #59639

Closed
wants to merge 3 commits into from

Conversation

zephyrbot
Copy link
Collaborator

@zephyrbot zephyrbot commented Jun 22, 2023

Backport 2bc980f~2..2bc980f from #59505.

Fixes: #59577

Fix a regression introduced by commit e6eb0a7 ("posix: eventfd: revise
locking, signaling, and allocation"), which was a complete rewrite stating
that:

  The `wait_q` and `k_poll_signal` entries were removed from
  `struct eventfd` as they were unnecessary.

In fact, `k_poll_signal` (both `read_sig` and `write_sig`) were used to
wake-up blocking `poll()` invocation in another thread. This is no longer
the case now, i.e. `poll(..., POLLIN)` does not return after calling
`eventfd_write()` on the observed (polled) FD.

Fix this regression by bringing back `read_sig` and `write_sig` to very
similar state as it was before.

Fixes: e6eb0a7 ("posix: eventfd: revise locking, signaling, and
  allocation")
Signed-off-by: Marcin Niestroj <[email protected]>
(cherry picked from commit 44d61bd)
Make sure that `poll(..., POLLIN)` executed from another thread returns
when `eventfd_write()` is called. Test also the same with `poll(...,
POLLOUT)` and `eventfd_read()` on eventfd with counter equal to
`UINT64_MAX - 1`.

Signed-off-by: Marcin Niestroj <[email protected]>
(cherry picked from commit 2bc980f)
@zephyrbot zephyrbot requested a review from cfriedt as a code owner June 22, 2023 20:10
@zephyrbot zephyrbot added Backport Backport PR and backport failure issues area: POSIX POSIX API Library labels Jun 22, 2023
@jgl-meta
Copy link
Collaborator

@cfriedt can you check out the CI failures if you get a chance?

@cfriedt
Copy link
Member

cfriedt commented Jul 19, 2023

@jgl-meta - the TLS issue can likely be fixed by a separate MbedTLS backport

The aarch64 crashes are yet another backport, not sure which one will fix those, cc @carlocaione

@RicArch97
Copy link

Any updates on this? It's a critical fix for a project I'm currently working on.

Since the argument is a 32-bit unsigned int, all possible
values satisfy the condition that intval < UINT64_MAX - 1.

Remove the redundant conditional.

Signed-off-by: Christopher Friedt <[email protected]>
@cfriedt
Copy link
Member

cfriedt commented Aug 17, 2023

Any updates on this? It's a critical fix for a project I'm currently working on.

@RicArch97 - this might still depend on the backport of #61455 (#61614)

@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@henrikbrixandersen
Copy link
Member

@cfriedt Please look into this.

@cfriedt
Copy link
Member

cfriedt commented Oct 24, 2023

@cfriedt Please look into this.

I am already, thanks for the reminders.

Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Dec 24, 2023
@github-actions github-actions bot closed this Jan 7, 2024
@nashif nashif deleted the backport-59505-to-v3.4-branch branch February 13, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: POSIX POSIX API Library Backport Backport PR and backport failure issues Stale
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants