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] [day] [month] [year] [list]
Date:   Tue, 20 Sep 2022 11:01:10 +0200
From:   Petr Pavlu <petr.pavlu@...e.com>
To:     Nathan Chancellor <nathan@...nel.org>
Cc:     tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
        dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com,
        nicolas@...sle.eu, masahiroy@...nel.org,
        kirill.shutemov@...ux.intel.com, tony.luck@...el.com,
        michael.roth@....com, ndesaulniers@...gle.com,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86: Avoid relocation information in final vmlinux

On 9/14/22 01:40, Nathan Chancellor wrote:
> [...]
>> diff --git a/arch/x86/Makefile.postlink b/arch/x86/Makefile.postlink
>> new file mode 100644
>> index 000000000000..4650aaf6d8b3
>> --- /dev/null
>> +++ b/arch/x86/Makefile.postlink
>> @@ -0,0 +1,41 @@
>> +# SPDX-License-Identifier: GPL-2.0
>> +# ===========================================================================
>> +# Post-link x86 pass
>> +# ===========================================================================
>> +#
>> +# 1. Separate relocations from vmlinux into vmlinux.relocs.
>> +# 2. Strip relocations from vmlinux.
>> +
>> +PHONY := __archpost
>> +__archpost:
>> +
>> +-include include/config/auto.conf
>> +include scripts/Kbuild.include
>> +
>> +CMD_RELOCS = arch/x86/tools/relocs
>> +quiet_cmd_relocs = RELOCS  $@...locs
>> +      cmd_relocs = $(CMD_RELOCS) $@ > $@...locs;$(CMD_RELOCS) --abs-relocs $@
>> +
>> +quiet_cmd_strip_relocs = RSTRIP  $@
>> +      cmd_strip_relocs = objcopy --remove-relocations='*' $@
> 
> Just a small drive by comment, prefer $(OBJCOPY) over objcopy so that
> the user's choice of objcopy is respected (such as llvm-objcopy).

Ok.

> Unfortunately, llvm-objcopy does not appear to support
> '--remove-relocations'. We can certainly file a feature request for this
> upstream but is there a way to accomplish this in a different way? Or
> perhaps this could be something that is controlled via Kconfig so it
> is only selectable with GNU objcopy??

An alternative is to use use --remove-section='.rel*' which has the same
effect.. or to be more careful, something as:
--remove-section='.rel.*' --remove-section='.rel__*' --remove-section='.rela.*' --remove-section='.rela__*'

Thanks,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ