Not safe to use SIGUSR1 with kj on non-epoll, non-kqueue platforms (of which none anyone actually uses) #679

Closed
opened 2025-02-17 01:19:31 +00:00 by jade · 1 comment
Owner

I found this while reading kj code. According to the code it's unsafe to use SIGUSR1 for your own purposes, except that lol it doesn't matter on any real operating system, of which 100% support either kqueue and epoll:

  • Linux, illumos have epoll and use eventfd
  • FreeBSD, OpenBSD, macOS have kqueue and use a user event

capnproto/capnproto@edc45f93c3/c /src/kj/async-unix.h (L76-L78)

All we have to do is reserve a different signal with kj's setReservedSignal or move our own SIGUSR1 usage to a different signal. Either way it's easy to do.

I found this while reading kj code. According to the code it's unsafe to use SIGUSR1 for your own purposes, except that lol it doesn't matter on any real operating system, of which *100%* support either kqueue and epoll: - Linux, illumos have epoll and use eventfd - FreeBSD, OpenBSD, macOS have kqueue and use a user event https://github.com/capnproto/capnproto/blob/edc45f93c33546170916dd85f5f0097d87b609a0/c++/src/kj/async-unix.h#L76-L78 All we have to do is reserve a different signal with kj's `setReservedSignal` or move our own SIGUSR1 usage to a different signal. Either way it's easy to do.
jade self-assigned this 2025-02-17 01:19:31 +00:00
pennae added this to the 2.93 milestone 2025-04-06 09:28:50 +00:00
Member

This issue was mentioned on Gerrit on the following CLs:

  • commit message in cl/3098 ("libmain: tell kj to use SIGUSR2")
<!-- GERRIT_LINKBOT: {"cls": [{"backlink": "https://gerrit.lix.systems/c/lix/+/3098", "number": 3098, "kind": "commit message"}], "cl_meta": {"3098": {"change_title": "libmain: tell kj to use SIGUSR2"}}} --> This issue was mentioned on Gerrit on the following CLs: * commit message in [cl/3098](https://gerrit.lix.systems/c/lix/+/3098) ("libmain: tell kj to use SIGUSR2")
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lix-project/lix#679
No description provided.