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, 23 Jul 2014 14:48:49 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Adrian Hunter <adrian.hunter@...el.com>
Cc:	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	linux-kernel@...r.kernel.org, David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Namhyung Kim <namhyung@...il.com>,
	Paul Mackerras <paulus@...ba.org>,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 49/52] perf tools: Build programs to copy 32-bit
 compatibility VDSOs

On Tue, Jul 22, 2014 at 04:17:58PM +0300, Adrian Hunter wrote:

SNIP

> index 1f67aa0..45ab040 100644
> --- a/tools/perf/config/Makefile
> +++ b/tools/perf/config/Makefile
> @@ -604,6 +604,27 @@ ifdef HAVE_KVM_STAT_SUPPORT
>      CFLAGS += -DHAVE_KVM_STAT_SUPPORT
>  endif
>  
> +ifeq (${IS_64_BIT}, 1)
> +  ifndef NO_PERF_READ_VDSO32
> +    CAN_DO := $(shell echo "main() {}" | ${CC} -m32 -x c - >/dev/null 2>/dev/null && echo 1 || echo 0)
> +    ifneq (${CAN_DO}, 1)
> +      NO_PERF_READ_VDSO32 := 1
> +    endif
> +  endif
> +  ifneq (${IS_X86_64}, 1)
> +    NO_PERF_READ_VDSOX32 := 1
> +  endif
> +  ifndef NO_PERF_READ_VDSOX32
> +    CAN_DO := $(shell echo 'main() {}' | ${CC} -mx32 -x c - >/dev/null 2>/dev/null && echo 1 || echo 0)
> +    ifneq (${CAN_DO}, 1)
> +      NO_PERF_READ_VDSOX32 := 1
> +    endif
> +  endif

please move those check into feature config code under config/features/..

SNIP

> +++ b/tools/perf/perf-read-vdso.c
> @@ -0,0 +1,59 @@
> +#include <stdio.h>
> +#include <string.h>
> +
> +#define VDSO__MAP_NAME "[vdso]"
> +
> +static int find_vdso_map(void **start, void **end)
> +{
> +	FILE *maps;
> +	char line[128];
> +	int found = 0;
> +
> +	maps = fopen("/proc/self/maps", "r");
> +	if (!maps) {
> +		fprintf(stderr, "vdso: cannot open maps\n");
> +		return -1;
> +	}
> +
> +	while (!found && fgets(line, sizeof(line), maps)) {
> +		int m = -1;
> +
> +		/* We care only about private r-x mappings. */
> +		if (2 != sscanf(line, "%p-%p r-xp %*x %*x:%*x %*u %n",
> +				start, end, &m))
> +			continue;
> +		if (m < 0)
> +			continue;
> +
> +		if (!strncmp(&line[m], VDSO__MAP_NAME,
> +			     sizeof(VDSO__MAP_NAME) - 1))
> +			found = 1;
> +	}
> +
> +	fclose(maps);
> +	return !found;
> +}

hum, any easy way to use/share find_vdso_map from vdso.c?
I guess this way is more straighforward and clear.. it's
probably not worthy for function this simple

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