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:	Wed, 3 Jun 2015 10:47:26 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Wang Nan <wangnan0@...wei.com>
Cc:	namhyung@...nel.org, acme@...nel.org, jolsa@...nel.org,
	mingo@...hat.com, lizefan@...wei.com, pi3orama@....com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7] perf: __kmod_path__parse: deal with kernel module
 names in '[]' correctly

On Wed, Jun 03, 2015 at 07:49:23AM +0000, Wang Nan wrote:

SNIP

> diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
> index b335db3..87f5796 100644
> --- a/tools/perf/util/dso.c
> +++ b/tools/perf/util/dso.c
> @@ -166,12 +166,28 @@ bool is_supported_compression(const char *ext)
>  	return false;
>  }
>  
> -bool is_kernel_module(const char *pathname)
> +bool is_kernel_module(const char *pathname, int cpumode)
>  {
>  	struct kmod_path m;
> -
> -	if (kmod_path__parse(&m, pathname))
> -		return NULL;
> +	int mode = cpumode & PERF_RECORD_MISC_CPUMODE_MASK;
> +
> +	WARN_ONCE(mode != cpumode,
> +		  "Internal error: passing unmasked cpumode (%x) to is_kernel_module",
> +		  cpumode);
> +	/* caller should pass a masked cpumode. Mask again for safety. */

no need for this comment then ^^^

jirka

> +	switch (mode) {
> +	case PERF_RECORD_MISC_USER:
> +	case PERF_RECORD_MISC_HYPERVISOR:
> +	case PERF_RECORD_MISC_GUEST_USER:
> +		return false;
> +	/* Treat PERF_RECORD_MISC_CPUMODE_UNKNOWN as kernel */
> +	default:
> +		if (kmod_path__parse(&m, pathname)) {
> +			pr_err("Failed to check whether %s is a kernel module or not. Assume it is.",
> +					pathname);
> +			return true;
> +		}
> +	}

SNIP

--
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