aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/modpost.c
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@in.ibm.com>2007-01-10 19:52:44 -0500
committerAndi Kleen <andi@basil.nowhere.org>2007-01-10 19:52:44 -0500
commitee6a8545a4cbc620625c7956c95aac513842156b (patch)
treef8209ae7a289e593917beb8fb4b5dda00e6f5656 /scripts/mod/modpost.c
parent118c0ace1b61433311ae4e067fdd32841baa7f91 (diff)
[PATCH] x86-64: Modpost whitelist reference to more symbols (pattern 3)
o MODPOST generates warning on i386 if kernel is compiled with CONFIG_RELOCATABLE=y. WARNING: vmlinux - Section mismatch: reference to .init.text:__init_begin from .text between 'free_initmem' (at offset 0xc0114fd3) and 'do_test_wp_bit' WARNING: vmlinux - Section mismatch: reference to .init.text:_sinittext from .text between 'core_kernel_text' (at offset 0xc012aeae) and 'kernel_text_address' WARNING: vmlinux - Section mismatch: reference to .init.text:_einittext from .text between 'core_kernel_text' (at offset 0xc012aeb7) and 'kernel_text_address' WARNING: vmlinux - Section mismatch: reference to .init.text:_sinittext from .text between 'get_symbol_pos' (at offset 0xc0135776) and 'reset_iter' WARNING: vmlinux - Section mismatch: reference to .init.text:_einittext from .text between 'get_symbol_pos' (at offset 0xc013577d) and 'reset_iter' o These symbols (__init_begin, _sinittext, _einittext) belong to init section and generally represent a section boundary. These are special symbols in the sense that their size is zero and no memory is allocated for them in init section. Their addr and value are same. So even if we free the init section, it is ok to reference them. o Whitelist access to such select symbols in MODPOST. Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com> Signed-off-by: Andi Kleen <ak@suse.de> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org>
Diffstat (limited to 'scripts/mod/modpost.c')
-rw-r--r--scripts/mod/modpost.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 82e019bf2dc5..2aa47623f5f8 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -582,9 +582,19 @@ static int strrcmp(const char *s, const char *sub)
582 * tosec = .init.text | .exit.text | .init.data 582 * tosec = .init.text | .exit.text | .init.data
583 * fromsec = .data 583 * fromsec = .data
584 * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one 584 * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one
585 *
586 * Pattern 3:
587 * Some symbols belong to init section but still it is ok to reference
588 * these from non-init sections as these symbols don't have any memory
589 * allocated for them and symbol address and value are same. So even
590 * if init section is freed, its ok to reference those symbols.
591 * For ex. symbols marking the init section boundaries.
592 * This pattern is identified by
593 * refsymname = __init_begin, _sinittext, _einittext
585 **/ 594 **/
586static int secref_whitelist(const char *modname, const char *tosec, 595static int secref_whitelist(const char *modname, const char *tosec,
587 const char *fromsec, const char *atsym) 596 const char *fromsec, const char *atsym,
597 const char *refsymname)
588{ 598{
589 int f1 = 1, f2 = 1; 599 int f1 = 1, f2 = 1;
590 const char **s; 600 const char **s;
@@ -599,6 +609,13 @@ static int secref_whitelist(const char *modname, const char *tosec,
599 NULL 609 NULL
600 }; 610 };
601 611
612 const char *pat3refsym[] = {
613 "__init_begin",
614 "_sinittext",
615 "_einittext",
616 NULL
617 };
618
602 /* Check for pattern 1 */ 619 /* Check for pattern 1 */
603 if (strcmp(tosec, ".init.data") != 0) 620 if (strcmp(tosec, ".init.data") != 0)
604 f1 = 0; 621 f1 = 0;
@@ -629,6 +646,11 @@ static int secref_whitelist(const char *modname, const char *tosec,
629 if ((strcmp(fromsec, ".pci_fixup") == 0) && 646 if ((strcmp(fromsec, ".pci_fixup") == 0) &&
630 (strcmp(tosec, ".init.text") == 0)) 647 (strcmp(tosec, ".init.text") == 0))
631 return 1; 648 return 1;
649
650 /* Check for pattern 3 */
651 for (s = pat3refsym; *s; s++)
652 if (strcmp(refsymname, *s) == 0)
653 return 1;
632 } 654 }
633 return 0; 655 return 0;
634} 656}
@@ -738,7 +760,7 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
738 /* check whitelist - we may ignore it */ 760 /* check whitelist - we may ignore it */
739 if (before && 761 if (before &&
740 secref_whitelist(modname, secname, fromsec, 762 secref_whitelist(modname, secname, fromsec,
741 elf->strtab + before->st_name)) 763 elf->strtab + before->st_name, refsymname))
742 return; 764 return;
743 765
744 if (before && after) { 766 if (before && after) {