From owner-freebsd-hackers@FreeBSD.ORG Sat Apr 27 19:06:02 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BFFDCFA4 for ; Sat, 27 Apr 2013 19:06:02 +0000 (UTC) (envelope-from wkoszek@freebsd.czest.pl) Received: from freebsd.czest.pl (freebsd.czest.pl [212.87.224.105]) by mx1.freebsd.org (Postfix) with ESMTP id 3F7B515FE for ; Sat, 27 Apr 2013 19:06:02 +0000 (UTC) Received: from freebsd.czest.pl (freebsd.czest.pl [212.87.224.105]) by freebsd.czest.pl (8.14.5/8.14.5) with ESMTP id r3RJ5FBl085935; Sat, 27 Apr 2013 19:05:15 GMT (envelope-from wkoszek@freebsd.czest.pl) Received: (from wkoszek@localhost) by freebsd.czest.pl (8.14.5/8.14.5/Submit) id r3RJ5Fp3085934; Sat, 27 Apr 2013 19:05:15 GMT (envelope-from wkoszek) Date: Sat, 27 Apr 2013 19:05:15 +0000 From: "Wojciech A. Koszek" To: Kimmo Paasiala Subject: Re: config(8) -x headscratcher Message-ID: <20130427190514.GA85673@FreeBSD.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-0.4 required=5.0 tests=RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on freebsd.czest.pl X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (freebsd.czest.pl [212.87.224.105]); Sat, 27 Apr 2013 19:05:19 +0000 (UTC) Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Apr 2013 19:06:02 -0000 On Sat, Apr 27, 2013 at 06:54:11PM +0300, Kimmo Paasiala wrote: > I'm getting a core dump on 'config -x /boot/kernel/kernel' on 9.1-RELEASE i386. > > Assertion failed: (r != '\0' && ("Char present in the configuration " > "string mustn't be equal to 0")), function kernconfdump, file > /usr/src/usr.sbin/config/main.c, line 710. > > I have double checked that my config file is sane and does not have > any funny characters anywhere. > > The system is i386 9.1-RELEASE r249856. The world and kernel are built > with clang and I'm suspecting that the use of clang has something to > do with this segfault. > > Looking at the kernel files I can see one very obvious difference. > This is the 'elfdump -c kernel | grep -A 8 kern_conf' output (what > config -x seems to use for finding out the config file from the kernel > image) for the GENERIC kernel from the stock installation: > > sh_name: kern_conf > sh_type: SHT_PROGBITS > sh_flags: SHF_ALLOC > sh_addr: 0xc1039f80 > sh_offset: 12820352 > sh_size: 3771 > sh_link: 0 > sh_info: 0 > sh_addralign: 32 > > And this is from the kernel I have built myself using clang and a > custom config file: > > sh_name: kern_conf > sh_type: SHT_PROGBITS > sh_flags: SHF_ALLOC > sh_addr: 0xc09aee9c > sh_offset: 5959324 > sh_size: 1994 > sh_link: 0 > sh_info: 0 > sh_addralign: 1 > > The align field looks suspicious, config -x seems to use it to check > for padding but to me it looks like the logic may not work if the > alignment is 1. > > This the relevant bit from main.c of config(8) > Kimmo, Lets keep discussion on hackers@ only. I do agree with you that config(8) internal implementation might have its issues. Can you make your kernel configuration file, faulty kernel image and exact build instructions available to me? -- Wojciech A. Koszek wkoszek@FreeBSD.czest.pl http://FreeBSD.czest.pl/~wkoszek/