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: <9bc00fb4-379a-e19b-4d27-32fff8f9781b@c-s.fr>
Date:   Mon, 8 Jul 2019 10:58:22 +0200
From:   Christophe Leroy <christophe.leroy@....fr>
To:     Michael Ellerman <mpe@...erman.id.au>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Paul Mackerras <paulus@...ba.org>
Cc:     linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
        Ulirch Weigand <Ulrich.Weigand@...ibm.com>
Subject: Re: [PATCH v3 3/3] powerpc/module64: Use symbolic instructions names.



Le 08/07/2019 à 02:56, Michael Ellerman a écrit :
> Christophe Leroy <christophe.leroy@....fr> writes:
>> To increase readability/maintainability, replace hard coded
>> instructions values by symbolic names.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@....fr>
>> ---
>> v3: fixed warning by adding () in an 'if' around X | Y (unlike said in v2 history, this change was forgotten in v2)
>> v2: rearranged comments
>>
>>   arch/powerpc/kernel/module_64.c | 53 +++++++++++++++++++++++++++--------------
>>   1 file changed, 35 insertions(+), 18 deletions(-)
>>
>> diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
>> index c2e1b06253b8..b33a5d5e2d35 100644
>> --- a/arch/powerpc/kernel/module_64.c
>> +++ b/arch/powerpc/kernel/module_64.c
>> @@ -704,18 +711,21 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
> ...
>>   			/*
>>   			 * If found, replace it with:
>>   			 *	addis r2, r12, (.TOC.-func)@ha
>>   			 *	addi r2, r12, (.TOC.-func)@l
>>   			 */
>> -			((uint32_t *)location)[0] = 0x3c4c0000 + PPC_HA(value);
>> -			((uint32_t *)location)[1] = 0x38420000 + PPC_LO(value);
>> +			((uint32_t *)location)[0] = PPC_INST_ADDIS | __PPC_RT(R2) |
>> +						    __PPC_RA(R12) | PPC_HA(value);
>> +			((uint32_t *)location)[1] = PPC_INST_ADDI | __PPC_RT(R2) |
>> +						    __PPC_RA(R12) | PPC_LO(value);
>>   			break;
> 
> This was crashing and it's amazing how long you can stare at a
> disassembly and not see the difference between `r2` and `r12` :)

Argh, yes. I was misleaded by the comment I guess. Sorry for that and 
thanks for fixing.

Christophe

> 
> Fixed now.
> 
> cheers
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ