Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp934741imm; Wed, 25 Jul 2018 08:36:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpflA7xRcV8qoxb8dp2RLPuXdd3Zou/S5zj+NSd/u62iqEpYdMlYjEdrZzQRQ+A3z6dLhRr8 X-Received: by 2002:a17:902:683:: with SMTP id 3-v6mr21595291plh.291.1532533012280; Wed, 25 Jul 2018 08:36:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532533012; cv=none; d=google.com; s=arc-20160816; b=CW3ldt9bNm7FVWUpPplq0YNwBY9N6reV9vTB/QCHmSezC/6NOFh4aURg/3Sq7qcwHG BqYgP66NGrLFgKlmqiDJrHm0HvLlCNM/9RJUGyCwV+/c4s6RLNIKGkRBzJKtYP8S7mbl rpx6Lj20LeX9FG1yA1ITcIos+XR1tZ7WgMt4os+HNKik4vRWF5UXxoUeApLVFgXueFP7 6eWGj1YEn5iI2WRIhmOVpjeY4YzAjbVKVPJnxHZDFkXAn6aLM4BDUFNplo0wP1k+UDOm 4UEvbVcSO+F4qH28SYdQt8n6ApzIM4SPCCw67NTS0ThK0ycuOM7LjcmtiHyEwo02jxaR Eo4A== 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 :dkim-signature:arc-authentication-results; bh=1qygJy1D3h5BQ61D7NSKKmB3ViiwpoYocEM9hV8AAcM=; b=QXtiB9H6jJtKRoVxaqjTkmqrbJRQNLxHUJaIB4WOxydRb8Sv9U6CXcGcxURKQKpQJB IYul3ad1qp5No4oobdKsu2LpoIqIyUFWhmL3SPYxUpiLYmVcYIOrul8jDb665PfRr19Q 7pt7P9oZ9l18foPhrCASqYnJXLTC+bI1GMlj40NWAgqOlYsAEYfxesYsi8Cp/xLvAaF2 L/PPUpVjBYQiUl31LmLvETqqmLKzLBTeNgfmvQgc9cuLLsF2V9cdirtTPJsRsvjxD8Af 8gMtPstaNsAQ3js4ZxbuSV6L7qhFgFH77NRLD36T61yu0VGYxteJoXWOC9PQNjjRZ+rz SG9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HUfRPWdP; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v129-v6si15656199pfc.330.2018.07.25.08.36.37; Wed, 25 Jul 2018 08:36:52 -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; dkim=pass header.i=@kernel.org header.s=default header.b=HUfRPWdP; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729130AbeGYQrk (ORCPT + 99 others); Wed, 25 Jul 2018 12:47:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:39110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728360AbeGYQrj (ORCPT ); Wed, 25 Jul 2018 12:47:39 -0400 Received: from devbox (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (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 5428820843; Wed, 25 Jul 2018 15:35:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1532532928; bh=1bXEJvFObp3RhoaJZKqUD/l+lQmwlm98uLUxbViaNxA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HUfRPWdPYfrB1UrSK10ftJai7xXjj6RE6qIFT+rbnQJwssqva7bJyJFTBiAvy2u/I jUUDihMwP4KJRrS3U/6cU2ujD3siP++BauSw/KRd8cn6Qq7TLU3fi9ogV5W+xT0jUy NIJhh5sVrnCQ4KFnuX29L2IF9O32ZUXIXmZyfquw= Date: Thu, 26 Jul 2018 00:35:24 +0900 From: Masami Hiramatsu To: Steven Rostedt Cc: Artem Savkov , 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: <20180726003524.e5ad32fc6b30476ccb0ebdc5@kernel.org> In-Reply-To: <20180725092151.11b9f2e1@gandalf.local.home> References: <20180725102826.8300-1-asavkov@redhat.com> <20180725092151.11b9f2e1@gandalf.local.home> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-redhat-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 09:21:51 -0400 Steven Rostedt wrote: > > [ 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? Yes, looks good to me too. Acked-by: Masami Hiramatsu Thanks Artem! > > -- 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; > > } > -- Masami Hiramatsu