lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240827123044.GB4679@willie-the-truck>
Date: Tue, 27 Aug 2024 13:30:45 +0100
From: Will Deacon <will@...nel.org>
To: Liao Chang <liaochang1@...wei.com>
Cc: catalin.marinas@....com, ptosi@...gle.com, oliver.upton@...ux.dev,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] arm64: Return early when break handler is found on
 linked-list

On Tue, Aug 27, 2024 at 11:00:46AM +0000, Liao Chang wrote:
> The search for breakpoint handlers iterate through the entire
> linked list. Given that all registered hook has a valid fn field, and no
> registered hooks share the same mask and imm. This commit optimize the
> efficiency slightly by returning early as a matching handler is found.
> 
> Signed-off-by: Liao Chang <liaochang1@...wei.com>
> ---
>  arch/arm64/kernel/debug-monitors.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
> index 024a7b245056..fc998956f44c 100644
> --- a/arch/arm64/kernel/debug-monitors.c
> +++ b/arch/arm64/kernel/debug-monitors.c
> @@ -281,6 +281,7 @@ static LIST_HEAD(kernel_break_hook);
>  
>  void register_user_break_hook(struct break_hook *hook)
>  {
> +	WARN_ON(!hook->fn);
>  	register_debug_hook(&hook->node, &user_break_hook);
>  }
>  
> @@ -291,6 +292,7 @@ void unregister_user_break_hook(struct break_hook *hook)
>  
>  void register_kernel_break_hook(struct break_hook *hook)
>  {
> +	WARN_ON(!hook->fn);
>  	register_debug_hook(&hook->node, &kernel_break_hook);
>  }

I don't think we need these WARN_ON()s. This API is pretty limited and
passing a NULL callback doesn't make sense.

Rest of the patch looks fine.

Will

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ