linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] mm: truncate: a possible sleep-in-atomic-context bug in truncate_exceptional_pvec_entries()
@ 2018-08-13  3:10 Jia-Ju Bai
  2018-08-13  8:56 ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: Jia-Ju Bai @ 2018-08-13  3:10 UTC (permalink / raw)
  To: akpm, jack, mgorman, ak, mawilcox, viro, mawilcox, ross.zwisler
  Cc: linux-mm, linux-kernel, linux-fsdevel

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 in get_unlocked_mapping_entry
fs/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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] mm: truncate: a possible sleep-in-atomic-context bug in truncate_exceptional_pvec_entries()
  2018-08-13  3:10 [BUG] mm: truncate: a possible sleep-in-atomic-context bug in truncate_exceptional_pvec_entries() Jia-Ju Bai
@ 2018-08-13  8:56 ` Jan Kara
  2018-08-13  9:30   ` Jia-Ju Bai
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2018-08-13  8:56 UTC (permalink / raw)
  To: Jia-Ju Bai
  Cc: akpm, jack, mgorman, ak, mawilcox, viro, ross.zwisler, linux-mm,
	linux-kernel, linux-fsdevel

Hi,

On Mon 13-08-18 11:10:23, Jia-Ju Bai wrote:
> 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 in get_unlocked_mapping_entry
> fs/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 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

-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] mm: truncate: a possible sleep-in-atomic-context bug in truncate_exceptional_pvec_entries()
  2018-08-13  8:56 ` Jan Kara
@ 2018-08-13  9:30   ` Jia-Ju Bai
  0 siblings, 0 replies; 3+ messages in thread
From: Jia-Ju Bai @ 2018-08-13  9:30 UTC (permalink / raw)
  To: Jan Kara
  Cc: akpm, mgorman, ak, mawilcox, viro, ross.zwisler, linux-mm,
	linux-kernel, linux-fsdevel



On 2018/8/13 16:56, Jan Kara wrote:
> Hi,
>
> On Mon 13-08-18 11:10:23, Jia-Ju Bai wrote:
>> 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 in get_unlocked_mapping_entry
>> fs/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 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-13  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-13  3:10 [BUG] mm: truncate: a possible sleep-in-atomic-context bug in truncate_exceptional_pvec_entries() Jia-Ju Bai
2018-08-13  8:56 ` Jan Kara
2018-08-13  9:30   ` Jia-Ju Bai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).