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: mlelstv%serpens.de@localhost (Michael van Elst)
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/57622: memfd mmap does not work for requests < page size
Date: Thu, 21 Sep 2023 05:37:57 -0000 (UTC)

 martin%NetBSD.org@localhost writes:
 
 >This makes the code sys/kern/sys_memfd.c line 352 fail:
 >        if (*offp + size > mfd->mfd_size) {
 >                error = EINVAL;
 >                goto leave;
 >        }
 >because mmap rounded up the requested size "size" to full pages already,
 
 >>Fix:
 >Adjust mfd_size to full pages and make sure the surplus bytes are zeroed?
 >Keep track of the number of pages separately from content size and make the
 >if test against the #pages?
 
 
 mfd_size must stay as is to keep the correct "file" size for
 read/write operations. The partial page must be zero filled when
 mapped and that part of the page must not be "written back" in
 case it gets modified.
 


Home | Main Index | Thread Index | Old Index