Saturday, May 2, 2020

Linux: Kernel Stack Corruption

What do you do when you see a crash trace like this one?

-- snip --
task: ffffffc07d4d8000 ti: ffffffc07d4d4000 task.ti
PC is at 0xc72kf
LR is at 0xc72kf
pc : [<00000000000c70c0>] lr : [<00000000000c70c0>]
sp : ffffffc07d4d7920
x29: ffffffc07d4d7720 x28: ffffffc07d4d7a58
x27: 0000000000000001 x26: ffffffc07d477780
x25: 0000000000000001 x24: ffffffc00088f000
 [<00000000000c70c0>] (suspected corrupt symbol)

This is a classic example of the kernel stack corruption. If you manage a software team and want to avoid running into this condition, see our brief application note for further details and tips.

Gautam Bhanage, "Kernel Stack Protection and keeping coding simple", Published online at April 2020. [PDF]