Re: s390 && user_enable_single_step() (Was: odd utrace testingresults on s390x)

From: Martin Schwidefsky
Date: Tue Jan 05 2010 - 04:26:24 EST


On Mon, 4 Jan 2010 19:14:12 +0100
Oleg Nesterov <oleg@xxxxxxxxxx> wrote:

> On 01/04, Martin Schwidefsky wrote:
> > Subject: [PATCH] fix loading of PER control registers for utrace.
> >
> > From: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
> >
> > If the current task enables / disables PER tracing for itself the
> > PER control registers need to be loaded in FixPerRegisters.
> >
> > Signed-off-by: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
> > ---
> > arch/s390/kernel/ptrace.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > --- a/arch/s390/kernel/ptrace.c
> > +++ b/arch/s390/kernel/ptrace.c
> > @@ -98,6 +98,9 @@ FixPerRegisters(struct task_struct *task
> > per_info->control_regs.bits.storage_alt_space_ctl = 1;
> > else
> > per_info->control_regs.bits.storage_alt_space_ctl = 0;
> > +
> > + if (task == current)
> > + __ctl_load(per_info->control_regs.words, 9, 11);
> > }
>
> Yes it does fix the problem! Thanks a lot Martin.

Ok, I will add that patch to the git390 queue.

> However. Could you please look at 6580807da14c423f0d0a708108e6df6ebc8bc83d ?
> I am worried, perhaps this commit is not enough for s390. OK, do_single_step()
> tracehook_consider_fatal_signal(), this means the forked thread will not
> be killed by SIGTRAP if it is not auto-attached, but still this may be
> wrong.
>
> IOW. I think this problem is minor and probably can be ignored, but if
> I remove tracehook_consider_fatal_signal() check from do_single_step(),
>
> --- a/arch/s390/kernel/traps.c
> +++ b/arch/s390/kernel/traps.c
> @@ -382,8 +382,7 @@ void __kprobes do_single_step(struct pt_
> SIGTRAP) == NOTIFY_STOP){
> return;
> }
> - if (tracehook_consider_fatal_signal(current, SIGTRAP))
> - force_sig(SIGTRAP, current);
> + force_sig(SIGTRAP, current);
> }
>
> static void default_trap_handler(struct pt_regs * regs, long interruption_code)
> -------------------------------------------------------------------
>
> then the test-case from 6580807da14c423f0d0a708108e6df6ebc8bc83d
> fails. This probably means that copy_process()->user_disable_single_step()
> is not enough to clear the "this task wants single-stepping" copied
> from parent.

user_disable_single_step() does not remove the TIF_SINGLE_STEP bit from the
forked task. Perhaps we should just clear the bit in the function.

--
blue skies,
Martin.

"Reality continues to ruin my life." - Calvin.

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