From patchwork Thu Oct 11 00:18:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10635541 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 3C922933 for ; Thu, 11 Oct 2018 00:20:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27C6D2ABF0 for ; Thu, 11 Oct 2018 00:20:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BA6C2ACBE; Thu, 11 Oct 2018 00:20:01 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI 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 B35D62ABF0 for ; Thu, 11 Oct 2018 00:20:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727268AbeJKHod (ORCPT ); Thu, 11 Oct 2018 03:44:33 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33313 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727081AbeJKHnh (ORCPT ); Thu, 11 Oct 2018 03:43:37 -0400 Received: by mail-pf1-f195.google.com with SMTP id 78-v6so1060903pfq.0 for ; Wed, 10 Oct 2018 17:19:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qfu2i5vCbLXUhEgxVTjIKQVSKkT0aaheZInMAAU7pCg=; b=h8CSwExuRPJDsJrDiwuXEIyychgJe6pkvqcLZBNNK8I35pEFBC2JDMH9FmbCB5c4Hh 2XqMoTa2jXCGVupBPQtfabThLm2M/nFsf9gez6PimPn0zhmC8QU6Ij9PGuhRlp60+KYy l24DA0UBAjTpm3PNbqWTTD4YzjRpiIPoV0N2o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qfu2i5vCbLXUhEgxVTjIKQVSKkT0aaheZInMAAU7pCg=; b=m/QF0LzelofBhKnKlUXq+a420NThXNGAZARWPh0t3Sb/QzW1xWkvH4Vqe8raei9cxY ytxzrHuO2gs/+ivZMgiIx7O+LA5fs+n92JC3qdUQd5B5Otcr9+0LtIkApwcgTaIVXn3D +VbfP5pnxVXfHBY03epkSr09MWQ7sdJQvfxwEMvBX2aAl4snjbO1tvyQuEpXYxagNKYj 3By6W/Xwn7GdvR5AyWc+Rn0HcrRqawYctREg8dWXO3/3xsNUshmzqTsOel0fjGnrLxXS +TzakhRhPH/xxNBwmDy53erUc4ETczJjvnbTs+vwMAxWlzlzYBPbHSf6CELilrvsyflt t5iw== X-Gm-Message-State: ABuFfojFkf2qm1cpn2sTKZWBpU/E6mRI9wWaOmw6Qcu2sH9+8cO93Jv9 DRciqymIEFUP90eHJMIZ8kbLhQ== X-Google-Smtp-Source: ACcGV63prjsFPCaTcde6dqOws5c/V8PiRq37SDg6xRRo82yu+prgVvu9t7835fjLP2q7ILQSj1HJJA== X-Received: by 2002:a62:ccd4:: with SMTP id j81-v6mr37703628pfk.76.1539217142740; Wed, 10 Oct 2018 17:19:02 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id k3-v6sm73024605pfk.60.2018.10.10.17.18.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Oct 2018 17:18:58 -0700 (PDT) From: Kees Cook To: James Morris Cc: Kees Cook , Casey Schaufler , John Johansen , Stephen Smalley , Paul Moore , Tetsuo Handa , Mimi Zohar , Randy Dunlap , Jordan Glover , LSM , linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH security-next v5 10/30] LSM: Don't ignore initialization failures Date: Wed, 10 Oct 2018 17:18:26 -0700 Message-Id: <20181011001846.30964-11-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181011001846.30964-1-keescook@chromium.org> References: <20181011001846.30964-1-keescook@chromium.org> Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP LSM initialization failures have traditionally been ignored. We should at least WARN when something goes wrong. Signed-off-by: Kees Cook Reviewed-by: Casey Schaufler Reviewed-by: John Johansen --- security/security.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/security/security.c b/security/security.c index 395f804f6a91..2055af907eba 100644 --- a/security/security.c +++ b/security/security.c @@ -55,10 +55,12 @@ static __initdata bool debug; static void __init major_lsm_init(void) { struct lsm_info *lsm; + int ret; for (lsm = __start_lsm_info; lsm < __end_lsm_info; lsm++) { init_debug("initializing %s\n", lsm->name); - lsm->init(); + ret = lsm->init(); + WARN(ret, "%s failed to initialize: %d\n", lsm->name, ret); } }