Re: mmap( MAP_ANON) is broken on current. (was Still seeing Failed assertion: "p[i] == 0" on armv7 buildworld) [debug.vm_check_pg_zero=1 silent]

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sat, 22 Nov 2025 20:48:32 UTC
Konstantin Belousov <kostikbel_at_gmail.com> wrote on
Date: Sat, 22 Nov 2025 20:19:33 UTC :

> On Sat, Nov 22, 2025 at 08:54:21PM +0100, Michal Meloun wrote:
> > 
> > 
> > On 22.11.2025 19:45, Konstantin Belousov wrote:
> > > On Sat, Nov 22, 2025 at 07:01:03PM +0100, Michal Meloun wrote:
> > > > > Would you please gather the same ddebugging info, with this patch applied?
> > > > Oups, sorry.
> > > > In meantime, next round with he vm_map patch finished successfully.
> > > 
> > > It was still the case of coalescing previous entry and the mapping.
> > > 
> > > It is weird, the patch ensures that there is no pages in the object
> > > backing the new region, and due to the ensured properties of the object,
> > > there should be no way to create pages under us.
> > > I am almost sure that the provided patch is correct, but it might be
> > > some additional cases that I miss.
> > > 
> > > Please apply the following debugging patch, it includes the vm_object'
> > > part. Instead of allowing the corruption in userspace, kernel should
> > > panic now. Can you confirm that?
> > > 
> > > diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
> > > . . .
> > 
> > Unfortunately, KASSERT doesn't assert on failure. Don't hit me, please. :)
> > 
> > . . .
> > ...
> Please in addition to the patch, enable debug.vm_check_pg_zero.


# sysctl debug.vm_check_pg_zero=1
debug.vm_check_pg_zero: 0 -> 1
# sysctl debug.vm_check_pg_zero
debug.vm_check_pg_zero: 1
# env WITH_META_MODE= make -j10 buildworld
--- buildworld ---
. . .
Building /usr/obj/usr/src/i386.i386/lib/clang/libclang/Sema/SemaCodeComplete.pico
Building /usr/obj/usr/src/i386.i386/lib/clang/libclang/Sema/SemaConcept.pico
Building /usr/obj/usr/src/i386.i386/lib/clang/libclang/Sema/SemaConsumer.pico
Building /usr/obj/usr/src/i386.i386/lib/clang/libclang/Sema/SemaCoroutine.pico
Building /usr/obj/usr/src/i386.i386/lib/clang/libclang/Sema/SemaDecl.pico
Building /usr/obj/usr/src/i386.i386/lib/clang/libclang/Sema/SemaDeclAttr.pico
Building /usr/obj/usr/src/i386.i386/lib/clang/libclang/Sema/SemaDeclCXX.pico
Building /usr/obj/usr/src/i386.i386/lib/clang/libclang/Sema/SemaDeclObjC.pico
Building /usr/obj/usr/src/i386.i386/lib/clang/libclang/Sema/SemaExceptionSpec.pico
Building /usr/obj/usr/src/i386.i386/lib/clang/libclang/Sema/SemaExpr.pico
Building /usr/obj/usr/src/i386.i386/lib/clang/libclang/Sema/SemaExprCXX.pico
Building /usr/obj/usr/src/i386.i386/lib/clang/libclang/Sema/SemaExprMember.pico
<jemalloc>: /usr/src/contrib/jemalloc/include/jemalloc/internal/ehooks.h:170: Failed assertion: "p[i] == 0"
Abort trap (core dumped)
*** [Sema/SemaCodeComplete.pico] Error code 134
. . .



===
Mark Millard
marklmi at yahoo.com