Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2461050imm; Sat, 15 Sep 2018 18:28:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZe00HtZkj3wdo/urUqiZJVX/iajH2J3EPq5/NLgxwUt7Uli9s6QHAArSbCluaGXYJWXofi X-Received: by 2002:a63:e318:: with SMTP id f24-v6mr17681548pgh.175.1537061330657; Sat, 15 Sep 2018 18:28:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537061330; cv=none; d=google.com; s=arc-20160816; b=s9VJ7jzWcQhGdFoqznbDzELRiunV0VjWShMo/8hAQKbN9+Zoc0U44iQtpjz+AW30dQ tZsWghQtRcruWKRXUTg/VmfK1F4KHT7s1I0tEgqZUp16Z2er3Dl9MqwMeCzup8tZgYju LGKQ+1Sn9FAcfDkRwZTc7wjp4IlnMvYMcJHn8dSPu3pxWmIG0ZYoG+kk2WiK2RsU1L6j vKuPzMKOkF/6GzQlM6IvjxOAYSJXqVzXMhyaccQ/5Hdq5zkjj/RFN8p3cE2R4/KGk5e3 JFfEWb/7Kak48zHDd2N0nFcUUx02ef1LAo8nxcDL7ERRckb4J0AsoTPgvBl83PJu39fC 5A0w== 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=MES4kK9ZkxtTjWSgZujL8lYbFoxxjsUItEv0ENN+FtM=; b=VNB6AFDqS6oZzfsWTULQOc+hKbNXU/3J2EneF5y3uTHLuRHBAOUkVHMww8hF7B/ohu OypXlCWfPp4DSVNb+a3SwxHMjUozeSlEwoUzW0f7emWFkVmD02KN748oLCPFe6acfPb5 Q8F06T+Z+cnJySroipGv6Yxt0NLuqJQ5ZgWFIJFdWm3qNveOmQ+y+cy/c/s7ZccHCEAH Wfd1GOt6BJm3DKoIFIUhRHGyaFvarVbXAjbLXrrvl4ffDsZJxAJNe6wl6J6HJdQ2FlXA m2S1X23HbajU8G78k/ddSC0MT0NtjuJkZ6i9i5XL4oZEewo622viF9CSlV8S9fbaTnFl J4sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Zy6yQ5ci; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17-v6si11344922pgl.575.2018.09.15.18.28.34; Sat, 15 Sep 2018 18:28: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=@google.com header.s=20161025 header.b=Zy6yQ5ci; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727190AbeIPGtQ (ORCPT + 99 others); Sun, 16 Sep 2018 02:49:16 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:32889 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726188AbeIPGtQ (ORCPT ); Sun, 16 Sep 2018 02:49:16 -0400 Received: by mail-ot1-f67.google.com with SMTP id i10-v6so8029155oth.0 for ; Sat, 15 Sep 2018 18:28:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MES4kK9ZkxtTjWSgZujL8lYbFoxxjsUItEv0ENN+FtM=; b=Zy6yQ5ciFxgjiFIc6RJvLw3+/M1jeL/Z+jTagmrab3Gyw6bfDeXh51Q6bHTe0pS90T ATRtchPlA1Om+En5ziY832wkZ8E1xZm1bGFd0zULXCmAMNrIPzbBkZab2aItmOh2fQXA 2BoysLjofLSId5UjRSVzcz/3YSNYPGsR2akNSNYDaC39KfQYEyWZg9tCJGSZM3kVJOpj s3mZRGmmekKf8P0w5aU0QaOTzK6dDNAbQb1ifAWbzNCIbx1NaF+/ZtQXUpvutH8vz/E5 OPIoJmf7Si4O5DujrG+Ej1gH4cpwNQeQaSkVpxCes9JrBD1knvrSjSc/BZCNzzZ9UW8f mG5w== 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=MES4kK9ZkxtTjWSgZujL8lYbFoxxjsUItEv0ENN+FtM=; b=hoyLRO+XRzV4pAZleD2Cu08pDMLAuLRmrsLC04aQWQHTqtKfEwCh2qyv8QeYvqx8ag KnH1KEwk5FHK2LZ7DPWRqrlKzbLak6cvjejb+Rdu5NzUMQNVfpFgb5KbHnorW+HSAAcH u74OROVfVn/GWkPrBt+3OY8B4I4nPgT1998EZIa8ezGhTDL+l1l1h7Mkd87O1hHnL5I2 1vTXhH+Syf2lChJS1TXlxMA7igpyDs4e1YRIeOyI+IjWvlk1Js06spqKn5j/zpAgqFkG 1TvAA1mxw4yH/bECQKj1tgvkrp/Nosz5m0ZULqCddeOm6V0bsWy8SyMfWGljP4QsUcbr 4M0w== X-Gm-Message-State: APzg51ClcYvuN7ZCQYNKIVrZtjh+uyW5p4luu4yhg9C3PJTAADkKb+cm i7DZw24h1wlhyxGZjcA+ekuAf/05UvW58jc3oB4DdA== X-Received: by 2002:a9d:4ea:: with SMTP id 97-v6mr8189336otm.99.1537061289663; Sat, 15 Sep 2018 18:28:09 -0700 (PDT) MIME-Version: 1.0 References: <20180916003059.1046-1-keescook@chromium.org> <20180916003059.1046-8-keescook@chromium.org> In-Reply-To: <20180916003059.1046-8-keescook@chromium.org> From: Jann Horn Date: Sun, 16 Sep 2018 03:27:42 +0200 Message-ID: Subject: Re: [PATCH 07/18] LSM: Add minor LSM initialization loop To: Kees Cook Cc: James Morris , Casey Schaufler , John Johansen , penguin-kernel@i-love.sakura.ne.jp, Paul Moore , Stephen Smalley , Casey Schaufler , linux-security-module , kernel list 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 Sun, Sep 16, 2018 at 3:11 AM Kees Cook wrote: > Split initialization loop into two phases: "exclusive" LSMs and "minor" > LSMs. > > Signed-off-by: Kees Cook > --- > include/linux/lsm_hooks.h | 6 ++++++ > security/security.c | 8 +++++--- > 2 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h > index f8e618e2bdd2..ec3419b9b16f 100644 > --- a/include/linux/lsm_hooks.h > +++ b/include/linux/lsm_hooks.h > @@ -2039,7 +2039,13 @@ extern char *lsm_names; > extern void security_add_hooks(struct security_hook_list *hooks, int count, > char *lsm); > > +enum lsm_type { > + LSM_TYPE_EXCLUSIVE = 0, > + LSM_TYPE_MINOR, > +}; Is the intent of this explicit zero assignment that LSM_TYPE_EXCLUSIVE should be the default? If so, perhaps a comment "/* default */", or something like that, might be helpful.