Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

stack address randomization

Altera_Forum
Honored Contributor II
1,099 Views

Hi, 

 

I am trying to implement stack address randomization, by which i mean the stack (starting) address changes dynamically(by adding some random number) each time the same program is executed.  

 

I am not able to figure out which file/function in Micro C/OS II source code controls stack allocation address. I think once I figure out this, I can modify the stack address randomly. Any info/suggestion to figure out the source file which controls stack is highly appreciated. 

 

Thanks, 

Amjad
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
370 Views

the stack pointer is initialized in the init function, befare main() is called. IIRC it is simply the highest memory pointer in the area reserved for heap. 

The stack for each individual threads are specified by the user though the OsTaskCreate() / OsTaskCreateEx() functions. Those are a lot easier to control, so if your application is running from a thread I would start looking there.
0 Kudos
Reply