Skip to contentSkip to conversation

fs/aio: A possible sleep-in-atomic bug in aio_migratepage

BUG Jia-Ju Bai 2 participants 2 messages Oct 7, 2017 VFS

lore
Share & tools
lore

Jia-Ju Bai

author
#0 lore raw

According to fs/aio.c, cond_resched is called under a spinlock, and the function call path is:
aio_migratepage (acquire the spinlock)
migrate_page_copy
copy_huge_page
__copy_gigantic_page
cond_resched
might_sleep

This bug is found by my static analysis tool and my code review. A possible fix is to remove cond_resched in __copy_gigantic_page.

Thanks,
Jia-Ju Bai

maintainer
#1 lore raw
Quoted 11 lines · Jia-Ju Bai

According to fs/aio.c, cond_resched is called under a spinlock, and the function call path is:
aio_migratepage (acquire the spinlock)
migrate_page_copy
copy_huge_page
__copy_gigantic_page
cond_resched
might_sleep

This bug is found by my static analysis tool and my code review. A possible fix is to remove cond_resched in __copy_gigantic_page.

How the hell would a huge page end up in page cache of inode created by aio_private_file()???