lkml.org 
[lkml]   [2022]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH V8 30/44] mm/pkeys: Test setting a PKS key in a custom fault callback
Date
On Thu, 2022-01-27 at 09:54 -0800, ira.weiny@intel.com wrote:
> Add a test which does this.
>
> $ echo 5 > /sys/kernel/debug/x86/run_pks
> $ cat /sys/kernel/debug/x86/run_pks
> PASS

Hmm, when I run this on qemu TCG, I get:

root@(none):/# echo 5 > /sys/kernel/debug/x86/run_pks
[ 29.438159] pks_test: Failed to see the callback
root@(none):/# cat /sys/kernel/debug/x86/run_pks
FAIL

I think it's a problem with the test though. The generated code is not
expecting fault_callback_ctx.callback_seen to get changed in the
exception. The following fixed it for me:

diff --git a/lib/pks/pks_test.c b/lib/pks/pks_test.c
index 1528df0bb283..d979d2afe921 100644
--- a/lib/pks/pks_test.c
+++ b/lib/pks/pks_test.c
@@ -570,6 +570,7 @@ static bool run_fault_clear_test(void)
/* fault */
memcpy(test_page, ctx->data, 8);

+ barrier();
if (!fault_callback_ctx.callback_seen) {
pr_err("Failed to see the callback\n");
rc = false;
But, I wonder if volatile is also needed on the read to be fully
correct. I usually have to consult the docs when I deal with that
stuff...
\
 
 \ /
  Last update: 2022-02-01 01:56    [W:0.310 / U:0.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site