Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jul 2025 02:01:53 -0700
From:      Kevin Bowling <kevin.bowling@kev009.com>
To:        Kristof Provost <kp@freebsd.org>
Cc:        Konstantin Belousov <kib@freebsd.org>, 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:  <CAK7dMtCk34QGtAxdYG-o9UsSE_oZ86yp21Y0cnFbheJ430Aq5A@mail.gmail.com>
In-Reply-To: <E4607358-5091-4AEE-9042-4330867B0AD7@FreeBSD.org>
References:  <202507142203.56EM3lOw070595@gitrepo.freebsd.org> <E4607358-5091-4AEE-9042-4330867B0AD7@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jul 15, 2025 at 1:52=E2=80=AFAM Kristof Provost <kp@freebsd.org> wr=
ote:
>
> 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
> > ---
> ..
> > 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:

Looks correct per Kib's comment on a similar issue here
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D288236

>
>         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, siz=
e_t redzsize, 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?CAK7dMtCk34QGtAxdYG-o9UsSE_oZ86yp21Y0cnFbheJ430Aq5A>