Skip to contentSkip to conversation

dmi_scan_machine uses uninitialized address on x86 / EFI

BUG Thomas Jourdan 3 participants 7 messages Feb 23, 2009 – Feb 25, 2009 x86

lore
Share & tools
lore
#0 lore raw

Hi

On x86/EFI platforms, if efi_enabled is true, the dmi_scan_machine function fails, even if valid DMI table is present. In the setup_arch function, efi_init is called after dmi_scan_machine. But this is efi_init which will initialize the smbios address, needed by dmi_scan_machine.

This leads to dmi_scan_machine ioremapping physical address 0, instead of the address provided by the EFI system table. The following patch fixes the problem.

Regards,
Thomas

On x86 / EFI platforms, the SMBIOS table address is available in the EFI system table. During the setup_arch function, the dmi_scan_machine function will detect valid DMI table or not.

If CONFIG_EFI is set, the dmi_scan_table function will use the address provided by the EFI system table. But it is inialized later, in the efi_init function.

This patch fixes the call order.

arch/x86/kernel/setup.c +3 -3
@@ -903,6 +903,9 @@
 
 	finish_e820_parsing();
 
+	if (efi_enabled)
+		efi_init();
+
 	dmi_scan_machine();
 
 	dmi_check_system(bad_bios_dmi_table);
@@ -916,9 +919,6 @@
 	insert_resource(&iomem_resource, &data_resource);
 	insert_resource(&iomem_resource, &bss_resource);
 
-	if (efi_enabled)
-		efi_init();
-
 #ifdef CONFIG_X86_32
 	if (ppro_with_ram_bug()) {
 		e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM,
#1 lore raw
Quoted 10 lines · Thomas Jourdan

On x86/EFI platforms, if efi_enabled is true, the dmi_scan_machine function fails, even if valid DMI table is present. In the setup_arch function, efi_init is called after dmi_scan_machine. But this is efi_init which will initialize the smbios address, needed by dmi_scan_machine.

This leads to dmi_scan_machine ioremapping physical address 0, instead of the address provided by the EFI system table. The following patch fixes the problem.

Hi Thomas,

What is the concrete manifestation of the bug (i.e. how critical is it?)
We are late in the 2.6.29-rc cycle, and this patch seems to have some
risk associated with it.

Huang, Peter, Yinghai: any opinions?

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#2 lore raw
Quoted 11 lines · H. Peter Anvin
Quoted 9 lines · Thomas Jourdan

On x86/EFI platforms, if efi_enabled is true, the dmi_scan_machine function fails, even if valid DMI table is present. In the setup_arch function, efi_init is called after dmi_scan_machine. But this is efi_init which will initialize the smbios address, needed by dmi_scan_machine.

This leads to dmi_scan_machine ioremapping physical address 0, instead of the address provided by the EFI system table. The following patch fixes the problem.

Quoted 8 lines

Hi Thomas,

What is the concrete manifestation of the bug (i.e. how critical is it?)
We are late in the 2.6.29-rc cycle, and this patch seems to have some
risk associated with it.

Huang, Peter, Yinghai: any opinions?

should be ok for 2.6.29

YH

#3 lore raw
Quoted 1 line · Yinghai Lu

should be ok for 2.6.29

Got a feel for what the impact of deferring it to .30 would be?

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#4 lore raw
Quoted 5 lines · H. Peter Anvin
Quoted 1 line · Yinghai Lu

should be ok for 2.6.29

Got a feel for what the impact of deferring it to .30 would be?

Not sure, wonder if someone try 2.6.29-rc6 on EFI 32/64 sytem...

YH

#5 lore raw
In reply to H. Peter Anvin

Hi guys

The bug is not critical. Vanilla kernel works fine without the patch, except for the DMI sysfs stuffs.

Without the patch, if CONFIG_DMI is enabled, I got the "DMI not present or invalid." error message on boot. Then later, if CONFIG_DMIID is enabled, DMI system identification informations won't be exported via sysfs to userspace. The /sys/class/dmi/id entry is not present.

Regards,
Thomas

-----Message d'origine-----
De : H. Peter Anvin [mailto:[email protected]]
Envoyé : mar. 24 février 2009 22:12
À : Thomas Jourdan
Cc : [email protected]; Huang Ying; Peter Jones; Yinghai Lu Objet : Re: [BUG] dmi_scan_machine uses uninitialized address on x86 / EFI

Quoted 10 lines · Thomas Jourdan

On x86/EFI platforms, if efi_enabled is true, the dmi_scan_machine function fails, even if valid DMI table is present. In the setup_arch function, efi_init is called after dmi_scan_machine. But this is efi_init which will initialize the smbios address, needed by dmi_scan_machine.

This leads to dmi_scan_machine ioremapping physical address 0, instead of the address provided by the EFI system table. The following patch fixes the problem.

Hi Thomas,

What is the concrete manifestation of the bug (i.e. how critical is it?)
We are late in the 2.6.29-rc cycle, and this patch seems to have some
risk associated with it.

Huang, Peter, Yinghai: any opinions?

-hpa

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


__________ Information NOD32 3887 (20090224) __________

Ce message a ete verifie par NOD32 Antivirus System.
http://www.nod32.com
#6 lore raw
In reply to Thomas Jourdan
Quoted 11 lines · Thomas Jourdan

Hi

On x86/EFI platforms, if efi_enabled is true, the dmi_scan_machine function fails, even if valid DMI table is present. In the setup_arch function, efi_init is called after dmi_scan_machine. But this is efi_init which will initialize the smbios address, needed by dmi_scan_machine.

This leads to dmi_scan_machine ioremapping physical address 0, instead of the address provided by the EFI system table. The following patch fixes the problem.

Hi Thomas,

Could you please resend both this patch and the phys_efi_get_time patch with a Signed-off-by: line so I can apply them?

Thanks,

-hpa