Kernel Stack Limit...

Kernel Stack Limit...

Post by Raj, Asho » Sat, 31 Aug 2002 04:10:12



Hello.

Please reply to me, since i dont have this email id on the list.

Could someone tell me at what the kernel stack size limit is?

Is there a gcc option for x86 that can warn if too large variables are
specified in the stack?

recently we had a problem with one variable accidently declared on the stack
which was quite large, and when
some calls nested, we noticed stack corruption. Once the variable was moved
to global, the corruption went away. We would always see that some member of

"current" would be corrupted, so when the user mode program exits, we will
notice the files member would be having garbage values.

if there is a compiler option to force that during compilation to point out
such weirdness, or if a runtime check could be done during each function
exit,
it would be really useful.

thanks
ashokr
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

Kernel Stack Limit...

Post by Robert Lov » Sat, 31 Aug 2002 04:20:09



> Please reply to me, since i dont have this email id on the list.

> Could someone tell me at what the kernel stack size limit is?

It depends on the architecture.  8KB for x86 and most others.  Some
(all?) 64-bit platforms have 16KB stacks.

Note the effective size is actually (8KB - sizeof(task_struct)) in 2.4
and (8KB - sizeof(thread_info)) in 2.5 since those structures are stored
at the top of the stack.

Also note interrupts share the stack.

Quote:> Is there a gcc option for x86 that can warn if too large variables are
> specified in the stack?

I believe 2.4-ac has a stack overflow check in it... as does the RedHat
kernel - check it out.

Also kgdb (or at least our copy here at MontaVista) has a stack overflow
check.

        Robert Love

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

Kernel Stack Limit...

Post by Randy.Dunla » Sat, 31 Aug 2002 04:30:06




|
| > Please reply to me, since i dont have this email id on the list.
| >
| > Could someone tell me at what the kernel stack size limit is?
|
| It depends on the architecture.  8KB for x86 and most others.  Some
| (all?) 64-bit platforms have 16KB stacks.
|
| Note the effective size is actually (8KB - sizeof(task_struct)) in 2.4
| and (8KB - sizeof(thread_info)) in 2.5 since those structures are stored
| at the top of the stack.
|
| Also note interrupts share the stack.
|
| > Is there a gcc option for x86 that can warn if too large variables are
| > specified in the stack?
|
| I believe 2.4-ac has a stack overflow check in it... as does the RedHat
| kernel - check it out.
|
| Also kgdb (or at least our copy here at MontaVista) has a stack overflow
| check.

Also Keith Owens posted a script in the last couple of days
that checks stack depth.

--
~Randy

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

Kernel Stack Limit...

Post by Richard B. Johnso » Sat, 31 Aug 2002 04:30:11



> Hello.

> Please reply to me, since i dont have this email id on the list.

> Could someone tell me at what the kernel stack size limit is?

Only two PAGES, 0x1000 per page on a ix86.

Quote:> Is there a gcc option for x86 that can warn if too large variables are
> specified in the stack?

sizeof(whatever_local_variable)

Quote:> recently we had a problem with one variable accidently declared on the stack
> which was quite large, and when
> some calls nested, we noticed stack corruption. Once the variable was moved
> to global, the corruption went away. We would always see that some member of

Yes strange things happen when stack, which goes down, meets data...

Cheers,
* Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
The US military has given us many words, FUBAR, SNAFU, now ENRON.
Yes, top management were graduates of West Point and Annapolis.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://www.veryComputer.com/
Please read the FAQ at  http://www.veryComputer.com/

 
 
 

1. Kernel stack limit?

Hello all-

I'm new to (Free)BSD programming, so this may be a dumb question.

Is there a limit to the stack space available to functions
within the kernel?  Occasionally I'll see a nasty bug where as
soon as a function is entered, the kernel double faults.

If I then reduce the amount of stack space required by the
function (by allocating some variables on the heap, or
breaking the function into subfunctions), then the problem
goes away.

It's possible it's an obscure GCC bug, but that seems pretty
unlikely.  On the other hand, I didn't think there was a limit
to stack size in the kernel.  Or is there something like a
4K limit per function, or some such?

Any and all help is appreciated.

Thanks-

    -Thomas

2. UNIX admin 1-3yrs HP-UX in DFW

3. Process Kernel Stack and Interrupt Stack

4. one more question about XF86Config file

5. Possibel to implement system , such that Kernel stack grows on top of User Stack

6. Setting up SLIP for NET-2

7. Kernel Limits and RLOGIND limits

8. Migrate user error

9. kernel: release: find kernel stack corruption. Aiee

10. Stack limit

11. Is there a stack size limit under UNIX?

12. Stack Size Limit???

13. Enlarging STACK SIZE limit ?