Stack overflows

I use intel processers,Arm and X86. I want to find stack overflow. Somone said that it is possible to use a "stack descriptor" in an Intel processor to catch exactly this kind of fault. But I don't know how? Does anyone know this?

Reply to
Loading thread data ...

If you're running in a protected mode, the Intel segmentation model gives a possibility to catch an addressing attempt outside of a segment. The segment boundaries are in the segment descriptor, which is a table element in the global descriptor table (GDT) or local descriptor table (LDT) of the process executing. The tables are built by the kernel running the protected mode environment.

The detailed instructions depend heavily upon the environment you're running your code in.

For hardware details, get a book on Intel 386+ architecture and look at protected mode programming model. The segmentation is already in 80286, but in limited 16 bit form.


Tauno Voipio tauno voipio @ iki fi

Reply to
Tauno Voipio

or if you're using paged memory model, using a "guard page" is a popular and simple arrangement.







Reply to
Bryan Bullard

Have a look at MPATROL and EFENCE. They help you track down memory related bugs. If nothing else they will help you understand what you should be looking for in terms of tools.

Regards Sergio Masci

formatting link
- optimising structured PIC BASIC compiler

Reply to
Sergio Masci

For older, non-MMU processors, the tactic always has been to 'fill' the stack with a certain 'guard' pattern on thread initialisation, and check the guard pattern at the top once in a while. (in interrupt, for example)

This detects stack overflows but doesn't prevent the accompanying damage.


Reply to

It does if the only damage is the corruption of the guard pattern.

Reply to
Richard Henry

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.