diff options
Diffstat (limited to 'kernel/trace/trace_eprobe.c')
| -rw-r--r-- | kernel/trace/trace_eprobe.c | 95 | 
1 files changed, 13 insertions, 82 deletions
diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c index 352b65e2b910..67e854979d53 100644 --- a/kernel/trace/trace_eprobe.c +++ b/kernel/trace/trace_eprobe.c @@ -311,7 +311,7 @@ print_eprobe_event(struct trace_iterator *iter, int flags,  	trace_seq_putc(s, ')'); -	if (print_probe_args(s, tp->args, tp->nr_args, +	if (trace_probe_print_args(s, tp->args, tp->nr_args,  			     (u8 *)&field[1], field) < 0)  		goto out; @@ -320,7 +320,8 @@ print_eprobe_event(struct trace_iterator *iter, int flags,  	return trace_handle_return(s);  } -static unsigned long get_event_field(struct fetch_insn *code, void *rec) +static nokprobe_inline unsigned long +get_event_field(struct fetch_insn *code, void *rec)  {  	struct ftrace_event_field *field = code->data;  	unsigned long val; @@ -395,20 +396,12 @@ static int get_eprobe_size(struct trace_probe *tp, void *rec)  			case FETCH_OP_TP_ARG:  				val = get_event_field(code, rec);  				break; -			case FETCH_OP_IMM: -				val = code->immediate; -				break; -			case FETCH_OP_COMM: -				val = (unsigned long)current->comm; -				break; -			case FETCH_OP_DATA: -				val = (unsigned long)code->data; -				break;  			case FETCH_NOP_SYMBOL:	/* Ignore a place holder */  				code++;  				goto retry;  			default: -				continue; +				if (process_common_fetch_insn(code, &val) < 0) +					continue;  			}  			code++;  			len = process_fetch_insn_bottom(code, val, NULL, NULL); @@ -428,84 +421,26 @@ process_fetch_insn(struct fetch_insn *code, void *rec, void *dest,  		   void *base)  {  	unsigned long val; +	int ret;   retry:  	switch (code->op) {  	case FETCH_OP_TP_ARG:  		val = get_event_field(code, rec);  		break; -	case FETCH_OP_IMM: -		val = code->immediate; -		break; -	case FETCH_OP_COMM: -		val = (unsigned long)current->comm; -		break; -	case FETCH_OP_DATA: -		val = (unsigned long)code->data; -		break;  	case FETCH_NOP_SYMBOL:	/* Ignore a place holder */  		code++;  		goto retry;  	default: -		return -EILSEQ; +		ret = process_common_fetch_insn(code, &val); +		if (ret < 0) +			return ret;  	}  	code++;  	return process_fetch_insn_bottom(code, val, dest, base);  }  NOKPROBE_SYMBOL(process_fetch_insn) -/* Return the length of string -- including null terminal byte */ -static nokprobe_inline int -fetch_store_strlen_user(unsigned long addr) -{ -	return kern_fetch_store_strlen_user(addr); -} - -/* Return the length of string -- including null terminal byte */ -static nokprobe_inline int -fetch_store_strlen(unsigned long addr) -{ -	return kern_fetch_store_strlen(addr); -} - -/* - * Fetch a null-terminated string from user. Caller MUST set *(u32 *)buf - * with max length and relative data location. - */ -static nokprobe_inline int -fetch_store_string_user(unsigned long addr, void *dest, void *base) -{ -	return kern_fetch_store_string_user(addr, dest, base); -} - -/* - * Fetch a null-terminated string. Caller MUST set *(u32 *)buf with max - * length and relative data location. - */ -static nokprobe_inline int -fetch_store_string(unsigned long addr, void *dest, void *base) -{ -	return kern_fetch_store_string(addr, dest, base); -} - -static nokprobe_inline int -probe_mem_read_user(void *dest, void *src, size_t size) -{ -	const void __user *uaddr =  (__force const void __user *)src; - -	return copy_from_user_nofault(dest, uaddr, size); -} - -static nokprobe_inline int -probe_mem_read(void *dest, void *src, size_t size) -{ -#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE -	if ((unsigned long)src < TASK_SIZE) -		return probe_mem_read_user(dest, src, size); -#endif -	return copy_from_kernel_nofault(dest, src, size); -} -  /* eprobe handler */  static inline void  __eprobe_trace_func(struct eprobe_data *edata, void *rec) @@ -923,17 +858,13 @@ static int trace_eprobe_parse_filter(struct trace_eprobe *ep, int argc, const ch  	p = ep->filter_str;  	for (i = 0; i < argc; i++) { -		ret = snprintf(p, len, "%s ", argv[i]); -		if (ret < 0) -			goto error; -		if (ret > len) { -			ret = -E2BIG; -			goto error; -		} +		if (i) +			ret = snprintf(p, len, " %s", argv[i]); +		else +			ret = snprintf(p, len, "%s", argv[i]);  		p += ret;  		len -= ret;  	} -	p[-1] = '\0';  	/*  	 * Ensure the filter string can be parsed correctly. Note, this  |