Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

stack address randomization

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

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.