[RFC PATCH] crc generation fix for EXPORT_SYMBOL_GPL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently genksym does not take into account the GPLness of the exported
symbol while generating the crc for the exported symbol. Any symbol
changes from EXPORT_SYMBOL to EXPORT_SYMBOL_GPL would not reflect in the
Module.symvers file.  This patch fixes that problem.

With the patch one could find the changes in GPLness of the exported symbols
between two releases of the kernel by diffing their Module.symvers file.

Signed-off-by Ram Pai ([email protected])

 scripts/genksyms/genksyms.c      |    4 +++-
 scripts/genksyms/genksyms.h      |    2 +-
 scripts/genksyms/parse.c_shipped |    2 +-
 scripts/genksyms/parse.y         |    2 +-
 4 files changed, 6 insertions(+), 4 deletions(-)

Index: linux-2.6.15.2/scripts/genksyms/genksyms.c
===================================================================
--- linux-2.6.15.2.orig/scripts/genksyms/genksyms.c
+++ linux-2.6.15.2/scripts/genksyms/genksyms.c
@@ -426,11 +426,11 @@ expand_and_crc_list(struct string_list *
 
   return crc;
 }
 
 void
-export_symbol(const char *name)
+export_symbol(const char *name, const char *export_type)
 {
   struct symbol *sym;
 
   sym = find_symbol(name, SYM_NORMAL);
   if (!sym)
@@ -443,10 +443,12 @@ export_symbol(const char *name)
 	fprintf(debugfile, "Export %s == <", name);
 
       expansion_trail = (struct symbol *)-1L;
 
       crc = expand_and_crc_list(sym->defn, 0xffffffff) ^ 0xffffffff;
+      if (strncmp(export_type, "EXPORT_SYMBOL_GPL", 17) == 0)
+	crc = partial_crc32("__gpl__", crc);
 
       sym = expansion_trail;
       while (sym != (struct symbol *)-1L)
 	{
 	  struct symbol *n = sym->expansion_trail;
Index: linux-2.6.15.2/scripts/genksyms/genksyms.h
===================================================================
--- linux-2.6.15.2.orig/scripts/genksyms/genksyms.h
+++ linux-2.6.15.2/scripts/genksyms/genksyms.h
@@ -65,11 +65,11 @@ extern struct string_list *current_list,
 
 
 struct symbol *find_symbol(const char *name, enum symbol_type ns);
 struct symbol *add_symbol(const char *name, enum symbol_type type,
 			   struct string_list *defn, int is_extern);
-void export_symbol(const char *);
+void export_symbol(const char *, const char *);
 
 struct string_list *reset_list(void);
 void free_list(struct string_list *s, struct string_list *e);
 void free_node(struct string_list *list);
 struct string_list *copy_node(struct string_list *);
Index: linux-2.6.15.2/scripts/genksyms/parse.c_shipped
===================================================================
--- linux-2.6.15.2.orig/scripts/genksyms/parse.c_shipped
+++ linux-2.6.15.2/scripts/genksyms/parse.c_shipped
@@ -1341,11 +1341,11 @@ case 120:
 #line 453 "scripts/genksyms/parse.y"
 { yyval = NULL; ;
     break;}
 case 122:
 #line 459 "scripts/genksyms/parse.y"
-{ export_symbol((*yyvsp[-2])->string); yyval = yyvsp[0]; ;
+{ export_symbol((*yyvsp[-2])->string, (*yyvsp[-4])->string); yyval = yyvsp[0]; ;
     break;}
 }
    /* the action file gets copied in in place of this dollarsign */
 #line 543 "/usr/lib/bison.simple"
 
Index: linux-2.6.15.2/scripts/genksyms/parse.y
===================================================================
--- linux-2.6.15.2.orig/scripts/genksyms/parse.y
+++ linux-2.6.15.2/scripts/genksyms/parse.y
@@ -454,11 +454,11 @@ asm_phrase_opt:
 	| ASM_PHRASE
 	;
 
 export_definition:
 	EXPORT_SYMBOL_KEYW '(' IDENT ')' ';'
-		{ export_symbol((*$3)->string); $$ = $5; }
+		{ export_symbol((*$3)->string, (*$1)->string); $$ = $5; }
 	;
 
 
 %%
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux