linux-alpha.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Amerigo Wang <amwang@redhat.com>
Cc: linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org, jdike@addtoit.com, mingo@elte.hu,
	sparclinux@vger.kernel.org, linux-ia64@vger.kernel.org
Subject: Re: [Patch 4/4] module: trim exception table in module_free()
Date: Thu, 28 May 2009 16:25:23 +0930	[thread overview]
Message-ID: <200905281625.24974.rusty@rustcorp.com.au> (raw)
In-Reply-To: <4A1CEFC3.2010309@redhat.com>

On Wed, 27 May 2009 05:16:11 pm Amerigo Wang wrote:
> Rusty Russell wrote:
> > __ex_table ends up with two entries:
> >
> > Contents of section __ex_table:
> >  0000 0c000000 00000000 0e000000 00000000  ................
> >  0010 10000000 0a000000 12000000 0a000000  ................
> >
> > The first is for the __put_user in .text (extable_not_init()) and the
> > second is for the one in .init.text (init()).
> >
> > Depending on how the module gets allocated, the one referring to
> > .init.text may be first or last.
>
> Hmm, how about the following? :-)
>
> struct exception_table_entry *p = mod->extable;
>
> for (;p <= mod->extable+mod->num_exentries; p++ )
>          if (with_in_module_init(p->insn, mod))
>                    trim_it(p);

More like this:

void trim_init_extable(struct module *m)
{
	/* Since entries are sorted, init entries are at the start... */
	while (m->num_exentries && within_module_init(m->extable[0].insn)) {
		m->extable++;
		m->num_exentries--;
	}

	/* ... or the end. */
	while (m->num_exentries && within_module_init(m->extable[m->num_exentries-1].insn))
		m->num_exentries--;
}

Cheers,
Rusty.

  reply	other threads:[~2009-05-28  6:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090526083717.5050.32719.sendpatchset@localhost.localdomain>
     [not found] ` <20090526083751.5050.60959.sendpatchset@localhost.localdomain>
2009-05-27  2:21   ` [Patch 4/4] module: trim exception table in module_free() Rusty Russell
2009-05-27  3:11     ` Amerigo Wang
2009-05-27  5:23       ` Rusty Russell
2009-05-27  5:48         ` Amerigo Wang
2009-05-27  7:46         ` Amerigo Wang
2009-05-28  6:55           ` Rusty Russell [this message]
2009-05-31  5:15             ` Amerigo Wang
2009-06-01 12:28               ` Rusty Russell

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=200905281625.24974.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=akpm@linux-foundation.org \
    --cc=amwang@redhat.com \
    --cc=jdike@addtoit.com \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sparclinux@vger.kernel.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 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).