Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp6278imj; Fri, 8 Feb 2019 13:50:34 -0800 (PST) X-Google-Smtp-Source: AHgI3IZVge5eTxvFiZ8wTGQEbovCgrDWM8V6HPhIYKQeEBFndKcjF/zyAPnN0SpT36TAnisD5nNn X-Received: by 2002:aa7:849a:: with SMTP id u26mr16358931pfn.157.1549662634145; Fri, 08 Feb 2019 13:50:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549662634; cv=none; d=google.com; s=arc-20160816; b=nsdWgz4O5jcM6E0tb+Lzl0r6VWGfULBuHorRLP/Xn36iJHiQPEM2eWr68jy1bAlXN2 Mu21rDK3agGWbp+D88b+/CbQRe+/TgSKgFZa+wbdniYwDdyeJgrUwGudqrLePNFJh3Sw Ikro4KFwROTy8dGmBOoyRT2+UGqxVTchU8QyNKKN6gjbjSm7L6gd4/S5BqhZi59FF+kW sXDglL8+radPVuwarkjGyQh0Rv1mBrlPVHX+eWr0vv/GfJPyNdEL7vu8BwJiQRQk4pEM l+MYxtT0uFHn+L4jszdaVK5Wu+bshJ0WFwuDksIazkTbEKzRdEa9RvfYqU//y/sk34rN GpVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4fRaS5HEGitPBMuZe/mI/6bybUFiM7/sj7x0YbePNjY=; b=tUQT5z+tTWlSBwEpS5bz8Pz6EdMI4MkpUoEbswhIgj7//MhwgphpyxXwkcVz1yAbNQ 5YjAc/CFUBZphI2hdAhlAQGH12AuH+jtecULkdAUHHR/NI75nBi28QA5eMmXubO/GACM LTPEFLGPaJ6zU+gaz3SYh2wKQK6g0g9K6TlzW5db3mwfAazaMtXc/mQ/5jfqZ3SRTVLk WCX2bQGakIggskVHUTkuZ6jNHLbAoL/EIm6S+zVzweQG0OPT4I9i24djt1wz/4hJBlOu wrWQuq83krya6OMiha2wZFY/mhHfBTq4jHoTrROn54uTYh8ERkZVPZUWBAUUf9AX/eSo stig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aXIHfd20; 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 t19si3105030pgl.102.2019.02.08.13.50.17; Fri, 08 Feb 2019 13:50:34 -0800 (PST) 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=aXIHfd20; 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 S1726858AbfBHVtp (ORCPT + 99 others); Fri, 8 Feb 2019 16:49:45 -0500 Received: from mail-vs1-f65.google.com ([209.85.217.65]:44117 "EHLO mail-vs1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726522AbfBHVtp (ORCPT ); Fri, 8 Feb 2019 16:49:45 -0500 Received: by mail-vs1-f65.google.com with SMTP id u11so2989963vsp.11 for ; Fri, 08 Feb 2019 13:49:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4fRaS5HEGitPBMuZe/mI/6bybUFiM7/sj7x0YbePNjY=; b=aXIHfd20YOICHLRxigPSutLUUA6kYK4NZVrf9MClkFK8qLumsLJdHErpIFkPz7VZwp 1QIXzZRMp+Vq1UigA5uj8WukuebbfHr83hFjjPC3kox3rspL9sy6U9KIU4lnmVytb31j Se66MTZg1Lbx1T7tFRrtLK9DEg9xTBERYHVbE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4fRaS5HEGitPBMuZe/mI/6bybUFiM7/sj7x0YbePNjY=; b=UH+BbQ5Lk3svX+VNnw4O0vjrhcx6QW2YPT2y/WOJQH2vgs0LD05yZScuWgvfzBjG1J PecEbp0k5Q23ha8eixLOzVHcsoIxfNNeOg5FEDmyIg6gekUIN1xz49/0QaFTYh7D33Oi JpgCuV9UTrk2Xve4Fcj2qqbxnzx/5Eh9pjBL1lkTPJa5a+If1oa192hLmQpRc+UtnsJx Fv71LKuaUaZUMrBN2+7p9jnJ53LiDnI2S9XRSDd+G1/9mjxQYchMu1CGyKJ6EUe8s4NR VkXlG8YHuAp9jeNLJ5dFpJnytdAlYYBUEqBelKCt6rHi1AEYQZ0Wh1vwQRp48RHhZBgR W8aw== X-Gm-Message-State: AHQUAuZNRfvfaWgX+z3SM4vkDFt4nFNAk+k3+2/tt42PswZxMvjZH65j eehQ7eXMZR16R3pMZiSzcyeAcObzkk4= X-Received: by 2002:a67:f98e:: with SMTP id b14mr4648102vsq.130.1549662581914; Fri, 08 Feb 2019 13:49:41 -0800 (PST) Received: from mail-ua1-f52.google.com (mail-ua1-f52.google.com. [209.85.222.52]) by smtp.gmail.com with ESMTPSA id g203sm517149vsd.19.2019.02.08.13.49.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Feb 2019 13:49:40 -0800 (PST) Received: by mail-ua1-f52.google.com with SMTP id z24so1622117ual.8 for ; Fri, 08 Feb 2019 13:49:40 -0800 (PST) X-Received: by 2002:ab0:6151:: with SMTP id w17mr869203uan.114.1549662580116; Fri, 08 Feb 2019 13:49:40 -0800 (PST) MIME-Version: 1.0 References: <8f48e1d0-c109-f8a9-ea94-9659b16cae49@i-love.sakura.ne.jp> <0d23d1a5-d4af-debf-6b5f-aaaf698daaa8@schaufler-ca.com> <201902070230.x172UUG6002087@www262.sakura.ne.jp> <6def6199-0235-7c37-974c-baf731725606@schaufler-ca.com> <54c0ae39-f35c-bdcd-a217-8e62ef14e41b@i-love.sakura.ne.jp> In-Reply-To: <54c0ae39-f35c-bdcd-a217-8e62ef14e41b@i-love.sakura.ne.jp> From: Kees Cook Date: Fri, 8 Feb 2019 13:49:28 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] LSM: Allow syzbot to ignore security= parameter. To: Tetsuo Handa Cc: Casey Schaufler , Dmitry Vyukov , Paul Moore , Stephen Smalley , syzbot , Tyler Hicks , John Johansen , James Morris , LKML , linux-security-module , Serge Hallyn , syzkaller-bugs , Jeffrey Vander Stoep , SELinux , Russell Coker , Laurent Bigonville , syzkaller , Andrew Morton Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 8, 2019 at 2:52 AM Tetsuo Handa wrote: > > On 2019/02/08 1:24, Casey Schaufler wrote: > >>>> Then, I think that it is straightforward (and easier to manage) to ignore security= parameter > >>>> when lsm= parameter is specified. > >>> That reduces flexibility somewhat. If I am debugging security modules > >>> I may want to use lsm= to specify the order while using security= to > >>> identify a specific exclusive module. I could do that using lsm= by > >>> itself, but habits die hard. > >> "lsm=" can be used for identifying a specific exclusive module, and Ubuntu kernels would > >> have to use CONFIG_LSM (or "lsm=") for identifying the default exclusive module (in order > >> to allow enabling both TOMOYO and one of SELinux,Smack,AppArmor at the same time). > >> > >> Since "security=" can't be used for selectively enable/disable more than one of > >> SELinux,Smack,TOMOYO,AppArmor, I think that recommending users to migrate to "lsm=" is the > >> better direction. And ignoring "security=" when "lsm=" is specified is easier to understand. > > > > I added Kees to the CC list. Kees, what to you think about > > ignoring security= if lsm= is specified? I'm ambivalent. > > > > > > To help administrators easily understand what LSM modules are possibly enabled by default (which > have to be fetched from e.g. /boot/config-`uname -r`) and specify lsm= parameter when they need, > I propose changes shown below. > > diff --git a/security/security.c b/security/security.c > index 3147785e..051d708 100644 > --- a/security/security.c > +++ b/security/security.c > @@ -51,8 +51,6 @@ > static __initdata const char *chosen_lsm_order; > static __initdata const char *chosen_major_lsm; > > -static __initconst const char * const builtin_lsm_order = CONFIG_LSM; > - > /* Ordered list of LSMs to initialize. */ > static __initdata struct lsm_info **ordered_lsms; > static __initdata struct lsm_info *exclusive; > @@ -284,14 +282,22 @@ static void __init ordered_lsm_parse(const char *order, const char *origin) > static void __init ordered_lsm_init(void) > { > struct lsm_info **lsm; > + const char *order = CONFIG_LSM; > + const char *origin = "builtin"; > > ordered_lsms = kcalloc(LSM_COUNT + 1, sizeof(*ordered_lsms), > GFP_KERNEL); > > - if (chosen_lsm_order) > - ordered_lsm_parse(chosen_lsm_order, "cmdline"); > - else > - ordered_lsm_parse(builtin_lsm_order, "builtin"); > + if (chosen_lsm_order) { > + if (chosen_major_lsm) { > + pr_info("security= is ignored because of lsm=\n"); This is intended to be the new default way to change the LSM ("lsm=..."), so I'd rather not have this appear every time. Also, it must continue to interact with the builtin ordering, so if you wanted this, I think better would be to do: 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++) > + pr_info("Security Framework initializing: %s\n", order); > + ordered_lsm_parse(order, origin); > > for (lsm = ordered_lsms; *lsm; lsm++) > prepare_lsm(*lsm); > @@ -333,8 +339,6 @@ int __init security_init(void) > int i; > struct hlist_head *list = (struct hlist_head *) &security_hook_heads; > > - pr_info("Security Framework initializing\n"); > - > for (i = 0; i < sizeof(security_hook_heads) / sizeof(struct hlist_head); > i++) > INIT_HLIST_HEAD(&list[i]); -- Kees Cook