[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091021082813.GA8655@Chamillionaire.breakpoint.cc>
Date: Wed, 21 Oct 2009 10:28:13 +0200
From: Sebastian Andrzej Siewior <sebastian@...akpoint.cc>
To: Roland McGrath <roland@...hat.com>
Cc: Ingo Molnar <mingo@...e.hu>, Oleg Nesterov <oleg@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org,
Haavard Skinnemoen <hskinnemoen@...el.com>
Subject: Re: [PATCH] consider stack access while checking for alternate
signal stack
* 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists