I\'m working on a homework problem that requires disabling compiler optimization protection for it to work. I\'m using gcc 4.4.1 on ubuntu linux, but can\'t figure out which
You don't need to disable ASLR in order to do a buffer overflow! Although ASLR is enabled (kernel_randomize_va_space = 2), it will not take effect unless the compiled executable is PIE. So unless you compiled your file with -fPIC -pie flag, ASLR will not take effect.
I think only disabling the canaries with -fno-stack-protector is enough.
If you want to check if ASLR is working or not (Position independent code must be set), use:
hardening-check executable_name