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:   Tue, 26 Jan 2021 16:55:00 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     "Liang, Kan" <kan.liang@...ux.intel.com>
Cc:     acme@...nel.org, mingo@...nel.org, linux-kernel@...r.kernel.org,
        eranian@...gle.com, namhyung@...nel.org, jolsa@...hat.com,
        ak@...ux.intel.com, yao.jin@...ux.intel.com
Subject: Re: [PATCH 01/12] perf/core: Add PERF_SAMPLE_WEIGHT_EXT

On Tue, Jan 26, 2021 at 10:33:18AM -0500, Liang, Kan wrote:
> 
> 
> On 1/26/2021 9:42 AM, Peter Zijlstra wrote:
> > On Tue, Jan 19, 2021 at 12:38:20PM -0800, kan.liang@...ux.intel.com wrote:
> > 
> > > @@ -900,6 +901,13 @@ enum perf_event_type {
> > >   	 *	  char			data[size]; } && PERF_SAMPLE_AUX
> > >   	 *	{ u64			data_page_size;} && PERF_SAMPLE_DATA_PAGE_SIZE
> > >   	 *	{ u64			code_page_size;} && PERF_SAMPLE_CODE_PAGE_SIZE
> > > +	 *	{ union {
> > > +	 *		u64		weight_ext;
> > > +	 *		struct {
> > > +	 *			u64	instr_latency:16,
> > > +	 *				reserved:48;
> > > +	 *		};
> > > +	 *	} && PERF_SAMPLE_WEIGHT_EXT
> > >   	 * };
> > >   	 */
> > >   	PERF_RECORD_SAMPLE			= 9,
> > > @@ -1248,4 +1256,12 @@ struct perf_branch_entry {
> > >   		reserved:40;
> > >   };
> > > +union perf_weight_ext {
> > > +	__u64		val;
> > > +	struct {
> > > +		__u64	instr_latency:16,
> > > +			reserved:48;
> > > +	};
> > > +};
> > > +
> > >   #endif /* _UAPI_LINUX_PERF_EVENT_H */
> > > diff --git a/kernel/events/core.c b/kernel/events/core.c
> > > index 55d1879..9363d12 100644
> > > --- a/kernel/events/core.c
> > > +++ b/kernel/events/core.c
> > > @@ -1903,6 +1903,9 @@ static void __perf_event_header_size(struct perf_event *event, u64 sample_type)
> > >   	if (sample_type & PERF_SAMPLE_CODE_PAGE_SIZE)
> > >   		size += sizeof(data->code_page_size);
> > > +	if (sample_type & PERF_SAMPLE_WEIGHT_EXT)
> > > +		size += sizeof(data->weight_ext);
> > > +
> > >   	event->header_size = size;
> > >   }
> > > @@ -6952,6 +6955,9 @@ void perf_output_sample(struct perf_output_handle *handle,
> > >   			perf_aux_sample_output(event, handle, data);
> > >   	}
> > > +	if (sample_type & PERF_SAMPLE_WEIGHT_EXT)
> > > +		perf_output_put(handle, data->weight_ext);
> > > +
> > >   	if (!event->attr.watermark) {
> > >   		int wakeup_events = event->attr.wakeup_events;
> > 
> > This patch is broken and will expose uninitialized kernel stack.
> > 
> 
> Could we initialize the 'weight_ext' in perf_sample_data_init()?

No. Also see my other mail for why I hate this thing.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ