Found on 5.4.6, may be encountered earlier.
Some functions under the same name as ones in libkern were introduced, causing a name conflict.
CC [M] /home/vmuser/darling/src/lkm/osfmk/ipc/ipc_entry.o
In file included from /home/vmuser/darling/src/lkm/osfmk/mach/mach_types.h:112,
from /home/vmuser/darling/src/lkm/osfmk/kern/clock.h:38,
from /home/vmuser/darling/src/lkm/osfmk/kern/sched_prim.h:72,
from /home/vmuser/darling/src/lkm/osfmk/ipc/ipc_entry.c:76:
/home/vmuser/darling/src/lkm/osfmk/mach/vm_param.h:275:18: error: ‘page_size’ redeclared as different kind of symbol
275 | extern vm_size_t page_size;
| ^~~~~~~~~
In file included from /home/vmuser/darling/src/lkm/osfmk/duct/duct.h:54,
from /home/vmuser/darling/src/lkm/osfmk/ipc/ipc_entry.c:67:
./include/linux/mm.h:810:29: note: previous definition of ‘page_size’ was here
810 | static inline unsigned long page_size(struct page *page)
| ^~~~~~~~~
In file included from /home/vmuser/darling/src/lkm/osfmk/mach/mach_types.h:112,
from /home/vmuser/darling/src/lkm/osfmk/kern/clock.h:38,
from /home/vmuser/darling/src/lkm/osfmk/kern/sched_prim.h:72,
from /home/vmuser/darling/src/lkm/osfmk/ipc/ipc_entry.c:76:
/home/vmuser/darling/src/lkm/osfmk/mach/vm_param.h:277:13: error: ‘page_shift’ redeclared as different kind of symbol
277 | extern int page_shift;
| ^~~~~~~~~~
In file included from /home/vmuser/darling/src/lkm/osfmk/duct/duct.h:54,
from /home/vmuser/darling/src/lkm/osfmk/ipc/ipc_entry.c:67:
./include/linux/mm.h:816:28: note: previous definition of ‘page_shift’ was here
816 | static inline unsigned int page_shift(struct page *page)
| ^~~~~~~~~~
In file included from /home/vmuser/darling/src/lkm/osfmk/i386/user_ldt.h:72,
from /home/vmuser/darling/src/lkm/osfmk/i386/task.h:61,
from /home/vmuser/darling/src/lkm/osfmk/machine/task.h:32,
from /home/vmuser/darling/src/lkm/osfmk/kern/task.h:108,
from /home/vmuser/darling/src/lkm/osfmk/kern/thread.h:123,
from /home/vmuser/darling/src/lkm/osfmk/kern/sched_prim.h:74,
from /home/vmuser/darling/src/lkm/osfmk/ipc/ipc_entry.c:76:
/home/vmuser/darling/src/lkm/osfmk/i386/seg.h:213: warning: "SZ_64" redefined
213 | #define SZ_64 0x2 /* 64-bit segment */
|
In file included from ./include/linux/mm.h:29,
from /home/vmuser/darling/src/lkm/osfmk/duct/duct.h:54,
from /home/vmuser/darling/src/lkm/osfmk/ipc/ipc_entry.c:67:
./include/linux/sizes.h:16: note: this is the location of the previous definition
16 | #define SZ_64 0x00000040
|
In file included from /home/vmuser/darling/src/lkm/osfmk/i386/user_ldt.h:72,
from /home/vmuser/darling/src/lkm/osfmk/i386/task.h:61,
from /home/vmuser/darling/src/lkm/osfmk/machine/task.h:32,
from /home/vmuser/darling/src/lkm/osfmk/kern/task.h:108,
from /home/vmuser/darling/src/lkm/osfmk/kern/thread.h:123,
from /home/vmuser/darling/src/lkm/osfmk/kern/sched_prim.h:74,
from /home/vmuser/darling/src/lkm/osfmk/ipc/ipc_entry.c:76:
/home/vmuser/darling/src/lkm/osfmk/i386/seg.h:214: warning: "SZ_32" redefined
214 | #define SZ_32 0x4 /* 32-bit segment */
|
In file included from ./include/linux/mm.h:29,
from /home/vmuser/darling/src/lkm/osfmk/duct/duct.h:54,
from /home/vmuser/darling/src/lkm/osfmk/ipc/ipc_entry.c:67:
./include/linux/sizes.h:15: note: this is the location of the previous definition
15 | #define SZ_32 0x00000020
|
We are defining functions under those names here:
The name conflicts in question are page_size and page_shift. They were added to the Linux headers in September.
https://github.com/torvalds/linux/blob/master/include/linux/mm.h#L794-L804
Our usages of the symbol may have to be renamed or aliased in some form. Or the Linux headers must be somehow avoided in the contexts where the XNU versions of these symbols are needed. Not necessarily straightforward.
This also happens in Ubuntu 19.10 Kernel 5.4.0 (manually updated).
:grimacing: looks like the clock is ticking before it hits mainstream distros. I looked into it and the fix seems complex.
Looks like Debian Testing already has this kernel, so I'll look into it.
This will take me a while, because there's a lot more breakage it seems...
Great work @LubosD! :tada: