From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, KVM list <kvm@vger.kernel.org>
Subject: [PATCH 3/3] KVM test: add test case to trigger the bug which cause hugepage mapping corrupt
Date: Fri, 23 Jul 2010 13:07:49 +0800 [thread overview]
Message-ID: <4C4923A5.9070505@cn.fujitsu.com> (raw)
In-Reply-To: <4C4922BD.6090502@cn.fujitsu.com>
The test case can trigger the bug that fixed by commit e09e90a5 in the kvm tree
to avoid regression
Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
---
kvm/test/x86/access.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/kvm/test/x86/access.c b/kvm/test/x86/access.c
index be51a55..a833df5 100644
--- a/kvm/test/x86/access.c
+++ b/kvm/test/x86/access.c
@@ -629,6 +629,49 @@ static void ac_test_show(ac_test_t *at)
printf("%s", line);
}
+/*
+ * This test case is used to triger the bug which is fixed by
+ * commit e09e90a5 in the kvm tree
+ */
+static int corrupt_hugepage_triger(ac_pool_t *pool)
+{
+ ac_test_t at1, at2;
+
+ ac_test_init(&at1, (void *)(0x123400000000));
+ ac_test_init(&at2, (void *)(0x666600000000));
+
+ at2.flags[AC_CPU_CR0_WP] = 1;
+ at2.flags[AC_PDE_PSE] = 1;
+ at2.flags[AC_PDE_PRESENT] = 1;
+ ac_test_setup_pte(&at2, pool);
+ if (!ac_test_do_access(&at2))
+ goto err;
+
+ at1.flags[AC_CPU_CR0_WP] = 1;
+ at1.flags[AC_PDE_PSE] = 1;
+ at1.flags[AC_PDE_WRITABLE] = 1;
+ at1.flags[AC_PDE_PRESENT] = 1;
+ ac_test_setup_pte(&at1, pool);
+ if (!ac_test_do_access(&at1))
+ goto err;
+
+ at1.flags[AC_ACCESS_WRITE] = 1;
+ ac_set_expected_status(&at1);
+ if (!ac_test_do_access(&at1))
+ goto err;
+
+ at2.flags[AC_ACCESS_WRITE] = 1;
+ ac_set_expected_status(&at2);
+ if (!ac_test_do_access(&at2))
+ goto err;
+
+ return 1;
+
+err:
+ printf("corrupt_hugepage_triger test fail\n");
+ return 0;
+}
+
int ac_test_exec(ac_test_t *at, ac_pool_t *pool)
{
int r;
@@ -656,6 +699,9 @@ int ac_test_run(void)
successes += ac_test_exec(&at, &pool);
} while (ac_test_bump(&at));
+ ++tests;
+ successes += corrupt_hugepage_triger(&pool);
+
printf("\n%d tests, %d failures\n", tests, tests - successes);
return successes == tests;
--
1.6.1.2
next prev parent reply other threads:[~2010-07-23 5:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-23 4:59 [PATCH 1/3] KVM test: separate expect status updates from ac_test_setup_pte() function Xiao Guangrong
2010-07-23 5:03 ` [PATCH 2/3] KVM test: separate pool from ac_test_t struct Xiao Guangrong
2010-07-23 5:07 ` Xiao Guangrong [this message]
2010-07-27 21:14 ` [PATCH 1/3] KVM test: separate expect status updates from ac_test_setup_pte() function Marcelo Tosatti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C4923A5.9070505@cn.fujitsu.com \
--to=xiaoguangrong@cn.fujitsu.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox