Skip to content

Fix SIGCHLD race in signal handler setup#5210

Merged
lifubang merged 1 commit intoopencontainers:mainfrom
lifubang:fix-signal-race
Apr 2, 2026
Merged

Fix SIGCHLD race in signal handler setup#5210
lifubang merged 1 commit intoopencontainers:mainfrom
lifubang:fix-signal-race

Conversation

@lifubang
Copy link
Copy Markdown
Member

@lifubang lifubang commented Apr 1, 2026

This is an alternative to #5206.
Fix: #5208

When signal installation was moved to a goroutine for performance(#4654), containers that exited quickly could complete before SIGCHLD was registered, causing runc to hang waiting for the signal.

This fix ensures SIGCHLD is registered immediately in the main thread before other signals are handled in the goroutine, maintaining performance while guaranteeing no missed SIGCHLD notifications for fast-exiting containers.

Reported-by: Ayato Tokubi atokubi@redhat.com

Comment thread signals.go Outdated
}
handler := make(chan *signalHandler)

// ensure that we have a large buffer size so that we do not miss any
Copy link
Copy Markdown
Contributor

@kolyshkin kolyshkin Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a very minor nit:

Suggested change
// ensure that we have a large buffer size so that we do not miss any
// Ensure that we have a large buffer size so that we do not miss any

Copy link
Copy Markdown
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread signals.go Outdated
Comment on lines +37 to +38
// setup.
// But `SIGCHLD` is very important, so we need to handle it immediately.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// setup.
// But `SIGCHLD` is very important, so we need to handle it immediately.
- // setup.
+ // setup, except for SIGCHLD which is very important (see #5208).

@kolyshkin kolyshkin requested review from AkihiroSuda and cyphar April 1, 2026 17:47
@kolyshkin kolyshkin added backport/1.3-todo A PR in main branch which needs to be backported to release-1.3 backport/1.4-todo A PR in main branch which needs to backported to release-1.4 backport/1.5-todo A PR in main branch which needs to be backported to release-1.5 labels Apr 1, 2026
@kolyshkin kolyshkin added this to the 1.5.0-rc.2 milestone Apr 1, 2026
@kolyshkin
Copy link
Copy Markdown
Contributor

I want to include this into 1.5.0rc2, @opencontainers/runc-maintainers ptal

@kolyshkin
Copy link
Copy Markdown
Contributor

@lifubang feel free to merge as is or modify the comments, either way is fine with me. Once merged, please open an 1.5 backport, I want to release rc2 asap

When signal installation was moved to a goroutine for performance,
containers that exited quickly could complete before SIGCHLD was
registered, causing runc to hang waiting for the signal.

This fix ensures SIGCHLD is registered immediately in the main thread
before other signals are handled in the goroutine, maintaining performance
while guaranteeing no missed SIGCHLD notifications for fast-exiting
containers.

Reported-by: Ayato Tokubi <atokubi@redhat.com>
Signed-off-by: lifubang <lifubang@acmcoder.com>
@lifubang lifubang merged commit 62d4f14 into opencontainers:main Apr 2, 2026
55 checks passed
@lifubang lifubang added backport/1.3-done A PR in main branch which has been backported to release-1.3 backport/1.4-done A PR in main branch which has been backported to release-1.4 backport/1.5-done A PR in main branch which has been backported to release-1.5 and removed backport/1.3-todo A PR in main branch which needs to be backported to release-1.3 backport/1.4-todo A PR in main branch which needs to backported to release-1.4 backport/1.5-todo A PR in main branch which needs to be backported to release-1.5 labels Apr 2, 2026
@kolyshkin kolyshkin mentioned this pull request Apr 2, 2026
@kolyshkin kolyshkin removed this from the 1.5.0-rc.2 milestone Apr 3, 2026
Maks1mS pushed a commit to stplr-dev/stplr that referenced this pull request Apr 5, 2026
This PR contains the following updates:

| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [github.com/opencontainers/runc](https://github.com/opencontainers/runc) | require | patch | `v1.4.1` → `v1.4.2` | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/opencontainers/runc/badge)](https://securityscorecards.dev/viewer/?uri=github.com/opencontainers/runc) |

---

> ⚠️ **Warning**
>
> Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/23) for more information.

---

### Release Notes

<details>
<summary>opencontainers/runc (github.com/opencontainers/runc)</summary>

### [`v1.4.2`](https://github.com/opencontainers/runc/releases/tag/v1.4.2): runc v1.4.2 -- &quot;Я — Земля! Я своих провожаю питомцев&quot;

[Compare Source](opencontainers/runc@v1.4.1...v1.4.2)

This is the second patch release of the 1.4.z release series of runc.

##### Fixed

- A regression in runc v1.3.0 which can result in a stuck `runc exec` or
  `runc run` when the container process runs for a short time. ([#&#8203;5208](opencontainers/runc#5208),
  [#&#8203;5210](opencontainers/runc#5210), [#&#8203;5216](opencontainers/runc#5216))

- Mount sources that need to be open on the host are now closed earlier during
  container start, reducing the total amount of used file descriptors and
  helping to avoid hitting the open files limit when handling many such mounts.
  ([#&#8203;5177](opencontainers/runc#5177), [#&#8203;5201](opencontainers/runc#5201))

##### Static Linking Notices

The `runc` binary distributed with this release are *statically linked* with
the following [GNU LGPL-2.1][lgpl-2.1] licensed libraries, with `runc` acting
as a "work that uses the Library":

[lgpl-2.1]: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html

- [libseccomp](https://github.com/seccomp/libseccomp)

The versions of these libraries were not modified from their upstream versions,
but in order to comply with the LGPL-2.1 (§6(a)), we have attached the
complete source code for those libraries which (when combined with the attached
runc source code) may be used to exercise your rights under the LGPL-2.1.

However we strongly suggest that you make use of your distribution's packages
or download them from the authoritative upstream sources, especially since
these libraries are related to the security of your containers.

***

Thanks to the following contributors for making this release possible:

- Ayato Tokubi <atokubi@redhat.com>
- Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
- Aleksa Sarai <cyphar@cyphar.com>
- Kir Kolyshkin <kolyshkin@gmail.com>
- Li Fubang <lifubang@acmcoder.com>
- Rodrigo Campos Catelin <rodrigo@amutable.com>

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At 12:00 AM through 04:59 AM and 10:00 PM through 11:59 PM, Monday through Friday ( * 0-4,22-23 * * 1-5 ), Only on Sunday and Saturday ( * * * * 0,6 ) (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My44Ni4xIiwidXBkYXRlZEluVmVyIjoiNDMuODYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9EZXBlbmRlbmNpZXMiXX0=-->

Reviewed-on: https://altlinux.space/stapler/stplr/pulls/387
Co-authored-by: Renovate Bot <stapler-helper-bot@noreply.altlinux.space>
Co-committed-by: Renovate Bot <stapler-helper-bot@noreply.altlinux.space>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/1.3-done A PR in main branch which has been backported to release-1.3 backport/1.4-done A PR in main branch which has been backported to release-1.4 backport/1.5-done A PR in main branch which has been backported to release-1.5 regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

a SIGCHLD race in signal handler setup (regression since runc 1.3.0)

3 participants