From owner-freebsd-hackers@FreeBSD.ORG Sun Apr 28 01:41:00 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 37708386; Sun, 28 Apr 2013 01:41:00 +0000 (UTC) (envelope-from kpaasial@gmail.com) Received: from mail-wi0-x236.google.com (mail-wi0-x236.google.com [IPv6:2a00:1450:400c:c05::236]) by mx1.freebsd.org (Postfix) with ESMTP id 9FA981259; Sun, 28 Apr 2013 01:40:59 +0000 (UTC) Received: by mail-wi0-f182.google.com with SMTP id m6so1743815wiv.9 for ; Sat, 27 Apr 2013 18:40:58 -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=fj53/O0c1KnB+ra+pDbOc561VZ8YAmhS+QqVCigA9GY=; b=jwjXjHWMmHcu7pFjmqRWDE10J4exWCAgB95utSAYLdm9AY4BpNPR4snseUIF8AjEDh ExgT84S9cbv/j08SVZyFtzE7C4uB4Q3DI4RNEYCHNd8QRVeTNn15t9aMbOc5uXttiYLS qQMOC4hJ5MtksfVgWcXWX3d1r1C/677YiQUt20+L/qzAgO5NRgJNbbATHZC9lkpWwXjK +I4STzU1p/80aof/q8ijmQ/FBCkzEj7whsPlIZp8hZhHD9CoFGwM6Fie8W08XKSzhzvz 8wmeH4miRl6CfDlJEDGZfns692S9ztnmhh0WYbrG/58x8h49ZC4Qy/kr0Jgx5YzS8eP8 37rg== MIME-Version: 1.0 X-Received: by 10.194.59.106 with SMTP id y10mr7631658wjq.28.1367113258776; Sat, 27 Apr 2013 18:40:58 -0700 (PDT) Received: by 10.216.139.72 with HTTP; Sat, 27 Apr 2013 18:40:58 -0700 (PDT) In-Reply-To: References: <20130427190514.GA85673@FreeBSD.org> Date: Sun, 28 Apr 2013 04:40:58 +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: Sun, 28 Apr 2013 01:41:00 -0000 On Sat, Apr 27, 2013 at 11:53 PM, Kimmo Paasiala wrote: > 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 dmesg(8) output of the system: http://pastebin.com/hqjsak2n -Kimmo