Enable the NETLINK_COMPAT32 hack for *all* 32bit x86 targets
This will break any targets still running a 32bit x86 kernel, if any.
Change-Id: I3bf4f60430e30a51ca5a41fe3f9c7a280efbaae7
Test: Tested via treehugger
diff --git a/server/Android.mk b/server/Android.mk
index 4634dee..cbbfe66 100644
--- a/server/Android.mk
+++ b/server/Android.mk
@@ -36,12 +36,6 @@
LOCAL_TIDY_FLAGS := $(common_local_tidy_flags)
LOCAL_TIDY_CHECKS := $(common_local_tidy_checks)
-ifeq ($(TARGET_ARCH), x86)
-ifneq ($(TARGET_PRODUCT), gce_x86_phone)
- LOCAL_CPPFLAGS += -D NETLINK_COMPAT32
-endif
-endif
-
LOCAL_INIT_RC := netd.rc
LOCAL_SHARED_LIBRARIES := \
diff --git a/server/XfrmController.h b/server/XfrmController.h
index 908c63c..d4c4779 100644
--- a/server/XfrmController.h
+++ b/server/XfrmController.h
@@ -243,11 +243,18 @@
private:
/*
+ * This is a workaround for a kernel bug in the 32bit netlink compat layer
+ * that has been present on x86_64 kernels since 2010 with no fix on the
+ * horizon.
+ *
* Below is a redefinition of the xfrm_usersa_info struct that is part
* of the Linux uapi <linux/xfrm.h> to align the structures to a 64-bit
* boundary.
+ *
+ * Note that we turn this on for all x86 32bit targets, under the assumption
+ * that nowadays all x86 targets are running 64bit kernels.
*/
-#ifdef NETLINK_COMPAT32
+#if defined(__i386__)
// Shadow the kernel definition of xfrm_usersa_info with a 64-bit aligned version
struct xfrm_usersa_info : ::xfrm_usersa_info {
} __attribute__((aligned(8)));