From owner-freebsd-bugs@FreeBSD.ORG Thu Jan 21 16:40:07 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93A5D106568F for ; Thu, 21 Jan 2010 16:40:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 538928FC1A for ; Thu, 21 Jan 2010 16:40:07 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id o0LGe7M8080956 for ; Thu, 21 Jan 2010 16:40:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id o0LGe7dg080955; Thu, 21 Jan 2010 16:40:07 GMT (envelope-from gnats) Resent-Date: Thu, 21 Jan 2010 16:40:07 GMT Resent-Message-Id: <201001211640.o0LGe7dg080955@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Nikos Vassiliadis Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87E8A106566C for ; Thu, 21 Jan 2010 16:37:13 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 5DDF48FC1E for ; Thu, 21 Jan 2010 16:37:13 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o0LGbC5x033413 for ; Thu, 21 Jan 2010 16:37:12 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o0LGbCNU033412; Thu, 21 Jan 2010 16:37:12 GMT (envelope-from nobody) Message-Id: <201001211637.o0LGbCNU033412@www.freebsd.org> Date: Thu, 21 Jan 2010 16:37:12 GMT From: Nikos Vassiliadis To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/143058: [patch] make mdconfig -o reserve default for malloc-backed memory disks X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2010 16:40:07 -0000 >Number: 143058 >Category: misc >Synopsis: [patch] make mdconfig -o reserve default for malloc-backed memory disks >Confidential: no >Severity: critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jan 21 16:40:06 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Nikos Vassiliadis >Release: 9.0-CURRENT >Organization: >Environment: FreeBSD lab.localdomain 9.0-CURRENT FreeBSD 9.0-CURRENT #1: Fri Jan 8 12:01:55 EET 2010 root@lab.localdomain:/usr/obj/usr/src/sys/LAB i386 >Description: Creating and filling a big malloc-backed memory disk is a way to panic the system. This could be easily avoided if the reseve option became the default for malloc disks. >How-To-Repeat: mdconfig -at malloc -s 200m dd if=/dev/zero of=/dev/md0 >Fix: The attached patch adds reserve to the defaults for malloc disks Patch attached with submission follows: Index: src/sbin/mdconfig/mdconfig.8 =================================================================== RCS file: /home/ncvs/src/sbin/mdconfig/mdconfig.8,v retrieving revision 1.44 diff -u -r1.44 mdconfig.8 --- src/sbin/mdconfig/mdconfig.8 10 Jan 2009 17:17:18 -0000 1.44 +++ src/sbin/mdconfig/mdconfig.8 21 Jan 2010 16:12:10 -0000 @@ -91,8 +91,8 @@ .Xr malloc 9 . This limits the size to the malloc bucket limit in the kernel. If the -.Fl o Cm reserve -option is not set, creating and filling a large +.Fl o Cm noreserve +option is set, creating and filling a large malloc-backed memory disk is a very easy way to panic a system. .It Cm vnode Index: src/sbin/mdconfig/mdconfig.c =================================================================== RCS file: /home/ncvs/src/sbin/mdconfig/mdconfig.c,v retrieving revision 1.57 diff -u -r1.57 mdconfig.c --- src/sbin/mdconfig/mdconfig.c 10 Jan 2009 17:17:18 -0000 1.57 +++ src/sbin/mdconfig/mdconfig.c 21 Jan 2010 16:12:10 -0000 @@ -115,7 +115,7 @@ usage(); if (!strcmp(optarg, "malloc")) { mdio.md_type = MD_MALLOC; - mdio.md_options = MD_AUTOUNIT | MD_COMPRESS; + mdio.md_options = MD_AUTOUNIT | MD_COMPRESS | MD_RESERVE; } else if (!strcmp(optarg, "preload")) { mdio.md_type = MD_PRELOAD; mdio.md_options = 0; >Release-Note: >Audit-Trail: >Unformatted: