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: <ZrQI1w1B3hnWbd6j@google.com>
Date: Wed, 7 Aug 2024 16:52:55 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Howard Chu <howardchu95@...il.com>
Cc: irogers@...gle.com, acme@...nel.org, adrian.hunter@...el.com,
	jolsa@...nel.org, kan.liang@...ux.intel.com,
	linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 8/9] perf header: Add field 'embed'

On Wed, Aug 07, 2024 at 11:38:42PM +0800, Howard Chu wrote:
> We have to save the embedded data's sample type for it to be consumed
> correctly by perf script or perf report.
> 
> This will approach most definitely break some perf.data convertor.
> 
> Signed-off-by: Howard Chu <howardchu95@...il.com>
> ---
>  tools/perf/util/header.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index 55e9553861d0..d60e77d5c25c 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -80,6 +80,7 @@ const char perf_version_string[] = PERF_VERSION;
>  
>  struct perf_file_attr {
>  	struct perf_event_attr	attr;
> +	__u64 embed;

Can we just set bpf_output.attr correctly and get rid of this?

Thanks,
Namhyung


>  	struct perf_file_section	ids;
>  };
>  
> @@ -3713,6 +3714,7 @@ static int perf_session__do_write_header(struct perf_session *session,
>  		}
>  		f_attr = (struct perf_file_attr){
>  			.attr = evsel->core.attr,
> +			.embed = evsel->sample_type_embed,
>  			.ids  = {
>  				.offset = evsel->id_offset,
>  				.size   = evsel->core.ids * sizeof(u64),
> @@ -4147,6 +4149,14 @@ static int read_attr(int fd, struct perf_header *ph,
>  
>  		ret = readn(fd, ptr, left);
>  	}
> +
> +	ret = readn(fd, &f_attr->embed, sizeof(f_attr->embed));
> +	if (ret <= 0) {
> +		pr_debug("failed to read %d bytes of embedded sample type\n",
> +			 (int)sizeof(f_attr->embed));
> +		return -1;
> +	}
> +
>  	/* read perf_file_section, ids are read in caller */
>  	ret = readn(fd, &f_attr->ids, sizeof(f_attr->ids));
>  
> @@ -4272,6 +4282,8 @@ int perf_session__read_header(struct perf_session *session, int repipe_fd)
>  		tmp = lseek(fd, 0, SEEK_CUR);
>  		evsel = evsel__new(&f_attr.attr);
>  
> +		evsel->sample_type_embed = f_attr.embed;
> +
>  		if (evsel == NULL)
>  			goto out_delete_evlist;
>  
> -- 
> 2.45.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ