mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
To: Roland McGrath <roland@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>, Oleg Nesterov <oleg@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org,
	Haavard Skinnemoen <hskinnemoen@atmel.com>
Subject: Re: [PATCH] consider stack access while checking for alternate signal stack
Date: Wed, 21 Oct 2009 10:28:13 +0200	[thread overview]
Message-ID: <20091021082813.GA8655@Chamillionaire.breakpoint.cc> (raw)
In-Reply-To: <20091020211116.2B76F81A3@magilla.sf.frob.com>

* Roland McGrath | 2009-10-20 14:11:16 [-0700]:

>> >+#ifdef CONFIG_STACK_GROWSUP
>> >+	return sp >= current->sas_ss_sp &&
>> >+		sp - current->sas_ss_sp < current->sas_ss_size;
>> 
>> CONFIG_STACK_GROWSUP is wrong: If your stack grows up and sp ==
>> sas_ss_sp + size than you are using the last entry in your sig stack
>> which will be not recognized correctly. 
>
>+		sp - current->sas_ss_sp <= current->sas_ss_size;
>
>then?

+		sp - current->sas_ss_sp < current->sas_ss_size;
That (the old code) is correct on POST_* architectures. However we don't
have any.

>> The case where sp == sas_ss_sp
>> is also not detected correctly but this should not happen in real life.
>
>So you say that sp==sas_ss_sp should not be considered "on the sig stack"?
Exactly. Because if you have a PRE_* architecture than you first
increment/decrement the stack and than store the value.
So if sp == sas_ss_sp than your next store on the stack will be just
below the begin of your sig stack.

>> That is the PRE case which is the only relevant since we don't have any
>> POST architectures. The check here produces the same results as my
>> variant so it is okay :)
>> So you prefer the smaller patch with comments around it?
>
>Yes, I think it is far clearer and easier to read than what you posted.
Okay. This would bring us to:

-       return (sp - current->sas_ss_sp < current->sas_ss_size);
+       /* This considers PRE_DEC and PRE_INC architectures */
+       return sp > current->sas_ss_sp &&
+               sp - current->sas_ss_sp <= current->sas_ss_size;

And I throw my table away and put something else into patch's comment?

>
>Thanks,
>Roland

Sebastian

  reply	other threads:[~2009-10-21  8:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-18 19:12 Sebastian Andrzej Siewior
2009-10-19  4:09 ` Haavard Skinnemoen
2009-10-19  7:58   ` Sebastian Andrzej Siewior
2009-10-19  9:26     ` Haavard Skinnemoen
2009-10-19  7:33 ` Ingo Molnar
2009-10-19  8:02   ` Sebastian Andrzej Siewior
2009-10-19 18:08     ` Roland McGrath
2009-10-19 19:30       ` Sebastian Andrzej Siewior
2009-10-20 21:11         ` Roland McGrath
2009-10-21  8:28           ` Sebastian Andrzej Siewior [this message]
2009-10-25 14:37           ` [PATCH v2] consider the kind of stack incrementation " Sebastian Andrzej Siewior
2009-11-04 17:27             ` [tip:core/signal] signal: Fix alternate signal stack check tip-bot for Sebastian Andrzej Siewior

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=20091021082813.GA8655@Chamillionaire.breakpoint.cc \
    --to=sebastian@breakpoint.cc \
    --cc=hpa@zytor.com \
    --cc=hskinnemoen@atmel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=roland@redhat.com \
    --cc=tglx@linutronix.de \
    /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®