From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 5/5] Port apic to new VMState design
Date: Tue, 18 Aug 2009 17:38:57 +0200 [thread overview]
Message-ID: <m3pratrv1q.fsf@neno.mitica> (raw)
In-Reply-To: <20090818152112.GA5483@1und1.de> ("Reimar Döffinger"'s message of "Tue, 18 Aug 2009 17:21:12 +0200")
Reply-to: quintela@redhat.com
Reimar Döffinger <Reimar.Doeffinger@gmx.de> wrote:
> On Tue, Aug 18, 2009 at 04:41:42PM +0200, Juan Quintela wrote:
>> Reimar Döffinger <Reimar.Doeffinger@gmx.de> wrote:
>> > Hello,
>> > sorry for replying in the middle of the thread, I was to fast and
>> > deleted the other mails already.
>> > And just in case I mention I am new around here, so feel free to ignore
>> > me if you feel I am completely wrong.
>> > One thing I don't like too much about it is that you can't really handle
>> > "calculated" fields.
>>
>> Calculated fields are not by definition part of the state :)
>> The state are the other fields that are used to save the state. I
>> haven't yet seen calculade fields (but I haven't looked throughfully
>> yet). With the current design, basically you can only save things that
>> are in one struct (the way it is stored is an offset against a base
>> address).
>
> I am not sure we 100% understand each other, so I maybe tell the
> specific example.
> I made a change to the eepro100 driver to fix dumping the network
> statistics.
> The main problem is, depending on which device you emulate, the size of
> the statistics struct changes.
> Since it looked ugly etc. I decided not to calculate the size of these
> statistics each time but instead save it in the device state.
> But instead of adding it to save_vm and load_vm (which also would change
> the version) I just set that statistics size again according to which
> device is emulated. This also assures that the emulated device and
> the statistics size always fit together, even if someone fiddles with
> the saved state.
> The "problem" with your approach if I understand it right is that I
> couldn't do that since the device never knows when it would have to
> re-fill these fields.
> Basically what I am asking is if you couldn't just add an optional
> callback so some additional stuff can be done after the "basic" state
> has been loaded - or if that isn't desired at least a callback that
> allows verifying the loaded values and aborting execution.
Ah, ok. I guess we are going to need that callbacks, one before we load
state, and another one after we load it.
Are your changes on upstream hw/eepro100.c? I can't see anything there
that can't be done in a table approach.
>> It is already that way. This design don't change anything. And I am
>> not sure how to fix it. We don't have a "is this value safe for this
>> field", around yet. It is possible to add some support for it, but I
>> would like to 1st have an use case.
>
> Well, I meant nowadays it is just possible to add a check in load_vm and
> fix any values that are off. While it is quite a bit of work there is
> nothing in the API stopping you from doing it, you even can return
> -EINVAL and hopefully the core will print some somewhat useful message.
I guess we are going to have an optional callback to be called
before/after loading the state. You should be able to put your verify
there.
>> > If nothing else, I'd at least add support for a "verify" function that
>> > gets a "const state *" and can abort loading the VM in case someone
>> > tries something evil (or can print some useful hint instead of having
>> > qemu crash silently on the user, possibly at some later time).
>>
>> This is as different problem that is not solved in qemu either. I agree
>> that it would be nice to have such a function, but I am not sure that I
>> know how to do it. and what is worse. if you can modify the image, you
>> can always change anything in the middle of the RAM. I don't really see
>> too much point trying to get a verify function for devices, when we
>> can't have it for RAM.
>
> That is completely different from what I meant.
> Changing the RAM compromises the VM and only the VM, an exploit in a
> device emulation might allow to compromise the _host_. Is it now clearer
> what I meant?
yes, I see where you are meaning now. But I guess that one is needed to
be solved, not only for migration. Not sure what to do about this.
Later, Juan.
next prev parent reply other threads:[~2009-08-18 15:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-18 13:34 [Qemu-devel] [PATCH RFC 0/5] New VMState table based load/save infrastructure Juan Quintela
2009-08-18 13:34 ` [Qemu-devel] [PATCH 1/5] loadvm already call vm_start() Juan Quintela
2009-08-18 13:34 ` [Qemu-devel] [PATCH 2/5] Don't call vm_start() if there was an error loading Juan Quintela
2009-08-18 13:34 ` [Qemu-devel] [PATCH 3/5] Don't ignore load_state() error return values Juan Quintela
2009-08-18 13:34 ` [Qemu-devel] [PATCH 4/5] New VMstate save/load infrastructure Juan Quintela
2009-08-18 17:13 ` Blue Swirl
2009-08-18 17:56 ` [Qemu-devel] " Juan Quintela
2009-08-19 7:49 ` [Qemu-devel] " Gerd Hoffmann
2009-08-19 9:38 ` [Qemu-devel] " Juan Quintela
2009-08-19 12:43 ` Gerd Hoffmann
2009-08-18 13:34 ` [Qemu-devel] [PATCH 5/5] Port apic to new VMState design Juan Quintela
2009-08-18 14:24 ` Reimar Döffinger
[not found] ` <20090818142405.GA16563@1und1.de>
[not found] ` <m37hx1tc9l.fsf@neno.mitica>
2009-08-18 15:21 ` [Qemu-devel] " Reimar Döffinger
2009-08-18 15:38 ` Juan Quintela [this message]
2009-08-18 16:06 ` Reimar Döffinger
2009-08-18 16:37 ` Juan Quintela
2009-08-19 8:00 ` Gerd Hoffmann
2009-08-19 9:10 ` Reimar Döffinger
[not found] ` <20090819085334.GA31062@1und1.de>
[not found] ` <4A8BC0C7.4010806@redhat.com>
2009-08-19 9:16 ` Reimar Döffinger
2009-08-19 7:41 ` [Qemu-devel] [PATCH RFC 0/5] New VMState table based load/save infrastructure Gerd Hoffmann
2009-08-19 10:15 ` [Qemu-devel] " Juan Quintela
2009-08-19 12:55 ` Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3pratrv1q.fsf@neno.mitica \
--to=quintela@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.