[DTrace-devel] [PATCH 2/2] lockstat: refuse to provide probes on kernels < 5.10.0
Nick Alcock
nick.alcock at oracle.com
Fri May 26 21:12:50 UTC 2023
On 26 May 2023, Kris Van Hees via DTrace-devel outgrape:
> Kernels earlier than 5.10.0 contain a bug that causes a kernel deadlock
> when using kretprobe on spinlock functions. We do not provide lockstat
> probes on such kernels for the user's safety.
>
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
> libdtrace/dt_prov_lockstat.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/libdtrace/dt_prov_lockstat.c b/libdtrace/dt_prov_lockstat.c
> index cc827660..60a78fda 100644
> --- a/libdtrace/dt_prov_lockstat.c
> +++ b/libdtrace/dt_prov_lockstat.c
> @@ -9,6 +9,7 @@
> #include <assert.h>
> #include <errno.h>
> #include <stdlib.h>
> +#include <linux/version.h>
>
> #include "dt_dctx.h"
> #include "dt_cg.h"
> @@ -100,6 +101,13 @@ static const dtrace_pattr_t pattr = {
> */
> static int populate(dtrace_hdl_t *dtp)
> {
> + /*
> + * Linux kernels earlier than 5.10.0 have a bug that can cause a kernel
> + * deadlock when placing a kretprobe on spinlock functions.
> + */
> + if (dtp->dt_kernver < KERNEL_VERSION(5, 10, 0))
> + return 0;
Not quite, I fear. dt_kernver is populated from a string representation
of the kernel version:
*vp = DT_VERSION_NUMBER(kv1, kv2, kv3);
where DT_VERSION_NUMBER is
((((M) & 0xFF) << 24) | (((m) & 0xFFF) << 12) | ((u) & 0xFFF))
But KERNEL_VERSION is
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
These are *not the same*, and you can't use the one to compare with the
other.
I think you have to use DT_VERSION_NUMBER here, not KERNEL_VERSION.
(If this actually works, my apologies: hay fever is doing a number on my
mental functioning :/ )
--
NULL && (void)
More information about the DTrace-devel
mailing list