mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 14:04:54 +02:00
Probes fixes for v6.8-rc3:
- kprobes: Remove unnecessary initial values of local variables.
- tracing/probe-events: Fixing parser bugs.
. Fix to calculate the argument size and format string after setting
type information from BTF, because BTF can change the size and format
string.
. Fix to show $comm parse error correctly instead of failing silently.
-----BEGIN PGP SIGNATURE-----
iQFPBAABCgA5FiEEh7BulGwFlgAOi5DV2/sHvwUrPxsFAmXGBlUbHG1hc2FtaS5o
aXJhbWF0c3VAZ21haWwuY29tAAoJENv7B78FKz8br98H/iP/rcGjP9WlnnYmUTXg
GFckr381X3PwyHKgcYyyzKlbNtl3PS4rruSXJnR3loIys7zPN4kJII8vnn4bnHex
djUv/5hoznKhEN/jItojm7Fip9gCdhQ9TDNPOXVcrBzwMyYVUBBlqaL+lY9isPnF
JGOWHa0FhM2mT6IsXW9Rg7cqECB0n6wB6wfrcv/KBFNr2KDll9Kbg7SOrYl6KvyV
kTRoV3MY3M9U4fRn3N6mZw6YU8i7q+cShVMs7mNaaz9cc09Q6mYcaa9H4l9ecz6p
woetR68yrYq+8A95byYh3vF7ChL4/BJKvTgsrXKEuraxkpDujYVOT7AKLAeNuBIk
Hcs=
=htgp
-----END PGP SIGNATURE-----
Merge tag 'probes-fixes-v6.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull probes fixes from Masami Hiramatsu:
- remove unnecessary initial values of kprobes local variables
- probe-events parser bug fixes:
- calculate the argument size and format string after setting type
information from BTF, because BTF can change the size and format
string.
- show $comm parse error correctly instead of failing silently.
* tag 'probes-fixes-v6.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
kprobes: Remove unnecessary initial values of variables
tracing/probes: Fix to set arg size and fmt after setting type from BTF
tracing/probes: Fix to show a parse error for bad type for $comm
This commit is contained in:
commit
6dc512a0a2
|
|
@ -1993,7 +1993,7 @@ NOKPROBE_SYMBOL(__kretprobe_find_ret_addr);
|
|||
unsigned long kretprobe_find_ret_addr(struct task_struct *tsk, void *fp,
|
||||
struct llist_node **cur)
|
||||
{
|
||||
struct kretprobe_instance *ri = NULL;
|
||||
struct kretprobe_instance *ri;
|
||||
kprobe_opcode_t *ret;
|
||||
|
||||
if (WARN_ON_ONCE(!cur))
|
||||
|
|
@ -2802,7 +2802,7 @@ static int show_kprobe_addr(struct seq_file *pi, void *v)
|
|||
{
|
||||
struct hlist_head *head;
|
||||
struct kprobe *p, *kp;
|
||||
const char *sym = NULL;
|
||||
const char *sym;
|
||||
unsigned int i = *(loff_t *) v;
|
||||
unsigned long offset = 0;
|
||||
char *modname, namebuf[KSYM_NAME_LEN];
|
||||
|
|
|
|||
|
|
@ -1159,9 +1159,12 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size,
|
|||
if (!(ctx->flags & TPARG_FL_TEVENT) &&
|
||||
(strcmp(arg, "$comm") == 0 || strcmp(arg, "$COMM") == 0 ||
|
||||
strncmp(arg, "\\\"", 2) == 0)) {
|
||||
/* The type of $comm must be "string", and not an array. */
|
||||
if (parg->count || (t && strcmp(t, "string")))
|
||||
/* The type of $comm must be "string", and not an array type. */
|
||||
if (parg->count || (t && strcmp(t, "string"))) {
|
||||
trace_probe_log_err(ctx->offset + (t ? (t - arg) : 0),
|
||||
NEED_STRING_TYPE);
|
||||
goto out;
|
||||
}
|
||||
parg->type = find_fetch_type("string", ctx->flags);
|
||||
} else
|
||||
parg->type = find_fetch_type(t, ctx->flags);
|
||||
|
|
@ -1169,18 +1172,6 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size,
|
|||
trace_probe_log_err(ctx->offset + (t ? (t - arg) : 0), BAD_TYPE);
|
||||
goto out;
|
||||
}
|
||||
parg->offset = *size;
|
||||
*size += parg->type->size * (parg->count ?: 1);
|
||||
|
||||
ret = -ENOMEM;
|
||||
if (parg->count) {
|
||||
len = strlen(parg->type->fmttype) + 6;
|
||||
parg->fmt = kmalloc(len, GFP_KERNEL);
|
||||
if (!parg->fmt)
|
||||
goto out;
|
||||
snprintf(parg->fmt, len, "%s[%d]", parg->type->fmttype,
|
||||
parg->count);
|
||||
}
|
||||
|
||||
code = tmp = kcalloc(FETCH_INSN_MAX, sizeof(*code), GFP_KERNEL);
|
||||
if (!code)
|
||||
|
|
@ -1204,6 +1195,19 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size,
|
|||
goto fail;
|
||||
}
|
||||
}
|
||||
parg->offset = *size;
|
||||
*size += parg->type->size * (parg->count ?: 1);
|
||||
|
||||
if (parg->count) {
|
||||
len = strlen(parg->type->fmttype) + 6;
|
||||
parg->fmt = kmalloc(len, GFP_KERNEL);
|
||||
if (!parg->fmt) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
snprintf(parg->fmt, len, "%s[%d]", parg->type->fmttype,
|
||||
parg->count);
|
||||
}
|
||||
|
||||
ret = -EINVAL;
|
||||
/* Store operation */
|
||||
|
|
|
|||
|
|
@ -515,7 +515,8 @@ extern int traceprobe_define_arg_fields(struct trace_event_call *event_call,
|
|||
C(BAD_HYPHEN, "Failed to parse single hyphen. Forgot '>'?"), \
|
||||
C(NO_BTF_FIELD, "This field is not found."), \
|
||||
C(BAD_BTF_TID, "Failed to get BTF type info."),\
|
||||
C(BAD_TYPE4STR, "This type does not fit for string."),
|
||||
C(BAD_TYPE4STR, "This type does not fit for string."),\
|
||||
C(NEED_STRING_TYPE, "$comm and immediate-string only accepts string type"),
|
||||
|
||||
#undef C
|
||||
#define C(a, b) TP_ERR_##a
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user