Received: by 2002:a4a:301c:0:0:0:0:0 with SMTP id q28-v6csp122662oof; Mon, 24 Sep 2018 17:20:58 -0700 (PDT) X-Google-Smtp-Source: ACcGV62t1znU6GqEED9MRvckCkXHODJM1eWoEd0fwm4l1A10fw2vLqgW1wHBFUlAjDR73KdxfFcj X-Received: by 2002:a63:5021:: with SMTP id e33-v6mr931848pgb.306.1537834858319; Mon, 24 Sep 2018 17:20:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537834858; cv=none; d=google.com; s=arc-20160816; b=S9C/sCHA9FGKnnB8mOW80likhYjMopBGWqmo9zEM0wipxkDMMKrPiicFrChq3quoSH 2oO+sUomafmh5JfKDN+Cwb+I1NKbVBtHYIqLyxsfw04GzAxwy3b1QJs7GQtZGOfoqXbB qmrhRgfzkP79AmfCy4UqBR2rCoE35HOHHqDf1/AUrBXb/VnU7mLBbkMkL+sGu32AxGX0 +1Yj47NgYzYCMhtXzwsLtDKW2aVr+AZGbpo1uveOtZo6gV2A/xjC2/YXQDR//8cLYHnR V+JJVpCnC9/Dix+R72CStXZCX2QPEhHmlxJ0nr2BY/q4ubvE8iQaxjJ+2MQ8SvAkJNJj Pfbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=2edRK2AZFrxFBXiESIgGjfhpy0zSRex0q+D6nx3+uAQ=; b=hmStGhE2rCch6gj3UFMLjajuWHUQLRsPrs49cf23cH0i7ef9DyJI0GE6HMN2VA6K+c LXOH0xTgzYwr8csDIt3aGFJ9HHkhmV9t4L2JBxRVA9ZJEsT+MJj0vGgkouhqjhj0WpcF tOkGJXbpcG640sjf1SgwiOaY+MMlbGZGId2cDINdroHrQmj5VQRpjXZCNnVIov3Vv6h6 raehyL01wcJBIxQzOY6VtK0Pi1pjPSYHHIB5xIlDaD5n7HV2X1f2arBypWDb0SY3v42r PtzGHgpLjhcxkAKxJqtXxGqIhyy831v6OwW2oWcjIvGwetWCaY3NP+01buXF6FqAtDKU onYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Urp1Mw90; 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 bi12-v6si730578plb.494.2018.09.24.17.20.43; Mon, 24 Sep 2018 17:20:58 -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=Urp1Mw90; 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 S1728934AbeIYGYl (ORCPT + 99 others); Tue, 25 Sep 2018 02:24:41 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43023 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726512AbeIYGXg (ORCPT ); Tue, 25 Sep 2018 02:23:36 -0400 Received: by mail-pf1-f196.google.com with SMTP id j26-v6so9907999pfi.10 for ; Mon, 24 Sep 2018 17:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2edRK2AZFrxFBXiESIgGjfhpy0zSRex0q+D6nx3+uAQ=; b=Urp1Mw90h+P8UxAPse25ALToKoEoVGmrJLmAMfS65DsUAxVRC1H4HpNVY/p7NpXEqx u8W55R5zikND2gyQf/c+q8WvpnfXrVQkBtQTl5swRnfU2gB/jtqataQi8vMrvL7e72FO cWNBdupazSohrkGtbXwFjWCWa5x+DYeZKZs9w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2edRK2AZFrxFBXiESIgGjfhpy0zSRex0q+D6nx3+uAQ=; b=QuJ69ahGH1nQEukgQm1gCa3alOXugFKNYU6UIibXnfkK11+47KCUXZl5ESv0BepyBM Q0uGV+6N00XnQ1dNHrhp1ZKXOHJfI6jfp6zASMpqIZD17pZ72J0ldv7fZufBLMlIlOJJ GZx34TIdIxz5ljvxnH6KNu+lI+ISDgPhZM+w5iu+oiwyJ3irDYanj2lhG2VvNcJcvsYs T4mh8iXaRsKpD7xa88algcnx17UQRS30sq85jlUJivrwqVmUpc01xlLZmVuQcI2Tzk/T tsAaHimfDrOKIKIMj+U3xKkS4NM7eCIoIuvqicNnVZQJbqHKG4LY437Tq+RvALJBsQkU 9oNA== X-Gm-Message-State: ABuFfojIOjBvj9nxePDX0KLF1GI5+Pa8TwKxkjOO+nAkaVMJnsEPkW6U aiar6bOiVIWss97no4/OX5ZOdQ== X-Received: by 2002:a63:e04d:: with SMTP id n13-v6mr931731pgj.426.1537834730657; Mon, 24 Sep 2018 17:18:50 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id c78-v6sm505844pfc.188.2018.09.24.17.18.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Sep 2018 17:18:48 -0700 (PDT) From: Kees Cook To: James Morris Cc: Kees Cook , Casey Schaufler , John Johansen , Tetsuo Handa , Paul Moore , Stephen Smalley , "Schaufler, Casey" , LSM , Jonathan Corbet , linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH security-next v3 11/29] LSM: Introduce LSM_FLAG_LEGACY_MAJOR Date: Mon, 24 Sep 2018 17:18:14 -0700 Message-Id: <20180925001832.18322-12-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180925001832.18322-1-keescook@chromium.org> References: <20180925001832.18322-1-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds a flag for the current "major" LSMs to distinguish them when we have a universal method for ordering all LSMs. It's called "legacy" since the distinction of "major" will go away in the blob-sharing world. Signed-off-by: Kees Cook --- include/linux/lsm_hooks.h | 3 +++ security/apparmor/lsm.c | 1 + security/selinux/hooks.c | 1 + security/smack/smack_lsm.c | 1 + security/tomoyo/tomoyo.c | 1 + 5 files changed, 7 insertions(+) diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index 543636f18152..5056f7374b3d 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h @@ -2039,8 +2039,11 @@ extern char *lsm_names; extern void security_add_hooks(struct security_hook_list *hooks, int count, char *lsm); +#define LSM_FLAG_LEGACY_MAJOR BIT(0) + struct lsm_info { const char *name; /* Populated automatically. */ + unsigned long flags; /* Optional: flags describing LSM */ int (*init)(void); }; diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index 7fa7b4464cf4..4c5f63e9aeba 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c @@ -1607,5 +1607,6 @@ static int __init apparmor_init(void) } DEFINE_LSM(apparmor) + .flags = LSM_FLAG_LEGACY_MAJOR, .init = apparmor_init, END_LSM; diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 469a90806bc6..615cf6498c0f 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -7203,6 +7203,7 @@ void selinux_complete_init(void) /* SELinux requires early initialization in order to label all processes and objects when they are created. */ DEFINE_LSM(selinux) + .flags = LSM_FLAG_LEGACY_MAJOR, .init = selinux_init, END_LSM; diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 1e1ace718e75..4aef844fc0e2 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -4883,5 +4883,6 @@ static __init int smack_init(void) * all processes and objects when they are created. */ DEFINE_LSM(smack) + .flags = LSM_FLAG_LEGACY_MAJOR, .init = smack_init, END_LSM; diff --git a/security/tomoyo/tomoyo.c b/security/tomoyo/tomoyo.c index a280d4eab456..528b6244a648 100644 --- a/security/tomoyo/tomoyo.c +++ b/security/tomoyo/tomoyo.c @@ -551,5 +551,6 @@ static int __init tomoyo_init(void) } DEFINE_LSM(tomoyo) + .flags = LSM_FLAG_LEGACY_MAJOR, .init = tomoyo_init, END_LSM; -- 2.17.1