summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Moore <pmoore@redhat.com>2015-05-09 08:14:21 -0400
committerPaul Moore <pmoore@redhat.com>2015-05-09 08:14:21 -0400
commit3823bcabf9ca675fae971cc9e8d753dde5919a3d (patch)
tree34f9173ec01039ef621fc78aed8f25814f99c9d2
parentb09fe0c60626268d501690c5faa76a4947aca086 (diff)
downloadlibseccomp-3823bcabf9ca675fae971cc9e8d753dde5919a3d.tar.gz
all: ensure the ARM and MIPS system defines are present
On some really old systems the ELF and or Audit ABI/arch defines are missing, this patch provides our own #defines in these cases. Reported-by: Vincent.Riera@imgtec.com Signed-off-by: Paul Moore <pmoore@redhat.com> (imported from commit f8de89b8764afa1e714e7b6d1c2247a655ed5470)
-rw-r--r--include/seccomp.h.in30
-rw-r--r--tools/util.h34
2 files changed, 46 insertions, 18 deletions
diff --git a/include/seccomp.h.in b/include/seccomp.h.in
index d3b3a60..0751191 100644
--- a/include/seccomp.h.in
+++ b/include/seccomp.h.in
@@ -121,10 +121,13 @@ struct scmp_arg_cmp {
* The ARM architecture tokens
*/
#define SCMP_ARCH_ARM AUDIT_ARCH_ARM
-#ifndef AUDIT_ARCH_AARCH64
/* AArch64 support for audit was merged in 3.17-rc1 */
+#ifndef AUDIT_ARCH_AARCH64
+#ifndef EM_AARCH64
+#define EM_AARCH64 183
+#endif /* EM_AARCH64 */
#define AUDIT_ARCH_AARCH64 (EM_AARCH64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
-#endif
+#endif /* AUDIT_ARCH_AARCH64 */
#define SCMP_ARCH_AARCH64 AUDIT_ARCH_AARCH64
/**
@@ -133,21 +136,30 @@ struct scmp_arg_cmp {
#ifndef __AUDIT_ARCH_CONVENTION_MIPS64_N32
#define __AUDIT_ARCH_CONVENTION_MIPS64_N32 0x20000000
#endif
-#define SCMP_ARCH_MIPS AUDIT_ARCH_MIPS
-#define SCMP_ARCH_MIPS64 AUDIT_ARCH_MIPS64
-#ifndef AUDIT_ARCH_MIPS64N32
+#ifndef EM_MIPS
+#define EM_MIPS 8
+#endif
+#ifndef AUDIT_ARCH_MIPS
+#define AUDIT_ARCH_MIPS (EM_MIPS)
+#endif
+#ifndef AUDIT_ARCH_MIPS64
+#define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT)
+#endif
/* MIPS64N32 support was merged in 3.15 */
+#ifndef AUDIT_ARCH_MIPS64N32
#define AUDIT_ARCH_MIPS64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|\
__AUDIT_ARCH_CONVENTION_MIPS64_N32)
#endif
-#define SCMP_ARCH_MIPS64N32 AUDIT_ARCH_MIPS64N32
-#define SCMP_ARCH_MIPSEL AUDIT_ARCH_MIPSEL
-#define SCMP_ARCH_MIPSEL64 AUDIT_ARCH_MIPSEL64
-#ifndef AUDIT_ARCH_MIPSEL64N32
/* MIPSEL64N32 support was merged in 3.15 */
+#ifndef AUDIT_ARCH_MIPSEL64N32
#define AUDIT_ARCH_MIPSEL64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE|\
__AUDIT_ARCH_CONVENTION_MIPS64_N32)
#endif
+#define SCMP_ARCH_MIPS AUDIT_ARCH_MIPS
+#define SCMP_ARCH_MIPS64 AUDIT_ARCH_MIPS64
+#define SCMP_ARCH_MIPS64N32 AUDIT_ARCH_MIPS64N32
+#define SCMP_ARCH_MIPSEL AUDIT_ARCH_MIPSEL
+#define SCMP_ARCH_MIPSEL64 AUDIT_ARCH_MIPSEL64
#define SCMP_ARCH_MIPSEL64N32 AUDIT_ARCH_MIPSEL64N32
/**
diff --git a/tools/util.h b/tools/util.h
index 261320f..4ec3f91 100644
--- a/tools/util.h
+++ b/tools/util.h
@@ -26,27 +26,43 @@
#include <inttypes.h>
#include <linux/audit.h>
+/**
+ * The ARM architecture tokens
+ */
+/* AArch64 support for audit was merged in 3.17-rc1 */
+#ifndef AUDIT_ARCH_AARCH64
+#ifndef EM_AARCH64
+#define EM_AARCH64 183
+#endif /* EM_AARCH64 */
+#define AUDIT_ARCH_AARCH64 (EM_AARCH64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
+#endif /* AUDIT_ARCH_AARCH64 */
+
+/**
+ * The MIPS architecture tokens
+ */
#ifndef __AUDIT_ARCH_CONVENTION_MIPS64_N32
#define __AUDIT_ARCH_CONVENTION_MIPS64_N32 0x20000000
#endif
-
-#ifndef AUDIT_ARCH_MIPS64N32
+#ifndef EM_MIPS
+#define EM_MIPS 8
+#endif
+#ifndef AUDIT_ARCH_MIPS
+#define AUDIT_ARCH_MIPS (EM_MIPS)
+#endif
+#ifndef AUDIT_ARCH_MIPS64
+#define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT)
+#endif
/* MIPS64N32 support was merged in 3.15 */
+#ifndef AUDIT_ARCH_MIPS64N32
#define AUDIT_ARCH_MIPS64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|\
__AUDIT_ARCH_CONVENTION_MIPS64_N32)
#endif
-
-#ifndef AUDIT_ARCH_MIPSEL64N32
/* MIPSEL64N32 support was merged in 3.15 */
+#ifndef AUDIT_ARCH_MIPSEL64N32
#define AUDIT_ARCH_MIPSEL64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE|\
__AUDIT_ARCH_CONVENTION_MIPS64_N32)
#endif
-#ifndef AUDIT_ARCH_AARCH64
-/* AArch64 support for audit was merged in 3.17-rc1 */
-#define AUDIT_ARCH_AARCH64 (EM_AARCH64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
-#endif
-
extern uint32_t arch;
void exit_usage(const char *program);