[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [csmith-dev] Generate two slightly different files



I think Yang Chen has experimented with the idea of tampering random number sequences generated by Csmith. What he found, IIRC, is that Csmith makes hundreds of random choices (each of them determined by a random number within a range, or a flip of true/false), if we change just one random number in the sequence, all the subsequent random numbers are affected, and the generated program looks vastly different from the original one.

I think the alteration of the random choices has to be done after, not during, the program is generated.

-Xuejun

On Mon, May 2, 2016 at 7:17 AM, John Regehr <regehr@cs.utah.edu> wrote:


Another idea that came to my mind was to manipulate the random stream
csmith uses to generate files. As I understand it correctly, csmith uses
lrand48() to generate a sequence of random numbers that are used to
construct the testcase. If filled with the same seed, the same testcase
would be build. What would happen, if I drop/replace one of these
numbers when generated the "mutant"? For example, one number that is
used relative late in the generation process:

Since you said "relatively late" I think you have already grasped the problem, which is that Csmith is a stateful generator and you can't just swap out a decision since many decisions affect all subsequent decisions.

But since the hack you describe is extremely easy you might as well try this out and see what happens, no big loss if it doesn't work.

John