Re: [PATCH] slow_map: minor improvements to ROM BAR handling

Alexander Graf
2009-12-22T15:36:37Z

Michael S. Tsirkin wrote:
> On Tue, Dec 22, 2009 at 04:24:43PM +0100, Alexander Graf wrote:
>
>> Avi Kivity wrote:
>>
>>> On 12/22/2009 05:19 PM, Michael S. Tsirkin wrote:
>>>
>>>>> I'm not sure the BIOS is the only one executing ROMs. If it is, then
>>>>> I'm
>>>>> good with the change.
>>>>> Maybe it'd make sense to also add a read only flag so we don't
>>>>> accidently try to write to the ROM region with slow_map.
>>>>>
>>>>> Alex
>>>>>
>>>>>
>>>> Correct: I think it's made readonly down the road with mprotect,
>>>> so attempt to do so will crash qemu :)
>>>>
>>>>
>>> Alex, are you happy with this? I'd like to apply it.
>>>
>> I'd like to see the read-only protection in.
>>
>
> Yes, this is a must, I am working on it.
>
>
>> Apart from that I'm good on checking it in, though I'm only awaiting
>> the day someone runs code off such a ROM region ;-).
>>
>> Alex
>>
>
> Is there a way to trap this and fprintf something?

I don't think so. KVM will just trap on execution outside of RAM and
either fail badly or throw something bad into the guest. MMIO access
works by analyzing the instruction that accesses the MMIO address. That
just doesn't work when we don't have an instruction to analyze.

Alex