From owner-freebsd-current@FreeBSD.ORG Sun Jan 29 20:35:00 2006 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 147CE16A420 for ; Sun, 29 Jan 2006 20:35:00 +0000 (GMT) (envelope-from julian@elischer.org) Received: from a50.ironport.com (a50.ironport.com [63.251.108.112]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0DC6A43D73 for ; Sun, 29 Jan 2006 20:34:54 +0000 (GMT) (envelope-from julian@elischer.org) Received: from unknown (HELO [192.168.2.6]) ([10.251.60.63]) by a50.ironport.com with ESMTP; 29 Jan 2006 12:34:53 -0800 Message-ID: <43DD26EE.50608@elischer.org> Date: Sun, 29 Jan 2006 12:34:54 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.11) Gecko/20050727 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Luigi Rizzo References: <20060129050435.A5945@xorpc.icir.org> In-Reply-To: <20060129050435.A5945@xorpc.icir.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: current@freebsd.org Subject: Re: for review: sys/dev/md/md.c patch X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2006 20:35:00 -0000 Luigi Rizzo wrote: >just discovered, trying to resurrect picobsd on -current, >that the compiler in 6.x/7.x has become smart and, at least >with the default compilation flags, will optimize out >the "end_mfs_root" string from the object. >As a consequence, any checks that the preloaded module >does not overflow the allocated space (looking at the >'MFS Filesystem had better STOP here' string in the patched >object) will fail. > >The attached patch fixes the issue. Any objection if i commit it ? > > seems fair to me. can't hurt anything unless MD_ROOT_SIZE is defined.. I LIKE PicoBSD.. and it woul dbe a shame if it was lost as a capacity. It's a pitty everythng has grown so much.. last I tried (on 5.x) you could JUST get a kenrel plus a shell and one small app. (in my case ssh). onto a floppy.. I hav eserious doubts about being able to do that now.. pitty.. I have an old laptop with no HD that was a good little VPN endpoint using the 5.x based picoBSD. > cheers > luigi > >Index: md.c >=================================================================== >RCS file: /prova/home/ncvs/src/sys/dev/md/md.c,v >retrieving revision 1.159 >diff -u -p -r1.159 md.c >--- md.c 31 Oct 2005 15:41:19 -0000 1.159 >+++ md.c 29 Jan 2006 12:57:22 -0000 >@@ -102,8 +102,13 @@ SYSCTL_INT(_debug, OID_AUTO, mddebug, CT > > #if defined(MD_ROOT) && defined(MD_ROOT_SIZE) > /* Image gets put here: */ >-static u_char mfs_root[MD_ROOT_SIZE*1024] = "MFS Filesystem goes here"; >-static u_char end_mfs_root[] __unused = "MFS Filesystem had better STOP here"; >+static struct { >+ u_char start[MD_ROOT_SIZE*1024]; >+ u_char end[128]; >+} mfs_root = { >+ .start = "MFS Filesystem goes here", >+ .end = "MFS Filesystem had better STOP here", >+}; > #endif > > static g_init_t g_md_init; >@@ -1139,7 +1144,7 @@ g_md_init(struct g_class *mp __unused) > g_topology_unlock(); > #ifdef MD_ROOT_SIZE > sx_xlock(&md_sx); >- md_preloaded(mfs_root, MD_ROOT_SIZE * 1024); >+ md_preloaded(mfs_root.start, MD_ROOT_SIZE * 1024); > sx_xunlock(&md_sx); > #endif > /* XXX: are preload_* static or do they need Giant ? */ >_______________________________________________ >freebsd-current@freebsd.org mailing list >http://lists.freebsd.org/mailman/listinfo/freebsd-current >To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" > >