From nobody Thu Apr 30 21:20:50 2026 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 4g66Xf6hC1z6cHbJ for ; Thu, 30 Apr 2026 21:20:50 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g66Xf69hqz3bcC for ; Thu, 30 Apr 2026 21:20:50 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777584050; 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; bh=MKrbA4F42k/eltjgbPyiouPF+xE11WCElGwyT36WaaY=; b=pTLHCLmzwwsDfUzgJz+mMOS33+3+9E9RH7vn3I+7bFdEx/8vkYwU68H4mzIJEsxuu5G+jN DzBi9RL8yK2oRsU1iCQJvPftbYrg9qo3ukqIcyw5xy/Et/q6iLkEyECXfHM6rJP9EeApgv I7MYbY4BHNBID0Sr+EkJsbi66LXgAvzgmP/uTWs/GPJhGwiTfZ0ITkwgV3+jZMAa7+6UVY bqO5XpLjz57qFfgUWNK+cGbrWp555gSDzy6x0isdM+INxK0jC+gPuX9BxuHSfXex7yVLrq TwlX9d8/klwvAwCWNwLjXCvoLFQbmr9fU5t0LP2VjGXmM29DnZf9qORcRr7OZQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1777584050; a=rsa-sha256; cv=none; b=k28Q51DoyW8Y9nqOO/zdVqYNPTacMdGmZ5e0ap7EkiXOq17VigEIlR3y9TGo0RmmcsyTU1 wdXjnfOCoOZr65GZuPuIxuY2NWPQR15djovEqExJOyfMFoVF04XUJsCSeeX2QJ5spIiOb+ RvFHm+aKAilx33TIq+aA7htKgnldtmfmEestcbuhlwti8efkQ0y1vzwtHYE5b8xIm8UjGp t9DyMA/M1myrNC6Q9KChu9fHWyq/saBJ7odn7lfsDOMyRAhIqDieX1YLa/JbZP3mVOH6/j j8XC6/LWvnpSmQ3NycuH9NnLLAeGJHInBCLp5qu3ZW2iRrsnAz7qDtR0KCUq8w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777584050; 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; bh=MKrbA4F42k/eltjgbPyiouPF+xE11WCElGwyT36WaaY=; b=mnyJ32nL1ScnUStSYcNqOhxKBa4yQu/Kt/DTCwec4F6C7fmHW9uZVnsSCiNZtOKTagOiCe 6Zzqlq3XsM0S/4UkH6kBLun+wV9HzNa+cLWYsPKdcJkxp5tN2uoaD48w2L/B9xXC0j/syV 2iUdNBN2rqLR1zfh0lMXyRpbYTr5v5aXb4eQhkpvJxACWijoSFlyw/463n5ckCQzr+SzWW 1cGqyjeCgL6dEGGCoJtuuxEx17XnNO3bZTURkphreL1bunO0ZBezq5irW5F7eDcf/iPf+A sH3yYq4LMdzSr72cFNeTrNiU+jVkKv45A1YKYkkkerhLgZDl0AfCDnVBPCSVmw== 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 4g66Xf5ZJYzCq2 for ; Thu, 30 Apr 2026 21:20:50 +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 63ULKoU1039403 for ; Thu, 30 Apr 2026 21:20:50 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 63ULKodC039402 for bugs@FreeBSD.org; Thu, 30 Apr 2026 21:20:50 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 294912] Linuxulator: munmap is missing EINVAL for unaligned addresses Date: Thu, 30 Apr 2026 21:20:50 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: iwtcex@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" 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 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D294912 Bug ID: 294912 Summary: Linuxulator: munmap is missing EINVAL for unaligned addresses Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: iwtcex@gmail.com It might be acceptable for the native FreeBSD code to truncate the passed address to the nearest page boundary (I personally don't agree), but the actual Linux behavior is different and some Unity engine games inadvertently rely on it not to crash. https://store.steampowered.com/app/3605120/Trails is a good example. The reason is too stupid to be believed, but Mono apparently has a wrapper around mmap (mono_valloc_aligned) that is used to align addresses to the page boundaries. (Yes, the addresses from mmap. Yes, I'm aware they are already aligned. No, I have no idea what's wrong with those people.) To do that mono_valloc_aligned always mmaps one additional page, "aligns" the returned address and unmaps the excess memory. That kind of works for Mono because it doesn't seem to actually to invoke mono_valloc_aligned with sizes that are not divisible by 4096. The Unity game in question somehow does and by doing so unmaps the memory that it's actually using. See https://github.com/mono/mono/blob/0f53e9e151d92944cacab3e24ac359410c606df6/= mono/utils/mono-mmap.c#L767 --=20 You are receiving this mail because: You are the assignee for the bug.=