On 26/09/2016 11:02, Michal Privoznik wrote: > Huh, this has beacame more hairy than I initially thought. An > alternative suggestion might be to not call PID->name translate function > from the signal handler, but call it just from the qemu_kill_report(). > Yes, this will increase the chances of reporting incorrect process name, > but there's no way to make this 100% correct. I mean even at the time > that our signal callback is ran, the sender might be dead already and > kernel might have spawn a different process under the same PID. > Therefore I guess there's no real harm in doing the translation later. > Moreover, if we want this to work on *BSD-s (where an libutil function > is called which does malloc), then we must call the translate function > from a safe place. On the other hand, malloc there could be reentrant.
Still extremely unlikely to be async-signal safe, so I guess calling it from qemu_kill_report is better. Thanks! Paolo