On 10/15/2012 08:28 AM, Aldy Hernandez wrote:

I am having a bit of a problem coming up with a generic testcase. Perhaps Andrew or others have an idea.

The attached testcase fails to trigger without the patch, because AFAICT we have no way of testing an addition of zero to a memory location:

        cmpl    $1, flag(%rip)
        setb    %al
        addl    %eax, dont_write(%rip)

In the simulate-thread harness I can test the environment before an instruction, and after an instruction, but adding 0 to *dont_write produces no measurable effects, particularly in a back-end independent manner. Ideas?

Hum. isn't that clever. Well, the instruction is executed pretty much atomically... so a write of the same value becomes very difficult to detect, and impossible within the existing harness. And I dont think a hardware watch point can catch that...

The only way I can think of is if you put 'dont_write' into a section which will trap if it is written to... I don't know the details of doing such a thing or how you monitor the trap within the harness...

Other than that I'm not sure we can detect this with our current set of tools, for the longer term we'd need a write detector. I don't suppose something like systemtap can detect writes like this?

Andrew

Reply via email to