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] [day] [month] [year] [list]
Message-ID: <20140406120728.GA1164@krava.brq.redhat.com>
Date:	Sun, 6 Apr 2014 14:07:28 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Cody P Schafer <cody@...ux.vnet.ibm.com>
Cc:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Ingo Molnar <mingo@...hat.com>,
	Paul Mackerras <paulus@...ba.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [PATCH] tools/perf: allow overriding sysfs and proc finding with
 env var

On Fri, Apr 04, 2014 at 12:59:25PM -0700, Cody P Schafer wrote:
> SYSFS_PATH and PROC_PATH environment variables now let the user override
> the detection of sysfs and proc locations for testing purposes.

seems usefull, but this code was moved to tools/lib/api/fs/fs.c

please rebase to the latest Arnaldo's perf/core branch
(git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux)

thanks,
jirka

> 
> Signed-off-by: Cody P Schafer <cody@...ux.vnet.ibm.com>
> ---
>  tools/perf/util/fs.c | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
> 
> diff --git a/tools/perf/util/fs.c b/tools/perf/util/fs.c
> index f5be1f2..dccbd26 100644
> --- a/tools/perf/util/fs.c
> +++ b/tools/perf/util/fs.c
> @@ -91,8 +91,44 @@ static bool fs__check_mounts(struct fs *fs)
>  	return false;
>  }
>  
> +static void mem_toupper(char *f, size_t len)
> +{
> +	while (len) {
> +		*f = toupper(*f);
> +		f++;
> +		len--;
> +	}
> +}
> +
> +/*
> + * Check for "NAME_PATH" environment variable to override fs location (for
> + * testing). This matches the recommendation in Documentation/sysfs-rules.txt
> + * for SYSFS_PATH.
> + */
> +static bool fs__env_override(struct fs *fs)
> +{
> +	char *override_path;
> +	size_t name_len = strlen(fs->name);
> +	/* name + "_PATH" + '\0' */
> +	char upper_name[name_len + 5 + 1];
> +	memcpy(upper_name, fs->name, name_len);
> +	mem_toupper(upper_name, name_len);
> +	strcpy(&upper_name[name_len], "_PATH");
> +
> +	override_path = getenv(upper_name);
> +	if (!override_path)
> +		return false;
> +
> +	fs->found = true;
> +	strcpy(fs->path, override_path);

please use strncpy with size of fs->path
--
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