On 08/14, Sebastian Andrzej Siewior wrote:
>
> On 08/13/2012 03:24 PM, Oleg Nesterov wrote:
>>
>> this patch still adds restore_flags into arch_uprobe_task.
>
> Yes, but

OOPS. Yes, we need a new member in ->utask now to record the state
of TIF_SINGLESTEP (X86_EFLAGS_TF actually).

I meant that, since the patch still uses TIF_SINGLESTEP,
arch_uprobe_disable_step() can check it but somehow I forgot that
since arch_uprobe_enable_step() still does user_enable_single_step()
TIF_SINGLESTEP is always set.

>>>   static void prepare_fixups(struct arch_uprobe *auprobe, struct insn *insn)
>>>   {
>>> -   bool fix_ip = true, fix_call = false;   /* defaults */
>>> +   bool fix_ip = true, fix_call = false, fix_tf = false;   /* defaults */
>>>     int reg;
>>>
>>>     insn_get_opcode(insn);  /* should be a nop */
>>>
>>>     switch (OPCODE1(insn)) {
>>> +   case 0x9d:
>>> +           /* popf */
>>> +           fix_tf = true;
>>> +           break;
>>>     case 0xc3:              /* ret/lret */
>>>     case 0xcb:
>>>     case 0xc2:
>>> @@ -277,6 +284,8 @@ static void prepare_fixups(struct arch_uprobe *auprobe, 
>>> struct insn *insn)
>>>             auprobe->fixups |= UPROBE_FIX_IP;
>>>     if (fix_call)
>>>             auprobe->fixups |= UPROBE_FIX_CALL;
>>> +   if (fix_tf)
>>> +           auprobe->fixups |= UPROBE_TF_CHANGES;
>>>   }
>>
>> I won't insist, but do we really need fix_tf? "case 0x9d" could simply
>> add UPROBE_TF_CHANGES.
>
> if it is not 0x9d (in most cases) we need to decide on per-process
> basis (not per-breakpoint) whether the task has gdb watching it or not.

Yes, yes, I see, thanks.

But this doesn't explain why do we need to add the new variable, fix_tf.

        case 0x9d:
                auprobe->fixups |= UPROBE_TF_CHANGES;
                break;

seems enough.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to