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

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

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 m

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

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 syscal

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. > > Si

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.

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 hijacke

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 mo

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 wi

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 a

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 any

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

Re: ntdll: enable CreateRemoteThread and RtlCreateUserThread for remote processes

2006-07-15 Thread Mike Hearn
Heya, First of all 'mad propz' to you for tackling this. I have no strong opinion on whether this approach of hijacking a thread is better than having a service thread, that's Alexandres call. But a few comments on the way you've done things here: I don't think there's any reason to use Linux spe