- NevemTeve blogja
- A hozzászóláshoz be kell jelentkezni
Hozzászólások
OT
Korábban is volt olyan OpenBSD-hiba, amire Theo valami olyasmit írt, hogy 20-30 évvel korábban SunOS-en (vagy Solarison?) már egyszer javította.
/OT
- A hozzászóláshoz be kell jelentkezni
Ha jól értem, a kulcsgondolat az, hogy signal-handler-ből free(3)-t hívunk
Igen (eredeti link); azt írja:
sshd's SIGALRM handler is called asynchronously, but this signal handler calls various functions that are not async-signal-safe
Nagyon kevesen foglalkoznak az igazság valódi forrásával:
If the process is multi-threaded, or if the process is single-threaded and a signal handler is executed other than as the result of:
The process calling abort(), raise(), kill(), pthread_kill(), or sigqueue() to generate a signal that is not blocked
A pending signal being unblocked and being delivered before the call that unblocked it returns
the behavior is undefined if the signal handler refers to any object other than errno with static storage duration other than by assigning a value to an object declared as volatile sig_atomic_t, or if the signal handler calls any function defined in this standard other than one of the functions listed in the following table.
Röviden úgy lehet összefoglalni, hogy ha unsafe környezetet szakít meg a handler és a handler-ben unsafe műveletet végzünk, akkor UB.
Ha legalább az egyik safe, akkor rendben vagyunk.
Kapcsolódó kommentek a Hacker News topikban.
- A hozzászóláshoz be kell jelentkezni