arch/arm/kernel/patch.c:94:11: error: implicit declaration of function '__opcode_to_mem_thumb32'

From: kernel test robot
Date: Sat Feb 20 2021 - 14:12:34 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f40ddce88593482919761f74910f42f4b84c004b
commit: 5a735583b764750726621b0396d03e4782911b77 arm/ftrace: Use __patch_text()
date: 1 year, 3 months ago
config: arm-randconfig-r014-20210220 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5a735583b764750726621b0396d03e4782911b77
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 5a735583b764750726621b0396d03e4782911b77
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

arch/arm/kernel/patch.c: In function '__patch_text_real':
>> arch/arm/kernel/patch.c:94:11: error: implicit declaration of function '__opcode_to_mem_thumb32' [-Werror=implicit-function-declaration]
94 | insn = __opcode_to_mem_thumb32(insn);
| ^~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +/__opcode_to_mem_thumb32 +94 arch/arm/kernel/patch.c

ab0615e2d6fb07 Rabin Vincent 2014-04-24 55
ab0615e2d6fb07 Rabin Vincent 2014-04-24 56 void __kprobes __patch_text_real(void *addr, unsigned int insn, bool remap)
b21d55e98ac2bb Rabin Vincent 2012-02-18 57 {
b21d55e98ac2bb Rabin Vincent 2012-02-18 58 bool thumb2 = IS_ENABLED(CONFIG_THUMB2_KERNEL);
ab0615e2d6fb07 Rabin Vincent 2014-04-24 59 unsigned int uintaddr = (uintptr_t) addr;
ab0615e2d6fb07 Rabin Vincent 2014-04-24 60 bool twopage = false;
ab0615e2d6fb07 Rabin Vincent 2014-04-24 61 unsigned long flags;
ab0615e2d6fb07 Rabin Vincent 2014-04-24 62 void *waddr = addr;
b21d55e98ac2bb Rabin Vincent 2012-02-18 63 int size;
b21d55e98ac2bb Rabin Vincent 2012-02-18 64
ab0615e2d6fb07 Rabin Vincent 2014-04-24 65 if (remap)
ab0615e2d6fb07 Rabin Vincent 2014-04-24 66 waddr = patch_map(addr, FIX_TEXT_POKE0, &flags);
ab0615e2d6fb07 Rabin Vincent 2014-04-24 67 else
ab0615e2d6fb07 Rabin Vincent 2014-04-24 68 __acquire(&patch_lock);
ab0615e2d6fb07 Rabin Vincent 2014-04-24 69
b21d55e98ac2bb Rabin Vincent 2012-02-18 70 if (thumb2 && __opcode_is_thumb16(insn)) {
ab0615e2d6fb07 Rabin Vincent 2014-04-24 71 *(u16 *)waddr = __opcode_to_mem_thumb16(insn);
b21d55e98ac2bb Rabin Vincent 2012-02-18 72 size = sizeof(u16);
ab0615e2d6fb07 Rabin Vincent 2014-04-24 73 } else if (thumb2 && (uintaddr & 2)) {
b21d55e98ac2bb Rabin Vincent 2012-02-18 74 u16 first = __opcode_thumb32_first(insn);
b21d55e98ac2bb Rabin Vincent 2012-02-18 75 u16 second = __opcode_thumb32_second(insn);
ab0615e2d6fb07 Rabin Vincent 2014-04-24 76 u16 *addrh0 = waddr;
ab0615e2d6fb07 Rabin Vincent 2014-04-24 77 u16 *addrh1 = waddr + 2;
ab0615e2d6fb07 Rabin Vincent 2014-04-24 78
ab0615e2d6fb07 Rabin Vincent 2014-04-24 79 twopage = (uintaddr & ~PAGE_MASK) == PAGE_SIZE - 2;
ab0615e2d6fb07 Rabin Vincent 2014-04-24 80 if (twopage && remap)
ab0615e2d6fb07 Rabin Vincent 2014-04-24 81 addrh1 = patch_map(addr + 2, FIX_TEXT_POKE1, NULL);
ab0615e2d6fb07 Rabin Vincent 2014-04-24 82
ab0615e2d6fb07 Rabin Vincent 2014-04-24 83 *addrh0 = __opcode_to_mem_thumb16(first);
ab0615e2d6fb07 Rabin Vincent 2014-04-24 84 *addrh1 = __opcode_to_mem_thumb16(second);
b21d55e98ac2bb Rabin Vincent 2012-02-18 85
ab0615e2d6fb07 Rabin Vincent 2014-04-24 86 if (twopage && addrh1 != addr + 2) {
ab0615e2d6fb07 Rabin Vincent 2014-04-24 87 flush_kernel_vmap_range(addrh1, 2);
ab0615e2d6fb07 Rabin Vincent 2014-04-24 88 patch_unmap(FIX_TEXT_POKE1, NULL);
ab0615e2d6fb07 Rabin Vincent 2014-04-24 89 }
b21d55e98ac2bb Rabin Vincent 2012-02-18 90
b21d55e98ac2bb Rabin Vincent 2012-02-18 91 size = sizeof(u32);
b21d55e98ac2bb Rabin Vincent 2012-02-18 92 } else {
b21d55e98ac2bb Rabin Vincent 2012-02-18 93 if (thumb2)
b21d55e98ac2bb Rabin Vincent 2012-02-18 @94 insn = __opcode_to_mem_thumb32(insn);
b21d55e98ac2bb Rabin Vincent 2012-02-18 95 else
b21d55e98ac2bb Rabin Vincent 2012-02-18 96 insn = __opcode_to_mem_arm(insn);
b21d55e98ac2bb Rabin Vincent 2012-02-18 97
ab0615e2d6fb07 Rabin Vincent 2014-04-24 98 *(u32 *)waddr = insn;
b21d55e98ac2bb Rabin Vincent 2012-02-18 99 size = sizeof(u32);
b21d55e98ac2bb Rabin Vincent 2012-02-18 100 }
b21d55e98ac2bb Rabin Vincent 2012-02-18 101
ab0615e2d6fb07 Rabin Vincent 2014-04-24 102 if (waddr != addr) {
ab0615e2d6fb07 Rabin Vincent 2014-04-24 103 flush_kernel_vmap_range(waddr, twopage ? size / 2 : size);
ab0615e2d6fb07 Rabin Vincent 2014-04-24 104 patch_unmap(FIX_TEXT_POKE0, &flags);
ab0615e2d6fb07 Rabin Vincent 2014-04-24 105 } else
ab0615e2d6fb07 Rabin Vincent 2014-04-24 106 __release(&patch_lock);
ab0615e2d6fb07 Rabin Vincent 2014-04-24 107
b21d55e98ac2bb Rabin Vincent 2012-02-18 108 flush_icache_range((uintptr_t)(addr),
b21d55e98ac2bb Rabin Vincent 2012-02-18 109 (uintptr_t)(addr) + size);
b21d55e98ac2bb Rabin Vincent 2012-02-18 110 }
b21d55e98ac2bb Rabin Vincent 2012-02-18 111

:::::: The code at line 94 was first introduced by commit
:::::: b21d55e98ac2bbcbbeec9a8cb091f717fd95b072 ARM: 7332/1: extract out code patch function from kprobes

:::::: TO: Rabin Vincent <rabin@xxxxxx>
:::::: CC: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip