2007-05-22 21:53:33

by Andrew Morton

[permalink] [raw]
Subject: section mismatches


So I bravely did an i386 allmodconfig build on the current -mm lineup:

WARNING: vmlinux(.text+0xc010116f): Section mismatch: reference to .init.text:start_kernel (between 'is386' and 'check_x87')
WARNING: vmlinux(.text+0xc02f7af7): Section mismatch: reference to .init.text: (between 'rest_init' and 'alloc_node_mem_map')
WARNING: vmlinux(.text+0xc02fe08d): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
WARNING: vmlinux(.text+0xc02fe099): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
WARNING: vmlinux(.text+0xc02fe0a5): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
WARNING: vmlinux(.text+0xc02fe0b1): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
WARNING: vmlinux(.text+0xc02f7b83): Section mismatch: reference to .init.text:__alloc_bootmem_node (between 'alloc_node_mem_map' and 'zone_wait_table_init')
WARNING: vmlinux(.text+0xc02f7c53): Section mismatch: reference to .init.text:__alloc_bootmem_node (between 'zone_wait_table_init' and 'schedule')
WARNING: vmlinux(.text+0xc021dcc8): Section mismatch: reference to .init.text:__alloc_bootmem (between 'vgacon_startup' and 'vgacon_scrolldelta')
WARNING: vmlinux(.text+0xc02fe738): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
WARNING: vmlinux(.text+0xc02fe884): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
WARNING: vmlinux(.data+0xc0439099): Section mismatch: reference to .init.text:xen_start_kernel (between 'startup_xen' and 'boot_gdt_descr')

Could the people who write these bugs, please, like, fix them?

It's not trivial noise. These things lead to kernel crashes.


2007-05-22 23:15:47

by Jeremy Fitzhardinge

[permalink] [raw]
Subject: Re: section mismatches

Andrew Morton wrote:
> WARNING: vmlinux(.text+0xc02fe884): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
> WARNING: vmlinux(.data+0xc0439099): Section mismatch: reference to .init.text:xen_start_kernel (between 'startup_xen' and 'boot_gdt_descr')
>

This is safe, but I'll clean it up. I'll also have a look at iret_exc,
some of which might be Xen-related. Actually, iret_exc is in the fixup
section, but it gets used from several places, so it might be worth just
making it .text.

J

2007-05-23 00:13:26

by Chris Wright

[permalink] [raw]
Subject: Re: section mismatches

* Jeremy Fitzhardinge ([email protected]) wrote:
> Andrew Morton wrote:
> > WARNING: vmlinux(.text+0xc02fe884): Section mismatch: reference to .init.text: (between 'iret_exc' and '_etext')
> > WARNING: vmlinux(.data+0xc0439099): Section mismatch: reference to .init.text:xen_start_kernel (between 'startup_xen' and 'boot_gdt_descr')
> >
>
> This is safe, but I'll clean it up. I'll also have a look at iret_exc,
> some of which might be Xen-related. Actually, iret_exc is in the fixup
> section, but it gets used from several places, so it might be worth just
> making it .text.

I tracked down a bunch of these a little while back. It's not really
iret_exc, but since there is no _sfixup/_efixup markers iret_exc is the
closest symbol to pick on. All the [iret_exc, _etext] warnings I found
were completely harmless from things that used, for example, mfn_to_pfn
in an __init function (which sucks in a fixup via __get_user).

2007-05-23 06:55:25

by Chris Wright

[permalink] [raw]
Subject: Re: section mismatches

* Chris Wright ([email protected]) wrote:
> I tracked down a bunch of these a little while back. It's not really
> iret_exc, but since there is no _sfixup/_efixup markers iret_exc is the
> closest symbol to pick on. All the [iret_exc, _etext] warnings I found
> were completely harmless from things that used, for example, mfn_to_pfn
> in an __init function (which sucks in a fixup via __get_user).

Took a moment to check current -mm allmodconfig as Andrew did.

$ make ARCH=i386 O=obj-mod allmodconfig
$ make -j8 ARCH=i386 O=obj-mod > obj-mod/build.out 2>&1
$ objdump -dr -j.text obj-mod/vmlinux > obj-mod/objdump.out
$ grep iret_exc obj-mod/build.out | sed 's/.*(at offset 0x\(.*\)).*/\1/' | while read addr; do grep -B1 $addr obj-mod/objdump.out; done
c0306935: e9 41 7e 19 00 jmp c049e77b <romsignature+0x1f>
c0306936: R_386_PC32 .init.text
c0306941: e9 83 7e 19 00 jmp c049e7c9 <romchecksum+0x34>
c0306942: R_386_PC32 .init.text
c030694d: e9 8e 85 19 00 jmp c049eee0 <request_standard_resources+0x82>
c030694e: R_386_PC32 .init.text
c0306959: e9 93 86 19 00 jmp c049eff1 <request_standard_resources+0x193>
c030695a: R_386_PC32 .init.text
c0306fd4: e9 bc c6 1a 00 jmp c04b3695 <xenbus_probe_init+0x69>
c0306fd5: R_386_PC32 .init.text
c0307120: e9 2c f3 1a 00 jmp c04b6451 <pci_pcbios_init+0x33>
c0307121: R_386_PC32 .init.text

Each of these is indeed from __get_user called from an __init function.

- romsignature calls __get_user via probe_kernel_address
- romchecksum calls __get_user via probe_kernel_address
- request_standard_resources inlines probe_roms which
twice calls __get_user via probe_kernel_address
- xenbus_probe_init calls __get_user via mfn_to_pfn
- pci_pcbios_init calls __get_user via probe_kernel_address

We could simply hush it up, by forcing that call to be out of line from
the __init function. That's not really robust, since each callsite needs
attention (meaning new ones will sneak in over time). Or fix the linker
script (and possibly modpost.c).