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: <20140519095854.GB5027@krava.brq.redhat.com>
Date:	Mon, 19 May 2014 11:58:54 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Stephane Eranian <eranian@...gle.com>
Cc:	linux-kernel@...r.kernel.org, peterz@...radead.org, mingo@...e.hu,
	acme@...hat.com, namhyung.kim@...nel.org,
	Michael Lentine <mlentine@...gle.com>
Subject: Re: [PATCH 2/2] perf tools: add automatic remapping of Android
 libraries

On Sat, May 17, 2014 at 01:14:47AM +0200, Stephane Eranian wrote:
> From: Michael Lentine <mlentine@...gle.com>
> 
> This patch automtically adjusts the path of MMAP records
> associated with Android system libraries. It enables running
> perf reporting tools directly on the Android system natively.

could the changelog have more info about the lib name changes?

SNIP

> +
> +	if (!strncmp(filename, "/data/app-lib", 13)) {
> +		char *apk_path;
> +
> +		if (!app_abi_length)
> +			return false;
> +
> +		new_length = 7 + app_abi_length + lib_length;
> +
> +		apk_path = getenv("APK_PATH");
> +		if(apk_path) {
> +			snprintf(*newfilename, new_length + strlen(apk_path) + 1,
> +				 "%s/libs/%s/%s", apk_path, app_abi, libname);
> +		} else {
> +			snprintf(*newfilename, new_length,
> +				 "libs/%s/%s", app_abi, libname);
> +		}

missing check for overflowing PATH_MAX for 'new_length' and 'new_length + strlen(apk_path) + 1'

> +		return true;
> +	}
> +
> +	if (!strncmp(filename, "/system/lib/", 11)) {
> +		char *ndk, *app;
> +		const char *arch;
> +		size_t ndk_length;
> +		size_t app_length;
> +
> +		ndk = getenv("NDK_ROOT");
> +		app = getenv("APP_PLATFORM");
> +
> +		if (!(ndk && app))
> +			return false;
> +
> +		ndk_length = strlen(ndk);
> +		app_length = strlen(app);
> +
> +		if (!(ndk_length && app_length && app_abi_length))
> +			return false;
> +
> +		arch = !strncmp(app_abi, "arm", 3) ? "arm" :
> +		       !strncmp(app_abi, "mips", 4) ? "mips" :
> +		       !strncmp(app_abi, "x86", 3) ? "x86" : NULL;
> +
> +		if (!arch)
> +			return false;
> +
> +		new_length = 27 + ndk_length +
> +			     app_length + lib_length
> +			   + strlen(arch);

missing check for overflowing PATH_MAX for 'new_length'

> +
> +		snprintf(*newfilename, new_length,
> +			"%s/platforms/%s/arch-%s/usr/lib/%s",
> +			ndk, app, arch, libname);
> +
> +		return true;
> +	}
> +	return false;
> +}
> +

SNIP

> +		if (android) {
> +			char *newfilename_ptr = newfilename;
> +			if (replace_android_lib(filename, &newfilename_ptr))
> +				filename = newfilename;

Why is the newfilename_ptr needed? We could pass newfilename directly
to replace_android_lib function

		if (replace_android_lib(filename, newfilename))
			filename = newfilename;

thanks,
jirka
--
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