From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753329AbdDLHhX (ORCPT ); Wed, 12 Apr 2017 03:37:23 -0400 Received: from terminus.zytor.com ([65.50.211.136]:34725 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752547AbdDLHhT (ORCPT ); Wed, 12 Apr 2017 03:37:19 -0400 Date: Wed, 12 Apr 2017 00:31:29 -0700 From: tip-bot for Joerg Roedel Message-ID: Cc: dvlasenk@redhat.com, shuah@kernel.org, hpa@zytor.com, peterz@infradead.org, bp@alien8.de, torvalds@linux-foundation.org, dave.hansen@linux.intel.com, jroedel@suse.de, brgerst@gmail.com, linux-kernel@vger.kernel.org, mingo@kernel.org, luto@kernel.org, tglx@linutronix.de, jpoimboe@redhat.com Reply-To: tglx@linutronix.de, linux-kernel@vger.kernel.org, luto@kernel.org, mingo@kernel.org, brgerst@gmail.com, jpoimboe@redhat.com, dave.hansen@linux.intel.com, jroedel@suse.de, peterz@infradead.org, bp@alien8.de, torvalds@linux-foundation.org, dvlasenk@redhat.com, shuah@kernel.org, hpa@zytor.com In-Reply-To: <1491488598-27346-1-git-send-email-joro@8bytes.org> References: <1491488598-27346-1-git-send-email-joro@8bytes.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/mm] x86/mpx, selftests: Only check bounds-vs-shadow when we keep shadow Git-Commit-ID: 5f2173e056b2a5c215b862f136192744c447844e X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 5f2173e056b2a5c215b862f136192744c447844e Gitweb: http://git.kernel.org/tip/5f2173e056b2a5c215b862f136192744c447844e Author: Joerg Roedel AuthorDate: Thu, 6 Apr 2017 16:23:18 +0200 Committer: Ingo Molnar CommitDate: Wed, 12 Apr 2017 08:40:59 +0200 x86/mpx, selftests: Only check bounds-vs-shadow when we keep shadow The check between the hardware state and our shadow of it is checked in the signal handler for all bounds exceptions, even for the ones where we don't keep the shadow up2date. This is a problem because when no shadow is kept the handler fails at this point and hides the real reason of the exception. Move the check into the code-path evaluating normal bounds exceptions to prevent this. Signed-off-by: Joerg Roedel Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dave Hansen Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Shuah Khan Cc: Thomas Gleixner Cc: linux-kselftest@vger.kernel.org Link: http://lkml.kernel.org/r/1491488598-27346-1-git-send-email-joro@8bytes.org Signed-off-by: Ingo Molnar --- tools/testing/selftests/x86/mpx-mini-test.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/x86/mpx-mini-test.c b/tools/testing/selftests/x86/mpx-mini-test.c index 616ee96..a8df159 100644 --- a/tools/testing/selftests/x86/mpx-mini-test.c +++ b/tools/testing/selftests/x86/mpx-mini-test.c @@ -404,8 +404,6 @@ void handler(int signum, siginfo_t *si, void *vucontext) dprintf2("info->si_lower: %p\n", __si_bounds_lower(si)); dprintf2("info->si_upper: %p\n", __si_bounds_upper(si)); - check_siginfo_vs_shadow(si); - for (i = 0; i < 8; i++) dprintf3("[%d]: %p\n", i, si_addr_ptr[i]); switch (br_reason) { @@ -416,6 +414,9 @@ void handler(int signum, siginfo_t *si, void *vucontext) exit(5); case 1: /* #BR MPX bounds exception */ /* these are normal and we expect to see them */ + + check_siginfo_vs_shadow(si); + dprintf1("bounds exception (normal): status 0x%jx at %p si_addr: %p\n", status, (void *)ip, si->si_addr); num_bnd_chk++;