Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Libc is a lot more tricky about signals, since not all libc functions can be safely called from handlers.

And this is a huge thing. People do all kinds of operations in signal handlers completely oblivious to the pitfalls. Pitfalls which often do not manifest, making it a great "it works for me" territory.

I once raised a ticket on fluentbit[1] about it but they have abused signal handlers so thoroughly that I do not think they can mitigate the issue without a major rewriting of the signal and crash handling.

[1] https://github.com/fluent/fluent-bit/issues/4836



Calls to printf() are particularly common in signal handlers I've seen in commercial code. malloc() too occasionally. Sometimes calls to logging functions

These are undefined behaviour, for real (and for good reasons), not just theoretically. They are a cause of reported occasional random crashes, but people don't realise, and it's tricky to demonstrate or warn at compile time.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: