From: Daniel Latypov <dlatypov@google.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: "Kees Cook" <keescook@chromium.org>,
"Eric Biederman" <ebiederm@xmission.com>,
"David Gow" <davidgow@google.com>,
"Alexey Dobriyan" <adobriyan@gmail.com>,
"Magnus Groß" <magnus.gross@rwth-aachen.de>,
kunit-dev@googlegroups.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH] binfmt_elf: Introduce KUnit test
Date: Mon, 28 Feb 2022 22:42:51 -0800 [thread overview]
Message-ID: <CAGS_qxprS1e_f_K6bi-RvVESoPJ2yQgQVszcmcRFq_VQWduyAA@mail.gmail.com> (raw)
In-Reply-To: <20220228232131.4b9cee32@rorschach.local.home>
On Mon, Feb 28, 2022 at 8:21 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Mon, 28 Feb 2022 17:48:27 -0800
> Daniel Latypov <dlatypov@google.com> wrote:
>
> > He also prototyped a more intrusive alternative to using ftrace and
> > kernel livepatch since they don't work on all arches, like UML.
>
> Perhaps instead of working on a intrusive alternative on archs that do
> not support live kernel patching, implement live kernel patching on
> those archs! ;-)
>
> It's probably the same amount of work. Well, really, you only need to
> implement the klp_arch_set_pc(fregs, new_function); part.
Yeah, that's the only bit we'd need to get working.
I called this out in "Open questions:" bit on
https://kunit-review.googlesource.com/c/linux/+/5109
As for the amount of work, I know how to do KUnit-y things, I have no
idea how to do livepatch things :)
Also, we're not aiming for something as "magic" as the ftrace one.
David's patch is here: https://kunit-review.googlesource.com/c/linux/+/5129
Here's a snippet from the example in that one:
static int add_one(int i)
{
/* This will trigger the stub if active. */
KUNIT_TRIGGER_STATIC_STUB(add_one, i);
return i + 1;
}
i.e. users just add this one macro in with <func> and <args>.
It internally expands to roughly
if (<check if current test has registered a replacement>)
<invoke replacement with <args>
So it's all quite simple.
But it'd definitely be interesting to try and get klp_arch_set_pc()
working on UML if that's a possibility!
Speaking from ignorance, I can see this either being somewhat simple
or very painful.
>
> -- Steve
next prev parent reply other threads:[~2022-03-01 6:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-24 5:43 Kees Cook
2022-02-24 6:07 ` Daniel Latypov
2022-02-24 6:13 ` Kees Cook
2022-02-24 7:57 ` David Gow
2022-02-24 14:15 ` Steven Rostedt
2022-03-01 1:48 ` Daniel Latypov
2022-03-01 3:17 ` Kees Cook
2022-03-01 4:21 ` Steven Rostedt
2022-03-01 6:42 ` Daniel Latypov [this message]
2022-03-01 15:06 ` Steven Rostedt
2022-02-24 7:41 ` David Gow
2022-02-24 9:45 ` Alexey Dobriyan
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=CAGS_qxprS1e_f_K6bi-RvVESoPJ2yQgQVszcmcRFq_VQWduyAA@mail.gmail.com \
--to=dlatypov@google.com \
--cc=adobriyan@gmail.com \
--cc=davidgow@google.com \
--cc=ebiederm@xmission.com \
--cc=keescook@chromium.org \
--cc=kunit-dev@googlegroups.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=magnus.gross@rwth-aachen.de \
--cc=rostedt@goodmis.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: 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