2010-12-17 02:42:11

by Shaohua Li

[permalink] [raw]
Subject: [BUG]x86: relocatable doesn't work with new binutils

Hi,
The CONFIG_RELOCATABLE is broken with new binutils, which will make boot
panic. According to Lu Hongjiu, the affected binutils are from
2.20.51.0.12 to 2.21.51.0.3, which are release since Oct 22 this year.
At least ubuntu 10.10 is using such binutils. see:
http://sourceware.org/bugzilla/show_bug.cgi?id=12327
The reason of boot panic is we have 'jiffies = jiffies_64;' in
vmlinux.lds.S. The jiffies isn't in any section. In kernel build, there
is warning saying jiffies is an absolute address and can't be
relocatable. At runtime, jiffies will have virtual address 0.
We can easily workaround this issue by moving jiffies to a section or at
least warn people if such binutils are using. what should we do?

Thanks,
Shaohua


2010-12-17 03:01:12

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [BUG]x86: relocatable doesn't work with new binutils

On 12/16/2010 06:42 PM, Shaohua Li wrote:
> We can easily workaround this issue by moving jiffies to a section or at
> least warn people if such binutils are using. what should we do?

I think we should do the workaround, but still get distros to update the
broken binutils.

-hpa


--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

2010-12-17 03:21:58

by Shaohua Li

[permalink] [raw]
Subject: Re: [BUG]x86: relocatable doesn't work with new binutils

On Fri, 2010-12-17 at 10:59 +0800, H. Peter Anvin wrote:
> On 12/16/2010 06:42 PM, Shaohua Li wrote:
> > We can easily workaround this issue by moving jiffies to a section or at
> > least warn people if such binutils are using. what should we do?
>
> I think we should do the workaround, but still get distros to update the
> broken binutils.
Here is my workaround.
The problem is a lot of kernel versions are affected by this, fix all?



The CONFIG_RELOCATABLE is broken with new binutils, which will make boot
panic. According to Lu Hongjiu, the affected binutils are from
2.20.51.0.12 to 2.21.51.0.3, which are release since Oct 22 this year.
At least ubuntu 10.10 is using such binutils. see:
http://sourceware.org/bugzilla/show_bug.cgi?id=12327
The reason of boot panic is we have 'jiffies = jiffies_64;' in
vmlinux.lds.S. The jiffies isn't in any section. In kernel build, there
is warning saying jiffies is an absolute address and can't be
relocatable. At runtime, jiffies will have virtual address 0.

Signed-off-by: Shaohua Li<[email protected]>

---
arch/x86/kernel/vmlinux.lds.S | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Index: linux/arch/x86/kernel/vmlinux.lds.S
===================================================================
--- linux.orig/arch/x86/kernel/vmlinux.lds.S 2010-12-16 09:18:05.000000000 +0800
+++ linux/arch/x86/kernel/vmlinux.lds.S 2010-12-17 11:13:14.000000000 +0800
@@ -34,11 +34,9 @@ OUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT, CONF
#ifdef CONFIG_X86_32
OUTPUT_ARCH(i386)
ENTRY(phys_startup_32)
-jiffies = jiffies_64;
#else
OUTPUT_ARCH(i386:x86-64)
ENTRY(phys_startup_64)
-jiffies_64 = jiffies;
#endif

#if defined(CONFIG_X86_64) && defined(CONFIG_DEBUG_RODATA)
@@ -138,6 +136,11 @@ SECTIONS
CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)

DATA_DATA
+#ifdef CONFIG_X86_32
+ jiffies = jiffies_64;
+#else
+ jiffies_64 = jiffies;
+#endif
CONSTRUCTORS

/* rarely changed data like cpu maps */

2010-12-17 03:25:22

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [BUG]x86: relocatable doesn't work with new binutils

On 12/16/2010 07:21 PM, Shaohua Li wrote:
> On Fri, 2010-12-17 at 10:59 +0800, H. Peter Anvin wrote:
>> On 12/16/2010 06:42 PM, Shaohua Li wrote:
>>> We can easily workaround this issue by moving jiffies to a section or at
>>> least warn people if such binutils are using. what should we do?
>>
>> I think we should do the workaround, but still get distros to update the
>> broken binutils.
> Here is my workaround.
> The problem is a lot of kernel versions are affected by this, fix all?

I suspect the stable kernels should be able to take the patch easily enough.

-hpa


--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

2010-12-17 04:54:42

by Lu, Hongjiu

[permalink] [raw]
Subject: RE: [BUG]x86: relocatable doesn't work with new binutils

I just released the Linux binutils 2.21.51.0.4:

http://gcc.gnu.org/ml/gcc/2010-12/msg00397.html


H.J.


> -----Original Message-----
> From: H. Peter Anvin [mailto:[email protected]]
> Sent: Thursday, December 16, 2010 7:25 PM
> To: Li, Shaohua
> Cc: lkml; Andrew Morton; Lu, Hongjiu; Huang, Ying
> Subject: Re: [BUG]x86: relocatable doesn't work with new binutils
>
> On 12/16/2010 07:21 PM, Shaohua Li wrote:
> > On Fri, 2010-12-17 at 10:59 +0800, H. Peter Anvin wrote:
> >> On 12/16/2010 06:42 PM, Shaohua Li wrote:
> >>> We can easily workaround this issue by moving jiffies to a section
> or at
> >>> least warn people if such binutils are using. what should we do?
> >>
> >> I think we should do the workaround, but still get distros to
> update the
> >> broken binutils.
> > Here is my workaround.
> > The problem is a lot of kernel versions are affected by this, fix
> all?
>
> I suspect the stable kernels should be able to take the patch easily
> enough.
>
> -hpa
>
>
> --
> H. Peter Anvin, Intel Open Source Technology Center
> I work for Intel. I don't speak on their behalf.

????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2010-12-17 10:06:12

by Cong Wang

[permalink] [raw]
Subject: Re: [BUG]x86: relocatable doesn't work with new binutils

On Fri, Dec 17, 2010 at 11:21:54AM +0800, Shaohua Li wrote:
>On Fri, 2010-12-17 at 10:59 +0800, H. Peter Anvin wrote:
>> On 12/16/2010 06:42 PM, Shaohua Li wrote:
>> > We can easily workaround this issue by moving jiffies to a section or at
>> > least warn people if such binutils are using. what should we do?
>>
>> I think we should do the workaround, but still get distros to update the
>> broken binutils.
>Here is my workaround.
>The problem is a lot of kernel versions are affected by this, fix all?
>
>
>
>The CONFIG_RELOCATABLE is broken with new binutils, which will make boot
>panic. According to Lu Hongjiu, the affected binutils are from
>2.20.51.0.12 to 2.21.51.0.3, which are release since Oct 22 this year.
>At least ubuntu 10.10 is using such binutils. see:
>http://sourceware.org/bugzilla/show_bug.cgi?id=12327
>The reason of boot panic is we have 'jiffies = jiffies_64;' in
>vmlinux.lds.S. The jiffies isn't in any section. In kernel build, there
>is warning saying jiffies is an absolute address and can't be
>relocatable. At runtime, jiffies will have virtual address 0.
>

Just curious, what change in binutils caused this? And what build
warning did you see? Section mismatch warning?

Thanks.

2010-12-17 14:06:33

by Shaohua Li

[permalink] [raw]
Subject: Re: [BUG]x86: relocatable doesn't work with new binutils

On Fri, 2010-12-17 at 18:05 +0800, Américo Wang wrote:
> On Fri, Dec 17, 2010 at 11:21:54AM +0800, Shaohua Li wrote:
> >On Fri, 2010-12-17 at 10:59 +0800, H. Peter Anvin wrote:
> >> On 12/16/2010 06:42 PM, Shaohua Li wrote:
> >> > We can easily workaround this issue by moving jiffies to a section or at
> >> > least warn people if such binutils are using. what should we do?
> >>
> >> I think we should do the workaround, but still get distros to update the
> >> broken binutils.
> >Here is my workaround.
> >The problem is a lot of kernel versions are affected by this, fix all?
> >
> >
> >
> >The CONFIG_RELOCATABLE is broken with new binutils, which will make boot
> >panic. According to Lu Hongjiu, the affected binutils are from
> >2.20.51.0.12 to 2.21.51.0.3, which are release since Oct 22 this year.
> >At least ubuntu 10.10 is using such binutils. see:
> >http://sourceware.org/bugzilla/show_bug.cgi?id=12327
> >The reason of boot panic is we have 'jiffies = jiffies_64;' in
> >vmlinux.lds.S. The jiffies isn't in any section. In kernel build, there
> >is warning saying jiffies is an absolute address and can't be
> >relocatable. At runtime, jiffies will have virtual address 0.
> >
>
> Just curious, what change in binutils caused this?
I'm not familiar with binutils, please check the bugzilla.

> And what build
> warning did you see? Section mismatch warning?
Something like this: WARNING: Absolute relocations present

Thanks,
Shaohua