From: mbenes at suse.cz (Miroslav Benes) Subject: [PATCH v3] selftests/livepatch: introduce tests Date: Mon, 16 Apr 2018 13:33:55 +0200 (CEST) [thread overview] Message-ID: <alpine.LSU.2.21.1804161329040.23118@pobox.suse.cz> (raw) In-Reply-To: <c9f4b440-c672-e45f-ddcc-63548b0411e2@redhat.com> On Fri, 13 Apr 2018, Joe Lawrence wrote: > On 04/13/2018 07:20 AM, Miroslav Benes wrote: > > Hi, > > > > On Thu, 12 Apr 2018, Joe Lawrence wrote: > > > >> Add a few livepatch modules and simple target modules that the included > >> regression suite can run tests against. > > > > Could you include a brief description which features are tested? > > I can add this to the commit msg: > > - basic livepatching (multiple patches, atomic replace) > - pre/post (un)patch callbacks > - shadow variable API > > Or do you prefer a little more detail? That would suffice. Thanks. > > > >> Signed-off-by: Joe Lawrence <joe.lawrence at redhat.com> > >> --- > > > >> diff --git a/lib/livepatch/test_klp_shadow_vars.c b/lib/livepatch/test_klp_shadow_vars.c > >> new file mode 100644 > >> index 000000000000..18c75b21cb9e > >> --- /dev/null > >> +++ b/lib/livepatch/test_klp_shadow_vars.c > >> > >> +/* > >> + * Shadow variable wrapper functions that echo the function and arguments > >> + * to the kernel log for testing verification. Don't display raw pointers, > >> + * but use the ptr_id() value instead. > >> + */ > >> +void *shadow_get(void *obj, unsigned long id) > >> +{ > >> + void *ret = klp_shadow_get(obj, id); > >> + > >> + pr_info("klp_%s(obj=PTR%d, id=0x%lx) = PTR%d\n", > >> + __func__, ptr_id(obj), id, ptr_id(ret)); > >> + > >> + return ret; > >> +} > > > >> +void shadow_free(void *obj, unsigned long id, klp_shadow_dtor_t dtor) > >> +{ > >> + klp_shadow_free(obj, id, dtor); > >> + pr_info("klp_%s(obj=PTR%d, id=0x%lx, dtor=PTR%d)\n", > >> + __func__, ptr_id(obj), id, ptr_id(dtor)); > >> +} > > > > Sparse (make C=1) would be happier with those two being static. > > Ah right. I wonder why the kbuild test robot didn't complain about > those, too. Easy enough to fix up, thanks. > > > Otherwise it works as expected. Good job! > > Thanks for reviewing. I'll hold off on posting v4 until Petr (and > others) get a chance to comment. Perhaps there are other tests that > would be helpful? I think it would be useful to have tests for a stack checking and a consistency. Nicolai has written some lately for our internal testing, but it would take some time to transform them appropriately, I think. So I would start with this and we can add more later. I would also establish a (soft) rule to submit selftests with new features. Miroslav -- To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: mbenes@suse.cz (Miroslav Benes) Subject: [PATCH v3] selftests/livepatch: introduce tests Date: Mon, 16 Apr 2018 13:33:55 +0200 (CEST) [thread overview] Message-ID: <alpine.LSU.2.21.1804161329040.23118@pobox.suse.cz> (raw) Message-ID: <20180416113355.XHZMqrCk_LEP7WH3Snf8kO3Umj_P_kg771ivODQlSPw@z> (raw) In-Reply-To: <c9f4b440-c672-e45f-ddcc-63548b0411e2@redhat.com> On Fri, 13 Apr 2018, Joe Lawrence wrote: > On 04/13/2018 07:20 AM, Miroslav Benes wrote: > > Hi, > > > > On Thu, 12 Apr 2018, Joe Lawrence wrote: > > > >> Add a few livepatch modules and simple target modules that the included > >> regression suite can run tests against. > > > > Could you include a brief description which features are tested? > > I can add this to the commit msg: > > - basic livepatching (multiple patches, atomic replace) > - pre/post (un)patch callbacks > - shadow variable API > > Or do you prefer a little more detail? That would suffice. Thanks. > > > >> Signed-off-by: Joe Lawrence <joe.lawrence at redhat.com> > >> --- > > > >> diff --git a/lib/livepatch/test_klp_shadow_vars.c b/lib/livepatch/test_klp_shadow_vars.c > >> new file mode 100644 > >> index 000000000000..18c75b21cb9e > >> --- /dev/null > >> +++ b/lib/livepatch/test_klp_shadow_vars.c > >> > >> +/* > >> + * Shadow variable wrapper functions that echo the function and arguments > >> + * to the kernel log for testing verification. Don't display raw pointers, > >> + * but use the ptr_id() value instead. > >> + */ > >> +void *shadow_get(void *obj, unsigned long id) > >> +{ > >> + void *ret = klp_shadow_get(obj, id); > >> + > >> + pr_info("klp_%s(obj=PTR%d, id=0x%lx) = PTR%d\n", > >> + __func__, ptr_id(obj), id, ptr_id(ret)); > >> + > >> + return ret; > >> +} > > > >> +void shadow_free(void *obj, unsigned long id, klp_shadow_dtor_t dtor) > >> +{ > >> + klp_shadow_free(obj, id, dtor); > >> + pr_info("klp_%s(obj=PTR%d, id=0x%lx, dtor=PTR%d)\n", > >> + __func__, ptr_id(obj), id, ptr_id(dtor)); > >> +} > > > > Sparse (make C=1) would be happier with those two being static. > > Ah right. I wonder why the kbuild test robot didn't complain about > those, too. Easy enough to fix up, thanks. > > > Otherwise it works as expected. Good job! > > Thanks for reviewing. I'll hold off on posting v4 until Petr (and > others) get a chance to comment. Perhaps there are other tests that > would be helpful? I think it would be useful to have tests for a stack checking and a consistency. Nicolai has written some lately for our internal testing, but it would take some time to transform them appropriately, I think. So I would start with this and we can add more later. I would also establish a (soft) rule to submit selftests with new features. Miroslav -- To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-04-16 11:33 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-04-12 14:54 [PATCH v3] Add livepatch kselftests joe.lawrence 2018-04-12 14:54 ` Joe Lawrence 2018-04-12 14:54 ` [PATCH v3] selftests/livepatch: introduce tests joe.lawrence 2018-04-12 14:54 ` Joe Lawrence 2018-04-12 21:36 ` jpoimboe 2018-04-12 21:36 ` Josh Poimboeuf 2018-04-13 11:20 ` mbenes 2018-04-13 11:20 ` Miroslav Benes 2018-04-13 20:52 ` joe.lawrence 2018-04-13 20:52 ` Joe Lawrence 2018-04-16 11:33 ` mbenes [this message] 2018-04-16 11:33 ` Miroslav Benes 2018-04-16 15:02 ` pmladek 2018-04-16 15:02 ` Petr Mladek 2018-04-17 8:06 ` mbenes 2018-04-17 8:06 ` Miroslav Benes 2018-04-17 13:25 ` joe.lawrence 2018-04-17 13:25 ` Joe Lawrence 2018-04-16 12:49 ` pmladek 2018-04-16 12:49 ` Petr Mladek 2018-04-20 12:56 ` lpechacek 2018-04-20 12:56 ` Libor Pechacek 2018-04-23 14:43 ` joe.lawrence 2018-04-23 14:43 ` Joe Lawrence 2018-04-24 15:50 ` joe.lawrence 2018-04-24 15:50 ` Joe Lawrence 2018-04-24 17:19 ` lpechacek 2018-04-24 17:19 ` Libor Pechacek 2018-04-24 17:35 ` lpechacek 2018-04-24 17:35 ` Libor Pechacek
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=alpine.LSU.2.21.1804161329040.23118@pobox.suse.cz \ --to=linux-kselftest@vger.kernel.org \ /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: linkBe 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; as well as URLs for NNTP newsgroup(s).