[PATCH 23/24] powerpc/mm: Cleanup check for stack expansion
Christophe LEROY
christophe.leroy at c-s.fr
Mon Jul 31 21:37:37 AEST 2017
Le 25/07/2017 à 13:19, Michael Ellerman a écrit :
> LEROY Christophe <christophe.leroy at c-s.fr> writes:
>
>> Michael Ellerman <mpe at ellerman.id.au> a écrit :
>>
>>> LEROY Christophe <christophe.leroy at c-s.fr> writes:
>>>
>>>> Benjamin Herrenschmidt <benh at kernel.crashing.org> a écrit :
>>>>
>>>>> When hitting below a VM_GROWSDOWN vma (typically growing the stack),
>>>>> we check whether it's a valid stack-growing instruction and we
>>>>> check the distance to GPR1. This is largely open coded with lots
>>>>> of comments, so move it out to a helper.
>>>>
>>>> Did you have a look at the following patch ? It's been waiting for
>>>> application for some weeks now.
>>>> https://patchwork.ozlabs.org/patch/771869
>>>
>>> I actually merged it last merge window, but found I had no good way to
>>> test it, so I took it out again until I can write a test case for it.
>>>
>>> The way I realised it wasn't being tested was by removing all the
>>> store_updates_sp logic entirely and having my system run happily for
>>> several days :}
>>
>> Which demonstrates how unlikely this is, hence doing that get_user()
>> at every fault is waste of time.
>
> Yes I agree.
>
>> How do you plan to handle that in parralele to ben's serie ?
>
> Not sure :)
>
>> I'll be back from vacation next week and may help finding a way to
>> test that. (A test program using alloca() ?)
>
> I was thinking hand-crafted asm, but that might be a pain to get working
> for 32 & 64-bit, in which case alloca() might work.
No need of very sofisticated thing indeed.
The following app makes the trick. If I modify store_updates_sp() to
always return 0, the app gets a SIGSEGV.
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv)
{
char buf[1024 * 1025];
sprintf(buf, "Hello world !\n");
printf(buf);
exit(0);
}
Christophe
>
> cheers
>
More information about the Linuxppc-dev
mailing list