From owner-freebsd-bugs@FreeBSD.ORG Sun Mar 2 01:20:01 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 845621065675 for ; Sun, 2 Mar 2008 01:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 583328FC2C for ; Sun, 2 Mar 2008 01:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m221K1uv040503 for ; Sun, 2 Mar 2008 01:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m221K12V040502; Sun, 2 Mar 2008 01:20:01 GMT (envelope-from gnats) Resent-Date: Sun, 2 Mar 2008 01:20:01 GMT Resent-Message-Id: <200803020120.m221K12V040502@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Edwin Groothuis Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B8D61065675 for ; Sun, 2 Mar 2008 01:13:02 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: from mail5out.barnet.com.au (mail5.barnet.com.au [202.83.178.78]) by mx1.freebsd.org (Postfix) with ESMTP id A88B08FC33 for ; Sun, 2 Mar 2008 01:13:01 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: by mail5out.barnet.com.au (Postfix, from userid 1001) id D90582218AC9; Sun, 2 Mar 2008 12:13:00 +1100 (EST) Received: from mail5auth.barnet.com.au (mail5.barnet.com.au [202.83.178.78]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mail5auth.barnet.com.au", Issuer "*.barnet.com.au" (verified OK)) by mail5.barnet.com.au (Postfix) with ESMTP id 551E321B2003 for ; Sun, 2 Mar 2008 12:13:00 +1100 (EST) Received: from k7.mavetju (k7.mavetju.org [10.251.1.18]) by mail5auth.barnet.com.au (Postfix) with ESMTP id ACFB72218ABE for ; Sun, 2 Mar 2008 12:12:59 +1100 (EST) Received: by k7.mavetju (Postfix, from userid 1001) id 74F6413B; Sun, 2 Mar 2008 12:12:59 +1100 (EST) Message-Id: <20080302011259.74F6413B@k7.mavetju> Date: Sun, 2 Mar 2008 12:12:59 +1100 (EST) From: Edwin Groothuis To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: kern/121276: [patch] let link_elf_error show the name of the module which couldn't be loaded. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Edwin Groothuis List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Mar 2008 01:20:01 -0000 >Number: 121276 >Category: kern >Synopsis: [patch] let link_elf_error show the name of the module which couldn't be loaded. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Mar 02 01:20:00 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Edwin Groothuis >Release: FreeBSD 6.3-RELEASE i386 >Organization: - >Environment: System: FreeBSD k7.mavetju 6.3-RELEASE FreeBSD 6.3-RELEASE #0: Sun Feb 17 22:11:52 EST 2008 edwin@k7.mavetju:/usr/src/sys/i386/compile/SMP i386 >Description: After the upgrade of 6.2 to 6.3 I get some warnings on my console: kldload: Unsupported file type kldload: Unsupported file type I couldn't figure out which file it was, so I changed link_elf_error() to display the filename: kldload: /boot/modules/test.ko: Unsupported file type kldload: /boot/modules/test1.ko: Unsupported file type >How-To-Repeat: >Fix: In src/sys/kern: --- link_elf.c.orig 2008-03-02 11:52:39.000000000 +1100 +++ link_elf.c 2008-03-02 11:53:42.000000000 +1100 @@ -213,9 +213,12 @@ extern struct _dynamic _DYNAMIC; static void -link_elf_error(const char *s) +link_elf_error(const char *filename, const char *s) { - printf("kldload: %s\n", s); + if (filename == NULL) + printf("kldload: %s\n", s); + else + printf("kldload: %s: %s\n", filename, s); } /* @@ -599,23 +602,23 @@ if (hdr->e_ident[EI_CLASS] != ELF_TARG_CLASS || hdr->e_ident[EI_DATA] != ELF_TARG_DATA) { - link_elf_error("Unsupported file layout"); + link_elf_error(filename, "Unsupported file layout"); error = ENOEXEC; goto out; } if (hdr->e_ident[EI_VERSION] != EV_CURRENT || hdr->e_version != EV_CURRENT) { - link_elf_error("Unsupported file version"); + link_elf_error(filename, "Unsupported file version"); error = ENOEXEC; goto out; } if (hdr->e_type != ET_EXEC && hdr->e_type != ET_DYN) { - link_elf_error("Unsupported file type"); + link_elf_error(filename, "Unsupported file type"); error = ENOEXEC; goto out; } if (hdr->e_machine != ELF_TARG_MACH) { - link_elf_error("Unsupported machine"); + link_elf_error(filename, "Unsupported machine"); error = ENOEXEC; goto out; } @@ -628,7 +631,7 @@ if (!((hdr->e_phentsize == sizeof(Elf_Phdr)) && (hdr->e_phoff + hdr->e_phnum*sizeof(Elf_Phdr) <= PAGE_SIZE) && (hdr->e_phoff + hdr->e_phnum*sizeof(Elf_Phdr) <= nbytes))) - link_elf_error("Unreadable program headers"); + link_elf_error(filename, "Unreadable program headers"); /* * Scan the program header entries, and save key information. @@ -646,7 +649,7 @@ case PT_LOAD: if (nsegs == MAXSEGS) { - link_elf_error("Too many sections"); + link_elf_error(filename, "Too many sections"); error = ENOEXEC; goto out; } @@ -666,7 +669,7 @@ break; case PT_INTERP: - link_elf_error("Unsupported file type"); + link_elf_error(filename, "Unsupported file type"); error = ENOEXEC; goto out; } @@ -674,12 +677,12 @@ ++phdr; } if (phdyn == NULL) { - link_elf_error("Object is not dynamically-linked"); + link_elf_error(filename, "Object is not dynamically-linked"); error = ENOEXEC; goto out; } if (nsegs == 0) { - link_elf_error("No sections"); + link_elf_error(filename, "No sections"); error = ENOEXEC; goto out; } --- link_elf_obj.c.orig 2008-03-02 12:06:16.000000000 +1100 +++ link_elf_obj.c 2008-03-02 12:07:16.000000000 +1100 @@ -151,9 +151,12 @@ static int relocate_file(elf_file_t ef); static void -link_elf_error(const char *s) +link_elf_error(const char *filename, const char *s) { - printf("kldload: %s\n", s); + if (filename == NULL) + printf("kldload: %s\n", s); + else + printf("kldload: %s: %s\n", filename, s); } static void @@ -437,23 +440,23 @@ if (hdr->e_ident[EI_CLASS] != ELF_TARG_CLASS || hdr->e_ident[EI_DATA] != ELF_TARG_DATA) { - link_elf_error("Unsupported file layout"); + link_elf_error(filename, "Unsupported file layout"); error = ENOEXEC; goto out; } if (hdr->e_ident[EI_VERSION] != EV_CURRENT || hdr->e_version != EV_CURRENT) { - link_elf_error("Unsupported file version"); + link_elf_error(filename, "Unsupported file version"); error = ENOEXEC; goto out; } if (hdr->e_type != ET_REL) { - link_elf_error("Unsupported file type"); + link_elf_error(filename, "Unsupported file type"); error = ENOEXEC; goto out; } if (hdr->e_machine != ELF_TARG_MACH) { - link_elf_error("Unsupported machine"); + link_elf_error(filename, "Unsupported machine"); error = ENOEXEC; goto out; } @@ -517,19 +520,19 @@ } } if (ef->nprogtab == 0) { - link_elf_error("file has no contents"); + link_elf_error(filename, "file has no contents"); error = ENOEXEC; goto out; } if (nsym != 1) { /* Only allow one symbol table for now */ - link_elf_error("file has no valid symbol table"); + link_elf_error(filename, "file has no valid symbol table"); error = ENOEXEC; goto out; } if (symstrindex < 0 || symstrindex > hdr->e_shnum || shdr[symstrindex].sh_type != SHT_STRTAB) { - link_elf_error("file has invalid symbol strings"); + link_elf_error(filename, "file has invalid symbol strings"); error = ENOEXEC; goto out; } >Release-Note: >Audit-Trail: >Unformatted: