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]
Message-ID: <20181116195203.GB15240@ravnborg.org>
Date:   Fri, 16 Nov 2018 20:52:03 +0100
From:   Sam Ravnborg <sam@...nborg.org>
To:     Paul Walmsley <paul.walmsley@...ive.com>
Cc:     linux-kernel@...r.kernel.org, Russell King <linux@...linux.org.uk>,
        Jim Wilson <jimw@...ive.com>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Michal Marek <michal.lkml@...kovi.net>,
        linux-kbuild@...r.kernel.org, Paul Walmsley <paul@...an.com>
Subject: Re: [PATCH v2 2/2] modpost: skip ELF local symbols by default during
 section mismatch check

On Wed, Nov 14, 2018 at 04:56:02PM -0800, Paul Walmsley wrote:
> During development of a serial console driver with a gcc 8.2.0
> toolchain for RISC-V, the following modpost warning appeared:
> 
> ----
> WARNING: vmlinux.o(.data+0x19b10): Section mismatch in reference from the variable .LANCHOR1 to the function .init.text:sifive_serial_console_setup()
> The variable .LANCHOR1 references
> the function __init sifive_serial_console_setup()
> If the reference is valid then annotate the
> variable with __init* or __refdata (see linux/init.h) or name the variable:
> *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
> ----
> 
> ".LANCHOR1" is an ELF local symbol, automatically created by gcc's section
> anchor generation code:
> 
> https://gcc.gnu.org/onlinedocs/gccint/Anchored-Addresses.html
> 
> https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/varasm.c;h=cd9591a45617464946dcf9a126dde277d9de9804;hb=9fb89fa845c1b2e0a18d85ada0b077c84508ab78#l7473
> 
> This was verified by compiling the kernel with -fno-section-anchors.
> The serial driver code idiom triggering the warning is standard serial
> driver practice, and one that has a specific whitelist inclusion in
> modpost.c.
> 
> I'm neither a modpost nor an ELF expert, but naively, it doesn't seem
> useful for modpost to report section mismatch warnings caused by ELF
> local symbols by default.  Local symbols have compiler-generated
> names, and thus bypass modpost's whitelisting algorithm, which relies
> on the presence of a non-autogenerated symbol name.  This increases
> the likelihood that false positive warnings will be generated (as in
> the above case).
> 
> Thus, disable section mismatch reporting on ELF local symbols.  The
> rationale here is similar to that of commit 2e3a10a1551d ("ARM: avoid
> ARM binutils leaking ELF local symbols") and of similar code already
> present in modpost.c:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/mod/modpost.c?h=v4.19-rc4&id=7876320f88802b22d4e2daf7eb027dd14175a0f8#n1256
> 
> This second version of the patch drops the option to keep section
> mismatch warnings for local sections, based on feedback from Sam
> Ravnborg <sam@...nborg.org>; and clarifies that these warnings
> appear with gcc 8.2.0.
> 
> Cc: Russell King <linux@...linux.org.uk>
> Cc: Jim Wilson <jimw@...ive.com>
> Cc: Masahiro Yamada <yamada.masahiro@...ionext.com>
> Cc: Michal Marek <michal.lkml@...kovi.net>
> Cc: Sam Ravnborg <sam@...nborg.org>
> Cc: linux-kbuild@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> Signed-off-by: Paul Walmsley <paul.walmsley@...ive.com>
> Signed-off-by: Paul Walmsley <paul@...an.com>
Acked-by: Sam Ravnborg <sam@...nborg.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ