NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/57622: memfd mmap does not work for requests < page size
The following reply was made to PR kern/57622; it has been noted by GNATS.
From: Robert Bagdan <kikadf.01%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: kern/57622: memfd mmap does not work for requests < page size
Date: Sun, 22 Feb 2026 15:17:52 +0100
I encountered the same mmap() EINVAL error with Wayland cursor loading
on NetBSD 11.0_BETA/amd64.
In this case the requested size is 2304 (derived from the cursor size:
24 =C3=97 24 =C3=97 4).
The sequence is:
1) fd =3D memfd_create("wayland-cursor", MFD_CLOEXEC | MFD_ALLOW_SEALING
| MFD_NOEXEC_SEAL)
2) ftruncate(fd, size)
3) mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, pool->fd, 0)
The mmap() call memfd_mmap(), where:
KASSERT(*offp =3D=3D round_page(*offp));
KASSERT(size =3D=3D round_page(size));
and the following check then fails:
if (*offp + size > mfd->mfd_size) {
error =3D EINVAL;
goto leave;
}
where mfd_size is still 2304, while size is already rounded up to 4096.
--=20
Regards,
kikadf
Home |
Main Index |
Thread Index |
Old Index