module.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * AArch64 loadable module support.
  4. *
  5. * Copyright (C) 2012 ARM Limited
  6. *
  7. * Author: Will Deacon <[email protected]>
  8. */
  9. #include <linux/bitops.h>
  10. #include <linux/elf.h>
  11. #include <linux/ftrace.h>
  12. #include <linux/gfp.h>
  13. #include <linux/kasan.h>
  14. #include <linux/kernel.h>
  15. #include <linux/mm.h>
  16. #include <linux/moduleloader.h>
  17. #include <linux/scs.h>
  18. #include <linux/vmalloc.h>
  19. #include <asm/alternative.h>
  20. #include <asm/insn.h>
  21. #include <asm/scs.h>
  22. #include <asm/sections.h>
  23. void *module_alloc(unsigned long size)
  24. {
  25. u64 module_alloc_end = module_alloc_base + MODULES_VSIZE;
  26. gfp_t gfp_mask = GFP_KERNEL;
  27. void *p;
  28. /* Silence the initial allocation */
  29. if (IS_ENABLED(CONFIG_ARM64_MODULE_PLTS))
  30. gfp_mask |= __GFP_NOWARN;
  31. if (IS_ENABLED(CONFIG_KASAN_GENERIC) ||
  32. IS_ENABLED(CONFIG_KASAN_SW_TAGS))
  33. /* don't exceed the static module region - see below */
  34. module_alloc_end = MODULES_END;
  35. p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base,
  36. module_alloc_end, gfp_mask, PAGE_KERNEL, VM_DEFER_KMEMLEAK,
  37. NUMA_NO_NODE, __builtin_return_address(0));
  38. if (!p && IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) &&
  39. (IS_ENABLED(CONFIG_KASAN_VMALLOC) ||
  40. (!IS_ENABLED(CONFIG_KASAN_GENERIC) &&
  41. !IS_ENABLED(CONFIG_KASAN_SW_TAGS))))
  42. /*
  43. * KASAN without KASAN_VMALLOC can only deal with module
  44. * allocations being served from the reserved module region,
  45. * since the remainder of the vmalloc region is already
  46. * backed by zero shadow pages, and punching holes into it
  47. * is non-trivial. Since the module region is not randomized
  48. * when KASAN is enabled without KASAN_VMALLOC, it is even
  49. * less likely that the module region gets exhausted, so we
  50. * can simply omit this fallback in that case.
  51. */
  52. p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base,
  53. module_alloc_base + SZ_2G, GFP_KERNEL,
  54. PAGE_KERNEL, 0, NUMA_NO_NODE,
  55. __builtin_return_address(0));
  56. if (p && (kasan_alloc_module_shadow(p, size, gfp_mask) < 0)) {
  57. vfree(p);
  58. return NULL;
  59. }
  60. /* Memory is intended to be executable, reset the pointer tag. */
  61. return kasan_reset_tag(p);
  62. }
  63. enum aarch64_reloc_op {
  64. RELOC_OP_NONE,
  65. RELOC_OP_ABS,
  66. RELOC_OP_PREL,
  67. RELOC_OP_PAGE,
  68. };
  69. static u64 do_reloc(enum aarch64_reloc_op reloc_op, __le32 *place, u64 val)
  70. {
  71. switch (reloc_op) {
  72. case RELOC_OP_ABS:
  73. return val;
  74. case RELOC_OP_PREL:
  75. return val - (u64)place;
  76. case RELOC_OP_PAGE:
  77. return (val & ~0xfff) - ((u64)place & ~0xfff);
  78. case RELOC_OP_NONE:
  79. return 0;
  80. }
  81. pr_err("do_reloc: unknown relocation operation %d\n", reloc_op);
  82. return 0;
  83. }
  84. static int reloc_data(enum aarch64_reloc_op op, void *place, u64 val, int len)
  85. {
  86. s64 sval = do_reloc(op, place, val);
  87. /*
  88. * The ELF psABI for AArch64 documents the 16-bit and 32-bit place
  89. * relative and absolute relocations as having a range of [-2^15, 2^16)
  90. * or [-2^31, 2^32), respectively. However, in order to be able to
  91. * detect overflows reliably, we have to choose whether we interpret
  92. * such quantities as signed or as unsigned, and stick with it.
  93. * The way we organize our address space requires a signed
  94. * interpretation of 32-bit relative references, so let's use that
  95. * for all R_AARCH64_PRELxx relocations. This means our upper
  96. * bound for overflow detection should be Sxx_MAX rather than Uxx_MAX.
  97. */
  98. switch (len) {
  99. case 16:
  100. *(s16 *)place = sval;
  101. switch (op) {
  102. case RELOC_OP_ABS:
  103. if (sval < 0 || sval > U16_MAX)
  104. return -ERANGE;
  105. break;
  106. case RELOC_OP_PREL:
  107. if (sval < S16_MIN || sval > S16_MAX)
  108. return -ERANGE;
  109. break;
  110. default:
  111. pr_err("Invalid 16-bit data relocation (%d)\n", op);
  112. return 0;
  113. }
  114. break;
  115. case 32:
  116. *(s32 *)place = sval;
  117. switch (op) {
  118. case RELOC_OP_ABS:
  119. if (sval < 0 || sval > U32_MAX)
  120. return -ERANGE;
  121. break;
  122. case RELOC_OP_PREL:
  123. if (sval < S32_MIN || sval > S32_MAX)
  124. return -ERANGE;
  125. break;
  126. default:
  127. pr_err("Invalid 32-bit data relocation (%d)\n", op);
  128. return 0;
  129. }
  130. break;
  131. case 64:
  132. *(s64 *)place = sval;
  133. break;
  134. default:
  135. pr_err("Invalid length (%d) for data relocation\n", len);
  136. return 0;
  137. }
  138. return 0;
  139. }
  140. enum aarch64_insn_movw_imm_type {
  141. AARCH64_INSN_IMM_MOVNZ,
  142. AARCH64_INSN_IMM_MOVKZ,
  143. };
  144. static int reloc_insn_movw(enum aarch64_reloc_op op, __le32 *place, u64 val,
  145. int lsb, enum aarch64_insn_movw_imm_type imm_type)
  146. {
  147. u64 imm;
  148. s64 sval;
  149. u32 insn = le32_to_cpu(*place);
  150. sval = do_reloc(op, place, val);
  151. imm = sval >> lsb;
  152. if (imm_type == AARCH64_INSN_IMM_MOVNZ) {
  153. /*
  154. * For signed MOVW relocations, we have to manipulate the
  155. * instruction encoding depending on whether or not the
  156. * immediate is less than zero.
  157. */
  158. insn &= ~(3 << 29);
  159. if (sval >= 0) {
  160. /* >=0: Set the instruction to MOVZ (opcode 10b). */
  161. insn |= 2 << 29;
  162. } else {
  163. /*
  164. * <0: Set the instruction to MOVN (opcode 00b).
  165. * Since we've masked the opcode already, we
  166. * don't need to do anything other than
  167. * inverting the new immediate field.
  168. */
  169. imm = ~imm;
  170. }
  171. }
  172. /* Update the instruction with the new encoding. */
  173. insn = aarch64_insn_encode_immediate(AARCH64_INSN_IMM_16, insn, imm);
  174. *place = cpu_to_le32(insn);
  175. if (imm > U16_MAX)
  176. return -ERANGE;
  177. return 0;
  178. }
  179. static int reloc_insn_imm(enum aarch64_reloc_op op, __le32 *place, u64 val,
  180. int lsb, int len, enum aarch64_insn_imm_type imm_type)
  181. {
  182. u64 imm, imm_mask;
  183. s64 sval;
  184. u32 insn = le32_to_cpu(*place);
  185. /* Calculate the relocation value. */
  186. sval = do_reloc(op, place, val);
  187. sval >>= lsb;
  188. /* Extract the value bits and shift them to bit 0. */
  189. imm_mask = (BIT(lsb + len) - 1) >> lsb;
  190. imm = sval & imm_mask;
  191. /* Update the instruction's immediate field. */
  192. insn = aarch64_insn_encode_immediate(imm_type, insn, imm);
  193. *place = cpu_to_le32(insn);
  194. /*
  195. * Extract the upper value bits (including the sign bit) and
  196. * shift them to bit 0.
  197. */
  198. sval = (s64)(sval & ~(imm_mask >> 1)) >> (len - 1);
  199. /*
  200. * Overflow has occurred if the upper bits are not all equal to
  201. * the sign bit of the value.
  202. */
  203. if ((u64)(sval + 1) >= 2)
  204. return -ERANGE;
  205. return 0;
  206. }
  207. static int reloc_insn_adrp(struct module *mod, Elf64_Shdr *sechdrs,
  208. __le32 *place, u64 val)
  209. {
  210. u32 insn;
  211. if (!is_forbidden_offset_for_adrp(place))
  212. return reloc_insn_imm(RELOC_OP_PAGE, place, val, 12, 21,
  213. AARCH64_INSN_IMM_ADR);
  214. /* patch ADRP to ADR if it is in range */
  215. if (!reloc_insn_imm(RELOC_OP_PREL, place, val & ~0xfff, 0, 21,
  216. AARCH64_INSN_IMM_ADR)) {
  217. insn = le32_to_cpu(*place);
  218. insn &= ~BIT(31);
  219. } else {
  220. /* out of range for ADR -> emit a veneer */
  221. val = module_emit_veneer_for_adrp(mod, sechdrs, place, val & ~0xfff);
  222. if (!val)
  223. return -ENOEXEC;
  224. insn = aarch64_insn_gen_branch_imm((u64)place, val,
  225. AARCH64_INSN_BRANCH_NOLINK);
  226. }
  227. *place = cpu_to_le32(insn);
  228. return 0;
  229. }
  230. int apply_relocate_add(Elf64_Shdr *sechdrs,
  231. const char *strtab,
  232. unsigned int symindex,
  233. unsigned int relsec,
  234. struct module *me)
  235. {
  236. unsigned int i;
  237. int ovf;
  238. bool overflow_check;
  239. Elf64_Sym *sym;
  240. void *loc;
  241. u64 val;
  242. Elf64_Rela *rel = (void *)sechdrs[relsec].sh_addr;
  243. for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
  244. /* loc corresponds to P in the AArch64 ELF document. */
  245. loc = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
  246. + rel[i].r_offset;
  247. /* sym is the ELF symbol we're referring to. */
  248. sym = (Elf64_Sym *)sechdrs[symindex].sh_addr
  249. + ELF64_R_SYM(rel[i].r_info);
  250. /* val corresponds to (S + A) in the AArch64 ELF document. */
  251. val = sym->st_value + rel[i].r_addend;
  252. /* Check for overflow by default. */
  253. overflow_check = true;
  254. /* Perform the static relocation. */
  255. switch (ELF64_R_TYPE(rel[i].r_info)) {
  256. /* Null relocations. */
  257. case R_ARM_NONE:
  258. case R_AARCH64_NONE:
  259. ovf = 0;
  260. break;
  261. /* Data relocations. */
  262. case R_AARCH64_ABS64:
  263. overflow_check = false;
  264. ovf = reloc_data(RELOC_OP_ABS, loc, val, 64);
  265. break;
  266. case R_AARCH64_ABS32:
  267. ovf = reloc_data(RELOC_OP_ABS, loc, val, 32);
  268. break;
  269. case R_AARCH64_ABS16:
  270. ovf = reloc_data(RELOC_OP_ABS, loc, val, 16);
  271. break;
  272. case R_AARCH64_PREL64:
  273. overflow_check = false;
  274. ovf = reloc_data(RELOC_OP_PREL, loc, val, 64);
  275. break;
  276. case R_AARCH64_PREL32:
  277. ovf = reloc_data(RELOC_OP_PREL, loc, val, 32);
  278. break;
  279. case R_AARCH64_PREL16:
  280. ovf = reloc_data(RELOC_OP_PREL, loc, val, 16);
  281. break;
  282. /* MOVW instruction relocations. */
  283. case R_AARCH64_MOVW_UABS_G0_NC:
  284. overflow_check = false;
  285. fallthrough;
  286. case R_AARCH64_MOVW_UABS_G0:
  287. ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 0,
  288. AARCH64_INSN_IMM_MOVKZ);
  289. break;
  290. case R_AARCH64_MOVW_UABS_G1_NC:
  291. overflow_check = false;
  292. fallthrough;
  293. case R_AARCH64_MOVW_UABS_G1:
  294. ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 16,
  295. AARCH64_INSN_IMM_MOVKZ);
  296. break;
  297. case R_AARCH64_MOVW_UABS_G2_NC:
  298. overflow_check = false;
  299. fallthrough;
  300. case R_AARCH64_MOVW_UABS_G2:
  301. ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 32,
  302. AARCH64_INSN_IMM_MOVKZ);
  303. break;
  304. case R_AARCH64_MOVW_UABS_G3:
  305. /* We're using the top bits so we can't overflow. */
  306. overflow_check = false;
  307. ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 48,
  308. AARCH64_INSN_IMM_MOVKZ);
  309. break;
  310. case R_AARCH64_MOVW_SABS_G0:
  311. ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 0,
  312. AARCH64_INSN_IMM_MOVNZ);
  313. break;
  314. case R_AARCH64_MOVW_SABS_G1:
  315. ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 16,
  316. AARCH64_INSN_IMM_MOVNZ);
  317. break;
  318. case R_AARCH64_MOVW_SABS_G2:
  319. ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 32,
  320. AARCH64_INSN_IMM_MOVNZ);
  321. break;
  322. case R_AARCH64_MOVW_PREL_G0_NC:
  323. overflow_check = false;
  324. ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 0,
  325. AARCH64_INSN_IMM_MOVKZ);
  326. break;
  327. case R_AARCH64_MOVW_PREL_G0:
  328. ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 0,
  329. AARCH64_INSN_IMM_MOVNZ);
  330. break;
  331. case R_AARCH64_MOVW_PREL_G1_NC:
  332. overflow_check = false;
  333. ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 16,
  334. AARCH64_INSN_IMM_MOVKZ);
  335. break;
  336. case R_AARCH64_MOVW_PREL_G1:
  337. ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 16,
  338. AARCH64_INSN_IMM_MOVNZ);
  339. break;
  340. case R_AARCH64_MOVW_PREL_G2_NC:
  341. overflow_check = false;
  342. ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 32,
  343. AARCH64_INSN_IMM_MOVKZ);
  344. break;
  345. case R_AARCH64_MOVW_PREL_G2:
  346. ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 32,
  347. AARCH64_INSN_IMM_MOVNZ);
  348. break;
  349. case R_AARCH64_MOVW_PREL_G3:
  350. /* We're using the top bits so we can't overflow. */
  351. overflow_check = false;
  352. ovf = reloc_insn_movw(RELOC_OP_PREL, loc, val, 48,
  353. AARCH64_INSN_IMM_MOVNZ);
  354. break;
  355. /* Immediate instruction relocations. */
  356. case R_AARCH64_LD_PREL_LO19:
  357. ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 2, 19,
  358. AARCH64_INSN_IMM_19);
  359. break;
  360. case R_AARCH64_ADR_PREL_LO21:
  361. ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 0, 21,
  362. AARCH64_INSN_IMM_ADR);
  363. break;
  364. case R_AARCH64_ADR_PREL_PG_HI21_NC:
  365. overflow_check = false;
  366. fallthrough;
  367. case R_AARCH64_ADR_PREL_PG_HI21:
  368. ovf = reloc_insn_adrp(me, sechdrs, loc, val);
  369. if (ovf && ovf != -ERANGE)
  370. return ovf;
  371. break;
  372. case R_AARCH64_ADD_ABS_LO12_NC:
  373. case R_AARCH64_LDST8_ABS_LO12_NC:
  374. overflow_check = false;
  375. ovf = reloc_insn_imm(RELOC_OP_ABS, loc, val, 0, 12,
  376. AARCH64_INSN_IMM_12);
  377. break;
  378. case R_AARCH64_LDST16_ABS_LO12_NC:
  379. overflow_check = false;
  380. ovf = reloc_insn_imm(RELOC_OP_ABS, loc, val, 1, 11,
  381. AARCH64_INSN_IMM_12);
  382. break;
  383. case R_AARCH64_LDST32_ABS_LO12_NC:
  384. overflow_check = false;
  385. ovf = reloc_insn_imm(RELOC_OP_ABS, loc, val, 2, 10,
  386. AARCH64_INSN_IMM_12);
  387. break;
  388. case R_AARCH64_LDST64_ABS_LO12_NC:
  389. overflow_check = false;
  390. ovf = reloc_insn_imm(RELOC_OP_ABS, loc, val, 3, 9,
  391. AARCH64_INSN_IMM_12);
  392. break;
  393. case R_AARCH64_LDST128_ABS_LO12_NC:
  394. overflow_check = false;
  395. ovf = reloc_insn_imm(RELOC_OP_ABS, loc, val, 4, 8,
  396. AARCH64_INSN_IMM_12);
  397. break;
  398. case R_AARCH64_TSTBR14:
  399. ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 2, 14,
  400. AARCH64_INSN_IMM_14);
  401. break;
  402. case R_AARCH64_CONDBR19:
  403. ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 2, 19,
  404. AARCH64_INSN_IMM_19);
  405. break;
  406. case R_AARCH64_JUMP26:
  407. case R_AARCH64_CALL26:
  408. ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 2, 26,
  409. AARCH64_INSN_IMM_26);
  410. if (IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) &&
  411. ovf == -ERANGE) {
  412. val = module_emit_plt_entry(me, sechdrs, loc, &rel[i], sym);
  413. if (!val)
  414. return -ENOEXEC;
  415. ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 2,
  416. 26, AARCH64_INSN_IMM_26);
  417. }
  418. break;
  419. default:
  420. pr_err("module %s: unsupported RELA relocation: %llu\n",
  421. me->name, ELF64_R_TYPE(rel[i].r_info));
  422. return -ENOEXEC;
  423. }
  424. if (overflow_check && ovf == -ERANGE)
  425. goto overflow;
  426. }
  427. return 0;
  428. overflow:
  429. pr_err("module %s: overflow in relocation type %d val %Lx\n",
  430. me->name, (int)ELF64_R_TYPE(rel[i].r_info), val);
  431. return -ENOEXEC;
  432. }
  433. static inline void __init_plt(struct plt_entry *plt, unsigned long addr)
  434. {
  435. *plt = get_plt_entry(addr, plt);
  436. }
  437. static int module_init_ftrace_plt(const Elf_Ehdr *hdr,
  438. const Elf_Shdr *sechdrs,
  439. struct module *mod)
  440. {
  441. #if defined(CONFIG_ARM64_MODULE_PLTS) && defined(CONFIG_DYNAMIC_FTRACE)
  442. const Elf_Shdr *s;
  443. struct plt_entry *plts;
  444. s = find_section(hdr, sechdrs, ".text.ftrace_trampoline");
  445. if (!s)
  446. return -ENOEXEC;
  447. plts = (void *)s->sh_addr;
  448. __init_plt(&plts[FTRACE_PLT_IDX], FTRACE_ADDR);
  449. if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS))
  450. __init_plt(&plts[FTRACE_REGS_PLT_IDX], FTRACE_REGS_ADDR);
  451. mod->arch.ftrace_trampolines = plts;
  452. #endif
  453. return 0;
  454. }
  455. static int module_init_hyp(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
  456. struct module *mod)
  457. {
  458. #ifdef CONFIG_KVM
  459. const Elf_Shdr *s;
  460. /*
  461. * If the .hyp.text is missing or empty, this is not a hypervisor
  462. * module so ignore the rest of it.
  463. */
  464. s = find_section(hdr, sechdrs, ".hyp.text");
  465. if (!s || !s->sh_size)
  466. return 0;
  467. mod->arch.hyp.text = (struct pkvm_module_section) {
  468. .start = (void *)s->sh_addr,
  469. .end = (void *)s->sh_addr + s->sh_size,
  470. };
  471. s = find_section(hdr, sechdrs, ".hyp.reloc");
  472. if (!s)
  473. return -ENOEXEC;
  474. mod->arch.hyp.relocs = (void *)s->sh_addr;
  475. mod->arch.hyp.nr_relocs = s->sh_size / sizeof(*mod->arch.hyp.relocs);
  476. s = find_section(hdr, sechdrs, ".hyp.bss");
  477. if (s && s->sh_size) {
  478. mod->arch.hyp.bss = (struct pkvm_module_section) {
  479. .start = (void *)s->sh_addr,
  480. .end = (void *)s->sh_addr + s->sh_size,
  481. };
  482. }
  483. s = find_section(hdr, sechdrs, ".hyp.rodata");
  484. if (s && s->sh_size) {
  485. mod->arch.hyp.rodata = (struct pkvm_module_section) {
  486. .start = (void *)s->sh_addr,
  487. .end = (void *)s->sh_addr + s->sh_size,
  488. };
  489. }
  490. s = find_section(hdr, sechdrs, ".hyp.data");
  491. if (s && s->sh_size) {
  492. mod->arch.hyp.data = (struct pkvm_module_section) {
  493. .start = (void *)s->sh_addr,
  494. .end = (void *)s->sh_addr + s->sh_size,
  495. };
  496. }
  497. #endif
  498. return 0;
  499. }
  500. int module_finalize(const Elf_Ehdr *hdr,
  501. const Elf_Shdr *sechdrs,
  502. struct module *me)
  503. {
  504. int err;
  505. const Elf_Shdr *s;
  506. s = find_section(hdr, sechdrs, ".altinstructions");
  507. if (s)
  508. apply_alternatives_module((void *)s->sh_addr, s->sh_size);
  509. if (scs_is_dynamic()) {
  510. s = find_section(hdr, sechdrs, ".init.eh_frame");
  511. if (s)
  512. scs_patch((void *)s->sh_addr, s->sh_size);
  513. }
  514. err = module_init_ftrace_plt(hdr, sechdrs, me);
  515. if (err)
  516. return err;
  517. return module_init_hyp(hdr, sechdrs, me);
  518. }