From: Casey Schaufler <casey@schaufler-ca.com>
To: Aleksandr Nogikh <nogikh@google.com>
Cc: Aleksandr Nogikh <a.nogikh@gmail.com>,
jmorris@namei.org, serge@hallyn.com, akinobu.mita@gmail.com,
Andrey Konovalov <andreyknvl@google.com>,
Dmitry Vyukov <dvyukov@google.com>,
Marco Elver <elver@google.com>,
glider@google.com, keescook@google.com,
LKML <linux-kernel@vger.kernel.org>,
linux-security-module@vger.kernel.org,
Casey Schaufler <casey@schaufler-ca.com>
Subject: Re: [RFC PATCH v2 1/2] security: add fault injection capability
Date: Tue, 27 Oct 2020 10:56:11 -0700 [thread overview]
Message-ID: <c55336e4-dd4f-3a72-e22f-aaf9c305d57f@schaufler-ca.com> (raw)
In-Reply-To: <CANp29Y5w1ZxDShGQHvJ-F0bM_P4WSrvPoDQtPNnBCG38Ee-x-A@mail.gmail.com>
On 10/27/2020 10:29 AM, Aleksandr Nogikh wrote:
> (resending the previous message in a plain/text mode)
>
> On Mon, Oct 26, 2020 at 7:20 PM Casey Schaufler <casey@schaufler-ca.com> wrote:
> [...]
>>> - int RC = IRC; \
>>> - do { \
>>> + int RC = lsm_hooks_inject_fail(); \
>>> + if (RC == 0) { \
>> Injecting the failure here will prevent the loaded LSM hooks from
>> being called.
> In this RFC, fault injection was intentionally placed before the code that
> invokes LSM hooks. The reasoning was that it would simultaneously check
> how the kernel code reacts to LSM denials and the effect of fault injections
> on LSM modules.
>
>>> struct security_hook_list *P; \
>>> + RC = IRC; \
>>> \
>>> hlist_for_each_entry(P, &security_hook_heads.FUNC, list) { \
>>> RC = P->hook.FUNC(__VA_ARGS__); \
>>> if (RC != 0) \
>>> break; \
>>> } \
>>> - } while (0); \
>>> + } \
>> Injecting the failure here would allow the loaded LSM hooks to
>> be called. It shouldn't make a difference, but hooks with side-effects
>> are always possible. I don't have an issue either way.
>>
>>> RC; \
>>> })
>>>
> Should we expect LSM modules to properly handle the cases when their
> hooks with side effects were not invoked (unlike the selinux crash that
> is described in the cover letter)? From the source code it seems that a
> failure/denial from one module prevents the execution of the subsequent
> hooks, so this looks like a realistic scenario.
Yes. Security modules have to accept the possibility that something
ahead of them in the stack will fail. This may be a DAC check, a
capability check or another security module.
> If that is not true in general and depends on the specific active modules,
> then it probably makes sense to introduce an option to control whether to
> inject faults at the beginning of call_int_hook() or after the hooks have
> been invoked.
If you want to do that you could implement it as an LSM. You could place it
anywhere in the stack that way. Based on what I see with the BPF lsm that might
be more work than it is worth.
next prev parent reply other threads:[~2020-10-27 17:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-26 12:52 [RFC PATCH v2 0/2] security: add fault injection to LSM hooks Aleksandr Nogikh
2020-10-26 12:52 ` [RFC PATCH v2 1/2] security: add fault injection capability Aleksandr Nogikh
2020-10-26 16:20 ` Casey Schaufler
2020-10-27 17:29 ` Aleksandr Nogikh
2020-10-27 17:56 ` Casey Schaufler [this message]
2020-10-26 12:52 ` [RFC PATCH v2 2/2] docs: add fail_lsm_hooks info to fault-injection.rst Aleksandr Nogikh
2020-10-27 15:31 ` Akinobu Mita
2020-10-27 17:33 ` Aleksandr Nogikh
2020-10-28 9:41 ` Dmitry Vyukov
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=c55336e4-dd4f-3a72-e22f-aaf9c305d57f@schaufler-ca.com \
--to=casey@schaufler-ca.com \
--cc=a.nogikh@gmail.com \
--cc=akinobu.mita@gmail.com \
--cc=andreyknvl@google.com \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=jmorris@namei.org \
--cc=keescook@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=nogikh@google.com \
--cc=serge@hallyn.com \
/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
all inboxes | Powered by JetHome®