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: <20190716184959.GG3624@kernel.org>
Date:   Tue, 16 Jul 2019 15:49:59 -0300
From:   Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To:     Alexey Budankov <alexey.budankov@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>
Cc:     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

Em Mon, Jul 15, 2019 at 03:30:24PM +0300, Alexey Budankov escreveu:
> 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 - :)

So, Jiri, Acked-by?

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ