Wed Jan 3 21:11:41 2018 UTC ()
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


(snj)
diff -r1.50 -r1.50.2.1 src/sys/kern/subr_kobj.c

cvs diff -r1.50 -r1.50.2.1 src/sys/kern/subr_kobj.c (expand / switch to unified diff)

--- src/sys/kern/subr_kobj.c 2014/07/16 13:26:33 1.50
+++ src/sys/kern/subr_kobj.c 2018/01/03 21:11:40 1.50.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: subr_kobj.c,v 1.50 2014/07/16 13:26:33 maxv Exp $ */ 1/* $NetBSD: subr_kobj.c,v 1.50.2.1 2018/01/03 21:11:40 snj Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software developed for The NetBSD Foundation 7 * This code is derived from software developed for The NetBSD Foundation
8 * by Andrew Doran. 8 * by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -53,27 +53,27 @@ @@ -53,27 +53,27 @@
53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 * SUCH DAMAGE. 56 * SUCH DAMAGE.
57 */ 57 */
58 58
59/* 59/*
60 * Kernel loader for ELF objects. 60 * Kernel loader for ELF objects.
61 * 61 *
62 * TODO: adjust kmem_alloc() calls to avoid needless fragmentation. 62 * TODO: adjust kmem_alloc() calls to avoid needless fragmentation.
63 */ 63 */
64 64
65#include <sys/cdefs.h> 65#include <sys/cdefs.h>
66__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.50 2014/07/16 13:26:33 maxv Exp $"); 66__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.50.2.1 2018/01/03 21:11:40 snj Exp $");
67 67
68#include "opt_modular.h" 68#include "opt_modular.h"
69 69
70#include <sys/kobj_impl.h> 70#include <sys/kobj_impl.h>
71 71
72#ifdef MODULAR 72#ifdef MODULAR
73 73
74#include <sys/param.h> 74#include <sys/param.h>
75#include <sys/kernel.h> 75#include <sys/kernel.h>
76#include <sys/kmem.h> 76#include <sys/kmem.h>
77#include <sys/proc.h> 77#include <sys/proc.h>
78#include <sys/ksyms.h> 78#include <sys/ksyms.h>
79#include <sys/module.h> 79#include <sys/module.h>
@@ -894,27 +894,27 @@ kobj_checksyms(kobj_t ko, bool undefined @@ -894,27 +894,27 @@ kobj_checksyms(kobj_t ko, bool undefined
894 /* Check (and complain) about differing values. */ 894 /* Check (and complain) about differing values. */
895 if (sym->st_value == rval) { 895 if (sym->st_value == rval) {
896 continue; 896 continue;
897 } 897 }
898 if (strcmp(name, "_bss_start") == 0 || 898 if (strcmp(name, "_bss_start") == 0 ||
899 strcmp(name, "__bss_start") == 0 || 899 strcmp(name, "__bss_start") == 0 ||
900 strcmp(name, "_bss_end__") == 0 || 900 strcmp(name, "_bss_end__") == 0 ||
901 strcmp(name, "__bss_end__") == 0 || 901 strcmp(name, "__bss_end__") == 0 ||
902 strcmp(name, "_edata") == 0 || 902 strcmp(name, "_edata") == 0 ||
903 strcmp(name, "_end") == 0 || 903 strcmp(name, "_end") == 0 ||
904 strcmp(name, "__end") == 0 || 904 strcmp(name, "__end") == 0 ||
905 strcmp(name, "__end__") == 0 || 905 strcmp(name, "__end__") == 0 ||
906 strncmp(name, "__start_link_set_", 17) == 0 || 906 strncmp(name, "__start_link_set_", 17) == 0 ||
907 strncmp(name, "__stop_link_set_", 16)) { 907 strncmp(name, "__stop_link_set_", 16) == 0) {
908 continue; 908 continue;
909 } 909 }
910 kobj_error(ko, "global symbol `%s' redefined", 910 kobj_error(ko, "global symbol `%s' redefined",
911 name); 911 name);
912 error = ENOEXEC; 912 error = ENOEXEC;
913 } 913 }
914 914
915 return error; 915 return error;
916} 916}
917 917
918/* 918/*
919 * kobj_relocate: 919 * kobj_relocate:
920 * 920 *