From b1b706453f3761d4aa927c6f9b124d74abb8670a Mon Sep 17 00:00:00 2001 From: NAKAMURA Gou Date: Wed, 16 Sep 2015 13:14:18 +0900 Subject: [PATCH] vsyscall: send SIGSEGV to the caller if syscall fails On CentOS 7 (RHEL 7?), "errno" isn't set when vsyscall_gettimeofday fails. So, in such case, vsyscall_gettimeofday send SIGSEGV to the caller to report failure of gettimeofday operation. --- arch/x86/kernel/vsyscall.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kernel/vsyscall.c b/arch/x86/kernel/vsyscall.c index c4e3dd1e..40cfe21d 100644 --- a/arch/x86/kernel/vsyscall.c +++ b/arch/x86/kernel/vsyscall.c @@ -30,6 +30,9 @@ int vsyscall_gettimeofday(void *tv, void *tz) : "a" (__NR_gettimeofday), "D" (tv), "S" (tz) : "%rcx", "%r11", "memory"); + if (error) { + *(int *)0 = 0; /* i.e. raise(SIGSEGV) */ + } return error; }