Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4113038ybb; Mon, 23 Mar 2020 13:48:14 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtkxG+gQD9aCmbmvKP1soyYa+ZcHrpeJ2kltuM6930uIm7MGdsFMwsHfTAHPA95szSe7YQT X-Received: by 2002:aca:fd0d:: with SMTP id b13mr954748oii.179.1584996494506; Mon, 23 Mar 2020 13:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584996494; cv=none; d=google.com; s=arc-20160816; b=mF0aVKrhArrdrL0C9fXXrIBhuK0IoMc/5RLMGLeYhgn+lZVNHGy6+CaZXR0Jwul9lW ahL4e8BzXI4DVeJjPoVfLdwss6T4sJ7OBA9arWj1lawVgg3yHhz0Oy+ZbRXXJ0g6rlKU cxBFCFf+KR2s6+dFbSBKeV+GPypH5a/IaH/O74XZTMl13EDlODFLYoLuJnx4WsO1H42Q SrMH4zWPoJpDlxGNuqyzi2BIg8xee2KeiBEULlqadnxP66v/ITOI62riqHK9lTkP3trB XvYBBANNlp9wKAZtyOQcKXxn89yMWheQRlwFEuV5HR3Lud44rESZjviuMU+CAp+x+7Hr f8sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject:dkim-signature; bh=7Q91aiE4rFiKsFv4/8Et+8SX35Ktzhult4cEA7Ku6uY=; b=u/6SNFrM7QGdbkZ/zVTWYbKmPwKfG0VjcrefTV2Cj9hf1CUQk11l/RIR42I2g1cOJz JQyWohRu7ifm9JDSYUeYVMLKDvXIfq38HS8BSUcCnScqGCSFOzXX0PayYwByFAJp+7gx owyCnCCorKYujOsPp0YlvTDRvNUpae5JYsUxayc034ebk+7EwUgNnpURrGotEYuUIu49 Yhkow+maJXB2AJyBjD8Eh0It80lM6YESF5sghw59MrY288EQzZvlewRPzGowyN9MfHd5 mRh4t297j6dnO9/ZHEZ9rabRYluLZbB+JHE56Hn7vBixgHJqWcpDjW/ltGsZay5ogMg3 WYJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=VhBNvBYq; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6si3451126oto.34.2020.03.23.13.48.01; Mon, 23 Mar 2020 13:48:14 -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=@yahoo.com header.s=s2048 header.b=VhBNvBYq; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727064AbgCWUrf (ORCPT + 99 others); Mon, 23 Mar 2020 16:47:35 -0400 Received: from sonic310-30.consmr.mail.ne1.yahoo.com ([66.163.186.211]:42225 "EHLO sonic310-30.consmr.mail.ne1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725893AbgCWUre (ORCPT ); Mon, 23 Mar 2020 16:47:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1584996452; bh=7Q91aiE4rFiKsFv4/8Et+8SX35Ktzhult4cEA7Ku6uY=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=VhBNvBYqlpgwd1HYJJny3nPGyY/O2s2IHFcKiPZQSYfHWyp2hEyHfqNcL/MlfmBVwNxoclR8V9Gq7AUrorTaJ8nWtl3rvAIk0YL5vLQgd4e8tH9P557p2rkCNiuBBoIGg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bfeXVKSpRASWxVLUgXUS.sHe9_O4c6rIyDoRew957ao_7peexOXDewdQevQVvL9 3oGKAQC6sowDXwpXGtBJcl2NE_U32rBRd3X.4Fy5LufqHiNIjwt1VDVkUqLQAnMj2_X5_Y3gBxlR sKEGLV34_qJj_YxvvLudaiuRbQ9fZlKVAmrMWWFhgrmtT2GOKlK5HuegzYvr4Y17pakyW6E8ypm. szLPAFcKu_Mzp9GafUeA3zKUocozjY30KtGBU5gDp.tjAdTocQBUfMHz3x3HOJbTe_MiBMSIEWbR xfrUMoDjFhR1X8mJkQ0pPgMdKGeX5yiMxqNwfu9pnorYBunE0_kBNHjkgDHCqEUjR8R5B3p5LGDu nb4xX8PTGgBVLNZhbROlsJTxSuxvfVCR0OC0XPGCx7hZeBhOBKIcP6MNK7sC.iCwOicGUQYy3dwn c6dX43.iB4yf_59nd4IHhPud6GcDKtBCfZUsEMNYHFJuHrwEtmoG5tqs1MYQ2opvXGML.5QJcdRK r34BJIQ9bz3mabF83gaRLQjLIU6_A79k6yO1F6Cmm_0yY.9B7eCw1kQYButm3TRpWRduml_y9QrX hTG_cbsdelaZYNoiV105rbztUqYOCGHR6Qo1w Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.ne1.yahoo.com with HTTP; Mon, 23 Mar 2020 20:47:32 +0000 Received: by smtp432.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID f2519a3a28c5deca2168a06d076f32a1; Mon, 23 Mar 2020 20:47:31 +0000 (UTC) Subject: Re: [PATCH bpf-next v5 5/7] bpf: lsm: Initialize the BPF LSM hooks To: Kees Cook , KP Singh Cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-security-module@vger.kernel.org, Brendan Jackman , Florent Revest , Alexei Starovoitov , Daniel Borkmann , James Morris , Paul Turner , Jann Horn , Florent Revest , Brendan Jackman , Greg Kroah-Hartman , Casey Schaufler References: <20200323164415.12943-1-kpsingh@chromium.org> <20200323164415.12943-6-kpsingh@chromium.org> <202003231237.F654B379@keescook> From: Casey Schaufler Autocrypt: addr=casey@schaufler-ca.com; keydata= mQINBFzV9HABEAC/mmv3jeJyF7lR7QhILYg1+PeBLIMZv7KCzBSc/4ZZipoWdmr77Lel/RxQ 1PrNx0UaM5r6Hj9lJmJ9eg4s/TUBSP67mTx+tsZ1RhG78/WFf9aBe8MSXxY5cu7IUwo0J/CG vdSqACKyYPV5eoTJmnMxalu8/oVUHyPnKF3eMGgE0mKOFBUMsb2pLS/enE4QyxhcZ26jeeS6 3BaqDl1aTXGowM5BHyn7s9LEU38x/y2ffdqBjd3au2YOlvZ+XUkzoclSVfSR29bomZVVyhMB h1jTmX4Ac9QjpwsxihT8KNGvOM5CeCjQyWcW/g8LfWTzOVF9lzbx6IfEZDDoDem4+ZiPsAXC SWKBKil3npdbgb8MARPes2DpuhVm8yfkJEQQmuLYv8GPiJbwHQVLZGQAPBZSAc7IidD2zbf9 XAw1/SJGe1poxOMfuSBsfKxv9ba2i8hUR+PH7gWwkMQaQ97B1yXYxVEkpG8Y4MfE5Vd3bjJU kvQ/tOBUCw5zwyIRC9+7zr1zYi/3hk+OG8OryZ5kpILBNCo+aePeAJ44znrySarUqS69tuXd a3lMPHUJJpUpIwSKQ5UuYYkWlWwENEWSefpakFAIwY4YIBkzoJ/t+XJHE1HTaJnRk6SWpeDf CreF3+LouP4njyeLEjVIMzaEpwROsw++BX5i5vTXJB+4UApTAQARAQABtChDYXNleSBTY2hh dWZsZXIgPGNhc2V5QHNjaGF1Zmxlci1jYS5jb20+iQJUBBMBCAA+FiEEC+9tH1YyUwIQzUIe OKUVfIxDyBEFAlzV9HACGwMFCRLMAwAFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQOKUV fIxDyBG6ag/6AiRl8yof47YOEVHlrmewbpnlBTaYNfJ5cZflNRKRX6t4bp1B2YV1whlDTpiL vNOwFkh+ZE0eI5M4x8Gw2Oiok+4Q5liA9PHTozQYF+Ia+qdL5EehfbLGoEBqklpGvG3h8J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.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <202003231237.F654B379@keescook> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-Mailer: WebService/1.1.15518 hermes Apache-HttpAsyncClient/4.1.4 (Java/1.8.0_242) Content-Length: 6383 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/23/2020 12:44 PM, Kees Cook wrote: > On Mon, Mar 23, 2020 at 05:44:13PM +0100, KP Singh wrote: >> From: KP Singh >> >> The bpf_lsm_ nops are initialized into the LSM framework like any othe= r >> LSM. Some LSM hooks do not have 0 as their default return value. The >> __weak symbol for these hooks is overridden by a corresponding >> definition in security/bpf/hooks.c >> >> The LSM can be enabled / disabled with CONFIG_LSM. >> >> Signed-off-by: KP Singh > Nice! This is super clean on the LSM side of things. :) > > One note below... > >> Reviewed-by: Brendan Jackman >> Reviewed-by: Florent Revest >> --- >> security/Kconfig | 10 ++++---- >> security/Makefile | 2 ++ >> security/bpf/Makefile | 5 ++++ >> security/bpf/hooks.c | 55 ++++++++++++++++++++++++++++++++++++++++++= + >> 4 files changed, 67 insertions(+), 5 deletions(-) >> create mode 100644 security/bpf/Makefile >> create mode 100644 security/bpf/hooks.c >> >> diff --git a/security/Kconfig b/security/Kconfig >> index 2a1a2d396228..cd3cc7da3a55 100644 >> --- a/security/Kconfig >> +++ b/security/Kconfig >> @@ -277,11 +277,11 @@ endchoice >> =20 >> config LSM >> string "Ordered list of enabled LSMs" >> - default "lockdown,yama,loadpin,safesetid,integrity,smack,selinux,tom= oyo,apparmor" if DEFAULT_SECURITY_SMACK >> - default "lockdown,yama,loadpin,safesetid,integrity,apparmor,selinux,= smack,tomoyo" if DEFAULT_SECURITY_APPARMOR >> - default "lockdown,yama,loadpin,safesetid,integrity,tomoyo" if DEFAUL= T_SECURITY_TOMOYO >> - default "lockdown,yama,loadpin,safesetid,integrity" if DEFAULT_SECUR= ITY_DAC >> - default "lockdown,yama,loadpin,safesetid,integrity,selinux,smack,tom= oyo,apparmor" >> + default "lockdown,yama,loadpin,safesetid,integrity,smack,selinux,tom= oyo,apparmor,bpf" if DEFAULT_SECURITY_SMACK >> + default "lockdown,yama,loadpin,safesetid,integrity,apparmor,selinux,= smack,tomoyo,bpf" if DEFAULT_SECURITY_APPARMOR >> + default "lockdown,yama,loadpin,safesetid,integrity,tomoyo,bpf" if DE= FAULT_SECURITY_TOMOYO >> + default "lockdown,yama,loadpin,safesetid,integrity,bpf" if DEFAULT_S= ECURITY_DAC >> + default "lockdown,yama,loadpin,safesetid,integrity,selinux,smack,tom= oyo,apparmor,bpf" >> help >> A comma-separated list of LSMs, in initialization order. >> Any LSMs left off this list will be ignored. This can be >> diff --git a/security/Makefile b/security/Makefile >> index 746438499029..22e73a3482bd 100644 >> --- a/security/Makefile >> +++ b/security/Makefile >> @@ -12,6 +12,7 @@ subdir-$(CONFIG_SECURITY_YAMA) +=3D yama >> subdir-$(CONFIG_SECURITY_LOADPIN) +=3D loadpin >> subdir-$(CONFIG_SECURITY_SAFESETID) +=3D safesetid >> subdir-$(CONFIG_SECURITY_LOCKDOWN_LSM) +=3D lockdown >> +subdir-$(CONFIG_BPF_LSM) +=3D bpf >> =20 >> # always enable default capabilities >> obj-y +=3D commoncap.o >> @@ -30,6 +31,7 @@ obj-$(CONFIG_SECURITY_LOADPIN) +=3D loadpin/ >> obj-$(CONFIG_SECURITY_SAFESETID) +=3D safesetid/ >> obj-$(CONFIG_SECURITY_LOCKDOWN_LSM) +=3D lockdown/ >> obj-$(CONFIG_CGROUP_DEVICE) +=3D device_cgroup.o >> +obj-$(CONFIG_BPF_LSM) +=3D bpf/ >> =20 >> # Object integrity file lists >> subdir-$(CONFIG_INTEGRITY) +=3D integrity >> diff --git a/security/bpf/Makefile b/security/bpf/Makefile >> new file mode 100644 >> index 000000000000..c7a89a962084 >> --- /dev/null >> +++ b/security/bpf/Makefile >> @@ -0,0 +1,5 @@ >> +# SPDX-License-Identifier: GPL-2.0 >> +# >> +# Copyright (C) 2020 Google LLC. >> + >> +obj-$(CONFIG_BPF_LSM) :=3D hooks.o >> diff --git a/security/bpf/hooks.c b/security/bpf/hooks.c >> new file mode 100644 >> index 000000000000..68e5824868f9 >> --- /dev/null >> +++ b/security/bpf/hooks.c >> @@ -0,0 +1,55 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> + >> +/* >> + * Copyright (C) 2020 Google LLC. >> + */ >> +#include >> +#include >> + >> +/* Some LSM hooks do not have 0 as their default return values. Overr= ide the >> + * __weak definitons generated by default for these hooks > If you wanted to avoid this, couldn't you make the default return value= > part of lsm_hooks.h? > > e.g.: > > LSM_HOOK(int, -EOPNOTSUPP, inode_getsecurity, struct inode *inode, > const char *name, void **buffer, bool alloc) If you're going to do that you'll have to keep lsm_hooks.h and security.c= default values in sync somehow. Note that the four functions you've calle= d out won't be using call_int_hook() after the next round of stacking. I'm = not nixing the idea, I just don't want the default return for the security_ functions defined in two places. > > ... > > #define LSM_HOOK(RET, DEFAULT, NAME, ...) \ > LSM_HOOK_##RET(NAME, DEFAULT, __VA_ARGS__) > ... > #define LSM_HOOK_int(NAME, DEFAULT, ...) \ > noinline int bpf_lsm_##NAME(__VA_ARGS__) \ > { \ > return (DEFAULT); \ > } > > Then all the __weak stuff is gone, and the following 4 functions don't > need to be written out, and the information is available to the macros > if anyone else might ever want it. > > -Kees > >> + */ >> +noinline int bpf_lsm_inode_getsecurity(struct inode *inode, const cha= r *name, >> + void **buffer, bool alloc) >> +{ >> + return -EOPNOTSUPP; >> +} >> + >> +noinline int bpf_lsm_inode_setsecurity(struct inode *inode, const cha= r *name, >> + const void *value, size_t size, >> + int flags) >> +{ >> + return -EOPNOTSUPP; >> +} >> + >> +noinline int bpf_lsm_task_prctl(int option, unsigned long arg2, >> + unsigned long arg3, unsigned long arg4, >> + unsigned long arg5) >> +{ >> + return -ENOSYS; >> +} >> + >> +noinline int bpf_lsm_xfrm_state_pol_flow_match(struct xfrm_state *x, >> + struct xfrm_policy *xp, >> + const struct flowi *fl) >> +{ >> + return 1; >> +} >> + >> +static struct security_hook_list bpf_lsm_hooks[] __lsm_ro_after_init = =3D { >> + #define LSM_HOOK(RET, NAME, ...) LSM_HOOK_INIT(NAME, bpf_lsm_##NAME)= , >> + #include >> + #undef LSM_HOOK >> +}; >> + >> +static int __init bpf_lsm_init(void) >> +{ >> + security_add_hooks(bpf_lsm_hooks, ARRAY_SIZE(bpf_lsm_hooks), "bpf");= >> + pr_info("LSM support for eBPF active\n"); >> + return 0; >> +} >> + >> +DEFINE_LSM(bpf) =3D { >> + .name =3D "bpf", >> + .init =3D bpf_lsm_init, >> +}; >> --=20 >> 2.20.1 >>