From: Yi-Hung Wei Date: Wed, 10 Oct 2018 23:21:57 +0000 (-0700) Subject: datapath: compat: Fix compilation issue with grsecurity patch X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=1556fcca676676acefab53bf46c156842ea8cf4f;p=ovs.git datapath: compat: Fix compilation issue with grsecurity patch 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 Signed-off-by: Ben Pfaff Tested-by: Greg Rose Reviewed-by: Greg Rose --- diff --git a/datapath/compat.h b/datapath/compat.h index 98b68640a..b820251a4 100644 --- a/datapath/compat.h +++ b/datapath/compat.h @@ -28,6 +28,13 @@ #include #include +/* Fix grsecurity patch compilation issue. */ +#ifdef CONSTIFY_PLUGIN +#include +#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