From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f194.google.com ([209.85.215.194]:45279 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728676AbeIYGXe (ORCPT ); Tue, 25 Sep 2018 02:23:34 -0400 Received: by mail-pg1-f194.google.com with SMTP id t70-v6so5309033pgd.12 for ; Mon, 24 Sep 2018 17:18:48 -0700 (PDT) From: Kees Cook Subject: [PATCH security-next v3 10/29] LSM: Don't ignore initialization failures Date: Mon, 24 Sep 2018 17:18:13 -0700 Message-ID: <20180925001832.18322-11-keescook@chromium.org> In-Reply-To: <20180925001832.18322-1-keescook@chromium.org> References: <20180925001832.18322-1-keescook@chromium.org> Sender: linux-arch-owner@vger.kernel.org List-ID: To: James Morris Cc: Kees Cook , Casey Schaufler , John Johansen , Tetsuo Handa , Paul Moore , Stephen Smalley , "Schaufler, Casey" , LSM , Jonathan Corbet , linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <20180925001813.8-2GGhpR6tenLaLKPEyUxsyfo7ctFgykb6XHt9CaKrQ@z> LSM initialization failures have traditionally been ignored. We should at least WARN when something goes wrong. Signed-off-by: Kees Cook --- security/security.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/security/security.c b/security/security.c index ee49b921d750..1f055936a746 100644 --- a/security/security.c +++ b/security/security.c @@ -55,10 +55,12 @@ static bool debug __initdata; 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); } } -- 2.17.1