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:   Tue, 12 Feb 2019 08:23:37 +0100
From:   Ard Biesheuvel <ard.biesheuvel@...aro.org>
To:     Masahiro Yamada <yamada.masahiro@...ionext.com>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...hat.com>,
        linux-efi <linux-efi@...r.kernel.org>,
        Kees Cook <keescook@...omium.org>,
        Alistair Strachan <astrachan@...gle.com>,
        Laura Abbott <labbott@...hat.com>,
        Will Deacon <will.deacon@....com>,
        Ingo Molnar <mingo@...nel.org>,
        Nathan Chancellor <natechancellor@...il.com>
Subject: Re: [PATCH] efi/libstub: refactor cmd_stubcopy

On Tue, 12 Feb 2019 at 04:45, Masahiro Yamada
<yamada.masahiro@...ionext.com> wrote:
>
> It took me a while to understand what is going on in the nested
> if-blocks.
>
> Simplify it by removing unneeded code.
>
>   - if_changed automatically adds 'set -e', so any failure in the
>     series of commands makes it immediately fail as a whole.
>     So, the outer if block is entirely redundant.
>
>   - Since commit 9c2af1c7377a ("kbuild: add .DELETE_ON_ERROR special
>     target"), GNU Make automatically deletes the target on any failure
>     in its recipe. The explicit 'rm -f $@' is redundant.
>
>   - surrounding commands with ( ) will spawn a subshell to execute them
>     in it, but it is rarely useful to do so.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@...ionext.com>

Assuming that it still works as expected:

Acked-by: Ard Biesheuvel <ard.biesheuvel@...aro.org>

You can test this by adding a statically initialized global function
pointer to any of the libstub source files that get built for ARM.

Thanks!

> ---
>
>  drivers/firmware/efi/libstub/Makefile | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
> index d984509..7788e8a 100644
> --- a/drivers/firmware/efi/libstub/Makefile
> +++ b/drivers/firmware/efi/libstub/Makefile
> @@ -86,12 +86,13 @@ $(obj)/%.stub.o: $(obj)/%.o FORCE
>  # this time, use objcopy and leave all sections in place.
>  #
>  quiet_cmd_stubcopy = STUBCPY $@
> -      cmd_stubcopy = if $(STRIP) --strip-debug $(STUBCOPY_RM-y) -o $@ $<; \
> -                    then if $(OBJDUMP) -r $@ | grep $(STUBCOPY_RELOC-y); \
> -                    then (echo >&2 "$@: absolute symbol references not allowed in the EFI stub"; \
> -                          rm -f $@; /bin/false);                         \
> -                    else $(OBJCOPY) $(STUBCOPY_FLAGS-y) $< $@; fi        \
> -                    else /bin/false; fi
> +      cmd_stubcopy =                                                   \
> +       $(STRIP) --strip-debug $(STUBCOPY_RM-y) -o $@ $<;               \
> +       if $(OBJDUMP) -r $@ | grep $(STUBCOPY_RELOC-y); then            \
> +               echo "$@: absolute symbol references not allowed in the EFI stub" >&2; \
> +               /bin/false;                                             \
> +       fi;                                                             \
> +       $(OBJCOPY) $(STUBCOPY_FLAGS-y) $< $@
>
>  #
>  # ARM discards the .data section because it disallows r/w data in the
> --
> 2.7.4
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ