selftests/x86: Do not rely on "int $0x80" in test_mremap_vdso.c

"Linux Kernel Mailing List" <[email protected]> Thu, 15 Feb 2018 01:31:43 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/2cbc0d66de0480449c75636f55697c7ff3af61fc
Commit:     2cbc0d66de0480449c75636f55697c7ff3af61fc
Parent:     7f95122067ab26fb8344b2a9de64ffbd0fea0010
Refname:    refs/heads/master
Author:     Dominik Brodowski <[email protected]>
AuthorDate: Sun Feb 11 12:10:11 2018 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue Feb 13 09:05:37 2018 +0100

    selftests/x86: Do not rely on "int $0x80" in test_mremap_vdso.c
    
    On 64-bit builds, we should not rely on "int $0x80" working (it only does if
    CONFIG_IA32_EMULATION=y is enabled).
    
    Without this patch, the move test may succeed, but the "int $0x80" causes
    a segfault, resulting in a false negative output of this self-test.
    
    Signed-off-by: Dominik Brodowski <[email protected]>
    Cc: Andy Lutomirski <[email protected]>
    Cc: Dmitry Safonov <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Link: http://lkml.kernel.org/r/[email protected]
    Signed-off-by: Ingo Molnar <[email protected]>
---
 tools/testing/selftests/x86/test_mremap_vdso.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/x86/test_mremap_vdso.c b/tools/testing/selftests/x86/test_mremap_vdso.c
index bf0d687c7db7..64f11c8d9b76 100644
--- a/tools/testing/selftests/x86/test_mremap_vdso.c
+++ b/tools/testing/selftests/x86/test_mremap_vdso.c
@@ -90,8 +90,12 @@ int main(int argc, char **argv, char **envp)
 			vdso_size += PAGE_SIZE;
 		}
 
+#ifdef __i386__
 		/* Glibc is likely to explode now - exit with raw syscall */
 		asm volatile ("int $0x80" : : "a" (__NR_exit), "b" (!!ret));
+#else /* __x86_64__ */
+		syscall(SYS_exit, ret);
+#endif
 	} else {
 		int status;
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html