<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: fun with process scheduling</title>
	<atom:link href="http://www.outflux.net/blog/archives/2010/02/25/fun-with-process-scheduling/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.outflux.net/blog/archives/2010/02/25/fun-with-process-scheduling/</link>
	<description>code is freedom -- patching my itch</description>
	<lastBuildDate>Tue, 24 Jan 2012 19:58:01 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
	<item>
		<title>By: Patrik</title>
		<link>http://www.outflux.net/blog/archives/2010/02/25/fun-with-process-scheduling/comment-page-1/#comment-874</link>
		<dc:creator>Patrik</dc:creator>
		<pubDate>Sat, 27 Feb 2010 22:07:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.outflux.net/blog/?p=316#comment-874</guid>
		<description>if you can get gdb to follow children, you might as well just do a sh -c &#039;sleep 60; sudo ...&#039; and attach to the sh process</description>
		<content:encoded><![CDATA[<p>if you can get gdb to follow children, you might as well just do a sh -c &#8216;sleep 60; sudo &#8230;&#8217; and attach to the sh process</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kees</title>
		<link>http://www.outflux.net/blog/archives/2010/02/25/fun-with-process-scheduling/comment-page-1/#comment-871</link>
		<dc:creator>kees</dc:creator>
		<pubDate>Fri, 26 Feb 2010 23:04:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.outflux.net/blog/?p=316#comment-871</guid>
		<description>Looks like I&#039;d need &#039;set follow-fork-mode child&#039; &#039;catch exec&#039; &#039;catch fork&#039; in gdb, or this in a setuid /lib .so:
int _init(void) {
    int seconds = 0;
    char *str = getenv(&quot;SLEEP&quot;);
    if (str) seconds = atoi(str);
    sleep(seconds);
    return 0;
}</description>
		<content:encoded><![CDATA[<p>Looks like I&#8217;d need &#8216;set follow-fork-mode child&#8217; &#8216;catch exec&#8217; &#8216;catch fork&#8217; in gdb, or this in a setuid /lib .so:<br />
int _init(void) {<br />
    int seconds = 0;<br />
    char *str = getenv(&#8220;SLEEP&#8221;);<br />
    if (str) seconds = atoi(str);<br />
    sleep(seconds);<br />
    return 0;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kees</title>
		<link>http://www.outflux.net/blog/archives/2010/02/25/fun-with-process-scheduling/comment-page-1/#comment-870</link>
		<dc:creator>kees</dc:creator>
		<pubDate>Fri, 26 Feb 2010 22:33:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.outflux.net/blog/?p=316#comment-870</guid>
		<description>@Thomas hunh, cool.  I didn&#039;t realize that ld.so did such careful filtering.  I thought it just dropped LD_PRELOAD on the ground.  Yeah, that works very nicely -- jamming a sleep() in the init section of a setuid lib in /lib should work great.

@Branden I wasn&#039;t sure if gdb would play nicely across the exec (i.e. loading the new ELF image).</description>
		<content:encoded><![CDATA[<p>@Thomas hunh, cool.  I didn&#8217;t realize that ld.so did such careful filtering.  I thought it just dropped LD_PRELOAD on the ground.  Yeah, that works very nicely &#8212; jamming a sleep() in the init section of a setuid lib in /lib should work great.</p>
<p>@Branden I wasn&#8217;t sure if gdb would play nicely across the exec (i.e. loading the new ELF image).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Branden</title>
		<link>http://www.outflux.net/blog/archives/2010/02/25/fun-with-process-scheduling/comment-page-1/#comment-869</link>
		<dc:creator>Branden</dc:creator>
		<pubDate>Fri, 26 Feb 2010 19:06:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.outflux.net/blog/?p=316#comment-869</guid>
		<description>So don&#039;t directly spawn it, but rather spawn a shim process that drops priv&#039;s before then invoking the setuid process.  The debugger should be able to follow the process tree, remaining as root.</description>
		<content:encoded><![CDATA[<p>So don&#8217;t directly spawn it, but rather spawn a shim process that drops priv&#8217;s before then invoking the setuid process.  The debugger should be able to follow the process tree, remaining as root.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas</title>
		<link>http://www.outflux.net/blog/archives/2010/02/25/fun-with-process-scheduling/comment-page-1/#comment-867</link>
		<dc:creator>Thomas</dc:creator>
		<pubDate>Fri, 26 Feb 2010 12:55:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.outflux.net/blog/?p=316#comment-867</guid>
		<description>If you want to modify the behavior of the process to study without modifying the binary, you may be able to do this by having it use a modified .so through LD_PRELOAD or LD_LIBRARY_PATH. 

Why not try writing a small lib that does just kill(getpid(),SIGSTOP) and loading it through LD_PRELOAD... ?

A little googling on &quot;LD_PRELOAD setuid&quot; seem to show that some checks are done by ld.so to ignore LD_PRELOAD for setuid binaries in most cases, but that it is still doable if the lib you use is installed in the right path with the right flags. 

 http://lists.netisland.net/archives/plug/plug-2006-05/msg00018.html 

So, you&#039;re likely to need to play a little bit to get it to work, but it would seem doable that way.</description>
		<content:encoded><![CDATA[<p>If you want to modify the behavior of the process to study without modifying the binary, you may be able to do this by having it use a modified .so through LD_PRELOAD or LD_LIBRARY_PATH. </p>
<p>Why not try writing a small lib that does just kill(getpid(),SIGSTOP) and loading it through LD_PRELOAD&#8230; ?</p>
<p>A little googling on &#8220;LD_PRELOAD setuid&#8221; seem to show that some checks are done by ld.so to ignore LD_PRELOAD for setuid binaries in most cases, but that it is still doable if the lib you use is installed in the right path with the right flags. </p>
<p> <a href="http://lists.netisland.net/archives/plug/plug-2006-05/msg00018.html">http://lists.netisland.net/archives/plug/plug-2006-05/msg00018.html</a> </p>
<p>So, you&#8217;re likely to need to play a little bit to get it to work, but it would seem doable that way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kees</title>
		<link>http://www.outflux.net/blog/archives/2010/02/25/fun-with-process-scheduling/comment-page-1/#comment-866</link>
		<dc:creator>kees</dc:creator>
		<pubDate>Fri, 26 Feb 2010 01:04:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.outflux.net/blog/?p=316#comment-866</guid>
		<description>Yeah, a monster sleep or a SIGSTOP-self works, but I was hoping to do this without changing the target binary.  As for ptrace, yes, that&#039;s what gdb uses for debugging.  The problem is that I cannot directly use ptrace on a setuid process.  I want to examine the transition from unprivileged to privileged, and I can only do that if my debugger process has the caps for it (i.e. running as root).  Which means I also can&#039;t directly spawn it.</description>
		<content:encoded><![CDATA[<p>Yeah, a monster sleep or a SIGSTOP-self works, but I was hoping to do this without changing the target binary.  As for ptrace, yes, that&#8217;s what gdb uses for debugging.  The problem is that I cannot directly use ptrace on a setuid process.  I want to examine the transition from unprivileged to privileged, and I can only do that if my debugger process has the caps for it (i.e. running as root).  Which means I also can&#8217;t directly spawn it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken Bloom</title>
		<link>http://www.outflux.net/blog/archives/2010/02/25/fun-with-process-scheduling/comment-page-1/#comment-865</link>
		<dc:creator>Ken Bloom</dc:creator>
		<pubDate>Fri, 26 Feb 2010 00:58:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.outflux.net/blog/?p=316#comment-865</guid>
		<description>Maybe you could compile a custom version of sudo that runs kill(getpid(),SIGSTOP) on itself as the first thing it does, thereby giving you time all the time in the world to attach to the process and run kill -CONT when you&#039;re ready.</description>
		<content:encoded><![CDATA[<p>Maybe you could compile a custom version of sudo that runs kill(getpid(),SIGSTOP) on itself as the first thing it does, thereby giving you time all the time in the world to attach to the process and run kill -CONT when you&#8217;re ready.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Branden</title>
		<link>http://www.outflux.net/blog/archives/2010/02/25/fun-with-process-scheduling/comment-page-1/#comment-864</link>
		<dc:creator>Branden</dc:creator>
		<pubDate>Thu, 25 Feb 2010 21:28:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.outflux.net/blog/?p=316#comment-864</guid>
		<description>With ptrace(2), you can have a child process stop upon calling exec(2).  Essentially, it starts up in the stopped state.  Perhaps you can use that somehow?</description>
		<content:encoded><![CDATA[<p>With ptrace(2), you can have a child process stop upon calling exec(2).  Essentially, it starts up in the stopped state.  Perhaps you can use that somehow?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kees</title>
		<link>http://www.outflux.net/blog/archives/2010/02/25/fun-with-process-scheduling/comment-page-1/#comment-863</link>
		<dc:creator>kees</dc:creator>
		<pubDate>Thu, 25 Feb 2010 19:59:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.outflux.net/blog/?p=316#comment-863</guid>
		<description>Hmm, yeah, might work, though I think it would still be a hard race -- I&#039;d need to have something spinning with a &quot;sudo kill -STOP $(pidof sudo)&quot;.</description>
		<content:encoded><![CDATA[<p>Hmm, yeah, might work, though I think it would still be a hard race &#8212; I&#8217;d need to have something spinning with a &#8220;sudo kill -STOP $(pidof sudo)&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Markus Hochholdinger</title>
		<link>http://www.outflux.net/blog/archives/2010/02/25/fun-with-process-scheduling/comment-page-1/#comment-862</link>
		<dc:creator>Markus Hochholdinger</dc:creator>
		<pubDate>Thu, 25 Feb 2010 19:42:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.outflux.net/blog/?p=316#comment-862</guid>
		<description>What&#039;s about kill -STOP and kill -CONT?</description>
		<content:encoded><![CDATA[<p>What&#8217;s about kill -STOP and kill -CONT?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

