All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Atom2 <ariel.atom2@web2web.at>, Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH RFC] x86/traps: Improve hypervisor stack overflow detection
Date: Fri, 20 Nov 2015 06:11:22 -0700	[thread overview]
Message-ID: <564F2A0A02000078000B7234@prv-mh.provo.novell.com> (raw)
In-Reply-To: <564F1796.4070705@citrix.com>

>>> On 20.11.15 at 13:52, <andrew.cooper3@citrix.com> wrote:
> On 20/11/15 12:23, Jan Beulich wrote:
>>>>> On 20.11.15 at 12:03, <andrew.cooper3@citrix.com> wrote:
>>> On 20/11/15 10:54, Jan Beulich wrote:
>>>>>>> On 19.11.15 at 18:34, <andrew.cooper3@citrix.com> wrote:
>>>>> @@ -394,9 +401,8 @@ void show_stack_overflow(unsigned int cpu, const struct 
>>> cpu_user_regs *regs)
>>>>>             (void *)esp_top, (void *)esp_bottom, (void *)esp,
>>>>>             (void *)per_cpu(init_tss, cpu).esp0);
>>>>>  
>>>>> -    /* Trigger overflow trace if %esp is within 512 bytes of the guard page. 
>>> */
>>>>> -    if ( ((unsigned long)(esp - esp_top) > 512) &&
>>>>> -         ((unsigned long)(esp_top - esp) > 512) )
>>>>> +    /* Trigger overflow trace if %esp is anywhere within the guard page. */
>>>>> +    if ( (esp & PAGE_MASK) != (esp_top - PAGE_SIZE) )
>>>> Is this correct? I'd suspect this to be wrong when esp is in the
>>>> lower of the two primary stack pages.
>>> If we have hit a double fault from the stack guard pages, one way or
>>> another %esp is somewhere in the guard page.
>> But the #DF may be for a reason other than having run into a
>> stack guard page.
> 
> Indeed, but under such circumstances, we don't want to continue with the
> stack overflow analysis.

Oh, right, the right side is the guard page (the "top" vs "bottom"
use is somewhat confusing when you consider memory addresses
instead of the direction the stack grows).

Jan

      reply	other threads:[~2015-11-20 13:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-19 17:34 [PATCH RFC] x86/traps: Improve hypervisor stack overflow detection Andrew Cooper
2015-11-19 17:36 ` Andrew Cooper
2015-11-20 10:56   ` Jan Beulich
2015-11-20 10:54 ` Jan Beulich
2015-11-20 11:03   ` Andrew Cooper
2015-11-20 12:23     ` Jan Beulich
2015-11-20 12:52       ` Andrew Cooper
2015-11-20 13:11         ` Jan Beulich [this message]

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=564F2A0A02000078000B7234@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ariel.atom2@web2web.at \
    --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.