diff options
| author | Noah Misch <noah@leadboat.com> | 2015-05-18 10:02:31 -0400 |
|---|---|---|
| committer | Noah Misch <noah@leadboat.com> | 2015-05-18 10:02:37 -0400 |
| commit | 439ff9b6b9de435e1c92d05221cfbcb7ff80e150 (patch) | |
| tree | 56195bd242f119e88858faf3fd128cf8ae88dda0 /src/backend/postmaster/postmaster.c | |
| parent | 6f8b6abd97711ea4f5f4f7bf92d93d32156e15d4 (diff) | |
Prevent a double free by not reentering be_tls_close().
Reentering this function with the right timing caused a double free,
typically crashing the backend. By synchronizing a disconnection with
the authentication timeout, an unauthenticated attacker could achieve
this somewhat consistently. Call be_tls_close() solely from within
proc_exit_prepare(). Back-patch to 9.0 (all supported versions).
Benkocs Norbert Attila
Security: CVE-2015-3165
Diffstat (limited to 'src/backend/postmaster/postmaster.c')
| -rw-r--r-- | src/backend/postmaster/postmaster.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 07aca31a93c..c6cca64051a 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -3464,7 +3464,16 @@ BackendInitialize(Port *port) * We arrange for a simple exit(1) if we receive SIGTERM or SIGQUIT or * timeout while trying to collect the startup packet. Otherwise the * postmaster cannot shutdown the database FAST or IMMED cleanly if a - * buggy client fails to send the packet promptly. + * buggy client fails to send the packet promptly. XXX it follows that + * the remainder of this function must tolerate losing control at any + * instant. Likewise, any pg_on_exit_callback registered before or during + * this function must be prepared to execute at any instant between here + * and the end of this function. Furthermore, affected callbacks execute + * partially or not at all when a second exit-inducing signal arrives + * after proc_exit_prepare() decrements on_proc_exit_index. (Thanks to + * that mechanic, callbacks need not anticipate more than one call.) This + * is fragile; it ought to instead follow the norm of handling interrupts + * at selected, safe opportunities. */ pqsignal(SIGTERM, startup_die); pqsignal(SIGQUIT, startup_die); |
