Received: by 2002:a4a:301c:0:0:0:0:0 with SMTP id q28-v6csp122381oof; Mon, 24 Sep 2018 17:20:36 -0700 (PDT) X-Google-Smtp-Source: ACcGV62sXw5UVS3skxYuibsZqTXXG1CvMLGO6pHAYUajcIVHLckq6+cvI2vPv+je1ONhkE7LNg/R X-Received: by 2002:a65:60cf:: with SMTP id r15-v6mr927501pgv.41.1537834836584; Mon, 24 Sep 2018 17:20:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537834836; cv=none; d=google.com; s=arc-20160816; b=g6q3O4DZL3st0x+1nrx+JUEch67uz5NxqtXA+Dpb0eU6hJ2MdUJeRRLfSHdqT/vubF np67Ll4kCa/Vio/MWdWmu0ftdvhycwUn3E0ZELqMJvfjIwFPZOkBXTHuttQqZ3Re8AN+ nvme3S55F89UpB+FByVSSsJa2oOXZ/Wtruj/keEbNk84yqjNdYfZowVIAJY0aTDL/IjS qEu2OiVWOLuVwrLyjQ5j5ZMjkXObK++82RM/bNwh7focqVqRmIIYymE1rFEqraVig+ms oFz/vKlbau5KSCcW6xUUwcd+xL9RDJN0HnkkJBUKOgFymJ4c4cfKDk40ZZY1GtnDEBii qtHw== 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=V3gWF7rko5DL5iZJCCi6Kc67O4L0MbWrE1FLQotdnGU=; b=eYs2cLwYCZGvM5+XniWS3U4Cf82Ms/wB4rPD8W0skU0cdA44+M1A7kNOt9zeS4120J Y/5sJuupn+83eMZ+yBJCcO1sAqQzkn8Qpq+sBZ197f8VofE9rKV51PYsfjA1FuEeexX2 2S0gvbMMnuniPO9MIHFS/SB/f4h7CUffMVmWPir2WfqOaUy7MPeTW9bJ6g8ODyoZoKqc 40iY2myVA7QiQjiyywiTodxBkIu1sGcoKOIt7pSaDH7mLn1h8TpA+aoa3hDxcVkVudge NtEiBeSUD7exCZracKwD2wIgauONV49sU27KMZxeBdCoH2vJxwZomwvH7u0s/u6a+9FQ W/jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hkOjT+tk; 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 e1-v6si690382pfa.274.2018.09.24.17.20.21; Mon, 24 Sep 2018 17:20:36 -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=hkOjT+tk; 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 S1728743AbeIYGXh (ORCPT + 99 others); Tue, 25 Sep 2018 02:23:37 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:39075 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728634AbeIYGXd (ORCPT ); Tue, 25 Sep 2018 02:23:33 -0400 Received: by mail-pg1-f195.google.com with SMTP id 85-v6so7044382pge.6 for ; Mon, 24 Sep 2018 17:18:47 -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=V3gWF7rko5DL5iZJCCi6Kc67O4L0MbWrE1FLQotdnGU=; b=hkOjT+tkFnNlRszSXPE//GHlDYA0w4AK8opuzxqqgNSPnb4aEo6bx3OTwffySrpN4W jIb9d1mocCjbaiWHTR+rZjDkXeKO0vUU+VHXyYFomeC2mkGsAuU6YmkwUm26MIDQ6jZJ gsOo7QwkxDatM8nWhoWjLBhDOoJ+Kh5j0QS1o= 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=V3gWF7rko5DL5iZJCCi6Kc67O4L0MbWrE1FLQotdnGU=; b=d0IAM5pIYr8WBFd5w6hYdnkcrJUnK+ih0gSPeT1bpYTwrESrsI6IiXLi5wyrjx7n7B WRB8viIwMN0RJdnUFLMfuKF7OqeHayKHCPuZz7jCGoshh9MVAboNHxEdZZ4cnfQI6T4I 84hlPcvvWj8BeliE7nTo51qa6mAU6TQJW58lBfI+6/5OouT4ps2Qe8+yKNcaX95A8E9l 29q3hNZNSaNd8RuWb0GgVqNmAti4OFE2w/T7kPiBFrbPNneNP+GrAJnem0XXfJl1Khrh tEtuecnR0OKbG+fX5wqofCttsVZ1qfWEUoFmmLy9dLhH33a/OHZ5x3/UEgNb2oihljA/ KvGA== X-Gm-Message-State: ABuFfoi4zt4uHUgjK1QjkX6iX9qhq2pmNTUmXe1K0SRgQVTEtUsPfeCh FRsbGr7LsIje9RvEVhke5pIHhA== X-Received: by 2002:a17:902:44:: with SMTP id 62-v6mr955985pla.181.1537834727371; Mon, 24 Sep 2018 17:18:47 -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 v83-v6sm612154pfa.103.2018.09.24.17.18.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Sep 2018 17:18:42 -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 v3 09/29] LSM: Provide init debugging infrastructure Date: Mon, 24 Sep 2018 17:18:12 -0700 Message-Id: <20180925001832.18322-10-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180925001832.18322-1-keescook@chromium.org> References: <20180925001832.18322-1-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Booting with "lsm.debug" will report future details on how LSM ordering decisions are being made. Signed-off-by: Kees Cook --- .../admin-guide/kernel-parameters.txt | 2 ++ security/security.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 9871e649ffef..32d323ee9218 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2274,6 +2274,8 @@ ltpc= [NET] Format: ,, + lsm.debug [SECURITY] Enable LSM initialization debugging output. + machvec= [IA-64] Force the use of a particular machine-vector (machvec) in a generic kernel. Example: machvec=hpzx1_swiotlb diff --git a/security/security.c b/security/security.c index e74f46fba591..ee49b921d750 100644 --- a/security/security.c +++ b/security/security.c @@ -12,6 +12,8 @@ * (at your option) any later version. */ +#define pr_fmt(fmt) "LSM: " fmt + #include #include #include @@ -43,11 +45,19 @@ char *lsm_names; static __initdata char chosen_lsm[SECURITY_NAME_MAX + 1] = CONFIG_DEFAULT_SECURITY; +static bool debug __initdata; +#define init_debug(...) \ + do { \ + if (debug) \ + pr_info(__VA_ARGS__); \ + } while (0) + static void __init major_lsm_init(void) { struct lsm_info *lsm; for (lsm = __start_lsm_info; lsm < __end_lsm_info; lsm++) { + init_debug("initializing %s\n", lsm->name); lsm->init(); } } @@ -91,6 +101,14 @@ static int __init choose_lsm(char *str) } __setup("security=", choose_lsm); +/* Enable LSM order debugging. */ +static int __init enable_debug(char *str) +{ + debug = true; + return 1; +} +__setup("lsm.debug", enable_debug); + static bool match_last_lsm(const char *list, const char *lsm) { const char *last; -- 2.17.1