On rhel-10.2, a kpatch touching fs/userfaultfd.o results in a final linker error: ld: final link failed: bad value
Tracing through this, it seems that upstream v6.1+ 9c7bfc2dc21e ("powerpc/64s: Make POWER10 and later use pause_short in cpu_relax loops") results in way more __ftr_alt_97, __ftr_fixup, .rela__ftr_fixup sections for which kpatch-build now stumbles over:
Some debugging from the main linux tree:
Before 9c7bfc2dc21e
-------------------
$ git checkout 9c7bfc2dc21e~1
$ make ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- defconfig
$ ./scripts/config --set-val CONFIG_USERFAULTFD y
$ make ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- olddefconfig
$ make ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- -j$(nproc) fs/userfaultfd.o
$ ppc64le-linux-gnu-readelf --sections --wide fs/userfaultfd.o | grep 'ftr_'
(nothing)
After 9c7bfc2dc21e
-------------------
$ git checkout 9c7bfc2dc21e
$ make ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- defconfig
$ ./scripts/config --set-val CONFIG_USERFAULTFD y
$ make ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- olddefconfig
$ make ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- -j$(nproc) fs/userfaultfd.o
$ ppc64le-linux-gnu-readelf --sections --wide fs/userfaultfd.o | grep 'ftr_'
[19] __ftr_alt_97 PROGBITS 0000000000000000 004ca0 000018 00 A 0 0 4
[20] __ftr_fixup PROGBITS 0000000000000000 004cb8 000120 00 A 0 0 8
[21] .rela__ftr_fixup RELA 0000000000000000 009b58 000240 18 I 38 20 8
$ ppc64le-linux-gnu-objdump -Dr -j __ftr_alt_97 -j__ftr_fixup fs/userfaultfd.o
fs/userfaultfd.o: file format elf64-powerpc
Disassembly of section __ftr_alt_97:
0000000000000000 <__ftr_alt_97>:
0: 7c 40 00 3c pause_short
4: 7c 40 00 3c pause_short
8: 7c 40 00 3c pause_short
c: 7c 40 00 3c pause_short
10: 7c 40 00 3c pause_short
14: 7c 40 00 3c pause_short
Disassembly of section __ftr_fixup:
0000000000000000 <__ftr_fixup>:
0: 00 04 00 00 .long 0x40000
...
10: R_PPC64_REL64 .text+0x14a0
18: R_PPC64_REL64 .text+0x14b0
20: R_PPC64_REL64 __ftr_alt_97+0x20
28: R_PPC64_REL64 __ftr_alt_97+0x2c
30: 00 04 00 00 .long 0x40000
...
40: R_PPC64_REL64 .text+0x1670
48: R_PPC64_REL64 .text+0x1680
50: R_PPC64_REL64 __ftr_alt_97+0x24
58: R_PPC64_REL64 __ftr_alt_97+0x30
60: 00 04 00 00 .long 0x40000
...
70: R_PPC64_REL64 .text+0x17f0
78: R_PPC64_REL64 .text+0x1800
80: R_PPC64_REL64 __ftr_alt_97+0x28
88: R_PPC64_REL64 __ftr_alt_97+0x34
90: 00 04 00 00 .long 0x40000
...
a0: R_PPC64_REL64 .text+0x1e00
a8: R_PPC64_REL64 .text+0x1e10
b0: R_PPC64_REL64 __ftr_alt_97+0x2c
b8: R_PPC64_REL64 __ftr_alt_97+0x38
c0: 00 04 00 00 .long 0x40000
...
d0: R_PPC64_REL64 .text+0x2060
d8: R_PPC64_REL64 .text+0x2070
e0: R_PPC64_REL64 __ftr_alt_97+0x30
e8: R_PPC64_REL64 __ftr_alt_97+0x3c
f0: 00 04 00 00 .long 0x40000
...
100: R_PPC64_REL64 .text+0x2350
108: R_PPC64_REL64 .text+0x2360
110: R_PPC64_REL64 __ftr_alt_97+0x34
118: R_PPC64_REL64 __ftr_alt_97+0x40
On rhel-10.2, a kpatch touching fs/userfaultfd.o results in a final linker error:
ld: final link failed: bad valueTracing through this, it seems that upstream v6.1+ 9c7bfc2dc21e ("powerpc/64s: Make POWER10 and later use pause_short in cpu_relax loops") results in way more
__ftr_alt_97, __ftr_fixup, .rela__ftr_fixupsections for which kpatch-build now stumbles over:Some debugging from the main linux tree: