-
Notifications
You must be signed in to change notification settings - Fork 124
fix(starry,nginx): multi-worker signal interruption and EPOLLEXCLUSIVE handling #1018
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
Merged
ZR233
merged 6 commits into
rcore-os:dev
from
Antareske:fix/dev-starry-nginx-multiworker-kernel
Jun 4, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ff70c03
fix(starry,nginx): fix multi-worker signal interruption and EPOLLEXCL…
Antareske 4b3fa0d
Merge branch 'rcore-os:dev' into fix/dev-starry-nginx-multiworker-kernel
Antareske 39a11fd
test(starry,epoll): add EPOLLEXCLUSIVE syscall regression case
Antareske 470f8db
test(starry,epoll): add signal interrupt EINTR case
Antareske e01a90c
Merge branch 'rcore-os:dev' into fix/dev-starry-nginx-multiworker-kernel
Antareske b2305a2
fix(starry,nginx): tighten epoll exclusive ABI checks
Antareske File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
test-suit/starryos/normal/qemu-smp1/syscall/test-epoll-exclusive/c/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| cmake_minimum_required(VERSION 3.20) | ||
| project(test-epoll-exclusive C) | ||
|
|
||
| set(CMAKE_C_STANDARD 11) | ||
| set(CMAKE_C_STANDARD_REQUIRED ON) | ||
| set(CMAKE_C_EXTENSIONS OFF) | ||
|
|
||
| add_executable(test-epoll-exclusive src/main.c) | ||
| target_include_directories(test-epoll-exclusive PRIVATE ../../common) | ||
| target_compile_options(test-epoll-exclusive PRIVATE -Wall -Wextra -Werror) | ||
|
|
||
| install(TARGETS test-epoll-exclusive RUNTIME DESTINATION usr/bin/starry-test-suit) |
110 changes: 110 additions & 0 deletions
110
test-suit/starryos/normal/qemu-smp1/syscall/test-epoll-exclusive/c/src/main.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| #include "test_framework.h" | ||
|
|
||
| #include <stdint.h> | ||
| #include <sys/epoll.h> | ||
| #include <unistd.h> | ||
|
|
||
| static void close_pipe(int pipefd[2]) | ||
| { | ||
| if (pipefd[0] >= 0) { | ||
| close(pipefd[0]); | ||
| } | ||
| if (pipefd[1] >= 0) { | ||
| close(pipefd[1]); | ||
| } | ||
| } | ||
|
|
||
| int main(void) | ||
| { | ||
| /* | ||
| * 回归目标: | ||
| * 1) Linux 合法的 EPOLLEXCLUSIVE ADD 必须被接受; | ||
| * 2) Linux 明确非法的 EPOLLEXCLUSIVE 组合必须返回 EINVAL。 | ||
| * 3) StarryOS 目前不放行 EPOLLWAKEUP,因此相关组合仍应返回 EINVAL。 | ||
| */ | ||
| TEST_START("epoll_ctl: EPOLLEXCLUSIVE Linux ABI checks"); | ||
|
|
||
| int epfd = epoll_create1(EPOLL_CLOEXEC); | ||
| CHECK(epfd >= 0, "epoll_create1 succeeds"); | ||
| if (epfd < 0) { | ||
| TEST_DONE(); | ||
| } | ||
|
|
||
| int ok_pipe[2] = {-1, -1}; | ||
| CHECK_RET(pipe(ok_pipe), 0, "pipe for EPOLLEXCLUSIVE positive case"); | ||
| if (ok_pipe[0] >= 0) { | ||
| struct epoll_event ev = { | ||
| .events = EPOLLIN | EPOLLEXCLUSIVE, | ||
| .data.fd = ok_pipe[0], | ||
| }; | ||
| CHECK_RET(epoll_ctl(epfd, EPOLL_CTL_ADD, ok_pipe[0], &ev), 0, | ||
| "epoll_ctl ADD with EPOLLEXCLUSIVE returns 0"); | ||
|
|
||
| CHECK_ERR(epoll_ctl(epfd, EPOLL_CTL_MOD, ok_pipe[0], &ev), EINVAL, | ||
| "epoll_ctl MOD with EPOLLEXCLUSIVE returns EINVAL"); | ||
|
|
||
| ev.events = EPOLLIN; | ||
| CHECK_ERR(epoll_ctl(epfd, EPOLL_CTL_MOD, ok_pipe[0], &ev), EINVAL, | ||
| "epoll_ctl MOD after exclusive ADD returns EINVAL"); | ||
| } | ||
|
|
||
| int oneshot_pipe[2] = {-1, -1}; | ||
| CHECK_RET(pipe(oneshot_pipe), 0, "pipe for EPOLLONESHOT negative case"); | ||
| if (oneshot_pipe[0] >= 0) { | ||
| struct epoll_event ev = { | ||
| .events = EPOLLIN | EPOLLONESHOT | EPOLLEXCLUSIVE, | ||
| .data.fd = oneshot_pipe[0], | ||
| }; | ||
| CHECK_ERR(epoll_ctl(epfd, EPOLL_CTL_ADD, oneshot_pipe[0], &ev), EINVAL, | ||
| "epoll_ctl ADD rejects EPOLLONESHOT with EPOLLEXCLUSIVE"); | ||
| } | ||
|
|
||
| int rdhup_pipe[2] = {-1, -1}; | ||
| CHECK_RET(pipe(rdhup_pipe), 0, "pipe for EPOLLRDHUP negative case"); | ||
| if (rdhup_pipe[0] >= 0) { | ||
| struct epoll_event ev = { | ||
| .events = EPOLLIN | EPOLLRDHUP | EPOLLEXCLUSIVE, | ||
| .data.fd = rdhup_pipe[0], | ||
| }; | ||
| CHECK_ERR(epoll_ctl(epfd, EPOLL_CTL_ADD, rdhup_pipe[0], &ev), EINVAL, | ||
| "epoll_ctl ADD rejects EPOLLRDHUP with EPOLLEXCLUSIVE"); | ||
| } | ||
|
|
||
| int pri_pipe[2] = {-1, -1}; | ||
| CHECK_RET(pipe(pri_pipe), 0, "pipe for EPOLLPRI negative case"); | ||
| if (pri_pipe[0] >= 0) { | ||
| struct epoll_event ev = { | ||
| .events = EPOLLIN | EPOLLPRI | EPOLLEXCLUSIVE, | ||
| .data.fd = pri_pipe[0], | ||
| }; | ||
| CHECK_ERR(epoll_ctl(epfd, EPOLL_CTL_ADD, pri_pipe[0], &ev), EINVAL, | ||
| "epoll_ctl ADD rejects EPOLLPRI with EPOLLEXCLUSIVE"); | ||
| } | ||
|
|
||
| int wake_pipe[2] = {-1, -1}; | ||
| CHECK_RET(pipe(wake_pipe), 0, "pipe for EPOLLWAKEUP negative case"); | ||
| if (wake_pipe[0] >= 0) { | ||
| struct epoll_event ev = { | ||
| .events = EPOLLIN | EPOLLWAKEUP | EPOLLEXCLUSIVE, | ||
| .data.fd = wake_pipe[0], | ||
| }; | ||
| CHECK_ERR(epoll_ctl(epfd, EPOLL_CTL_ADD, wake_pipe[0], &ev), EINVAL, | ||
| "epoll_ctl ADD rejects EPOLLWAKEUP with EPOLLEXCLUSIVE on StarryOS"); | ||
| } | ||
|
|
||
| struct epoll_event ev = { | ||
| .events = EPOLLIN | EPOLLEXCLUSIVE, | ||
| .data.fd = epfd, | ||
| }; | ||
| CHECK_ERR(epoll_ctl(epfd, EPOLL_CTL_ADD, epfd, &ev), EINVAL, | ||
| "epoll_ctl ADD rejects epoll target with EPOLLEXCLUSIVE"); | ||
|
|
||
| close_pipe(ok_pipe); | ||
| close_pipe(oneshot_pipe); | ||
| close_pipe(rdhup_pipe); | ||
| close_pipe(pri_pipe); | ||
| close_pipe(wake_pipe); | ||
| close(epfd); | ||
|
|
||
| TEST_DONE(); | ||
| } |
12 changes: 12 additions & 0 deletions
12
test-suit/starryos/normal/qemu-smp1/test-signal-interrupt-eintr/c/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| cmake_minimum_required(VERSION 3.20) | ||
| project(test-signal-interrupt-eintr C) | ||
|
|
||
| set(CMAKE_C_STANDARD 11) | ||
| set(CMAKE_C_STANDARD_REQUIRED ON) | ||
| set(CMAKE_C_EXTENSIONS OFF) | ||
|
|
||
| add_executable(test-signal-interrupt-eintr src/main.c) | ||
| target_include_directories(test-signal-interrupt-eintr PRIVATE src) | ||
| target_compile_options(test-signal-interrupt-eintr PRIVATE -Wall -Wextra -Werror) | ||
|
|
||
| install(TARGETS test-signal-interrupt-eintr RUNTIME DESTINATION usr/bin) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.