Date: Wed, 17 Apr 2013 11:21:43 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Carl Shapiro <carl.shapiro@gmail.com> Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Re: MADV_FREE and wait4 EFAULT Message-ID: <20130417082143.GW2930@kib.kiev.ua> In-Reply-To: <CANVK_QgKRkpzWjA=H2u2HTp_vpxFhNLBGTVuFZmMEpBLTbzeaA@mail.gmail.com> References: <CANVK_QgKRkpzWjA=H2u2HTp_vpxFhNLBGTVuFZmMEpBLTbzeaA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--JZV+hE4cb0ibQYPB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 16, 2013 at 02:12:54PM -0700, Carl Shapiro wrote: > I am seeing wait4 system calls failing with an EFAULT and I am trying to > understand what might be going wrong. >=20 > An inspection of the wait4 implementation suggests the opportunity for > EFAULT is within its invocations of copyout. In my situation, the status > and rusage pointer arguments contain addresses to mmaped pages which have > been madvised as MADV_FREE. >=20 > Is it permissible to pass pages which have been madvised MADV_FREE to wai= t4 > or any other system call for that matter? Might there be another > opportunity for a wait4 to EFAULT? Did you ensured with e.g. ktrace and procstat -v that your assumptions hold, i.e. the addresses supplied as wait4(2) arguments are valid ? Please provide the minimal test case demonstrating the behaviour. MADV_FREE should only result in the possible lost of the previous content of the page, not in the faulting of the page access. From the inspection of the code, I do not see how MADV_FREE could result in the memory address becoming invalid. --JZV+hE4cb0ibQYPB Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJRbluXAAoJEJDCuSvBvK1BiCgP/jCSkpdxMFcz6C4FIu5Itihe 6fAlhZ/TyDuxnWvRLAIUI+JiJ3JyxRXgImlixzvMnk3GO9scVaknHooztaLmFtmr UkWceD9zfBNJEtYqEtrKLwKYej2uIj4GUr0Ohh48/jTiqO8t7g3dUMdSxzByXzBp kbP5UOmMBfARb6dFCKkTYW5aUd5Ma8Y9WQhiUdj2iFJBIi2QSi06GMPsAmigtiy+ d4rtAE2B+Ci3qS/R9WEd+AHFKvIvNvZ29S2eXHUIAD1bTaX/ulz2uWrX+p4SQC0M PfGUC+zPML5Btrv8fDfM7T6oompQ7PBjUGi8Dt7pG8fb8R0xMtgwDkNY1VeyJ9uG 468Zot/dcmhVuc9rzWOHRgjjf8rFaDeGIHgDrOo75XYwJHlO42Nzqo2xEWo4ZM2z Cied4/Ra9OvmdrgyXk6jNuPemIvjD+xfNvhAvLasYUQQe0YycBOuiybSGJFaRb60 kF2RPVRQfkzWem63JN30BnvBI5WKeFmmI3WTdjMbHm0lQwEKfF00Pv6bOTjSxvjv uHdD/U/hIKP2TzuXGcb2W35NDjr2QDzbwwrx1lkoS5EoN2PRbvXtdVLqwPqnZqlY gGr4zuEv5k9HhUiHqRL65BUJOpgtY6fk9J+eBxgrK36IMnUq/QEcHm7zEbV1wANl wTnLy1WvvRnyIw+senit =MPJi -----END PGP SIGNATURE----- --JZV+hE4cb0ibQYPB--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130417082143.GW2930>