Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2429399imm; Sat, 15 Sep 2018 17:31:44 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYRbDC0IiPVzhX+krWzbEIXeiqttcoyDCihKRTtUoJJe+INUl+v6bs7iwNgKwFb6xh/oATo X-Received: by 2002:a63:5a13:: with SMTP id o19-v6mr17541531pgb.75.1537057904700; Sat, 15 Sep 2018 17:31:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537057904; cv=none; d=google.com; s=arc-20160816; b=k1FjAjzZmZ+e3H5fAmtxASOpsuGVT6En8cnV+jzCaovRZmjuptvWDHAx0SpralTZbH ZmRnu95NwXrFo1tiVopM3dqYNQ3f/ygKw1c2RRD8jvhW+puzQI6z4lSA9eYxy8XeafUw ++toJxuTD91ZixNYBFiPAa5SaXvh1lB96UoVitCUf9+dHPY4Z0r8Zg1d7neeNKUwRrnS 4yj8SQSPW7BNsZz4C0E9fy1CNWXFnL/xSIqwKucKquV5MzE2WICX8RuFAp4mV1kGQWDA ukzPRBeLoxqNnTgbFLEU/6crS3d5T0Q2QzZbciQ3S6JopYkazvjzG20R3Fsch4h12WtB cWDg== 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=Zqm+45y3CwqjDH3PNBS+oFC+JGgE2+c9aAZo0Gv2nRM=; b=hQzr8nbAYO7p/cCQxvctcITln0eGyzS+38mWadASEg8bHqx//SbAcQW2oMpTgfZW53 IEmBq7o5NutA3yVqLExlW367ZE2TYCv4X+oqh6x9G2stXZ/Z75GaqFbzX2olV17PjvKM WuXEznqbvQQ9D93Q6JdmgevujxHB7y5igXCO9tXfTE0FENjKWPkevBQynOZL1HGxnrn+ 5MLL70TSTrR2uNwsLlbaYTEnVi0AiR7O1REx5KMLpt7vGWpmolhpOKY/MTUsVUCtr7zJ qrxX5D1tlb4bG3cvHOmbAEy9L8QCpZzGmi/cLcTt8YZSThs1ea9vnrZhTdh4ZhPsnPD2 z1ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BjbEkjjc; 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 b38-v6si12391837plb.167.2018.09.15.17.31.29; Sat, 15 Sep 2018 17:31:44 -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=BjbEkjjc; 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 S1728324AbeIPFwO (ORCPT + 99 others); Sun, 16 Sep 2018 01:52:14 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:45076 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728298AbeIPFwN (ORCPT ); Sun, 16 Sep 2018 01:52:13 -0400 Received: by mail-pf1-f195.google.com with SMTP id i26-v6so5907531pfo.12 for ; Sat, 15 Sep 2018 17:31:17 -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=Zqm+45y3CwqjDH3PNBS+oFC+JGgE2+c9aAZo0Gv2nRM=; b=BjbEkjjcXDwOycmGy1HPB6giilzNOuG85J4iIgDv7cSYhIlikd3/HExfLREe96giP3 lSjbmNq0u3m245BlSen/nNc+1NIn3mRGw6Lj0whd3sneyMjShzhsR60WzsLaz84EfDu5 RSyKfCkB4aYFCz4Z2Rd32MV9bkJjNfMShhvp4= 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=Zqm+45y3CwqjDH3PNBS+oFC+JGgE2+c9aAZo0Gv2nRM=; b=SmPO4lbs25FsmCdIgWf8PGvLte18xZWPdFPryBeeqYkcX7pXmQ06gsBYNLs2FbSiLS digPNXGeL7qXm2uWYKDPpU+orrDIV6Cj/3DEsG/qXVVHKoPFx04vwjN5mawD+xanhSbA EljK7D/433/D6LhAZDMk3ZwlSfQorZVCxu9VW3wSJkvY3zrqpmXyUYT86pRmH3rdp+nU 4g6TymXPvvZHKnYSZQf+1kfZ0I0mlIPuwLnqebqIFREJTuTyY8lWH4Vr+agmgKBBfiE/ Fzqq0kYzhbFh5FBRG2OZR3YZFYCfsQ3xpNRuO53C2L4Fz+xp7RuULkDJdn/M8ATmXXm8 T+OQ== X-Gm-Message-State: APzg51B0ebuWRU8/B7PTOy9oDUoNHQ58j0IMaF4p7ALMmKEm+bzbWQrQ xfxlG2KxD3j81As8OBT/1p9Wrg== X-Received: by 2002:a63:3f45:: with SMTP id m66-v6mr17636170pga.51.1537057877690; Sat, 15 Sep 2018 17:31:17 -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 h20-v6sm12346360pgg.3.2018.09.15.17.31.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Sep 2018 17:31:14 -0700 (PDT) From: Kees Cook To: James Morris Cc: Kees Cook , Casey Schaufler , John Johansen , Tetsuo Handa , Paul Moore , Stephen Smalley , "Schaufler, Casey" , LSM , LKLM Subject: [PATCH 14/18] Yama: Initialize as LSM_TYPE_MINOR Date: Sat, 15 Sep 2018 17:30:55 -0700 Message-Id: <20180916003059.1046-15-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180916003059.1046-1-keescook@chromium.org> References: <20180916003059.1046-1-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This converts Yama to use the new LSM_TYPE_MINOR marking. Signed-off-by: Kees Cook --- include/linux/lsm_hooks.h | 5 ----- security/security.c | 1 - security/yama/yama_lsm.c | 8 +++++++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index 5e0ca4a05091..0564153130c8 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h @@ -2102,10 +2102,5 @@ static inline void security_delete_hooks(struct security_hook_list *hooks, #endif /* CONFIG_SECURITY_WRITABLE_HOOKS */ extern void __init capability_add_hooks(void); -#ifdef CONFIG_SECURITY_YAMA -extern void __init yama_add_hooks(void); -#else -static inline void __init yama_add_hooks(void) { } -#endif #endif /* ! __LINUX_LSM_HOOKS_H */ diff --git a/security/security.c b/security/security.c index 65d7ba1bc1ef..c6ca07fc0771 100644 --- a/security/security.c +++ b/security/security.c @@ -125,7 +125,6 @@ int __init security_init(void) * Load minor LSMs, with the capability module always first. */ capability_add_hooks(); - yama_add_hooks(); lsm_init(LSM_TYPE_MINOR); /* diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c index ffda91a4a1aa..e970917926d9 100644 --- a/security/yama/yama_lsm.c +++ b/security/yama/yama_lsm.c @@ -477,9 +477,15 @@ static void __init yama_init_sysctl(void) static inline void yama_init_sysctl(void) { } #endif /* CONFIG_SYSCTL */ -void __init yama_add_hooks(void) +static int __init yama_init(void) { pr_info("Yama: becoming mindful.\n"); security_add_hooks(yama_hooks, ARRAY_SIZE(yama_hooks), "yama"); yama_init_sysctl(); + return 0; } + +DEFINE_LSM(yama) + .type = LSM_TYPE_MINOR, + .init = yama_init, +END_LSM; -- 2.17.1