All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Rowand <frank.rowand@am.sony.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	"Rowand, Frank" <Frank_Rowand@sonyusa.com>,
	Alessio Igor Bogani <abogani@kernel.org>,
	Jan Beulich <jbeulich@novell.com>,
	Kbuild <linux-kbuild@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Bird, Tim" <Tim.Bird@am.sony.com>,
	Anders Kaseorg <andersk@ksplice.com>,
	Arnaud Lacombe <lacombar@gmail.com>, <sam@ravnborg.org>
Subject: Re: [PATCH] modpost: Fix modpost's license checking V3
Date: Mon, 9 Apr 2012 17:59:03 -0700	[thread overview]
Message-ID: <4F8385D7.3060701@am.sony.com> (raw)
In-Reply-To: <87hax8yqcz.fsf@rustcorp.com.au>

On 03/28/12 21:37, Rusty Russell wrote:
> On Mon, 26 Mar 2012 18:58:24 -0700, Frank Rowand <frank.rowand@am.sony.com> wrote:
>> The attached patch modifies your patch to also use export_from_secname()
>> for vmlinux and vmlinux.o.
> 
> OK, today is my last day online for six weeks, so Alessio, please come
> up with a fix and push straight to Linus once consensus is reached.
> 
> If that's impossible, I'll review when I get back.
> 
> Thanks,
> Rusty.

Linus,

Alessio asked me to send this directly to you.

-Frank


The commit f02e8a6 sorts symbols placing each of them in its own elf section.
The sorting and merging into the canonical sections are done by the linker.
Unfortunately modpost to generate Module.symvers file parses vmlinux.o (which
is not linked yet) and all modules object files (which aren't linked yet).
These aren't sanitized by the linker yet. That breaks modpost that can't
detect license properly for modules.

This patch makes modpost aware of the new exported symbols structure.

The above is a slightly corrected version of the explanation of the problem,
copied from commit 62a26356.  That commit fixed the problem for module object
files, but not for vmlinux.o.  This patch fixes modpost for vmlinux.o.

Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Signed-off-by: Alessio Igor Bogani <abogani@kernel.org>
---
 scripts/mod/modpost.c |    7 	5 +	2 -	0 !
 scripts/mod/modpost.h |    1 	1 +	0 -	0 !
 2 files changed, 6 insertions(+), 2 deletions(-)

Index: b/scripts/mod/modpost.c
===================================================================
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -132,8 +132,10 @@ static struct module *new_module(char *m
 	/* strip trailing .o */
 	s = strrchr(p, '.');
 	if (s != NULL)
-		if (strcmp(s, ".o") == 0)
+		if (strcmp(s, ".o") == 0) {
 			*s = '\0';
+			mod->is_dot_o = 1;
+		}
 
 	/* add to list */
 	mod->name = p;
@@ -587,7 +589,8 @@ static void handle_modversions(struct mo
 	unsigned int crc;
 	enum export export;
 
-	if (!is_vmlinux(mod->name) && strncmp(symname, "__ksymtab", 9) == 0)
+	if ((!is_vmlinux(mod->name) || mod->is_dot_o) &&
+	    strncmp(symname, "__ksymtab", 9) == 0)
 		export = export_from_secname(info, get_secindex(info, sym));
 	else
 		export = export_from_sec(info, get_secindex(info, sym));
Index: b/scripts/mod/modpost.h
===================================================================
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -113,6 +113,7 @@ struct module {
 	int has_cleanup;
 	struct buffer dev_table_buf;
 	char	     srcversion[25];
+	int is_dot_o;
 };
 
 struct elf_info {


WARNING: multiple messages have this Message-ID (diff)
From: Frank Rowand <frank.rowand@am.sony.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	"Rowand, Frank" <Frank_Rowand@sonyusa.com>,
	Alessio Igor Bogani <abogani@kernel.org>,
	Jan Beulich <jbeulich@novell.com>,
	Kbuild <linux-kbuild@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Bird, Tim" <Tim.Bird@am.sony.com>,
	Anders Kaseorg <andersk@ksplice.com>,
	Arnaud Lacombe <lacombar@gmail.com>,
	sam@ravnborg.org
Subject: Re: [PATCH] modpost: Fix modpost's license checking V3
Date: Mon, 9 Apr 2012 17:59:03 -0700	[thread overview]
Message-ID: <4F8385D7.3060701@am.sony.com> (raw)
In-Reply-To: <87hax8yqcz.fsf@rustcorp.com.au>

On 03/28/12 21:37, Rusty Russell wrote:
> On Mon, 26 Mar 2012 18:58:24 -0700, Frank Rowand <frank.rowand@am.sony.com> wrote:
>> The attached patch modifies your patch to also use export_from_secname()
>> for vmlinux and vmlinux.o.
> 
> OK, today is my last day online for six weeks, so Alessio, please come
> up with a fix and push straight to Linus once consensus is reached.
> 
> If that's impossible, I'll review when I get back.
> 
> Thanks,
> Rusty.

Linus,

Alessio asked me to send this directly to you.

-Frank


The commit f02e8a6 sorts symbols placing each of them in its own elf section.
The sorting and merging into the canonical sections are done by the linker.
Unfortunately modpost to generate Module.symvers file parses vmlinux.o (which
is not linked yet) and all modules object files (which aren't linked yet).
These aren't sanitized by the linker yet. That breaks modpost that can't
detect license properly for modules.

This patch makes modpost aware of the new exported symbols structure.

The above is a slightly corrected version of the explanation of the problem,
copied from commit 62a26356.  That commit fixed the problem for module object
files, but not for vmlinux.o.  This patch fixes modpost for vmlinux.o.

Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Signed-off-by: Alessio Igor Bogani <abogani@kernel.org>
---
 scripts/mod/modpost.c |    7 	5 +	2 -	0 !
 scripts/mod/modpost.h |    1 	1 +	0 -	0 !
 2 files changed, 6 insertions(+), 2 deletions(-)

Index: b/scripts/mod/modpost.c
===================================================================
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -132,8 +132,10 @@ static struct module *new_module(char *m
 	/* strip trailing .o */
 	s = strrchr(p, '.');
 	if (s != NULL)
-		if (strcmp(s, ".o") == 0)
+		if (strcmp(s, ".o") == 0) {
 			*s = '\0';
+			mod->is_dot_o = 1;
+		}
 
 	/* add to list */
 	mod->name = p;
@@ -587,7 +589,8 @@ static void handle_modversions(struct mo
 	unsigned int crc;
 	enum export export;
 
-	if (!is_vmlinux(mod->name) && strncmp(symname, "__ksymtab", 9) == 0)
+	if ((!is_vmlinux(mod->name) || mod->is_dot_o) &&
+	    strncmp(symname, "__ksymtab", 9) == 0)
 		export = export_from_secname(info, get_secindex(info, sym));
 	else
 		export = export_from_sec(info, get_secindex(info, sym));
Index: b/scripts/mod/modpost.h
===================================================================
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -113,6 +113,7 @@ struct module {
 	int has_cleanup;
 	struct buffer dev_table_buf;
 	char	     srcversion[25];
+	int is_dot_o;
 };
 
 struct elf_info {


  reply	other threads:[~2012-04-10  0:59 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-04 15:00 sorting of exports breaks modpost's GPL checking Jan Beulich
2011-07-05  9:36 ` Alessio Igor Bogani
2011-07-05  9:47   ` Jan Beulich
2011-07-07  1:03     ` Rusty Russell
2011-07-07  8:09       ` Jan Beulich
2011-07-07 12:17         ` Alessio Igor Bogani
2011-07-09 23:13           ` [PATCH] modpost: Fix modpost's license checking Alessio Igor Bogani
2011-07-10  6:08             ` Arnaud Lacombe
2011-07-12  7:00               ` [PATCH] modpost: Fix modpost's license checking V2 Alessio Igor Bogani
2011-07-12 18:02                 ` Anders Kaseorg
2011-07-12 18:15                   ` Arnaud Lacombe
2011-07-12 18:35                     ` Anders Kaseorg
2011-07-12 18:49                       ` Arnaud Lacombe
2011-07-14  6:51                         ` [PATCH] modpost: Fix modpost's license checking V3 Alessio Igor Bogani
2011-07-18 23:38                           ` Rusty Russell
2011-07-18 23:38                             ` Rusty Russell
2011-07-20 15:25                           ` Michal Marek
2011-07-21  6:46                             ` Rusty Russell
2012-03-24  2:04                           ` Frank Rowand
2012-03-24  2:25                             ` Frank Rowand
2012-03-24  2:25                               ` Frank Rowand
2012-03-27  1:58                             ` Frank Rowand
2012-03-27  1:58                               ` Frank Rowand
2012-03-27  7:19                               ` Alessio Igor Bogani
2012-03-27 22:59                                 ` Frank Rowand
2012-03-28  8:04                                   ` Alessio Igor Bogani
2012-03-29  4:37                               ` Rusty Russell
2012-03-29  4:37                                 ` Rusty Russell
2012-04-10  0:59                                 ` Frank Rowand [this message]
2012-04-10  0:59                                   ` Frank Rowand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F8385D7.3060701@am.sony.com \
    --to=frank.rowand@am.sony.com \
    --cc=Frank_Rowand@sonyusa.com \
    --cc=Tim.Bird@am.sony.com \
    --cc=abogani@kernel.org \
    --cc=andersk@ksplice.com \
    --cc=jbeulich@novell.com \
    --cc=lacombar@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=sam@ravnborg.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.