systemtap/SOURCES/rhbz1868095.patch
2021-09-10 05:04:30 +00:00

238 lines
11 KiB
Diff

diff --git a/java/HelperSDT.c b/java/HelperSDT.c
index ea08b8d..4b3271d 100644
--- a/java/HelperSDT.c
+++ b/java/HelperSDT.c
@@ -47,7 +47,7 @@ static int64_t determine_java_type(JNIEnv *env, jobject _arg, _Bool *need_free)
{
if ((*env)->IsSameObject(env, _arg, NULL)) {
*need_free = 1;
- return (int64_t) strdup("(null)"); /* need a real string to avoid user_string_warn getting upset */
+ return (int64_t) (uintptr_t) strdup("(null)"); /* need a real string to avoid user_string_warn getting upset */
}
jclass class_arg = (*env)->GetObjectClass(env, _arg);
@@ -87,7 +87,7 @@ static int64_t determine_java_type(JNIEnv *env, jobject _arg, _Bool *need_free)
(*env)->ExceptionClear(env);
/* Not a simple numeric scalar. Caller must free(). */
*need_free = true;
- return (int64_t) get_java_tostring(env, _arg);
+ return (int64_t) (uintptr_t) get_java_tostring(env, _arg);
}
static char *alloc_sargs(int64_t *sargs, _Bool *sfree, JNIEnv *env,
@@ -106,7 +106,7 @@ static void free_sargs(char *rulename, int64_t *sargs, _Bool *sfree, int num)
int i;
for (i = 0;i < num; i++)
if (sfree[i])
- free((void *) sargs[i]);
+ free((void *) (uintptr_t) sargs[i]);
free(rulename);
}
diff --git a/tapset/linux/conversions.stp b/tapset/linux/conversions.stp
index cfea83c..82f535f 100644
--- a/tapset/linux/conversions.stp
+++ b/tapset/linux/conversions.stp
@@ -26,7 +26,8 @@ deref_fault: /* branched to from deref_string() */
* really odd in the following error message. Setting a format
* width of '1' fixes this. */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel string copy fault at 0x%p [man error::fault]", (void *) (uintptr_t) STAP_ARG_addr);
+ "kernel string copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -67,7 +68,8 @@ function kernel_string_quoted:string (addr:long)
(char *)(uintptr_t)STAP_ARG_addr,
MAXSTRINGLEN, MAXSTRINGLEN, 1, 0, 0);
if (STAP_ARG_addr == 0 || rc < 0)
- snprintf(STAP_RETVALUE, MAXSTRINGLEN, "%p", (void *)(uintptr_t)STAP_ARG_addr);
+ snprintf(STAP_RETVALUE, MAXSTRINGLEN, "0x%lx",
+ (unsigned long)(uintptr_t)STAP_ARG_addr);
%}
/**
@@ -86,7 +88,8 @@ function kernel_string_n:string (addr:long, n:long) %{ /* pure */
if (0) {
deref_fault: /* branched to from deref_string() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel string copy fault at 0x%p [man error::fault]", (void *) (uintptr_t) STAP_ARG_addr);
+ "kernel string copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -110,7 +113,8 @@ function kernel_string_utf32:string (addr:long) %{ /* pure */
if ((rc = _stp_convert_utf32(destination, len, c32)) <= 0) {
if (rc < 0) {
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "invalid UTF-32 character U+%X at 0x%p", c32, source);
+ "invalid UTF-32 character U+%X at 0x%lx", c32,
+ (unsigned long) (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
break;
@@ -123,7 +127,8 @@ function kernel_string_utf32:string (addr:long) %{ /* pure */
if (0) {
deref_fault: /* branched to from deref_string() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel string copy fault at 0x%p [man error::fault]", source);
+ "kernel string copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -189,7 +194,8 @@ function kernel_string_utf16:string (addr:long) %{ /* pure */
if ((rc = _stp_convert_utf32(destination, len, c32)) <= 0) {
if (rc < 0) {
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "invalid UTF-16 character U+%X at 0x%p", c32, source);
+ "invalid UTF-16 character U+%X at 0x%lx", c32,
+ (unsigned long) (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
break;
@@ -202,7 +208,8 @@ function kernel_string_utf16:string (addr:long) %{ /* pure */
if (0) {
deref_fault: /* branched to from deref_string() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel string copy fault at 0x%p [man error::fault]", source);
+ "kernel string copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -249,7 +256,8 @@ function kernel_long:long (addr:long) %{ /* pure */
if (0) {
deref_fault: /* branched to from kread() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel long copy fault at 0x%p [man error::fault]", (void *) (uintptr_t) STAP_ARG_addr);
+ "kernel long copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -267,7 +275,8 @@ function kernel_int:long (addr:long) %{ /* pure */
if (0) {
deref_fault: /* branched to from kread() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel int copy fault at 0x%p [man error::fault]", (void *) (uintptr_t) STAP_ARG_addr);
+ "kernel int copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -285,7 +294,8 @@ function kernel_short:long (addr:long) %{ /* pure */
if (0) {
deref_fault: /* branched to from kread() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel short copy fault at 0x%p [man error::fault]", (void *) (uintptr_t) STAP_ARG_addr);
+ "kernel short copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -303,7 +313,8 @@ function kernel_char:long (addr:long) %{ /* pure */
if (0) {
deref_fault: /* branched to from kread() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel char copy fault at 0x%p [man error::fault]", (void *) (uintptr_t) STAP_ARG_addr);
+ "kernel char copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -322,7 +333,8 @@ function kernel_pointer:long (addr:long) %{ /* pure */
if (0) {
deref_fault: /* branched to from kread() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel pointer copy fault at 0x%p [man error::fault]", (void *) (uintptr_t) STAP_ARG_addr);
+ "kernel pointer copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
diff --git a/tapset/uconversions.stp b/tapset/uconversions.stp
index 1b2b52e..83790e9 100644
--- a/tapset/uconversions.stp
+++ b/tapset/uconversions.stp
@@ -126,7 +126,7 @@ function user_string_n:string (addr:long, n:long)
strlcpy(STAP_RETVALUE, "<unknown>", MAXSTRINGLEN);
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
"user string copy fault %ld at 0x%lx [man error::fault]", rc,
- (uintptr_t) STAP_ARG_addr);
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
} else
STAP_RETVALUE[len - 1] = '\0';
@@ -228,8 +228,8 @@ function user_string_n_warn:string (addr:long, n:long, warn_msg:string)
// NB: using error_buffer to get local space for the warning, but we're
// not aborting, so leave last_error alone.
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "user string copy fault 0x%ld at %lx [man error::fault]", rc,
- (void *) (uintptr_t) STAP_ARG_addr);
+ "user string copy fault %ld at 0x%lx [man error::fault]", rc,
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
_stp_warn(CONTEXT->error_buffer);
strlcpy (STAP_RETVALUE, STAP_ARG_warn_msg, MAXSTRINGLEN);
} else
@@ -335,7 +335,7 @@ function user_string_n_quoted:string (addr:long, inlen:long, outlen:long)
else
#endif
snprintf(STAP_RETVALUE, MAXSTRINGLEN, "0x%lx",
- (uintptr_t)STAP_ARG_addr);
+ (unsigned long) (uintptr_t)STAP_ARG_addr);
#endif
}
}
@@ -366,7 +366,8 @@ function user_string_utf32:string (addr:long) %{ /* pure */ /* myproc-unprivileg
if ((rc = _stp_convert_utf32(destination, len, c32)) <= 0) {
if (rc < 0) {
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "invalid UTF-32 character U+%X at 0x%lx", c32, (uintptr_t) source);
+ "invalid UTF-32 character U+%X at 0x%lx", c32,
+ (unsigned long) (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
break;
@@ -379,7 +380,8 @@ function user_string_utf32:string (addr:long) %{ /* pure */ /* myproc-unprivileg
if (0) {
deref_fault: /* branched to from deref_string() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "user string copy fault at 0x%lx [man error::fault]", (uintptr_t) source);
+ "user string copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -447,7 +449,8 @@ function user_string_utf16:string (addr:long) %{ /* pure */ /* myproc-unprivileg
if ((rc = _stp_convert_utf32(destination, len, c32)) <= 0) {
if (rc < 0) {
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "invalid UTF-16 character U+%X at 0x%lx", c32, source);
+ "invalid UTF-16 character U+%X at 0x%lx", c32,
+ (unsigned long) (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
break;
@@ -460,7 +463,8 @@ function user_string_utf16:string (addr:long) %{ /* pure */ /* myproc-unprivileg
if (0) {
deref_fault: /* branched to from deref_string() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "user string copy fault at 0x%lx [man error::fault]", (uintptr_t) source);
+ "user string copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -532,7 +536,7 @@ function user_char_warn:long (addr:long) {
try {
return user_char_error(addr)
} catch {
- warn(sprintf("user char copy fault %p [man error::fault]",
+ warn(sprintf("user char copy fault at %p [man error::fault]",
addr))
return 0
}