From owner-freebsd-arch@FreeBSD.ORG Thu May 19 23:52:36 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B1AC616A4CE for ; Thu, 19 May 2005 23:52:36 +0000 (GMT) Received: from pd4mo3so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1E6CC43D67 for ; Thu, 19 May 2005 23:52:36 +0000 (GMT) (envelope-from cperciva@freebsd.org) Received: from pd2mr7so.prod.shaw.ca (pd2mr7so-qfe3.prod.shaw.ca [10.0.141.10])2004))freebsd-arch@freebsd.org; Thu, 19 May 2005 17:52:35 -0600 (MDT) Received: from pn2ml3so.prod.shaw.ca ([10.0.121.147]) by pd2mr7so.prod.shaw.ca (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) with ESMTP id <0IGR007ZSGZN2ME0@pd2mr7so.prod.shaw.ca> for freebsd-arch@freebsd.org; Thu, 19 May 2005 17:52:35 -0600 (MDT) Received: from [192.168.0.60] (S0106006067227a4a.vc.shawcable.net [24.87.209.6]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0IGR00I16GZNHD@l-daemon> for freebsd-arch@freebsd.org; Thu, 19 May 2005 17:52:35 -0600 (MDT) Date: Thu, 19 May 2005 16:52:33 -0700 From: Colin Percival To: freebsd-arch@freebsd.org Message-id: <428D26C1.2020201@freebsd.org> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en X-Enigmail-Version: 0.91.0.0 User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050406) Subject: RFC: Using fixed-length strings for version[] and osrelease[] X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 May 2005 23:52:36 -0000 In vers.c (created by src/sys/conf/newvers.sh), the strings version[] and osrelease[] are not declared with a fixed length. As a result, as the kernel moves from x.y-RELEASE to x.y-RELEASE-p1, and later to x.y-RELEASE-p10, the length of these strings will change; this causes cascading differences in addresses throughout the kernel binary. This is not a major problem for most people, but it causes difficulty for FreeBSD Update. Such cascading differences in addresses cause FreeBSD Update to recognize the kernel as having changed, at which point it decided that the new kernel needs to be distributed to everybody -- or rather, it would do this but for the fact that my FreeBSD Update build code replaces the traditional "x.y-RELEASE-p15" name with "x.y-SECURITY". As this is the last remaining place where the files built and distributed by FreeBSD Update differ from the standard src tree, I'd like to remove the need for this local patch. At BSDCan last week, Jacques Vidrine pointed out that this could be done simply by declaring these two strings as having fixed length -- i.e., by zero-padding them. Would anyone object to the following patch being applied? --- newvers.sh 15 Jan 2005 13:25:41 -0000 1.68 +++ newvers.sh 19 May 2005 23:48:21 -0000 @@ -87,9 +87,9 @@ cat << EOF > vers.c $COPYRIGHT char sccspad[32 - 4 /* sizeof(sccs) */] = { '\\0' }; char sccs[4] = { '@', '(', '#', ')' }; -char version[] = "${VERSION} #${v}: ${t}\\n ${u}@${h}:${d}\\n"; +char version[512] = "${VERSION} #${v}: ${t}\\n ${u}@${h}:${d}\\n"; char ostype[] = "${TYPE}"; -char osrelease[] = "${RELEASE}"; +char osrelease[64] = "${RELEASE}"; int osreldate = ${RELDATE}; char kern_ident[] = "${i}"; EOF The lengths 512 and 64 are chosen as being considerably more than double the likely lengths of these strings; on my system, these two strings are 12 bytes and 134 bytes long respectively. Colin Percival