From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34E34C2D0C2 for ; Mon, 30 Dec 2019 18:58:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 06F13206DB for ; Mon, 30 Dec 2019 18:58:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qIcOHgQE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727558AbfL3S6d (ORCPT ); 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-Google-Smtp-Source: APXvYqwDOsS9YHgxCCyXTdNdnNrfhZNvB4d4/wICLKJ0+mcEO1l7YflLkp1qWW8s03+qMMjRRC7UCvLeTeQvZ2v/pUk= 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: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@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 > > > > > > > [...]