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]
Date:   Mon, 8 Jul 2019 12:38:11 -0400
From:   Kris Van Hees <kris.van.hees@...cle.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Kris Van Hees <kris.van.hees@...cle.com>, netdev@...r.kernel.org,
        bpf@...r.kernel.org, dtrace-devel@....oracle.com,
        linux-kernel@...r.kernel.org, rostedt@...dmis.org,
        mhiramat@...nel.org, acme@...nel.org, ast@...nel.org,
        daniel@...earbox.net, Chris Mason <clm@...com>
Subject: Re: [PATCH 1/1] tools/dtrace: initial implementation of DTrace

On Thu, Jul 04, 2019 at 03:05:09PM +0200, Peter Zijlstra wrote:
> On Wed, Jul 03, 2019 at 08:14:30PM -0700, Kris Van Hees wrote:
> > +int dt_bpf_attach(int event_id, int bpf_fd)
> > +{
> > +	int			event_fd;
> > +	int			rc;
> > +	struct perf_event_attr	attr = {};
> > +
> > +	attr.type = PERF_TYPE_TRACEPOINT;
> > +	attr.sample_type = PERF_SAMPLE_RAW;
> > +	attr.sample_period = 1;
> > +	attr.wakeup_events = 1;
> > +	attr.config = event_id;
> > +
> > +	/* Register the event (based on its id), and obtain a fd. */
> > +	event_fd = perf_event_open(&attr, -1, 0, -1, 0);
> > +	if (event_fd < 0) {
> > +		perror("sys_perf_event_open");
> > +		return -1;
> > +	}
> > +
> > +	/* Enable the probe. */
> > +	rc = ioctl(event_fd, PERF_EVENT_IOC_ENABLE, 0);
> 
> AFAICT you didn't use attr.disabled = 1, so this IOC_ENABLE is
> completely superfluous.

Oh yes, good point (and the same applies to the dt_buffer.c code where I set
up the events that own each buffer - no point in doing an explicit enable there
eiteher).

Thanks for catching this!

> > +	if (rc < 0) {
> > +		perror("PERF_EVENT_IOC_ENABLE");
> > +		return -1;
> > +	}
> > +
> > +	/* Associate the BPF program with the event. */
> > +	rc = ioctl(event_fd, PERF_EVENT_IOC_SET_BPF, bpf_fd);
> > +	if (rc < 0) {
> > +		perror("PERF_EVENT_IOC_SET_BPF");
> > +		return -1;
> > +	}
> > +
> > +	return 0;
> > +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ