From patchwork Mon Feb 11 22:54:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10806923 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 C3C2013B4 for ; Mon, 11 Feb 2019 22:54:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE58F2A22C for ; Mon, 11 Feb 2019 22:54:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FB502B421; Mon, 11 Feb 2019 22:54:07 +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 14F022A22C for ; Mon, 11 Feb 2019 22:54:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727014AbfBKWyG (ORCPT ); Mon, 11 Feb 2019 17:54:06 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35281 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726955AbfBKWyG (ORCPT ); Mon, 11 Feb 2019 17:54:06 -0500 Received: by mail-pf1-f194.google.com with SMTP id z9so278024pfi.2 for ; Mon, 11 Feb 2019 14:54:06 -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=DAhMB66WOye4Rsj6bDeOQbNbLoWJEGTVizWiNqAylXQ=; b=P8db4TPa00jf2gdKKbsQ4JR//27/enkXpoooyBg+8q37oeI9r+KJsbfjzUGRvsueLU fyzK+7yqAR5bjN2O0ltSJyKkztHw80ITBsWeJRQys1gcvytiD7vO+GmXI1yM9eykfcRS o+F/+mVfa7oclkW1vswNiWfBhQL8vx+jsixUQ= 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=DAhMB66WOye4Rsj6bDeOQbNbLoWJEGTVizWiNqAylXQ=; b=nj4iPPi9K5JBGEsdYOl2TgXThL0dEkyrC9pLyEipmGZILBUGoSgnhsBxs+xezDbU4I CLhZ5OoIPwMS2raVMyEbREalZeqNAXKgBIROD69GJEN2Amj+CRKcmEe3siwhxTw4tJOx Ha/lxgLOvi6d3l7kGB912tLu5jf/FI+r9s9UjMiXiejCjhk4XEfaBlU2HH6t4nYMzF8g BzJfqvdXzpsvy9nHcrDAi5BRgd+h7gXEVFxXoLaZ9lnHD+dmqZW6og4Y2EpMD6G8lunE AWn6fCHK5QbPuz0qqGCMxawgYAZR0g9Lw1S/Rq93ghEvRcwqPK/482O7fWRlAARF6pE6 8d1w== X-Gm-Message-State: AHQUAuZq/5mHip+5ir6X39AWhRTXcvrF3rPulZFEN47KjO77tz6GXXo1 uAknUnv8DZ/5ypmDhlSSzj9vRA== X-Google-Smtp-Source: AHgI3IbouTZp0J23mCdzPG9Xy5+T20eSKOMw4lKUIEr/HO1rruye272esKEhb3FqkeQMscDJL+8HkQ== X-Received: by 2002:a63:c56:: with SMTP id 22mr626220pgm.44.1549925645759; Mon, 11 Feb 2019 14:54:05 -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 m68sm6141079pfj.89.2019.02.11.14.54.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Feb 2019 14:54:04 -0800 (PST) Date: Mon, 11 Feb 2019 14:54:03 -0800 From: Kees Cook To: James Morris Cc: linux-security-module@vger.kernel.org, Tetsuo Handa , linux-kernel@vger.kernel.org Subject: [PATCH] LSM: Ignore "security=" when "lsm=" is specified Message-ID: <20190211225403.GA7769@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 --- security/security.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/security/security.c b/security/security.c index 3147785e20d7..e6153ed54361 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 of 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++)