linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PROBLEM: large auto variables cause segfault under 2.6
@ 2004-10-05 13:27 Andrei A. Voropaev
  2004-10-05 13:40 ` Arjan van de Ven
  2004-10-07 15:05 ` Tonnerre
  0 siblings, 2 replies; 4+ messages in thread
From: Andrei A. Voropaev @ 2004-10-05 13:27 UTC (permalink / raw)
  To: linux-kernel

Declaring very large auto variables cause segfaults in the program under
2.6 kernel.

Take a look at this program.

  int main( int argc, char **argv )
  {
       unsigned char  bRet = 0;
  
       char tst[67123456];
  
  
       const char* pcSupportedParams = "d:t:lV:C:cP:h";
  
       printf("pcSupportedParams = %s\n");
       return 0;
  }

When compiled it produces segfault under kernel 2.6.8.1. The problem is
with that large array. Under 2.4 kernel the program gets its memory
region automatically extended to accomodate for large auto variables.
Under 2.6 it gets segment violation signal.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PROBLEM: large auto variables cause segfault under 2.6
  2004-10-05 13:27 PROBLEM: large auto variables cause segfault under 2.6 Andrei A. Voropaev
@ 2004-10-05 13:40 ` Arjan van de Ven
  2004-10-05 13:47   ` Andrei A. Voropaev
  2004-10-07 15:05 ` Tonnerre
  1 sibling, 1 reply; 4+ messages in thread
From: Arjan van de Ven @ 2004-10-05 13:40 UTC (permalink / raw)
  To: Andrei A. Voropaev; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 473 bytes --]

On Tue, 2004-10-05 at 15:27, Andrei A. Voropaev wrote:
> Declaring very large auto variables cause segfaults in the program under
> 2.6 kernel.
> 
> Take a look at this program.
> 
>   int main( int argc, char **argv )
>   {
>        unsigned char  bRet = 0;
>   
>        char tst[67123456];
>   
you have a stack variable that is several orders of magnitude bigger
than the rlimit you have set for the stack I suspect. Try increasing the
stack rlimit...


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PROBLEM: large auto variables cause segfault under 2.6
  2004-10-05 13:40 ` Arjan van de Ven
@ 2004-10-05 13:47   ` Andrei A. Voropaev
  0 siblings, 0 replies; 4+ messages in thread
From: Andrei A. Voropaev @ 2004-10-05 13:47 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel

On Tue, Oct 05, 2004 at 03:40:52PM +0200, Arjan van de Ven wrote:
> On Tue, 2004-10-05 at 15:27, Andrei A. Voropaev wrote:
> > Declaring very large auto variables cause segfaults in the program under
> > 2.6 kernel.
> > 
> > Take a look at this program.
> > 
> >   int main( int argc, char **argv )
> >   {
> >        unsigned char  bRet = 0;
> >   
> >        char tst[67123456];
> >   
> you have a stack variable that is several orders of magnitude bigger
> than the rlimit you have set for the stack I suspect. Try increasing the
> stack rlimit...
> 

Yep. I was just going to write "excuse me" letter. Looks like under new
kernel the kernel stack is limited to 8M while under 2.4 kernel it is
unlimited. So setrusage should help us.

Sorry for distractions.

Andrei



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PROBLEM: large auto variables cause segfault under 2.6
  2004-10-05 13:27 PROBLEM: large auto variables cause segfault under 2.6 Andrei A. Voropaev
  2004-10-05 13:40 ` Arjan van de Ven
@ 2004-10-07 15:05 ` Tonnerre
  1 sibling, 0 replies; 4+ messages in thread
From: Tonnerre @ 2004-10-07 15:05 UTC (permalink / raw)
  To: Andrei A. Voropaev; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 434 bytes --]

Salut,

On Tue, Oct 05, 2004 at 03:27:41PM +0200, Andrei A. Voropaev wrote:
>   int main( int argc, char **argv )
>   {
>        unsigned char  bRet = 0;
>   
>        char tst[67123456];
>   
>   
>        const char* pcSupportedParams = "d:t:lV:C:cP:h";
>   
>        printf("pcSupportedParams = %s\n");
>        return 0;
>   }

It might also crash because your printf is printing something odd.

				Tonnerre


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-10-07 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-05 13:27 PROBLEM: large auto variables cause segfault under 2.6 Andrei A. Voropaev
2004-10-05 13:40 ` Arjan van de Ven
2004-10-05 13:47   ` Andrei A. Voropaev
2004-10-07 15:05 ` Tonnerre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).