From: Mathieu Desnoyers Date: Wed, 9 Sep 2015 17:16:50 +0000 (-0400) Subject: Disable sys_membarrier X-Git-Tag: v0.7.15~1 X-Git-Url: http://git.liburcu.org/?p=userspace-rcu.git;a=commitdiff_plain;h=de07ab9691f011d2458be8c1239d62aaa6cb6100 Disable sys_membarrier sys_membarrier underwent changes between its original implementation and its upcoming inclusion into the Linux kernel. Disable it to ensure we do not use the ABI incorrectly. Should the prior user-space code be built against a kernel header that defines SYS_membarrier, and executed against that kernel, the following scenarios may happen: - -1 will be returned with EINVAL errno if the 2nd argument (flags) is non-zero (the previous ABI expected a single argument), - (MEMBARRIER_EXPEDITED | MEMBARRIER_QUERY) defined as (1 << 0) | (1 << 16) will return -1 with EINVAL errno, because valid commands are now one-hot. Therefore, should an incompatible user-space code try to use sys_membarrier, it will simply think that the system does not have membarrier support due to the negative return value upon query. Signed-off-by: Mathieu Desnoyers --- diff --git a/urcu/map/urcu.h b/urcu/map/urcu.h index dd7a691..3fae95f 100644 --- a/urcu/map/urcu.h +++ b/urcu/map/urcu.h @@ -48,19 +48,13 @@ #define RCU_MB #endif +/* + * The ABI of sys_membarrier changed after its original implementation. + * Disable it for now. Use RCU_MB flavor instead. + */ #ifdef RCU_MEMBARRIER -#include - -/* If the headers do not support SYS_membarrier, statically use RCU_MB */ -#ifdef SYS_membarrier -# define MEMBARRIER_EXPEDITED (1 << 0) -# define MEMBARRIER_DELAYED (1 << 1) -# define MEMBARRIER_QUERY (1 << 16) -# define membarrier(...) syscall(SYS_membarrier, __VA_ARGS__) -#else -# undef RCU_MEMBARRIER -# define RCU_MB -#endif +#undef RCU_MEMBARRIER +#define RCU_MB #endif #ifdef RCU_MEMBARRIER diff --git a/urcu/static/urcu.h b/urcu/static/urcu.h index 5b9ceec..fc70717 100644 --- a/urcu/static/urcu.h +++ b/urcu/static/urcu.h @@ -60,19 +60,13 @@ extern "C" { #define RCU_MB #endif +/* + * The ABI of sys_membarrier changed after its original implementation. + * Disable it for now. Use RCU_MB flavor instead. + */ #ifdef RCU_MEMBARRIER -#include - -/* If the headers do not support SYS_membarrier, statically use RCU_MB */ -#ifdef SYS_membarrier -# define MEMBARRIER_EXPEDITED (1 << 0) -# define MEMBARRIER_DELAYED (1 << 1) -# define MEMBARRIER_QUERY (1 << 16) -# define membarrier(...) syscall(SYS_membarrier, __VA_ARGS__) -#else -# undef RCU_MEMBARRIER -# define RCU_MB -#endif +#undef RCU_MEMBARRIER +#define RCU_MB #endif /*