summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2023-02-08 13:09:49 +0900
committerMichael Paquier <michael@paquier.xyz>2023-02-08 13:09:49 +0900
commit1e4fda6da918f734dd6dab67b3ddcaba4c2fecb2 (patch)
tree676e861d3a3e41ead044d1401345a00242dc8777 /src/include
parent20aba55fae83cd0b6f7511365d172da8cd7e0135 (diff)
Make EXEC_BACKEND more convenient on Linux and FreeBSD.
Try to disable ASLR when building in EXEC_BACKEND mode, to avoid random memory mapping failures while testing. For developer use only, no effect on regular builds. This has been originally applied as of f3e7806 for v15~, but recently-added buildfarm member gokiburi tests this configuration on older branches as well, causing it to fail randomly as ASLR would be enabled. Suggested-by: Andres Freund <andres@anarazel.de> Tested-by: Bossart, Nathan <bossartn@amazon.com> Discussion: https://postgr.es/m/20210806032944.m4tz7j2w47mant26%40alap3.anarazel.de Backpatch-through: 12
Diffstat (limited to 'src/include')
-rw-r--r--src/include/pg_config.h.in3
-rw-r--r--src/include/port.h5
2 files changed, 8 insertions, 0 deletions
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 2711c2ce9bd..2cd221b85a0 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -590,6 +590,9 @@
/* Define to 1 if you have the <sys/ipc.h> header file. */
#undef HAVE_SYS_IPC_H
+/* Define to 1 if you have the <sys/personality.h> header file. */
+#undef HAVE_SYS_PERSONALITY_H
+
/* Define to 1 if you have the <sys/prctl.h> header file. */
#undef HAVE_SYS_PRCTL_H
diff --git a/src/include/port.h b/src/include/port.h
index 0c3c8d14e76..70b193657e4 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -115,6 +115,11 @@ extern char *pipe_read_line(char *cmd, char *line, int maxsize);
/* Doesn't belong here, but this is used with find_other_exec(), so... */
#define PG_BACKEND_VERSIONSTR "postgres (PostgreSQL) " PG_VERSION "\n"
+#ifdef EXEC_BACKEND
+/* Disable ASLR before exec, for developer builds only (in exec.c) */
+extern int pg_disable_aslr(void);
+#endif
+
#if defined(WIN32) || defined(__CYGWIN__)
#define EXE ".exe"