public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm•com>
To: Steve Capper <steve.capper@arm•com>
Cc: crecklin@redhat•com, ard.biesheuvel@linaro•org, maz@kernel•org,
	bhsharma@redhat•com, will@kernel•org,
	linux-arm-kernel@lists•infradead.org
Subject: Re: [PATCH V4 03/11] arm64: kasan: Switch to using KASAN_SHADOW_OFFSET
Date: Mon, 5 Aug 2019 17:37:21 +0100	[thread overview]
Message-ID: <20190805163720.GF4175@arrakis.emea.arm.com> (raw)
In-Reply-To: <20190729162117.832-4-steve.capper@arm.com>

On Mon, Jul 29, 2019 at 05:21:09PM +0100, Steve Capper wrote:
> diff --git a/Documentation/arm64/kasan-offsets.sh b/Documentation/arm64/kasan-offsets.sh
> new file mode 100644
> index 000000000000..2b7a021db363
> --- /dev/null
> +++ b/Documentation/arm64/kasan-offsets.sh
> @@ -0,0 +1,27 @@
> +#!/bin/sh
> +
> +# Print out the KASAN_SHADOW_OFFSETS required to place the KASAN SHADOW
> +# start address at the mid-point of the kernel VA space
> +
> +print_kasan_offset () {
> +	printf "%02d\t" $1
> +	printf "0x%08x00000000\n" $(( (0xffffffff & (-1 << ($1 - 1 - 32))) \
> +			+ (1 << ($1 - 32 - $2)) \
> +			- (1 << (64 - 32 - $2)) ))
> +}
> +
> +echo KASAN_SHADOW_SCALE_SHIFT = 3
> +printf "VABITS\tKASAN_SHADOW_OFFSET\n"
> +print_kasan_offset 48 3
> +print_kasan_offset 47 3
> +print_kasan_offset 42 3
> +print_kasan_offset 39 3
> +print_kasan_offset 36 3
> +echo
> +echo KASAN_SHADOW_SCALE_SHIFT = 4
> +printf "VABITS\tKASAN_SHADOW_OFFSET\n"
> +print_kasan_offset 48 4
> +print_kasan_offset 47 4
> +print_kasan_offset 42 4
> +print_kasan_offset 39 4
> +print_kasan_offset 36 4

Even better if this generated the Kconfig entry directly ;). Anyway,
it's fine as it is.


> diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c
> index 05edfe9b02e4..9e68e3d12956 100644
> --- a/arch/arm64/mm/kasan_init.c
> +++ b/arch/arm64/mm/kasan_init.c
> @@ -154,8 +154,6 @@ static void __init kasan_pgd_populate(unsigned long addr, unsigned long end,
>  /* The early shadow maps everything to a single page of zeroes */
>  asmlinkage void __init kasan_early_init(void)
>  {
> -	BUILD_BUG_ON(KASAN_SHADOW_OFFSET !=
> -		KASAN_SHADOW_END - (1UL << (64 - KASAN_SHADOW_SCALE_SHIFT)));

Can we not still keep a BUILD_BUG_ON() for KASAN_SHADOW_OFFSET around,
even if it does the same calculation as the script?

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-08-05 16:37 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-29 16:21 [PATCH V4 00/11] 52-bit kernel + user VAs Steve Capper
2019-07-29 16:21 ` [PATCH V4 01/11] arm64: mm: Remove bit-masking optimisations for PAGE_OFFSET and VMEMMAP_START Steve Capper
2019-08-05 11:07   ` Catalin Marinas
2019-07-29 16:21 ` [PATCH V4 02/11] arm64: mm: Flip kernel VA space Steve Capper
2019-08-05 11:29   ` Catalin Marinas
2019-08-05 11:50     ` Steve Capper
2019-07-29 16:21 ` [PATCH V4 03/11] arm64: kasan: Switch to using KASAN_SHADOW_OFFSET Steve Capper
2019-08-05 16:37   ` Catalin Marinas [this message]
2019-08-06  9:05     ` Steve Capper
2019-07-29 16:21 ` [PATCH V4 04/11] arm64: dump: De-constify VA_START and KASAN_SHADOW_START Steve Capper
2019-08-05 16:38   ` Catalin Marinas
2019-07-29 16:21 ` [PATCH V4 05/11] arm64: mm: Introduce VA_BITS_MIN Steve Capper
2019-08-05 17:17   ` Catalin Marinas
2019-08-05 17:20   ` Catalin Marinas
2019-08-06  9:11     ` Steve Capper
2019-07-29 16:21 ` [PATCH V4 06/11] arm64: mm: Introduce VA_BITS_ACTUAL Steve Capper
2019-08-05 17:26   ` Catalin Marinas
2019-08-06 11:32     ` Steve Capper
2019-08-06 14:48       ` Catalin Marinas
2019-08-07 13:27         ` Steve Capper
2019-07-29 16:21 ` [PATCH V4 07/11] arm64: mm: Logic to make offset_ttbr1 conditional Steve Capper
2019-08-05 17:06   ` Catalin Marinas
2019-07-29 16:21 ` [PATCH V4 08/11] arm64: mm: Separate out vmemmap Steve Capper
2019-08-05 17:07   ` Catalin Marinas
2019-07-29 16:21 ` [PATCH V4 09/11] arm64: mm: Modify calculation of VMEMMAP_SIZE Steve Capper
2019-08-05 17:10   ` Catalin Marinas
2019-07-29 16:21 ` [PATCH V4 10/11] arm64: mm: Introduce 52-bit Kernel VAs Steve Capper
2019-08-05 17:27   ` Catalin Marinas
2019-08-06 14:55   ` Catalin Marinas
2019-08-06 14:58     ` Catalin Marinas
2019-07-29 16:21 ` [PATCH V4 11/11] docs: arm64: Add layout and 52-bit info to memory document Steve Capper
2019-08-06 15:27   ` Catalin Marinas
2019-08-07 13:29     ` Steve Capper
2019-08-07 14:55       ` Will Deacon
2019-08-07 15:57         ` Steve Capper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190805163720.GF4175@arrakis.emea.arm.com \
    --to=catalin.marinas@arm$(echo .)com \
    --cc=ard.biesheuvel@linaro$(echo .)org \
    --cc=bhsharma@redhat$(echo .)com \
    --cc=crecklin@redhat$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=maz@kernel$(echo .)org \
    --cc=steve.capper@arm$(echo .)com \
    --cc=will@kernel$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox