From patchwork Tue Feb 12 18:23:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10808517 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D1EA1746 for ; Tue, 12 Feb 2019 18:23:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFBE12C554 for ; Tue, 12 Feb 2019 18:23:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3ABC2C5A3; Tue, 12 Feb 2019 18:23:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FE4C2C554 for ; Tue, 12 Feb 2019 18:23:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728534AbfBLSXV (ORCPT ); Tue, 12 Feb 2019 13:23:21 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:47045 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726685AbfBLSXV (ORCPT ); Tue, 12 Feb 2019 13:23:21 -0500 Received: by mail-pf1-f195.google.com with SMTP id g6so1661911pfh.13 for ; Tue, 12 Feb 2019 10:23:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=fZynsMqP80440N33/zyWh+nSbTs5Z2QL/QCUJqp1qGU=; b=dt65tWm4NckOQG+gXubMg9ozXeAHtWhmTfXZBlkIq/JgJgR7dCF4/eX6nCYSl+f/Nd KErOIJOxgjvL2Yx8TXEGmryRehxfy4dKrc6lWuGXlEVOS5mUlRU9o1GJzHHlupNOTELy +heAxF/O/uUhSqFZs3en+J/27jIzgtJLkLsvE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=fZynsMqP80440N33/zyWh+nSbTs5Z2QL/QCUJqp1qGU=; b=G6JPw9Q5DJ3/UaXKy/i/DbsIW7yWaa60ERZsShgcJP8Ar2jH8BMYCUszv5Rwk8fulz IfJkM9NqqJyEA1rXHHH05tXzhZQGO3q9myh+72bCUFTUnYkxBlFrHk0ZWFd2wcXMTn2X ZK4PB8HsKkp18YkmUP0HnaVTvPVHslUKg4p/1MlgGo719t1uSpcqcZI5/mODz7CGfCyv YdMAxS64ltD2RsWlxowljc7kWplXs8gxtOsf7vwa3ZJuGnLHsSz1pzmZlbEonmcZPFgp vWYEyqasv4O7/ggJuDDZ5u5wQJnKPvVkRXdzZ2CN3CrHeVcOeeGX8+zGBV6m6Ujt8sf8 ATIg== X-Gm-Message-State: AHQUAuY7zxu5PWjt4dK2CA/Ap7JyHGuoTzJdkFTRw1ES4qzlrc/hFLOC AnbazN0wLEeNyUBsxilNTAXVYg== X-Google-Smtp-Source: AHgI3IaHKd4c3P3WktFwJrSwlOOXjOzu6zbSSBJc1+mov5Zi7TjOtRj7AUjOb6FtZ76YuYKczZvIZg== X-Received: by 2002:a62:b2c3:: with SMTP id z64mr5187699pfl.149.1549995800723; Tue, 12 Feb 2019 10:23:20 -0800 (PST) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id y5sm44730501pge.49.2019.02.12.10.23.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Feb 2019 10:23:19 -0800 (PST) Date: Tue, 12 Feb 2019 10:23:18 -0800 From: Kees Cook To: James Morris Cc: Tetsuo Handa , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] LSM: Ignore "security=" when "lsm=" is specified Message-ID: <20190212182318.GA16669@beast> MIME-Version: 1.0 Content-Disposition: inline Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP To avoid potential confusion, explicitly ignore "security=" when "lsm=" is used on the command line, and report that it is happening. Suggested-by: Tetsuo Handa Signed-off-by: Kees Cook Acked-by: Casey Schaufler Acked-by: John Johansen --- Documentation/admin-guide/kernel-parameters.txt | 10 ++++------ security/security.c | 8 ++++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 93d2c97f28fe..a0abd5f56e00 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2340,7 +2340,7 @@ lsm=lsm1,...,lsmN [SECURITY] Choose order of LSM initialization. This - overrides CONFIG_LSM. + overrides CONFIG_LSM, and the "security=" parameter. machvec= [IA-64] Force the use of a particular machine-vector (machvec) in a generic kernel. @@ -4129,11 +4129,9 @@ Note: increases power consumption, thus should only be enabled if running jitter sensitive (HPC/RT) workloads. - security= [SECURITY] Choose a security module to enable at boot. - If this boot parameter is not specified, only the first - security module asking for security registration will be - loaded. An invalid security module name will be treated - as if no module has been chosen. + security= [SECURITY] Choose a legacy "major" security module to + enable at boot. This has been deprecated by the + "lsm=" parameter. selinux= [SELINUX] Disable or enable SELinux at boot time. Format: { "0" | "1" } diff --git a/security/security.c b/security/security.c index 3147785e20d7..23cbb1a295a3 100644 --- a/security/security.c +++ b/security/security.c @@ -288,9 +288,13 @@ static void __init ordered_lsm_init(void) ordered_lsms = kcalloc(LSM_COUNT + 1, sizeof(*ordered_lsms), GFP_KERNEL); - if (chosen_lsm_order) + if (chosen_lsm_order) { + if (chosen_major_lsm) { + pr_info("security= is ignored because it is superseded by lsm=\n"); + chosen_major_lsm = NULL; + } ordered_lsm_parse(chosen_lsm_order, "cmdline"); - else + } else ordered_lsm_parse(builtin_lsm_order, "builtin"); for (lsm = ordered_lsms; *lsm; lsm++)