On 08/17, Roland McGrath wrote:
>
> @@ -1033,6 +1042,18 @@ int utrace_control(struct task_struct *target,
>       if (unlikely(action > UTRACE_DETACH))
>               return -EINVAL;
>
> +     /*
> +      * This is a sanity check for a programming error in the caller.
> +      * Their request can only work properly in all cases by relying on
> +      * a follow-up callback, but they didn't set one up!  This check
> +      * doesn't do locking, but it shouldn't matter.  The caller has to
> +      * be synchronously sure the callback is set up to be operating the
> +      * interface properly.
> +      */
> +     if (action >= UTRACE_REPORT && action < UTRACE_RESUME &&
> +         unlikely(!(engine->flags & UTRACE_EVENT(QUIESCE))))
> +             return -EINVAL;

Agreed, this can help to catch the problems.

Unfortunately, this doesn't help if a module doesn't use utrace_control()
but just returns UTRACE_SINGLESTEP/etc. Like Srikar's test-case does.

But I guess we can do nothing in this case, except perhaps we could add
pr_debug() into finish_callback(). I dunno. And in any case, the warning
from finish_callback() can't be always correct.

Oleg.

Reply via email to