From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out01.mta.xmission.com ([166.70.13.231]:35175 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966499AbeEXUuO (ORCPT ); Thu, 24 May 2018 16:50:14 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Mimi Zohar Cc: linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, David Howells , "Luis R . Rodriguez" , kexec@lists.infradead.org, Andres Rodriguez , Greg Kroah-Hartman , Ard Biesheuvel , Kees Cook References: <1527160176-29269-1-git-send-email-zohar@linux.vnet.ibm.com> <1527160176-29269-3-git-send-email-zohar@linux.vnet.ibm.com> Date: Thu, 24 May 2018 15:50:03 -0500 In-Reply-To: <1527160176-29269-3-git-send-email-zohar@linux.vnet.ibm.com> (Mimi Zohar's message of "Thu, 24 May 2018 07:09:31 -0400") Message-ID: <87k1rs22ys.fsf@xmission.com> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [PATCH v3 2/7] kexec: add call to LSM hook in original kexec_load syscall Sender: linux-integrity-owner@vger.kernel.org List-ID: Mimi Zohar writes: > In order for LSMs and IMA-appraisal to differentiate between the > original and new syscalls, both the original and new syscalls must call > an LSM hook. This patch adds a call to security_kernel_read_data() in > the original kexec syscall. Until the lsm hook mess gets cleaned up. Nacked-by: "Eric W. Biederman" > > Signed-off-by: Mimi Zohar > Cc: Eric Biederman > Cc: Luis R. Rodriguez > Cc: Kees Cook > Cc: David Howells > --- > kernel/kexec.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/kernel/kexec.c b/kernel/kexec.c > index aed8fb2564b3..061ada41c18c 100644 > --- a/kernel/kexec.c > +++ b/kernel/kexec.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -195,10 +196,17 @@ static int do_kexec_load(unsigned long entry, unsigned long nr_segments, > static inline int kexec_load_check(unsigned long nr_segments, > unsigned long flags) > { > + int result; > + > /* We only trust the superuser with rebooting the system. */ > if (!capable(CAP_SYS_BOOT) || kexec_load_disabled) > return -EPERM; > > + /* Permit LSMs and IMA to fail the kexec */ > + result = security_kernel_read_data(NULL, READING_KEXEC_IMAGE); > + if (result < 0) > + return result; > + > /* > * Verify we have a legal set of flags > * This leaves us room for future extensions.