Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2213418imm; Thu, 20 Sep 2018 09:25:33 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda5E8KJVWbO2A5tbHmaZQ950OUKG6d37RFCVocWGvY4UGv2AfdQy1/oy7D8eA1c37qaltrf X-Received: by 2002:a62:880c:: with SMTP id l12-v6mr42907107pfd.204.1537460733246; Thu, 20 Sep 2018 09:25:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537460733; cv=none; d=google.com; s=arc-20160816; b=Ar/c9MeOSRKjIqoUQNB1iW+s/7wKBfzJtD/PHpLVrYazTb2IRLLqv7OV/3xdUiP8bS eX5X0pUDpSPgRi5FEi34cen3N37o0A34gE3wIa+NHgdpH1L1Pf0iy//31zlie2kwRRzK gqUpoi9v1dJkD+fTut9bBBCV5EBoFnGzfl0BaOa3NAqxMI8bZw3VEI7+UmmdYaZ5+zqx lfUb89zM1/t9KX1RbyK4ReOx13BoHt/APMitl91A1+DXmRGUfrBmJa3t6hLCEguf3T77 eP43duC2d3JGOo/e+AfgVOa4DJiYz2Bi+0WC8iry6xLo5h7V/edB6VzTsLkMlq0QFHrq /XNQ== 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=G3i95t7+v2g56KuLeRtbAudIISIFfGyqEheIMll8XMNy2qa33cRnOfJGBN2JIcZ5Zp NiOnDaan4Y+d2l0+VsS99v1bmIxOVUFCAXc8Y5noUNIrr6CBVmsb3FYDrFovebk8mNVs 3hcjIZclERcvx1aciFRmrl+g3gTcSVQIb9euzrwwoChDYy8WgeSMe+3+VJoD03mG/v60 zvGvLho//NjjYzWk5zCD81jpPJ4KUkIhDaq/A/tmqEukh/LGvRyzH3Iew/HIFwKHst2z dRt+/Yo4tF2kurx+ZT1BS14xpQIvSjlRMEp3WCtmUej0MuT+Ll+Rzl3T7tzscfcDceA9 gfLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BrecM7tm; 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 cf16-v6si26234580plb.254.2018.09.20.09.25.17; Thu, 20 Sep 2018 09:25:33 -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=BrecM7tm; 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 S2387888AbeITWIK (ORCPT + 99 others); Thu, 20 Sep 2018 18:08:10 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:34357 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387868AbeITWIJ (ORCPT ); Thu, 20 Sep 2018 18:08:09 -0400 Received: by mail-pl1-f195.google.com with SMTP id f6-v6so4594242plo.1 for ; Thu, 20 Sep 2018 09:23:54 -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=BrecM7tmXbNMsUhl0Mupx9lVNe2C1xFeTN5HxndpWFG10LXFE2t093zwwIFTEldMjU 0B/JdxWJCPJF7nf71jJKwN7QYCxwBJUxgygh5eQFom/wYx3UkP0M4hpk2VdVGZf0k6EW 2AaLPMYE1mizLaCJLG+W0bfPevqbuWTU05lfA= 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=g1Sma/O9Y6sab6OCHLxvGxlHwwNENhPb7EjKpFRvdKImcPI6KaTX0cUksZlGt8a9Jk +hcUGNrZSfv4OviLXt09HVwQ2A7+vRtGFK9tUzXiZ15CR9uwfTF87OKVHwrDFIKjGAPP C/ThbgZ68t8VfG6uCltlDZBxKKCOkFSgY2I8JauxTisl36HeqA6uXN56ntT4NOQvjGGl TDW/+UV93uRA/HTxtzY0WUKlr3PQ7D8b2RyLiCHjGKkEQGnmnMLUvvSv79GLl4mXXa1E 2LpAkCdX16Z2mhB3Cvc61l0wJ83Vq1d59kF72Lq05kawl3wCibOeBzrre350cgKg0znG SAqQ== X-Gm-Message-State: APzg51A6v9dWHDxnhNgDetQjZ0Q4UKAA90ETUcU1aVVAGj5w6sRVQC29 COwWdtHurg70n3zdSWOalIgyRw== X-Received: by 2002:a17:902:4601:: with SMTP id o1-v6mr40579191pld.202.1537460634349; Thu, 20 Sep 2018 09:23:54 -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 t1-v6sm26569696pgp.32.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 09/26] LSM: Provide init debugging infrastructure Date: Thu, 20 Sep 2018 09:23:21 -0700 Message-Id: <20180920162338.21060-10-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 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