Worth using personality(ADDR_NO_RANDOMIZE) for EXEC_BACKEND on linux?
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: pgsql-hackers@postgresql.org
Date: 2021-08-06T03:29:44Z
Lists: pgsql-hackers
Hi, When testing EXEC_BACKEND on linux I see occasional test failures as long as I don't disable ASLR. There's a code comment to that effect: * If testing EXEC_BACKEND on Linux, you should run this as root before * starting the postmaster: * * echo 0 >/proc/sys/kernel/randomize_va_space but I don't like doing that on a system wide basis. Linux allows disabling ASLR on a per-process basis using personality(ADDR_NO_RANDOMIZE). There's a wrapper binary to do that as well, setarch --addr-no-randomize. I was wondering if we should have postmaster do personality(ADDR_NO_RANDOMIZE) for EXEC_BACKEND builds? It seems nicer to make it automatically work than have people remember that they need to call "setarch --addr-no-randomize make check". Not that it actually matters for EXEC_BACKEND, but theoretically doing personality(ADDR_NO_RANDOMIZE) in postmaster is a tad more secure than doing it via setarch, as in the personality() case postmaster's layout itself is still randomized... Or perhaps we should just add a comment mentioning setarch. Greetings, Andres Freund
Commits
-
Make EXEC_BACKEND more convenient on Linux and FreeBSD.
- 6b4dba711a4e 12.15 landed
- 1e4fda6da918 13.11 landed
- 0801345758db 14.8 landed
- f3e78069db7f 15.0 landed
-
Make EXEC_BACKEND more convenient on macOS.
- 8201b60565b8 14.0 landed
- 2c6275423535 13.5 landed
- a8096e30f4d0 12.9 landed
- 0bfefb7dafe0 11.14 landed
- d49e228a664d 10.19 landed
- 715a8668a5f7 9.6.24 landed
- 88cbbbfa3e2b 15.0 landed