#define SPUFS_MAGIC 0x23c9b64e
#endif
+#ifdef HAVE_PERSONALITY
+# include <sys/personality.h>
+# if !HAVE_DECL_ADDR_NO_RANDOMIZE
+# define ADDR_NO_RANDOMIZE 0x0040000
+# endif
+#endif
+
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
static int
linux_create_inferior (char *program, char **allargs)
{
+#ifdef HAVE_PERSONALITY
+ int personality_orig = 0, personality_set = 0;
+#endif
struct lwp_info *new_lwp;
int pid;
ptid_t ptid;
+#ifdef HAVE_PERSONALITY
+ if (disable_randomization)
+ {
+ errno = 0;
+ personality_orig = personality (0xffffffff);
+ if (errno == 0 && !(personality_orig & ADDR_NO_RANDOMIZE))
+ {
+ personality_set = 1;
+ personality (personality_orig | ADDR_NO_RANDOMIZE);
+ }
+ if (errno != 0 || (personality_set
+ && !(personality (0xffffffff) & ADDR_NO_RANDOMIZE)))
+ warning ("Error disabling address space randomization: %s",
+ strerror (errno));
+ }
+#endif
+
#if defined(__UCLIBC__) && defined(HAS_NOMMU)
pid = vfork ();
#else
_exit (0177);
}
+#ifdef HAVE_PERSONALITY
+ if (personality_set)
+ {
+ errno = 0;
+ personality (personality_orig);
+ if (errno != 0)
+ warning ("Error restoring address space randomization: %s",
+ strerror (errno));
+ }
+#endif
+
linux_add_process (pid, 0);
ptid = ptid_build (pid, pid, 0);
return 1;
}
+static int
+linux_supports_disable_randomization (void)
+{
+#ifdef HAVE_PERSONALITY
+ return 1;
+#else
+ return 0;
+#endif
+}
/* Enumerate spufs IDs for process PID. */
static int
linux_cancel_breakpoints,
linux_stabilize_threads,
linux_install_fast_tracepoint_jump_pad,
- linux_emit_ops
+ linux_emit_ops,
+ linux_supports_disable_randomization,
};
static void