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]
Message-ID: <20181126211835.wdqiqszz6u65cbe3@gmail.com>
Date:   Mon, 26 Nov 2018 11:18:35 -1000
From:   Joey Pabalinas <joeypabalinas@...il.com>
To:     David CARLIER <devnexen@...il.com>
Cc:     joeypabalinas@...il.com, linux-kernel@...r.kernel.org,
        alexander.shishkin@...ux.intel.com, gregkh@...uxfoundation.org,
        andriy.shevchenko@...ux.intel.com, aryabinin@...tuozzo.com
Subject: Re: Re: [PATCH] Little memset_explicit optimisation

On Mon, Nov 26, 2018 at 07:36:19PM +0000, David CARLIER wrote:
> Sorry I m not used yet at all to LKML rules.
> 
> So here a slight difference in assembly generated between the two
> versions (amd64) :
> `
>      .loc 1 7 7
>      leaq    -12(%rbp), %rax
>      movq    %rax, -8(%rbp)
> -    .loc 1 11 2
> +    .loc 1 9 6
>      movq    -8(%rbp), %rax
>      movl    $4, %edx
>      movl    $0, %esi
>      movq    %rax, %rdi
>      call    memset@PLT
> +    movq    %rax, -8(%rbp)
>      .loc 1 13 23
>      movq    -8(%rbp), %rax
>      movl    (%rax), %eax

What is the advantage of having the added `movq %rax, -8(%rbp)` here?

The next instruction is `movq -8(%rbp), %rax` and nothing afterwords
uses the value stored in `-8(%rbp)`.

Also, is this compiled without optimization? Take a looks at the
assembly in a small test case with -O1 (making sure to use the target
variable so it isn't optimized out) and compare the assembly generated
with and without that assignment.

-- 
Cheers,
Joey Pabalinas

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ