mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chuck Ebbert <76306.1226@compuserve.com>
To: Stas Sergeev <stsp@aknet.ru>
Cc: Andi Kleen <ak@suse.de>, linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Segfault on the i386 enter instruction
Date: Mon, 15 May 2006 22:29:39 -0400	[thread overview]
Message-ID: <200605152231_MC3-1-BFDF-12B4@compuserve.com> (raw)

In-Reply-To: <44676F42.7080907@aknet.ru>

On Sun, 14 May 2006 21:56:18 +0400, Stas Sergeev wrote:

> Andi Kleen wrote:
> > Handling it like you expect would require to disassemble 
> > the function in the page fault handler and it's probably not 
> > worth doing that for this weird case.
> Just wondering, is this case really that weird?
> In fact, the check against %esp that the kernel
> does, looks strange. I realize that it can catch a
> (very rare) user-space bug of accessing below %esp, but
> other than that it looks redundant (IMHO) and as soon as
> it triggers the false-positives, what is it really good for?

I can't get a SIGSEGV on any native i386 kernel, not even when
running on AMD64.  It only happens on native x86_64 kernels.

Looking at the AMD instruction manual, the pseudo-code for 'enter'
ends with:

RSP.s = RSP - temp_ALLOC_SPACE // Leave "temp_ALLOC_SPACE" free bytes on
                               // the stack
WRITE_MEM.v [SS:RSP.s] = temp_unused // ENTER finishes with a memory write
                                     // check on the final stack pointer,
                                     // but no write actually occurs.
RBP.v = temp_RBP
EXIT


And the Intel manual says:

IF 64-Bit Mode (StackSize = 64)
THEN
        RBP = FrameTemp;
        RSP = RSP - Size;
ELSE IF StackSize = 32
THEN
        EBP = FrameTemp;
        ESP = ESP - Size;
ELSE (* StackSize = 16 *)
        BP = FrameTemp;
        SP = SP - Size;
FI;
END;


Intel says nothing about a write check.  Is that a mistake in the manual
or is that something only AMD64 does, and then only in long mode?


-- 
Chuck

"The x86 isn't all that complex -- it just doesn't make a lot of sense."
                                                        -- Mike Johnson

             reply	other threads:[~2006-05-16  2:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-16  2:29 Chuck Ebbert [this message]
2006-05-16  9:32 ` Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2006-05-17  8:20 Chuck Ebbert
2006-05-14 17:56 Stas Sergeev
2006-05-15  7:40 ` Andi Kleen
2006-05-15 17:15   ` Stas Sergeev
2006-05-15 18:44     ` Andi Kleen
2006-05-15 19:38       ` Stas Sergeev
2006-05-15 19:56         ` Lee Revell
2006-05-15 22:49           ` Ingo Oeser
2006-05-15 22:56             ` Lee Revell
2006-05-12 13:16 Tomasz Malesinski
2006-05-12 13:47 ` Denis Vlasenko
2006-05-12 13:50 ` Andi Kleen
2006-05-12 14:03   ` Denis Vlasenko
2006-05-12 15:31   ` Tomasz Malesinski
2006-05-15 11:36     ` Bart Hartgers
2006-05-15 11:46       ` Andi Kleen
2006-05-15 13:36       ` linux-os (Dick Johnson)
2006-05-15 14:19         ` Bart Hartgers
2006-05-12 14:07 ` linux-os (Dick Johnson)
2006-05-12 14:20   ` Denis Vlasenko
2006-05-12 14:42     ` linux-os (Dick Johnson)
2006-05-12 14:53       ` Denis Vlasenko
2006-05-15 20:53   ` Bill Davidsen

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=200605152231_MC3-1-BFDF-12B4@compuserve.com \
    --to=76306.1226@compuserve.com \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stsp@aknet.ru \
    /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

all inboxes | Powered by JetHome®