Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

You must log in to answer this question.