public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: "MONTGOMERY,BOB (HP-FtCollins,ex1)" <bob.montgomery@hp.com>
To: linux-ia64@vger.kernel.org
Subject: RE: [Linux-ia64] Problem with call across kernel modules
Date: Sat, 25 Jan 2003 01:06:35 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590709805749@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590709805718@msgid-missing>

I wrote last week:

> The Makefile makes two modules: caller.o and helper.o.  The 
> caller module
> calls the function helper from its init_module routine.  The helper
> function is in the helper module.
...  
 
> If you insmod caller.o first, it will fail with an unresolved symbol
> for helper, as expected.
> 
> After insmod'ing helper, the insmod of caller is expected to succeed,
> but the call to helper from init_module causes an Oops.  The oops
> message seems to indicate that the procedure call to helper lands at
> the wrong address.  The ISR 4294967296 (or 0x1 0000 0000) indicates
> the x bit (Execute exception - Interruption is associated with an
> instruction fetch).

After some more looking:

The problem is that the symbol exported by default for the helper
function (as visible from /proc/ksyms) is the address of the
function's entry point, and not the address of a function descriptor.

So when insmod connects the second module to it, the call stub code
that thinks it's loading the function address and the gp value is
really loading the first two words of the code of the function itself.
These work really badly as a function address and a gp value and show
up in the oops message as bizarre values for IP and r1.

One solution:
EXPORT_SYMBOL(helper) 
and add -DEXPORT_SYMTAB to the makefile.

If you don't use EXPORT_SYMBOL, but rely on the default "export
everything", even -DEXPORT_SYMTAB doesn't seem to help.  The symbol
that gets exported will be wrong as described above.

So it looks like the question has become: Why does the default exported
symbol from an insmod'd module not correctly point to a function
descriptor as required on IA64?  Or, if it isn't right, why make
it visible?

Hopefully this is getting closer to the real problem.

Bob Montgomery, HP





  reply	other threads:[~2003-01-25  1:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-17 23:28 [Linux-ia64] Problem with call across kernel modules MONTGOMERY,BOB (HP-FtCollins,ex1)
2003-01-25  1:06 ` MONTGOMERY,BOB (HP-FtCollins,ex1) [this message]
2003-01-25  1:32 ` Keith Owens

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=marc-linux-ia64-105590709805749@msgid-missing \
    --to=bob.montgomery@hp.com \
    --cc=linux-ia64@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