Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1748352pxb; Fri, 24 Sep 2021 10:56:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoK6NHZLlYOTRPCy2M06nGfWRswTtd772T2pyOqMimGYUgPMuT9Er3sUBGbd8Rz7O5Empc X-Received: by 2002:a05:6e02:100f:: with SMTP id n15mr3037161ilj.174.1632506178466; Fri, 24 Sep 2021 10:56:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632506178; cv=none; d=google.com; s=arc-20160816; b=0iqLN/Qs9j/r9W8Rf9Dp8ivF2005XO6Xl+7zQ6z2JQapIyJY7CzyseHyHQKEWVVe3c HS6l8+aj/Pg8mvCRB1Xr2leb3iOeBZIfu4GKJYAIZQphhHEES01LlyvE4QFDpznEZdnp 0iOOy8xBsIIhq4wuKzSWXB0uwITQm7lkkHCIZCW9wkqpGosx3/rdQ4HdjGH0/vfOolTE 22oT5/lneePM+v+3/7dIvH494yFIT4ml8HZd5fQLOzQ2B1Yd3FGuCYuRtACdxSHJObns RNs4OoCkqTqJnmsaKc6XuunqU2kroKsVS+abAV/UgPSBzMtFhB1LuTDRJ6kq6TOg8min tWdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pbTZ4xF0QqQ+tdG5dUdn83RCDBMy6QCEJ4D2p/rhA+0=; b=OmD2nGpkfbfo4Z+JE7WNbw/BmsjSib9ph2jGKlrzu7N6lgPXYk9GB5YZ/P9hb8L5sd KxJrac4Gu0cjypsBCEqo7961aXkb+6DU2TUdASpVqaGt0ji++elqkZKo5VPsAJKKJAC6 r/YVRgq7TVrjfNuTh1++t0h8DXMRfENKvqaHLQ0bYaIbS1lCl8sw9ncLdOYLS06UOm36 yYfSBkKD1k4wV9C1hhHEP1FgMkKGJwnRxRGnO+QAcnihufZ8Fwx/i5yb3B+7SdgKkzGx Ce0heDpAXpwrRD2DvOw9w18zW65SVb9MaKs6QH9v2L4wMs4CxUiqtma4O8PsPGyhPlsK sRkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mONjWIGl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q10si12670025ilu.41.2021.09.24.10.56.05; Fri, 24 Sep 2021 10:56:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mONjWIGl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344769AbhIXMyZ (ORCPT + 99 others); Fri, 24 Sep 2021 08:54:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:42988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343934AbhIXMvL (ORCPT ); Fri, 24 Sep 2021 08:51:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 38CE761241; Fri, 24 Sep 2021 12:48:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632487731; bh=dBWPLmhRUuP5AbnOzWV1uHPFnyYPfDzVu8Tw6gvHBWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mONjWIGl/azURAhMItPNLeCMXgfARGQzGzxG7JAAaZ08NB4kUMtFo5AN6hx4v/38o BxZdcgj64Wjld8SY4gwIELQY1Bfsw+JMhF7F0pgLqnA++T9J3AaG4Yrc6/PeLAd5ip uonguEIsznXX7LFU/surqDXxV+pOja6Z/aU+NM0A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Huafei Subject: [PATCH 4.19 06/34] tracing/kprobe: Fix kprobe_on_func_entry() modification Date: Fri, 24 Sep 2021 14:44:00 +0200 Message-Id: <20210924124330.173774576@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210924124329.965218583@linuxfoundation.org> References: <20210924124329.965218583@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Li Huafei The commit 960434acef37 ("tracing/kprobe: Fix to support kretprobe events on unloaded modules") backport from v5.11, which modifies the return value of kprobe_on_func_entry(). However, there is no adaptation modification in create_trace_kprobe(), resulting in the exact opposite behavior. Now we need to return an error immediately only if kprobe_on_func_entry() returns -EINVAL. Fixes: 960434acef37 ("tracing/kprobe: Fix to support kretprobe events on unloaded modules") Signed-off-by: Li Huafei Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace_kprobe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -836,8 +836,9 @@ static int create_trace_kprobe(int argc, pr_info("Failed to parse either an address or a symbol.\n"); return ret; } + /* Defer the ENOENT case until register kprobe */ if (offset && is_return && - !kprobe_on_func_entry(NULL, symbol, offset)) { + kprobe_on_func_entry(NULL, symbol, offset) == -EINVAL) { pr_info("Given offset is not valid for return probe.\n"); return -EINVAL; }