Skip to contentSkip to conversation

2.6.8-rc3 slab corruption (jffs2?)

BUG Manfred Spraul 2 participants 2 messages Aug 8, 2004

lore
Share & tools
lore
#0 lore raw
Quoted 7 lines · rmk

Due to tail call optimisation, its difficult to work out exactly what's going on, but the first seems to be a kfree call from the erase callback (possibly jffs2_erase_callback). The second function is the call to jffs2_free_full_dirent() in jffs2_garbage_collect_deletion_dirent().

I'd concentrate on cfi_intelext_erase_varsize+0x58/0x64:
When slab encounters a corruption, it dumps three objects: the corrupted one, the previous one and the next one. Theoretically, a write before/after the end of the object could corrupt the neighboring object, but probably the first function is the relevant one.

Could you double check that gcc did a tail optimization in cfi_intelext_erase_varsize?
I don't understand how this is possible: cfi_intelext_erase_varsize returns (int)0, instr->callback is a void function. And even if there is a tail optimization: how would that affect the call address of the kfree() call? Perhaps gcc automatically inlined something?

--
Manfred

#1 lore raw
Quoted 11 lines · Manfred Spraul
Quoted 4 lines · rmk

Due to tail call optimisation, its difficult to work out exactly what's going on, but the first seems to be a kfree call from the erase callback (possibly jffs2_erase_callback). The second function is the call to jffs2_free_full_dirent() in jffs2_garbage_collect_deletion_dirent().

I'd concentrate on cfi_intelext_erase_varsize+0x58/0x64:
When slab encounters a corruption, it dumps three objects: the corrupted one, the previous one and the next one. Theoretically, a write before/after the end of the object could corrupt the neighboring object, but probably the first function is the relevant one.

Remember - we report the _return_ address of a function when we use __builtin_return_address(0) in that function.

This means that if kfree() is called from a tail-call optimised position, the reported address will be the parent function of the one which actually called it.

Therefore, cfi_intelext_erase_varsize() called some other function (in this case, via a function pointer) which then called kfree() in a tail-call optimised position. jffs2_erase_callback() would be called from this function pointer and does have kfree() in a tail-call optimised position.

However, reading the code around jffs2_erase_callback() and jffs2_erase_block(), I can find nothing obviously wrong.

The main problem is that I don't actually know what triggered it in the first place - I'd just booted the machine and was just logging in when it poped up, but repeating this does not cause the problem.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core