Re: ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes

2006-07-18 Thread Alexandre Julliard
Thomas Kho [EMAIL PROTECTED] writes: I was thinking that cloning the process could take care of deadlocks. What if the cloned thread fudges its teb and sets a different thread id than its cloning thread? This invalidates all locks in the cloned thread taken by the cloning thread. Both threads

Re: ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes

2006-07-17 Thread Alexandre Julliard
Dan Kegel [EMAIL PROTECTED] writes: I guess the worst case is the signal will be delivered at the beginning of the next time slice, so that shouldn't be too long. There's no need to wait for that. On a UP system obviously the thread is interrupted already since you are doing a kill syscall. On

Re: ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes

2006-07-17 Thread Alexandre Julliard
Dan Kegel [EMAIL PROTECTED] writes: I'm afraid I don't quite understand. What's wrong with interrupting a thread holding a lock? Could that make cloning a new thread deadlock? One problem is that many locks have to be acquired in a specific order to avoid deadlocks, and since you don't know

Re: ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes

2006-07-17 Thread Andreas Mohr
Hi, On Mon, Jul 17, 2006 at 01:08:38PM +0200, Alexandre Julliard wrote: Dan Kegel [EMAIL PROTECTED] writes: I'm afraid I don't quite understand. What's wrong with interrupting a thread holding a lock? Could that make cloning a new thread deadlock? One problem is that many locks

Re: ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes

2006-07-17 Thread Thomas Kho
On 7/17/06, Alexandre Julliard [EMAIL PROTECTED] wrote: Dan Kegel [EMAIL PROTECTED] writes: I'm afraid I don't quite understand. What's wrong with interrupting a thread holding a lock? Could that make cloning a new thread deadlock? One problem is that many locks have to be acquired in a

ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes

2006-07-16 Thread Mike Hearn
[forgot to hit reply to all instead of just reply ...] On 7/15/06, Dan Kegel [EMAIL PROTECTED] wrote: The right thing to do would be to promote the linux thread to be a win32 thread, but as a temporary stopgap, Thomas had the linux thread just do CreateThread and exit, hoping that the newly

Re: ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes

2006-07-16 Thread Dan Kegel
On 7/16/06, Mike Hearn [EMAIL PROTECTED] wrote: Well, I think calling CreateThread directly from the context of the hijacked thread would be simpler, though I understand that gets hairy as well if the hijacked thread is holding (say) the loader lock I'd rather not take the chance of doing

Re: ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes

2006-07-16 Thread Mike Hearn
On 7/16/06, Dan Kegel [EMAIL PROTECTED] wrote: I'd rather not take the chance of doing anything that messes with the poor thread we're hijacking.Hmm... http://lwn.net/Articles/7577/ makes me think that converting a linux thread to a win32 thread might require initializing the thread's TLS

Re: ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes

2006-07-16 Thread Dan Kegel
On 7/16/06, Mike Hearn [EMAIL PROTECTED] wrote: On 7/16/06, Dan Kegel [EMAIL PROTECTED] wrote: I'd rather not take the chance of doing anything that messes with the poor thread we're hijacking.Hmm... http://lwn.net/Articles/7577/ makes me think that converting a linux thread to a win32

Re: ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes

2006-07-16 Thread Alexandre Julliard
Dan Kegel [EMAIL PROTECTED] writes: Well, kind of. Signals are only delivered when syscalls return, so they won't work well if the thread you pick to molest happens to not make any syscalls for a long time. Signals certainly don't need system calls to be delivered. IMO they would be more

Re: ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes

2006-07-16 Thread Mike Hearn
On 7/16/06, Alexandre Julliard [EMAIL PROTECTED] wrote: Cloning a new thread is not going to help with this at all, since it still uses the Win32 context of the original thread, so it only makes things worse. What then is the solution? A service thread? I think it'd be OK to have the hijacked

Re: ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes

2006-07-16 Thread Dan Kegel
On 7/16/06, Alexandre Julliard [EMAIL PROTECTED] wrote: Well, kind of. Signals are only delivered when syscalls return, so they won't work well if the thread you pick to molest happens to not make any syscalls for a long time. Signals certainly don't need system calls to be delivered. I

Re: ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes

2006-07-16 Thread Dan Kegel
On 7/16/06, Dan Kegel [EMAIL PROTECTED] wrote: On 7/16/06, Alexandre Julliard [EMAIL PROTECTED] wrote: Well, kind of. Signals are only delivered when syscalls return, so they won't work well if the thread you pick to molest happens to not make any syscalls for a long time. Signals

Re: ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes

2006-07-15 Thread Mike Hearn
-mike On Fri, 14 Jul 2006 19:59:51 -0700, Thomas Kho wrote: ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes Greetings,

re: ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes

2006-07-15 Thread Dan Kegel
Mike wrote: ... I'm not sure how this works. You create a new raw kernel thread using clone, then run NT code using it. But that isn't valid and may not work - only threads created by Wine may use Win32. The right thing to do would be to promote the linux thread to be a win32 thread, but as a