[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LRH.2.21.1810040409280.13517@namei.org>
Date: Thu, 4 Oct 2018 04:13:08 +1000 (AEST)
From: James Morris <jmorris@...ei.org>
To: Kees Cook <keescook@...omium.org>
cc: Casey Schaufler <casey@...aufler-ca.com>,
LSM <linux-security-module@...r.kernel.org>,
SE Linux <selinux@...ho.nsa.gov>,
LKLM <linux-kernel@...r.kernel.org>,
John Johansen <john.johansen@...onical.com>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
Paul Moore <paul@...l-moore.com>,
Stephen Smalley <sds@...ho.nsa.gov>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
Alexey Dobriyan <adobriyan@...il.com>,
Mickaël Salaün <mic@...ikod.net>,
Salvatore Mesoraca <s.mesoraca16@...il.com>
Subject: Re: [PATCH v4 14/19] LSM: Infrastructure management of the inode
security
On Fri, 21 Sep 2018, Kees Cook wrote:
> On Fri, Sep 21, 2018 at 5:19 PM, Casey Schaufler <casey@...aufler-ca.com> wrote:
> > + * lsm_early_inode - during initialization allocate a composite inode blob
> > + * @inode: the inode that needs a blob
> > + *
> > + * Allocate the inode blob for all the modules if it's not already there
> > + */
> > +void lsm_early_inode(struct inode *inode)
> > +{
> > + int rc;
> > +
> > + if (inode == NULL)
> > + panic("%s: NULL inode.\n", __func__);
> > + if (inode->i_security != NULL)
> > + return;
> > + rc = lsm_inode_alloc(inode);
> > + if (rc)
> > + panic("%s: Early inode alloc failed.\n", __func__);
> > +}
>
> I'm still advising against using panic(), but I'll leave it up to James.
>
Calling panic() is not appropriate here. Perhaps if it was during
boot-time initialization of LSM infrastructure, but not on the fly.
Use a WARN_ONCE then propagate the error back and fail the operation.
--
James Morris
<jmorris@...ei.org>
Powered by blists - more mailing lists