Skip to content

Commit 338dcaf

Browse files
torvaldsgregkh
authored andcommitted
vm: make stack guard page errors return VM_FAULT_SIGSEGV rather than SIGBUS
commit 9c145c5 upstream. The stack guard page error case has long incorrectly caused a SIGBUS rather than a SIGSEGV, but nobody actually noticed until commit fee7e49 ("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. Reported-and-tested-by: Takashi Iwai <tiwai@suse.de> Tested-by: Jan Engelhardt <jengelh@inai.de> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> # "s390 still compiles and boots" Cc: linux-arch@vger.kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4c0720f commit 338dcaf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎mm/memory.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2645,7 +2645,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
26452645

26462646
/* Check if we need to add a guard page to the stack */
26472647
if (check_stack_guard_page(vma, address) < 0)
2648-
return VM_FAULT_SIGBUS;
2648+
return VM_FAULT_SIGSEGV;
26492649

26502650
/* Use the zero-page for reads */
26512651
if (!(flags & FAULT_FLAG_WRITE)) {

0 commit comments

Comments
 (0)