linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: Michal Marek <mmarek@suse.cz>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-next@vger.kernel.org,
	PowerPC <linuxppc-dev@lists.ozlabs.org>,
	linux-kernel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
	linux-kbuild@vger.kernel.org
Subject: Re: linux-next: build warnings after merge of the kbuild tree
Date: Fri, 26 Aug 2016 13:58:03 +1000	[thread overview]
Message-ID: <20160826135803.0c5ffb42@roar.ozlabs.ibm.com> (raw)
In-Reply-To: <20160822204758.5b2cff63@roar.ozlabs.ibm.com>

On Mon, 22 Aug 2016 20:47:58 +1000
Nicholas Piggin <npiggin@gmail.com> wrote:

> On Fri, 19 Aug 2016 20:44:55 +1000
> Nicholas Piggin <npiggin@gmail.com> wrote:
> 
> > On Fri, 19 Aug 2016 10:37:00 +0200
> > Michal Marek <mmarek@suse.cz> wrote:
> >   
> > > On 2016-08-19 07:09, Stephen Rothwell wrote:    
> 
> [snip]
> 
> > > > 
> > > > I may be missing something, but genksyms generates the crc's off the
> > > > preprocessed C source code and we don't have any for the asm files ...      
> > > 
> > > Of course you are right. Which means that we are losing type information
> > > for these exports for CONFIG_MODVERSIONS purposes. I guess it's
> > > acceptable, since the asm functions are pretty basic and their
> > > signatures do not change.    
> > 
> > I don't completely agree. It would be nice to have the functionality
> > still there.
> > 
> > What happens if you just run cmd_modversions on the as rule? It relies on
> > !defined(__ASSEMBLY__), but we're feeding the result to genksyms, not as.
> > It would require the header be included in the .S file and be protected for
> > asm builds.  
> 
> 
> This seems like it *could* be made to work, but there's a few problems.
> 
> - .h files are not made for C consumption. Matter of manually adding the
> ifdef guards, which isn't terrible.
> 
> - .S files do not all include their .h where the C declaration is. Also
> will cause some churn but doable and maybe not completely unreasonable.
> 
> - genksyms parser barfs when it hits the assembly of the .S file. Best
> way to fix that seems just send the #include and EXPORT_SYMBOL lines
> from the .S to the preprocessor. That's a bit of a rabbit hole too, with
> some .S files being included, etc.
> 
> I'm not sure what to do here. If nobody cares and we lose CRCs for .S
> exports, then okay we can whitelist those relocs easily. If we don't want
> to lose the functionality, the above might work but it's a bit intrusive
> an is going to require another cycle of prep patches to go through arch
> code first.
> 
> Or suggestions for alternative approach?

Here is a quick patch that I think should catch missing CRCs in
architecture independent way. If we merge something like this, we
can whitelist the symbols in arch/powerpc so people get steered to
the right place.

Powerpc seems to be the only one really catching this, and it's
only as a side effect of a test run for CONFIG_RELOCATABLE kernels,
which means version failures probably slipped through other archs.

I'll clean it up, do some more testing, and submit it unless
anybody dislikes it or has a better way to do it.

Thanks,
Nick


diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 4b8ffd3..1efc454 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -609,6 +609,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
 {
 	unsigned int crc;
 	enum export export;
+	int is_crc = 0;
 
 	if ((!is_vmlinux(mod->name) || mod->is_dot_o) &&
 	    strncmp(symname, "__ksymtab", 9) == 0)
@@ -618,6 +619,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
 
 	/* CRC'd symbol */
 	if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
+		is_crc = 1;
 		crc = (unsigned int) sym->st_value;
 		sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
 				export);
@@ -663,6 +665,10 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
 		else
 			symname++;
 #endif
+		if (is_crc && !mod->is_dot_o) {
+			const char *e = is_vmlinux(mod->name) ?"":".ko";
+			warn("EXPORT symbol \"%s\" [%s%s] version generation failed, symbol will not be versioned.\n", symname + strlen(CRC_PFX), mod->name, e);
+		}
 		mod->unres = alloc_symbol(symname,
 					  ELF_ST_BIND(sym->st_info) == STB_WEAK,
 					  mod->unres);

  reply	other threads:[~2016-08-26  3:58 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-17  1:44 linux-next: build warnings after merge of the kbuild tree Stephen Rothwell
2016-08-17 12:59 ` Michal Marek
2016-08-18  1:09   ` Nicholas Piggin
2016-08-19  3:38     ` Stephen Rothwell
2016-08-19  5:09       ` Stephen Rothwell
2016-08-19  5:32         ` Nicholas Piggin
2016-08-19  8:37         ` Michal Marek
2016-08-19 10:44           ` Nicholas Piggin
2016-08-22 10:47             ` Nicholas Piggin
2016-08-26  3:58               ` Nicholas Piggin [this message]
2016-08-26  6:21                 ` Nicholas Mc Guire
  -- strict thread matches above, loose matches on Subject: below --
2022-06-01 23:28 Stephen Rothwell
2019-09-04  0:13 Stephen Rothwell
2019-09-04  1:00 ` Masahiro Yamada
2019-09-04  6:22   ` Masahiro Yamada
2019-09-04 12:33     ` Stephen Rothwell
2019-09-04 12:32   ` Stephen Rothwell
2018-05-30 22:40 Stephen Rothwell
2018-05-31  1:12 ` Masahiro Yamada
2018-05-31  1:26   ` Kees Cook
2018-05-31  3:53     ` Kees Cook
2018-06-01  1:56       ` Masahiro Yamada
2018-06-01  4:01         ` Kees Cook
2018-06-02 20:39           ` Arnd Bergmann
2018-06-04  8:39             ` Arnd Bergmann
2017-07-19  0:05 Stephen Rothwell
2016-06-09  2:22 Stephen Rothwell
2016-06-09  2:56 ` Kees Cook
2016-06-09  4:05   ` Stephen Rothwell
2016-06-09 10:57     ` Michal Marek
2016-06-09 17:37       ` Emese Revfy
2016-06-09 17:58         ` Kees Cook
2016-06-09 11:10     ` Michael Ellerman
2016-06-09 17:42 ` Emese Revfy

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=20160826135803.0c5ffb42@roar.ozlabs.ibm.com \
    --to=npiggin@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mmarek@suse.cz \
    --cc=sfr@canb.auug.org.au \
    --cc=viro@zeniv.linux.org.uk \
    /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 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).