lkml.org 
[lkml]   [2022]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH V8 13/44] mm/pkeys: Add initial PKS Test code
Date
On Thu, 2022-01-27 at 09:54 -0800, ira.weiny@intel.com wrote:
> +static void crash_it(void)
> +{
> + struct pks_test_ctx *ctx;
> + void *ptr;
> +
> + pr_warn(" ***** BEGIN: Unhandled fault test *****\n");
> +
> + ctx = alloc_ctx(PKS_KEY_TEST);
> + if (IS_ERR(ctx)) {
> + pr_err("Failed to allocate context???\n");
> + return;
> + }
> +
> + ptr = alloc_test_page(ctx->pkey);
> + if (!ptr) {
> + pr_err("Failed to vmalloc page???\n");
> + return;
> + }
> +
> + /* This purposely faults */
> + memcpy(ptr, ctx->data, 8);
> +
> + /* Should never get here if so the test failed */
> + last_test_pass = false;
> +
> + vfree(ptr);
> + free_ctx(ctx);

So these only gets cleaned up if the test fails? Could you clean them
up in pks_release_file() like the later test patch?

> +}

snip

> +
> +static void __exit pks_test_exit(void)
> +{
> + debugfs_remove(pks_test_dentry);
> + pr_info("test exit\n");
> +}

How does this get called?
\
 
 \ /
  Last update: 2022-01-31 20:30    [W:0.625 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site