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]
Date:   Thu, 18 Feb 2021 22:08:58 +1100
From:   Michael Ellerman <mpe@...erman.id.au>
To:     Feng Tang <feng.tang@...el.com>
Cc:     Christophe Leroy <christophe.leroy@...roup.eu>,
        lkp <lkp@...el.com>,
        "kbuild-all@...ts.01.org" <kbuild-all@...ts.01.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Segher Boessenkool <segher@...nel.crashing.org>
Subject: Re: {standard input}:577: Error: unsupported relocation against base

Feng Tang <feng.tang@...el.com> writes:
> Hi Michael,
>
> On Tue, Feb 16, 2021 at 08:36:02PM +1100, Michael Ellerman wrote:
>> Feng Tang <feng.tang@...el.com> writes:
>> > Hi Christophe and Michael,
>> >
>> > On Mon, Jan 18, 2021 at 10:24:08PM +0800, Christophe Leroy wrote:
>> >> 
>> >> Le 05/01/2021 ? 11:58, kernel test robot a 閏rit :
>> >> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> >> > head:   e71ba9452f0b5b2e8dc8aa5445198cd9214a6a62
>> >> > commit: 8b8319b181fd9d6821703fef1228b4dcde613a16 powerpc/44x: Don't support 440 when CONFIG_PPC_47x is set
>> >> 
>> >> I see no link with that commit. Looks like the problem has been existing for some time.
>> >> It exists on the commit before that one, it exists on v5.9 and it exists on v5.10 with that commit
>> >> reverted.
>> >  
>> > Yes, this seems to be a long-standing issue, and we just double checked
>> > this compile error. 
>> >
>> > It happend when compiling arch/powerpc/platforms/44x/fsp2.c, macro
>> > 'mfdcr' requirs an instant number as parameter, while is not met by
>> > show_plbopb_regs(). Changing show_plbopb_regs() from function to
>> > a macro fixes the error, as the patch below:
>> >
>> > Thanks,
>> > Feng
>> >
>> >
>> > From 3bcb9638afc873d0e803aea1aad4f77bf1c2f6f6 Mon Sep 17 00:00:00 2001
>> > From: Feng Tang <feng.tang@...el.com>
>> > Date: Fri, 5 Feb 2021 16:08:43 +0800
>> > Subject: [PATCH] powerpc/44x/fsp2: fix a compiling error regarding macro
>> >  'mdfcr'
>> >
>> > 0day's kbuild test found error:
>> >
>> > "
>> >   CC      arch/powerpc/platforms/44x/fsp2.o
>> >
>> >   {standard input}:577: Error: unsupported relocation against base
>> >   {standard input}:580: Error: unsupported relocation against base
>> >   {standard input}:583: Error: unsupported relocation against base
>> > "
>> >
>> > The reason is macro 'mfdcr' requirs an instant number as parameter,
>> > which is not met by show_plbopb_regs().
>> 
>> It doesn't require a constant, it checks if the argument is constant:
>
> Aha, seems my grep found the wrong target: arch/powerpc/boot/dcr.h,
> which has  
>
> #define mfdcr(rn) \
> 	({	\
> 		unsigned long rval; \
> 		asm volatile("mfdcr %0,%1" : "=r"(rval) : "i"(rn)); \
> 		rval; \
> 	})

Yeah, annoyingly we have several macros like that duplicated in
arch/powerpc/boot.

>> #define mfdcr(rn)						\
>> 	({unsigned int rval;					\
>> 	if (__builtin_constant_p(rn) && rn < 1024)		\
>> 		asm volatile("mfdcr %0," __stringify(rn)	\
>> 		              : "=r" (rval));			\
>> 	else if (likely(cpu_has_feature(CPU_FTR_INDEXED_DCR)))	\
>> 		rval = mfdcrx(rn);				\
>> 	else							\
>> 		rval = __mfdcr(rn);				\
>> 	rval;})
>> 
>> But the error you're seeing implies the compiler is choosing the first
>> leg of the if, even when rn == "base + x", which is surprising.
>
> Yes, it might be related to compiler (though myself isn't faimiliar
> with it). As show_plbopb_regs() was introduced by commit 7813043e1bbc
> ("powerpc/44x/fsp2: Add irq error handlers") back in 2017, while it
> was just reported.

It seems to be something in the config, I can only reproduce with the
config attached to the original report. I can't see any reason why the
config matters for this bug, but perhaps it's enabling something that's
confusing the compiler somehow.

Anyway I'll post a patch to change the asm so the bug goes away.

cheers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ