Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp719262imm; Mon, 1 Oct 2018 17:56:50 -0700 (PDT) X-Google-Smtp-Source: ACcGV61MW2WkynP2ocbsDTf8mX5sLLa1ws2F2hXQQLHFCps5osK43EuleTV+dFq4+tkRz8L2sav/ X-Received: by 2002:a62:898d:: with SMTP id n13-v6mr13911900pfk.57.1538441810417; Mon, 01 Oct 2018 17:56:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538441810; cv=none; d=google.com; s=arc-20160816; b=Cz06AIDKw7l82krIM+PIFHVEEcUuA/f8UKA6LBZgbujcI3lXGMDdUBKVrJdTwo0ct7 eK+drO/fEnejqh7/leBmQBSu7kpe8WxcpaoFAHgmGPzL/IIJToeeEL+0pDnRxVmJtMVb LmuGeBuC98MmUKWa2jB7oWAgu8bcLvNUhqKd8cQgNMZjPAp3NncleGs83QohgrIoL9pQ PmvAoJCTcaYzGOu1bgWqs7KdC5kIRiS67EGzC7GC4Xr8QzbnAumBvx8eYoN7bXXzzv90 vLp6Glas46NdOFXNdfFCmaHcddfo9J9CaE22OoLmLezS5mTVJvzGvMMq2T+p8Ke5FsQX s3vQ== 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=coT3X8tVSAJpPw1SxEOHYVe3MlpWDyaK1fjOEndGqVU=; b=c0HHFWczvRjIoRo31LFfgzPeK3iHH9GifiJ/Vzgvp+bPmjzxBMKo65Ys4x2qhME/tn YGygYNdgVyHIsX4FlQCTajX4Asxol28ciJsuWrbZwp9XZMb+Tjv0QtuG3aWXKVoHQta+ E/bTK3vEttgFaVyz5IHxeQWm6Bz/JgC4Lt7Ua9BORfkYZwcTM0nxL5xdgdF3PzbIwKCA A5QEJ3WeCm26g/rLb4OZha+lXr71kc6C8GZp8ghitl5wCNHNp93PbSrGe1a/2UtXTNVi y66O9N6SHobtNeM3UAk77UK5KLODnxpMR4y51k1KKUOtr+u+FMJhhJr5UG0ccj0d6sf4 pOVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Yyh9c4r8; 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 q15-v6si14315622pfj.260.2018.10.01.17.56.36; Mon, 01 Oct 2018 17:56:50 -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=Yyh9c4r8; 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 S1727059AbeJBHfv (ORCPT + 99 others); Tue, 2 Oct 2018 03:35:51 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:36256 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726909AbeJBHfr (ORCPT ); Tue, 2 Oct 2018 03:35:47 -0400 Received: by mail-io1-f65.google.com with SMTP id p4-v6so264156iom.3 for ; Mon, 01 Oct 2018 17:55:18 -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=coT3X8tVSAJpPw1SxEOHYVe3MlpWDyaK1fjOEndGqVU=; b=Yyh9c4r8HcXrwZjSirhotaTthk0NLxyrtfg2GQ7LiwXyRWVrGXiqMbqkV3uB+JQeHX Ky4m5kQaHYTjykplveV9uXn+Jr4rkzA1xy9fT5MN/3FZAWAL25XsEqeC4Ivn5+OM24dA Qjyc28qKorbF5wVPtDI+GqrsRr5cj1zQEAEFY= 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=coT3X8tVSAJpPw1SxEOHYVe3MlpWDyaK1fjOEndGqVU=; b=SMhb6yz8M5CJpUP4Z3E9e0KfsfYIYcjaPtQYiP48LOlBwBohnjs+6tB1dBPyiV7D4L I5Q36RHM6DP2XmkhRYxPA77eZxsF06g7MzZeNYAIHkrOSIrs8lk91HmESkTNfrABsRsF b/SAMuagGln/48e9nDm5FWHRaaBQKACJtwxrdVkULs0+skcmmirUC8MwSi3euwQt10ix aegJfQhZQVIA6L4WVfnSOKcDqwCVcPksLuVqY1EgcgGa3rnxjLLBB8tyOFpsBxyNJ6o2 1o1YXV96Fr0LLBUQa5j/SfghiaB1kmVqEY2FbohGQf89vWX6k6xTACjdju7XWgQWKCFM eMzQ== X-Gm-Message-State: ABuFfohSJZSU/cDFHunNMODIizHhIDjJs8cW3pEuPX95l/VkPSF3gDGP ye3Mkpb9k5zjb4tqxP8Oat4XjQ== X-Received: by 2002:a17:902:9f8c:: with SMTP id g12-v6mr14307634plq.309.1538441718186; Mon, 01 Oct 2018 17:55:18 -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 a2-v6sm17051135pgc.68.2018.10.01.17.55.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Oct 2018 17:55:13 -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 v4 09/32] LSM: Provide init debugging infrastructure Date: Mon, 1 Oct 2018 17:54:42 -0700 Message-Id: <20181002005505.6112-10-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181002005505.6112-1-keescook@chromium.org> References: <20181002005505.6112-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 Reviewed-by: Casey Schaufler Reviewed-by: John Johansen --- .../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..395f804f6a91 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 __initdata bool debug; +#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