On Wed, 2012-10-24 at 23:44 -0700, Kees Cook wrote: > On Wed, Oct 24, 2012 at 10:43 PM, Mimi Zohar <zohar at linux.vnet.ibm.com> wrote: > > On Wed, 2012-10-24 at 13:19 -0400, Vivek Goyal wrote: > >> On Tue, Oct 23, 2012 at 09:44:59AM -0700, Eric W. Biederman wrote: > >> > Matthew Garrett <mjg at redhat.com> writes: > >> > > >> > > On Tue, Oct 23, 2012 at 10:59:20AM -0400, Vivek Goyal wrote: > >> > > > >> > >> But what about creation of a new program which can call kexec_load() > >> > >> and execute an unsigned kernel. Doesn't look like that will be > >> > >> prevented using IMA. > > > > Like the existing kernel modules, kexec_load() is not file descriptor > > based. There isn't an LSM or IMA-appraisal hook here. > > > >> > > Right. Trusting userspace would require a new system call that passes in > >> > > a signature of the userspace binary, and the kernel would then have to > >> > > verify the ELF object in memory in order to ensure that it > >> > > matches the signature. Verifying that the copy on the filesystem is > >> > > unmodified isn't adequate - an attacker could simply have paused the > >> > > process and injected code. > > > > I haven't looked at kexec_load() in detail, but like kernel modules, I > > think the better solution would be to pass a file descriptor, especially > > if you're discussing a new system call. (cc'ing Kees.) > > Yeah, it looks like kexec_load could use a nearly identical new > syscall that uses an fd, just like init_module is getting. > > Another area, kind of related, is firmware loading. The interface for > that is a bit weird, if the documentation is up to date: > > echo 1 > /sys/$DEVPATH/loading > cat $HOTPLUG_FW_DIR/$FIRMWARE > /sysfs/$DEVPATH/data > echo 0 > /sys/$DEVPATH/loading > > It looks like there's a filp on the reader: > > static ssize_t firmware_data_read(struct file *filp, struct kobject *kobj, > struct bin_attribute *bin_attr, > char *buffer, loff_t offset, size_t count) > > But it's not clear to me yet if we'll actually get the firmware file, > or if we'll get a random pipe we can't evaluate. Has anyone looked at > handling "signed" firmware loading yet? > > -Kees Only looked at it enough to mention at LSS, that it's needed. Mimi