From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-6.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable autolearn_force=no version=3.4.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id C8EAB7D8D7 for ; Thu, 11 Oct 2018 00:20:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727164AbeJKHnj (ORCPT ); Thu, 11 Oct 2018 03:43:39 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:43294 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727148AbeJKHni (ORCPT ); Thu, 11 Oct 2018 03:43:38 -0400 Received: by mail-pf1-f193.google.com with SMTP id p24-v6so3433215pff.10 for ; Wed, 10 Oct 2018 17:19:04 -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=O55DFeS8ueFeZRsonWfjwV1xQL3qE86rj2SxIpnAmMg=; b=SnJL19inC1A4uT1F9hK0NVjaJHzq4ikuhyvQZjAdgvEZYbYPVBYF99u+kezQV7YvtS TRWhdqZoJNOwf1Xr5Vmkq1dYyTLwe1OnOzAs9UWA2CZooDhUDac9UEaTwJDdOEdoe9rZ r7bJlN7WfZYwNT3zKh6fTEO4BS3805PxuY51M= 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=O55DFeS8ueFeZRsonWfjwV1xQL3qE86rj2SxIpnAmMg=; b=TLkfqn/T9/PlXPkGEI1JuwenGssu5WAAeRajm9jX1BANIkmNqMCf7NfY3MRK0IJAPs bNgr6Rp5C+cIpNAr9tge1tN4z1BpRKJO9Tr1ZOqhcViKGkWnNi032ENGHJ5DTeiIkdOR w28TvO7dzX7dmt/Ug7g3liPQzkezeJtFgjWF5x0tZj0J/j5MVXQlmtlMyagHUMYFj3gM IokBGOr/3wzeCyWvtAIGfMzABbw8YXUbqscayoxAhGdBBpQmK/1hP/Q3WSRPrmNmAUHn QnbtfIyfxkwyhdEiMxwTBUxoLdiuS1zSDPXBHvAgSD/Ow2fZgRi6d+f19lC3H6I24UL/ Qj5w== X-Gm-Message-State: ABuFfogqCmEpq0XMBAAUhbUv+rHsXswlmYcX05yiL3XWZJU6b5TJTs0t 6VFREZzB8kapogk2UJHYtL4VMQ== X-Google-Smtp-Source: ACcGV62ySqYROrB5LLeSkAniSEvUin/jAQUthu9Z2hI8/66fd8ozoSTiVrhYKRl/r8/5x5QALVqtXg== X-Received: by 2002:a63:fd09:: with SMTP id d9-v6mr32277270pgh.164.1539217144391; Wed, 10 Oct 2018 17:19:04 -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 b3-v6sm40544422pfc.178.2018.10.10.17.18.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Oct 2018 17:18:58 -0700 (PDT) From: Kees Cook To: James Morris Cc: Kees Cook , Casey Schaufler , John Johansen , Stephen Smalley , Paul Moore , Tetsuo Handa , Mimi Zohar , Randy Dunlap , Jordan Glover , LSM , linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH security-next v5 09/30] LSM: Provide init debugging infrastructure Date: Wed, 10 Oct 2018 17:18:25 -0700 Message-Id: <20181011001846.30964-10-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181011001846.30964-1-keescook@chromium.org> References: <20181011001846.30964-1-keescook@chromium.org> Sender: linux-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@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 Reviewed-by: James Morris --- .../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