Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754336AbbGFMpG (ORCPT ); Mon, 6 Jul 2015 08:45:06 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:35142 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754562AbbGFMpA (ORCPT ); Mon, 6 Jul 2015 08:45:00 -0400 Date: Mon, 6 Jul 2015 14:44:55 +0200 From: Ingo Molnar To: Denys Vlasenko Cc: Linus Torvalds , Steven Rostedt , Borislav Petkov , "H. Peter Anvin" , Andy Lutomirski , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , x86@kernel.org, linux-kernel@vger.kernel.org, Shuah Khan Subject: Re: [PATCH v3 RESEND] x86/asm/entry/32, selftests: Add test_syscall_vdso test Message-ID: <20150706124455.GA10784@gmail.com> References: <1435953772-1446-1-git-send-email-dvlasenk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1435953772-1446-1-git-send-email-dvlasenk@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3581 Lines: 93 * Denys Vlasenko wrote: > The test checks that all registers are preserved across > 32-bit syscalls. It tests syscalls through VDSO > (if available) and through INT 0x80, normally > and under ptrace. > > If kernel is a 64-bit one, high registers (r8..r15) are poisoned > before call and checked afterwards. They must be either preserved, > or cleared to zero (but r11 is special); r12..15 must be preserved > for INT 0x80. > > EFLAGS is checked for changes too, but change there is not considered > to be a bug (paravirt kernels do not preserve arithmetic flags). > > Run-tested on 64-bit kernel: > > $ ./test_syscall_vdso_32 > [RUN] Executing 6-argument 32-bit syscall via VDSO > [OK] Arguments are preserved across syscall > [NOTE] R11 has changed:0000000000200ed7 - assuming clobbered by SYSRET insn > [OK] R8..R15 did not leak kernel data > [RUN] Executing 6-argument 32-bit syscall via INT 80 > [OK] Arguments are preserved across syscall > [OK] R8..R15 did not leak kernel data > [RUN] Running tests under ptrace > [RUN] Executing 6-argument 32-bit syscall via VDSO > [OK] Arguments are preserved across syscall > [OK] R8..R15 did not leak kernel data > [RUN] Executing 6-argument 32-bit syscall via INT 80 > [OK] Arguments are preserved across syscall > [OK] R8..R15 did not leak kernel data > > On 32-bit paravirt kernel: > > $ ./test_syscall_vdso_32 > [NOTE] Not a 64-bit kernel, won't test R8..R15 leaks > [RUN] Executing 6-argument 32-bit syscall via VDSO > [WARN] Flags before=0000000000200ed7 id 0 00 o d i s z 0 a 0 p 1 c > [WARN] Flags after=0000000000200246 id 0 00 i z 0 0 p 1 > [WARN] Flags change=0000000000000c91 0 00 o d s 0 a 0 0 c > [OK] Arguments are preserved across syscall > [RUN] Executing 6-argument 32-bit syscall via INT 80 > [OK] Arguments are preserved across syscall > [RUN] Running tests under ptrace > [RUN] Executing 6-argument 32-bit syscall via VDSO > [OK] Arguments are preserved across syscall > [RUN] Executing 6-argument 32-bit syscall via INT 80 > [OK] Arguments are preserved across syscall > > Signed-off-by: Denys Vlasenko > CC: Linus Torvalds > CC: Steven Rostedt > CC: Ingo Molnar > CC: Borislav Petkov > CC: "H. Peter Anvin" > CC: Andy Lutomirski > CC: Oleg Nesterov > CC: Frederic Weisbecker > CC: Alexei Starovoitov > CC: Will Drewry > CC: Kees Cook > CC: x86@kernel.org > CC: linux-kernel@vger.kernel.org > --- > > Changes in v2: > does not fail if VDSO can't be found; > tests INT 80 syscall method; > tests syscalls under ptrace; > switched to /* */ comments > > Changes in v3: > added checking for r8..r15 info leaks > > tools/testing/selftests/x86/test_syscall_vdso.c | 401 ++++++++++++++++++++++++ > tools/testing/selftests/x86/thunks_32.S | 55 ++++ > 2 files changed, 456 insertions(+) > create mode 100644 tools/testing/selftests/x86/test_syscall_vdso.c > create mode 100644 tools/testing/selftests/x86/thunks_32.S Hm, what I don't see is any Makefile integration. How am I supposed to build this test, and how will automated tests pick this testcase up? Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/