From owner-freebsd-hackers@FreeBSD.ORG Sat Apr 27 20:53:37 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B60BD683; Sat, 27 Apr 2013 20:53:37 +0000 (UTC) (envelope-from kpaasial@gmail.com) Received: from mail-we0-x22f.google.com (mail-we0-x22f.google.com [IPv6:2a00:1450:400c:c03::22f]) by mx1.freebsd.org (Postfix) with ESMTP id 2CD6A19F5; Sat, 27 Apr 2013 20:53:37 +0000 (UTC) Received: by mail-we0-f175.google.com with SMTP id i48so1338037wef.6 for ; Sat, 27 Apr 2013 13:53:36 -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=VKx3HDwhFn1fyxrk4VDBbvP0/fDVdcDtZ5tY7ud6VXM=; b=AYEwF52WpV3UMja683qV7zTyMxPCJiNSxlKQ9VVKkQVcqHiGeuAxECMF/+URJODQ4G h+I+rFl2VsSiLYyb0wCOW1mfxcQFxna2eeWuy37ropHBjNjKWQCMD7dVBMWMsNKBs7T7 HC+Q7LS3+O6K/RQ/3cHxWdLUoKlWRulv4U+D2bB7zEAGQXE+NfwFS2jOd3mrR29VEPX9 9ea3Bup6x/kgb8rJ3xyKoWD1b++vuAyIwu2ujCKo6QIGvRqr54ZwnPRrhad9rO+fZK2H A73CuImbkXFWP9qgMzsTj0z1MvBFU9/spAcl0e9fVkqd6YJB8ZmlbVwgIa1CaoucQvqP aFiw== MIME-Version: 1.0 X-Received: by 10.194.236.169 with SMTP id uv9mr7690667wjc.42.1367096016232; Sat, 27 Apr 2013 13:53:36 -0700 (PDT) Received: by 10.216.139.72 with HTTP; Sat, 27 Apr 2013 13:53:36 -0700 (PDT) In-Reply-To: References: <20130427190514.GA85673@FreeBSD.org> Date: Sat, 27 Apr 2013 23:53:36 +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:53:37 -0000 On Sat, Apr 27, 2013 at 11:42 PM, Kimmo Paasiala wrote: > 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 The kernel file: https://www.dropbox.com/s/07mjk6j4ditbl9r/kernel -Kimmo