From patchwork Tue Aug 13 19:21:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 11092783 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D4C36746 for ; Tue, 13 Aug 2019 19:21:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C61A5204FA for ; Tue, 13 Aug 2019 19:21:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9F2328706; Tue, 13 Aug 2019 19:21:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62B7D204FA for ; Tue, 13 Aug 2019 19:21:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726186AbfHMTVe (ORCPT ); Tue, 13 Aug 2019 15:21:34 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:56044 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726137AbfHMTVd (ORCPT ); Tue, 13 Aug 2019 15:21:33 -0400 Received: by mail-pf1-f201.google.com with SMTP id 22so5058682pfn.22 for ; Tue, 13 Aug 2019 12:21:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc:content-transfer-encoding; bh=LGoSw8wdPlJ5LZexCtQbX5CILiN8poHoRBIV73YdzEI=; b=H3slEEpqUKKz7YIUBqg/8QpCBvIil0RBF/4+KpAWN1+qD5n2YDQa9WnC78++oRMQc7 HRdFJzlZYsRgTZNpKs2esIFI9HtdhG9M4wYO5mGqJl0AMr/fvjn/qHkwffYYSuBIrYlO rR5PlV3rgfW9XnQrPvoIr7BaK49L/ldnKIMj4XVvQyZ9m8yG57UlMNCLkzNFqJOSFof7 tv+rqUpPdp94GuSTka+vhaqja66yzDU+w1mPPEsXgfduv5fiPSfcsXwTK/7rB3f881vC mPENoNfW8z/140tEMn/oBnf69iZm4Y++8j6p1kK13pETOapVp9+CAOcCpRLPw25R4AGT isBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc:content-transfer-encoding; bh=LGoSw8wdPlJ5LZexCtQbX5CILiN8poHoRBIV73YdzEI=; b=lPwJDLd+Uzxf3PEEApcJcDWTVA2LGt4o/uq4Mf5i8Phdd9vqmTmSgCBu7yyge2EVvE SsZzCjJoUp5Rjoj+2eOgo9PI+C83QqYUysMyBpDuh6Sj9bjnwi1rszCErjwnEHGxSpdg mHMQxSg+uVikfuFgWaaFiNhhdyxuY/t7Lye5IelZ2qWxMKyUCO4gKzXFGbJ0/C1r6wHD c5oO9qBRGvdGMpZSAL3XEW52UmKIykv3O/WW2Jc2z548VVL68rXUPh3vj4K83aZGpDSH /fvaoZuC/RDp+jezm4XGibUecWJTPsQdYTu/r7TeN0WkJiTMYJHzGfyRPG3hyUvEGs9X kWzQ== X-Gm-Message-State: APjAAAWS216sPRAw/ZBVca+scu11t7jS5FuCn35/2bnz1YWIgNQB1VBi ZVElkU/kbs60E7x1M6dWqCTeHddXVSUEzPnOAgFgxg== X-Google-Smtp-Source: APXvYqwzMe41fY7WVgXRqbj+bDqvVvSfpAGS+es7PR1B9q896RnZLvJbKOMAoWK6X7eFUaSIR9VBjcCvbecldsFqcZeRBw== X-Received: by 2002:a65:62cd:: with SMTP id m13mr35560835pgv.437.1565724092836; Tue, 13 Aug 2019 12:21:32 -0700 (PDT) Date: Tue, 13 Aug 2019 12:21:21 -0700 In-Reply-To: <20190813192126.122370-1-matthewgarrett@google.com> Message-Id: <20190813192126.122370-2-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190813192126.122370-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog Subject: [PATCH 1/6] tracefs: Fix potential null dereference in default_file_open() From: Matthew Garrett To: jmorris@namei.org Cc: linux-security-module@vger.kernel.org, Ben Hutchings Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Ben Hutchings The "open" operation in struct file_operations is optional, and ftrace_event_id_fops does not set it. In default_file_open(), after all other checks have passed, return 0 if the underlying struct file_operations does not implement open. Fixes: 757ff7244358 ("tracefs: Restrict tracefs when the kernel is …") References: https://bugs.debian.org/934304 Signed-off-by: Ben Hutchings --- fs/tracefs/inode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index 34da48036e08..761af8ce4015 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -42,6 +42,8 @@ static int default_open_file(struct inode *inode, struct file *filp) return ret; real_fops = dentry->d_fsdata; + if (!real_fops->open) + return 0; return real_fops->open(inode, filp); } From patchwork Tue Aug 13 19:21:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 11092785 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D714A14D5 for ; Tue, 13 Aug 2019 19:21:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8C0D204FA for ; Tue, 13 Aug 2019 19:21:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC9F328706; Tue, 13 Aug 2019 19:21:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFA55204FA for ; Tue, 13 Aug 2019 19:21:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726137AbfHMTVg (ORCPT ); Tue, 13 Aug 2019 15:21:36 -0400 Received: from mail-pg1-f202.google.com ([209.85.215.202]:46712 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfHMTVg (ORCPT ); Tue, 13 Aug 2019 15:21:36 -0400 Received: by mail-pg1-f202.google.com with SMTP id u1so67047994pgr.13 for ; Tue, 13 Aug 2019 12:21:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=sHYpjjOSj3cKsZS8LNbuqU4iflCegvGo0YeYfpsqvjM=; b=auN+J9iyrf5OGT56LOVxjtJish8Eymt2JZXIc5dyN7DK1GC267QiVFEHpvxz/rh+6C 11D6krWY8TfxuU1h0UThVJJXHmIc8IXt7EKs07xS+44ziHE2VUbaO5s2wBUQ1knAjY/V RBCDLj8oADYUyy2+x8jyM1ATuUxDqkHnITKzn3qlb6a9dODjW5DDxn+1i4LZWzZ6f3lg YNdrgs/T08SSGATVY4mDfiCB2/afZTOYwttVKuKr6HXWuy9sw281eZUwZ2f8IXGedt8K uVHXRzbUKEgp+ac+qyPDqPMXc37jS6g3r9AVF+THw4SqD5FJvbn6nLAoU2j9hsCJCUl8 lFVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=sHYpjjOSj3cKsZS8LNbuqU4iflCegvGo0YeYfpsqvjM=; b=bc/75XHEXaOy+gYNOMnNho4loUDgfAnnR5MwguloInPG+n9jMVuHekQTABN8z9F/dt OWAWPOIdPXvPXAWadHkvu/4YJ9PQKZD5AuRTa4Yzpwh0CGgkGxjDvGpJzQGtyLaJ/OyX 0s8KnutM2AGhv3A0gcx3wWAK2RgJ1TZUMhqX8JVEEyuKbH2evWn6u66m6bd97jE2J1rB IGpgxaAgSVY837eb3eAPYPa8/oVJd/NPV/xHpxXto0Tshs36ajbAFyau/EfQyEoiHJp8 2eX7hpTKEqdUdkA72ZifbnFpaqHE/qsUa8+Q/xaHU6Pr8kgppIaMToxfhVJfdlQ1v29P 1/ig== X-Gm-Message-State: APjAAAWUQrcMRgkyxbA7lWR0x0k7VcfFa+JV8eDke2AwAoQMsyonjRPc eus6LCZD7OnyQ17vIt0liiiGYCZHyq/qxniBgegQhw== X-Google-Smtp-Source: APXvYqwtV/c0ur98YG3sspSS/O1ZIrocbgw2IcEyWMI67fI9fUxJOer3VnMhmBoQKCxa8tTAsmuL7ypg/grobp7Y6ySz4A== X-Received: by 2002:a65:514c:: with SMTP id g12mr35833280pgq.76.1565724095535; Tue, 13 Aug 2019 12:21:35 -0700 (PDT) Date: Tue, 13 Aug 2019 12:21:22 -0700 In-Reply-To: <20190813192126.122370-1-matthewgarrett@google.com> Message-Id: <20190813192126.122370-3-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190813192126.122370-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog Subject: [PATCH 2/6] early_security_init() needs a stub got !CONFIG_SECURITY From: Matthew Garrett To: jmorris@namei.org Cc: linux-security-module@vger.kernel.org, Stephen Rothwell Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Stephen Rothwell An arm multi_v7_defconfig fails like this: init/main.c: In function 'start_kernel': init/main.c:596:2: error: implicit declaration of function 'early_security_init'; did you mean 'security_init'? [-Werror=implicit-function-declaration] early_security_init(); ^~~~~~~~~~~~~~~~~~~ security_init Fixes: 45d29f9e9b8b ("security: Support early LSMs") Signed-off-by: Stephen Rothwell --- include/linux/security.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/security.h b/include/linux/security.h index 5748ccc2a42e..429f9f03372b 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -473,6 +473,11 @@ static inline int security_init(void) return 0; } +static inline int early_security_init(void) +{ + return 0; +} + static inline int security_binder_set_context_mgr(struct task_struct *mgr) { return 0; From patchwork Tue Aug 13 19:21:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 11092787 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8604414D5 for ; Tue, 13 Aug 2019 19:21:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76188204FA for ; Tue, 13 Aug 2019 19:21:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68EEF28706; Tue, 13 Aug 2019 19:21:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0ADD204FA for ; Tue, 13 Aug 2019 19:21:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726188AbfHMTVj (ORCPT ); Tue, 13 Aug 2019 15:21:39 -0400 Received: from mail-ua1-f73.google.com ([209.85.222.73]:42551 "EHLO mail-ua1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfHMTVj (ORCPT ); Tue, 13 Aug 2019 15:21:39 -0400 Received: by mail-ua1-f73.google.com with SMTP id h45so161133uae.9 for ; Tue, 13 Aug 2019 12:21:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=bm7tpjWVOUDYZx97BncdSkZ9NvRhZO8YSsPPBr5vkok=; b=slazxnn157c/8d5NLixGKQHNLN7VTx1GaxxgepSJpk+EhBUjfJoNCOjXNoBlzwtTgz ATQMg1/p6wmxCiwn3NqDaSdbn0sOCgj18C/YAUSAxFH1lVQCg5+UIR6idPpfaL02EAZH IIEIw4YVgw2HCssS06onnz1SgWi3wxL7U0JMJr/iDDouwY06MoWIPdhHHDmKOO16YIkx j5G4kkndQqP76ENddQHpPGQGcFOITR7tjSD3KkUsaWPXuqX9KcbxTR2w0/9BFBqYyGaY 8WoBEUCB9UM2pRs0iCKC8r+peYhTnubEAyqgJUXHJQvwP1KZzcqzE6ODHz9/GnNc2FLx LSWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=bm7tpjWVOUDYZx97BncdSkZ9NvRhZO8YSsPPBr5vkok=; b=pcCw6Km8RbPvRa5BMoEsSTdsKnBi4vNO30MWb/mO2CYaS3TSAn1wMzAvYniWbBeVah AKCHTfiQrH5R6cE65g/XUCNl+9XuMNRDI/Q2UZvSMzkpMtnNCIMFyoxSwCnyHYnkr8mV HZl8JNqnLQtQ4qhNw3OPEeKIrN3WLiHhjSPeUv5SUtd5gEw4Y5ZdvQ9N75r5hGBFP3tE TV1eXG/Y4M/y9Bs6DYwNauyn/cV5FGK+svHVefwAKDXJ6rKlrcDYUyBaAfbYsX9BnpXC P2vtH5pl2JJ68qxfff0zyx7hSGZq7M9p/PRMj9FMmpqchiYHQFzH18IJSWZgliUj4/Ri qzTA== X-Gm-Message-State: APjAAAWJg/nyeOHJn8q5HR78UIrZSjXgEZ8yeZK4O45e1UnJBv3NKzDB nn4VLQWYD/k8hyFI/0muu2mPpsaktmIcI5efTtES4w== X-Google-Smtp-Source: APXvYqzRVkooHVUD52Jj7apoZc5mIoEhdYnVm95g08oervUdSjOgObCJlOhYCdmCQD7I3YQEPRfXBlAg4kq7Nznq8SGZ4Q== X-Received: by 2002:a1f:ec41:: with SMTP id k62mr7315266vkh.32.1565724098096; Tue, 13 Aug 2019 12:21:38 -0700 (PDT) Date: Tue, 13 Aug 2019 12:21:23 -0700 In-Reply-To: <20190813192126.122370-1-matthewgarrett@google.com> Message-Id: <20190813192126.122370-4-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190813192126.122370-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog Subject: [PATCH 3/6] Avoid build warning when !CONFIG_KEXEC_SIG From: Matthew Garrett To: jmorris@namei.org Cc: linux-security-module@vger.kernel.org, Matthew Garrett , Matthew Garrett , Jiri Bohac , Dave Young , kexec@lists.infradead.org Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Refactor the signature validation and lockdown integration a little in order to avoid an unused variable. Signed-off-by: Matthew Garrett Cc: Jiri Bohac Cc: Dave Young Cc: kexec@lists.infradead.org --- kernel/kexec_file.c | 72 ++++++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 27 deletions(-) diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index be0c13076056..e878587715b9 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -177,36 +177,13 @@ void kimage_file_post_load_cleanup(struct kimage *image) image->image_loader_data = NULL; } -/* - * In file mode list of segments is prepared by kernel. Copy relevant - * data from user space, do error checking, prepare segment list - */ +#ifdef CONFIG_KEXEC_SIG static int -kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd, - const char __user *cmdline_ptr, - unsigned long cmdline_len, unsigned flags) +kimage_validate_signature(struct kimage *image) { const char *reason; int ret; - void *ldata; - loff_t size; - - ret = kernel_read_file_from_fd(kernel_fd, &image->kernel_buf, - &size, INT_MAX, READING_KEXEC_IMAGE); - if (ret) - return ret; - image->kernel_buf_len = size; - - /* IMA needs to pass the measurement list to the next kernel. */ - ima_add_kexec_buffer(image); - /* Call arch image probe handlers */ - ret = arch_kexec_kernel_image_probe(image, image->kernel_buf, - image->kernel_buf_len); - if (ret) - goto out; - -#ifdef CONFIG_KEXEC_SIG ret = arch_kexec_kernel_verify_sig(image, image->kernel_buf, image->kernel_buf_len); switch (ret) { @@ -228,7 +205,7 @@ kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd, decide: if (IS_ENABLED(CONFIG_KEXEC_SIG_FORCE)) { pr_notice("%s rejected\n", reason); - goto out; + break; } ret = 0; @@ -251,9 +228,44 @@ kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd, */ default: pr_notice("kernel signature verification failed (%d).\n", ret); - goto out; + break; } + + return ret; +} +#endif + +/* + * In file mode list of segments is prepared by kernel. Copy relevant + * data from user space, do error checking, prepare segment list + */ +static int +kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd, + const char __user *cmdline_ptr, + unsigned long cmdline_len, unsigned flags) +{ + int ret; + void *ldata; + loff_t size; + + ret = kernel_read_file_from_fd(kernel_fd, &image->kernel_buf, + &size, INT_MAX, READING_KEXEC_IMAGE); + if (ret) + return ret; + image->kernel_buf_len = size; + + /* Call arch image probe handlers */ + ret = arch_kexec_kernel_image_probe(image, image->kernel_buf, + image->kernel_buf_len); + if (ret) + goto out; + +#ifdef CONFIG_KEXEC_SIG + ret = kimage_validate_signature(image); + if (ret) + goto out; #endif + /* It is possible that there no initramfs is being loaded */ if (!(flags & KEXEC_FILE_NO_INITRAMFS)) { ret = kernel_read_file_from_fd(initrd_fd, &image->initrd_buf, @@ -279,8 +291,14 @@ kimage_file_prepare_segments(struct kimage *image, int kernel_fd, int initrd_fd, ret = -EINVAL; goto out; } + + ima_kexec_cmdline(image->cmdline_buf, + image->cmdline_buf_len - 1); } + /* IMA needs to pass the measurement list to the next kernel. */ + ima_add_kexec_buffer(image); + /* Call arch image load handlers */ ldata = arch_kexec_kernel_image_load(image); From patchwork Tue Aug 13 19:21:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 11092789 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE1CC746 for ; Tue, 13 Aug 2019 19:21:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F855204FA for ; Tue, 13 Aug 2019 19:21:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93E6128706; Tue, 13 Aug 2019 19:21:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41450204FA for ; Tue, 13 Aug 2019 19:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726074AbfHMTVl (ORCPT ); Tue, 13 Aug 2019 15:21:41 -0400 Received: from mail-pg1-f201.google.com ([209.85.215.201]:42962 "EHLO mail-pg1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfHMTVl (ORCPT ); Tue, 13 Aug 2019 15:21:41 -0400 Received: by mail-pg1-f201.google.com with SMTP id l12so20334852pgt.9 for ; Tue, 13 Aug 2019 12:21:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=2aeEBz56zRddyxSHEez5i69GNQI42igiq+SaDdsB6Ys=; b=bAjrzwoQGLXXppXDgT1dxNMrO7zA3yo9e9wBbiGcQnDnh1iPyU91k28VYNewazRLSf ZOtdqhLHeInuBANqoCsMnjNliTDxWjXstFUmwsNhlMpkbIp3dkzwnIBWNhc2I69gzy0U FyUA9ui/MEV5MXvtHLHNVjApIu+vJGnOfrfTL99z3c+L7upxUenxzd7rIbMKdnnm9w5R y5GSZ3D9jgcfICXGBiMrbNQvua+3xm4UYhUFkZ7Nl/QqPzX6HEwnlns+Ort6J/aBQ5C+ ycmAIT7zwNbGra6eHI2eeGClcs9CRMrvzcHjk8dkwopMifkaKFNtWWHePep0QjyfoBZD ZN+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=2aeEBz56zRddyxSHEez5i69GNQI42igiq+SaDdsB6Ys=; b=kaZMPIBrCDzmZo43OUyj8J7EGz99UZY0Ls/OuZxNOF16e35V7R6M5I0sdIE/g3aos5 ryMU6IlAy0/9SkELKaLTeAwIKrORXQui9vpKnjuCv3Cx0wlXXLAc5F63LUkXTzoCoQiz TqLKcufBPNX/+6MxUm0qQLPkda6GZAllLtRUN5LuIo9bHsk8SQa+TR9Vrzrp5jpWRGBN 6wLtlSIegm2xEbXKKlw3pUHGiys5BiNLMsjMraFGjfM/d7wAtBWCvjBI3VcNvx91Ox3+ 60HnnoTeeY8djiNpCAv8Ud2gv3aCUNI5PQXYCz/O1LcIEcSA6z7VVLXlh4s+3w2PiRY2 kS1w== X-Gm-Message-State: APjAAAXtCut/BgehJ/WaBKuWkIBWrNm4PF/AP4CHFpjDgBFU+80pyNRW BCnb5YRinBK1OGXprXI4LEL4wD5EDv2I+SLCgYiBJw== X-Google-Smtp-Source: APXvYqzU/oWYR4SKCCMM79/8zpON6iCEKCZfRVjunNBBQ1kH+u74smlApXRqpqBuAVa78xnFquFZ7nFtsf8MJucMpmvFGA== X-Received: by 2002:a65:620a:: with SMTP id d10mr35199635pgv.8.1565724100334; Tue, 13 Aug 2019 12:21:40 -0700 (PDT) Date: Tue, 13 Aug 2019 12:21:24 -0700 In-Reply-To: <20190813192126.122370-1-matthewgarrett@google.com> Message-Id: <20190813192126.122370-5-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190813192126.122370-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog Subject: [PATCH 4/6] security: fix ptr_ret.cocci warnings From: Matthew Garrett To: jmorris@namei.org Cc: linux-security-module@vger.kernel.org, kbuild test robot , Matthew Garrett Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: kbuild test robot security/lockdown/lockdown.c:157:1-3: WARNING: PTR_ERR_OR_ZERO can be used Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR Generated by: scripts/coccinelle/api/ptr_ret.cocci Fixes: 80d14015a8e3 ("security: Add a static lockdown policy LSM") Signed-off-by: kbuild test robot Signed-off-by: Matthew Garrett --- security/lockdown/lockdown.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c index f6c74cf6a798..0068cec77c05 100644 --- a/security/lockdown/lockdown.c +++ b/security/lockdown/lockdown.c @@ -176,10 +176,7 @@ static int __init lockdown_secfs_init(void) dentry = securityfs_create_file("lockdown", 0600, NULL, NULL, &lockdown_ops); - if (IS_ERR(dentry)) - return PTR_ERR(dentry); - - return 0; + return PTR_ERR_OR_ZERO(dentry); } core_initcall(lockdown_secfs_init); From patchwork Tue Aug 13 19:21:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 11092791 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 31F3814D5 for ; Tue, 13 Aug 2019 19:21:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23B15204FA for ; Tue, 13 Aug 2019 19:21:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 183D528706; Tue, 13 Aug 2019 19:21:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77F98204FA for ; Tue, 13 Aug 2019 19:21:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726195AbfHMTVo (ORCPT ); Tue, 13 Aug 2019 15:21:44 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:37781 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfHMTVn (ORCPT ); Tue, 13 Aug 2019 15:21:43 -0400 Received: by mail-pf1-f201.google.com with SMTP id w30so5184256pfj.4 for ; Tue, 13 Aug 2019 12:21:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=A861+1mOmVyR5QtRNmHzFupjzHAlW0OufyD2KNhRCsU=; b=qGTpf9ItxHzf6+9tdPoih4KXW55BTSF6RC4GhTOrVzZ6yP69WiqCJUjFIm0i6xt5HE 9C4qm9ZDe6B0T9nYCOaXc+EvvgbgPUKjkRTo+H7P2LQR60avQvcmw7Qt9yqCrCXTzX+B JAbmep3g4kbotkADp9IR6N/tasP3NwLDzZZCtBXPDDNEdY+QB3OvYkAJU5qSrFPxpIqR MgvpdvvESpK+N3obomWckpclcssqUKxQ+cQfL3/dHOVnMJsRXz8T8jqYo09xGuQFoHWn p1idYvPuDGaoYyIgXGl78fGh1HhgDSt8BJoQio6JvEBgzHmo7S8TZf7HTlR9MQy7dzWe m7OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=A861+1mOmVyR5QtRNmHzFupjzHAlW0OufyD2KNhRCsU=; b=H2hb68SI7svvwjJM68ftb+URLHbF0DDe+cP8qLDIl6tRaLVVupUV1deXUFdCzw5K5t Eu/lnXY6doLQk9MucZqx5924JODiGAeccuKmDXaKTYqYfScPlg3jbrKVNx5LiRmirV3q 59zqVeogys0hPLa7+jStxt1BZND2Em+PtJXKQvti83jboWpzlQHGgicNtR4tMf2jfaJz FfCKSBcy4I6kYxh10fpJI13qPTG1U+7s7o6HcN/v17lUX+kppPPMe+p1j+HV3CVGURx4 7x7X7n/QJ8WIO7e5k/dRPhbYHI9g9ewWx1LFfCTvWy5TWHAHV091l3PBeCu3UxaaqbmN ZEsw== X-Gm-Message-State: APjAAAW9oZ4pKylR7Uab3NSVg6UCwzYqiEFGuvaHh2hTvR1Gl+2t7UUG /m3TP7JLqTIDtACX3dRsMNdj6W0l0138IhjsTDPzXw== X-Google-Smtp-Source: APXvYqx+uyk/BN4iocnWHUWpq4kPpgWhHMCQdGRzciS9fcuSNyYID+GolWVWCEfjw120xbkMmfq6LEPSEXNTFMA1PtA6OA== X-Received: by 2002:a63:61cd:: with SMTP id v196mr36280640pgb.263.1565724102774; Tue, 13 Aug 2019 12:21:42 -0700 (PDT) Date: Tue, 13 Aug 2019 12:21:25 -0700 In-Reply-To: <20190813192126.122370-1-matthewgarrett@google.com> Message-Id: <20190813192126.122370-6-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190813192126.122370-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog Subject: [PATCH 5/6] kexec: s/KEXEC_VERIFY_SIG/KEXEC_SIG/ for consistency From: Matthew Garrett To: jmorris@namei.org Cc: linux-security-module@vger.kernel.org, Matthew Garrett , Matthew Garrett Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 47b88836 ("kexec_file: split KEXEC_VERIFY_SIG into KEXEC_SIG and KEXEC_SIG_FORCE") removed CONFIG_KEXEC_VERIFY_SIG, but it's still present in other architectures and we end up with build breakage as a result. Make this consistent across architectures. Fixes: 47b88836 ("kexec_file: split KEXEC_VERIFY_SIG into KEXEC_SIG and KEXEC_SIG_FORCE") Signed-off-by: Matthew Garrett --- arch/arm64/Kconfig | 6 +++--- arch/s390/Kconfig | 2 +- arch/s390/configs/debug_defconfig | 2 +- arch/s390/configs/defconfig | 2 +- arch/s390/configs/performance_defconfig | 2 +- arch/s390/kernel/kexec_elf.c | 4 ++-- arch/s390/kernel/kexec_image.c | 4 ++-- arch/s390/kernel/machine_kexec_file.c | 4 ++-- arch/x86/kernel/ima_arch.c | 4 ++-- security/integrity/ima/Kconfig | 2 +- security/integrity/ima/ima_main.c | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 697ea0510729..f940500a941b 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -961,7 +961,7 @@ config KEXEC_FILE for kernel and initramfs as opposed to list of segments as accepted by previous system call. -config KEXEC_VERIFY_SIG +config KEXEC_SIG bool "Verify kernel signature during kexec_file_load() syscall" depends on KEXEC_FILE help @@ -976,13 +976,13 @@ config KEXEC_VERIFY_SIG config KEXEC_IMAGE_VERIFY_SIG bool "Enable Image signature verification support" default y - depends on KEXEC_VERIFY_SIG + depends on KEXEC_SIG depends on EFI && SIGNED_PE_FILE_VERIFICATION help Enable Image signature verification support. comment "Support for PE file signature verification disabled" - depends on KEXEC_VERIFY_SIG + depends on KEXEC_SIG depends on !EFI || !SIGNED_PE_FILE_VERIFICATION config CRASH_DUMP diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 109243fdb6ec..c4a423f30d49 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -555,7 +555,7 @@ config ARCH_HAS_KEXEC_PURGATORY def_bool y depends on KEXEC_FILE -config KEXEC_VERIFY_SIG +config KEXEC_SIG bool "Verify kernel signature during kexec_file_load() syscall" depends on KEXEC_FILE && SYSTEM_DATA_VERIFICATION help diff --git a/arch/s390/configs/debug_defconfig b/arch/s390/configs/debug_defconfig index b0920b35f87b..525e0a6addb9 100644 --- a/arch/s390/configs/debug_defconfig +++ b/arch/s390/configs/debug_defconfig @@ -64,7 +64,7 @@ CONFIG_NUMA=y CONFIG_PREEMPT=y CONFIG_HZ_100=y CONFIG_KEXEC_FILE=y -CONFIG_KEXEC_VERIFY_SIG=y +CONFIG_KEXEC_SIG=y CONFIG_EXPOLINE=y CONFIG_EXPOLINE_AUTO=y CONFIG_MEMORY_HOTPLUG=y diff --git a/arch/s390/configs/defconfig b/arch/s390/configs/defconfig index c59b922cb6c5..4c37279acdb4 100644 --- a/arch/s390/configs/defconfig +++ b/arch/s390/configs/defconfig @@ -39,7 +39,7 @@ CONFIG_NR_CPUS=256 CONFIG_NUMA=y CONFIG_HZ_100=y CONFIG_KEXEC_FILE=y -CONFIG_KEXEC_VERIFY_SIG=y +CONFIG_KEXEC_SIG=y CONFIG_CRASH_DUMP=y CONFIG_HIBERNATION=y CONFIG_PM_DEBUG=y diff --git a/arch/s390/configs/performance_defconfig b/arch/s390/configs/performance_defconfig index 09aa5cb14873..158ad0f0d433 100644 --- a/arch/s390/configs/performance_defconfig +++ b/arch/s390/configs/performance_defconfig @@ -65,7 +65,7 @@ CONFIG_NR_CPUS=512 CONFIG_NUMA=y CONFIG_HZ_100=y CONFIG_KEXEC_FILE=y -CONFIG_KEXEC_VERIFY_SIG=y +CONFIG_KEXEC_SIG=y CONFIG_EXPOLINE=y CONFIG_EXPOLINE_AUTO=y CONFIG_MEMORY_HOTPLUG=y diff --git a/arch/s390/kernel/kexec_elf.c b/arch/s390/kernel/kexec_elf.c index 6d0635ceddd0..9b4f37a4edf1 100644 --- a/arch/s390/kernel/kexec_elf.c +++ b/arch/s390/kernel/kexec_elf.c @@ -130,7 +130,7 @@ static int s390_elf_probe(const char *buf, unsigned long len) const struct kexec_file_ops s390_kexec_elf_ops = { .probe = s390_elf_probe, .load = s390_elf_load, -#ifdef CONFIG_KEXEC_VERIFY_SIG +#ifdef CONFIG_KEXEC__SIG .verify_sig = s390_verify_sig, -#endif /* CONFIG_KEXEC_VERIFY_SIG */ +#endif /* CONFIG_KEXEC_SIG */ }; diff --git a/arch/s390/kernel/kexec_image.c b/arch/s390/kernel/kexec_image.c index 58318bf89fd9..af23eff5774d 100644 --- a/arch/s390/kernel/kexec_image.c +++ b/arch/s390/kernel/kexec_image.c @@ -59,7 +59,7 @@ static int s390_image_probe(const char *buf, unsigned long len) const struct kexec_file_ops s390_kexec_image_ops = { .probe = s390_image_probe, .load = s390_image_load, -#ifdef CONFIG_KEXEC_VERIFY_SIG +#ifdef CONFIG_KEXEC_SIG .verify_sig = s390_verify_sig, -#endif /* CONFIG_KEXEC_VERIFY_SIG */ +#endif /* CONFIG_KEXEC_SIG */ }; diff --git a/arch/s390/kernel/machine_kexec_file.c b/arch/s390/kernel/machine_kexec_file.c index fbdd3ea73667..c0f33ba49a9a 100644 --- a/arch/s390/kernel/machine_kexec_file.c +++ b/arch/s390/kernel/machine_kexec_file.c @@ -22,7 +22,7 @@ const struct kexec_file_ops * const kexec_file_loaders[] = { NULL, }; -#ifdef CONFIG_KEXEC_VERIFY_SIG +#ifdef CONFIG_KEXEC_SIG /* * Module signature information block. * @@ -90,7 +90,7 @@ int s390_verify_sig(const char *kernel, unsigned long kernel_len) VERIFYING_MODULE_SIGNATURE, NULL, NULL); } -#endif /* CONFIG_KEXEC_VERIFY_SIG */ +#endif /* CONFIG_KEXEC_SIG */ static int kexec_file_update_purgatory(struct kimage *image, struct s390_load_data *data) diff --git a/arch/x86/kernel/ima_arch.c b/arch/x86/kernel/ima_arch.c index 64b973f0e985..b98890894731 100644 --- a/arch/x86/kernel/ima_arch.c +++ b/arch/x86/kernel/ima_arch.c @@ -66,9 +66,9 @@ bool arch_ima_get_secureboot(void) /* secureboot arch rules */ static const char * const sb_arch_rules[] = { -#if !IS_ENABLED(CONFIG_KEXEC_VERIFY_SIG) +#if !IS_ENABLED(CONFIG_KEXEC_SIG) "appraise func=KEXEC_KERNEL_CHECK appraise_type=imasig", -#endif /* CONFIG_KEXEC_VERIFY_SIG */ +#endif /* CONFIG_KEXEC_SIG */ "measure func=KEXEC_KERNEL_CHECK", #if !IS_ENABLED(CONFIG_MODULE_SIG) "appraise func=MODULE_CHECK appraise_type=imasig", diff --git a/security/integrity/ima/Kconfig b/security/integrity/ima/Kconfig index 2692c7358c2c..32cd25fa44a5 100644 --- a/security/integrity/ima/Kconfig +++ b/security/integrity/ima/Kconfig @@ -160,7 +160,7 @@ config IMA_APPRAISE config IMA_ARCH_POLICY bool "Enable loading an IMA architecture specific policy" - depends on KEXEC_VERIFY_SIG || IMA_APPRAISE && INTEGRITY_ASYMMETRIC_KEYS + depends on KEXEC_SIG || IMA_APPRAISE && INTEGRITY_ASYMMETRIC_KEYS default n help This option enables loading an IMA architecture specific policy diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index f302cbc387f8..1747bc7bcb60 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c @@ -541,7 +541,7 @@ int ima_load_data(enum kernel_load_data_id id) switch (id) { case LOADING_KEXEC_IMAGE: - if (IS_ENABLED(CONFIG_KEXEC_VERIFY_SIG) + if (IS_ENABLED(CONFIG_KEXEC_SIG) && arch_ima_get_secureboot()) { pr_err("impossible to appraise a kernel image without a file descriptor; try using kexec_file_load syscall.\n"); return -EACCES; From patchwork Tue Aug 13 19:21:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 11092793 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6B9F014D5 for ; Tue, 13 Aug 2019 19:21:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E471204FA for ; Tue, 13 Aug 2019 19:21:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52A3A28706; Tue, 13 Aug 2019 19:21:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07B7C204FA for ; Tue, 13 Aug 2019 19:21:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726313AbfHMTVq (ORCPT ); Tue, 13 Aug 2019 15:21:46 -0400 Received: from mail-vk1-f201.google.com ([209.85.221.201]:45490 "EHLO mail-vk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726275AbfHMTVq (ORCPT ); Tue, 13 Aug 2019 15:21:46 -0400 Received: by mail-vk1-f201.google.com with SMTP id x83so45764618vkx.12 for ; Tue, 13 Aug 2019 12:21:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=U4sqvdKOHk6dd3bPdrZadjO6yR4my3JBXo6uYepBVBY=; b=SsSWHVmB3VKy9t0EY0Vi920PorFVCWXYmiLt3Ikok8W4LD59Z7p0a7y4LOlHI9zHL7 OToRrq5Z+CreeX6SDf4hpxRROlIqvMxLzn0NqOUhtal8gQce5IgTrNKh1CWUmobRZAwj QJCRss7oQWBuYu+K7505i2HCL7AiBinNapi8Gd95r3LKCgw0F6ytkYd5+hPeWkFaWgLl y6ykOnAGQEAbcnJuGLqDplx/ibrJ9jDDwgYGQ5+AHfRwud/T9TyeqxrcGOiPzUeuWL6U yEMQ4kToBR1mvhVUL0JRmTo4Z8+6N0dOkpWjwjJZ7R0kkzWPRjAI3va6hbnlQL/e0oyU oXSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=U4sqvdKOHk6dd3bPdrZadjO6yR4my3JBXo6uYepBVBY=; b=MvINziPcJcj+OypHTOwoM9+Nvq577BIzXTuJAowtwgtmIFhCT5O20thMtPeGgOeYAT o6R0stLs6z6xDcrLGzzeOKJPZSxA/vNdOYho2CPHdqEG8C8ba623nTEK3YUAbXQ2wgHG Qdr2Lvy60jKfUUSdaO35gagKn/hUO2mQZY2bq1ZRFw+NCIKqF5xo3XNwA8KRm2Y4tjiH hLcb0CygGr8A6pb1To2YOSNfk0fr0cCbsMxRrPQCl8jHkm5VcdkyzfLGp/gC5Z7GI7m+ xHzZ435U8vfDU3FVGEHPvk5F3LWUS1S4eduqw+tV4O+DerLmhQYO/pE0DKbAYZk6kUdm 5FfQ== X-Gm-Message-State: APjAAAUYFacHOLP4EA8Fw1OmT0VbIcLhbfJ8o3KaIvAQIDTsiZrrU+3o LW3nLuiMgO1B3qhgxeqlvgMbqRuzUa/NcCVSX9sExw== X-Google-Smtp-Source: APXvYqzAE/erA5sSA4sUWQJ44I89ctbCbVNVQtqbb7rQPZwii3Rb4chhl0+b/gWVV3N1Y7i7AKkQSjAUBSWNtzNexJpZkQ== X-Received: by 2002:a67:8ec6:: with SMTP id q189mr27008065vsd.43.1565724105306; Tue, 13 Aug 2019 12:21:45 -0700 (PDT) Date: Tue, 13 Aug 2019 12:21:26 -0700 In-Reply-To: <20190813192126.122370-1-matthewgarrett@google.com> Message-Id: <20190813192126.122370-7-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190813192126.122370-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog Subject: [PATCH 6/6] Document locked_down LSM hook From: Matthew Garrett To: jmorris@namei.org Cc: linux-security-module@vger.kernel.org, Matthew Garrett , kbuild test robot , Matthew Garrett Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP The kbuild test robot pointed out that this wasn't documented. Reported-by: kbuild test robot Fixes: c360be6c ("security: Add a "locked down" LSM hook") Signed-off-by: Matthew Garrett --- include/linux/lsm_hooks.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index 5ec2912c8661..2f4ba9062fb8 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h @@ -1446,6 +1446,11 @@ * @bpf_prog_free_security: * Clean up the security information stored inside bpf prog. * + * @locked_down + * Determine whether a kernel feature that potentially enables arbitrary + * code execution in kernel space should be permitted. + * + * @what: kernel feature being accessed */ union security_list_options { int (*binder_set_context_mgr)(struct task_struct *mgr);