lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55957CB4.3010803@plumgrid.com>
Date:	Thu, 02 Jul 2015 11:02:28 -0700
From:	Alexei Starovoitov <ast@...mgrid.com>
To:	"Wangnan (F)" <wangnan0@...wei.com>, He Kuang <hekuang@...wei.com>,
	rostedt@...dmis.org, masami.hiramatsu.pt@...achi.com,
	mingo@...hat.com, acme@...hat.com, a.p.zijlstra@...llo.nl,
	jolsa@...nel.org, namhyung@...nel.org
CC:	linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 1/5] bpf: Put perf_events check ahead of bpf prog

On 7/1/15 10:52 PM, Wangnan (F) wrote:
> I'd like to discuss with you about the correctness of our
> understanding. Do you have any strong reason to put BPF filters at such
> an early stage?

the obvious reason is performance.
It is so much faster to run generated
'if (bpf_get_current_pid() != expected_pid) return'
instead of going through __get_data_size,
perf_trace_buf_prepare, store_trace_args,
perf_trace_buf_submit->perf_tp_event_match->filter_match_preds.
bpf is the fastest way to filter out things, so it should be first.

I would argue that even for regular samples (cycle counts and so on),
we should be using this tiny bpf prog to filter by pid.
It's around 5 or so instructions that perf can always use instead
of doing 'common_pid != expected_pid' > filter. Disturbance to the
whole kernel will be much lower. Obviously there are no hooks for
bpf programs in regular samples, but I think it's worth doing.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ