[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191203084626.GB17468@krava>
Date: Tue, 3 Dec 2019 09:46:26 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Steve Grubb <sgrubb@...hat.com>
Cc: Paul Moore <paul@...l-moore.com>, Jiri Olsa <jolsa@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, netdev@...r.kernel.org,
bpf@...r.kernel.org, linux-audit@...hat.com,
Andrii Nakryiko <andriin@...com>, Yonghong Song <yhs@...com>,
Martin KaFai Lau <kafai@...com>,
Jakub Kicinski <jakub.kicinski@...ronome.com>,
David Miller <davem@...hat.com>,
Eric Paris <eparis@...hat.com>, Jiri Benc <jbenc@...hat.com>
Subject: Re: [RFC] bpf: Emit audit messages upon successful prog load and
unload
On Mon, Dec 02, 2019 at 11:57:22PM -0500, Steve Grubb wrote:
> On Monday, December 2, 2019 6:00:14 PM EST Paul Moore wrote:
> > On Thu, Nov 28, 2019 at 4:16 AM Jiri Olsa <jolsa@...nel.org> wrote:
> > > From: Daniel Borkmann <daniel@...earbox.net>
> > >
> > > Allow for audit messages to be emitted upon BPF program load and
> > > unload for having a timeline of events. The load itself is in
> > > syscall context, so additional info about the process initiating
> > > the BPF prog creation can be logged and later directly correlated
> > > to the unload event.
> > >
> > > 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.
SNIP
> > I think you would probably also want to check the results of
> > audit_dummy_context() here as well, see all the various audit_XXX()
> > functions in include/linux/audit.h as an example. You'll see a
> > pattern similar to the following:
> >
> > static inline void audit_foo(...)
> > {
> > if (unlikely(!audit_dummy_context()))
> > __audit_foo(...)
> > }
> >
> > > + ab = audit_log_start(audit_context(), GFP_ATOMIC, AUDIT_BPF);
> > > + if (unlikely(!ab))
> > > + return;
> > > + audit_log_format(ab, "prog-id=%u op=%s",
> > > + prog->aux->id, bpf_audit_str[op]);
> >
> > Is it worth putting some checks in here to make sure that you don't
> > blow past the end of the bpf_audit_str array?
>
> I am wondering if prog-id was really the only information that was needed? Is
> it meaningful to other tools? Does that correlate to anything in /proc? In
> earlier discussion, it sounded like more information was needed to be sure
> what was happening.
yep, as David mentions in the changelog the global ID is enough,
because you can get all the other bpf program info based on that
jirka
Powered by blists - more mailing lists