Messages in this thread | | | Date | Wed, 9 Feb 2022 15:44:41 -0800 | From | Ira Weiny <> | Subject | Re: [PATCH V8 13/44] mm/pkeys: Add initial PKS Test code |
| |
On Mon, Jan 31, 2022 at 11:30:14AM -0800, Edgecombe, Rick P wrote: > 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?
Not a bad idea. Although if someone is running this they are most likely not concerned with it.
> > > +} > > snip > > > + > > +static void __exit pks_test_exit(void) > > +{ > > + debugfs_remove(pks_test_dentry); > > + pr_info("test exit\n"); > > +} > > How does this get called?
Left over from when this was a module. Thanks for catching.
Ira
| |