NetBSD Problem Report #45125

From www@NetBSD.org  Fri Jul  8 02:30:31 2011
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 4B85E63C40B
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  8 Jul 2011 02:30:31 +0000 (UTC)
Message-Id: <20110708023030.2D04463B8E2@www.NetBSD.org>
Date: Fri,  8 Jul 2011 02:30:30 +0000 (UTC)
From: mita@fixstars.com
Reply-To: mita@fixstars.com
To: gnats-bugs@NetBSD.org
Subject: Kernel object loader can't detect duplication of global symbol
X-Send-Pr-Version: www-1.0

>Number:         45125
>Category:       kern
>Synopsis:       Kernel object loader can't detect duplication of global symbol
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pgoyette
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 08 02:35:00 +0000 2011
>Closed-Date:    Mon Sep 05 07:41:42 +0000 2016
>Last-Modified:  Wed Jan 03 21:15:02 +0000 2018
>Originator:     Akinobu  Mita
>Release:        
>Organization:
Fixstars
>Environment:
>Description:
The kernel object loader checks duplication of global symbol with already loaded objects in sys/kern/subr_kobject.c:kobj_checksyms(). But the check doesn't work very well.
>How-To-Repeat:

>Fix:
Looks like the fix is trivial.  Also remove trailing \n in error
message because kobj_error() appends \n.

--- subr_kobj.c.orig	2011-07-08 10:55:12.000000000 +0900
+++ subr_kobj.c	2011-07-08 10:56:28.000000000 +0900
@@ -861,10 +861,10 @@ kobj_checksyms(kobj_t ko, bool undefined
 		    strcmp(name, "__end") == 0 ||
 		    strcmp(name, "__end__") == 0 ||
 		    strncmp(name, "__start_link_set_", 17) == 0 ||
-		    strncmp(name, "__stop_link_set_", 16)) {
+		    strncmp(name, "__stop_link_set_", 16) == 0) {
 		    	continue;
 		}
-		kobj_error("global symbol `%s' redefined\n", name);
+		kobj_error("global symbol `%s' redefined", name);
 		error = ENOEXEC;
 	}


>Release-Note:

>Audit-Trail:
From: "Paul Goyette" <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45125 CVS commit: src/sys/kern
Date: Tue, 31 May 2016 03:57:05 +0000

 Module Name:	src
 Committed By:	pgoyette
 Date:		Tue May 31 03:57:04 UTC 2016

 Modified Files:
 	src/sys/kern: subr_kobj.c

 Log Message:
 Compare names of duplicate symbols properly, so we correctly return
 an error status.

 Fixes PR kern/45125 with patch supplied by Akinobu  Mita


 To generate a diff of this commit:
 cvs rdiff -u -r1.51 -r1.52 src/sys/kern/subr_kobj.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: kern-bug-people->pgoyette
Responsible-Changed-By: pgoyette@NetBSD.org
Responsible-Changed-When: Tue, 31 May 2016 04:00:49 +0000
Responsible-Changed-Why:
I handled it.


State-Changed-From-To: open->closed
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Tue, 31 May 2016 04:00:49 +0000
State-Changed-Why:
Fix provided by submitter was integrated.


State-Changed-From-To: closed->open
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Mon, 06 Jun 2016 08:06:10 +0000
State-Changed-Why:
The fix for this PR has demonstrated that some modules (iic and bpf
for example) do indeed re-define kernel symbols.  so this bug has been
hiding a real problem.  Thus, once we resolve the known issues, we
should pull this up to NetBSD-7 and NetBSD-7-0.

I'll take care of the pull-up requests once the actual modules have
been fixed.


State-Changed-From-To: open->analyzed
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Mon, 06 Jun 2016 08:14:12 +0000
State-Changed-Why:
"analyzed" is more appropriate


From: "Paul Goyette" <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45125 CVS commit: src/sys
Date: Tue, 7 Jun 2016 01:06:28 +0000

 Module Name:	src
 Committed By:	pgoyette
 Date:		Tue Jun  7 01:06:28 UTC 2016

 Modified Files:
 	src/sys/dev/i2c: files.i2c i2c.c i2c_bitbang.c
 	src/sys/modules: Makefile
 	src/sys/modules/bpf: Makefile
 	src/sys/modules/iic: Makefile
 	src/sys/net: bpf.c bpf_filter.c
 Added Files:
 	src/sys/modules/bpf_filter: Makefile
 	src/sys/modules/i2c_bitbang: Makefile

 Log Message:
 Create separate modules for i2c_bitbang and bpf_filter so these files
 can be included in kernels which need them without also duplicating
 them in other modules.  Removes the duplicate symbols I found which
 prevented loading i2c and bpf modules after having fixed PR 45125.


 To generate a diff of this commit:
 cvs rdiff -u -r1.69 -r1.70 src/sys/dev/i2c/files.i2c
 cvs rdiff -u -r1.51 -r1.52 src/sys/dev/i2c/i2c.c
 cvs rdiff -u -r1.13 -r1.14 src/sys/dev/i2c/i2c_bitbang.c
 cvs rdiff -u -r1.165 -r1.166 src/sys/modules/Makefile
 cvs rdiff -u -r1.4 -r1.5 src/sys/modules/bpf/Makefile
 cvs rdiff -u -r0 -r1.1 src/sys/modules/bpf_filter/Makefile
 cvs rdiff -u -r0 -r1.1 src/sys/modules/i2c_bitbang/Makefile
 cvs rdiff -u -r1.3 -r1.4 src/sys/modules/iic/Makefile
 cvs rdiff -u -r1.195 -r1.196 src/sys/net/bpf.c
 cvs rdiff -u -r1.70 -r1.71 src/sys/net/bpf_filter.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: analyzed->pending-pullups
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Tue, 07 Jun 2016 01:22:34 +0000
State-Changed-Why:
Pullup-7 #1179 and #1180 have been filed.


State-Changed-From-To: pending-pullups->closed
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Mon, 05 Sep 2016 07:41:42 +0000
State-Changed-Why:
Patches for "collateral damage" do not apply cleanly.  Since this PR is
truly a low-priority non-critical bug, it is just cleaner to leave the
bug in the 7.x branch(es) and fix it going forward.  Pullup-7 #1179 and
#1180 were already deleted.


From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45125 CVS commit: [netbsd-7-0] src/sys/kern
Date: Wed, 3 Jan 2018 21:11:37 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Wed Jan  3 21:11:37 UTC 2018

 Modified Files:
 	src/sys/kern [netbsd-7-0]: subr_kobj.c

 Log Message:
 Pull up following revision(s) (requested by pgoyette in ticket #1539):
 	sys/kern/subr_kobj.c: revision 1.52
 Compare names of duplicate symbols properly, so we correctly return
 an error status.
 Fixes PR kern/45125 with patch supplied by Akinobu  Mita


 To generate a diff of this commit:
 cvs rdiff -u -r1.50 -r1.50.6.1 src/sys/kern/subr_kobj.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45125 CVS commit: [netbsd-7-1] src/sys/kern
Date: Wed, 3 Jan 2018 21:11:39 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Wed Jan  3 21:11:39 UTC 2018

 Modified Files:
 	src/sys/kern [netbsd-7-1]: subr_kobj.c

 Log Message:
 Pull up following revision(s) (requested by pgoyette in ticket #1539):
 	sys/kern/subr_kobj.c: revision 1.52
 Compare names of duplicate symbols properly, so we correctly return
 an error status.
 Fixes PR kern/45125 with patch supplied by Akinobu  Mita


 To generate a diff of this commit:
 cvs rdiff -u -r1.50 -r1.50.10.1 src/sys/kern/subr_kobj.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45125 CVS commit: [netbsd-7] src/sys/kern
Date: Wed, 3 Jan 2018 21:11:41 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Wed Jan  3 21:11:41 UTC 2018

 Modified Files:
 	src/sys/kern [netbsd-7]: subr_kobj.c

 Log Message:
 Pull up following revision(s) (requested by pgoyette in ticket #1539):
 	sys/kern/subr_kobj.c: revision 1.52
 Compare names of duplicate symbols properly, so we correctly return
 an error status.
 Fixes PR kern/45125 with patch supplied by Akinobu  Mita


 To generate a diff of this commit:
 cvs rdiff -u -r1.50 -r1.50.2.1 src/sys/kern/subr_kobj.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.