Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp794033imm; Wed, 25 Jul 2018 06:23:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdoj7EbU84KIhpjinXYvTeNDUW12t1fYbjWvZMDhRR2rZLkPJsTOAeNH4CXMqo4H+iLWtHo X-Received: by 2002:a63:2043:: with SMTP id r3-v6mr20912476pgm.105.1532525027524; Wed, 25 Jul 2018 06:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532525027; cv=none; d=google.com; s=arc-20160816; b=gbF3kXTjD8Nlq0XY/sD+Zb55dZUHA4Qtk440VWoDs4MD8B6hq+eA08BIN1M2Ii4Dp5 HmDwfry53bxcwtWwJT9Z33Yn28P/sGW4IHXQC9CRo9TViB/7cKkVENwbptwh5qjXKuXJ lBF8D873X4pFD2qRze8XZe0cefQR+erBpBvQyoebw9Uk1EZKnBYRdbS70Otz8yTStxSV YSFaI545MQEMd+eCG4x2w9psGliljSOO++Z6EV60xpinfijRnmxibWUKhapdSaVx5XWn RH5Ge8wA5qNvnIb7Ypj1ZIfh7lCHTNhiRgOTjgJravqRvAG3jslNXpx05UEXdHm/T0pW HCuw== 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=Q0D8u7spfEVBMXc+CVRlbJAX4HDy03/FngC7jYsjlbs=; b=rMT3MVTAJqUwciealBk4D3hgh9LbVzzjZBUmOrED6VRX2OuL8PfwewRN/yTgTOkXks K6asrB77S+Feq7O1ccUv7hxhprmv5u5rxd/ncg0d3/lgcsCB9j2frDt8mz5mPeEWldu8 aT1I4kDpxm3zeULJ8Lr7FZVBLjgnXdqm9pSSUC0iHwELYD2uF+k8yQ5Wgb+uOD0Mn59K S3LzZrRRgAY0xNr/q/pvlTisEzf4oZSWEWC8GvXlTSgTdalbzVFMkN7r2X6QzWWKJjRC gZrKR3AAHz5rGqrsNLOQEcGopyc+c7mmYP8o8stM67mLylhkq6VkFVcE4Yc61OcPeaSe D3Mg== 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 l185-v6si14424635pfl.134.2018.07.25.06.23.32; Wed, 25 Jul 2018 06:23:47 -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 S1729065AbeGYOdd (ORCPT + 99 others); Wed, 25 Jul 2018 10:33:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:36748 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728988AbeGYOdd (ORCPT ); Wed, 25 Jul 2018 10:33:33 -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 6AC0120843; Wed, 25 Jul 2018 13:21:53 +0000 (UTC) Date: Wed, 25 Jul 2018 09:21:51 -0400 From: Steven Rostedt To: Artem Savkov Cc: Ingo Molnar , linux-kernel@vger.kernel.org, Josh Poimboeuf , Masami Hiramatsu Subject: Re: [PATCH] kprobes: fix trace_probe flags in enable_trace_kprobe Message-ID: <20180725092151.11b9f2e1@gandalf.local.home> In-Reply-To: <20180725102826.8300-1-asavkov@redhat.com> References: <20180725102826.8300-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 [ Adding Masami to Cc ] On Wed, 25 Jul 2018 12:28:26 +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 previosly. > 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. > Looks good to me. Masami, want to ack it? -- Steve > Signed-off-by: Artem Savkov > --- > 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..fb887ced5056 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(&link->list); > + kfree(link); > + tk->tp.flags &= ~TP_FLAG_TRACE; > + } else { > + tk->tp.flags &= ~TP_FLAG_PROFILE; > + } > + } > out: > return ret; > }