From nobody Sun Jun 12 17:48:24 2022 X-Original-To: bugs@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 6AC78832BC3 for ; Sun, 12 Jun 2022 17:48:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LLhy11ttZz4n82 for ; Sun, 12 Jun 2022 17:48:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDB4525C1E for ; Sun, 12 Jun 2022 17:48:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 25CHmOkS098093 for ; Sun, 12 Jun 2022 17:48:24 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 25CHmOnB098092 for bugs@FreeBSD.org; Sun, 12 Jun 2022 17:48:24 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 258932] panic: vm_page_free_prep: freeing mapped page Date: Sun, 12 Jun 2022 17:48:24 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: markj@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: markj@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: assigned_to Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655056105; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rpslU9+IeEy9mpQ6QcSdejZ1jMlNJcEFtSXfJBGqa2I=; b=WpIRkgZAAQE7sVc5/552ihihjVq++VzQkigLE5bLbmkwTnj06wXIpVCMrk7IZdYopcnTL2 Sd8yIWiAFDQFsAD0P5cyH04N9g9pkXOYFLTUXOMCwv8HV7YYtqRRby9qAHgCFRHGIh5Mva B4bN1YAziHLU/HHjlploKAn14Ce3XCUMCN6JZekjxtykG++NKi7QSYhrAWEjLrZ7zn2ZTg tZcH+JtfKaL3X4nytCy+xnVP/zYjY4fRZuId8f2tLGHZ170yNpoWtjuNji7NIxRza/HWL/ fJCUGnMFHMoS9JuwW4/+fxT2T15RSbiWJn8WOvETWMAmC63ZdPGCEy7yqYW5wQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655056105; a=rsa-sha256; cv=none; b=jXKuYN4jIQwMwyEtiYmDMrlJlSIKbUYv33I3TpMWWMRNi50Qy0dIIJIfdKGcg9yF5F5DYD E32CxDjoQkeWA0hHUqiwnu8d7I6FejivW7lQubcbY+7eWp9gmSYEAcaDE85uNcAAWypv1i jwjS21qwyct/2G46WK93qfmbZX0UhCl1v3Rge7ZP2d03USLNSxt9A57TLmmg5/3O7Z8Qc4 u+zjHEogkvWzFyH3x9QG3mLR0/lb0ryMukcSTVesvun7dsyf7i7YtUL9BW0rfkTJYbtAUX /Cngzj9u73HtXJwUwO2NIrNhXLudsOdfjyoTLgA4oYnMpafUWWdSUh1tj9DTlA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D258932 Mark Johnston changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|bugs@FreeBSD.org |markj@FreeBSD.org --- Comment #16 from Mark Johnston --- After staring at a vmcore from bdrewery for a long time, I think I see the = bug. It's a race which seems very hard to hit accidentally. When the kernel crashed, we were removing and freeing pages from a VM objec= t in preparation for execve(). The OBJ_ONEMAPPING flag is set on the object, wh= ich means only the current process has mapped the object, which why it's (suppo= sed to be) safe to free the object's pages. The problem is that there are in f= act two mappings of the object: the other is in the parent tmux process, a COW mapping. So OBJ_ONEMAPPING should absolutely not be set! When vmspace_fork() copies vm map entries from the parent into the child, i= t's supposed to clear OBJ_ONEMAPPING. For anonymous mappings, this happens in vmspace_fork() -> vm_map_copy_entry() -> vm_map_copy_swap_object() vm_map_copy_entry() uses the following test to determine whether it's deali= ng with a swap object: if (src_object->type =3D=3D OBJT_DEFAULT || (src_object->flags & OBJ_SWAP= ) !=3D 0) This test is done racily, i.e., without the object lock, which isn't quite a problem in itself, but with commit 4b8365d752ef4 it can produce false negatives. In particular, the first time a page in the object gets paged o= ut, swap_pager_put_pages() converts the object to a OBJT_SWAP object: object->type =3D OBJT_SWAP; vm_object_set_flag(object, OBJ_SWAP); So there's a small window where object->type =3D=3D OBJT_SWAP and OBJ_SWAP = is clear. --=20 You are receiving this mail because: You are the assignee for the bug.=