dynup / kpatch

kpatch - live kernel patching
GNU General Public License v2.0
1.49k stars 305 forks source link

rhel-7.9/syscall.patch fails to build on 3.10.0-1160.71.1.el7.ppc64le #1278

Closed joe-lawrence closed 2 years ago

joe-lawrence commented 2 years ago

build.log.tar.gz

/root/kpatch/kmod/patch/kpatch-syscall.h:99:2: error: data definition has no type or storage class [-Werror]
  __diag_push();       \
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
/root/kpatch/kmod/patch/kpatch-syscall.h:99:2: error: type defaults to ‘int’ in declaration of ‘__diag_push’ [-Werror=implicit-int]
  __diag_push();       \
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
kernel/sys.c:1396:1: error: function declaration isn’t a prototype [-Werror=strict-prototypes]
In file included from kernel/sys.c:1395:0:
/root/kpatch/kmod/patch/kpatch-syscall.h:100:21: error: expected ‘)’ before numeric constant
  __diag_ignore(GCC, 8, "-Wattribute-alias",   \
                     ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
/root/kpatch/kmod/patch/kpatch-syscall.h:104:2: error: data definition has no type or storage class [-Werror]
  ALLOW_ERROR_INJECTION(sys##name, ERRNO);   \
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
/root/kpatch/kmod/patch/kpatch-syscall.h:104:2: error: type defaults to ‘int’ in declaration of ‘ALLOW_ERROR_INJECTION’ [-Werror=implicit-int]
  ALLOW_ERROR_INJECTION(sys##name, ERRNO);   \
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
In file included from kernel/sys.c:47:0:
kernel/sys.c:1396:41: error: parameter names (without types) in function declaration [-Werror]
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
                                         ^
include/linux/syscalls.h:101:25: note: in definition of macro ‘__SC_DECL’
 #define __SC_DECL(t, a) t a
                         ^
include/linux/syscalls.h:99:22: note: in expansion of macro ‘__MAP1’
 #define __MAP(n,...) __MAP##n(__VA_ARGS__)
                      ^
/root/kpatch/kmod/patch/kpatch-syscall.h:102:28: note: in expansion of macro ‘__MAP’
  asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
                            ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
In file included from kernel/sys.c:1395:0:
/root/kpatch/kmod/patch/kpatch-syscall.h:115:2: error: data definition has no type or storage class [-Werror]
  __diag_pop();       \
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
/root/kpatch/kmod/patch/kpatch-syscall.h:115:2: error: type defaults to ‘int’ in declaration of ‘__diag_pop’ [-Werror=implicit-int]
  __diag_pop();       \
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
In file included from include/linux/thread_info.h:11:0,
                 from include/linux/preempt.h:9,
                 from include/linux/spinlock.h:50,
                 from include/linux/mmzone.h:7,
                 from include/linux/gfp.h:5,
                 from include/linux/mm.h:9,
                 from kernel/sys.c:8:
kernel/sys.c:1396:41: error: function declaration isn’t a prototype [-Werror=strict-prototypes]
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
                                         ^
include/linux/bug.h:36:55: note: in definition of macro ‘BUILD_BUG_ON_ZERO’
 #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
                                                       ^
include/linux/syscalls.h:93:23: note: in expansion of macro ‘__SC_TEST’
 #define __MAP1(m,t,a) m(t,a)
                       ^
include/linux/syscalls.h:99:22: note: in expansion of macro ‘__MAP1’
 #define __MIn file included from kernel/sys.c:1395:0:
/root/kpatch/kmod/patch/kpatch-syscall.h:99:2: error: data definition has no type or storage class [-Werror]
  __diag_push();       \
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
/root/kpatch/kmod/patch/kpatch-syscall.h:99:2: error: type defaults to ‘int’ in declaration of ‘__diag_push’ [-Werror=implicit-int]
  __diag_push();       \
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
kernel/sys.c:1396:1: error: function declaration isn’t a prototype [-Werror=strict-prototypes]
In file included from kernel/sys.c:1395:0:
/root/kpatch/kmod/patch/kpatch-syscall.h:100:21: error: expected ‘)’ before numeric constant
  __diag_ignore(GCC, 8, "-Wattribute-alias",   \
                     ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
/root/kpatch/kmod/patch/kpatch-syscall.h:104:2: error: data definition has no type or storage class [-Werror]
  ALLOW_ERROR_INJECTION(sys##name, ERRNO);   \
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
/root/kpatch/kmod/patch/kpatch-syscall.h:104:2: error: type defaults to ‘int’ in declaration of ‘ALLOW_ERROR_INJECTION’ [-Werror=implicit-int]
  ALLOW_ERROR_INJECTION(sys##name, ERRNO);   \
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
In file included from kernel/sys.c:47:0:
kernel/sys.c:1396:41: error: parameter names (without types) in function declaration [-Werror]
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
                                         ^
include/linux/syscalls.h:101:25: note: in definition of macro ‘__SC_DECL’
 #define __SC_DECL(t, a) t a
                         ^
include/linux/syscalls.h:99:22: note: in expansion of macro ‘__MAP1’
 #define __MAP(n,...) __MAP##n(__VA_ARGS__)
                      ^
/root/kpatch/kmod/patch/kpatch-syscall.h:102:28: note: in expansion of macro ‘__MAP’
  asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
                            ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
In file included from kernel/sys.c:1395:0:
/root/kpatch/kmod/patch/kpatch-syscall.h:115:2: error: data definition has no type or storage class [-Werror]
  __diag_pop();       \
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
/root/kpatch/kmod/patch/kpatch-syscall.h:115:2: error: type defaults to ‘int’ in declaration of ‘__diag_pop’ [-Werror=implicit-int]
  __diag_pop();       \
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
In file included from include/linux/thread_info.h:11:0,
                 from include/linux/preempt.h:9,
                 from include/linux/spinlock.h:50,
                 from include/linux/mmzone.h:7,
                 from include/linux/gfp.h:5,
                 from include/linux/mm.h:9,
                 from kernel/sys.c:8:
kernel/sys.c:1396:41: error: function declaration isn’t a prototype [-Werror=strict-prototypes]
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
                                         ^
include/linux/bug.h:36:55: note: in definition of macro ‘BUILD_BUG_ON_ZERO’
 #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
                                                       ^
include/linux/syscalls.h:93:23: note: in expansion of macro ‘__SC_TEST’
 #define __MAP1(m,t,a) m(t,a)
                       ^
include/linux/syscalls.h:99:22: note: in expansion of macro ‘__MAP1’
 #define __MAP(n,...) __MAP##n(__VA_ARGS__)
                      ^
/root/kpatch/kmod/patch/kpatch-syscall.h:111:3: note: in expansion of macro ‘__MAP’
   __MAP(x,__SC_TEST,__VA_ARGS__);    \
   ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
cc1: all warnings being treated as errors
make[1]: *** [kernel/sys.o] Error 1
make: *** [kernel] Error 2
make: *** Waiting for unfinished jobs....AP(n,...) __MAP##n(__VA_ARGS__)
                      ^
/root/kpatch/kmod/patch/kpatch-syscall.h:111:3: note: in expansion of macro ‘__MAP’
   __MAP(x,__SC_TEST,__VA_ARGS__);    \
   ^
/root/kpatch/kmod/patch/kpatch-syscall.h:37:2: note: in expansion of macro ‘__KPATCH_SYSCALL_DEFINEx’
  __KPATCH_SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
  ^
/root/kpatch/kmod/patch/kpatch-syscall.h:28:43: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINEx’
 #define KPATCH_SYSCALL_DEFINE1(name, ...) KPATCH_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
                                           ^
kernel/sys.c:1396:1: note: in expansion of macro ‘KPATCH_SYSCALL_DEFINE1’
 KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
 ^
cc1: all warnings being treated as errors
make[1]: *** [kernel/sys.o] Error 1
make: *** [kernel] Error 2
make: *** Waiting for unfinished jobs....
joe-lawrence commented 2 years ago

Ok, I think I have a handle on what the problem is: kmod/patch/kpatch-syscall.h defines the syscall macros by kernel version only for x86_64. The one that's trying to build for ppc64le is a newer definition than rhel-7. Furthermore, it looks like the syscall macros started arch-independent, and then over time arches started adding their own variants. It will take a little while to juggle the code, but I think a cleaner solution would be something like:

arch N specific definitions
kernel 1
kernel 2
etc

if the macros haven't been defined above
generic implementation
kernel 1
kernel 2
etc