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: <20220525083142.GA1952409@roeck-us.net>
Date:   Wed, 25 May 2022 01:31:42 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Masahiro Yamada <masahiroy@...nel.org>
Cc:     linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Nicolas Schier <nicolas@...sle.eu>,
        Peter Zijlstra <peterz@...radead.org>,
        linux-modules@...r.kernel.org, llvm@...ts.linux.dev,
        Ard Biesheuvel <ardb@...nel.org>,
        Sami Tolvanen <samitolvanen@...gle.com>
Subject: Re: [PATCH v6 06/10] kbuild: check static EXPORT_SYMBOL* by script
 instead of modpost

On Fri, May 13, 2022 at 08:39:26PM +0900, Masahiro Yamada wrote:
> The 'static' specifier and EXPORT_SYMBOL() are an odd combination.
> 
> Commit 15bfc2348d54 ("modpost: check for static EXPORT_SYMBOL*
> functions") tried to detect it, but this check has false negatives.
> 
> Here is the sample code.
> 
>   Makefile:
> 
>     obj-y += foo1.o foo2.o
> 
>   foo1.c:
> 
>     #include <linux/export.h>
>     static void foo(void) {}
>     EXPORT_SYMBOL(foo);
> 
>   foo2.c:
> 
>     void foo(void) {}
> 
> foo1.c exports the static symbol 'foo', but modpost cannot catch it
> because it is fooled by foo2.c, which has a global symbol with the
> same name.
> 
> s->is_static is cleared if a global symbol with the same name is found
> somewhere, but EXPORT_SYMBOL() and the global symbol do not necessarily
> belong to the same compilation unit.
> 
> This check should be done per compilation unit, but I do not know how
> to do it in modpost. modpost runs against vmlinux.o or modules, which
> merges multiple objects, then forgets their origin.
> 
> It is true modpost gets access to the lists of all the member objects
> (.vmlinux.objs and *.mod), but modpost cannot parse individual objects
> because they may not be ELF but LLVM IR when CONFIG_LTO_CLANG=y.
> 
> Add a simple bash script to parse the output from ${NM}. This works for
> CONFIG_LTO_CLANG=y because llvm-nm can dump symbols of LLVM IR files.
> 

On parisc builds, this patch results in:

Building parisc:allnoconfig ... failed
--------------
Error log:
scripts/check-local-export: sh /opt/buildbot/slave/next-next/build/arch/parisc/nm failed

Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ