From owner-freebsd-hackers@FreeBSD.ORG Sat Apr 27 20:42:20 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 1CD3E412; Sat, 27 Apr 2013 20:42:20 +0000 (UTC) (envelope-from kpaasial@gmail.com) Received: from mail-wi0-x233.google.com (mail-wi0-x233.google.com [IPv6:2a00:1450:400c:c05::233]) by mx1.freebsd.org (Postfix) with ESMTP id 87E7118B4; Sat, 27 Apr 2013 20:42:19 +0000 (UTC) Received: by mail-wi0-f179.google.com with SMTP id l13so1661234wie.12 for ; Sat, 27 Apr 2013 13:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=tZTdlDQ/uM7zHr4oV2M/gc2TEMffBgAEGLS8Ngh4mrg=; b=H+Tp9awk0Wv/OGhDUDw0BzF3uokmm+zcwp9YCaMEyLow3zf7tA0ebJc4QFo34wwLNT CeBLVq7XDL98jkcce5W7QaMrGvLkq4FWIwZvpkQC4vcBDqCzYTpwA439P/aUifvDVnyB PsEZ8I8Wg5QwJmng5e8OXnOSzz7nqsHmM3ox8HZXd1BKC6puKbSQR5i78Nnl+C1/mTM1 ZB97Kxoz9ce2QwkTjayRGfRV5UyNbhz/grk9lgpcuZrzADwUX0hCWSk3GKJVM2/v1ImS f5g7852EcY+HHK7IC5rJ5yYaLQrRZtCKXUbrWkoW5jFnBr16A3iXq7LRiMTO2v/BLclc Na4Q== MIME-Version: 1.0 X-Received: by 10.194.59.106 with SMTP id y10mr7040148wjq.28.1367095338770; Sat, 27 Apr 2013 13:42:18 -0700 (PDT) Received: by 10.216.139.72 with HTTP; Sat, 27 Apr 2013 13:42:18 -0700 (PDT) In-Reply-To: <20130427190514.GA85673@FreeBSD.org> References: <20130427190514.GA85673@FreeBSD.org> Date: Sat, 27 Apr 2013 23:42:18 +0300 Message-ID: Subject: Re: config(8) -x headscratcher From: Kimmo Paasiala To: "Wojciech A. Koszek" Content-Type: text/plain; charset=UTF-8 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 20:42:20 -0000 On Sat, Apr 27, 2013 at 10:05 PM, Wojciech A. Koszek wrote: > 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/ The kernel config file: http://pastebin.com/j0J9NPCi My /etc/make.conf: http://pastebin.com/HYudWCA9 And /etc/src.conf: http://pastebin.com/ZAKq6ABT I'll see how I can make the kernel image available. -Kimmo