Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp867681imm; Wed, 25 Jul 2018 07:32:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeLF7zjnMU7MfMS5NcxYUzCjP2uFw7we/2rHPe8VF7d0No8pbK2kGwmTGu85zREBjaw7sk2 X-Received: by 2002:a63:9856:: with SMTP id l22-v6mr21389368pgo.208.1532529133250; Wed, 25 Jul 2018 07:32:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532529133; cv=none; d=google.com; s=arc-20160816; b=zE77U3AAYibE29+AIISvrh16dDLe9CgXQtDwYst76J2xqKlgoMI586M/sSo7RfdXCL C5I0VRqF02eTZWy8PoD1qcmpARC8w10jQOXEG5YA39YVr647u01NqwAPYeKHFYlTqao6 1NrOag7hipjf80S+wbIqPgNynVVzhcvHzQumaGDMroalvYstSC8nuJ8Ua8Ns7YyOo+kC w1m65L4NI8Y53pGUNnMaRm2vVrIbfTGxRiQqJ1X1w64agbg5CFzmIUxkHzJgcZpL0/hh wt3VinUsit8/PGbO991S2P8BSSu4LlBvN6zxcOoGn4Pga4CSIes4I4DEiHAECzPGuPkf 53DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=3GQorxK0MSG3l3B7sTULKZ3hmRLB5iqhyfr42Cf+Zsg=; b=fNuisuzkoFQIH0/r7o+CgXflA7/qOHtpNFBSjlkrmXvpz7NhFNkXPmFc/7mygxnXjG vRr16S6kASrZiKe9NHn7G3IhxFMm/2/dp4Wu7rBkK2uFUsuh65Bf1Ta18+Mdd5g3yPDZ dMrUa8Gz0rsc1AL0XiiMPjRISlIIfmst/8SllPPD7jkr5u+eUgAkIqEvv9E1c6Uamkfm qa8f48L58OzLTCL98u/sdwzdR5yRPLtxNVFNxY6zkB9875ErgXiDSo/m3XFnKD1T4zYF tM8D17XblfRad4siiefIrjrg+Ekt1wOsl5pBz+Qgll0cpEd6P72YhdK/wRPQZfw02XdG HufQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k33-v6si12985717pld.269.2018.07.25.07.31.58; Wed, 25 Jul 2018 07:32:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729298AbeGYPmk (ORCPT + 99 others); Wed, 25 Jul 2018 11:42:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:52864 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728051AbeGYPmj (ORCPT ); Wed, 25 Jul 2018 11:42:39 -0400 Received: from gandalf.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 488CC20852; Wed, 25 Jul 2018 14:30:42 +0000 (UTC) Date: Wed, 25 Jul 2018 10:30:39 -0400 From: Steven Rostedt To: Masami Hiramatsu Cc: Artem Savkov , Ingo Molnar , linux-kernel@vger.kernel.org, Josh Poimboeuf Subject: Re: [PATCH v2] tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure Message-ID: <20180725103039.0b7498a6@gandalf.local.home> In-Reply-To: <20180725142038.4765-1-asavkov@redhat.com> References: <20180725142038.4765-1-asavkov@redhat.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 25 Jul 2018 16:20:38 +0200 Artem Savkov wrote: > If enable_trace_kprobe fails to enable the probe in enable_k(ret)probe > it returns an error, but does not unset the tp flags it set previously. > This results in a probe being considered enabled and failures like being > unable to remove the probe through kprobe_events file since probes_open() > expects every probe to be disabled. > > Signed-off-by: Artem Savkov Masami, Can you ack this? Thanks! -- Steve > --- > kernel/trace/trace_kprobe.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c > index 21f718472942..27ace4513c43 100644 > --- a/kernel/trace/trace_kprobe.c > +++ b/kernel/trace/trace_kprobe.c > @@ -400,11 +400,10 @@ static struct trace_kprobe *find_trace_kprobe(const char *event, > static int > enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file) > { > + struct event_file_link *link; > int ret = 0; > > if (file) { > - struct event_file_link *link; > - > link = kmalloc(sizeof(*link), GFP_KERNEL); > if (!link) { > ret = -ENOMEM; > @@ -424,6 +423,16 @@ enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file) > else > ret = enable_kprobe(&tk->rp.kp); > } > + > + if (ret) { > + if (file) { > + list_del_rcu(&link->list); > + kfree(link); > + tk->tp.flags &= ~TP_FLAG_TRACE; > + } else { > + tk->tp.flags &= ~TP_FLAG_PROFILE; > + } > + } > out: > return ret; > }