During investigation of an Alpha specific problem in GNU Emacs (see https://bugs.gentoo.org/660448 and https://debbugs.gnu.org/32083) we found that on Alpha the ADDR_NO_RANDOMIZE flag set with personality(2) is not preserved across execve(2). The following test program demonstrates the problem: -------- 8< -------- #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/personality.h> int main (int argc, char **argv) { int pers, new_pers; if ((pers = personality (0xffffffff)) < 0) { fprintf (stderr, "could not get personality\n"); exit (1); } if (getenv ("WAS_HERE")) { printf ("*** after execvp ***\n"); printf ("personality = 0x%08x\n", pers); exit (0); } printf ("old personality = 0x%08x\n", pers); new_pers = pers | ADDR_NO_RANDOMIZE; printf ("demand personality = 0x%08x\n", new_pers); if (personality (new_pers) < 0) { fprintf (stderr, "could not set personality\n"); exit (1); } if ((pers = personality (0xffffffff)) < 0) { fprintf (stderr, "could not get personality\n"); exit (1); } printf ("new personality = 0x%08x\n", pers); putenv ("WAS_HERE=1"); execvp (*argv, argv); fprintf (stderr, "execvp returned\n"); exit (1); } -------- >8 -------- I get as output (on Alpha, kernel 4.17.0): old personality = 0x00000000 demand personality = 0x00040000 new personality = 0x00040000 *** after execvp *** personality = 0x00000000 Whereas on amd64 the last line is (as should be expected): personality = 0x00040000 I suspect that the problem is with the SET_PERSONALITY macro defined in arch/alpha/include/asm/elf.h: #define SET_PERSONALITY(EX) \ set_personality(((EX).e_flags & EF_ALPHA_32BIT) \ ? PER_LINUX_32BIT : PER_LINUX) The corresponding code for other architectures (e.g., ppc) does additional masking of the flag bits, like this: set_personality(PER_LINUX | (current->personality & (~PER_MASK))) Linux monolith 4.17.0+ #43 SMP Wed Jun 6 10:42:37 CEST 2018 alpha EV68AL Tsunami GNU/Linux GNU C 7.3.0 GNU Make 4.2.1 Binutils 2.30 Util-linux 2.32 Mount 2.32 Module-init-tools 25 E2fsprogs 1.44.2 Linux C Library 2.27 Dynamic linker (ldd) 2.27 Linux C++ Library 6.0.24 Procps 3.3.15 Net-tools 1.60 Kbd 2.0.4 Console-tools 2.0.4 Sh-utils 8.30 Udev 238 Modules Loaded binfmt_misc cdrom libata netlink_diag pata_ali sr_mod unix_diag -- To unsubscribe from this list: send the line "unsubscribe linux-alpha" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html