From 7f1446052fd7ff1006f9a98a76f8b1010e4e413e Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sun, 5 May 2019 11:06:19 +0000 Subject: [PATCH] Do not collapse objects with OBJ_NOSPLIT backing swap object. NOSPLIT swap objects are not anonymous, they are used by tmpfs regular files and POSIX shared memory. For such objects, collapse is not permitted. Reported by: mjg Reviewed by: markj, trasz Tested by: mjg, pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D19923 --- sys/vm/vm_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index c50a673f825..49212f2ae90 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -1748,7 +1748,8 @@ vm_object_collapse(vm_object_t object) VM_OBJECT_WLOCK(backing_object); if (backing_object->handle != NULL || (backing_object->type != OBJT_DEFAULT && - backing_object->type != OBJT_SWAP) || + (backing_object->type != OBJT_SWAP || + (backing_object->flags & OBJ_NOSPLIT) != 0)) || (backing_object->flags & OBJ_DEAD) || object->handle != NULL || (object->type != OBJT_DEFAULT &&