Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2472461imm; Sat, 15 Sep 2018 18:50:05 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaUEH9ElY6ERtKuL6jnrPrgveFg0VRxSxCCkIN22PU3K6uaIftliG8no8lM+nZkGgySS8cY X-Received: by 2002:a62:5f82:: with SMTP id t124-v6mr19388728pfb.223.1537062605080; Sat, 15 Sep 2018 18:50:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537062605; cv=none; d=google.com; s=arc-20160816; b=Z8OngXYTG40IhszrCR+uQ4yGwXKQ/ImLn0MqUzRtrZhXkEPnDkS5Cp9+xvC4cndKBJ 56Yn08DLwQ1gHzip1gqgcBLI70qY/NK4iV75oIqHSaXSOvtjNuupGLCS60vzUKB0o03A EctPejfyMoN1VUWVYhww/j5EiV5W+eafS8D3FTeQ7WTEJDs1K2lew9AL92AChfcXv8T0 66+4J4FejORuq6AQlG/Cs6N+slp6wHp2nx3++65Ogv4h9oLTxKKlpnXkMXFxu9ypRyXi jVHl3Fho01RRQyjH54QH9funTFS9/q7cJpNY0AXatbpOA+Di2kKxF4il8rhM2OqJ0pTv F8Kg== 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 :references:in-reply-to:mime-version:dkim-signature; bh=7WV0jhMUC27fh3+VW50Y1h/lDTvtprDUDIBUaTd9iu8=; b=qI5fLNNxKnFIqGLcCM08xw5deMBp8BWWxVcO6M/myF4L4cf6hrYuDLMNpfALaPtenA A8U4jAuUxh5895Ke8cI59NYGoW1iIH4QiEYgf1iOaSBFvS/ypA/iOKHEt0bP5h1v/9v0 mr7tk0DOUi5H1hpnZzibeCHNk1ZymXCbS898he39rg0tDYSMUVv6e+xa1AW+ndtsL/vz YPBJseVo5eobY4LSbc1ijq2yaCNS7OyysLQUKTjHZY71Ciq/yrPE5Pg5KPdvmiY4o5vl lmEIbIq34DEMfVhPOltxBAtt12Z3G1RPoZqVKiueYZiILywog8a4HbZEq7rkeuTXUI9k dv9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fGG2ziMb; 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 n6-v6si10757505plk.255.2018.09.15.18.49.49; Sat, 15 Sep 2018 18:50:05 -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=@chromium.org header.s=google header.b=fGG2ziMb; 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 S1727940AbeIPHKV (ORCPT + 99 others); Sun, 16 Sep 2018 03:10:21 -0400 Received: from mail-yb1-f194.google.com ([209.85.219.194]:35413 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727558AbeIPHKV (ORCPT ); Sun, 16 Sep 2018 03:10:21 -0400 Received: by mail-yb1-f194.google.com with SMTP id o63-v6so723974yba.2 for ; Sat, 15 Sep 2018 18:49:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=7WV0jhMUC27fh3+VW50Y1h/lDTvtprDUDIBUaTd9iu8=; b=fGG2ziMbUXw8yHyRuLEeFd1Hq+z4HXiPOCKzM+TRvX6P/hjXVVh4xcQVtEp95fJqzD 3RYJqiAhpU8XMIIWbqywfb7tXW+ky7r5DR4c4NyKRsn9AUrabSKAfe1B2Fp4AH/YQWRH RVsY0lIKfQqaZAWixu+Td40ljdfXPPZ+hUxU8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=7WV0jhMUC27fh3+VW50Y1h/lDTvtprDUDIBUaTd9iu8=; b=BbMh1yT7h7U7r6R0t1FVns6WkwKJs3PB1/NcvuxBu3DnJIm2P5MMehe7DWcs0OTZ9o ixK8i3qF5y1dIMly2jrcS5RX295oPnptc16dfLlD8Z6ukRvwBEGN2dlmsLowj+ej5OoH czEWHyUCv4dpA68cygQ3wYgrhwX25bqqq0m26vl+VhqR3pPFQJLDpOOpDS4qnlOQacL1 vxM0B3JsmyUGBafnpxr23z+iL2AbheVyi4ZUKAbNXrrRFNl8x2tdtrRrlYguoPrAVNbK cWd7GFHc+G54N/kgzzrxHZ/nFkUW7TtVj6ilHKV5RFNaBrkMZNwTedQURBh1oJw81lAj rDBA== X-Gm-Message-State: APzg51DKQfiCQld3KP4r+cM5olO/tj2SlC0JGDOuJf4JymLlH/Xni2R8 mDhdyPejcdPrIb+SjWCsiBy8EwVwiNs= X-Received: by 2002:a25:c186:: with SMTP id r128-v6mr7901146ybf.3.1537062551021; Sat, 15 Sep 2018 18:49:11 -0700 (PDT) Received: from mail-yw1-f43.google.com (mail-yw1-f43.google.com. [209.85.161.43]) by smtp.gmail.com with ESMTPSA id d70-v6sm8071298ywe.97.2018.09.15.18.49.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Sep 2018 18:49:08 -0700 (PDT) Received: by mail-yw1-f43.google.com with SMTP id z143-v6so4153697ywa.7 for ; Sat, 15 Sep 2018 18:49:08 -0700 (PDT) X-Received: by 2002:a81:9b85:: with SMTP id s127-v6mr7854568ywg.47.1537062547816; Sat, 15 Sep 2018 18:49:07 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:5f04:0:0:0:0:0 with HTTP; Sat, 15 Sep 2018 18:49:07 -0700 (PDT) In-Reply-To: References: <20180916003059.1046-1-keescook@chromium.org> <20180916003059.1046-8-keescook@chromium.org> From: Kees Cook Date: Sat, 15 Sep 2018 18:49:07 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 07/18] LSM: Add minor LSM initialization loop To: Jann Horn Cc: James Morris , Casey Schaufler , John Johansen , Tetsuo Handa , 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 Sat, Sep 15, 2018 at 6:27 PM, Jann Horn wrote: > 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. You cut the patch quote off where I do exactly that: >> + enum lsm_type type; /* Optional: default is LSM_TYPE_EXCLUSIVE */ :) -Kees -- Kees Cook Pixel Security