* [PATCH] Reading the VDSO area - i386
@ 2007-07-17 16:23 John Blackwood
2007-07-17 16:47 ` Jeremy Fitzhardinge
0 siblings, 1 reply; 5+ messages in thread
From: John Blackwood @ 2007-07-17 16:23 UTC (permalink / raw)
To: linux-kernel, Jeremy Fitzhardinge; +Cc: Andi Kleen, Roland McGrath, bugsy
Hi Jeremy,
I was doing some tests that attempt to read the VDSO area of a
task through either the /proc/pid/mem or ptrace(PTRACE_PEEKTEXT,
...) interfaces, and it seems that when the CONFIG_COMPAT_VDSO kernel
parameter is enabled, we can no longer successfully read the VDSO area
on i386 kernels.
I believe that debuggers such as gdb will attempt to sometimes walkback
through the vsyscall area, and not being able to read the vsyscall/vdso
area would thus cause debuggers problems.
So assuming that this change in behavior was not intentional, I've
provided my stab (just an idea) at a fix. With this change below,
the code in places such as get_user_pages() can now successfully call
in_gate_area() and then subsequently call get_gate_vma(), which already
properly returns the correct info.
Thanks for taking the time to read over this.
---
/userland/johnb/s/os/kernel/linux-2.6.22/arch/i386/kernel/sysenter.c
2007-07-17 08:38:48.000000000 -0400
+++ new/arch/i386/kernel/./sysenter.c 2007-07-17 11:48:28.000000000 -0400
@@ -336,6 +336,14 @@ struct vm_area_struct *get_gate_vma(stru
int in_gate_area(struct task_struct *task, unsigned long addr)
{
+ struct mm_struct *mm = task->mm;
+
+ /* Check to see if this task was created in compat vdso mode
+ * and if the address is within the gate_vma area.
+ */
+ if (mm && mm->context.vdso == (void *)VDSO_HIGH_BASE &&
+ addr >= gate_vma.vm_start && addr <= gate_vma.vm_end)
+ return 1;
return 0;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Reading the VDSO area - i386
2007-07-17 16:23 [PATCH] Reading the VDSO area - i386 John Blackwood
@ 2007-07-17 16:47 ` Jeremy Fitzhardinge
2007-07-17 17:48 ` Andi Kleen
0 siblings, 1 reply; 5+ messages in thread
From: Jeremy Fitzhardinge @ 2007-07-17 16:47 UTC (permalink / raw)
To: john.blackwood
Cc: linux-kernel, Jeremy Fitzhardinge, Andi Kleen, Roland McGrath,
bugsy, Andrew Morton
John Blackwood wrote:
> I was doing some tests that attempt to read the VDSO area of a
> task through either the /proc/pid/mem or ptrace(PTRACE_PEEKTEXT,
> ...) interfaces, and it seems that when the CONFIG_COMPAT_VDSO kernel
> parameter is enabled, we can no longer successfully read the VDSO area
> on i386 kernels.
Thanks. Someone else noticed this recently, and posted a near-identical
patch. But I can't seem to find it right now...
Andrew, Andi: do you remember something like this passing by?
J
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Reading the VDSO area - i386
2007-07-17 16:47 ` Jeremy Fitzhardinge
@ 2007-07-17 17:48 ` Andi Kleen
2007-07-17 17:51 ` Jeremy Fitzhardinge
0 siblings, 1 reply; 5+ messages in thread
From: Andi Kleen @ 2007-07-17 17:48 UTC (permalink / raw)
To: Jeremy Fitzhardinge
Cc: john.blackwood, linux-kernel, Jeremy Fitzhardinge, Roland McGrath,
bugsy, Andrew Morton
On Tuesday 17 July 2007 18:47:56 Jeremy Fitzhardinge wrote:
> John Blackwood wrote:
> > I was doing some tests that attempt to read the VDSO area of a
> > task through either the /proc/pid/mem or ptrace(PTRACE_PEEKTEXT,
> > ...) interfaces, and it seems that when the CONFIG_COMPAT_VDSO kernel
> > parameter is enabled, we can no longer successfully read the VDSO area
> > on i386 kernels.
>
> Thanks. Someone else noticed this recently, and posted a near-identical
> patch. But I can't seem to find it right now...
>
> Andrew, Andi: do you remember something like this passing by?
Yes it was from Jan Beulich.
-Andi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Reading the VDSO area - i386
2007-07-17 17:48 ` Andi Kleen
@ 2007-07-17 17:51 ` Jeremy Fitzhardinge
2007-07-17 17:57 ` Andi Kleen
0 siblings, 1 reply; 5+ messages in thread
From: Jeremy Fitzhardinge @ 2007-07-17 17:51 UTC (permalink / raw)
To: Andi Kleen
Cc: john.blackwood, linux-kernel, Jeremy Fitzhardinge, Roland McGrath,
bugsy, Andrew Morton, Jan Beulich
Andi Kleen wrote:
> On Tuesday 17 July 2007 18:47:56 Jeremy Fitzhardinge wrote:
>
>> John Blackwood wrote:
>>
>>> I was doing some tests that attempt to read the VDSO area of a
>>> task through either the /proc/pid/mem or ptrace(PTRACE_PEEKTEXT,
>>> ...) interfaces, and it seems that when the CONFIG_COMPAT_VDSO kernel
>>> parameter is enabled, we can no longer successfully read the VDSO area
>>> on i386 kernels.
>>>
>> Thanks. Someone else noticed this recently, and posted a near-identical
>> patch. But I can't seem to find it right now...
>>
>> Andrew, Andi: do you remember something like this passing by?
>>
>
> Yes it was from Jan Beulich.
>
Ah, yes. For some reason I can't find it in my archives. Do you have
it queued up?
J
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Reading the VDSO area - i386
2007-07-17 17:51 ` Jeremy Fitzhardinge
@ 2007-07-17 17:57 ` Andi Kleen
0 siblings, 0 replies; 5+ messages in thread
From: Andi Kleen @ 2007-07-17 17:57 UTC (permalink / raw)
To: Jeremy Fitzhardinge
Cc: john.blackwood, linux-kernel, Jeremy Fitzhardinge, Roland McGrath,
bugsy, Andrew Morton, Jan Beulich
>
> Ah, yes. For some reason I can't find it in my archives. Do you have
> it queued up?
Yes
-Andi
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-07-17 17:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-17 16:23 [PATCH] Reading the VDSO area - i386 John Blackwood
2007-07-17 16:47 ` Jeremy Fitzhardinge
2007-07-17 17:48 ` Andi Kleen
2007-07-17 17:51 ` Jeremy Fitzhardinge
2007-07-17 17:57 ` Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox