From owner-freebsd-current@FreeBSD.ORG Sat Apr 27 15:54:13 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A43C2CEF; Sat, 27 Apr 2013 15:54:13 +0000 (UTC) (envelope-from kpaasial@gmail.com) Received: from mail-wg0-x22f.google.com (mail-wg0-x22f.google.com [IPv6:2a00:1450:400c:c00::22f]) by mx1.freebsd.org (Postfix) with ESMTP id E80551EE4; Sat, 27 Apr 2013 15:54:12 +0000 (UTC) Received: by mail-wg0-f47.google.com with SMTP id j13so2671751wgh.2 for ; Sat, 27 Apr 2013 08:54:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=q3kuv3cKSM65IsCNMRJAQjKlvarEuu7jY9eF9FH3xJg=; b=kmfDXuIaH+bpX2/2Op7m3P5cguMOhvZl6divzRlYgnDhIr/ju5pNgsiVAi0UCfpAbg k6zjPmcsHoNXxp8zhKmc9BJ8l00o3ukgenxGKUnzbcILI/+YghEF8GsefXlmp8ugCfFb aqhtbJif6aewIqBJKEJSm18KvBUsu9/ia4VjzMmD57vn99nllP/W1bvDY3xXbcpM28ZO zHX9kAsTu4cWH982iRuTJbBgCw21UbgIUhhD1hOO486QY+8ahMN1aylPzudlgG0BVM7o bVqIhzIkwhRH5aXXAijDqvhidgtcbeCbM2/licfvmnI1CcZQ+buGt5qIYF+8sGR79wE3 ROTQ== MIME-Version: 1.0 X-Received: by 10.194.236.169 with SMTP id uv9mr6843526wjc.42.1367078052040; Sat, 27 Apr 2013 08:54:12 -0700 (PDT) Received: by 10.216.139.72 with HTTP; Sat, 27 Apr 2013 08:54:11 -0700 (PDT) Date: Sat, 27 Apr 2013 18:54:11 +0300 Message-ID: Subject: config(8) -x headscratcher From: Kimmo Paasiala To: freebsd-hackers@freebsd.org, freebsd-stable@freebsd.org, FreeBSD current Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Apr 2013 15:54:13 -0000 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) if (r == '\0' && (size - i) < align) break; assert(r != '\0' && ("Char present in the configuration " "string mustn't be equal to 0")); fputc(r, stdout); -Kimmo