Re: DTrace, kernel loader, unknown probes, enable on load?

From: Bjoern A. Zeeb <bzeeb-lists_at_lists.zabbadoz.net>
Date: Sat, 12 Feb 2022 00:16:45 UTC
On Fri, 11 Feb 2022, Mark Johnston wrote:

> It appears to be sufficient to simply move the kld_load hook to before
> module registration, patch below.  In the case of a subsequent error,
> the unload hook is called so DTrace gets a chance to clean up.  I can't
> see any reasons not to move it, though there's at least one non-dtrace
> consumer that needs a look.

HWPMC?

It does work for my case with -Z which will ease work massively.
I can't wait for the "morning" and more time then to look at things :-)

Please put me on subscribers should you put up a review.

Thanks a lot Mark and a happy weekend!
Bjoern


> diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
> index 2e4c95f16c8f..55661b9f9aa2 100644
> --- a/sys/kern/kern_linker.c
> +++ b/sys/kern/kern_linker.c
> @@ -452,6 +452,7 @@ linker_load_file(const char *filename, linker_file_t *result)
> 		if (error != ENOENT)
> 			foundfile = 1;
> 		if (lf) {
> +			EVENTHANDLER_INVOKE(kld_load, lf);
> 			error = linker_file_register_modules(lf);
> 			if (error == EEXIST) {
> 				linker_file_unload(lf, LINKER_UNLOAD_FORCE);
> @@ -472,7 +473,6 @@ linker_load_file(const char *filename, linker_file_t *result)
> 				return (ENOEXEC);
> 			}
> 			linker_file_enable_sysctls(lf);
> -			EVENTHANDLER_INVOKE(kld_load, lf);
> 			*result = lf;
> 			return (0);
> 		}
>
>

-- 
Bjoern A. Zeeb                                                     r15:7