From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: KP Singh <kpsingh@kernel.org>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
LKML <linux-kernel@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
Borislav Petkov <bp@alien8.de>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Kees Cook <keescook@chromium.org>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Florent Revest <revest@chromium.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Christoph Hellwig <hch@infradead.org>, Chris Mason <clm@meta.com>
Subject: Re: [PATCH v2] panic: Taint kernel if fault injection has been used
Date: Mon, 12 Dec 2022 09:53:33 +0900 [thread overview]
Message-ID: <20221212095333.01599330d97de6c7ddc3eebe@kernel.org> (raw)
In-Reply-To: <CACYkzJ72-hJweZoFN_YN8u3NOmp5x82M2xA-ZKBi5ubt6yrzZA@mail.gmail.com>
Hi,
On Sun, 11 Dec 2022 08:49:01 +0100
KP Singh <kpsingh@kernel.org> wrote:
> 1. Revisit what is allowed for error injection in the kernel and if
> they can cause any subtle issues. My initial take is that functions
> that are directly called from syscall path should generally be okay.
> But let's check them for the patterns you mentioned.
> 2. If it helps, add the list of BPF modify return programs to stack
> traces. Although this is really needed if we don't do [1] properly.
> 3. Check if anything needs to be improved in the verification logic
> for modify return trampolines.
Hmm, I found that bpf might not check the acceptable error type of
each ALLOW_ERROR_INJECTION().
Except for EI_ETYPE_NONE, we have 4 types of the error.
EI_ETYPE_NULL, /* Return NULL if failure */
EI_ETYPE_ERRNO, /* Return -ERRNO if failure */
EI_ETYPE_ERRNO_NULL, /* Return -ERRNO or NULL if failure */
EI_ETYPE_TRUE, /* Return true if failure */
These specifies that what return value will be treated as an error
by the caller.
If bpf trampoline only expect that the function will return -errno
in error cases, bpf should check the error type as below.
etype = get_injectable_error_type(addr);
if (etype != EI_ETYPE_ERRNO && etype != EI_ETYPE_ERRNO_NULL)
/* reject it */
If bpf can handle any case, it still need to verify that the user
bpf prog specifies correct return value for each type.
See adjust_error_retval()@kernel/fail_function.c for the available
return values.
Thank you,
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
prev parent reply other threads:[~2022-12-12 0:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-04 22:22 [PATCH v2] panic: Taint kernel if fault injection has been used Masami Hiramatsu (Google)
2022-12-04 22:30 ` Alexei Starovoitov
2022-12-04 22:59 ` Masami Hiramatsu
2022-12-06 2:17 ` Alexei Starovoitov
2022-12-06 7:20 ` Masami Hiramatsu
2022-12-07 4:01 ` Alexei Starovoitov
2022-12-07 4:39 ` Steven Rostedt
2022-12-07 4:41 ` Steven Rostedt
2022-12-07 4:45 ` Alexei Starovoitov
2022-12-07 5:18 ` Steven Rostedt
2022-12-07 12:48 ` Steven Rostedt
2022-12-08 4:36 ` Alexei Starovoitov
2022-12-08 14:59 ` Steven Rostedt
2022-12-11 2:52 ` Masami Hiramatsu
2022-12-11 7:49 ` KP Singh
2022-12-11 15:14 ` Masami Hiramatsu
2022-12-12 21:39 ` KP Singh
2022-12-11 17:02 ` Steven Rostedt
2022-12-12 21:43 ` KP Singh
2022-12-12 0:53 ` Masami Hiramatsu [this message]
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=20221212095333.01599330d97de6c7ddc3eebe@kernel.org \
--to=mhiramat@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=alexei.starovoitov@gmail.com \
--cc=bp@alien8.de \
--cc=bpf@vger.kernel.org \
--cc=clm@meta.com \
--cc=gregkh@linuxfoundation.org \
--cc=hch@infradead.org \
--cc=jpoimboe@redhat.com \
--cc=keescook@chromium.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=peterz@infradead.org \
--cc=revest@chromium.org \
--cc=rostedt@goodmis.org \
--cc=torvalds@linux-foundation.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