[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e6f7ce4aa506ff016dde9a75c607849587c1ca2c.camel@linux.ibm.com>
Date: Wed, 29 Jul 2020 14:10:18 -0400
From: Mimi Zohar <zohar@...ux.ibm.com>
To: Kees Cook <keescook@...omium.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Scott Branden <scott.branden@...adcom.com>,
Luis Chamberlain <mcgrof@...nel.org>,
Jessica Yu <jeyu@...nel.org>, SeongJae Park <sjpark@...zon.de>,
KP Singh <kpsingh@...omium.org>, linux-efi@...r.kernel.org,
linux-security-module@...r.kernel.org,
linux-integrity@...r.kernel.org, selinux@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 12/19] firmware_loader: Use security_post_load_data()
On Wed, 2020-07-29 at 12:29 -0400, Mimi Zohar wrote:
> On Tue, 2020-07-28 at 12:43 -0700, Kees Cook wrote:
> > On Mon, Jul 27, 2020 at 06:57:45AM -0400, Mimi Zohar wrote:
> > > On Fri, 2020-07-24 at 14:36 -0700, Kees Cook wrote:
> > > > Now that security_post_load_data() is wired up, use it instead
> > > > of the NULL file argument style of security_post_read_file(),
> > > > and update the security_kernel_load_data() call to indicate that a
> > > > security_kernel_post_load_data() call is expected.
> > > >
> > > > Wire up the IMA check to match earlier logic. Perhaps a generalized
> > > > change to ima_post_load_data() might look something like this:
> > > >
> > > > return process_buffer_measurement(buf, size,
> > > > kernel_load_data_id_str(load_id),
> > > > read_idmap[load_id] ?: FILE_CHECK,
> > > > 0, NULL);
> > > >
> > > > Signed-off-by: Kees Cook <keescook@...omium.org>
> > >
> > > process_measurement() measures, verifies a file signature - both
> > > signatures stored as an xattr and as an appended buffer signature -
> > > and augments audit records with the file hash. (Support for measuring,
> > > augmenting audit records, and/or verifying fs-verity signatures has
> > > yet to be added.)
> > >
> > > As explained in my response to 11/19, the file descriptor provides the
> > > file pathname associated with the buffer data. In addition, IMA
> > > policy rules may be defined in terms of other file descriptor info -
> > > uid, euid, uuid, etc.
> > >
> > > Recently support was added for measuring the kexec boot command line,
> > > certificates being loaded onto a keyring, and blacklisted file hashes
> > > (limited to appended signatures). None of these buffers are signed.
> > > process_buffer_measurement() was added for this reason and as a
> > > result is limited to just measuring the buffer data.
> > >
> > > Whether process_measurement() or process_buffer_measurement() should
> > > be modified, needs to be determined. In either case to support the
> > > init_module syscall, would at minimum require the associated file
> > > pathname.
> >
> > Right -- I don't intend to make changes to the init_module() syscall
> > since it's deprecated, so this hook is more of a "fuller LSM coverage
> > for old syscalls" addition.
> >
> > IMA can happily continue to ignore it, which is what I have here, but I
> > thought I'd at least show what it *might* look like. Perhaps BPF LSM is
> > a better example.
> >
> > Does anything need to change for this patch?
>
> I wasn't aware that init_syscall was deprecated. From your original comments,
> it sounded like you wanted a new LSM for verifying kernel module signatures,
> as
> they're currently supported via init_module().
>
> I was mistaken. Without a file descriptor, security_post_load_data() will
> measure the firmware, as Scott confirmed, but won't be able to verify the
> signature, whether he signed it using evmctl or not,
Actually, the partial firmware read should be calling
security_kernel_read_file(). The sysfs firmware fallback is calling
security_kernel_load_data(). Which firmware is calling
security_kernel_post_load_data()?
thanks,
Mimi
Powered by blists - more mailing lists