[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LRH.2.21.1805190303100.26396@namei.org>
Date: Sat, 19 May 2018 03:13:37 +1000 (AEST)
From: James Morris <jmorris@...ei.org>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
cc: Casey Schaufler <casey@...aufler-ca.com>,
Mimi Zohar <zohar@...ux.vnet.ibm.com>,
linux-integrity@...r.kernel.org,
linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org, David Howells <dhowells@...hat.com>,
"Luis R . Rodriguez" <mcgrof@...nel.org>,
kexec@...ts.infradead.org, Andres Rodriguez <andresx7@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Kees Cook <keescook@...omium.org>
Subject: Re: [PATCH v2 3/9] security: define security_kernel_read_blob()
wrapper
On Thu, 17 May 2018, Eric W. Biederman wrote:
> Nacked-by: "Eric W. Biederman" <ebiederm@...ssion.com>
>
> Nack on this sharing nonsense. These two interfaces do not share any
> code in their implementations other than the if statement to distinguish
> between the two cases.
Hmm, it's not even doing that.
There's already an if(!file && read_id == X) { } check and this is another
one being added.
> If we want comprehensible and maintainable code in the security modules
> we need to split these two pieces of functionality apart.
All ima_read is doing in both the old and new case is checking if there's
no file then if it's a certain operation, returning an error.
To echo Eric and Casey's suggestions, how about changing the name of the
hook to security_kernel_read_data() ?
Then ima_read_file() can be changed to ima_read_data(), and then instead
of two if (!file && read_id == X) checks, have:
if (!file) {
switch (read_id) {
}
}
--
James Morris
<jmorris@...ei.org>
Powered by blists - more mailing lists