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=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 C85E9C432C3 for ; Wed, 20 Nov 2019 21:30:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C0E120855 for ; Wed, 20 Nov 2019 21:30:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VZpR92FK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725936AbfKTVaY (ORCPT ); Wed, 20 Nov 2019 16:30:24 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:23276 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725820AbfKTVaY (ORCPT ); Wed, 20 Nov 2019 16:30:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574285422; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rtwpA4pT/CgUxGCYsbiwstNxREBeZqu/WGJTSfvVrww=; b=VZpR92FKcCDNmLf+8nX0xJ4ixIrHosO1DVV6Pc76wpwEyJ6h+ODtpF7hQtZJVKvxQch3CI saLrWT4MhLYWkFA7VTyu4COASvdATSii2oxV06YLsb5YlAQLw/zu3GUEEe72vV2MqvwzeP MLr8ChhO8eVzL9jcCyiD+LFgiy7ErDE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-278-x1AVbhzYMWWY7W_5uvBRdQ-1; Wed, 20 Nov 2019 16:30:19 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7BF0818C35A2; Wed, 20 Nov 2019 21:30:17 +0000 (UTC) Received: from krava (ovpn-204-103.brq.redhat.com [10.40.204.103]) by smtp.corp.redhat.com (Postfix) with SMTP id 52FF351C85; Wed, 20 Nov 2019 21:30:12 +0000 (UTC) Date: Wed, 20 Nov 2019 22:30:11 +0100 From: Jiri Olsa To: Alexei Starovoitov Cc: Jiri Olsa , Alexei Starovoitov , Daniel Borkmann , netdev@vger.kernel.org, bpf@vger.kernel.org, Andrii Nakryiko , Yonghong Song , Martin KaFai Lau , Jakub Kicinski , Steve Grubb , David Miller , Paul Moore , Eric Paris , Jiri Benc Subject: Re: [RFC] bpf: emit audit messages upon successful prog load and unload Message-ID: <20191120213011.GA6829@krava> References: <20191120143810.8852-1-jolsa@kernel.org> <20191120211438.x5dn2ns755bv3q63@ast-mbp.dhcp.thefacebook.com> MIME-Version: 1.0 In-Reply-To: <20191120211438.x5dn2ns755bv3q63@ast-mbp.dhcp.thefacebook.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: x1AVbhzYMWWY7W_5uvBRdQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Wed, Nov 20, 2019 at 01:14:40PM -0800, Alexei Starovoitov wrote: > On Wed, Nov 20, 2019 at 03:38:10PM +0100, Jiri Olsa wrote: > >=20 > > The only info really needed from BPF side is the globally unique > > prog ID where then audit user space tooling can query / dump all > > info needed about the specific BPF program right upon load event > > and enrich the record, thus these changes needed here can be kept > > small and non-intrusive to the core. >=20 > ... >=20 > > +static void bpf_audit_prog(const struct bpf_prog *prog, enum bpf_event= event) > > +{ > > +=09bool has_task_context =3D event =3D=3D BPF_EVENT_LOAD; > > +=09struct audit_buffer *ab; > > + > > +=09if (audit_enabled =3D=3D AUDIT_OFF) > > +=09=09return; > > +=09ab =3D audit_log_start(audit_context(), GFP_ATOMIC, AUDIT_BPF); > > +=09if (unlikely(!ab)) > > +=09=09return; > > +=09if (has_task_context) > > +=09=09audit_log_task(ab); > > +=09audit_log_format(ab, "%sprog-id=3D%u event=3D%s", > > +=09=09=09 has_task_context ? " " : "", > > +=09=09=09 prog->aux->id, bpf_event_audit_str[event]); > > +=09audit_log_end(ab); >=20 > Single prog ID is enough for perf_event based framework to track everythi= ng > about the programs and should be enough for audit. > Could you please resend as proper patch with explicit 'From:' ? > Since I'm not sure what is the proper authorship of the patch.. Daniel's = or yours. it's Daniel's I'll resend jirka