]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace: work around libdtrace-ctf bug
authorNick Alcock <nick.alcock@oracle.com>
Fri, 4 Aug 2017 16:54:24 +0000 (17:54 +0100)
committerTomas Jedlicka <tomas.jedlicka@oracle.com>
Tue, 29 Aug 2017 13:31:42 +0000 (15:31 +0200)
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 <nick.alcock@oracle.com>
Reviewed-by: Tomas Jedlicka <tomas.jedlicka@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
dtrace/dtrace_dif.c
include/dtrace/provider_defines.h

index 78d288b348d70235128a2e27b503685a16b97a9d..3bf3d51aaeafa4aee05d99bd98b18d49d0271e7a 100644 (file)
@@ -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];
 
index a4c7c60cfc41cfee396de8f4b4cb0037b09af904..89b7b83d2eb11986679b3e5a911942e5fdfbb022 100644 (file)
@@ -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;