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: <8db2729f-c59d-2119-cb44-ca916a194624@foss.arm.com>
Date:   Thu, 29 Oct 2020 12:01:16 +0000
From:   Andre Przywara <andre.przywara@...s.arm.com>
To:     Leo Yan <leo.yan@...aro.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Dave Martin <Dave.Martin@....com>,
        Wei Li <liwei391@...wei.com>,
        James Clark <james.clark@....com>, Al Grant <Al.Grant@....com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 10/21] perf arm_spe: Fixup top byte for data virtual
 address

On 29/10/2020 07:19, Leo Yan wrote:
> To establish a valid address from the address packet payload and finally
> the address value can be used for parsing data symbol in DSO, current
> code uses 0xff to replace the tag in the top byte of data virtual
> address.
> 
> So far the code only fixups top byte for the memory layouts with 4KB
> pages, it misses to support memory layouts with 64KB pages.
> 
> This patch adds the conditions for checking bits [55:52] are 0xf, if
> detects the pattern it will fill 0xff into the top byte of the address,
> also adds comment to explain the fixing up.
> 
> Signed-off-by: Leo Yan <leo.yan@...aro.org>

Thanks for the change!

Reviewed-by: Andre Przywara <andre.przywara@....com>

Cheers,
Andre

> ---
>  .../util/arm-spe-decoder/arm-spe-decoder.c    | 20 ++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
> index 776b3e6628bb..cac2ef79c025 100644
> --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
> +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
> @@ -24,7 +24,7 @@
>  
>  static u64 arm_spe_calc_ip(int index, u64 payload)
>  {
> -	u64 ns, el;
> +	u64 ns, el, val;
>  
>  	/* Instruction virtual address or Branch target address */
>  	if (index == SPE_ADDR_PKT_HDR_INDEX_INS ||
> @@ -45,8 +45,22 @@ static u64 arm_spe_calc_ip(int index, u64 payload)
>  		/* Clean tags */
>  		payload = SPE_ADDR_PKT_ADDR_GET_BYTES_0_6(payload);
>  
> -		/* Fill highest byte if bits [48..55] is 0xff */
> -		if (SPE_ADDR_PKT_ADDR_GET_BYTE_6(payload) == 0xffULL)
> +		/*
> +		 * Armv8 ARM (ARM DDI 0487F.c), chapter "D10.2.1 Address packet"
> +		 * defines the data virtual address payload format, the top byte
> +		 * (bits [63:56]) is assigned as top-byte tag; so we only can
> +		 * retrieve address value from bits [55:0].
> +		 *
> +		 * According to Documentation/arm64/memory.rst, if detects the
> +		 * specific pattern in bits [55:52] of payload which falls in
> +		 * the kernel space, should fixup the top byte and this allows
> +		 * perf tool to parse DSO symbol for data address correctly.
> +		 *
> +		 * For this reason, if detects the bits [55:52] is 0xf, will
> +		 * fill 0xff into the top byte.
> +		 */
> +		val = SPE_ADDR_PKT_ADDR_GET_BYTE_6(payload);
> +		if ((val & 0xf0ULL) == 0xf0ULL)
>  			payload |= 0xffULL << SPE_ADDR_PKT_ADDR_BYTE7_SHIFT;
>  
>  	/* Data access physical address */
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ