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]
Message-ID: <20180509170809.GJ13491@kernel.org>
Date:   Wed, 9 May 2018 14:08:09 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Adrian Hunter <adrian.hunter@...el.com>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Andy Lutomirski <luto@...nel.org>,
        "H. Peter Anvin" <hpa@...or.com>, Andi Kleen <ak@...ux.intel.com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Joerg Roedel <joro@...tes.org>, Jiri Olsa <jolsa@...hat.com>,
        linux-kernel@...r.kernel.org, x86@...nel.org
Subject: Re: [PATCH RFC 06/19] perf tools: Fix kernel_start for KPTI on x86_64

Em Wed, May 09, 2018 at 02:43:35PM +0300, Adrian Hunter escreveu:
> On x86_64, KPTI entry trampolines are less than the start of kernel text,
> but still above 2^63. So leave kernel_start = 1ULL << 63 for x86_64.
> 
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
> ---
>  tools/perf/util/machine.c | 16 +++++++++++++++-
>  tools/perf/util/machine.h |  2 ++
>  2 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index 72a351613d85..22047ff3cf2a 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -2296,6 +2296,15 @@ int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid,
>  	return 0;
>  }
>  
> +/*
> + * Compares the raw arch string. N.B. see instead perf_env__arch() if a
> + * normalized arch is needed.
> + */
> +bool machine__is(struct machine *machine, const char *arch)
> +{
> +	return machine->env && !strcmp(machine->env->arch, arch);
> +}
> +

Please make machine__is(NULL) return false, to reduce boilerplate in
callers:

bool machine__is(struct machine *machine, const char *arch)
{
	return machine && machine->env && !strcmp(machine->env->arch, arch);
}


>  int machine__get_kernel_start(struct machine *machine)
>  {
>  	struct map *map = machine__kernel_map(machine);
> @@ -2312,7 +2321,12 @@ int machine__get_kernel_start(struct machine *machine)
>  	machine->kernel_start = 1ULL << 63;
>  	if (map) {
>  		err = map__load(map);
> -		if (!err)
> +		/*
> +		 * On x86_64, KPTI entry trampolines are less than the
> +		 * start of kernel text, but still above 2^63. So leave
> +		 * kernel_start = 1ULL << 63 for x86_64.
> +		 */
> +		if (!err && !machine__is(machine, "x86_64"))
>  			machine->kernel_start = map->start;
>  	}
>  	return err;
> diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h
> index 388fb4741c54..b31d33b5aa2a 100644
> --- a/tools/perf/util/machine.h
> +++ b/tools/perf/util/machine.h
> @@ -188,6 +188,8 @@ static inline bool machine__is_host(struct machine *machine)
>  	return machine ? machine->pid == HOST_KERNEL_ID : false;
>  }
>  
> +bool machine__is(struct machine *machine, const char *arch);
> +
>  struct thread *__machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid);
>  struct thread *machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid);
>  
> -- 
> 1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ