i386 TIF flags for debug regs and io bitmap in ctxsw (v2)
In-Reply-To: <[email protected]>
Quoted 24 lines · Stephane Eranian
I would like to follow-up the TIF flags and especially on the rules of inheritance. It appears the TIF flags are copied from parent to child task systematically on
copy_process. Then they are adjusted incopy_threads()or sub-functions.The
TIF_IO_BITMAPis checked incopy_threads()with the following code:int copy_thread(int nr, unsigned long
clone_flags, unsigned long esp,
unsigned long unused,
structtask_struct* p, structpt_regs* regs){ .... if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) { p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL); if (!p->thread.io_bitmap_ptr) { p->thread.io_bitmap_max = 0; return -ENOMEM; } memcpy(p->thread.io_bitmap_ptr, tsk->thread.io_bitmap_ptr, IO_BITMAP_BYTES); set_tsk_thread_flag(p, TIF_IO_BITMAP); }
Quoted 2 lines
I would think that the
set_tsk_thread_flag()is extraneous.
Yeah. But harmless.
Quoted 2 lines
As for
TIF_DEBUG, my patch is not clearing it. I don't think you can have HW breakpoints be inherited from one task to the other.
Looks like the debug regs get copied on fork and only cleared on exec in flush_thread(). So this should be OK. Please doublecheck.
(The new TIF_DEBUG flag went into 2.8.18-rc, in case you didn't notice.)
Signature · 1 line
Chuck
Chuck,
Quoted 7 lines · Chuck Ebbert
Quoted 3 lines
As for
TIF_DEBUG, my patch is not clearing it. I don't think you can have HW breakpoints be inherited from one task to the other.Looks like the debug regs get copied on fork and only cleared on exec in
flush_thread(). So this should be OK. Please doublecheck.
How is this supposed to work? You can set debug registers via ptrace(). So A is ptracing B and sets up breakpoints in B. Now, if B forks C, C inherits the breakpoints of B. But what about the ptracing and re-parenting that is associated with this? If A does not know about C, I wonder how this could be work and be useful?
Quoted 1 line
(The new
TIF_DEBUGflag went into 2.8.18-rc, in case you didn't notice.)
I did not keep track but thanks or this update. That's great!
Signature · 1 line
-Stephane