Commit 3c3e9027 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull tracing fixes from Steven Rostedt:
 "Various tracing fixes:

   - Fix NULL pointer dereference caused by an error path

   - Give histogram calculation fields a size, otherwise it breaks
     synthetic creation based on them.

   - Reject strings being used for number calculations.

   - Fix recordmcount.pl warning on llvm building RISC-V allmodconfig

   - Fix the draw_functrace.py script to handle the new trace output

   - Fix warning of smp_processor_id() in preemptible code"

* tag 'trace-v5.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  tracing: Quiet smp_processor_id() use in preemptable warning in hwlat
  scripts/tracing: fix the bug that can't parse raw_trace_func
  scripts/recordmcount.pl: Remove check_objcopy() and $can_use_local
  tracing: Reject string operand in the histogram expression
  tracing / histogram: Give calculation hist_fields a size
  tracing: Fix NULL pointer dereference in start_creating
parents 130951bb 51397dc6
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -546,7 +546,6 @@ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
PHONY += scripts_basic
scripts_basic:
	$(Q)$(MAKE) $(build)=scripts/basic
	$(Q)rm -f .tmp_quiet_recordmcount

PHONY += outputmakefile
ifdef building_out_of_srctree
+3 −1
Original line number Diff line number Diff line
@@ -9135,8 +9135,10 @@ static int trace_array_create_dir(struct trace_array *tr)
		return -EINVAL;

	ret = event_trace_add_tracer(tr->dir, tr);
	if (ret)
	if (ret) {
		tracefs_remove(tr->dir);
		return ret;
	}

	init_tracer_tracefs(tr, tr->dir);
	__update_tracer_options(tr);
+23 −1
Original line number Diff line number Diff line
@@ -65,7 +65,8 @@
	C(INVALID_SORT_MODIFIER,"Invalid sort modifier"),		\
	C(EMPTY_SORT_FIELD,	"Empty sort field"),			\
	C(TOO_MANY_SORT_FIELDS,	"Too many sort fields (Max = 2)"),	\
	C(INVALID_SORT_FIELD,	"Sort field must be a key or a val"),
	C(INVALID_SORT_FIELD,	"Sort field must be a key or a val"),	\
	C(INVALID_STR_OPERAND,	"String type can not be an operand in expression"),

#undef C
#define C(a, b)		HIST_ERR_##a
@@ -2156,6 +2157,13 @@ static struct hist_field *parse_unary(struct hist_trigger_data *hist_data,
		ret = PTR_ERR(operand1);
		goto free;
	}
	if (operand1->flags & HIST_FIELD_FL_STRING) {
		/* String type can not be the operand of unary operator. */
		hist_err(file->tr, HIST_ERR_INVALID_STR_OPERAND, errpos(str));
		destroy_hist_field(operand1, 0);
		ret = -EINVAL;
		goto free;
	}

	expr->flags |= operand1->flags &
		(HIST_FIELD_FL_TIMESTAMP | HIST_FIELD_FL_TIMESTAMP_USECS);
@@ -2257,6 +2265,11 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data,
		operand1 = NULL;
		goto free;
	}
	if (operand1->flags & HIST_FIELD_FL_STRING) {
		hist_err(file->tr, HIST_ERR_INVALID_STR_OPERAND, errpos(operand1_str));
		ret = -EINVAL;
		goto free;
	}

	/* rest of string could be another expression e.g. b+c in a+b+c */
	operand_flags = 0;
@@ -2266,6 +2279,11 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data,
		operand2 = NULL;
		goto free;
	}
	if (operand2->flags & HIST_FIELD_FL_STRING) {
		hist_err(file->tr, HIST_ERR_INVALID_STR_OPERAND, errpos(str));
		ret = -EINVAL;
		goto free;
	}

	ret = check_expr_operands(file->tr, operand1, operand2);
	if (ret)
@@ -2287,6 +2305,10 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data,

	expr->operands[0] = operand1;
	expr->operands[1] = operand2;

	/* The operand sizes should be the same, so just pick one */
	expr->size = operand1->size;

	expr->operator = field_op;
	expr->name = expr_str(expr, 0);
	expr->type = kstrdup(operand1->type, GFP_KERNEL);
+1 −1
Original line number Diff line number Diff line
@@ -327,7 +327,7 @@ static void move_to_next_cpu(void)

	get_online_cpus();
	cpumask_and(current_mask, cpu_online_mask, tr->tracing_cpumask);
	next_cpu = cpumask_next(smp_processor_id(), current_mask);
	next_cpu = cpumask_next(raw_smp_processor_id(), current_mask);
	put_online_cpus();

	if (next_cpu >= nr_cpu_ids)
+0 −40
Original line number Diff line number Diff line
@@ -173,39 +173,6 @@ my $mcount_regex; # Find the call site to mcount (return offset)
my $mcount_adjust;	# Address adjustment to mcount offset
my $alignment;		# The .align value to use for $mcount_section
my $section_type;	# Section header plus possible alignment command
my $can_use_local = 0; 	# If we can use local function references

# Shut up recordmcount if user has older objcopy
my $quiet_recordmcount = ".tmp_quiet_recordmcount";
my $print_warning = 1;
$print_warning = 0 if ( -f $quiet_recordmcount);

##
# check_objcopy - whether objcopy supports --globalize-symbols
#
#  --globalize-symbols came out in 2.17, we must test the version
#  of objcopy, and if it is less than 2.17, then we can not
#  record local functions.
sub check_objcopy
{
    open (IN, "$objcopy --version |") or die "error running $objcopy";
    while (<IN>) {
	if (/objcopy.*\s(\d+)\.(\d+)/) {
	    $can_use_local = 1 if ($1 > 2 || ($1 == 2 && $2 >= 17));
	    last;
	}
    }
    close (IN);

    if (!$can_use_local && $print_warning) {
	print STDERR "WARNING: could not find objcopy version or version " .
	    "is less than 2.17.\n" .
	    "\tLocal function references are disabled.\n";
	open (QUIET, ">$quiet_recordmcount");
	printf QUIET "Disables the warning from recordmcount.pl\n";
	close QUIET;
    }
}

if ($arch =~ /(x86(_64)?)|(i386)/) {
    if ($bits == 64) {
@@ -434,8 +401,6 @@ if ($filename =~ m,^(.*)(\.\S),) {
my $mcount_s = $dirname . "/.tmp_mc_" . $prefix . ".s";
my $mcount_o = $dirname . "/.tmp_mc_" . $prefix . ".o";

check_objcopy();

#
# Step 1: find all the local (static functions) and weak symbols.
#         't' is local, 'w/W' is weak
@@ -473,11 +438,6 @@ sub update_funcs

    # is this function static? If so, note this fact.
    if (defined $locals{$ref_func}) {

	# only use locals if objcopy supports globalize-symbols
	if (!$can_use_local) {
	    return;
	}
	$convert{$ref_func} = 1;
    }

Loading