History

vm: make stack guard page errors return VM_FAULT_SIGSEGV rather than SIGBUS

The stack guard page error case has long incorrectly caused a SIGBUS rather than a SIGSEGV, but nobody actually noticed until commit fee7e49d4514 ("mm: propagate error from stack expansion even for guard page") because that error case was never actually triggered in any normal situations. Now that we actually report the error, people noticed the wrong signal that resulted. So far, only the test suite of libsigsegv seems to have actually cared, but there are real applications that use libsigsegv, so let's not wait for any of those to break.

Linus Torvalds committed 11 years ago

Commit 9c145c51 parent 33692f21 file · +1 −1Browse files

Unified · Split

mm/memory.c+1−1
@@ -2632,7 +2632,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, · 2631 unmodified lines
26322632
26332633 /* Check if we need to add a guard page to the stack */
26342634 if (check_stack_guard_page(vma, address) < 0)
2635− return VM_FAULT_SIGBUS;
2635+ return VM_FAULT_SIGSEGV;
26362636
26372637 /* Use the zero-page for reads */
26382638 if (!(flags & FAULT_FLAG_WRITE) && !mm_forbids_zeropage(mm)) {