From nobody Sat Nov 22 18:22:39 2025 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dDL6h5kpbz6HZRC for ; Sat, 22 Nov 2025 18:22:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4dDL6h2bDBz3lFS; Sat, 22 Nov 2025 18:22:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 5AMIMeE2017672; Sat, 22 Nov 2025 20:22:43 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 5AMIMeE2017672 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 5AMIMe3k017671; Sat, 22 Nov 2025 20:22:40 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 22 Nov 2025 20:22:39 +0200 From: Konstantin Belousov To: Mark Millard Cc: Michal Meloun , FreeBSD Current Subject: Re: mmap( MAP_ANON) is broken on current. (was Still seeing Failed assertion: "p[i] == 0" on armv7 buildworld) Message-ID: References: <7435C4D0-94AF-41FA-B9A0-2E5091F5A727.ref@yahoo.com> <7435C4D0-94AF-41FA-B9A0-2E5091F5A727@yahoo.com> List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7435C4D0-94AF-41FA-B9A0-2E5091F5A727@yahoo.com> X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4dDL6h2bDBz3lFS On Sat, Nov 22, 2025 at 09:37:15AM -0800, Mark Millard wrote: > Michal Meloun wrote on > Date: Sat, 22 Nov 2025 16:37:19 UTC : > > > On 22.11.2025 16:40, Konstantin Belousov wrote: > > > On Sat, Nov 22, 2025 at 03:31:24PM +0100, Michal Meloun wrote: > > >> This patch KASSERTs almost immediately when the system enters multi-user > > >> mode while processing mmap() syscall: > > >> > > >> panic: vm_object_coalesce: obj 0xc73ddb28 next_pindex 0x13 next_size 0x5 > > >> obj_size 0x176 > > > > > > Yes, the assert was mis-placed. Please try this variant. > > > > > > commit 2b1a1bcd2926bd89b8422c665b0aa411e29c883b > > > Author: Konstantin Belousov > > > Date: Sat Nov 22 16:02:50 2025 +0200 > > > > > > vm_object_coalesce(): fix logic to detect coalesce possibility, simplify > > > > > > diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c > > > index 5b4517d2bf0c..9bb4e54edd96 100644 > > > --- a/sys/vm/vm_object.c > > > +++ b/sys/vm/vm_object.c > > > @@ -2189,13 +2189,19 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset_t prev_offset, > > > next_size >>= PAGE_SHIFT; > > > next_pindex = OFF_TO_IDX(prev_offset) + prev_size; > > > > > > - if (prev_object->ref_count > 1 && > > > - prev_object->size != next_pindex && > > > + if (prev_object->ref_count > 1 || > > > + prev_object->size != next_pindex || > > > (prev_object->flags & OBJ_ONEMAPPING) == 0) { > > > VM_OBJECT_WUNLOCK(prev_object); > > > return (FALSE); > > > } > > > > > > + KASSERT(next_pindex + next_size > prev_object->size, > > > + ("vm_object_coalesce: " > > > + "obj %p next_pindex %#jx next_size %#jx obj_size %#jx", > > > + prev_object, (uintmax_t)next_pindex, (uintmax_t)next_size, > > > + (uintmax_t)prev_object->size)); > > > + > > > /* > > > * Account for the charge. > > > */ > > > @@ -2222,26 +2228,13 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset_t prev_offset, > > > * Remove any pages that may still be in the object from a previous > > > * deallocation. > > > */ > > > - if (next_pindex < prev_object->size) { > > > - vm_object_page_remove(prev_object, next_pindex, next_pindex + > > > - next_size, 0); > > > -#if 0 > > > - if (prev_object->cred != NULL) { > > > - KASSERT(prev_object->charge >= > > > - ptoa(prev_object->size - next_pindex), > > > - ("object %p overcharged 1 %jx %jx", prev_object, > > > - (uintmax_t)next_pindex, (uintmax_t)next_size)); > > > - prev_object->charge -= ptoa(prev_object->size - > > > - next_pindex); > > > - } > > > -#endif > > > - } > > > + vm_object_page_remove(prev_object, next_pindex, next_pindex + > > > + next_size, 0); > > > > > > /* > > > * Extend the object if necessary. > > > */ > > > - if (next_pindex + next_size > prev_object->size) > > > - prev_object->size = next_pindex + next_size; > > > + prev_object->size = next_pindex + next_size; > > > > > > VM_OBJECT_WUNLOCK(prev_object); > > > return (TRUE); > > > > Unfortunately, that didn't help. I will try the vm_map.c patch again > > for confirmation. > > On amd64 I could not complete a boot: the KASSERT failed for equality > instead of > : "next_pindex Oxf next_size 0x4 obj_size 0x19" > > QUOTE (from a prior message to the list): > No serial console so a summary from a picture > (expect typos): > > . . . > ue0: link state changed to UP > panic: vm_object_coalesce: obj Oxfffff800090a27c0 next_pindex Oxf next_size 0x4 obj_size 0x19 Remove this assertion from your source. The right fix is to move it later, but it does not matter for the testing.