mm: truncate: a possible sleep-in-atomic-context bug in truncate_exceptional_pvec_entries()
Subsystems (2)
The kernel may sleep with holding a spinlock.
The function call paths (from bottom to top) in Linux-4.16 are:
[FUNC] schedulefs/dax.c, 259: schedule in get_unlocked_mapping_entryfs/dax.c, 450: get_unlocked_mapping_entry in __dax_invalidate_mapping_entry fs/dax.c, 471: __dax_invalidate_mapping_entry in dax_delete_mapping_entry mm/truncate.c, 97: dax_delete_mapping_entry in truncate_exceptional_pvec_entries mm/truncate.c, 82: spin_lock_irq in truncate_exceptional_pvec_entries
I do not find a good way to fix, so I only report. This is found by my static analysis tool (DSAC).
Thanks,
Jia-Ju Bai
Jan Kara
reviewerHi,
Quoted 12 lines · Jia-Ju Bai
The kernel may sleep with holding a spinlock.
The function call paths (from bottom to top) in Linux-4.16 are:
[FUNC] schedule
fs/dax.c, 259: schedule inget_unlocked_mapping_entryfs/dax.c, 450:get_unlocked_mapping_entryin__dax_invalidate_mapping_entryfs/dax.c, 471:__dax_invalidate_mapping_entryindax_delete_mapping_entrymm/truncate.c, 97:dax_delete_mapping_entryintruncate_exceptional_pvec_entriesmm/truncate.c, 82:spin_lock_irqintruncate_exceptional_pvec_entries
Quoted 2 lines
I do not find a good way to fix, so I only report. This is found by my static analysis tool (DSAC).
Thanks for report but this is a false positive. Note that the lock is acquired only if we are not operating on DAX mapping but we can get to dax_delete_mapping_entry() only if we are operating on DAX mapping.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Quoted 15 lines · Jan Kara
Hi,
Quoted 12 lines · Jia-Ju Bai
The kernel may sleep with holding a spinlock.
The function call paths (from bottom to top) in Linux-4.16 are:
[FUNC] schedule
fs/dax.c, 259: schedule inget_unlocked_mapping_entryfs/dax.c, 450:get_unlocked_mapping_entryin__dax_invalidate_mapping_entryfs/dax.c, 471:__dax_invalidate_mapping_entryindax_delete_mapping_entrymm/truncate.c, 97:dax_delete_mapping_entryintruncate_exceptional_pvec_entriesmm/truncate.c, 82:spin_lock_irqintruncate_exceptional_pvec_entries
Quoted 5 lines
Quoted 2 lines
I do not find a good way to fix, so I only report. This is found by my static analysis tool (DSAC).
Thanks for report but this is a false positive. Note that the lock is acquired only if we are not operating on DAX mapping but we can get to
dax_delete_mapping_entry()only if we are operating on DAX mapping.
Thanks for your reply :)
My tool does not well check the path condition here... Sorry for this false report.
Best wishes,
Jia-Ju Bai