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: <CALCETrXctXAp5hZWCj632hGt_EhXzh0KupD=GFrz7BHWDY80RA@mail.gmail.com>
Date:	Fri, 6 Mar 2015 13:05:05 -0800
From:	Andy Lutomirski <luto@...capital.net>
To:	Denys Vlasenko <dvlasenk@...hat.com>
Cc:	"H. Peter Anvin" <hpa@...ux.intel.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Ingo Molnar <mingo@...nel.org>, Borislav Petkov <bp@...en8.de>,
	"H. Peter Anvin" <hpa@...or.com>, Oleg Nesterov <oleg@...hat.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Will Drewry <wad@...omium.org>,
	Kees Cook <keescook@...omium.org>, X86 ML <x86@...nel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86: clean up unnecessarily wide TEST insns

On Fri, Mar 6, 2015 at 12:55 PM, Denys Vlasenko <dvlasenk@...hat.com> wrote:
> By the nature of TEST operation, it is often possible
> to test a narrower part of the operand:
>     "testl $3, mem"  -> "testb $3, mem",
>     "testq $3, %rcx" -> "testb $3, %cl"
> This results in shorter insns, because TEST insn has no
> sign-entending byte-immediate forms unlike other ALU ops.
>
> Signed-off-by: Denys Vlasenko <dvlasenk@...hat.com>
> CC: Linus Torvalds <torvalds@...ux-foundation.org>
> CC: Steven Rostedt <rostedt@...dmis.org>
> CC: Ingo Molnar <mingo@...nel.org>
> CC: Borislav Petkov <bp@...en8.de>
> CC: "H. Peter Anvin" <hpa@...or.com>
> CC: Andy Lutomirski <luto@...capital.net>
> CC: Oleg Nesterov <oleg@...hat.com>
> CC: Frederic Weisbecker <fweisbec@...il.com>
> CC: Will Drewry <wad@...omium.org>
> CC: Kees Cook <keescook@...omium.org>
> CC: x86@...nel.org
> CC: linux-kernel@...r.kernel.org
> ---
>
> Code changes in assembly are:
>
>     -48 f7 07 01 00 00 00       testq  $0x1,(%rdi)
>     +f6 07 01                   testb  $0x1,(%rdi)
>     -48 f7 c1 01 00 00 00       test   $0x1,%rcx
>     +f6 c1 01                   test   $0x1,%cl
>     -48 f7 c1 02 00 00 00       test   $0x2,%rcx
>     +f6 c1 02                   test   $0x2,%cl
>     -41 f7 c2 01 00 00 00       test   $0x1,%r10d
>     +41 f6 c2 01                test   $0x1,%r10b
>     -48 f7 c1 04 00 00 00       test   $0x4,%rcx
>     +f6 c1 04                   test   $0x4,%cl
>     -48 f7 c1 08 00 00 00       test   $0x8,%rcx
>     +f6 c1 08                   test   $0x8,%cl
>
>  arch/x86/kernel/head_64.S            |  2 +-
>  arch/x86/kernel/relocate_kernel_32.S |  8 ++++----
>  arch/x86/kernel/relocate_kernel_64.S |  8 ++++----
>  arch/x86/lib/checksum_32.S           |  4 ++--
>  arch/x86/lib/csum-copy_64.S          |  2 +-

Looks good to me.  Ingo, should I queue this up?

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ