From: Matt Mackall <mpm@selenic.com>
To: "Randy.Dunlap" <rddunlap@osdl.org>
Cc: Dave Jones <davej@redhat.com>, Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org
Subject: Re: Debug: sleeping function called from invalid context
Date: Sat, 16 Aug 2003 02:06:52 -0500 [thread overview]
Message-ID: <20030816070652.GG325@waste.org> (raw)
In-Reply-To: <20030815123053.2f81ec0a.rddunlap@osdl.org>
On Fri, Aug 15, 2003 at 12:30:53PM -0700, Randy.Dunlap wrote:
> On Fri, 15 Aug 2003 18:32:47 +0100 Dave Jones <davej@redhat.com> wrote:
>
> | On Fri, Aug 15, 2003 at 10:18:56AM -0700, Randy.Dunlap wrote:
> |
> | > Debug: sleeping function called from invalid context at include/asm/uaccess.h:473
> | > Call Trace:
> | > [<c0120d94>] __might_sleep+0x54/0x5b
> | > [<c010d001>] save_v86_state+0x71/0x1f0
> | > [<c010dbd5>] handle_vm86_fault+0xc5/0xa90
> | > [<c019cab8>] ext3_file_write+0x28/0xc0
> | > [<c011cd96>] __change_page_attr+0x26/0x220
> | > [<c010b310>] do_general_protection+0x0/0x90
> | > [<c010a69d>] error_code+0x2d/0x40
> | > [<c0109657>] syscall_call+0x7/0xb
> |
> | That's one really wierd looking backtrace. What else was that
> | machine up to at the time ?
>
> Some parts of it are explainable (to me), some not.
> I don't know what caused a GP fault or why ext3 shows up.
>
> But I can follow from do_general_protection() to handle_vm86_fault()
> to [inline] return_to_32bit() to save_v86_state() to __might_sleep().
>
> And __might_sleep() is correct if change_page_attr() was called,
> since it takes a spinlock. I just can't connect quite all of the dots.
Ok, there's some stack noise here with the ext3_file_write and
__change_page_attr.
Here's what I've figured out so far. You probably have something like
X running with a driver that calls an image of its own 16-bit BIOS to
get something done (I think Matrox does this) via sys_vm86. One of the
arguments to sys_vm86 is a pointer to a vm86plus_struct in userspace
that gets stashed away in tsk->thread.vm86_info.
When, for whatever reason, a fixup is needed in vm86 mode, we find
ourselves in handle_vm86_fault and save_v86_state copied various junk
out to this userspace struct we've kept a pointer to. Now as far as I
can tell, there's nothing guaranteeing this struct is pinned down or
in any way guaranteed to be around when the fault occurs. If the page
with the struct _does_ get swapped out, we can be in trouble when we
hit this fault.
If this is actually a valid analysis, we should probably just pin the
page for the duration of vm86 as it's already bordering on magical.
If there's some reason this whole thing is safe, let me know and I'll
try to get might_sleep to stop complaining about these.
I suppose we could test it by hacking a program guaranteed to fault in
vm86 mode and hacking the syscall to force the page out before calling
do_sys_vm86.
--
Matt Mackall : http://www.selenic.com : of or relating to the moon
next prev parent reply other threads:[~2003-08-16 7:07 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-15 17:18 Debug: sleeping function called from invalid context Randy.Dunlap
2003-08-15 17:32 ` Dave Jones
2003-08-15 17:42 ` Randy.Dunlap
2003-08-15 19:30 ` Randy.Dunlap
2003-08-16 7:06 ` Matt Mackall [this message]
2003-08-18 21:07 ` Randy.Dunlap
2003-08-18 21:26 ` Matt Mackall
2003-08-19 0:13 ` Dave Jones
2003-08-19 0:15 ` Randy.Dunlap
2003-08-19 1:02 ` Zwane Mwaikambo
2003-08-19 0:15 ` Andrew Morton
2003-08-19 1:27 ` Matt Mackall
2003-08-19 3:24 ` Randy.Dunlap
2003-08-19 3:35 ` Andrew Morton
2003-08-19 3:39 ` Randy.Dunlap
2003-08-19 4:26 ` Matt Mackall
2003-08-19 4:29 ` Andrew Morton
2003-08-19 4:14 ` Matt Mackall
2003-08-19 5:14 ` Matt Mackall
2003-08-19 1:01 ` Matt Mackall
2003-08-19 1:04 ` Dave Jones
2003-08-19 1:09 ` Matt Mackall
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=20030816070652.GG325@waste.org \
--to=mpm@selenic.com \
--cc=akpm@osdl.org \
--cc=davej@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rddunlap@osdl.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