From: "chenjun (AM)" <chenjun102@huawei.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Ard Biesheuvel <ardb@kernel.org>,
Will Deacon <will.deacon@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
"Xiangrui (Euler)" <rui.xiang@huawei.com>,
liuyanshi <liuyanshi@huawei.com>,
wuzengkun <wuzengkun@hisilicon.com>
Subject: [question] insert ko failed because count_plts return 0 when CONFIG_RANDOMIZE_BASE is not set
Date: Wed, 24 Mar 2021 07:27:04 +0000 [thread overview]
Message-ID: <6c819e1944044bfa8f88574beb094ef5@huawei.com> (raw)
Hi
I make a Image for arm64 (without CONFIG_RANDOMIZE_BASE). And a ko (13M)
can not be inserted.
WARNING: CPU: 2 PID: 1998 at arch/arm64/kernel/module-plts.c:39
module_emit_plt_entry+0x100/0x118
..
Call trace:
module_emit_plt_entry+0x100/0x118
apply_relocate_add+0x34c/0x570
..
I think the problem is that:
in apply_relocate_add:
case R_AARCH64_CALL26:
ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 2, 26,
AARCH64_INSN_IMM_26);
if (IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) &&
ovf == -ERANGE) {
val = module_emit_plt_entry(me, sechdrs,
loc, &rel[i], sym); realoc_insn_imm return -ERANGE (because the ko is
too big?)
in module_emit_plt_entry:
WARN_ON(pltsec->plt_num_entries > pltsec->plt_max_entries)
pltsec->plt_max_entries is 0 if CONFIG_RANDOMIZE_BASE is not be set.
a257e02 arm64/kernel: don't ban ADRP to work around Cortex-A53 erratum
#843419
static unsigned int count_plts(Elf64_Sym *syms, Elf64_Rela *rela, int
num,
- Elf64_Word dstidx)
+ Elf64_Word dstidx, Elf_Shdr *dstsec)
{
..
switch (ELF64_R_TYPE(rela[i].r_info)) {
case R_AARCH64_JUMP26:
case R_AARCH64_CALL26:
+ if (!IS_ENABLED(CONFIG_RANDOMIZE_BASE))
+ break;
+
Why we need break if !IS_ENABLED(CONFIG_RANDOMIZE_BASE)? or any
restrictions on ko?
I comment out this part of the code. the ko could be inserted, and seems
to work well. So is it a accepted way? or any solution for my case?
--
Regards
Chen Jun
next reply other threads:[~2021-03-24 7:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-24 7:27 chenjun (AM) [this message]
2021-03-24 8:29 ` [question] insert ko failed because count_plts return 0 when CONFIG_RANDOMIZE_BASE is not set Ard Biesheuvel
2021-03-25 6:21 ` chenjun (AM)
2021-03-25 7:35 ` Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6c819e1944044bfa8f88574beb094ef5@huawei.com \
--to=chenjun102@huawei.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyanshi@huawei.com \
--cc=rui.xiang@huawei.com \
--cc=will.deacon@arm.com \
--cc=wuzengkun@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).