From owner-svn-src-user@FreeBSD.ORG Sun Jan 29 16:44:22 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3A29106566C; Sun, 29 Jan 2012 16:44:21 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C88CD8FC0A; Sun, 29 Jan 2012 16:44:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TGiLd5044229; Sun, 29 Jan 2012 16:44:21 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TGiLVw044226; Sun, 29 Jan 2012 16:44:21 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201201291644.q0TGiLVw044226@svn.freebsd.org> From: Attilio Rao Date: Sun, 29 Jan 2012 16:44:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230750 - user/attilio/vmcontention/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 16:44:22 -0000 Author: attilio Date: Sun Jan 29 16:44:21 2012 New Revision: 230750 URL: http://svn.freebsd.org/changeset/base/230750 Log: Fix a bug in vm_radix_leaf() where the shifting start address can wrap-up at some point. This bug is triggered very easilly by indirect blocks in UFS which grow negative resulting in very high counts. In collabouration with: flo Modified: user/attilio/vmcontention/sys/vm/vm_radix.c user/attilio/vmcontention/sys/vm/vm_radix.h Modified: user/attilio/vmcontention/sys/vm/vm_radix.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_radix.c Sun Jan 29 16:29:06 2012 (r230749) +++ user/attilio/vmcontention/sys/vm/vm_radix.c Sun Jan 29 16:44:21 2012 (r230750) @@ -458,6 +458,12 @@ restart: */ inc = 1LL << (level * VM_RADIX_WIDTH); start &= ~VM_RADIX_MAX(level); + + /* Avoid start address wrapping up. */ + if ((VM_RADIX_MAXVAL - start) < inc) { + rnode = NULL; + goto out; + } start += inc; slot++; CTR5(KTR_VM, @@ -473,6 +479,10 @@ restart: rnode = rnode->rn_child[slot]; break; } + if ((VM_RADIX_MAXVAL - start) < inc) { + rnode = NULL; + goto out; + } } if (slot == VM_RADIX_COUNT) goto restart; Modified: user/attilio/vmcontention/sys/vm/vm_radix.h ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_radix.h Sun Jan 29 16:29:06 2012 (r230749) +++ user/attilio/vmcontention/sys/vm/vm_radix.h Sun Jan 29 16:44:21 2012 (r230750) @@ -35,6 +35,7 @@ #define VM_RADIX_WIDTH 5 #define VM_RADIX_COUNT (1 << VM_RADIX_WIDTH) #define VM_RADIX_MASK (VM_RADIX_COUNT - 1) +#define VM_RADIX_MAXVAL ((vm_pindex_t)-1) #define VM_RADIX_LIMIT howmany((sizeof(vm_pindex_t) * NBBY), VM_RADIX_WIDTH) #define VM_RADIX_FLAGS 0x3 /* Flag bits stored in node pointers. */ #define VM_RADIX_BLACK 0x1 /* Black node. (leaf only) */ @@ -46,7 +47,7 @@ /* Calculates maximum value for a tree of height h. */ #define VM_RADIX_MAX(h) \ - ((h) == VM_RADIX_LIMIT ? ((vm_pindex_t)-1) : \ + ((h) == VM_RADIX_LIMIT ? VM_RADIX_MAXVAL : \ (((vm_pindex_t)1 << ((h) * VM_RADIX_WIDTH)) - 1)) /*