From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1947773AbdEZLag (ORCPT ); Fri, 26 May 2017 07:30:36 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34030 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1947742AbdEZL3F (ORCPT ); Fri, 26 May 2017 07:29:05 -0400 Subject: Re: [PATCH 7/7] DWARF: add the config option From: Jiri Slaby To: Josh Poimboeuf , "H. Peter Anvin" Cc: linux-kernel@vger.kernel.org, Andrew Morton , live-patching@vger.kernel.org, Thomas Gleixner , Ingo Molnar , the arch/x86 maintainers , Andy Lutomirski , Jiri Kosina , Linus Torvalds References: <20170505122200.31436-1-jslaby@suse.cz> <20170505122200.31436-7-jslaby@suse.cz> <20170507165524.cdxfuwbd5alr7v6k@treble> <20170519205354.caeyqri2k6gvso3w@treble> <8dbbb971-fc41-fba2-f356-931a7eabe6ef@zytor.com> <20170519212913.otir6mlujoxoy3ha@treble> <20170519213556.pv5kxocfprfkloay@treble> Message-ID: Date: Fri, 26 May 2017 13:29:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/26/2017, 08:54 AM, Jiri Slaby wrote: > On 05/19/2017, 11:35 PM, Josh Poimboeuf wrote: >> https://github.com/jpoimboe/linux/blob/undwarf/arch/x86/kernel/unwind_undwarf.c > > JFYI, it crashes in sha1_transform_avx due to crypto changes. You > perhaps missed that this beast uses ebp (not rbp) register for > computations. I had to do: > > --- a/arch/x86/crypto/sha1_ssse3_asm.S > +++ b/arch/x86/crypto/sha1_ssse3_asm.S > @@ -37,7 +37,7 @@ > #define REG_A %ecx > #define REG_B %esi > #define REG_C %edi > -#define REG_D %ebp > +#define REG_D %r12d > #define REG_E %edx > > #define REG_T1 %eax > @@ -74,6 +74,7 @@ > SYM_FUNC_START(\name) > > push %rbx > + push %r12 > push %rbp > > mov %rsp, %rbp > @@ -99,6 +100,7 @@ > rep stosq > > leaveq # deallocate workspace > + pop %r12 > pop %rbx > ret > > > I am afraid there are more of these, e.g. in aesni-intel_asm.S. aesni-intel_asm.S is OK -- only untouched x86_32 part uses ebp. But sha1_avx2_x86_64_asm.S is not. They use *all* usable registers including ebp in the computations hidden behind the SHA1_PIPELINED_MAIN_BODY macro. The only work around I can see is to push rbp/pop rbp around the computation as it used to do with rbx: --- a/arch/x86/crypto/sha1_avx2_x86_64_asm.S +++ b/arch/x86/crypto/sha1_avx2_x86_64_asm.S @@ -636,6 +636,7 @@ _loop3: /* Align stack */ mov %rsp, %rbp and $~(0x20-1), %rsp + push %rbp sub $RESERVE_STACK, %rsp avx2_zeroupper @@ -661,6 +662,7 @@ _loop3: avx2_zeroupper add $RESERVE_STACK, %rsp + pop %rbp leaveq pop %r15 regards, -- js suse labs