• Linus Torvalds's avatar
    Fix gcc-4.9.0 miscompilation of load_balance() in scheduler · 64cb5bd3
    Linus Torvalds authored
    commit 2062afb4f804afef61cbe62a30cac9a46e58e067 upstream.
    
    Michel Dänzer and a couple of other people reported inexplicable random
    oopses in the scheduler, and the cause turns out to be gcc mis-compiling
    the load_balance() function when debugging is enabled.  The gcc bug
    apparently goes back to gcc-4.5, but slight optimization changes means
    that it now showed up as a problem in 4.9.0 and 4.9.1.
    
    The instruction scheduling problem causes gcc to schedule a spill
    operation to before the stack frame has been created, which in turn can
    corrupt the spilled value if an interrupt comes in.  There may be other
    effects of this bug too, but that's the code generation problem seen in
    Michel's case.
    
    This is fixed in current gcc HEAD, but the workaround as suggested by
    Markus Trippelsdorf is pretty simple: use -fno-var-tracking-assignments
    when compiling the kernel, which disables the gcc code that causes the
    problem.  This can result in slightly worse debug...
    64cb5bd3
Makefile 52.7 KB