@encthenet write(2) to a self pipe you already have open is also safe and well-trodden, in order to inject an event into your event loop. Some OSes also have event loop systems with a facility built for this, such as port_send(3C) from event ports on illumos.
Conversation
Notices
-
Embed this notice
Joshua M. Clulow (jmc@m.unix.house)'s status on Tuesday, 02-Jul-2024 07:53:08 JST Joshua M. Clulow
- Haelwenn /элвэн/ :triskell: likes this.
-
Embed this notice
John-Mark Gurney (encthenet@flyovercountry.social)'s status on Tuesday, 02-Jul-2024 07:53:09 JST John-Mark Gurney
The OpenSSH vuln is just a reminder that there's a list of officially supported syscalls you're allows to make in a signal handler, and the BEST thing is to pretend that list only contains _exit and no functions, and instead, set a sig_atomic_t type, and handle it in the body of your code/event loop.
Anything else is just problematic.