public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: renzo@cs.unibo.it (Renzo Davoli)
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Andi Kleen <ak@suse.de>, Daniel Jacobowitz <dan@debian.org>,
	Ulrich Drepper <drepper@gmail.com>,
	osd@cs.unibo.it, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 2-ptrace_multi
Date: Sat, 20 May 2006 20:30:20 +0200	[thread overview]
Message-ID: <20060520183020.GC11648@cs.unibo.it> (raw)
In-Reply-To: <1148135825.2085.33.camel@localhost.localdomain>

To summarize the thread we have agreed that
/proc/*/mem should be writable, at least with ptrace permissions.

Even reading from /proc/*/mem does not currently have the same permissions of
ptrace. E.g. when a setuid process is started under ptrace it runs
without the setuid semantics, thus it is possible to get/put data
using PTRACE_{PEEK,POKE}*.
There are no security threats as the process is running in an
unprivileged way, on the contrary this is a feature that allows
virtual machines to run setuid code, e.g. we use this feature to
run /bin/ping on virtual networks.
Instead it is not possible to read the memory through /proc/*/mem
in the same situation.
(In UMview -- see our cvs if you like -- to manage this exception
there is now a read from /proc/*/mem file and if the read fails it 
rolls back to the standard PTRACE_PEEKDATA.)

Let me point out that PTRACE_MULTI is not only related to memory access.
We are using PTRACE_MULTI also to store the registers and restart the
execution of the ptraced process with a single syscall.
This is very effective when umview runs on a ppc32 architecture. In
fact, PPC_PTRACE_{G,S}ETREGS do not exist for that architecture
(IMHO there is no evident reason for that). Without PTRACE_MULTI each register
must be read/written individually by a PTRACE_{PEEK,POKE}USER(*)

PTRACE_MULTI can be also used to optimize many other virtualized calls,
e.g. to read/write all the buffers for a readv/writev/recvmsg/sendmsg
call at once.

Therefore I feel that /proc/*/mem access can help but PTRACE_MULTI
gives something more.

	renzo

(*) two notes about PPC_PTRACE_{G,S}ETREGS for powerpc.
It is not clear to me why the same calls are okay for ppc64 and forbidden
for ppc32, all the statements inside this ifdef

arch/powerpc/kernel/ptrace.c: 407  #ifdef CONFIG_PPC64
arch/powerpc/kernel/ptrace.c: 408  case PPC_PTRACE_GETREGS: { /* Get GPRs 0 - 31. */
...

are meaningful for ppc32 too. I have not tested it yet, but maybe
deleting the #ifdef is enough to provide PPC_PTRACE_{G,S}ETREGS to
ppc32, too.
There is another detail. IMVHO in ppc64 architecture the security control 
that forbids to change the PT_ORIG_R3 register by PTRACE_POKEUSER

arch/powerpc/kernel/ptrace.c: 329  if (index == PT_ORIG_R3)
arch/powerpc/kernel/ptrace.c: 330    break;

is circunvented by PPC_PTRACE_SETREGS that rewrites all the registers
including PT_ORIG_R3. (Maybe I am wrong but I haven't seen any
check about this).

  reply	other threads:[~2006-05-20 18:30 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-18 15:53 ptrace enhancements for VM support (patch proposals follow in sep.msgs) Renzo Davoli
2006-05-18 15:56 ` [PATCH] 1-access_process_vm_user Renzo Davoli
2006-05-18 15:58 ` [PATCH] 2-ptrace_multi Renzo Davoli
2006-05-18 20:17   ` Andi Kleen
2006-05-18 21:13     ` Renzo Davoli
2006-05-19  2:23       ` Ulrich Drepper
2006-05-19  9:07         ` Renzo Davoli
2006-05-19 13:09           ` Daniel Jacobowitz
2006-05-19 17:45             ` Renzo Davoli
2006-05-19 19:15               ` Renzo Davoli
2006-05-19 20:15               ` Daniel Jacobowitz
2006-05-19 20:17                 ` Andi Kleen
2006-05-20  6:44                   ` Ulrich Drepper
2006-05-20 14:37                   ` Alan Cox
2006-05-20 18:30                     ` Renzo Davoli [this message]
2006-05-20 20:23                       ` Ulrich Drepper
2006-05-20 21:39                       ` Jeff Dike
2006-05-21 12:38                         ` Avi Kivity
2006-05-21 15:28                         ` Renzo Davoli
2006-05-22 13:02                           ` Daniel Jacobowitz
2006-05-22 15:05                             ` Renzo Davoli
2006-05-22 15:26                               ` Daniel Jacobowitz
2006-05-18 16:07 ` [PATCH] 3-ptrace_vm Renzo Davoli
2006-05-21  8:03 ` ptrace enhancements for VM support (patch proposals follow in sep.msgs) Peter Chubb

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=20060520183020.GC11648@cs.unibo.it \
    --to=renzo@cs.unibo.it \
    --cc=ak@suse.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dan@debian.org \
    --cc=drepper@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=osd@cs.unibo.it \
    /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