[PATCH 1/2] ARM: Introduce THREAD_NOTIFY_COPY for copy_thread() hooks

Will Deacon will.deacon at arm.com
Mon Feb 14 07:12:05 EST 2011


Hi Catalin,

> Subject: [PATCH 1/2] ARM: Introduce THREAD_NOTIFY_COPY for copy_thread() hooks
> 
> This patch adds THREAD_NOTIFY_COPY for colling registered handlers
> during the copy_thread() function call. It also changes the VFP handler
> to use a switch statement rather than if..else and ignore this event.
> 
> Signed-off-by: Catalin Marinas <catalin.marinas at arm.com>
> ---
>  arch/arm/include/asm/thread_notify.h |    1 +
>  arch/arm/kernel/process.c            |    2 ++
>  arch/arm/vfp/vfpmodule.c             |   22 +++++++++++++++-------
>  3 files changed, 18 insertions(+), 7 deletions(-)

This would be useful for the hw-breakpoint code, where we need to clear
(memset 0) the breakpoint structures in the child so that they don't get
unregistered later on.

However, we also need to flush (unregister) breakpoints in flush_thread
so that they don't persist across an exec. Ideally, we'd have a single
notifier block and act on THREAD_NOTIFY_{FLUSH,COPY} accordingly, but
the problem is that THREAD_NOTIFY_FLUSH is only notified *after* zeroing
most of the thread structure, so the call is currently inlined into
flush_thread and we don't use a notifier.

This could be solved by either notifying the FLUSH before zeroing the
various thread structures or by moving the zeroing of the debug struct
into the hw-breakpoint notifier. The latter probably makes more sense
once we've removed the single-step functionality from ptrace.

Will








More information about the linux-arm-kernel mailing list