All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: "Luiz Fernando N. Capitulino" <lcapitulino@mandriva.com.br>,
	Gerhard Brauer <gerhard.brauer@web.de>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Colin Ian King <colin.king@ubuntu.com>
Subject: Re: 2.6.{26.2,27-rc} oops on virtualbox
Date: Tue, 26 Aug 2008 10:32:30 -0700	[thread overview]
Message-ID: <48B43E2E.5000207@zytor.com> (raw)
In-Reply-To: <20080826171822.GB14906@Krystal>

I have been unable to replicate this on my own hardware mostly because 
my testing machine decided to blow its DVD drive in some very strange 
way, but I did pick apart the data from Luiz, and found it very interesting:

The code sequence before patching looks like:

c012fc69:       51                      push   %ecx
c012fc6a:       52                      push   %edx
c012fc6b:       ff 15 40 b9 41 c0       call   *0xc041b940
c012fc71:       5a                      pop    %edx
c012fc72:       59                      pop    %ecx

After patching:

50 9d 0f 1f 84 00 00 00 <00> 00

... which disassembles to (in Intel notation):

C012FC69  50                push eax
C012FC6A  9D                popfd
C012FC6B  0F1F840000000000  nop dword [eax+eax+0x0]

We do, indeed have a return point that falls in the *middle* of a 
patched instruction, and if the patching happens in the middle of the 
instruction call, then, well, bad things happen.

Furthermore, why on Earth is %ecx/%edx pushed and popped in-line here? 
Surely it should be the responsibility of the PV call to present a 
no-clobber interface (using an assembly wrapper if necessary[*]), rather 
than bloating every callsite like this?

	-hpa


[*] One can compile gcc code with -fcall-saved-* to use nonstandard 
register conventions.  Unfortunately stock gcc only lets you do this 
with a file parameter, and doesn't support doing this with attributes.

  reply	other threads:[~2008-08-26 17:33 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-20 19:29 2.6.{26.2,27-rc} oops on virtualbox Luiz Fernando N. Capitulino
2008-08-21 21:34 ` H. Peter Anvin
2008-08-22  6:42   ` H. Peter Anvin
2008-08-22  6:50     ` Ingo Molnar
2008-08-22 14:39       ` Luiz Fernando N. Capitulino
2008-08-22 15:34         ` Mathieu Desnoyers
2008-08-22 16:29           ` Luiz Fernando N. Capitulino
2008-08-22 16:35             ` Mathieu Desnoyers
2008-08-22 17:20               ` Luiz Fernando N. Capitulino
2008-08-22 18:11                 ` H. Peter Anvin
2008-08-22 19:40                   ` Luiz Fernando N. Capitulino
2008-08-22 20:31                     ` H. Peter Anvin
2008-08-22 20:55                       ` Luiz Fernando N. Capitulino
2008-08-22 20:57                 ` Luiz Fernando N. Capitulino
2008-08-22 21:08                   ` H. Peter Anvin
2008-08-26 14:18                     ` Gerhard Brauer
2008-08-26 14:53                       ` Mathieu Desnoyers
2008-08-26 16:09                         ` Luiz Fernando N. Capitulino
2008-08-26 16:13                         ` Luiz Fernando N. Capitulino
2008-08-26 17:18                           ` Mathieu Desnoyers
2008-08-26 17:32                             ` H. Peter Anvin [this message]
2008-08-26 18:02                             ` Luiz Fernando N. Capitulino
2008-08-26 18:15                               ` Mathieu Desnoyers
2008-08-26 19:52                                 ` H. Peter Anvin
2008-08-26 20:34                                 ` Gerhard Brauer
2008-08-26 20:48                                   ` Mathieu Desnoyers
2008-08-26 21:25                                     ` Gerhard Brauer
2008-08-26 21:35                                       ` Mathieu Desnoyers
2008-08-26 21:51                                         ` H. Peter Anvin
2008-08-27  0:13                                         ` Gerhard Brauer
2008-08-27 19:13                                   ` Luiz Fernando N. Capitulino
2008-08-27 23:33                                     ` Mathieu Desnoyers
2008-08-28 13:30                                       ` Luiz Fernando N. Capitulino
2008-08-31  9:29                                         ` Gerhard Brauer
2008-08-31 13:28                                           ` Stefan Lippers-Hollmann
2008-08-31 14:03                                             ` Gerhard Brauer
2008-08-31 14:09                                           ` Luiz Fernando N. Capitulino
2008-09-21 13:41                                             ` Gerhard Brauer
2008-09-22  9:51                                               ` Ingo Molnar
2008-09-24 13:24                                               ` Luiz Fernando N. Capitulino
2008-08-28 13:50                                       ` Gerhard Brauer
2008-08-26 19:27                         ` Gerhard Brauer
2008-08-26 16:02                       ` Luiz Fernando N. Capitulino
2008-08-26 16:40                         ` Gerhard Brauer
2008-08-22 17:16             ` H. Peter Anvin
2008-08-22 17:45               ` Mathieu Desnoyers
2008-08-22 17:57                 ` H. Peter Anvin
2008-08-22 19:10               ` Luiz Fernando N. Capitulino
2008-08-22 19:14                 ` H. Peter Anvin
2008-08-22 19:18                 ` H. Peter Anvin
2008-08-22 19:42                   ` Luiz Fernando N. Capitulino
2008-08-22 14:28   ` Luiz Fernando N. Capitulino

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=48B43E2E.5000207@zytor.com \
    --to=hpa@zytor.com \
    --cc=colin.king@ubuntu.com \
    --cc=gerhard.brauer@web.de \
    --cc=lcapitulino@mandriva.com.br \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    /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.