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: <87wqx0x7e7.fsf@sejong.aot.lge.com>
Date:	Mon, 03 Dec 2012 10:16:00 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc:	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Paul Mackerras <paulus@...ba.org>,
	Ingo Molnar <mingo@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Jiri Olsa <jolsa@...hat.com>,
	Stephane Eranian <eranian@...gle.com>,
	Andi Kleen <andi@...stfloor.org>,
	Namhyung Kim <namhyung.kim@....com>
Subject: Re: [PATCH 04/18] perf header: Add HEADER_GROUP_DESC feature

On Thu, 29 Nov 2012 15:43:04 -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Nov 29, 2012 at 03:38:32PM +0900, Namhyung Kim escreveu:
>> From: Namhyung Kim <namhyung.kim@....com>
>> 
>> Save group relationship information so that it can be restored when
>> perf report is running.
>> 
[snip]
>> +static int write_group_desc(int fd, struct perf_header *h __maybe_unused,
>> +			    struct perf_evlist *evlist)
>> +{
>> +	u32 nr_groups = evlist->nr_groups;
>> +	struct perf_evsel *evsel;
>> +
>> +	do_write(fd, &nr_groups, sizeof(nr_groups));
>> +
>> +	list_for_each_entry(evsel, &evlist->entries, node) {
>> +		if (perf_evsel__is_group_leader(evsel) &&
>> +		    evsel->nr_members > 1) {
>> +			const char *name = evsel->group_name ?: "{anon_group}";
>> +			u32 leader_idx = evsel->idx;
>> +			u32 nr_members = evsel->nr_members;
>> +
>> +			do_write_string(fd, name);
>> +			do_write(fd, &leader_idx, sizeof(leader_idx));
>> +			do_write(fd, &nr_members, sizeof(nr_members));
>
> You need to check do_write() return, it can fail. There are some cases
> in header.c that don't check it, those should be eventually fixed, most
> cases check it tho.

Okay.

>
>> +		}
>> +	}
>> +	return 0;
>> +}
[snip]
>> +static int process_group_desc(struct perf_file_section *section __maybe_unused,
>> +			      struct perf_header *ph, int fd,
>> +			      void *data __maybe_unused)
>> +{
>> +	size_t ret = -1;
>> +	u32 i, nr, nr_groups;
>> +	struct perf_session *session;
>> +	struct perf_evsel *evsel, *leader = NULL;
>> +	struct group_desc {
>> +		char *name;
>> +		u32 leader_idx;
>> +		u32 nr_members;
>> +	} *desc;
>> +
>> +	if (read(fd, &nr_groups, sizeof(nr_groups)) != sizeof(nr_groups))
>
> Please use readn() instead in all read() cases in this function.

Will do.

Thanks,
Namhyung
--
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