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: <389a8b98-1d53-6fe3-ff56-0789c0841292@linux.intel.com>
Date:   Mon, 15 Jul 2019 15:30:24 +0300
From:   Alexey Budankov <alexey.budankov@...ux.intel.com>
To:     Jiri Olsa <jolsa@...hat.com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Andi Kleen <ak@...ux.intel.com>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1] perf session: fix loading of compressed data split
 across adjacent records

On 14.07.2019 18:49, Jiri Olsa wrote:
> On Tue, Jul 09, 2019 at 05:48:14PM +0300, Alexey Budankov wrote:
> 
> SNIP
> 
>>  	decomp->file_pos = file_offset;
>> +	decomp->mmap_len = mmap_len;
>>  	decomp->head = 0;
>>  
>> -	if (decomp_last) {
>> -		decomp_last_rem = decomp_last->size - decomp_last->head;
>> +	if (decomp_last_rem) {
>>  		memcpy(decomp->data, &(decomp_last->data[decomp_last->head]), decomp_last_rem);
>>  		decomp->size = decomp_last_rem;
>>  	}
>> @@ -61,7 +67,7 @@ static int perf_session__process_compressed_event(struct perf_session *session,
>>  	decomp_size = zstd_decompress_stream(&(session->zstd_data), src, src_size,
>>  				&(decomp->data[decomp_last_rem]), decomp_len - decomp_last_rem);
>>  	if (!decomp_size) {
>> -		munmap(decomp, sizeof(struct decomp) + decomp_len);
>> +		munmap(decomp, mmap_len);
>>  		pr_err("Couldn't decompress data\n");
>>  		return -1;
>>  	}
>> @@ -255,15 +261,15 @@ static void perf_session__delete_threads(struct perf_session *session)
>>  static void perf_session__release_decomp_events(struct perf_session *session)
>>  {
>>  	struct decomp *next, *decomp;
>> -	size_t decomp_len;
>> +	size_t mmap_len;
>>  	next = session->decomp;
>> -	decomp_len = session->header.env.comp_mmap_len;
>>  	do {
>>  		decomp = next;
>>  		if (decomp == NULL)
>>  			break;
>>  		next = decomp->next;
>> -		munmap(decomp, decomp_len + sizeof(struct decomp));
>> +		mmap_len = decomp->mmap_len;
>> +		munmap(decomp, mmap_len);
> 
> what's the need for extra mmap_len variable in here?
> could you just use decomp->mmap_len directly?

To avoid reference to the object being deallocated.
Plain munmap(), yes - :)

~Alexey

> 
> otherwise it lookgs good to me
> 
> thanks,
> jirka
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ