lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <6c819e1944044bfa8f88574beb094ef5@huawei.com>
Date:   Wed, 24 Mar 2021 07:27:04 +0000
From:   "chenjun (AM)" <chenjun102@...wei.com>
To:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        Ard Biesheuvel <ardb@...nel.org>,
        Will Deacon <will.deacon@....com>
CC:     Catalin Marinas <catalin.marinas@....com>,
        "Xiangrui (Euler)" <rui.xiang@...wei.com>,
        liuyanshi <liuyanshi@...wei.com>,
        wuzengkun <wuzengkun@...ilicon.com>
Subject: [question] insert ko failed because count_plts return 0 when
 CONFIG_RANDOMIZE_BASE is not set

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ