Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm/gup: Let __get_user_pages_locked() return -EINTR for fatal signal

__get_user_pages_locked() will return 0 instead of -EINTR after commit
4426e945df588 ("mm/gup: allow VM_FAULT_RETRY for multiple times") which
added extra code to allow gup detect fatal signal faster.

Restore the original -EINTR behavior.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: 4426e945df58 ("mm/gup: allow VM_FAULT_RETRY for multiple times")
Reported-by: syzbot+3be1a33f04dc782e9fd5@syzkaller.appspotmail.com
Signed-off-by: Hillf Danton <hdanton@sina.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Hillf Danton and committed by
Linus Torvalds
ae46d2aa f5e94d10

+4 -1
+4 -1
mm/gup.c
··· 1326 1326 * start trying again otherwise it can loop forever. 1327 1327 */ 1328 1328 1329 - if (fatal_signal_pending(current)) 1329 + if (fatal_signal_pending(current)) { 1330 + if (!pages_done) 1331 + pages_done = -EINTR; 1330 1332 break; 1333 + } 1331 1334 1332 1335 ret = down_read_killable(&mm->mmap_sem); 1333 1336 if (ret) {