On 11/16, Roland McGrath wrote:
>
> Whatever temporary hacks are fine by me one way or the other.
> They will just be coming out later along with assorted other cleanup.
> We certainly do want to get this right in the utrace layer.

Yes. But imho it is always good to test/review the patches against
the working kernel. The patch I sent is very simple, and can be
easily reverted once we improve utrace.

IOW, I am asking you to apply my patch for now and revert your
change to have the working tree, then discuss the "right" fix.

> The change we talked about before seems simple enough and should cover this
> without new kludges in the ptrace layer.  I did this (commit f19442c).

I don't think this can work.

        tracehook_report_syscall_exit(step)

                if (step || UTRACE_EVENT(SYSCALL_EXIT))
                        utrace_report_syscall_exit(step);

and,
        utrace_report_syscall_exit(step)

                if (step)
                        send_sigtrap();

The problems is: we can trust "bool step", and in fact we do
not need it at all.

Once again. The tracee sleeps in SYSCALL_ENTER. The tracer resumes
the tracee via utrace_control(UTRACE_SINGLESTEP).

By the time the resumed tracee passes tracehook_report_syscall_exit()
step == F, utrace_control() does not set TIF_SINGLESTEP.

So, I think we should do something like

        tracehook_report_syscall_exit(step)

                // do not use step at all
                if (task_utrace_flags() != 0)
                        utrace_report_syscall_exit();

                // this code below is only for old ptrace

                if (step && (task_ptrace(current) & PT_PTRACED))
                        send_sigtrap();
                ptrace_report_syscall();

and,
        utrace_report_syscall_exit()

                if (UTRACE_EVENT(SYSCALL_EXIT))
                        REPORT(report_syscall_exit);

                if (utrace->resume == UTRACE_SINGLESTEP ||
                    utrace->resume == UTRACE_BLOCKSTEP)
                        send_sigtrap();

What do you think?

Oleg.

Reply via email to