linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] crc generation fix for EXPORT_SYMBOL_GPL
@ 2006-02-02  4:15 Ram Pai
  2006-02-04 20:31 ` Arjan van de Ven
  0 siblings, 1 reply; 6+ messages in thread
From: Ram Pai @ 2006-02-02  4:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: linuxram

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 (linuxram@us.ibm.com)

 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"
 \f
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; }
 	;
 
 
 %%
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH] crc generation fix for EXPORT_SYMBOL_GPL
  2006-02-02  4:15 [RFC PATCH] crc generation fix for EXPORT_SYMBOL_GPL Ram Pai
@ 2006-02-04 20:31 ` Arjan van de Ven
  2006-02-06  5:24   ` Ram Pai
  0 siblings, 1 reply; 6+ messages in thread
From: Arjan van de Ven @ 2006-02-04 20:31 UTC (permalink / raw)
  To: Ram Pai; +Cc: linux-kernel

On Wed, 2006-02-01 at 20:15 -0800, Ram Pai wrote:
> 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.

and this is a problem.. why?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH] crc generation fix for EXPORT_SYMBOL_GPL
  2006-02-04 20:31 ` Arjan van de Ven
@ 2006-02-06  5:24   ` Ram Pai
  2006-02-06 13:42     ` Arjan van de Ven
  2006-02-06 14:09     ` Arjan van de Ven
  0 siblings, 2 replies; 6+ messages in thread
From: Ram Pai @ 2006-02-06  5:24 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel

On Sat, 2006-02-04 at 21:31 +0100, Arjan van de Ven wrote:
> On Wed, 2006-02-01 at 20:15 -0800, Ram Pai wrote:
> > 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.
> 
> and this is a problem.. why?

Tools that depend on Module.symvers wont be able to detect the change in
GPLness of the exported symbols.

Eventually we want to generate a tool that can report API changes across
kernel releases and put it in some friendly(docbook) format.

Suggestions?
RP


> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH] crc generation fix for EXPORT_SYMBOL_GPL
  2006-02-06  5:24   ` Ram Pai
@ 2006-02-06 13:42     ` Arjan van de Ven
  2006-02-06 14:09     ` Arjan van de Ven
  1 sibling, 0 replies; 6+ messages in thread
From: Arjan van de Ven @ 2006-02-06 13:42 UTC (permalink / raw)
  To: Ram Pai; +Cc: linux-kernel

On Sun, 2006-02-05 at 21:24 -0800, Ram Pai wrote:
> On Sat, 2006-02-04 at 21:31 +0100, Arjan van de Ven wrote:
> > On Wed, 2006-02-01 at 20:15 -0800, Ram Pai wrote:
> > > 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.
> > 
> > and this is a problem.. why?
> 
> Tools that depend on Module.symvers wont be able to detect the change in
> GPLness of the exported symbols.

and that is relevant.. why?


> Eventually we want to generate a tool that can report API changes across
> kernel releases and put it in some friendly(docbook) format.

but a _GPL change isn't an API change though... either a module is legal
or it isn't. _GPL doesn't matter there...




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH] crc generation fix for EXPORT_SYMBOL_GPL
  2006-02-06  5:24   ` Ram Pai
  2006-02-06 13:42     ` Arjan van de Ven
@ 2006-02-06 14:09     ` Arjan van de Ven
  2006-02-07  6:49       ` Ram Pai
  1 sibling, 1 reply; 6+ messages in thread
From: Arjan van de Ven @ 2006-02-06 14:09 UTC (permalink / raw)
  To: Ram Pai; +Cc: linux-kernel


> Eventually we want to generate a tool that can report API changes across
> kernel releases and put it in some friendly(docbook) format.

the CRC's are only very lightly related to API though (or even ABI) so I
suspect this isn't too useful a thing to persue in the first place
(using CRC I mean, documenting real API changes I can see being useful)



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH] crc generation fix for EXPORT_SYMBOL_GPL
  2006-02-06 14:09     ` Arjan van de Ven
@ 2006-02-07  6:49       ` Ram Pai
  0 siblings, 0 replies; 6+ messages in thread
From: Ram Pai @ 2006-02-07  6:49 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel

On Mon, 2006-02-06 at 15:09 +0100, Arjan van de Ven wrote:
> > Eventually we want to generate a tool that can report API changes across
> > kernel releases and put it in some friendly(docbook) format.
> 
> the CRC's are only very lightly related to API though (or even ABI) so I
> suspect this isn't too useful a thing to persue in the first place

actually the CRC's capture a pretty good picture of the changes to API
as well as ABI. The crc is run on the prototype of the exported symbol,
recursively expanding each and every datastructure involved in the
prototype. 

Hence it mostly captures the ABI signature of the exported symbols.  The
only part it misses is, it does not capture the GPL'ness of the exported
symbol. And that was what I was trying to fix, because changing the
export nature of the symbol changes the ABI. With the fix one would
be able to exactly detect API/ABI changes to exported symbols. 

Do you think its a bad idea still? Its a good indication for out-of-tree
modules that the ABI/API of some exported symbols they depend on, has
changed.  


>(using CRC I mean, documenting real API changes I can see being useful)

Sure. Nice to learn that this work will be of value. Also
looking for ideas on what information would be useful to report and in
what format. 

Thanks,
RP


> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-02-07  6:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-02  4:15 [RFC PATCH] crc generation fix for EXPORT_SYMBOL_GPL Ram Pai
2006-02-04 20:31 ` Arjan van de Ven
2006-02-06  5:24   ` Ram Pai
2006-02-06 13:42     ` Arjan van de Ven
2006-02-06 14:09     ` Arjan van de Ven
2006-02-07  6:49       ` Ram Pai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).