Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2434106imm; Sat, 15 Sep 2018 17:39:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbgDY3v8hViMjOwWSsFBx/RyYrmYkpXLefvzCGuOxNqQK3GjbKq91mbAlNfOe4aQ8kgGKZV X-Received: by 2002:a17:902:7145:: with SMTP id u5-v6mr18666525plm.259.1537058363128; Sat, 15 Sep 2018 17:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537058363; cv=none; d=google.com; s=arc-20160816; b=eGEa+rTmWsVgyNhM33S1PLMKZGFGMoewwQWY/Fm2TMoSu9Piot1EGsQQ4lTWEUL73U /v7EpoCARvr00hJrOIjbLbsIJdSfvqYoL76rquqOc5evDMZ3gskDWGhYSNix8HEJKLwe Aiyk0PREaQUZhOEzs0n7tSZWH8Enf0u6wguOiN4cUqdjvTbWwzyDHBBvw7Y9dVDaWJXW 79QdllPG9Hc49xKGZ3JpJqH9bv/Bt1HClIkUi5dS7uMdcspLu2d4hCioPIKy8rjygOTg /dAHg8OtMNNKLlyPJgLEsxLGFTU/XSvasQ8MXbON0RMpY+xiym4EnZhm5LFLtSHCVeWv IwaQ== 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=2uODomYPzcjoTQQPESLleriIuqidQ5xqsN+C5mdVLUU=; b=zgg+2weZX2GTwIyEA1WXHGLeQeh31nkzvxKU1KCAMlkGsmX4TRwRXPYgwRoQw016Ho GDjLIqsRewLEV6cmTP/t7EqtrMIodvdVw9UzDTOCjkjkxL18PiUuorPxNK6Smi+8se+P T1jklHfmTetoG4B7zmD8oyZhxWX3eUkefeSWCZpYG7Ywb82dLK0Ubvu1yiATLEz+g58J uy4xK9hMX4M9XdlBFrQ5mjwyXkbk6Hk4OReTV7k/nZXT9bfyIIZ62XsbJzHjhDErbuQ1 EuNQLnkGTnS7hBCP5ai6H5MpL7Ydr8DAMBTmHiL5BnGFeSqQ9pqtBwyMTo/uu7ODeXuw yOcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="jh/fYOru"; 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 s7-v6si11424695pgj.480.2018.09.15.17.39.07; Sat, 15 Sep 2018 17:39:23 -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="jh/fYOru"; 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 S1728126AbeIPF7u (ORCPT + 99 others); Sun, 16 Sep 2018 01:59:50 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:34044 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727726AbeIPF7t (ORCPT ); Sun, 16 Sep 2018 01:59:49 -0400 Received: by mail-pg1-f193.google.com with SMTP id d19-v6so6037483pgv.1 for ; Sat, 15 Sep 2018 17:38:51 -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=2uODomYPzcjoTQQPESLleriIuqidQ5xqsN+C5mdVLUU=; b=jh/fYOrus0NcGv3zrDb+DvAW8rZwHjKGZcKpIKMJuLsff/l5JVlANpaOP070W9VMG8 1UcOtTzXPlBDj7MfFCEPXQNWkZ0ZwX9D6yR7N1XDv6cxPRjQ1vfuqZqKeYPJ+PL6pgUn FqDdizPT+5O1jjmaSB2TS8cE0cPDgFTrVouNw= 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=2uODomYPzcjoTQQPESLleriIuqidQ5xqsN+C5mdVLUU=; b=Lb4MGnVHa1Syfkkz/XDszNt4Oz4wX/Mr7MW5SJ4FnuV2uV5UwkR74F/PP4/RC1nJPA IXTL2zHwuabDYlRxM6LQpad6+LWKhqZ6cmOxagA1AcO2WH3HcfIl4zBnnChvJbLJovrv ZZ9ksHr9/hturWdoxRSaSh+/ux0GvA3TjVTxpnZzWytjFb3dP1bEBBf60aO6euchUzhO Is8S0cQUr7pzwL3JEjHYS70zQ6UjOGDoNN3KOA04TIyuZmj70uq9jCrGltKT3qh86esr 8K5PeTPoPtl/ZIytDE8LYnQQTpHeLyt3Xff5gOQsXApHdJy1s2fdJnrnS+QbfgxZ7O2a dLMg== X-Gm-Message-State: APzg51DY6XZasQ/2/AOT4zyIVKTPCgZPu9zjJLh+zTzjzYf39ak6lkuL qd5zP9XxT4ghd94BX3oy5YBh9w== X-Received: by 2002:a62:2c53:: with SMTP id s80-v6mr19015526pfs.154.1537058331240; Sat, 15 Sep 2018 17:38:51 -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 5-v6sm14160058pgc.86.2018.09.15.17.38.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Sep 2018 17:38:49 -0700 (PDT) From: Kees Cook To: James Morris Cc: Kees Cook , Casey Schaufler , John Johansen , Tetsuo Handa , Paul Moore , Stephen Smalley , "Schaufler, Casey" , LSM , LKLM Subject: [PATCH 18/18] LSM: Don't ignore initialization failures Date: Sat, 15 Sep 2018 17:30:59 -0700 Message-Id: <20180916003059.1046-19-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180916003059.1046-1-keescook@chromium.org> References: <20180916003059.1046-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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/security/security.c b/security/security.c index 3b84b7eeb08c..a7796e522f72 100644 --- a/security/security.c +++ b/security/security.c @@ -203,11 +203,15 @@ static void __init maybe_enable_lsm(struct lsm_info *lsm) /* If selected, initialize the LSM. */ if (enabled) { + int ret; + if (lsm->type == LSM_TYPE_EXCLUSIVE) { exclusive = lsm; init_debug("exclusive: %s\n", exclusive->name); } - lsm->init(); + + ret = lsm->init(); + WARN(ret, "%s failed to initialize: %d\n", lsm->name, ret); } } -- 2.17.1