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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 14 Feb 2021 09:51:47 -0600
From:   Josh Poimboeuf <jpoimboe@...hat.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Steven Rostedt <rostedt@...dmis.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Xi Ruoyao <xry111@...gyan1223.wang>,
        "# 3.4.x" <stable@...r.kernel.org>,
        Arnd Bergmann <arnd@...nel.org>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Miroslav Benes <mbenes@...e.cz>,
        "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-tip-commits@...r.kernel.org
Subject: Re: [tip: objtool/urgent] objtool: Fix seg fault with Clang
 non-section symbols

On Sat, Feb 13, 2021 at 05:25:18PM +0100, Greg Kroah-Hartman wrote:
> On Sat, Feb 13, 2021 at 09:52:03AM -0600, Josh Poimboeuf wrote:
> > On Sat, Feb 13, 2021 at 09:13:04AM -0500, Steven Rostedt wrote:
> > > On Sat, 13 Feb 2021 15:09:02 +0100
> > > Greg Kroah-Hartman <gregkh@...uxfoundation.org> wrote:
> > > 
> > > > Thanks for the patch, but no, still fails with:
> > > > 
> > > > Cannot find symbol for section 8: .text.unlikely.
> > > > kernel/kexec_file.o: failed
> > > > make[1]: *** [scripts/Makefile.build:277: kernel/kexec_file.o] Error 1
> > > > make[1]: *** Deleting file 'kernel/kexec_file.o'
> > > 
> > > It was just a guess.
> > > 
> > > I guess I'll need to find some time next week to set up a VM with
> > > binutils 2.36 (I just checked, and all my development machines have
> > > 2.35). Then I'll be able to try and debug it.
> > 
> > FWIW, I wasn't able to recreate.   I tried both binutils 2.36 and
> > 2.36.1, with gcc 11 and a 'make allmodconfig' kernel.
> 
> I'm using whatever the latest is in Arch, which is gcc 10.2 and binutils
> 2.36.  My config is here:
> 	https://github.com/gregkh/gregkh-linux/blob/master/stable/configs/4.4.y

Ok, I was able to recreate with that config.

GCC places two weak functions (arch_kexec_apply_relocations_add() and
arch_kexec_apply_relocations()) in .text.unlikely (probably because
printk() is __cold), and then the assembler doesn't generate the
'.text.unlikely' symbol because no other code references it.

Steve, looks like recordmcount avoids referencing weak symbols directly
by their function symbol.  Maybe it can just skip weak symbols which
don't have a section symbol, since this seems like a rare scenario.

Here's a total hack fix.  Just remove the functions, awkwardly avoiding
the problem.

diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 6030efd4a188..456e3427c5e5 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -115,24 +115,6 @@ int __weak arch_kexec_kernel_verify_sig(struct kimage *image, void *buf,
 	return -EKEYREJECTED;
 }
 
-/* Apply relocations of type RELA */
-int __weak
-arch_kexec_apply_relocations_add(const Elf_Ehdr *ehdr, Elf_Shdr *sechdrs,
-				 unsigned int relsec)
-{
-	pr_err("RELA relocation unsupported.\n");
-	return -ENOEXEC;
-}
-
-/* Apply relocations of type REL */
-int __weak
-arch_kexec_apply_relocations(const Elf_Ehdr *ehdr, Elf_Shdr *sechdrs,
-			     unsigned int relsec)
-{
-	pr_err("REL relocation unsupported.\n");
-	return -ENOEXEC;
-}
-
 /*
  * Free up memory used by kernel, initrd, and command line. This is temporary
  * memory allocation which is not needed any more after these buffers have

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ