aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2021-08-13 10:38:22 +1200
committerThomas Munro <tmunro@postgresql.org>2021-08-13 11:11:59 +1200
commit8201b60565b8da465e75da4e4c6d2f01bf976a43 (patch)
tree4d5cd33bc2c94657079c5b291613d9b1dddcd54a /src
parent886531f3f403cae67a4537f0a2a1edc730f6b793 (diff)
downloadpostgresql-8201b60565b8da465e75da4e4c6d2f01bf976a43.tar.gz
postgresql-8201b60565b8da465e75da4e4c6d2f01bf976a43.zip
Make EXEC_BACKEND more convenient on macOS.
It's hard to disable ASLR on current macOS releases, for testing with -DEXEC_BACKEND. You could already set the environment variable PG_SHMEM_ADDR to something not likely to collide with mappings created earlier in process startup. Let's also provide a default value that works on current releases and architectures, for developer convenience. As noted in the pre-existing comment, this is a horrible hack, but -DEXEC_BACKEND is only used by Unix-based PostgreSQL developers for testing some otherwise Windows-only code paths, so it seems excusable. Back-patch to all supported branches. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/20210806032944.m4tz7j2w47mant26%40alap3.anarazel.de
Diffstat (limited to 'src')
-rw-r--r--src/backend/port/sysv_shmem.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c
index 0cc83ffc16a..9de96edf6ad 100644
--- a/src/backend/port/sysv_shmem.c
+++ b/src/backend/port/sysv_shmem.c
@@ -143,6 +143,16 @@ InternalIpcMemoryCreate(IpcMemoryKey memKey, Size size)
if (pg_shmem_addr)
requestedAddress = (void *) strtoul(pg_shmem_addr, NULL, 0);
+ else
+ {
+#if defined(__darwin__) && SIZEOF_VOID_P == 8
+ /*
+ * Provide a default value that is believed to avoid problems with
+ * ASLR on the current macOS release.
+ */
+ requestedAddress = (void *) 0x80000000000;
+#endif
+ }
}
#endif