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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220214114927.6104-1-alexandr.lobakin@intel.com>
Date:   Mon, 14 Feb 2022 12:49:27 +0100
From:   Alexander Lobakin <alexandr.lobakin@...el.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Alexander Lobakin <alexandr.lobakin@...el.com>,
        linux-hardening@...r.kernel.org, x86@...nel.org,
        Borislav Petkov <bp@...en8.de>,
        Jesse Brandeburg <jesse.brandeburg@...el.com>,
        Kristen Carlson Accardi <kristen@...ux.intel.com>,
        Kees Cook <keescook@...omium.org>,
        Miklos Szeredi <miklos@...redi.hu>,
        Ard Biesheuvel <ardb@...nel.org>,
        Tony Luck <tony.luck@...el.com>,
        Bruce Schlobohm <bruce.schlobohm@...el.com>,
        Jessica Yu <jeyu@...nel.org>,
        kernel test robot <lkp@...el.com>,
        Miroslav Benes <mbenes@...e.cz>,
        Evgenii Shatokhin <eshatokhin@...tuozzo.com>,
        Jonathan Corbet <corbet@....net>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Michal Marek <michal.lkml@...kovi.net>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        "David S. Miller" <davem@...emloft.net>,
        Thomas Gleixner <tglx@...utronix.de>,
        Will Deacon <will@...nel.org>, Ingo Molnar <mingo@...hat.com>,
        Christoph Hellwig <hch@....de>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        Andy Lutomirski <luto@...nel.org>,
        Arnd Bergmann <arnd@...db.de>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Nathan Chancellor <nathan@...nel.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Marios Pomonis <pomonis@...gle.com>,
        Sami Tolvanen <samitolvanen@...gle.com>,
        "H.J. Lu" <hjl.tools@...il.com>, Nicolas Pitre <nico@...xnic.net>,
        linux-kernel@...r.kernel.org, linux-kbuild@...r.kernel.org,
        linux-arch@...r.kernel.org, live-patching@...r.kernel.org,
        llvm@...ts.linux.dev
Subject: Re: [PATCH v10 05/15] x86: support asm function sections

From: Peter Zijlstra <peterz@...radead.org>
Date: Fri, 11 Feb 2022 16:45:24 +0100

> On Wed, Feb 09, 2022 at 07:57:42PM +0100, Alexander Lobakin wrote:
> > Address places which need special care and enable
> > CONFIG_ARCH_SUPPORTS_ASM_FUNCTION_SECTIONS.
> > 
> > Notably:
> >  - propagate `--sectname-subst` to KBUILD_AFLAGS in
> >    x86/boot/Makefile and x86/boot/compressed/Makefile as both
> >    override them;
> >  - symbols starting with a dot (like ".Lrelocated") should be
> >    handled manually with SYM_*_START_SECT(.Lrelocated, relocated)
> >    as "two dots" is a special (and CPP doesn't want to concatenate
> >    two dots in general);
> >  - some symbols explicitly need to reside in one section (like
> >    kexec control code, hibernation page etc.);
> >  - macros creating aliases for functions (like __memcpy() for
> >    memcpy() etc.) should go after the main declaration (as
> >    aliases should be declared in the same section and they
> >    don't have SYM_PUSH_SECTION() inside);
> >  - things like ".org", ".align" should be manually pushed to
> >    the same section the next symbol goes to;
> >  - expand indirect_thunk wildcards in vmlinux.lds.S to catch
> >    symbols back into the "main" section;
> >  - inline ASM functions like __raw_callee*() should be pushed
> >    manually as well.
> > 
> > With these changes and `-ffunction-sections` enabled, "plain"
> > ".text" section is empty which means that everything works
> > right as expected.
> > 
> > Signed-off-by: Alexander Lobakin <alexandr.lobakin@...el.com>
> > ---
> >  arch/x86/Kconfig                              |  1 +
> >  arch/x86/boot/Makefile                        |  1 +
> >  arch/x86/boot/compressed/Makefile             |  1 +
> >  arch/x86/boot/compressed/head_32.S            |  2 +-
> >  arch/x86/boot/compressed/head_64.S            | 32 ++++++++++++-------
> >  arch/x86/boot/pmjump.S                        |  2 +-
> >  arch/x86/crypto/aesni-intel_asm.S             |  4 +--
> >  arch/x86/crypto/poly1305-x86_64-cryptogams.pl |  4 +++
> >  arch/x86/include/asm/paravirt.h               |  2 ++
> >  arch/x86/include/asm/qspinlock_paravirt.h     |  2 ++
> >  arch/x86/kernel/head_32.S                     |  4 +--
> >  arch/x86/kernel/head_64.S                     |  4 +--
> >  arch/x86/kernel/kprobes/core.c                |  2 ++
> >  arch/x86/kernel/kvm.c                         |  2 ++
> >  arch/x86/kernel/relocate_kernel_32.S          | 10 +++---
> >  arch/x86/kernel/relocate_kernel_64.S          | 12 ++++---
> >  arch/x86/kernel/vmlinux.lds.S                 |  2 +-
> >  arch/x86/kvm/emulate.c                        |  7 +++-
> >  arch/x86/lib/copy_user_64.S                   |  2 +-
> >  arch/x86/lib/error-inject.c                   |  2 ++
> >  arch/x86/lib/getuser.S                        |  5 ++-
> >  arch/x86/lib/memcpy_64.S                      |  4 +--
> >  arch/x86/lib/memmove_64.S                     |  5 ++-
> >  arch/x86/lib/memset_64.S                      |  5 +--
> >  arch/x86/lib/putuser.S                        |  2 +-
> >  arch/x86/power/hibernate_asm_32.S             | 10 +++---
> >  arch/x86/power/hibernate_asm_64.S             | 10 +++---
> >  27 files changed, 89 insertions(+), 50 deletions(-)
> 
> Urgh, how much of that can you avoid by (ab)using __DISABLE_EXPORTS
> like:
> 
>   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?h=x86/wip.ibt&id=ab74f54f2b1f6cfeaf2b3ba6999bde7cabada9ca

Oh, never thought on that, looks like at least 3 of 27 files and
35 of 139 lines, nice!
I'll redo this one in the meantime whilst waiting for more comments
here.

Thanks!
Al

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ