]> git.proxmox.com Git - ovs.git/commitdiff
datapath: compat: Fix compilation issue with grsecurity patch
authorYi-Hung Wei <yihung.wei@gmail.com>
Wed, 10 Oct 2018 23:21:57 +0000 (16:21 -0700)
committerBen Pfaff <blp@ovn.org>
Mon, 15 Oct 2018 18:22:24 +0000 (11:22 -0700)
Grsecurity patch enables GCC's constify plugin so that it will
automatically constify a class of type that contains only function
pointers.  However, if the type is also specified by __read_mostly, it
will put the constify object into the read_mostly section that results
in compilation error.  This patch works around the compilation issue by
disabling __ready_mostly when grsecurity patch is applied.

Tested with 4.14.33 kernel with grsecurity patch.

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Tested-by: Greg Rose <gvrose8192@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
datapath/compat.h

index 98b68640a372030f08a6e0859fe3eb07e439be35..b820251a47670b54ba9a015a3dc00fbb31015302 100644 (file)
 #include <net/netfilter/ipv6/nf_defrag_ipv6.h>
 #include <net/netfilter/nf_conntrack_count.h>
 
+/* Fix grsecurity patch compilation issue. */
+#ifdef CONSTIFY_PLUGIN
+#include <linux/cache.h>
+#undef __read_mostly
+#define __read_mostly
+#endif
+
 /* Even though vanilla 3.10 kernel has grp->id, RHEL 7 kernel is missing
  * this field. */
 #ifdef HAVE_GENL_MULTICAST_GROUP_WITH_ID