All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Richard Henderson <rth@twiddle.net>
Cc: linux-kernel@vger.kernel.org, Nathan Poznick <kraken@drunkmonkey.org>
Subject: Re: [PATCH] Handle R_ALPHA_REFLONG relocation on Alpha (2.6.0-test11)
Date: Tue, 30 Dec 2003 14:57:36 +1100	[thread overview]
Message-ID: <20031230145736.4ce0ff59.rusty@rustcorp.com.au> (raw)
In-Reply-To: <20031218010203.GA13385@twiddle.net>

On Wed, 17 Dec 2003 17:02:03 -0800
Richard Henderson <rth@twiddle.net> wrote:

> On Wed, Dec 17, 2003 at 01:31:24PM -0600, Nathan Poznick wrote:
> > my next question is if this is a known/intended side effect -- enabling
> > CONFIG_DEBUG_INFO means that modules cannot be used?
> 
> No.  This means there's a bug in the generic bits of the module
> loaders, that they're not discarding debugging sections.

Ah, my bad.  We suck in the whole module, then copy SHF_ALLOC sections,
then apply relocations.  We don't skip relocations on sections which
haven't been copied.

This patch works for me: Nathan, does it solve your problem?
Rusty.
-- 
   there are those who do and those who hang on and you don't see too
   many doers quoting their contemporaries.  -- Larry McVoy

Name: Don't Apply Relocations To Sections We Haven't Copied
Author: Rusty Russell
Status: Tested on 2.6.0-bk1

D: The module code applies every relocation section given.  Obviously, if
D: the section has not been copied into the module, there's no point.
D: In particular, Alpha has relocs which are only used on debug sections,
D: so they don't load with CONFIG_DEBUG_INFO enabled.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .2481-linux-2.6.0-bk1/kernel/module.c .2481-linux-2.6.0-bk1.updated/kernel/module.c
--- .2481-linux-2.6.0-bk1/kernel/module.c	2003-11-24 15:42:33.000000000 +1100
+++ .2481-linux-2.6.0-bk1.updated/kernel/module.c	2003-12-30 14:08:40.000000000 +1100
@@ -1618,9 +1618,13 @@ static struct module *load_module(void _
 	/* Now do relocations. */
 	for (i = 1; i < hdr->e_shnum; i++) {
 		const char *strtab = (char *)sechdrs[strindex].sh_addr;
-		if (sechdrs[i].sh_type == SHT_REL)
-			err = apply_relocate(sechdrs, strtab, symindex, i,mod);
-		else if (sechdrs[i].sh_type == SHT_RELA)
+
+		/* Skip relocations on non-allocated (ie. debug) sections */
+		if (sechdrs[i].sh_type == SHT_REL
+		    && (sechdrs[sechdrs[i].sh_info].sh_flags & SHF_ALLOC))
+			err = apply_relocate(sechdrs, strtab, symindex,i, mod);
+		else if (sechdrs[i].sh_type == SHT_RELA
+			 && (sechdrs[sechdrs[i].sh_info].sh_flags & SHF_ALLOC))
 			err = apply_relocate_add(sechdrs, strtab, symindex, i,
 						 mod);
 		if (err < 0)

  parent reply	other threads:[~2003-12-30  4:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-13  0:38 [PATCH] Handle R_ALPHA_REFLONG relocation on Alpha (2.6.0-test11) Nathan Poznick
2003-12-13  2:27 ` Måns Rullgård
2003-12-13  4:09   ` Nathan Poznick
2003-12-17 12:10 ` Richard Henderson
2003-12-17 19:31   ` Nathan Poznick
2003-12-18  1:02     ` Richard Henderson
2003-12-22  1:08       ` Rusty Russell
2003-12-30  3:57       ` Rusty Russell [this message]
2003-12-30  6:14         ` Nathan Poznick

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=20031230145736.4ce0ff59.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=kraken@drunkmonkey.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rth@twiddle.net \
    /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.