Cannot compile on Arch Linux: -Werror=incompatible-pointer-types
Closed this issue · 8 comments
Hi!
I'm trying to test this tool, and can't compile it (when running make
):
./leak_check/common_mm/payload.c:805:15: error: passing argument 1 of ‘atomic_inc’ from incompatible pointer type [-Werror=incompatible-pointer-types]
atomic_inc(&(*acl)->a_refcount);
^~~~~~~~~~~~~~~~~~~
In file included from ./arch/x86/include/asm/atomic.h:283,
from ./arch/x86/include/asm/msr.h:67,
from ./arch/x86/include/asm/processor.h:21,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/mmzone.h:8,
from ./include/linux/gfp.h:6,
from ./include/linux/slab.h:15,
from ./leak_check/common_mm/payload.c:30:
A bunch of errors like this, and it doesn't compile due to this. My versions are (if it matters):
cmake version 3.11.4
GNU Make 4.2.1
c (GCC) 8.1.1 20180531
Am I doing something wrong?
This looks like a kernel header versioning issue. Do you have the correct kernel headers?
I think so...
[user@pc kedr_build]$ pacman -Qi linux linux-headers | grep 'Version\|Install'; uname -r
Version : 4.17.6-1
Installed Size : 114.64 MiB
Install Date : Tue 17 Jul 2018 10:21:21 AM PDT
Install Reason : Explicitly installed
Install Script : Yes
Version : 4.17.6-1
Installed Size : 42.66 MiB
Install Date : Tue 17 Jul 2018 12:46:45 PM PDT
Install Reason : Explicitly installed
Install Script : No
4.17.6-1-ARCH
I have the same issue on openSUSE Tumbleweed. I'm quite sure I have the right versions, since I installed kernel-source
, kernel-devel
, and dkms
from YaST. The full error is below:
[ 92%] Building kernel module kedr_lc_common_mm
/home/rahul/Desktop/kedr/build/leak_check/common_mm/payload.c: In function ‘pre___posix_acl_create’:
/home/rahul/Desktop/kedr/build/leak_check/common_mm/payload.c:805:15: error: passing argument 1 of ‘atomic_inc’ from incompatible pointer type [-Werror=incompatible-pointer-types]
atomic_inc(&(*acl)->a_refcount);
^~~~~~~~~~~~~~~~~~~
In file included from /usr/src/linux-4.19.5-1/arch/x86/include/asm/atomic.h:265,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/msr.h:67,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/processor.h:21,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/cpufeature.h:5,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/thread_info.h:53,
from /usr/src/linux-4.19.5-1/include/linux/thread_info.h:38,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/preempt.h:7,
from /usr/src/linux-4.19.5-1/include/linux/preempt.h:81,
from /usr/src/linux-4.19.5-1/include/linux/spinlock.h:51,
from /usr/src/linux-4.19.5-1/include/linux/mmzone.h:8,
from /usr/src/linux-4.19.5-1/include/linux/gfp.h:6,
from /usr/src/linux-4.19.5-1/include/linux/slab.h:15,
from /home/rahul/Desktop/kedr/build/leak_check/common_mm/payload.c:30:
/usr/src/linux-4.19.5-1/include/asm-generic/atomic-instrumented.h:107:50: note: expected ‘atomic_t *’ {aka ‘struct <anonymous> *’} but argument is of type ‘refcount_t *’ {aka ‘struct refcount_struct *’}
static __always_inline void atomic_inc(atomic_t *v)
~~~~~~~~~~^
/home/rahul/Desktop/kedr/build/leak_check/common_mm/payload.c: In function ‘post___posix_acl_create’:
/home/rahul/Desktop/kedr/build/leak_check/common_mm/payload.c:833:38: error: passing argument 1 of ‘atomic_dec_and_test’ from incompatible pointer type [-Werror=incompatible-pointer-types]
if (old_acl && atomic_dec_and_test(&old_acl->a_refcount)) {
^~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/linux-4.19.5-1/arch/x86/include/asm/atomic.h:265,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/msr.h:67,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/processor.h:21,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/cpufeature.h:5,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/thread_info.h:53,
from /usr/src/linux-4.19.5-1/include/linux/thread_info.h:38,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/preempt.h:7,
from /usr/src/linux-4.19.5-1/include/linux/preempt.h:81,
from /usr/src/linux-4.19.5-1/include/linux/spinlock.h:51,
from /usr/src/linux-4.19.5-1/include/linux/mmzone.h:8,
from /usr/src/linux-4.19.5-1/include/linux/gfp.h:6,
from /usr/src/linux-4.19.5-1/include/linux/slab.h:15,
from /home/rahul/Desktop/kedr/build/leak_check/common_mm/payload.c:30:
/usr/src/linux-4.19.5-1/include/asm-generic/atomic-instrumented.h:257:59: note: expected ‘atomic_t *’ {aka ‘struct <anonymous> *’} but argument is of type ‘refcount_t *’ {aka ‘struct refcount_struct *’}
static __always_inline bool atomic_dec_and_test(atomic_t *v)
~~~~~~~~~~^
/home/rahul/Desktop/kedr/build/leak_check/common_mm/payload.c: In function ‘pre___posix_acl_chmod’:
/home/rahul/Desktop/kedr/build/leak_check/common_mm/payload.c:865:15: error: passing argument 1 of ‘atomic_inc’ from incompatible pointer type [-Werror=incompatible-pointer-types]
atomic_inc(&(*acl)->a_refcount);
^~~~~~~~~~~~~~~~~~~
In file included from /usr/src/linux-4.19.5-1/arch/x86/include/asm/atomic.h:265,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/msr.h:67,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/processor.h:21,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/cpufeature.h:5,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/thread_info.h:53,
from /usr/src/linux-4.19.5-1/include/linux/thread_info.h:38,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/preempt.h:7,
from /usr/src/linux-4.19.5-1/include/linux/preempt.h:81,
from /usr/src/linux-4.19.5-1/include/linux/spinlock.h:51,
from /usr/src/linux-4.19.5-1/include/linux/mmzone.h:8,
from /usr/src/linux-4.19.5-1/include/linux/gfp.h:6,
from /usr/src/linux-4.19.5-1/include/linux/slab.h:15,
from /home/rahul/Desktop/kedr/build/leak_check/common_mm/payload.c:30:
/usr/src/linux-4.19.5-1/include/asm-generic/atomic-instrumented.h:107:50: note: expected ‘atomic_t *’ {aka ‘struct <anonymous> *’} but argument is of type ‘refcount_t *’ {aka ‘struct refcount_struct *’}
static __always_inline void atomic_inc(atomic_t *v)
~~~~~~~~~~^
/home/rahul/Desktop/kedr/build/leak_check/common_mm/payload.c: In function ‘post___posix_acl_chmod’:
/home/rahul/Desktop/kedr/build/leak_check/common_mm/payload.c:893:38: error: passing argument 1 of ‘atomic_dec_and_test’ from incompatible pointer type [-Werror=incompatible-pointer-types]
if (old_acl && atomic_dec_and_test(&old_acl->a_refcount)) {
^~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/linux-4.19.5-1/arch/x86/include/asm/atomic.h:265,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/msr.h:67,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/processor.h:21,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/cpufeature.h:5,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/thread_info.h:53,
from /usr/src/linux-4.19.5-1/include/linux/thread_info.h:38,
from /usr/src/linux-4.19.5-1/arch/x86/include/asm/preempt.h:7,
from /usr/src/linux-4.19.5-1/include/linux/preempt.h:81,
from /usr/src/linux-4.19.5-1/include/linux/spinlock.h:51,
from /usr/src/linux-4.19.5-1/include/linux/mmzone.h:8,
from /usr/src/linux-4.19.5-1/include/linux/gfp.h:6,
from /usr/src/linux-4.19.5-1/include/linux/slab.h:15,
from /home/rahul/Desktop/kedr/build/leak_check/common_mm/payload.c:30:
/usr/src/linux-4.19.5-1/include/asm-generic/atomic-instrumented.h:257:59: note: expected ‘atomic_t *’ {aka ‘struct <anonymous> *’} but argument is of type ‘refcount_t *’ {aka ‘struct refcount_struct *’}
static __always_inline bool atomic_dec_and_test(atomic_t *v)
~~~~~~~~~~^
cc1: some warnings being treated as errors
make[6]: *** [/usr/src/linux-4.19.5-1/scripts/Makefile.build:307: /home/rahul/Desktop/kedr/build/leak_check/common_mm/payload.o] Error 1
make[5]: *** [/usr/src/linux-4.19.5-1/Makefile:1532: _module_/home/rahul/Desktop/kedr/build/leak_check/common_mm] Error 2
make[4]: *** [Makefile:146: sub-make] Error 2
make[3]: *** [Makefile:24: __sub-make] Error 2
make[2]: *** [leak_check/common_mm/CMakeFiles/kedr_lc_common_mm.dir/build.make:66: leak_check/common_mm/kedr_lc_common_mm.ko] Error 2
make[1]: *** [CMakeFiles/Makefile2:1138: leak_check/common_mm/CMakeFiles/kedr_lc_common_mm.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
I'll take a look. It might be related to the move from atomic_t to refcount_t in the kernel some time ago.
Yes, POSIX ACL functions were converted to use refcount_t in the kernel 4.16:
commit 66717260545b67b04ce6b004fff26de7141b2757
Author: Elena Reshetova <elena.reshetova@intel.com>
Date: Wed Nov 29 13:19:31 2017 +0200
posix_acl: convert posix_acl.a_refcount from atomic_t to refcount_t
I have pushed the fix to the master branch, along with a couple more fixes. Please check if it works for you now.
Yes, compilation now succeeds. Thanks!
Good.
The self-tests from KEDR passed too, at least the ones for the core and LeakCheck.
Closing this.