Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2213138imm; Thu, 20 Sep 2018 09:25:19 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbd5kv65FBu6Peb9VF9nLr+pPL1yEgHjq8gX6h+42Y+PkaZ0pLmqDrP2JnOi3KwivoeSsEm X-Received: by 2002:a62:6d02:: with SMTP id i2-v6mr42975472pfc.218.1537460719567; Thu, 20 Sep 2018 09:25:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537460719; cv=none; d=google.com; s=arc-20160816; b=fRuOkxrSKMsoB9dQ8E093FNvHK45+hzRF4vnP6bllriIMS5J5shHdevaHz9bh9Ztmi mU3UDRxAls0UBtLodCmZHqv83vqJ3gLzmXUszeSv1Us+J8tnC4lwkAM2a6QVRnN4hc2V 5tfNrIk9CRu1OCs9KX92NGroBs/9HLoH8gYO3LEbmHk5NbiEWIxG7fbsjjWE8X2xGL/M 1fHWZq/Y/lOfkaw96cVt4EVKF1PCsbEobKq65OGiyMSgG/OP0wDhdF16YMNYdw8YHhLK dPUBz+498S0zADjunBjFOOczySqVSXKsKgxaMG9DCsio9zJVnOo7I+RlsqNxBecDrVSP 5wSQ== 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=Kixk0uqAIkMWS9YrOweAApK1Z6SPQYN33DNf134KWzM=; b=Ip3M03FEXpXTynxyhLUQTKZF0LZhg0nhshyfu7n7UmVMmKHUW0vwgFmmBUDCv3I5MU 2Phsa4WUtcZWq3ZA2amjuJPtFJ+EfU7UX4Uclz9aKjp2gPjZsTrz04IbUZ1UkBLXQNUD W55gDCGg1bJQ7Df1inRohG6Euwoyz7Gdb+jIP4Wx1ow8l2rnMi6ljI/QrpWjRpx7UmjC T7VB2MEVwimIcwnLdsK4w0y+Mo18v1Ks7WrygrRSj0MYW0sncerzEkVcE0yujEqt8wq0 quOFOSbQqiOZgA/HQGrq9v6WOcjR5tz4I8b3p5LbM5YA2+ifdC8AdAwr13lZxza84ZFH mcsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SU+rpAGT; 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 x3-v6si24189755pgo.542.2018.09.20.09.25.03; Thu, 20 Sep 2018 09:25:19 -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=SU+rpAGT; 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 S2387951AbeITWIL (ORCPT + 99 others); Thu, 20 Sep 2018 18:08:11 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:40283 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387934AbeITWIK (ORCPT ); Thu, 20 Sep 2018 18:08:10 -0400 Received: by mail-pl1-f194.google.com with SMTP id s17-v6so4583097plp.7 for ; Thu, 20 Sep 2018 09:23:55 -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=Kixk0uqAIkMWS9YrOweAApK1Z6SPQYN33DNf134KWzM=; b=SU+rpAGThh5wY0Yo+yecfVW7Rh4VwD8po3ka0l027pnk4LOFoptpHij4nDsAi2HP9X 03KiMsC3vLmyA7ZFP44FjOVsrsxRpe4QqYTM1uTeNfsrZHQCYnqmFC+9ccsu/6iatT3+ jiV/7cNJD9I5czE41qzb/p5oflsTQCboR69VQ= 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=Kixk0uqAIkMWS9YrOweAApK1Z6SPQYN33DNf134KWzM=; b=ksA0XTElysDpGD6HmZLuShUqznLMSv1SnJn7s19XBzqDxQkO0F8GyLLsEKYewDd+9a z5hCiUvCzDYPz7yHCZ5Dlg9rFkMJh1lbyKGFJ0Gw7lArsYFWkYxVJA7+S2kyTvnS+9Wa 1lUCUit5QbaXFtGwGPziBybV2PO4pjIhEP43rfxSUVBq5QpNGi6UcryUIP8JQUn9Fzzi qvk9UjEzibJe0jLb3bOj/FhDZ1QggEe/R71ExeoBH6+p6anPRT3hTnzNgM51Uat6sUjC rN17BlGj1sR9hZFB6+1LLomYnS23XhoMeU1SpWDg7qdVp+0o2qjz9d8Tea1EeFw4PsI4 7GVA== X-Gm-Message-State: APzg51AQaAyBt6KCn5X1HbFCNegRd3xqh1n3JH0h5Midu1LussyXH/d6 7ZSgHs9TxuElg+dPgh+/nCYDgD1bxMo= X-Received: by 2002:a17:902:7145:: with SMTP id u5-v6mr40573989plm.259.1537460635285; Thu, 20 Sep 2018 09:23:55 -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 6-v6sm45011908pfr.115.2018.09.20.09.23.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Sep 2018 09:23: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 v2 11/26] LSM: Introduce LSM_FLAG_LEGACY_MAJOR Date: Thu, 20 Sep 2018 09:23:23 -0700 Message-Id: <20180920162338.21060-12-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180920162338.21060-1-keescook@chromium.org> References: <20180920162338.21060-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..38cbefabff71 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 (1 << 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