1 // SPDX-License-Identifier: GPL-2.0
3 * Common code for probe-based Dynamic events.
5 * This code was copied from kernel/trace/trace_kprobe.c written by
6 * Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
8 * Updates to make this generic:
9 * Copyright (C) IBM Corporation, 2010-2011
10 * Author: Srikar Dronamraju
12 #define pr_fmt(fmt) "trace_probe: " fmt
14 #include <linux/bpf.h>
15 #include "trace_btf.h"
17 #include "trace_probe.h"
22 static const char *trace_probe_err_text[] = { ERRORS };
24 static const char *reserved_field_names[] = {
27 "common_preempt_count",
35 /* Printing in basic type function template */
36 #define DEFINE_BASIC_PRINT_TYPE_FUNC(tname, type, fmt) \
37 int PRINT_TYPE_FUNC_NAME(tname)(struct trace_seq *s, void *data, void *ent)\
39 trace_seq_printf(s, fmt, *(type *)data); \
40 return !trace_seq_has_overflowed(s); \
42 const char PRINT_TYPE_FMT_NAME(tname)[] = fmt;
44 DEFINE_BASIC_PRINT_TYPE_FUNC(u8, u8, "%u")
45 DEFINE_BASIC_PRINT_TYPE_FUNC(u16, u16, "%u")
46 DEFINE_BASIC_PRINT_TYPE_FUNC(u32, u32, "%u")
47 DEFINE_BASIC_PRINT_TYPE_FUNC(u64, u64, "%Lu")
48 DEFINE_BASIC_PRINT_TYPE_FUNC(s8, s8, "%d")
49 DEFINE_BASIC_PRINT_TYPE_FUNC(s16, s16, "%d")
50 DEFINE_BASIC_PRINT_TYPE_FUNC(s32, s32, "%d")
51 DEFINE_BASIC_PRINT_TYPE_FUNC(s64, s64, "%Ld")
52 DEFINE_BASIC_PRINT_TYPE_FUNC(x8, u8, "0x%x")
53 DEFINE_BASIC_PRINT_TYPE_FUNC(x16, u16, "0x%x")
54 DEFINE_BASIC_PRINT_TYPE_FUNC(x32, u32, "0x%x")
55 DEFINE_BASIC_PRINT_TYPE_FUNC(x64, u64, "0x%Lx")
56 DEFINE_BASIC_PRINT_TYPE_FUNC(char, u8, "'%c'")
58 int PRINT_TYPE_FUNC_NAME(symbol)(struct trace_seq *s, void *data, void *ent)
60 trace_seq_printf(s, "%pS", (void *)*(unsigned long *)data);
61 return !trace_seq_has_overflowed(s);
63 const char PRINT_TYPE_FMT_NAME(symbol)[] = "%pS";
65 /* Print type function for string type */
66 int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s, void *data, void *ent)
68 int len = *(u32 *)data >> 16;
71 trace_seq_puts(s, FAULT_STRING);
73 trace_seq_printf(s, "\"%s\"",
74 (const char *)get_loc_data(data, ent));
75 return !trace_seq_has_overflowed(s);
78 const char PRINT_TYPE_FMT_NAME(string)[] = "\\\"%s\\\"";
80 /* Fetch type information table */
81 static const struct fetch_type probe_fetch_types[] = {
83 __ASSIGN_FETCH_TYPE("string", string, string, sizeof(u32), 1, 1,
85 __ASSIGN_FETCH_TYPE("ustring", string, string, sizeof(u32), 1, 1,
87 __ASSIGN_FETCH_TYPE("symstr", string, string, sizeof(u32), 1, 1,
90 ASSIGN_FETCH_TYPE(u8, u8, 0),
91 ASSIGN_FETCH_TYPE(u16, u16, 0),
92 ASSIGN_FETCH_TYPE(u32, u32, 0),
93 ASSIGN_FETCH_TYPE(u64, u64, 0),
94 ASSIGN_FETCH_TYPE(s8, u8, 1),
95 ASSIGN_FETCH_TYPE(s16, u16, 1),
96 ASSIGN_FETCH_TYPE(s32, u32, 1),
97 ASSIGN_FETCH_TYPE(s64, u64, 1),
98 ASSIGN_FETCH_TYPE_ALIAS(x8, u8, u8, 0),
99 ASSIGN_FETCH_TYPE_ALIAS(x16, u16, u16, 0),
100 ASSIGN_FETCH_TYPE_ALIAS(x32, u32, u32, 0),
101 ASSIGN_FETCH_TYPE_ALIAS(x64, u64, u64, 0),
102 ASSIGN_FETCH_TYPE_ALIAS(char, u8, u8, 0),
103 ASSIGN_FETCH_TYPE_ALIAS(symbol, ADDR_FETCH_TYPE, ADDR_FETCH_TYPE, 0),
105 ASSIGN_FETCH_TYPE_END
108 static const struct fetch_type *find_fetch_type(const char *type, unsigned long flags)
112 /* Reject the symbol/symstr for uprobes */
113 if (type && (flags & TPARG_FL_USER) &&
114 (!strcmp(type, "symbol") || !strcmp(type, "symstr")))
118 type = DEFAULT_FETCH_TYPE_STR;
120 /* Special case: bitfield */
124 type = strchr(type, '/');
129 if (kstrtoul(type, 0, &bs))
134 return find_fetch_type("u8", flags);
136 return find_fetch_type("u16", flags);
138 return find_fetch_type("u32", flags);
140 return find_fetch_type("u64", flags);
146 for (i = 0; probe_fetch_types[i].name; i++) {
147 if (strcmp(type, probe_fetch_types[i].name) == 0)
148 return &probe_fetch_types[i];
155 static struct trace_probe_log trace_probe_log;
157 void trace_probe_log_init(const char *subsystem, int argc, const char **argv)
159 trace_probe_log.subsystem = subsystem;
160 trace_probe_log.argc = argc;
161 trace_probe_log.argv = argv;
162 trace_probe_log.index = 0;
165 void trace_probe_log_clear(void)
167 memset(&trace_probe_log, 0, sizeof(trace_probe_log));
170 void trace_probe_log_set_index(int index)
172 trace_probe_log.index = index;
175 void __trace_probe_log_err(int offset, int err_type)
178 int i, len = 0, pos = 0;
180 if (!trace_probe_log.argv)
183 /* Recalculate the length and allocate buffer */
184 for (i = 0; i < trace_probe_log.argc; i++) {
185 if (i == trace_probe_log.index)
187 len += strlen(trace_probe_log.argv[i]) + 1;
189 command = kzalloc(len, GFP_KERNEL);
193 if (trace_probe_log.index >= trace_probe_log.argc) {
195 * Set the error position is next to the last arg + space.
196 * Note that len includes the terminal null and the cursor
197 * appears at pos + 1.
203 /* And make a command string from argv array */
205 for (i = 0; i < trace_probe_log.argc; i++) {
206 len = strlen(trace_probe_log.argv[i]);
207 strcpy(p, trace_probe_log.argv[i]);
213 tracing_log_err(NULL, trace_probe_log.subsystem, command,
214 trace_probe_err_text, err_type, pos + offset);
219 /* Split symbol and offset. */
220 int traceprobe_split_symbol_offset(char *symbol, long *offset)
228 tmp = strpbrk(symbol, "+-");
230 ret = kstrtol(tmp, 0, offset);
240 /* @buf must has MAX_EVENT_NAME_LEN size */
241 int traceprobe_parse_event_name(const char **pevent, const char **pgroup,
242 char *buf, int offset)
244 const char *slash, *event = *pevent;
247 slash = strchr(event, '/');
249 slash = strchr(event, '.');
252 if (slash == event) {
253 trace_probe_log_err(offset, NO_GROUP_NAME);
256 if (slash - event + 1 > MAX_EVENT_NAME_LEN) {
257 trace_probe_log_err(offset, GROUP_TOO_LONG);
260 strscpy(buf, event, slash - event + 1);
261 if (!is_good_system_name(buf)) {
262 trace_probe_log_err(offset, BAD_GROUP_NAME);
267 offset += slash - event + 1;
276 trace_probe_log_err(offset, NO_EVENT_NAME);
278 } else if (len > MAX_EVENT_NAME_LEN) {
279 trace_probe_log_err(offset, EVENT_TOO_LONG);
282 if (!is_good_name(event)) {
283 trace_probe_log_err(offset, BAD_EVENT_NAME);
289 static int parse_trace_event_arg(char *arg, struct fetch_insn *code,
290 struct traceprobe_parse_context *ctx)
292 struct ftrace_event_field *field;
293 struct list_head *head;
295 head = trace_get_fields(ctx->event);
296 list_for_each_entry(field, head, link) {
297 if (!strcmp(arg, field->name)) {
298 code->op = FETCH_OP_TP_ARG;
306 #ifdef CONFIG_PROBE_EVENTS_BTF_ARGS
308 static u32 btf_type_int(const struct btf_type *t)
310 return *(u32 *)(t + 1);
313 static bool btf_type_is_char_ptr(struct btf *btf, const struct btf_type *type)
315 const struct btf_type *real_type;
319 real_type = btf_type_skip_modifiers(btf, type->type, &tid);
323 if (BTF_INFO_KIND(real_type->info) != BTF_KIND_INT)
326 intdata = btf_type_int(real_type);
327 return !(BTF_INT_ENCODING(intdata) & BTF_INT_SIGNED)
328 && BTF_INT_BITS(intdata) == 8;
331 static bool btf_type_is_char_array(struct btf *btf, const struct btf_type *type)
333 const struct btf_type *real_type;
334 const struct btf_array *array;
338 if (BTF_INFO_KIND(type->info) != BTF_KIND_ARRAY)
341 array = (const struct btf_array *)(type + 1);
343 real_type = btf_type_skip_modifiers(btf, array->type, &tid);
345 intdata = btf_type_int(real_type);
346 return !(BTF_INT_ENCODING(intdata) & BTF_INT_SIGNED)
347 && BTF_INT_BITS(intdata) == 8;
350 static int check_prepare_btf_string_fetch(char *typename,
351 struct fetch_insn **pcode,
352 struct traceprobe_parse_context *ctx)
354 struct btf *btf = ctx->btf;
356 if (!btf || !ctx->last_type)
359 /* char [] does not need any change. */
360 if (btf_type_is_char_array(btf, ctx->last_type))
363 /* char * requires dereference the pointer. */
364 if (btf_type_is_char_ptr(btf, ctx->last_type)) {
365 struct fetch_insn *code = *pcode + 1;
367 if (code->op == FETCH_OP_END) {
368 trace_probe_log_err(ctx->offset, TOO_MANY_OPS);
371 if (typename[0] == 'u')
372 code->op = FETCH_OP_UDEREF;
374 code->op = FETCH_OP_DEREF;
379 /* Other types are not available for string */
380 trace_probe_log_err(ctx->offset, BAD_TYPE4STR);
384 static const char *fetch_type_from_btf_type(struct btf *btf,
385 const struct btf_type *type,
386 struct traceprobe_parse_context *ctx)
390 /* TODO: const char * could be converted as a string */
391 switch (BTF_INFO_KIND(type->info)) {
393 /* enum is "int", so convert to "s32" */
395 case BTF_KIND_ENUM64:
398 /* pointer will be converted to "x??" */
399 if (IS_ENABLED(CONFIG_64BIT))
404 intdata = btf_type_int(type);
405 if (BTF_INT_ENCODING(intdata) & BTF_INT_SIGNED) {
406 switch (BTF_INT_BITS(intdata)) {
416 } else { /* unsigned */
417 switch (BTF_INT_BITS(intdata)) {
427 /* bitfield, size is encoded in the type */
428 ctx->last_bitsize = BTF_INT_BITS(intdata);
429 ctx->last_bitoffs += BTF_INT_OFFSET(intdata);
433 /* TODO: support other types */
438 static int query_btf_context(struct traceprobe_parse_context *ctx)
440 const struct btf_param *param;
441 const struct btf_type *type;
451 type = btf_find_func_proto(ctx->funcname, &btf);
458 /* ctx->params is optional, since func(void) will not have params. */
460 param = btf_get_func_param(type, &nr);
461 if (!IS_ERR_OR_NULL(param)) {
462 /* Hide the first 'data' argument of tracepoint */
463 if (ctx->flags & TPARG_FL_TPOINT) {
480 static void clear_btf_context(struct traceprobe_parse_context *ctx)
491 /* Return 1 if the field separater is arrow operator ('->') */
492 static int split_next_field(char *varname, char **next_field,
493 struct traceprobe_parse_context *ctx)
498 field = strpbrk(varname, ".-");
500 if (field[0] == '-' && field[1] == '>') {
504 } else if (field[0] == '.') {
508 trace_probe_log_err(ctx->offset + field - varname, BAD_HYPHEN);
518 * Parse the field of data structure. The @type must be a pointer type
519 * pointing the target data structure type.
521 static int parse_btf_field(char *fieldname, const struct btf_type *type,
522 struct fetch_insn **pcode, struct fetch_insn *end,
523 struct traceprobe_parse_context *ctx)
525 struct fetch_insn *code = *pcode;
526 const struct btf_member *field;
527 u32 bitoffs, anon_offs;
533 /* Outer loop for solving arrow operator ('->') */
534 if (BTF_INFO_KIND(type->info) != BTF_KIND_PTR) {
535 trace_probe_log_err(ctx->offset, NO_PTR_STRCT);
538 /* Convert a struct pointer type to a struct type */
539 type = btf_type_skip_modifiers(ctx->btf, type->type, &tid);
541 trace_probe_log_err(ctx->offset, BAD_BTF_TID);
547 /* Inner loop for solving dot operator ('.') */
549 is_ptr = split_next_field(fieldname, &next, ctx);
554 field = btf_find_struct_member(ctx->btf, type, fieldname,
557 trace_probe_log_err(ctx->offset, NO_BTF_FIELD);
560 /* Add anonymous structure/union offset */
561 bitoffs += anon_offs;
563 /* Accumulate the bit-offsets of the dot-connected fields */
564 if (btf_type_kflag(type)) {
565 bitoffs += BTF_MEMBER_BIT_OFFSET(field->offset);
566 ctx->last_bitsize = BTF_MEMBER_BITFIELD_SIZE(field->offset);
568 bitoffs += field->offset;
569 ctx->last_bitsize = 0;
572 type = btf_type_skip_modifiers(ctx->btf, field->type, &tid);
574 trace_probe_log_err(ctx->offset, BAD_BTF_TID);
578 ctx->offset += next - fieldname;
580 } while (!is_ptr && fieldname);
583 trace_probe_log_err(ctx->offset, TOO_MANY_OPS);
586 code->op = FETCH_OP_DEREF; /* TODO: user deref support */
587 code->offset = bitoffs / 8;
590 ctx->last_bitoffs = bitoffs % 8;
591 ctx->last_type = type;
597 static int parse_btf_arg(char *varname,
598 struct fetch_insn **pcode, struct fetch_insn *end,
599 struct traceprobe_parse_context *ctx)
601 struct fetch_insn *code = *pcode;
602 const struct btf_param *params;
603 const struct btf_type *type;
608 if (WARN_ON_ONCE(!ctx->funcname))
611 is_ptr = split_next_field(varname, &field, ctx);
614 if (!is_ptr && field) {
615 /* dot-connected field on an argument is not supported. */
616 trace_probe_log_err(ctx->offset + field - varname,
621 if (ctx->flags & TPARG_FL_RETURN) {
622 if (strcmp(varname, "$retval") != 0) {
623 trace_probe_log_err(ctx->offset, NO_BTFARG);
626 code->op = FETCH_OP_RETVAL;
627 /* Check whether the function return type is not void */
628 if (query_btf_context(ctx) == 0) {
629 if (ctx->proto->type == 0) {
630 trace_probe_log_err(ctx->offset, NO_RETVAL);
633 tid = ctx->proto->type;
637 trace_probe_log_err(ctx->offset + field - varname,
645 ret = query_btf_context(ctx);
646 if (ret < 0 || ctx->nr_params == 0) {
647 trace_probe_log_err(ctx->offset, NO_BTF_ENTRY);
648 return PTR_ERR(params);
651 params = ctx->params;
653 for (i = 0; i < ctx->nr_params; i++) {
654 const char *name = btf_name_by_offset(ctx->btf, params[i].name_off);
656 if (name && !strcmp(name, varname)) {
657 code->op = FETCH_OP_ARG;
658 if (ctx->flags & TPARG_FL_TPOINT)
662 tid = params[i].type;
666 trace_probe_log_err(ctx->offset, NO_BTFARG);
670 type = btf_type_skip_modifiers(ctx->btf, tid, &tid);
672 trace_probe_log_err(ctx->offset, BAD_BTF_TID);
675 /* Initialize the last type information */
676 ctx->last_type = type;
677 ctx->last_bitoffs = 0;
678 ctx->last_bitsize = 0;
680 ctx->offset += field - varname;
681 return parse_btf_field(field, type, pcode, end, ctx);
686 static const struct fetch_type *find_fetch_type_from_btf_type(
687 struct traceprobe_parse_context *ctx)
689 struct btf *btf = ctx->btf;
690 const char *typestr = NULL;
692 if (btf && ctx->last_type)
693 typestr = fetch_type_from_btf_type(btf, ctx->last_type, ctx);
695 return find_fetch_type(typestr, ctx->flags);
698 static int parse_btf_bitfield(struct fetch_insn **pcode,
699 struct traceprobe_parse_context *ctx)
701 struct fetch_insn *code = *pcode;
703 if ((ctx->last_bitsize % 8 == 0) && ctx->last_bitoffs == 0)
707 if (code->op != FETCH_OP_NOP) {
708 trace_probe_log_err(ctx->offset, TOO_MANY_OPS);
713 code->op = FETCH_OP_MOD_BF;
714 code->lshift = 64 - (ctx->last_bitsize + ctx->last_bitoffs);
715 code->rshift = 64 - ctx->last_bitsize;
716 code->basesize = 64 / 8;
721 static void clear_btf_context(struct traceprobe_parse_context *ctx)
726 static int query_btf_context(struct traceprobe_parse_context *ctx)
731 static int parse_btf_arg(char *varname,
732 struct fetch_insn **pcode, struct fetch_insn *end,
733 struct traceprobe_parse_context *ctx)
735 trace_probe_log_err(ctx->offset, NOSUP_BTFARG);
739 static int parse_btf_bitfield(struct fetch_insn **pcode,
740 struct traceprobe_parse_context *ctx)
742 trace_probe_log_err(ctx->offset, NOSUP_BTFARG);
746 #define find_fetch_type_from_btf_type(ctx) \
747 find_fetch_type(NULL, ctx->flags)
749 static int check_prepare_btf_string_fetch(char *typename,
750 struct fetch_insn **pcode,
751 struct traceprobe_parse_context *ctx)
758 #define PARAM_MAX_STACK (THREAD_SIZE / sizeof(unsigned long))
760 /* Parse $vars. @orig_arg points '$', which syncs to @ctx->offset */
761 static int parse_probe_vars(char *orig_arg, const struct fetch_type *t,
762 struct fetch_insn **pcode,
763 struct fetch_insn *end,
764 struct traceprobe_parse_context *ctx)
766 struct fetch_insn *code = *pcode;
767 int err = TP_ERR_BAD_VAR;
768 char *arg = orig_arg + 1;
773 if (ctx->flags & TPARG_FL_TEVENT) {
776 ret = parse_trace_event_arg(arg, code, ctx);
779 if (strcmp(arg, "comm") == 0 || strcmp(arg, "COMM") == 0) {
780 code->op = FETCH_OP_COMM;
783 /* backward compatibility */
788 if (str_has_prefix(arg, "retval")) {
789 if (!(ctx->flags & TPARG_FL_RETURN)) {
790 err = TP_ERR_RETVAL_ON_PROBE;
793 if (!(ctx->flags & TPARG_FL_KERNEL) ||
794 !IS_ENABLED(CONFIG_PROBE_EVENTS_BTF_ARGS)) {
795 code->op = FETCH_OP_RETVAL;
798 return parse_btf_arg(orig_arg, pcode, end, ctx);
801 len = str_has_prefix(arg, "stack");
804 if (arg[len] == '\0') {
805 code->op = FETCH_OP_STACKP;
809 if (isdigit(arg[len])) {
810 ret = kstrtoul(arg + len, 10, ¶m);
814 if ((ctx->flags & TPARG_FL_KERNEL) &&
815 param > PARAM_MAX_STACK) {
816 err = TP_ERR_BAD_STACK_NUM;
819 code->op = FETCH_OP_STACK;
820 code->param = (unsigned int)param;
826 if (strcmp(arg, "comm") == 0 || strcmp(arg, "COMM") == 0) {
827 code->op = FETCH_OP_COMM;
831 #ifdef CONFIG_HAVE_FUNCTION_ARG_ACCESS_API
832 len = str_has_prefix(arg, "arg");
833 if (len && tparg_is_function_entry(ctx->flags)) {
834 ret = kstrtoul(arg + len, 10, ¶m);
838 if (!param || param > PARAM_MAX_STACK) {
839 err = TP_ERR_BAD_ARG_NUM;
843 code->op = FETCH_OP_ARG;
844 code->param = (unsigned int)param - 1;
846 * The tracepoint probe will probe a stub function, and the
847 * first parameter of the stub is a dummy and should be ignored.
849 if (ctx->flags & TPARG_FL_TPOINT)
856 __trace_probe_log_err(ctx->offset, err);
860 static int str_to_immediate(char *str, unsigned long *imm)
863 return kstrtoul(str, 0, imm);
864 else if (str[0] == '-')
865 return kstrtol(str, 0, (long *)imm);
866 else if (str[0] == '+')
867 return kstrtol(str + 1, 0, (long *)imm);
871 static int __parse_imm_string(char *str, char **pbuf, int offs)
873 size_t len = strlen(str);
875 if (str[len - 1] != '"') {
876 trace_probe_log_err(offs + len, IMMSTR_NO_CLOSE);
879 *pbuf = kstrndup(str, len - 1, GFP_KERNEL);
885 /* Recursive argument parser */
887 parse_probe_arg(char *arg, const struct fetch_type *type,
888 struct fetch_insn **pcode, struct fetch_insn *end,
889 struct traceprobe_parse_context *ctx)
891 struct fetch_insn *code = *pcode;
893 int deref = FETCH_OP_DEREF;
900 ret = parse_probe_vars(arg, type, pcode, end, ctx);
903 case '%': /* named register */
904 if (ctx->flags & (TPARG_FL_TEVENT | TPARG_FL_FPROBE)) {
905 /* eprobe and fprobe do not handle registers */
906 trace_probe_log_err(ctx->offset, BAD_VAR);
909 ret = regs_query_register_offset(arg + 1);
911 code->op = FETCH_OP_REG;
912 code->param = (unsigned int)ret;
915 trace_probe_log_err(ctx->offset, BAD_REG_NAME);
918 case '@': /* memory, file-offset or symbol */
919 if (isdigit(arg[1])) {
920 ret = kstrtoul(arg + 1, 0, ¶m);
922 trace_probe_log_err(ctx->offset, BAD_MEM_ADDR);
926 code->op = FETCH_OP_IMM;
927 code->immediate = param;
928 } else if (arg[1] == '+') {
929 /* kprobes don't support file offsets */
930 if (ctx->flags & TPARG_FL_KERNEL) {
931 trace_probe_log_err(ctx->offset, FILE_ON_KPROBE);
934 ret = kstrtol(arg + 2, 0, &offset);
936 trace_probe_log_err(ctx->offset, BAD_FILE_OFFS);
940 code->op = FETCH_OP_FOFFS;
941 code->immediate = (unsigned long)offset; // imm64?
943 /* uprobes don't support symbols */
944 if (!(ctx->flags & TPARG_FL_KERNEL)) {
945 trace_probe_log_err(ctx->offset, SYM_ON_UPROBE);
948 /* Preserve symbol for updating */
949 code->op = FETCH_NOP_SYMBOL;
950 code->data = kstrdup(arg + 1, GFP_KERNEL);
954 trace_probe_log_err(ctx->offset, TOO_MANY_OPS);
957 code->op = FETCH_OP_IMM;
960 /* These are fetching from memory */
962 trace_probe_log_err(ctx->offset, TOO_MANY_OPS);
966 code->op = FETCH_OP_DEREF;
967 code->offset = offset;
970 case '+': /* deref memory */
973 deref = FETCH_OP_UDEREF;
978 arg++; /* Skip '+', because kstrtol() rejects it. */
979 tmp = strchr(arg, '(');
981 trace_probe_log_err(ctx->offset, DEREF_NEED_BRACE);
985 ret = kstrtol(arg, 0, &offset);
987 trace_probe_log_err(ctx->offset, BAD_DEREF_OFFS);
990 ctx->offset += (tmp + 1 - arg) + (arg[0] != '-' ? 1 : 0);
992 tmp = strrchr(arg, ')');
994 trace_probe_log_err(ctx->offset + strlen(arg),
998 const struct fetch_type *t2 = find_fetch_type(NULL, ctx->flags);
999 int cur_offs = ctx->offset;
1002 ret = parse_probe_arg(arg, t2, &code, end, ctx);
1005 ctx->offset = cur_offs;
1006 if (code->op == FETCH_OP_COMM ||
1007 code->op == FETCH_OP_DATA) {
1008 trace_probe_log_err(ctx->offset, COMM_CANT_DEREF);
1011 if (++code == end) {
1012 trace_probe_log_err(ctx->offset, TOO_MANY_OPS);
1018 code->offset = offset;
1019 /* Reset the last type if used */
1020 ctx->last_type = NULL;
1023 case '\\': /* Immediate value */
1024 if (arg[1] == '"') { /* Immediate string */
1025 ret = __parse_imm_string(arg + 2, &tmp, ctx->offset + 2);
1028 code->op = FETCH_OP_DATA;
1031 ret = str_to_immediate(arg + 1, &code->immediate);
1033 trace_probe_log_err(ctx->offset + 1, BAD_IMM);
1035 code->op = FETCH_OP_IMM;
1039 if (isalpha(arg[0]) || arg[0] == '_') { /* BTF variable */
1040 if (!tparg_is_function_entry(ctx->flags)) {
1041 trace_probe_log_err(ctx->offset, NOSUP_BTFARG);
1044 ret = parse_btf_arg(arg, pcode, end, ctx);
1048 if (!ret && code->op == FETCH_OP_NOP) {
1049 /* Parsed, but do not find fetch method */
1050 trace_probe_log_err(ctx->offset, BAD_FETCH_ARG);
1056 #define BYTES_TO_BITS(nb) ((BITS_PER_LONG * (nb)) / sizeof(long))
1058 /* Bitfield type needs to be parsed into a fetch function */
1059 static int __parse_bitfield_probe_arg(const char *bf,
1060 const struct fetch_type *t,
1061 struct fetch_insn **pcode)
1063 struct fetch_insn *code = *pcode;
1064 unsigned long bw, bo;
1070 bw = simple_strtoul(bf + 1, &tail, 0); /* Use simple one */
1072 if (bw == 0 || *tail != '@')
1076 bo = simple_strtoul(bf, &tail, 0);
1078 if (tail == bf || *tail != '/')
1081 if (code->op != FETCH_OP_NOP)
1085 code->op = FETCH_OP_MOD_BF;
1086 code->lshift = BYTES_TO_BITS(t->size) - (bw + bo);
1087 code->rshift = BYTES_TO_BITS(t->size) - bw;
1088 code->basesize = t->size;
1090 return (BYTES_TO_BITS(t->size) < (bw + bo)) ? -EINVAL : 0;
1093 /* String length checking wrapper */
1094 static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size,
1095 struct probe_arg *parg,
1096 struct traceprobe_parse_context *ctx)
1098 struct fetch_insn *code, *scode, *tmp = NULL;
1103 arg = kstrdup(argv, GFP_KERNEL);
1109 if (len > MAX_ARGSTR_LEN) {
1110 trace_probe_log_err(ctx->offset, ARG_TOO_LONG);
1112 } else if (len == 0) {
1113 trace_probe_log_err(ctx->offset, NO_ARG_BODY);
1118 parg->comm = kstrdup(arg, GFP_KERNEL);
1123 t = strchr(arg, ':');
1126 t2 = strchr(++t, '[');
1129 t3 = strchr(t2, ']');
1131 int offs = t2 + strlen(t2) - arg;
1133 trace_probe_log_err(ctx->offset + offs,
1136 } else if (t3[1] != '\0') {
1137 trace_probe_log_err(ctx->offset + t3 + 1 - arg,
1142 if (kstrtouint(t2, 0, &parg->count) || !parg->count) {
1143 trace_probe_log_err(ctx->offset + t2 - arg,
1147 if (parg->count > MAX_ARRAY_LEN) {
1148 trace_probe_log_err(ctx->offset + t2 - arg,
1156 * Since $comm and immediate string can not be dereferenced,
1157 * we can find those by strcmp. But ignore for eprobes.
1159 if (!(ctx->flags & TPARG_FL_TEVENT) &&
1160 (strcmp(arg, "$comm") == 0 || strcmp(arg, "$COMM") == 0 ||
1161 strncmp(arg, "\\\"", 2) == 0)) {
1162 /* The type of $comm must be "string", and not an array type. */
1163 if (parg->count || (t && strcmp(t, "string"))) {
1164 trace_probe_log_err(ctx->offset + (t ? (t - arg) : 0),
1168 parg->type = find_fetch_type("string", ctx->flags);
1170 parg->type = find_fetch_type(t, ctx->flags);
1172 trace_probe_log_err(ctx->offset + (t ? (t - arg) : 0), BAD_TYPE);
1176 code = tmp = kcalloc(FETCH_INSN_MAX, sizeof(*code), GFP_KERNEL);
1179 code[FETCH_INSN_MAX - 1].op = FETCH_OP_END;
1181 ctx->last_type = NULL;
1182 ret = parse_probe_arg(arg, parg->type, &code, &code[FETCH_INSN_MAX - 1],
1187 /* Update storing type if BTF is available */
1188 if (IS_ENABLED(CONFIG_PROBE_EVENTS_BTF_ARGS) &&
1191 parg->type = find_fetch_type_from_btf_type(ctx);
1192 } else if (strstr(t, "string")) {
1193 ret = check_prepare_btf_string_fetch(t, &code, ctx);
1198 parg->offset = *size;
1199 *size += parg->type->size * (parg->count ?: 1);
1202 len = strlen(parg->type->fmttype) + 6;
1203 parg->fmt = kmalloc(len, GFP_KERNEL);
1208 snprintf(parg->fmt, len, "%s[%d]", parg->type->fmttype,
1213 /* Store operation */
1214 if (parg->type->is_string) {
1215 if (!strcmp(parg->type->name, "symstr")) {
1216 if (code->op != FETCH_OP_REG && code->op != FETCH_OP_STACK &&
1217 code->op != FETCH_OP_RETVAL && code->op != FETCH_OP_ARG &&
1218 code->op != FETCH_OP_DEREF && code->op != FETCH_OP_TP_ARG) {
1219 trace_probe_log_err(ctx->offset + (t ? (t - arg) : 0),
1224 if (code->op != FETCH_OP_DEREF && code->op != FETCH_OP_UDEREF &&
1225 code->op != FETCH_OP_IMM && code->op != FETCH_OP_COMM &&
1226 code->op != FETCH_OP_DATA && code->op != FETCH_OP_TP_ARG) {
1227 trace_probe_log_err(ctx->offset + (t ? (t - arg) : 0),
1232 if (!strcmp(parg->type->name, "symstr") ||
1233 (code->op == FETCH_OP_IMM || code->op == FETCH_OP_COMM ||
1234 code->op == FETCH_OP_DATA) || code->op == FETCH_OP_TP_ARG ||
1237 * IMM, DATA and COMM is pointing actual address, those
1238 * must be kept, and if parg->count != 0, this is an
1239 * array of string pointers instead of string address
1241 * For the symstr, it doesn't need to dereference, thus
1242 * it just get the value.
1245 if (code->op != FETCH_OP_NOP) {
1246 trace_probe_log_err(ctx->offset, TOO_MANY_OPS);
1250 /* If op == DEREF, replace it with STRING */
1251 if (!strcmp(parg->type->name, "ustring") ||
1252 code->op == FETCH_OP_UDEREF)
1253 code->op = FETCH_OP_ST_USTRING;
1254 else if (!strcmp(parg->type->name, "symstr"))
1255 code->op = FETCH_OP_ST_SYMSTR;
1257 code->op = FETCH_OP_ST_STRING;
1258 code->size = parg->type->size;
1259 parg->dynamic = true;
1260 } else if (code->op == FETCH_OP_DEREF) {
1261 code->op = FETCH_OP_ST_MEM;
1262 code->size = parg->type->size;
1263 } else if (code->op == FETCH_OP_UDEREF) {
1264 code->op = FETCH_OP_ST_UMEM;
1265 code->size = parg->type->size;
1268 if (code->op != FETCH_OP_NOP) {
1269 trace_probe_log_err(ctx->offset, TOO_MANY_OPS);
1272 code->op = FETCH_OP_ST_RAW;
1273 code->size = parg->type->size;
1276 /* Modify operation */
1278 ret = __parse_bitfield_probe_arg(t, parg->type, &code);
1280 trace_probe_log_err(ctx->offset + t - arg, BAD_BITFIELD);
1283 } else if (IS_ENABLED(CONFIG_PROBE_EVENTS_BTF_ARGS) &&
1285 ret = parse_btf_bitfield(&code, ctx);
1290 /* Loop(Array) operation */
1292 if (scode->op != FETCH_OP_ST_MEM &&
1293 scode->op != FETCH_OP_ST_STRING &&
1294 scode->op != FETCH_OP_ST_USTRING) {
1295 trace_probe_log_err(ctx->offset + (t ? (t - arg) : 0),
1300 if (code->op != FETCH_OP_NOP) {
1301 trace_probe_log_err(ctx->offset, TOO_MANY_OPS);
1304 code->op = FETCH_OP_LP_ARRAY;
1305 code->param = parg->count;
1308 code->op = FETCH_OP_END;
1311 /* Shrink down the code buffer */
1312 parg->code = kcalloc(code - tmp + 1, sizeof(*code), GFP_KERNEL);
1316 memcpy(parg->code, tmp, sizeof(*code) * (code - tmp + 1));
1320 for (code = tmp; code < tmp + FETCH_INSN_MAX; code++)
1321 if (code->op == FETCH_NOP_SYMBOL ||
1322 code->op == FETCH_OP_DATA)
1332 /* Return 1 if name is reserved or already used by another argument */
1333 static int traceprobe_conflict_field_name(const char *name,
1334 struct probe_arg *args, int narg)
1338 for (i = 0; i < ARRAY_SIZE(reserved_field_names); i++)
1339 if (strcmp(reserved_field_names[i], name) == 0)
1342 for (i = 0; i < narg; i++)
1343 if (strcmp(args[i].name, name) == 0)
1349 static char *generate_probe_arg_name(const char *arg, int idx)
1355 * If argument name is omitted, try arg as a name (BTF variable)
1358 if (IS_ENABLED(CONFIG_PROBE_EVENTS_BTF_ARGS)) {
1359 end = strchr(arg, ':');
1361 end = arg + strlen(arg);
1363 name = kmemdup_nul(arg, end - arg, GFP_KERNEL);
1364 if (!name || !is_good_name(name)) {
1371 name = kasprintf(GFP_KERNEL, "arg%d", idx + 1);
1376 int traceprobe_parse_probe_arg(struct trace_probe *tp, int i, const char *arg,
1377 struct traceprobe_parse_context *ctx)
1379 struct probe_arg *parg = &tp->args[i];
1382 /* Increment count for freeing args in error case */
1385 body = strchr(arg, '=');
1387 if (body - arg > MAX_ARG_NAME_LEN) {
1388 trace_probe_log_err(0, ARG_NAME_TOO_LONG);
1390 } else if (body == arg) {
1391 trace_probe_log_err(0, NO_ARG_NAME);
1394 parg->name = kmemdup_nul(arg, body - arg, GFP_KERNEL);
1397 parg->name = generate_probe_arg_name(arg, i);
1403 if (!is_good_name(parg->name)) {
1404 trace_probe_log_err(0, BAD_ARG_NAME);
1407 if (traceprobe_conflict_field_name(parg->name, tp->args, i)) {
1408 trace_probe_log_err(0, USED_ARG_NAME);
1411 ctx->offset = body - arg;
1412 /* Parse fetch argument */
1413 return traceprobe_parse_probe_arg_body(body, &tp->size, parg, ctx);
1416 void traceprobe_free_probe_arg(struct probe_arg *arg)
1418 struct fetch_insn *code = arg->code;
1420 while (code && code->op != FETCH_OP_END) {
1421 if (code->op == FETCH_NOP_SYMBOL ||
1422 code->op == FETCH_OP_DATA)
1432 static int argv_has_var_arg(int argc, const char *argv[], int *args_idx,
1433 struct traceprobe_parse_context *ctx)
1437 for (i = 0; i < argc; i++)
1438 if (str_has_prefix(argv[i], "$arg")) {
1439 trace_probe_log_set_index(i + 2);
1441 if (!tparg_is_function_entry(ctx->flags)) {
1442 trace_probe_log_err(0, NOFENTRY_ARGS);
1446 if (isdigit(argv[i][4])) {
1451 if (argv[i][4] != '*') {
1452 trace_probe_log_err(0, BAD_VAR);
1456 if (*args_idx >= 0 && *args_idx < argc) {
1457 trace_probe_log_err(0, DOUBLE_ARGS);
1467 static int sprint_nth_btf_arg(int idx, const char *type,
1468 char *buf, int bufsize,
1469 struct traceprobe_parse_context *ctx)
1474 if (idx >= ctx->nr_params) {
1475 trace_probe_log_err(0, NO_BTFARG);
1478 name = btf_name_by_offset(ctx->btf, ctx->params[idx].name_off);
1480 trace_probe_log_err(0, NO_BTF_ENTRY);
1483 ret = snprintf(buf, bufsize, "%s%s", name, type);
1484 if (ret >= bufsize) {
1485 trace_probe_log_err(0, ARGS_2LONG);
1491 /* Return new_argv which must be freed after use */
1492 const char **traceprobe_expand_meta_args(int argc, const char *argv[],
1493 int *new_argc, char *buf, int bufsize,
1494 struct traceprobe_parse_context *ctx)
1496 const struct btf_param *params = NULL;
1497 int i, j, n, used, ret, args_idx = -1;
1498 const char **new_argv = NULL;
1500 ret = argv_has_var_arg(argc, argv, &args_idx, ctx);
1502 return ERR_PTR(ret);
1509 ret = query_btf_context(ctx);
1510 if (ret < 0 || ctx->nr_params == 0) {
1511 if (args_idx != -1) {
1512 /* $arg* requires BTF info */
1513 trace_probe_log_err(0, NOSUP_BTFARG);
1514 return (const char **)params;
1521 *new_argc = argc + ctx->nr_params - 1;
1525 new_argv = kcalloc(*new_argc, sizeof(char *), GFP_KERNEL);
1527 return ERR_PTR(-ENOMEM);
1530 for (i = 0, j = 0; i < argc; i++) {
1531 trace_probe_log_set_index(i + 2);
1532 if (i == args_idx) {
1533 for (n = 0; n < ctx->nr_params; n++) {
1534 ret = sprint_nth_btf_arg(n, "", buf + used,
1535 bufsize - used, ctx);
1539 new_argv[j++] = buf + used;
1545 if (str_has_prefix(argv[i], "$arg")) {
1548 n = simple_strtoul(argv[i] + 4, &type, 10);
1549 if (type && !(*type == ':' || *type == '\0')) {
1550 trace_probe_log_err(0, BAD_VAR);
1554 /* Note: $argN starts from $arg1 */
1555 ret = sprint_nth_btf_arg(n - 1, type, buf + used,
1556 bufsize - used, ctx);
1559 new_argv[j++] = buf + used;
1562 new_argv[j++] = argv[i];
1569 return ERR_PTR(ret);
1572 void traceprobe_finish_parse(struct traceprobe_parse_context *ctx)
1574 clear_btf_context(ctx);
1577 int traceprobe_update_arg(struct probe_arg *arg)
1579 struct fetch_insn *code = arg->code;
1585 while (code && code->op != FETCH_OP_END) {
1586 if (code->op == FETCH_NOP_SYMBOL) {
1587 if (code[1].op != FETCH_OP_IMM)
1590 tmp = strpbrk(code->data, "+-");
1593 ret = traceprobe_split_symbol_offset(code->data,
1599 (unsigned long)kallsyms_lookup_name(code->data);
1602 if (!code[1].immediate)
1604 code[1].immediate += offset;
1611 /* When len=0, we just calculate the needed length */
1612 #define LEN_OR_ZERO (len ? len - pos : 0)
1613 static int __set_print_fmt(struct trace_probe *tp, char *buf, int len,
1614 enum probe_print_type ptype)
1616 struct probe_arg *parg;
1619 const char *fmt, *arg;
1622 case PROBE_PRINT_NORMAL:
1624 arg = ", REC->" FIELD_STRING_IP;
1626 case PROBE_PRINT_RETURN:
1627 fmt = "(%lx <- %lx)";
1628 arg = ", REC->" FIELD_STRING_FUNC ", REC->" FIELD_STRING_RETIP;
1630 case PROBE_PRINT_EVENT:
1639 pos += snprintf(buf + pos, LEN_OR_ZERO, "\"%s", fmt);
1641 for (i = 0; i < tp->nr_args; i++) {
1642 parg = tp->args + i;
1643 pos += snprintf(buf + pos, LEN_OR_ZERO, " %s=", parg->name);
1645 pos += snprintf(buf + pos, LEN_OR_ZERO, "{%s",
1647 for (j = 1; j < parg->count; j++)
1648 pos += snprintf(buf + pos, LEN_OR_ZERO, ",%s",
1650 pos += snprintf(buf + pos, LEN_OR_ZERO, "}");
1652 pos += snprintf(buf + pos, LEN_OR_ZERO, "%s",
1656 pos += snprintf(buf + pos, LEN_OR_ZERO, "\"%s", arg);
1658 for (i = 0; i < tp->nr_args; i++) {
1659 parg = tp->args + i;
1661 if (parg->type->is_string)
1662 fmt = ", __get_str(%s[%d])";
1664 fmt = ", REC->%s[%d]";
1665 for (j = 0; j < parg->count; j++)
1666 pos += snprintf(buf + pos, LEN_OR_ZERO,
1667 fmt, parg->name, j);
1669 if (parg->type->is_string)
1670 fmt = ", __get_str(%s)";
1673 pos += snprintf(buf + pos, LEN_OR_ZERO,
1678 /* return the length of print_fmt */
1683 int traceprobe_set_print_fmt(struct trace_probe *tp, enum probe_print_type ptype)
1685 struct trace_event_call *call = trace_probe_event_call(tp);
1689 /* First: called with 0 length to calculate the needed length */
1690 len = __set_print_fmt(tp, NULL, 0, ptype);
1691 print_fmt = kmalloc(len + 1, GFP_KERNEL);
1695 /* Second: actually write the @print_fmt */
1696 __set_print_fmt(tp, print_fmt, len + 1, ptype);
1697 call->print_fmt = print_fmt;
1702 int traceprobe_define_arg_fields(struct trace_event_call *event_call,
1703 size_t offset, struct trace_probe *tp)
1707 /* Set argument names as fields */
1708 for (i = 0; i < tp->nr_args; i++) {
1709 struct probe_arg *parg = &tp->args[i];
1710 const char *fmt = parg->type->fmttype;
1711 int size = parg->type->size;
1716 size *= parg->count;
1717 ret = trace_define_field(event_call, fmt, parg->name,
1718 offset + parg->offset, size,
1719 parg->type->is_signed,
1727 static void trace_probe_event_free(struct trace_probe_event *tpe)
1729 kfree(tpe->class.system);
1730 kfree(tpe->call.name);
1731 kfree(tpe->call.print_fmt);
1735 int trace_probe_append(struct trace_probe *tp, struct trace_probe *to)
1737 if (trace_probe_has_sibling(tp))
1740 list_del_init(&tp->list);
1741 trace_probe_event_free(tp->event);
1743 tp->event = to->event;
1744 list_add_tail(&tp->list, trace_probe_probe_list(to));
1749 void trace_probe_unlink(struct trace_probe *tp)
1751 list_del_init(&tp->list);
1752 if (list_empty(trace_probe_probe_list(tp)))
1753 trace_probe_event_free(tp->event);
1757 void trace_probe_cleanup(struct trace_probe *tp)
1761 for (i = 0; i < tp->nr_args; i++)
1762 traceprobe_free_probe_arg(&tp->args[i]);
1765 trace_probe_unlink(tp);
1768 int trace_probe_init(struct trace_probe *tp, const char *event,
1769 const char *group, bool alloc_filter)
1771 struct trace_event_call *call;
1772 size_t size = sizeof(struct trace_probe_event);
1775 if (!event || !group)
1779 size += sizeof(struct trace_uprobe_filter);
1781 tp->event = kzalloc(size, GFP_KERNEL);
1785 INIT_LIST_HEAD(&tp->event->files);
1786 INIT_LIST_HEAD(&tp->event->class.fields);
1787 INIT_LIST_HEAD(&tp->event->probes);
1788 INIT_LIST_HEAD(&tp->list);
1789 list_add(&tp->list, &tp->event->probes);
1791 call = trace_probe_event_call(tp);
1792 call->class = &tp->event->class;
1793 call->name = kstrdup(event, GFP_KERNEL);
1799 tp->event->class.system = kstrdup(group, GFP_KERNEL);
1800 if (!tp->event->class.system) {
1808 trace_probe_cleanup(tp);
1812 static struct trace_event_call *
1813 find_trace_event_call(const char *system, const char *event_name)
1815 struct trace_event_call *tp_event;
1818 list_for_each_entry(tp_event, &ftrace_events, list) {
1819 if (!tp_event->class->system ||
1820 strcmp(system, tp_event->class->system))
1822 name = trace_event_name(tp_event);
1823 if (!name || strcmp(event_name, name))
1831 int trace_probe_register_event_call(struct trace_probe *tp)
1833 struct trace_event_call *call = trace_probe_event_call(tp);
1836 lockdep_assert_held(&event_mutex);
1838 if (find_trace_event_call(trace_probe_group_name(tp),
1839 trace_probe_name(tp)))
1842 ret = register_trace_event(&call->event);
1846 ret = trace_add_event_call(call);
1848 unregister_trace_event(&call->event);
1853 int trace_probe_add_file(struct trace_probe *tp, struct trace_event_file *file)
1855 struct event_file_link *link;
1857 link = kmalloc(sizeof(*link), GFP_KERNEL);
1862 INIT_LIST_HEAD(&link->list);
1863 list_add_tail_rcu(&link->list, &tp->event->files);
1864 trace_probe_set_flag(tp, TP_FLAG_TRACE);
1868 struct event_file_link *trace_probe_get_file_link(struct trace_probe *tp,
1869 struct trace_event_file *file)
1871 struct event_file_link *link;
1873 trace_probe_for_each_link(link, tp) {
1874 if (link->file == file)
1881 int trace_probe_remove_file(struct trace_probe *tp,
1882 struct trace_event_file *file)
1884 struct event_file_link *link;
1886 link = trace_probe_get_file_link(tp, file);
1890 list_del_rcu(&link->list);
1891 kvfree_rcu_mightsleep(link);
1893 if (list_empty(&tp->event->files))
1894 trace_probe_clear_flag(tp, TP_FLAG_TRACE);
1900 * Return the smallest index of different type argument (start from 1).
1901 * If all argument types and name are same, return 0.
1903 int trace_probe_compare_arg_type(struct trace_probe *a, struct trace_probe *b)
1907 /* In case of more arguments */
1908 if (a->nr_args < b->nr_args)
1909 return a->nr_args + 1;
1910 if (a->nr_args > b->nr_args)
1911 return b->nr_args + 1;
1913 for (i = 0; i < a->nr_args; i++) {
1914 if ((b->nr_args <= i) ||
1915 ((a->args[i].type != b->args[i].type) ||
1916 (a->args[i].count != b->args[i].count) ||
1917 strcmp(a->args[i].name, b->args[i].name)))
1924 bool trace_probe_match_command_args(struct trace_probe *tp,
1925 int argc, const char **argv)
1927 char buf[MAX_ARGSTR_LEN + 1];
1930 if (tp->nr_args < argc)
1933 for (i = 0; i < argc; i++) {
1934 snprintf(buf, sizeof(buf), "%s=%s",
1935 tp->args[i].name, tp->args[i].comm);
1936 if (strcmp(buf, argv[i]))
1942 int trace_probe_create(const char *raw_command, int (*createfn)(int, const char **))
1944 int argc = 0, ret = 0;
1947 argv = argv_split(GFP_KERNEL, raw_command, &argc);
1952 ret = createfn(argc, (const char **)argv);
1959 int trace_probe_print_args(struct trace_seq *s, struct probe_arg *args, int nr_args,
1960 u8 *data, void *field)
1965 for (i = 0; i < nr_args; i++) {
1966 struct probe_arg *a = args + i;
1968 trace_seq_printf(s, " %s=", a->name);
1969 if (likely(!a->count)) {
1970 if (!a->type->print(s, data + a->offset, field))
1974 trace_seq_putc(s, '{');
1975 p = data + a->offset;
1976 for (j = 0; j < a->count; j++) {
1977 if (!a->type->print(s, p, field))
1979 trace_seq_putc(s, j == a->count - 1 ? '}' : ',');