The patch titled Subject: mm/gup.c: remove some BUG_ONs from get_gate_page() has been added to the -mm tree. Its filename is mm-gup-remove-some-bug_ons-from-get_gate_page.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-gup-remove-some-bug_ons-from-get_gate_page.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-gup-remove-some-bug_ons-from-get_gate_page.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andy Lutomirski <luto@xxxxxxxxxx> Subject: mm/gup.c: remove some BUG_ONs from get_gate_page() If we end up without a PGD or PUD entry backing the gate area, don't BUG -- just fail gracefully. It's not entirely implausible that this could happen some day on x86. It doesn't right now even with an execute-only emulated vsyscall page because the fixmap shares the PUD, but the core mm code shouldn't rely on that particular detail to avoid OOPSing. Link: http://lkml.kernel.org/r/a1d9f4efb75b9d464e59fd6af00104b21c58f6f7.1561610798.git.luto@xxxxxxxxxx Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxx> Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Florian Weimer <fweimer@xxxxxxxxxx> Cc: Jann Horn <jannh@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/gup.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/mm/gup.c~mm-gup-remove-some-bug_ons-from-get_gate_page +++ a/mm/gup.c @@ -586,11 +586,14 @@ static int get_gate_page(struct mm_struc pgd = pgd_offset_k(address); else pgd = pgd_offset_gate(mm, address); - BUG_ON(pgd_none(*pgd)); + if (pgd_none(*pgd)) + return -EFAULT; p4d = p4d_offset(pgd, address); - BUG_ON(p4d_none(*p4d)); + if (p4d_none(*p4d)) + return -EFAULT; pud = pud_offset(p4d, address); - BUG_ON(pud_none(*pud)); + if (pud_none(*pud)) + return -EFAULT; pmd = pmd_offset(pud, address); if (!pmd_present(*pmd)) return -EFAULT; _ Patches currently in -mm which might be from luto@xxxxxxxxxx are mm-gup-remove-some-bug_ons-from-get_gate_page.patch