From: Chuck Ebbert <76306.1226@compuserve.com>
To: Stas Sergeev <stsp@aknet.ru>
Cc: Zachary Amsden <zach@vmware.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: + espfix-code-cleanup.patch added to -mm tree
Date: Wed, 2 Aug 2006 15:14:08 -0400 [thread overview]
Message-ID: <200608021515_MC3-1-C6D7-2B90@compuserve.com> (raw)
In-Reply-To: <44D0DCF5.8050906@aknet.ru>
On Wed, 02 Aug 2006 21:12:21 +0400, Stas Sergeev wrote:
>
> > iret faults, but doesn't pop the user return frame.
> But does it push the kernel frame after it or not?
> If not - I don't understand how we go to a fixup.
> If yes - I don't understand how the user's frame gets
> accessed later, as it is above the kernel's frame.
Just before trying to return to userspace, we have a stack:
user_regs [ebx ... es]
orig_eax
user_iret_frame [eip ... oldss]
After RESTORE_ALL and discarding orig_eax, we have this just
before doing iret (user's regs are in the CPU regs now):
user_iret_frame [eip ... oldss]
iret faults and we get:
kernel_iret_frame [eip(of iret) ... flags]
user_iret_frame [eip ... oldss]
error_code then saves regs and we have:
user_regs [ebx ... es]
orig_eax [== -1]
kernel_iret_frame [eip(iret) ... flags]
user_iret_frame [eip ... oldss]
error_code then calls e.g. do_segment_not_present, which finds a fixup
and does:
regs->eip = fixup_address;
now we have:
user_regs [ebx ... es]
orig_eax [== -1]
kernel_iret_frame [eip(fixup) ... flags]
user_iret_frame [eip ... oldss]
standard return sequence gives us (again user's regs are back in CPU):
kernel_iret_frame [eip(fixup) ... flags]
user_iret_frame [eip ... oldss]
iret returns to the fixup code which jumps to error_code and then we have:
user_regs [ebx ... es]
orig_eax [== -1]
user_iret_frame [eip ... oldss]
So now there is a stack frame that looks like it came from userspace
and we call the iret fault handler with that.
Only problem I have with this is we lose the original fault info from
the iret. So we have no real way of knowing whether it was #GP, #NP, #SF
or whatever, and no record of the offending iret's address.
--
Chuck
next reply other threads:[~2006-08-02 19:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-02 19:14 Chuck Ebbert [this message]
2006-08-02 19:31 ` Stas Sergeev
-- strict thread matches above, loose matches on Subject: below --
2006-08-12 2:27 Chuck Ebbert
2006-08-12 10:35 ` Stas Sergeev
[not found] <200607300016.k6U0GYu4023664@shell0.pdx.osdl.net>
[not found] ` <44CE766D.6000705@vmware.com>
2006-08-01 12:21 ` Stas Sergeev
2006-08-01 13:38 ` Jan Beulich
2006-08-01 14:37 ` Stas Sergeev
2006-08-01 14:43 ` Jan Beulich
2006-08-01 15:09 ` Stas Sergeev
2006-08-01 21:01 ` Zachary Amsden
2006-08-02 17:12 ` Stas Sergeev
2006-08-02 18:30 ` Zachary Amsden
2006-08-02 19:12 ` Stas Sergeev
2006-08-01 2:24 Chuck Ebbert
2006-08-01 12:39 ` Stas Sergeev
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=200608021515_MC3-1-C6D7-2B90@compuserve.com \
--to=76306.1226@compuserve.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stsp@aknet.ru \
--cc=zach@vmware.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome