Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a buggy program that pushes a variable onto stack and may use it without initialization.

I take the same binary and run it on different Linux boxes. Those boxes have different CPUs (i5, i7), but other than that they run the same Fedora distro.

One one box, I can easily catch the problem because the variable has random data.

On another box, however, the stack variables are always initialized to 0 (even though they should not be).

I am trying to pin down the cause of this different behavior. Where should I look at? What can possibly cause this? Are there any kernel features that can affect this?

share|improve this question
    
The cause is the bug in the program. –  David Schwartz Oct 9 '13 at 0:47

1 Answer 1

There is no "should" or "should not" for uninitialized data. It can be whatever it darn well pleases. All zeros is a possibility - so is all ones, and so is random garbage. Indeed, all zeros is one perfectly acceptable form of random garbage. Rather than concerning yourself with what the uninitialized data is on different boxes, initialize it, and then (and only then) you can know what it "should be."

share|improve this answer
    
Thank you Captain. The question is why random is not random in certain environments. SELinux extensions, some stack protector features in glibc, etc? –  user49531 Oct 9 '13 at 1:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.