forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8acd8f8
committed
On NetBSD, force dynamic symbol resolution at postmaster start.
The default of lazy symbol resolution means that when the postmasterfirst reaches the select() call in ServerLoop, it'll need to resolvethe link to that libc entry point. NetBSD's dynamic loader takesan internal lock while doing that, and if a signal interrupts theoperation then there is a risk of self-deadlock should the signalhandler do anything that requires that lock, as several of thepostmaster signal handlers do. The window for this is pretty narrow,and timing considerations make it unlikely that a signal would arriveright then anyway. But it's semi-repeatable on slow single-CPUmachines, and in principle the race could happen with any hardware.The least messy solution to this is to force binding of dynamicsymbols at postmaster start, using the "-z now" linker option.While we're at it, also use "-z relro" so as to provide a smallsecurity gain.It's not entirely clear whether any other platforms share thisissue, but for now we'll assume it's NetBSD-specific. (We mightlater try to use "-z now" on more platforms for performancereasons, but that would not likely be something to back-patch.)Report and patch by me; the idea to fix it this way is fromAndres Freund.Discussion:https://postgr.es/m/3384826.1661802235@sss.pgh.pa.us1 parent05f9084 commit8acd8f8
1 file changed
+9
-0
lines changedLines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + |
0 commit comments
Comments
(0)