From: Andrew Morton <akpm@zip.com.au>
To: Skip Ford <skip.ford@verizon.net>
Cc: "Adam J. Richter" <adam@yggdrasil.com>,
ryan.flanigan@intel.com, linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@transmeta.com>
Subject: Re: 2.5.31: modules don't work at all
Date: Sun, 11 Aug 2002 22:36:50 -0700 [thread overview]
Message-ID: <3D574972.DD878928@zip.com.au> (raw)
In-Reply-To: 200208120307.g7C37AuF000184@pool-141-150-241-241.delv.east.verizon.net
Skip Ford wrote:
>
> ...
> > I already know that the error that trips insmod occurs at
> > in modules.c, line 831, when qm_symbols gets an error from copy_to_user():
> >
> > for (; i < mod->nsyms ; ++i, ++s, vals += 2) {
> > len = strlen(s->name)+1;
> > if (len > bufsize)
> > goto calc_space_needed;
> >
> > here------> if (copy_to_user(strings, s->name, len)
> > || __put_user(s->value, vals+0)
> > || __put_user(space, vals+1))
> > return -EFAULT;
> >
> > strings += len;
> > bufsize -= len;
> > space += len;
> > }
> >
> > The values of strings and s->name are similar in 2.5.30+preempt
> > (works) and 2.5.31+preempt (does not work). strings is 0x08______, and
> > s->name is 0xc0______.
>
> If I back out this change to arch/i386/mm/fault.c then modules
> successfully load. I have no idea if backing it out causes other
> problems though.
>
> diff -Nru a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c
> --- a/arch/i386/mm/fault.c Sat Aug 10 18:42:20 2002
> +++ b/arch/i386/mm/fault.c Sat Aug 10 18:42:20 2002
> @@ -181,10 +181,10 @@
> info.si_code = SEGV_MAPERR;
>
> /*
> - * If we're in an interrupt or have no user
> - * context, we must not take the fault..
> + * If we're in an interrupt, have no user context or are running in an
> + * atomic region then we must not take the fault..
> */
> - if (in_interrupt() || !mm)
> + if (preempt_count() || !mm)
> goto no_context;
>
> down_read(&mm->mmap_sem);
>
Yes, that's the problem. qm_symbols() is performing copy_to_user()
inside lock_kernel() and that's an "atomic copy_to_user()" in 2.5.31.
But only if preempt is selected. The copy_to_user() doesn't work.
There's nothing illegal about copy_to_user() inside lock_kernel().
Linus, we can back out the preempt_count() test in there and
perform the atomic copy_*_user via a current->flags bit, or
we can do something else?
next prev parent reply other threads:[~2002-08-12 5:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-12 2:33 2.5.31: modules don't work at all Adam J. Richter
2002-08-12 3:07 ` Skip Ford
2002-08-12 5:36 ` Andrew Morton [this message]
2002-08-12 17:22 ` Linus Torvalds
2002-08-12 17:52 ` Andrew Morton
2002-08-12 20:32 ` Linus Torvalds
2002-08-12 23:34 ` Andrew Morton
2002-08-12 23:45 ` Linus Torvalds
2002-08-13 0:32 ` Skip Ford
2002-08-13 1:31 ` Skip Ford
2002-08-13 0:09 ` Andrew Rodland
2002-08-13 0:13 ` Andrew Morton
2002-08-20 22:59 ` Ed Tomlinson
2002-08-12 3:09 ` Flanigan, Ryan
-- strict thread matches above, loose matches on Subject: below --
2002-08-11 12:41 Michel Eyckmans (MCE)
2002-08-12 0:54 ` Flanigan, Ryan
2002-08-12 1:03 ` Andrew Rodland
2002-08-12 1:11 ` Flanigan, Ryan
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=3D574972.DD878928@zip.com.au \
--to=akpm@zip.com.au \
--cc=adam@yggdrasil.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ryan.flanigan@intel.com \
--cc=skip.ford@verizon.net \
--cc=torvalds@transmeta.com \
/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.