* Re: [PATCH] print_worker_info: Handle pointer with more care
[not found] ` <520E500B.5000408@nod.at>
@ 2013-08-16 16:28 ` Tejun Heo
2013-08-16 16:38 ` Richard Weinberger
0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2013-08-16 16:28 UTC (permalink / raw)
To: Richard Weinberger
Cc: linux-kernel, Jeff Dike, Richard Weinberger,
user-mode-linux-devel
On Fri, Aug 16, 2013 at 06:15:07PM +0200, Richard Weinberger wrote:
> On UML I hit the case that pwq is NULL.
> Then we oops at &pwq->wq...
Hmmm? I'm confused. &pwq->wq is pwq's pointer + wq's offset in pwq.
It doesn't involve dereferencing pwq->wq. Maybe uml isn't
implementing probe_kernel_thread()? Now that I think about it, I'm
not sure how it could.
cc'ing uml people. Hey, guys, workqueue uses proble_kernel_read() to
print out workqueue related information during oops because those
events are completely asynchronous and workqueue states may not be
consistently accessible. It seems like uml doesn't implement
probe_kernel_read() and tries direct derference of incorrect pointers
leading to its own oops. Maybe uml should check whether the memory is
mapped from probe_kernel_read()?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] print_worker_info: Handle pointer with more care
2013-08-16 16:28 ` [PATCH] print_worker_info: Handle pointer with more care Tejun Heo
@ 2013-08-16 16:38 ` Richard Weinberger
2013-08-16 16:45 ` Tejun Heo
0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2013-08-16 16:38 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-kernel, Jeff Dike, user-mode-linux-devel
Am 16.08.2013 18:28, schrieb Tejun Heo:
> On Fri, Aug 16, 2013 at 06:15:07PM +0200, Richard Weinberger wrote:
>> On UML I hit the case that pwq is NULL.
>> Then we oops at &pwq->wq...
>
> Hmmm? I'm confused. &pwq->wq is pwq's pointer + wq's offset in pwq.
> It doesn't involve dereferencing pwq->wq. Maybe uml isn't
> implementing probe_kernel_thread()? Now that I think about it, I'm
> not sure how it could.
>
> cc'ing uml people. Hey, guys, workqueue uses proble_kernel_read() to
> print out workqueue related information during oops because those
> events are completely asynchronous and workqueue states may not be
> consistently accessible. It seems like uml doesn't implement
> probe_kernel_read() and tries direct derference of incorrect pointers
> leading to its own oops. Maybe uml should check whether the memory is
> mapped from probe_kernel_read()?
You are already talking to UML people. ;)
Anyway, I'll investigate into that.
What I see so far is that pwq is NULL after probe_kernel_read().
Thanks,
//richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] print_worker_info: Handle pointer with more care
2013-08-16 16:38 ` Richard Weinberger
@ 2013-08-16 16:45 ` Tejun Heo
2013-08-16 16:53 ` Richard Weinberger
0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2013-08-16 16:45 UTC (permalink / raw)
To: Richard Weinberger; +Cc: linux-kernel, Jeff Dike, user-mode-linux-devel
Hello,
On Fri, Aug 16, 2013 at 06:38:58PM +0200, Richard Weinberger wrote:
> > cc'ing uml people. Hey, guys, workqueue uses proble_kernel_read() to
> > print out workqueue related information during oops because those
> > events are completely asynchronous and workqueue states may not be
> > consistently accessible. It seems like uml doesn't implement
> > probe_kernel_read() and tries direct derference of incorrect pointers
> > leading to its own oops. Maybe uml should check whether the memory is
> > mapped from probe_kernel_read()?
>
> You are already talking to UML people. ;)
Ooh... :)
> Anyway, I'll investigate into that.
> What I see so far is that pwq is NULL after probe_kernel_read().
Yeah, and that should be fine. &pwq->wq would be just an offset of wq
from NULL which is an invalid pointer but probe_kernel_read() should
be able to handle that and probably just return 0 or -1 (all bits
set). I *think* what's necessary is making probe_kernel_read() use
mincore() to fine out whether the requested address is mapped (it
should return -EFAULT if not) and try to dereference the address iff
it's mapped.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] print_worker_info: Handle pointer with more care
2013-08-16 16:45 ` Tejun Heo
@ 2013-08-16 16:53 ` Richard Weinberger
2013-08-16 17:20 ` Richard Weinberger
0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2013-08-16 16:53 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-kernel, Jeff Dike, user-mode-linux-devel
Am 16.08.2013 18:45, schrieb Tejun Heo:
> Hello,
>
> On Fri, Aug 16, 2013 at 06:38:58PM +0200, Richard Weinberger wrote:
>>> cc'ing uml people. Hey, guys, workqueue uses proble_kernel_read() to
>>> print out workqueue related information during oops because those
>>> events are completely asynchronous and workqueue states may not be
>>> consistently accessible. It seems like uml doesn't implement
>>> probe_kernel_read() and tries direct derference of incorrect pointers
>>> leading to its own oops. Maybe uml should check whether the memory is
>>> mapped from probe_kernel_read()?
>>
>> You are already talking to UML people. ;)
>
> Ooh... :)
>
>> Anyway, I'll investigate into that.
>> What I see so far is that pwq is NULL after probe_kernel_read().
>
> Yeah, and that should be fine. &pwq->wq would be just an offset of wq
Yep. Now my brain also parsed the C notation correctly.
Sorry for the completely wrong patch.
> from NULL which is an invalid pointer but probe_kernel_read() should
> be able to handle that and probably just return 0 or -1 (all bits
> set). I *think* what's necessary is making probe_kernel_read() use
> mincore() to fine out whether the requested address is mapped (it
> should return -EFAULT if not) and try to dereference the address iff
> it's mapped.
UML needs a custom probe_kernel_read()? Fine. :)
Thanks,
//richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] print_worker_info: Handle pointer with more care
2013-08-16 16:53 ` Richard Weinberger
@ 2013-08-16 17:20 ` Richard Weinberger
0 siblings, 0 replies; 5+ messages in thread
From: Richard Weinberger @ 2013-08-16 17:20 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-kernel, Jeff Dike, user-mode-linux-devel
Am 16.08.2013 18:53, schrieb Richard Weinberger:
>> Yeah, and that should be fine. &pwq->wq would be just an offset of wq
>
> Yep. Now my brain also parsed the C notation correctly.
> Sorry for the completely wrong patch.
>
>> from NULL which is an invalid pointer but probe_kernel_read() should
>> be able to handle that and probably just return 0 or -1 (all bits
>> set). I *think* what's necessary is making probe_kernel_read() use
>> mincore() to fine out whether the requested address is mapped (it
>> should return -EFAULT if not) and try to dereference the address iff
>> it's mapped.
>
> UML needs a custom probe_kernel_read()? Fine. :)
With my own probe_kernel_read() that uses mincore()
it works fine so far. :-)
Thanks,
//richard
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-08-16 17:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1376668606-32354-1-git-send-email-richard@nod.at>
[not found] ` <20130816161229.GI2505@htj.dyndns.org>
[not found] ` <520E500B.5000408@nod.at>
2013-08-16 16:28 ` [PATCH] print_worker_info: Handle pointer with more care Tejun Heo
2013-08-16 16:38 ` Richard Weinberger
2013-08-16 16:45 ` Tejun Heo
2013-08-16 16:53 ` Richard Weinberger
2013-08-16 17:20 ` Richard Weinberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox