mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Don't use bgw_main even to specify in-core bgworker entrypoints.
On EXEC_BACKEND builds, this can fail if ASLR is in use. Backpatch to 9.5. On master, completely remove the bgw_main field completely, since there is no situation in which it is safe for an EXEC_BACKEND build. On 9.6 and 9.5, leave the field intact to avoid breaking things for third-party code that doesn't care about working under EXEC_BACKEND. Prior to 9.5, there are no in-core bgworker entrypoints. Petr Jelinek, reviewed by me. Discussion: http://postgr.es/m/09d8ad33-4287-a09b-a77f-77f8761adb5e@2ndquadrant.com
This commit is contained in:
@@ -295,7 +295,8 @@ logicalrep_worker_launch(Oid dbid, Oid subid, const char *subname, Oid userid,
|
||||
bgw.bgw_flags = BGWORKER_SHMEM_ACCESS |
|
||||
BGWORKER_BACKEND_DATABASE_CONNECTION;
|
||||
bgw.bgw_start_time = BgWorkerStart_RecoveryFinished;
|
||||
bgw.bgw_main = ApplyWorkerMain;
|
||||
snprintf(bgw.bgw_library_name, BGW_MAXLEN, "postgres");
|
||||
snprintf(bgw.bgw_function_name, BGW_MAXLEN, "ApplyWorkerMain");
|
||||
if (OidIsValid(relid))
|
||||
snprintf(bgw.bgw_name, BGW_MAXLEN,
|
||||
"logical replication worker for subscription %u sync %u", subid, relid);
|
||||
@@ -553,7 +554,8 @@ ApplyLauncherRegister(void)
|
||||
bgw.bgw_flags = BGWORKER_SHMEM_ACCESS |
|
||||
BGWORKER_BACKEND_DATABASE_CONNECTION;
|
||||
bgw.bgw_start_time = BgWorkerStart_RecoveryFinished;
|
||||
bgw.bgw_main = ApplyLauncherMain;
|
||||
snprintf(bgw.bgw_library_name, BGW_MAXLEN, "postgres");
|
||||
snprintf(bgw.bgw_function_name, BGW_MAXLEN, "ApplyLauncherMain");
|
||||
snprintf(bgw.bgw_name, BGW_MAXLEN,
|
||||
"logical replication launcher");
|
||||
bgw.bgw_restart_time = 5;
|
||||
|
||||
Reference in New Issue
Block a user