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:	Fri, 11 Dec 2015 16:12:29 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc:	Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
	vince@...ter.net, eranian@...gle.com,
	Arnaldo Carvalho de Melo <acme@...radead.org>,
	Mathieu Poirier <mathieu.poirier@...aro.org>
Subject: Re: [PATCH v0 3/5] perf: Introduce instruction trace filtering

On Fri, Dec 11, 2015 at 03:36:36PM +0200, Alexander Shishkin wrote:
> +/*
> + * Scan through mm's vmas and see if one of them matches the
> + * @filter; if so, adjust filter's address range.
> + * Called with mm::mmap_sem down for reading.
> + */
> +static int perf_itrace_filter_apply(struct perf_event *event,
> +				    struct perf_itrace_filter *filter,
> +				    struct mm_struct *mm)
> +{
> +	struct vm_area_struct *vma;

	lockdep_assert_held(&mm->mmap_sem);

If you want to be pedantic we could add:

	lockdep_assert_held_shared()
	lockdep_assert_held_exclusive()

to assert we hold it in any particular state.

> +
> +	for (vma = mm->mmap; vma->vm_next; vma = vma->vm_next) {
> +		struct file *file = vma->vm_file;
> +		unsigned long off = vma->vm_pgoff << PAGE_SHIFT;
> +		unsigned long vma_size = vma->vm_end - vma->vm_start;
> +
> +		if (!file)
> +			continue;
> +
> +		if (!perf_itrace_filter_match(filter, file, off,
> +					      vma_size))
> +			continue;
> +
> +		filter->start = vma->vm_start + filter->offset;
> +		filter->end = vma->vm_start + filter->offset +
> +			filter->size;
> +
> +		return 1;
> +	}
> +
> +	return 0;
> +}
--
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