linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	Dmitry Vyukov <dvyukov@google.com>
Cc: linux-integrity@vger.kernel.org, James Morris <jmorris@namei.org>,
	"Serge E . Hallyn" <serge@hallyn.com>,
	linux-security-module <linux-security-module@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Eric Biggers <ebiggers@kernel.org>
Subject: Re: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Date: Tue, 23 Mar 2021 08:09:21 -0400	[thread overview]
Message-ID: <8039976be3df9bd07374fe4f1931b8ce28b89dab.camel@linux.ibm.com> (raw)
In-Reply-To: <1a2245c6-3cab-7085-83d3-55b083619303@i-love.sakura.ne.jp>

On Tue, 2021-03-23 at 10:46 +0900, Tetsuo Handa wrote:
> On 2021/03/20 5:03, Mimi Zohar wrote:
> > The integrity's "iint_cache" is initialized at security_init().  Only
> > after an IMA policy is loaded, which is initialized at late_initcall,
> > is a file's integrity status stored in the "iint_cache".
> > 
> > All integrity_inode_get() callers first verify that the IMA policy has
> > been loaded, before calling it.  Yet for some reason, it is still being
> > called, causing a NULL pointer dereference.
> > 
> > qemu-system-x86_64 (...snipped...) lsm=smack (...snipped...)
> 
> Hmm, why are you using lsm=smack instead of security=smack ?
> Since use of lsm= overrides CONFIG_LSM="lockdown,yama,safesetid,integrity,tomoyo,smack,bpf" settings,
> only smack is activated, which means that integrity_iintcache_init() will not be called by
> 
>   DEFINE_LSM(integrity) = {
>   	.name = "integrity",
>   	.init = integrity_iintcache_init,
>   };
> 
> declaration. That's the reason iint_cache == NULL when integrity_inode_get() is called.

That's exactly the problem, but since we don't control how the system
is configured or which parameters are supplied on the boot command
line, the kernel needs to at least provide some explanation instead of
dereferencing a NULL pointer.

FYI, "security=" is being deprecated.   From Documentation/admin-
guide/kernel-parameters.txt:

       security=  [SECURITY] Choose a legacy "major" security module to
                        enable at boot. This has been deprecated by the
                        "lsm=" parameter.

Please take a look at the newer version of this patch.   Do you want to
add any tags?

thanks,

Mimi


  reply	other threads:[~2021-03-23 12:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19 20:03 [RFC PATCH 1/2] ima: don't access a file's integrity status before an IMA policy is loaded Mimi Zohar
2021-03-19 20:03 ` [RFC PATCH 2/2] integrity: double check iint_cache was initialized Mimi Zohar
2021-03-22  7:10   ` Tetsuo Handa
2021-03-22  7:53     ` Dmitry Vyukov
2021-03-23  1:46       ` Tetsuo Handa
2021-03-23 12:09         ` Mimi Zohar [this message]
2021-03-23 13:37           ` Tetsuo Handa
2021-03-23 14:01             ` Tetsuo Handa
2021-03-23 14:47               ` Mimi Zohar
2021-03-23 15:14                 ` Tetsuo Handa
2021-03-23 16:13                   ` Mimi Zohar
2021-03-24 10:10                     ` Tetsuo Handa
2021-03-24 11:10                       ` Mimi Zohar
2021-03-24 11:20                         ` Tetsuo Handa
2021-03-24 11:37                           ` Dmitry Vyukov
2021-03-24 11:49                             ` Mimi Zohar
2021-03-24 11:58                               ` Dmitry Vyukov
2021-03-24 12:17                                 ` Mimi Zohar
2021-03-24 15:56                                 ` Casey Schaufler

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=8039976be3df9bd07374fe4f1931b8ce28b89dab.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=dvyukov@google.com \
    --cc=ebiggers@kernel.org \
    --cc=jmorris@namei.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --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;
as well as URLs for NNTP newsgroup(s).