All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@MIT.EDU>
To: Tejun Heo <tj@kernel.org>
Cc: Matt Helsley <matthltc@us.ibm.com>,
	Pavel Emelyanov <xemul@parallels.com>,
	Nathan Lynch <ntl@pobox.com>, Oren Laadan <orenl@cs.columbia.edu>,
	Daniel Lezcano <dlezcano@fr.ibm.com>,
	S@MIT.EDU, "James E.J. Bottomley" <JBottomley@parallels.com>,
	"David S. Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [EXAMPLE CODE] Parasite thread injection and TCP connection hijacking
Date: Sat, 06 Aug 2011 08:45:28 -0400	[thread overview]
Message-ID: <4E3D3768.3070108@mit.edu> (raw)
In-Reply-To: <20110806121247.GC23937@htj.dyndns.org>

On 08/06/2011 08:12 AM, Tejun Heo wrote:
> Hello, guys.
>
> So, here's transparent TCP connection hijacking (ie. checkpointing in
> one process and restoring in another) which adds only relatively small
> pieces to the kernel.  It's by no means complete but already works
> rather reliably in my test setup even with heavy delay induced with
> tc.
>
> I wrote a rather long README describing how it's working, what's
> missing which is appended at the end of this mail so if you're
> interested in the details please go ahead and read.

That's a little gross but quite cool.

I think you have an annoying corner case, though:

 > 2. Decide where to inject the foreign code and save the original code
 >    with PTRACE_PEEKDATA.  Tracer can poke any mapped area regardless
 >    of protection flags but it can't add execution permission to the
 >    code, so it needs to choose memory area which already has X flag
 >    set.  The example code uses the page the %rip is in.

If the process is executing from the vsyscall page, then you'll probably 
fail.  (Admittedly, this is rather unlikely, given that the vsyscalls 
are now exactly one instruction.)  Presumably you also fail if executing 
from a read-only MAP_SHARED mapping.

Windows has a facility to more-or-less call mmap on behalf of another 
process, and another one to directly inject a thread into a remote 
process.  It's traditional to use them for this type of manipulation. 
Perhaps Linux should get the same thing.  (Although you could accomplish 
much the same thing if you could create a task with your mm but the 
tracee's fs.)

--Andy

  reply	other threads:[~2011-08-06 12:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-06 12:12 [EXAMPLE CODE] Parasite thread injection and TCP connection hijacking Tejun Heo
2011-08-06 12:12 ` Tejun Heo
2011-08-06 12:45 ` Andy Lutomirski [this message]
2011-08-06 13:00   ` Tejun Heo
2011-08-06 13:15     ` Andrew Lutomirski
2011-08-06 13:20       ` Tejun Heo
2011-08-08 10:20     ` Tejun Heo
2011-10-30  4:48 ` hiberante hangs TCP " David Fries
2011-10-30 20:16   ` Tejun Heo
2011-10-30 20:16     ` Tejun Heo
2011-10-30 20:43     ` David Fries
2011-10-30 20:43     ` David Fries
2011-11-02  9:44     ` MyungJoo Ham
2011-11-02  9:44       ` [linux-pm] " MyungJoo Ham
2011-11-02 15:10       ` Tejun Heo
2011-11-02 15:10         ` [linux-pm] " Tejun Heo
2012-02-17 19:28         ` Pavel Machek
2012-02-17 19:28           ` [linux-pm] " Pavel Machek
  -- strict thread matches above, loose matches on Subject: below --
2011-08-06 12:12 Tejun Heo

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=4E3D3768.3070108@mit.edu \
    --to=luto@mit.edu \
    --cc=JBottomley@parallels.com \
    --cc=S@MIT.EDU \
    --cc=davem@davemloft.net \
    --cc=dlezcano@fr.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthltc@us.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=ntl@pobox.com \
    --cc=orenl@cs.columbia.edu \
    --cc=tj@kernel.org \
    --cc=xemul@parallels.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.