Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp14486284ybl; Mon, 30 Dec 2019 11:00:41 -0800 (PST) X-Google-Smtp-Source: APXvYqwuSJcmEGFKyI8aE5Z8OyZjB+/bD2vTNoQ+yIRCVg/pqO2MacgGczAAtWv/X2s00ox3dSlT X-Received: by 2002:a9d:51c1:: with SMTP id d1mr71964928oth.136.1577732441872; Mon, 30 Dec 2019 11:00:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577732441; cv=none; d=google.com; s=arc-20160816; b=z1mSCoaZhKYyOigErCrkbT+NYH22aKaTQEBY9PAbHBs+x4o2qNMCObtu6xjokrZN3h O/r3jZEU8Ubw8nRxDEf4uF/yV/yOn6KKXWrgO0ybcGjPKVVToWnq2kiVIaolgs1rQiu4 OAq9QaMFsrDfxmotJrPRX10SGDWEc3q2hXsZ3L+FM+Rmg/LiGyE+VkwtjHGkDIx4dL7R Xr61efrpkWoM/QVF0WqHmqHEao8CcvQyYlAn5BbNB7y2zenDKsjXJu/wBrB27EoEipUj 6Za6DriRqvjLr6F4MGU9VrU/3r2XdgbgYYbASElT6cuNZZAvl3O0XWyIe8YUFUs1HpYc Nndw== 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 :in-reply-to:references:mime-version:dkim-signature; bh=5FEFjcDA8my2bZUcNbRJBtP3FywoOl3HIIG/fCfRCk8=; b=I1r04j+MZuOlVRf8Vw68mU/RxH074A+DJSYCgZyNL5jfdAKU3WYYPQYkfAGFV2wkvN m1Uh7/KgGPB0WXg4VusAXtHsWAzhxi/Wi6E7Hs7ls6jp/f7DnjO4Hxk7BDCu8YnCzHgI SzPqTiCMAXVfzi2uTu3d+R3j2Yn4uVV+OFM4fZsS5/eqYVv9kq2rLimuXos6haB49mlV zPNE8kvnEsHtw+zlAbG8cWtSrLFh8mQ6hUbK34fLq/WAc00a3k+r1mzfnkRhj/8ujnvv H06KfNBsdVnmyXZp3ANqrLFipI9WNUmC2HGbQHKey7cKkW0asr87OeUMkNFZAMLvAQhj FDfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qIcOHgQE; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d192si21571035oig.21.2019.12.30.11.00.30; Mon, 30 Dec 2019 11:00:41 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=qIcOHgQE; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727669AbfL3S6d (ORCPT + 99 others); Mon, 30 Dec 2019 13:58:33 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:39179 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727278AbfL3S6d (ORCPT ); Mon, 30 Dec 2019 13:58:33 -0500 Received: by mail-qt1-f195.google.com with SMTP id e5so30209995qtm.6; Mon, 30 Dec 2019 10:58:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5FEFjcDA8my2bZUcNbRJBtP3FywoOl3HIIG/fCfRCk8=; b=qIcOHgQE/kFeG8KW1Bro9BqC2MpHkT38jV/nN2KAZKOlKu/8HJF6RN+2ph/7kT5+PC 1ShG3xUCBcWJIwdnc+MM2FVNhOoEIjmoaVtAimxNTr4bHkXhMJwOPLMqS3v5iek4o9JB A9uEUtZZv0cN1+xBtp6jKlcCHHXF13TTradNTenhhtPjhkcf3ygy+YUyrAfJFf6qGoyu FSQjbtnE9QEZ1QXADvxW9ThuFT/nfSwnoAMsLndWqAfzLqa0s6R7oYgkvU7/otjk/Am/ reGPr4gtJM5OMI3FoCSCgwUrFODtmbZUvp4u+sGMXm1nq+QZgHKzSxgoVtvG+/twM2Ic shQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5FEFjcDA8my2bZUcNbRJBtP3FywoOl3HIIG/fCfRCk8=; b=dNcQaYVajEAUakcnATlo/+OZoDekyDMgXMXrObH2zASGNY/JXX2InRfew7wTNWPDln sXx7Qta+LVfyTVMIKrL5HqHufNiVo6AkEHTMnrtlhJsDv0vWsvpdV0kIImfc+A5Q1x/i DSgOvEPWi5EmqkoWjZR25csFVL1a+jbGchaPWhAq7PcfG2JRU87ZOMgKmCZkdb+0pLdp 6ONXLr03ksjTEW1kd3grERP3oOihRyw5xF7g9lfbrKiGcENXbdQ20kyZfx1/RmzVeMhU PC1dlpQ+ckW8Fbl2p9QlOtG+sdTZjnFwl6QOmBY6laCymnnnG3ncm6My+4k7zzLoOpwl cEdg== X-Gm-Message-State: APjAAAXh8eabrpYThMIk40OGQFrqPTiC113etoF9rfqASP1pDAL1h2Xk aSXBg8Dd/F2L/59smP2fNVy8gqosWSW5IQWv7FM= X-Received: by 2002:ac8:7b29:: with SMTP id l9mr17344101qtu.141.1577732311882; Mon, 30 Dec 2019 10:58:31 -0800 (PST) MIME-Version: 1.0 References: <20191220154208.15895-1-kpsingh@chromium.org> <20191230150424.GB70684@google.com> In-Reply-To: <20191230150424.GB70684@google.com> From: Andrii Nakryiko Date: Mon, 30 Dec 2019 10:58:20 -0800 Message-ID: Subject: Re: [PATCH bpf-next v1 00/13] MAC and Audit policy using eBPF (KRSI) To: KP Singh Cc: open list , bpf , linux-security-module@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , James Morris , Kees Cook , Thomas Garnier , Michael Halcrow , Paul Turner , Brendan Gregg , Jann Horn , Matthew Garrett , Christian Brauner , =?UTF-8?B?TWlja2HDq2wgU2FsYcO8bg==?= , Florent Revest , Brendan Jackman , Martin KaFai Lau , Song Liu , Yonghong Song , "Serge E. Hallyn" , Mauro Carvalho Chehab , "David S. Miller" , Greg Kroah-Hartman , Nicolas Ferre , Stanislav Fomichev , Quentin Monnet , Andrey Ignatov , Joe Stringer 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 Mon, Dec 30, 2019 at 7:04 AM KP Singh wrote: > > On 23-Dec 22:51, Andrii Nakryiko wrote: > > On Fri, Dec 20, 2019 at 7:42 AM KP Singh wrote: > > > > > > From: KP Singh > > > > > > This patch series is a continuation of the KRSI RFC > > > (https://lore.kernel.org/bpf/20190910115527.5235-1-kpsingh@chromium.org/) > > > > > > > [...] > > > > > # Usage Examples > > > > > > A simple example and some documentation is included in the patchset. > > > > > > In order to better illustrate the capabilities of the framework some > > > more advanced prototype code has also been published separately: > > > > > > * Logging execution events (including environment variables and arguments): > > > https://github.com/sinkap/linux-krsi/blob/patch/v1/examples/samples/bpf/lsm_audit_env.c > > > * Detecting deletion of running executables: > > > https://github.com/sinkap/linux-krsi/blob/patch/v1/examples/samples/bpf/lsm_detect_exec_unlink.c > > > * Detection of writes to /proc//mem: > > > https://github.com/sinkap/linux-krsi/blob/patch/v1/examples/samples/bpf/lsm_audit_env.c > > > > Are you planning on submitting these examples for inclusion into > > samples/bpf or selftests/bpf? It would be great to have more examples > > and we can review and suggest nicer ways to go about writing them > > (e.g., BPF skeleton and global data Alexei mentioned earlier). > > Eventually, yes and in selftest/bpf. > > But these examples depend on using security blobs and some non-atomic > calls in the BPF helpers which are not handled as a part of the > initial patch-set. > > Once we have the initial framework finalized, I will update the > examples and the helpers they are based on and send these separate > patch-sets on the list for review. Great! The reason I was asking is that once they are in selftests, it would be nice to switch them to use all the latest BPF usability improvements to make code cleaner and have it as another good example of modern BPF program. Like use BTF-defined maps, BPF skeleton, vmlinux.h, etc. We can go over this when the time comes, though :) > > - KP > > > > > > > > > We have updated Google's internal telemetry infrastructure and have > > > started deploying this LSM on our Linux Workstations. This gives us more > > > confidence in the real-world applications of such a system. > > > > > > KP Singh (13): > > > bpf: Refactor BPF_EVENT context macros to its own header. > > > bpf: lsm: Add a skeleton and config options > > > bpf: lsm: Introduce types for eBPF based LSM > > > bpf: lsm: Allow btf_id based attachment for LSM hooks > > > tools/libbpf: Add support in libbpf for BPF_PROG_TYPE_LSM > > > bpf: lsm: Init Hooks and create files in securityfs > > > bpf: lsm: Implement attach, detach and execution. > > > bpf: lsm: Show attached program names in hook read handler. > > > bpf: lsm: Add a helper function bpf_lsm_event_output > > > bpf: lsm: Handle attachment of the same program > > > tools/libbpf: Add bpf_program__attach_lsm > > > bpf: lsm: Add selftests for BPF_PROG_TYPE_LSM > > > bpf: lsm: Add Documentation > > > > > > > [...]