Date: Tue, 5 Nov 2013 06:18:50 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r257680 - head/sys/vm Message-ID: <201311050618.rA56IopR029475@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Tue Nov 5 06:18:50 2013 New Revision: 257680 URL: http://svnweb.freebsd.org/changeset/base/257680 Log: Do not coalesce if the swap object belongs to tmpfs vnode. The coalesce would extend the object to keep pages for the anonymous mapping created by the process. The pages has no relations to the tmpfs file content which could be written into the corresponding range, causing anonymous mapping and file content aliasing and subsequent corruption. Another lesser problem created by coalescing is over-accounting on the tmpfs node destruction, since the object size is substracted from the total count of the pages owned by the tmpfs mount. Reported and tested by: bdrewery Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Tue Nov 5 06:13:46 2013 (r257679) +++ head/sys/vm/vm_object.c Tue Nov 5 06:18:50 2013 (r257680) @@ -2099,8 +2099,9 @@ vm_object_coalesce(vm_object_t prev_obje if (prev_object == NULL) return (TRUE); VM_OBJECT_WLOCK(prev_object); - if (prev_object->type != OBJT_DEFAULT && - prev_object->type != OBJT_SWAP) { + if ((prev_object->type != OBJT_DEFAULT && + prev_object->type != OBJT_SWAP) || + (prev_object->flags & OBJ_TMPFS) != 0) { VM_OBJECT_WUNLOCK(prev_object); return (FALSE); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311050618.rA56IopR029475>