Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jan 2023 18:30:16 +1300
From:      Kristof Provost <kp@FreeBSD.org>
To:        Andrew Gallatin <gallatin@FreeBSD.org>
Cc:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   Re: git: da81cc6035f8 - main - dtrace: conditionally load the systrace_linux klds when loading dtrace.
Message-ID:  <00187534-3A6D-471D-B9DD-6CD42486DA3C@FreeBSD.org>
In-Reply-To: <202301240138.30O1cfL7004112@gitrepo.freebsd.org>
References:  <202301240138.30O1cfL7004112@gitrepo.freebsd.org>

index | next in thread | previous in thread | raw e-mail

On 24 Jan 2023, at 14:38, Andrew Gallatin wrote:
> The branch main has been updated by gallatin:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=da81cc6035f8283b6adda1ef466977e8c1c5389e
>
> commit da81cc6035f8283b6adda1ef466977e8c1c5389e
> Author:     Andrew Gallatin <gallatin@FreeBSD.org>
> AuthorDate: 2023-01-24 01:27:17 +0000
> Commit:     Andrew Gallatin <gallatin@FreeBSD.org>
> CommitDate: 2023-01-24 01:36:24 +0000
>
>     dtrace: conditionally load the systrace_linux klds when loading dtrace.
>
>     When dtrace starts, it tries to detect if the dtrace klds are loaded,
>     and if not, it loads them by loading the dtraceall kld. This module
>     depends on most dtrace modules, including systrace for the native
>     freebsd and freebsd32 ABIs. However, it does not depend on the
>     systrace_linux klds, as they in turn depend on the linux ABI klds, and
>     we don't want to load an ABI module that the user has not explicitly
>     requested. This can leave a naive user in a state where they think all
>     syscall providers have been loaded, yet linux ABI syscalls are
>     "invisible" to dtrace.
>
>     To fix this, check to see if the linux ABI modules are loaded. If they
>     are, then load their systrace klds.
>
>     Reviewed by: markj, (emaste & jhb, earlier versions)
>     Sponsored by: Netflix
>     Differential Revision: https://reviews.freebsd.org/D37986
> ---
>  cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
> index 867259b5d77c..e11cdc954683 100644
> --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
> +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
> @@ -1115,6 +1115,15 @@ dt_vopen(int version, int flags, int *errp,
>  	 */
>  	if (err == ENOENT && modfind("dtraceall") < 0) {
>  		kldload("dtraceall"); /* ignore the error */
> +#if __SIZEOF_LONG__ == 8
> +		if (modfind("linux64elf") >= 0)
> +			kldload("systrace_linux");
> +		if (modfind("linuxelf") >= 0)
> +			kldload("systrace_linux32");
> +#else
> +		if (modfind("linuxelf") >= 0) {

Trond spotted the extra brace here.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269128

> +			kldload("systrace_linux");
> +#endif
>  		dtfd = open("/dev/dtrace/dtrace", O_RDWR | O_CLOEXEC);
>  		err = errno;
>  	}

—
Kristof


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00187534-3A6D-471D-B9DD-6CD42486DA3C>