Re: [PATCH V3] iscsi_ibft: fix crash due to KASLR physical memory remapping

From: Christoph Hellwig
Date: Wed Aug 11 2021 - 02:59:18 EST


On Tue, Aug 10, 2021 at 01:55:11PM -0400, Konrad Rzeszutek Wilk wrote:
> On Tue, Aug 10, 2021 at 06:00:24PM +0100, Christoph Hellwig wrote:
> > > Fix this bug by saving the address of the physical location
> > > of the ibft; later the driver will use isa_bus_to_virt() to get
> > > the correct virtual address.
> >
> > That sound rather broken. Why not save the physical address in
> > find_ibft_region and then later ioremap that when a virtual address is
> > needed like all other code accessing magic I/O memory?
>
> That is kind of what he does. The physical address is saved as a global
> static variable and also the physical address is memreserved. Then
> later on the physical address is used to create the virtual address.

Except that it uses isa_bus_to_virt, which is really broken.

> Or are you thinking of making the find_ibft_region reserve the physical
> address, and _cache_ the physical address so there is no global
> variable ?

No. Just switch to ioremap/early_ioremap insted of this isa_bus_to_virt
mess.