From: Paolo Bonzini <pbonzini@redhat.com>
To: David Matlack <dmatlack@google.com>, kvm@vger.kernel.org
Cc: jan.kiszka@siemens.com
Subject: Re: [PATCH kvm-unit-tests] x86: always inline functions called after set_exception_return
Date: Wed, 9 Dec 2015 16:02:12 +0100 [thread overview]
Message-ID: <56684274.6030003@redhat.com> (raw)
In-Reply-To: <1449520601-31507-1-git-send-email-dmatlack@google.com>
On 07/12/2015 21:36, David Matlack wrote:
> set_exception_return forces exceptions handlers to return to a specific
> address instead of returning to the instruction address pushed by the
> CPU at the time of the exception. The unit tests apic.c and vmx.c use
> this functionality to recover from expected exceptions.
>
> When using set_exception_return we have to be careful not to modify the
> stack (such as by doing a function call) as triggering the exception will
> likely jump us past the instructions which undo the stack manipulation
> (such as a ret). To accomplish this, declare all functions called after
> set_exception_return as __always_inline, so that the compiler always
> inlines them.
set_exception_return is generally not a great idea IMHO---thanks for
looking at it.
A couple years ago we discussed adding setjmp/longjmp to libcflat
(http://www.spinics.net/lists/kvm/msg94159.html which is however missing
a 32-bit version). Making the exceptions do a longjmp would be a much
safer option.
Paolo
next prev parent reply other threads:[~2015-12-09 15:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-07 20:36 [PATCH kvm-unit-tests] x86: always inline functions called after set_exception_return David Matlack
2015-12-09 15:02 ` Paolo Bonzini [this message]
2015-12-11 18:05 ` David Matlack
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=56684274.6030003@redhat.com \
--to=pbonzini@redhat.com \
--cc=dmatlack@google.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.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.