* PTRACE_{READ,WRITE}{TEXT,DATA}
@ 2008-04-29 3:54 Benjamin Herrenschmidt
2008-04-29 4:34 ` PTRACE_{READ,WRITE}{TEXT,DATA} David Miller
2008-04-29 22:07 ` PTRACE_{READ,WRITE}{TEXT,DATA} Roland McGrath
0 siblings, 2 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2008-04-29 3:54 UTC (permalink / raw)
To: Roland McGrath; +Cc: David S. Miller, Linux Kernel list, Rik van Riel
Hi Roland, David !
I noticed kernel/ptrace.c has ptrace_readdata/writedata functions that
are only used by sparc and sparc64 which implements the ptrace requests
PTRACE_READ_DATA, PTRACE_WRITE_DATA (and _TEXT variants).
Any reason not to make everybody benefit from these and moving the sparc
implementation to the generic ptrace_request (&compat) ?
It's more efficient than read/writing one word at a time... I thought
about it in the light of some work Rik is doing to make
access_process_vm useable on video ram mappings done by the X server...
If you are ok, I'll do a patch.
Cheers,
Ben
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PTRACE_{READ,WRITE}{TEXT,DATA}
2008-04-29 3:54 PTRACE_{READ,WRITE}{TEXT,DATA} Benjamin Herrenschmidt
@ 2008-04-29 4:34 ` David Miller
2008-04-29 4:44 ` PTRACE_{READ,WRITE}{TEXT,DATA} Rik van Riel
2008-04-29 5:06 ` PTRACE_{READ,WRITE}{TEXT,DATA} Benjamin Herrenschmidt
2008-04-29 22:07 ` PTRACE_{READ,WRITE}{TEXT,DATA} Roland McGrath
1 sibling, 2 replies; 8+ messages in thread
From: David Miller @ 2008-04-29 4:34 UTC (permalink / raw)
To: benh; +Cc: roland, linux-kernel, riel
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: Tue, 29 Apr 2008 13:54:08 +1000
> I noticed kernel/ptrace.c has ptrace_readdata/writedata functions that
> are only used by sparc and sparc64 which implements the ptrace requests
> PTRACE_READ_DATA, PTRACE_WRITE_DATA (and _TEXT variants).
>
> Any reason not to make everybody benefit from these and moving the sparc
> implementation to the generic ptrace_request (&compat) ?
>
> It's more efficient than read/writing one word at a time... I thought
> about it in the light of some work Rik is doing to make
> access_process_vm useable on video ram mappings done by the X server...
It's kind of pointless because what gdb does these days on Linux is
use the procfs 'mem' file to directly read in parts of the inferior's
address space.
See linux_proc_xfer_partial() in gdb/linux-nat.c
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PTRACE_{READ,WRITE}{TEXT,DATA}
2008-04-29 4:34 ` PTRACE_{READ,WRITE}{TEXT,DATA} David Miller
@ 2008-04-29 4:44 ` Rik van Riel
2008-04-29 5:06 ` PTRACE_{READ,WRITE}{TEXT,DATA} Benjamin Herrenschmidt
2008-04-29 5:06 ` PTRACE_{READ,WRITE}{TEXT,DATA} Benjamin Herrenschmidt
1 sibling, 1 reply; 8+ messages in thread
From: Rik van Riel @ 2008-04-29 4:44 UTC (permalink / raw)
To: David Miller; +Cc: benh, roland, linux-kernel
On Mon, 28 Apr 2008 21:34:16 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:
> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Date: Tue, 29 Apr 2008 13:54:08 +1000
>
> > I noticed kernel/ptrace.c has ptrace_readdata/writedata functions that
> > are only used by sparc and sparc64 which implements the ptrace requests
> > PTRACE_READ_DATA, PTRACE_WRITE_DATA (and _TEXT variants).
> >
> > Any reason not to make everybody benefit from these and moving the sparc
> > implementation to the generic ptrace_request (&compat) ?
> >
> > It's more efficient than read/writing one word at a time... I thought
> > about it in the light of some work Rik is doing to make
> > access_process_vm useable on video ram mappings done by the X server...
>
> It's kind of pointless because what gdb does these days on Linux is
> use the procfs 'mem' file to directly read in parts of the inferior's
> address space.
>
> See linux_proc_xfer_partial() in gdb/linux-nat.c
Strange, changing access_process_vm on Fedora 9 made gdb able to
see video memory that the X server had mmapped.
Are you sure gdb behaves as you suggest?
On x86 my patch seems to work as I expected...
--
All rights reversed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PTRACE_{READ,WRITE}{TEXT,DATA}
2008-04-29 4:34 ` PTRACE_{READ,WRITE}{TEXT,DATA} David Miller
2008-04-29 4:44 ` PTRACE_{READ,WRITE}{TEXT,DATA} Rik van Riel
@ 2008-04-29 5:06 ` Benjamin Herrenschmidt
1 sibling, 0 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2008-04-29 5:06 UTC (permalink / raw)
To: David Miller; +Cc: roland, linux-kernel, riel
On Mon, 2008-04-28 at 21:34 -0700, David Miller wrote:
> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Date: Tue, 29 Apr 2008 13:54:08 +1000
>
> > I noticed kernel/ptrace.c has ptrace_readdata/writedata functions that
> > are only used by sparc and sparc64 which implements the ptrace requests
> > PTRACE_READ_DATA, PTRACE_WRITE_DATA (and _TEXT variants).
> >
> > Any reason not to make everybody benefit from these and moving the sparc
> > implementation to the generic ptrace_request (&compat) ?
> >
> > It's more efficient than read/writing one word at a time... I thought
> > about it in the light of some work Rik is doing to make
> > access_process_vm useable on video ram mappings done by the X server...
>
> It's kind of pointless because what gdb does these days on Linux is
> use the procfs 'mem' file to directly read in parts of the inferior's
> address space.
>
> See linux_proc_xfer_partial() in gdb/linux-nat.c=
Good point. That still uses access_process_vm() so Rik and I work
is still valid tho.
Thanks,
Ben.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PTRACE_{READ,WRITE}{TEXT,DATA}
2008-04-29 4:44 ` PTRACE_{READ,WRITE}{TEXT,DATA} Rik van Riel
@ 2008-04-29 5:06 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2008-04-29 5:06 UTC (permalink / raw)
To: Rik van Riel; +Cc: David Miller, roland, linux-kernel
> Strange, changing access_process_vm on Fedora 9 made gdb able to
> see video memory that the X server had mmapped.
>
> Are you sure gdb behaves as you suggest?
>
> On x86 my patch seems to work as I expected...
Because /proc/<pid>/mem also uses access_process_vm(). See
fs/proc/base.c
Cheers,
Ben.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PTRACE_{READ,WRITE}{TEXT,DATA}
2008-04-29 3:54 PTRACE_{READ,WRITE}{TEXT,DATA} Benjamin Herrenschmidt
2008-04-29 4:34 ` PTRACE_{READ,WRITE}{TEXT,DATA} David Miller
@ 2008-04-29 22:07 ` Roland McGrath
2008-04-30 0:06 ` PTRACE_{READ,WRITE}{TEXT,DATA} Benjamin Herrenschmidt
1 sibling, 1 reply; 8+ messages in thread
From: Roland McGrath @ 2008-04-29 22:07 UTC (permalink / raw)
To: benh; +Cc: David S. Miller, Linux Kernel list, Rik van Riel
I don't see any sense in adding that. Using /proc/pid/mem is already the
"efficient" API for this known to userland. I don't think keeping the fd
around for that is any great burden, and if you do then the one pread64
call is just as efficient as one ptrace call to do the same thing.
Thanks,
Roland
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PTRACE_{READ,WRITE}{TEXT,DATA}
2008-04-29 22:07 ` PTRACE_{READ,WRITE}{TEXT,DATA} Roland McGrath
@ 2008-04-30 0:06 ` Benjamin Herrenschmidt
2008-04-30 1:32 ` PTRACE_{READ,WRITE}{TEXT,DATA} Roland McGrath
0 siblings, 1 reply; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2008-04-30 0:06 UTC (permalink / raw)
To: Roland McGrath; +Cc: David S. Miller, Linux Kernel list, Rik van Riel
On Tue, 2008-04-29 at 15:07 -0700, Roland McGrath wrote:
> I don't see any sense in adding that. Using /proc/pid/mem is already the
> "efficient" API for this known to userland. I don't think keeping the fd
> around for that is any great burden, and if you do then the one pread64
> call is just as efficient as one ptrace call to do the same thing.
Yup, I didn't know gdb used /proc/pid/mem to be honest ... as long as it
goes through access_process_vm(), I'm fine anyway.
Cheers,
Ben.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PTRACE_{READ,WRITE}{TEXT,DATA}
2008-04-30 0:06 ` PTRACE_{READ,WRITE}{TEXT,DATA} Benjamin Herrenschmidt
@ 2008-04-30 1:32 ` Roland McGrath
0 siblings, 0 replies; 8+ messages in thread
From: Roland McGrath @ 2008-04-30 1:32 UTC (permalink / raw)
To: benh; +Cc: David S. Miller, Linux Kernel list, Rik van Riel
> Yup, I didn't know gdb used /proc/pid/mem to be honest ... as long as it
> goes through access_process_vm(), I'm fine anyway.
All user ABIs for this have always boiled down to access_process_vm.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-04-30 1:33 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-29 3:54 PTRACE_{READ,WRITE}{TEXT,DATA} Benjamin Herrenschmidt
2008-04-29 4:34 ` PTRACE_{READ,WRITE}{TEXT,DATA} David Miller
2008-04-29 4:44 ` PTRACE_{READ,WRITE}{TEXT,DATA} Rik van Riel
2008-04-29 5:06 ` PTRACE_{READ,WRITE}{TEXT,DATA} Benjamin Herrenschmidt
2008-04-29 5:06 ` PTRACE_{READ,WRITE}{TEXT,DATA} Benjamin Herrenschmidt
2008-04-29 22:07 ` PTRACE_{READ,WRITE}{TEXT,DATA} Roland McGrath
2008-04-30 0:06 ` PTRACE_{READ,WRITE}{TEXT,DATA} Benjamin Herrenschmidt
2008-04-30 1:32 ` PTRACE_{READ,WRITE}{TEXT,DATA} Roland McGrath
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox