On Thursday 27 December 2012 02:30 PM, Vineet Gupta wrote:
> On Friday 16 November 2012 10:28 AM, Al Viro wrote:
>>> +   ; --------- check for signals/restore-sigmask ------------
>>> +   bbit0  r9, TIF_SIGPENDING, chk_next_work
>>> +
>>> +   ; save CALLEE Regs.
>>> +   ; (i)  If this signal causes coredump - full regfile needed
>>> +   ; (ii) If signal is SIGTRAP/SIGSTOP, task is being traced thus
>>> +   ;      tracer might call PEEKUSR for a CALLEE reg
>>> +   ;
>>> +   ; NOTE: SP will grow up by size of CALLEE Reg-File
>>> +   SAVE_CALLEE_SAVED_USER          ; clobbers r12
>>> +
>>> +   ; save location of saved Callee Regs @ thread_struct->callee
>>> +   GET_CURR_TASK_FIELD_PTR   TASK_THREAD, r10
>>> +   st  sp, [r10, THREAD_CALLEE_REG]
>>> +
>>> +   bl  @do_signal
>>> +
>>> +   ; unwind SP for cheap discard of Callee saved Regs
>>> +   DISCARD_CALLEE_SAVED_USER
>> Uh-oh...  And what if tracer wanted to modify callee-saved regs?
> 
> So the solution would be to either unconditionally restore all the 13 callee 
> regs
> - or add additional state (struct thread) where ptrace makes a note that it 
> wrote
> to a callee reg which is used here to conditional-ize the restore. Former is
> simpler to do - although it might ill-affect micro-benchmarks such as LMBench
> lat_sig. Anyhow correctness comes before optimization.

Havign coded above, I just couldn't accept the anti-optimization here. Is it
absolute sin to take a look at current->ptrace != 0 in deciding whether to
save/restore the regs. However that won't work for coredump case.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
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