Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2213288imm; Thu, 20 Sep 2018 09:25:26 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaFO72oFreRb+osRlma+SQMZuG8w2cv4cDgNnZrOU/PqGX8QEJRS2C7MOdKo04gRQeV29lx X-Received: by 2002:a63:f14d:: with SMTP id o13-v6mr37278449pgk.236.1537460726742; Thu, 20 Sep 2018 09:25:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537460726; cv=none; d=google.com; s=arc-20160816; b=l/nbjpYi4CJqMTRNSxnxTpJEFEv2Iwa5VR9hAwn8lZi8GleAw3WVRPr8cGgNDRgOuz 1T26vud0DQgVNYbtsVpw5njeZjjKVuc7SYj7vUDl5aBFfrTOhhry+RibIGESzBDG5Sqm +dTn8YUjkWEhM2Jnju4cELDFKJeul8Ffm1/+4Hp/bkMJ8SutVO770wJ+TzKfD+Tp9TsB c3SwZH6mSVHS+Q157AF2PQpUskg3lLVH5wvx71os5Sn6lkbAHiB18FCbevdyhxZugh0l wuEjUF8+3sFjR7ILzLxtUiUSAlKmXoypOvt3mPxOvaJFPzk/BgEjmEr1hxdTmnu4aAyG /oHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=BZjzkTJ7R/6jxPCxq75uSj94glR2mULSvjebOSVz4jc=; b=U4orqXESXzcIxuuNjpbAJVuOlXSCI07kvWt9xX08sLGmSIF8yz884dkUJw5C1gvXzo fmJpF+MxUlgnu4uBeV1dacS5XT/99+XIfD7HaDjxCVOybSiZW16tcz3NavvrJ36Yr2WC 5aTK9Pu8PlHVG/DdH73yLvYE9FuL7zVoVHvxh4d/X7+Qqk2vZg0yCapVM/6zX8rHJAT3 UWGzdnkLZurpvVvs7AwVyoPt6IWciEMkvdd1moVBZhozOIPWZ2tQJzCDoNZYL3jwqIyw HJTQ4lgGwZQvHiXTHD5/o1YDyiieE2L5mY91nhD+aEiGtTuS5foytUjJYkBfSmBPE0Jl 4ORw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=MxXn5o1w; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f90-v6si24653607plf.30.2018.09.20.09.25.10; Thu, 20 Sep 2018 09:25:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=MxXn5o1w; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387923AbeITWIK (ORCPT + 99 others); Thu, 20 Sep 2018 18:08:10 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:46595 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387866AbeITWII (ORCPT ); Thu, 20 Sep 2018 18:08:08 -0400 Received: by mail-pl1-f193.google.com with SMTP id t20-v6so1150776ply.13 for ; Thu, 20 Sep 2018 09:23:53 -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=BZjzkTJ7R/6jxPCxq75uSj94glR2mULSvjebOSVz4jc=; b=MxXn5o1wdwyUuv3gmjvXz9NVRRSlP+x+Rz1IVveFVDlxx49jM8QkeGYTj+2lEj19Ck HyUGyqGRAHYTsoLpAVKXVO3oJSRTrQ9g04aCFM8tAsox+vUhAOv4lOGgT8jRe5nnyqaU q7TJK3kweWHBAT0eHuHhh9/o7VuN3z88+piyQ= 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=BZjzkTJ7R/6jxPCxq75uSj94glR2mULSvjebOSVz4jc=; b=kDnxIS89oGX9FDCwA/ttlaYydliH4KOCS/V3jok3sfQ3iH6hYc1IhTxo4vkCwZXRcs GPfjAbKKq2QpVwbca6yzKw8938EG6ZD+AMDAtbrCLOi4++4sPnc5lDQ6S5XdgTrTdNRS 5g7T0Po23yh5LbXhlGL44P/Hkn9QYKGfcHMaV/wP9A9nY0flxkjMIgr/46cwal5AO6hG BocOtWOar1Wko+1H9hJPPYLZ54QV/9NuGPLh/IyIeqY6RYH5Wb0cUN/6t9LqCXKi5XfT oOvlklSse29Q+fq+rJg+Fuu2V/eC6pieuhI07FmiHwUtuzoiHDjhj1UBec4MSF98Og7e 3dkw== X-Gm-Message-State: APzg51DIxLR87YaZIpR4pJUvzLy7lMFX/kGOr4G0xUaNftphvDGiUhkI VvN5HTUE0k9h2btL7d843n+qvw== X-Received: by 2002:a17:902:6b:: with SMTP id 98-v6mr4400899pla.258.1537460633220; Thu, 20 Sep 2018 09:23:53 -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 c1-v6sm31903041pfi.142.2018.09.20.09.23.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Sep 2018 09:23:48 -0700 (PDT) From: Kees Cook 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 Subject: [PATCH security-next v2 10/26] LSM: Don't ignore initialization failures Date: Thu, 20 Sep 2018 09:23:22 -0700 Message-Id: <20180920162338.21060-11-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180920162338.21060-1-keescook@chromium.org> References: <20180920162338.21060-1-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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