[PATCH 3/5] Default ADDR_NO_RANDOMIZE if not found

Clayton Shotwell
2015-05-28T13:04:39Z

Some older toolchains do not declare ADDR_NO_RANDOMIZE. Add a check for
it during configure and default it if it is not found.

Signed-off-by: Clayton Shotwell <clayton.shotwell@rockwellcollins.com>
---
auparse/interpret.c | 4 ++++
configure.ac | 1 +
2 files changed, 5 insertions(+)

diff --git a/auparse/interpret.c b/auparse/interpret.c
index 0dcaa9f..a9d6691 100644
--- a/auparse/interpret.c
+++ b/auparse/interpret.c
@@ -53,6 +53,10 @@
#include "auparse-defs.h"
#include "gen_tables.h"

+#if !HAVE_DECL_ADDR_NO_RANDOMIZE
+# define ADDR_NO_RANDOMIZE 0x0040000
+#endif
+
/* This is from asm/ipc.h. Copying it for now as some platforms
* have broken headers. */
#define SEMOP 1
diff --git a/configure.ac b/configure.ac
index 2e84b07..57aec03 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,7 @@ AM_PROG_CC_C_O
AC_CHECK_DECLS([MS_DIRSYNC], [], [], [[#include <sys/mount.h>]])
AC_CHECK_DECLS([AUDIT_FEATURE_VERSION], [], [], [[#include <linux/audit.h>]])
AC_CHECK_DECLS([AUDIT_VERSION_BACKLOG_WAIT_TIME], [], [], [[#include <linux/audit.h>]])
+AC_CHECK_DECLS([ADDR_NO_RANDOMIZE],,, [#include <sys/personality.h>])

ALLWARNS=""
ALLDEBUG="-g"
--
1.9.1