11bae0
11bae0
Fix the extension trace.so for RHEL7.6, which moved
11bae0
ftrace_event_call.data into an anonymous union, and the
11bae0
previous offset has changed, so the trace.so extension
11bae0
module fails to load, indicating "no commands registered:
11bae0
shared object unloaded".
11bae0
11bae0
--- crash-trace-command-2.0/trace.c.orig
11bae0
+++ crash-trace-command-2.0/trace.c
11bae0
@@ -853,8 +853,18 @@ static int syscall_get_enter_fields(ulon
11bae0
 	inited = 1;
11bae0
 	data_offset = MAX(MEMBER_OFFSET("ftrace_event_call", "data"), 
11bae0
 		MEMBER_OFFSET("trace_event_call", "data"));
11bae0
-	if (data_offset < 0)
11bae0
-		return -1;
11bae0
+	if (data_offset < 0) {
11bae0
+		/*
11bae0
+		 *  rhel-7.6 moved the .data member into an anonymous union.
11bae0
+		 */
11bae0
+		if (MEMBER_EXISTS("ftrace_event_call", "rh_data") &&
11bae0
+		    MEMBER_EXISTS("ftrace_event_data", "data")) {
11bae0
+			data_offset = MEMBER_OFFSET("ftrace_event_call", "rh_data") +
11bae0
+				MEMBER_OFFSET("ftrace_event_data", "data");
11bae0
+			inited = 2;
11bae0
+		} else
11bae0
+			return -1;
11bae0
+	}
11bae0
 
11bae0
 	enter_fields_offset = MEMBER_OFFSET("syscall_metadata", "enter_fields");
11bae0
 	if (enter_fields_offset < 0)
11bae0
@@ -868,6 +878,12 @@ work:
11bae0
 			"read ftrace_event_call data", RETURN_ON_ERROR))
11bae0
 		return -1;
11bae0
 
11bae0
+	if (inited == 2) {
11bae0
+		if (!readmem(metadata, KVADDR, &metadata, sizeof(metadata),
11bae0
+		    "read ftrace_event_call data (indirect rh_data)", RETURN_ON_ERROR))
11bae0
+			return -1;
11bae0
+	}
11bae0
+
11bae0
 	*fields = metadata + enter_fields_offset;
11bae0
 	return 0;
11bae0
 }