Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jul 2025 10:52:35 +0200
From:      Kristof Provost <kp@FreeBSD.org>
To:        Konstantin Belousov <kib@FreeBSD.org>
Cc:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   Re: git: 4dd828c80828 - main - amd64: add kva_layout
Message-ID:  <E4607358-5091-4AEE-9042-4330867B0AD7@FreeBSD.org>
In-Reply-To: <202507142203.56EM3lOw070595@gitrepo.freebsd.org>
References:  <202507142203.56EM3lOw070595@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 15 Jul 2025, at 0:03, Konstantin Belousov wrote:
> The branch main has been updated by kib:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=3D4dd828c80828637452a8a4e0=
7a64e294c82e5d8b
>
> commit 4dd828c80828637452a8a4e07a64e294c82e5d8b
> Author:     Konstantin Belousov <kib@FreeBSD.org>
> AuthorDate: 2025-06-15 21:39:10 +0000
> Commit:     Konstantin Belousov <kib@FreeBSD.org>
> CommitDate: 2025-07-14 22:03:28 +0000
>
>     amd64: add kva_layout
>
>     Reviewed by:    markj
>     Tested by:      pho
>     Sponsored by:   The FreeBSD Foundation
>     Differential revision:  https://reviews.freebsd.org/D51085
> ---
=2E.
> diff --git a/sys/amd64/include/vmparam.h b/sys/amd64/include/vmparam.h
> index 0cd9bb4fa7a4..f12e5217a44b 100644
> --- a/sys/amd64/include/vmparam.h
> +++ b/sys/amd64/include/vmparam.h
> @@ -181,12 +181,9 @@
>   * 0xffffffff80000000                        KERNBASE
>   */
>
> -#define	VM_MIN_KERNEL_ADDRESS	KV4ADDR(KPML4BASE, 0, 0, 0)
> -#define	VM_MAX_KERNEL_ADDRESS	KV4ADDR(KPML4BASE + NKPML4E - 1, \
> -					NPDPEPG-1, NPDEPG-1, NPTEPG-1)
> -
> -#define	DMAP_MIN_ADDRESS	KV4ADDR(DMPML4I, 0, 0, 0)
> -#define	DMAP_MAX_ADDRESS	KV4ADDR(DMPML4I + NDMPML4E, 0, 0, 0)
> +#define	VM_MIN_KERNEL_ADDRESS_LA48	KV4ADDR(KPML4BASE, 0, 0, 0)
> +#define	VM_MIN_KERNEL_ADDRESS		kva_layout.km_low
> +#define	VM_MAX_KERNEL_ADDRESS		kva_layout.km_high

The removal of DMAP_MIN_ADDRESS breaks the KASAN build.

This seems to fix it for me, but I=E2=80=99m not familiar enough with thi=
s code to be confident to commit it:

	diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c
	index 0edb631d1475..31204bad8c30 100644
	--- a/sys/kern/subr_asan.c
	+++ b/sys/kern/subr_asan.c
	@@ -263,8 +263,8 @@ kasan_mark(const void *addr, size_t size, size_t red=
zsize, uint8_t code)
	        if (__predict_false(!kasan_enabled))
	                return;

	-       if ((vm_offset_t)addr >=3D DMAP_MIN_ADDRESS &&
	-           (vm_offset_t)addr < DMAP_MAX_ADDRESS)
	+       if ((vm_offset_t)addr >=3D kva_layout.dmap_low &&
	+           (vm_offset_t)addr < kva_layout.dmap_high)
	                return;

	        KASSERT((vm_offset_t)addr >=3D VM_MIN_KERNEL_ADDRESS &&

=E2=80=94
Kristof



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E4607358-5091-4AEE-9042-4330867B0AD7>