Page MenuHomeFreeBSD

Fix incorrect reading of 32-bit modinfo on 64-bit loaders.
ClosedPublic

Authored by grehan on Nov 7 2014, 5:19 AM.
Tags
None
Referenced Files
F105778452: D1129.diff
Fri, Dec 20, 1:49 PM
Unknown Object (File)
Tue, Dec 3, 1:19 PM
Unknown Object (File)
Mon, Nov 25, 4:50 PM
Unknown Object (File)
Oct 27 2024, 8:53 AM
Unknown Object (File)
Oct 23 2024, 9:16 PM
Unknown Object (File)
Sep 23 2024, 3:32 PM
Unknown Object (File)
Sep 23 2024, 3:32 PM
Unknown Object (File)
Sep 23 2024, 3:32 PM
Subscribers
None

Details

Summary

The various structures in the mod_metadata set of a FreeBSD
kernel and modules contain pointers. The FreeBSD loader
correctly deals with a mismatch in loader build and
kernel (e.g. 32-bit i386/ppc loader, loading 64-bit amd64/ppc64
kernels), but wasn't dealing with the inverse case where a
64-bit loader was loading a 32-bit kernel.

This manifested itself as a 32-bit bhyve guest with ZFS root
not being able to load the zfs kernel module or determine
the dependency on opensolaris.ko.

Currently, the code is only built for and amd64 loader. However,
it would be simple to add other architectures should they need
this feature by adding to the conditional compilation guards.

Test Plan
  • Boot an i386 kernel under bhyve, and issue an 'lsmod' command.

Prior to this change, garbage would be printed, but it should now
be correct.

  • Install and boot an i386 ZFS-on-root guest under bhyve.
  • Verify that amd64 kernels and modules still function as before.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

grehan retitled this revision from to Fix incorrect reading of 32-bit modinfo on 64-bit loaders..
grehan updated this object.
grehan edited the test plan for this revision. (Show Details)
grehan added reviewers: jhb, neel.

10.0/i386 kernel bhyve guest kernel at the bhyveload prompt, before the change:

OK lsmod
0x400000: /boot/kernel/kernel (elf kernel, 0x1276c0c)
 modules: .4 .3 g?raid.1000510 g?raid.1 g_raid.0 PART.0 .5 .1 m?ibus.1 miibus.1 _?stop_set_modme.1 U??V??
                       ?E?D?E
                             ?D$??4$? ?????tǀ?.1

Same kernel, after the change:

OK lsmod
0x400000: /boot/kernel/kernel (elf kernel, 0x1276c0c)
modules: x86bios.1 elink.1 virtio_scsi.1 virtio_balloon.1 virtio_blk.1 vtnet.1 virtio_pci.1 virtio.1 nehemiah.1 random_rdrand.1 io.1 hptrr.1 hptnr.1 hpt27xx.1  ufs.1 kernel_mac_support.4 krpc.1 nfslockd.1 nfssvc.1 nfslock.1 wlan_sta.1 wlan_ratectl_none.1 wlan.1 wlan_wep.1 wlan_tkip.1 wlan_ccmp.1 wlan_amrr.1 zlib.1 if_vlan.3 if_tun.1 if_gif.1 if_faith.1 ether.1 sysvshm.1 sysvsem.1 sysvmsg.1 firmware.1 acl_posix1e.1 acl_nfs4.1 kernel.1000510 cd9660.1 isa.1 geom_raid.0 g_part.0 pseudofs.1 procfs.1 nfsd.1 nfscl.1 nfs.1 nfscommon.1 msdosfs.1 wpi.1 usb_quirk.1 ukbd.1 uhub.1 usb.1 usb_linux.1 umass.1 midi.1 sound.5 snd_hda.1 snd_via8233.1 snd_ich.1 snd_es137x.1 snd_emu10kx_midi.1 snd_emu10kx_pcm.1 snd_emu10kx.1 snd_csapcm.1 snd_csa.1 snd_cmi.1 siis.1 sdhci.1 yarrow.1 random.1 dummy.1 ppbus.1 pci.1 pccard.1 null.1 mwl.1 mvs.1 mpt_user.1 mpt_raid.1 mpt.1 mpt_cam.1 mpt_core.1 mii_bitbang.1 miibus.1 mfi.1 mem.1 malo.1 iwn.1 iwi.1 isp.1 ipw.1 splash.1 exca.1 cardbus.1 bt.1 if_ath.1 ath_pci.1 ata_via.1 ata_sis.1 ata_sii.1 ata_serverworks.1 ata_promise.1 ata_nvidia.1 ata_netcell.1 ata_national.1 ata_micron.1 ata_marvell.1 ata_jmicron.1 ata_ite.1 ata_intel.1 ata_highpoint.1 ata_cyrix.1 ata_cypress.1 ata_cenatek.1 ata_ati.1 ata_amd.1 ata_adaptec.1 ata_ali.1 ata_acard.1 ata_ahci.1 atapci.1 ata.1 ahc.1 ahd.1 ahd_pci.1 ahc_pci.1 ahc_isa.1 ahc_eisa.1 ahci.1 agp.1 acpi_pci.1 acpi.1 cam.1

'''

neel edited edge metadata.

Apologies for the delay. Looks good to me.

This revision is now accepted and ready to land.Nov 10 2014, 10:37 PM
jhb edited edge metadata.
grehan updated this revision to Diff 2366.

Closed by commit rS274407 (authored by @grehan).