x86/mpx, selftests: Only check bounds-vs-shadow when we keep shadow
PATCH 1/1 x86/mpx, selftests: Only check bounds-vs-shadow when we keep shadow
From: Joerg Roedel <[email protected]>
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.
--- tools/testing/selftests/x86/mpx-mini-test.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/x86/mpx-mini-test.c +3 -2
@@ -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++;
Signature · 1 line
1.9.1
tip-bot for Joerg Roedel
merge botx86/mpx, selftests: Only check bounds-vs-shadow when we keep shadow
Commit-ID: 5f2173e056b2a5c215b862f136192744c447844e Gitweb: http://git.kernel.org/tip/5f2173e056b2a5c215b862f136192744c447844e Author: Joerg Roedel <[email protected]> AuthorDate: Thu, 6 Apr 2017 16:23:18 +0200 Committer: Ingo Molnar <[email protected]> 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.
--- tools/testing/selftests/x86/mpx-mini-test.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/x86/mpx-mini-test.c +3 -2
@@ -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++;
Quoted 11 lines · Joerg Roedel
From: Joerg Roedel <[email protected]>
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.
Looks good to me.