[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f0059ebc-3586-dd08-efe5-f9ea69747218@i-love.sakura.ne.jp>
Date: Tue, 25 Sep 2018 02:22:28 +0900
From: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
To: Casey Schaufler <casey@...aufler-ca.com>,
Stephen Smalley <sds@...ho.nsa.gov>,
Kees Cook <keescook@...omium.org>
Cc: LSM <linux-security-module@...r.kernel.org>,
James Morris <jmorris@...ei.org>,
SE Linux <selinux@...ho.nsa.gov>,
LKLM <linux-kernel@...r.kernel.org>,
John Johansen <john.johansen@...onical.com>,
Paul Moore <paul@...l-moore.com>,
"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 00/19] LSM: Module stacking for SARA and Landlock
On 2018/09/25 1:15, Casey Schaufler wrote:
>>>> Since all free hooks are called when one of init hooks failed, each
>>>> free hook needs to check whether init hook was called. An example is
>>>> inode_free_security() in security/selinux/hooks.c (but not addressed in
>>>> this patch).
>>>
>>> I *think* that selinux_inode_free_security() is safe in this
>>> case because the blob will be zeroed, hence isec->list will
>>> be NULL.
>>
>> That's not safe - look more closely at what list_empty_careful() tests, and then think about what happens when list_del_init() gets called on that isec->list. selinux_inode_free_security() presumes that selinux_inode_alloc_security() has been called already. If you are breaking that assumption, you have to fix it.
>
> Yup. I misread the macro my first time around. Easy fix.
Oh, I didn't notice that it is doing !list_empty_careful() than list_empty_careful().
Unsafe indeed. But easy to fix.
>
>> Is there a reason you can't make inode_alloc_security() return void since you moved the allocation to the framework?
>
> No reason with any of the existing modules, But I could see someone
> doing unnatural things during allocation that might result in a
> failure.
Currently upstreamed LSM modules and AKARI would be OK. But I can't guarantee it
for future / not-yet-upstreamed LSM modules.
Powered by blists - more mailing lists