All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: Daniel Kiper <daniel.kiper@oracle.com>,
	David Vrabel <david.vrabel@citrix.com>
Cc: keir@xen.org, andrew.cooper3@citrix.com,
	kexec@lists.infradead.org, xen-devel@lists.xen.org,
	ebiederm@xmission.com, Jan Beulich <JBeulich@suse.com>
Subject: Re: [PATCH] xen/kexec: Clear unused registers before jumping into an image
Date: Mon, 18 Nov 2013 12:05:38 +0000	[thread overview]
Message-ID: <528A0292.4040205@eu.citrix.com> (raw)
In-Reply-To: <20131118114750.GE3506@olila.local.net-space.pl>

On 18/11/13 11:47, Daniel Kiper wrote:
> On Mon, Nov 18, 2013 at 11:23:27AM +0000, David Vrabel wrote:
>> On 18/11/13 09:29, Jan Beulich wrote:
>>>>>> On 15.11.13 at 21:07, David Vrabel <david.vrabel@citrix.com> wrote:
>>>> On 15/11/13 15:56, Daniel Kiper wrote:
>>>>> Clear unused registers before jumping into an image. This way
>>>>> loaded image could not assume that any register has an specific
>>>>> info about earlier running Xen hypervisor. However, it also
>>>>> does not mean that the image may expect that a given register
>>>>> is zeroed. The image MUST assume that every register has a random
>>>>> value or in other words it is uninitialized or has undefined state.
>>>> I think this, where the specification (registers undefined) differs from
>>>> the implementation (registers zeroed), is the worst option.
>>>>
>>>> I also think it is more likely for an image to inadvertently rely on a
>>>> zero value that whatever junk Xen has left behind.
>>> Preventing users to rely on anything would likely make it
>>> desirable to put some random value into all unused registers.
>> I don't think we need to go that far.
>>
>> I would just like to avoid someone looking that the implementation (and
>> not the documentation) and concluding that zero-ing of the registers is
>> part of the specified behaviour, or looking at the implementation and
>> documentation and wondering why they don't agree.
> David, my comment clearly states why we are doing that and what should
> be expected. What is wrong with it? I could improve it but say how?

You seem to be saying that the registers may contain useful information 
about Xen that are not part of the spec, and you are worried that the 
image may decide to use these and come to rely on them, making it hard 
to change the interface in the future.

David has a similar concern -- that if the registers are zeroed, the 
image may come to rely on the registers being pre-zeroed, and not zero 
them itself.  This would also make it hard to change the interface in 
the future.

A simple solution would be to "poison" the registers with useless data: 
0xdeadbeef is a favorite.  Anyone seeing that in the registers will 
immediately know, "Someone used a value that they shouldn't have."

Of course, it's *possible* that then the images might come to rely on 
that poison being there; having a non-deterministic value there, like a 
hash of the TSC, would make this impossible.  But even then, you could 
make the argument that the image may come to rely on a *pseudo-random* 
number being there, which it uses for some other kind of seed 
somewhere.  At some point you just have to give up on this like of 
thought. :-)

Personally I think having a poison is likely to be more useful -- if you 
crash because your pointer is 0xdeadbeef, then it's immediately obvious 
what kind of bug you have; whereas if you crash with a random value that 
changes every time, it's not so obvious.

  -George

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2013-11-18 12:06 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-15 15:56 [PATCH] xen/kexec: Clear unused registers before jumping into an image Daniel Kiper
2013-11-15 20:07 ` David Vrabel
2013-11-15 21:30   ` Daniel Kiper
2013-11-15 21:30   ` Daniel Kiper
2013-11-18  9:29   ` Jan Beulich
2013-11-18 11:08     ` Daniel Kiper
2013-11-18 11:27       ` Jan Beulich
2013-11-18 11:27       ` Jan Beulich
2013-11-18 11:53         ` Daniel Kiper
2013-11-18 11:53         ` Daniel Kiper
2013-11-18 11:08     ` Daniel Kiper
2013-11-18 11:23     ` David Vrabel
2013-11-18 11:23     ` David Vrabel
2013-11-18 11:47       ` Daniel Kiper
2013-11-18 11:47       ` Daniel Kiper
2013-11-18 12:05         ` George Dunlap
2013-11-18 12:05         ` George Dunlap [this message]
2013-11-18 12:41           ` Daniel Kiper
2013-11-18 13:13             ` Petr Tesarik
2013-11-18 14:06               ` George Dunlap
2013-11-18 14:06               ` George Dunlap
2013-11-19 19:35                 ` [Xen-devel] " Konrad Rzeszutek Wilk
2013-11-19 19:51                   ` Konrad Rzeszutek Wilk
2013-11-19 19:51                   ` [Xen-devel] " Konrad Rzeszutek Wilk
2013-11-19 19:35                 ` Konrad Rzeszutek Wilk
2013-11-18 13:13             ` Petr Tesarik
2013-11-18 12:41           ` Daniel Kiper
2013-11-18  9:29   ` Jan Beulich
2013-11-15 20:07 ` David Vrabel
  -- strict thread matches above, loose matches on Subject: below --
2013-11-15 15:56 Daniel Kiper

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=528A0292.4040205@eu.citrix.com \
    --to=george.dunlap@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=daniel.kiper@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=ebiederm@xmission.com \
    --cc=keir@xen.org \
    --cc=kexec@lists.infradead.org \
    --cc=xen-devel@lists.xen.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.