From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from h2.hallyn.com ([78.46.35.8] helo=mail.hallyn.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fPveQ-0005oh-Ui for kexec@lists.infradead.org; Mon, 04 Jun 2018 20:00:44 +0000 Date: Mon, 4 Jun 2018 15:00:11 -0500 From: "Serge E. Hallyn" Subject: Re: [PATCH v4 2/8] kexec: add call to LSM hook in original kexec_load syscall Message-ID: <20180604200011.GC14454@mail.hallyn.com> References: <1527616920-5415-1-git-send-email-zohar@linux.vnet.ibm.com> <1527616920-5415-3-git-send-email-zohar@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1527616920-5415-3-git-send-email-zohar@linux.vnet.ibm.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: Mimi Zohar Cc: Kees Cook , Ard Biesheuvel , Greg Kroah-Hartman , kexec@lists.infradead.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, David Howells , "Luis R . Rodriguez" , Eric Biederman , linux-integrity@vger.kernel.org, Andres Rodriguez Quoting Mimi Zohar (zohar@linux.vnet.ibm.com): > In order for LSMs and IMA-appraisal to differentiate between kexec_load > and kexec_file_load syscalls, both the original and new syscalls must > call an LSM hook. This patch adds a call to security_kernel_load_data() > in the original kexec_load syscall. > > Signed-off-by: Mimi Zohar > Cc: Eric Biederman Acked-by: Serge Hallyn > 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..68559808fdfa 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_load_data(LOADING_KEXEC_IMAGE); > + if (result < 0) > + return result; > + > /* > * Verify we have a legal set of flags > * This leaves us room for future extensions. > -- > 2.7.5 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec