From bc32b19051c6b4ea2cb0438b20d881301d52cc18 Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Fri, 4 Aug 2017 17:54:24 +0100 Subject: [PATCH] dtrace: work around libdtrace-ctf bug The bug involves synthesising pointers to types (ipaddr_t *, in particular) when such pointer types do not appear in the CTF files but are needed by the CTF itself. This is working in standalone modules, but not in modules with parent type containers. As a workaround, pro tem before fixing this properly in libdtrace-ctf, hack around it for the one type it is necessary for (a type that is used in the DTrace system translators, so if this type does not resolve correctly DTrace will not start). A suitable workaround is simply to introduce a use of this pointer type in the C code, and it so happens that we have a place where this would fit perfectly well. Orabug: 26583958 Signed-off-by: Nick Alcock Reviewed-by: Tomas Jedlicka Reviewed-by: Kris Van Hees --- dtrace/dtrace_dif.c | 4 +++- include/dtrace/provider_defines.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dtrace/dtrace_dif.c b/dtrace/dtrace_dif.c index 78d288b348d7..3bf3d51aaeaf 100644 --- a/dtrace/dtrace_dif.c +++ b/dtrace/dtrace_dif.c @@ -3740,6 +3740,7 @@ next: src = tupregs[argi].dttk_value; if (af == AF_INET) { ipaddr_t ip4; + ipaddr_t_p ptr4; uint8_t *ptr8, val; /* @@ -3767,7 +3768,8 @@ next: * Stringify as a dotted decimal quad. */ *end-- = '\0'; - ptr8 = (uint8_t *)&ip4; + ptr4 = &ip4; + ptr8 = (uint8_t *)ptr4; for (i = 3; i >= 0; i--) { val = ptr8[i]; diff --git a/include/dtrace/provider_defines.h b/include/dtrace/provider_defines.h index a4c7c60cfc41..89b7b83d2eb1 100644 --- a/include/dtrace/provider_defines.h +++ b/include/dtrace/provider_defines.h @@ -30,6 +30,7 @@ typedef uintptr_t dtrace_provider_id_t; typedef uintptr_t dtrace_meta_provider_id_t; typedef struct cred cred_t; typedef __be32 ipaddr_t; +typedef ipaddr_t * ipaddr_t_p; typedef struct in6_addr in6_addr_t; struct dtrace_pops; -- 2.50.1