Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2534887rdb; Mon, 25 Dec 2023 16:21:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IFETwaximOy+aODoRgL1FIkPP8nFaNuHgjXJ1qt4kwH6X2iLzuFh+7NcdzEV+qZI5O904vv X-Received: by 2002:a05:6808:2e8c:b0:3bb:a758:aaa5 with SMTP id gt12-20020a0568082e8c00b003bba758aaa5mr2370019oib.87.1703550061261; Mon, 25 Dec 2023 16:21:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703550061; cv=none; d=google.com; s=arc-20160816; b=GHrIecPl1+G0/LZ8eRF53rTUaLlchujblooFD9Pf60QZTg35Fpjq0S4ojnet7zXgMc M7ZuWjb6AgTqcB14ak9GHDWagst+Up0FL9qyYhTFOLT28U9KB4uIJK3C4/40650ucoRD ZbrgiD7xAG9BYPAb1OXZBiU/VPDoetsPbCId8RtkStw2ahI3A/eW9v6zPMO5sSlH4fFu ahTgAmTuWmRBUaAuwpn3KhPgKHL2PHl8pjBIKwb/9t10n5jyOBj2ZzyTsiyHrL/3tJlg ZWls3wjH5nWHW/x9y3IeuYiyuDPw2wQI8rHAa8vnd+zpax+mEyF2MyTydC2eIEY3dhhG Yt4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=4dRebsoPZXgpjM72s5Srlz7pV4hQlbLI67srErxaX78=; fh=o/rrZCnZyJ9PlHt2EJb/EO6w6OBE7MFj8wlL86OtJOY=; b=Cq8D2xD4018Dk7qnhsgfVntNQCvbaOZcOQ6kS47SNq1QbuPXLAW2fki+7HTH14UTmv WFtkLKIpEsDPLeLh517Dd7bNZLFFBoiTTErGdRBXWD+zrxG2VE6Tk0AX6thwgt1LGqw2 9JnRJD40H5IcUulSh1k6j3xBIrGmzJ7fjGT9VsgWHVPjtyyikg9gOUuucT7cvO74PELI wHrqhe8lEArInmP5pF2crKei78yTnK2AJlXhILsvFA0/77/Hy4KX63IX0wvz8ctgWbLz Di3Rk8fqYCVDGqBB/LCyx9cgfnw3vjl/31vCstcw3QcONx7yqRdDcqEZYkf0xc3LT5XV UzkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EGulxQ0a; spf=pass (google.com: domain of linux-kernel+bounces-11195-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11195-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bv192-20020a632ec9000000b005b95ee3edc6si8647675pgb.628.2023.12.25.16.21.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Dec 2023 16:21:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11195-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EGulxQ0a; spf=pass (google.com: domain of linux-kernel+bounces-11195-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11195-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DDAE6282593 for ; Tue, 26 Dec 2023 00:21:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5AD9B1874; Tue, 26 Dec 2023 00:20:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EGulxQ0a" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8400715CB; Tue, 26 Dec 2023 00:20:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3ECEC433CA; Tue, 26 Dec 2023 00:20:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703550029; bh=viWaVDgZggRIC+o1djZ9IF495Y7uvJgX50ROW6lgb8E=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EGulxQ0aRmTNruUx3GKzXeud8BJciXVftEVkUSyTpcOIM3yhzQuVhvCx5B9WS1ARx bg41Z/eMW1yPZASeWOrhYDYnZTdeW044e9NidLVmOIAnzU5UhyMCIZKgYgrtedg6dc 2xDec3CDR5P8CE7J6UeZsWwU3Mtg+td3ATN0DqSmA0R9nWvUsETe5phgQXIL5Mul+L EPrIfxggPTVih0FGqZPxlxbOthFTyJ+nbXCzfr1U2twCPPGyrbUqBRk+B0TSr7IrO3 9RNrFlvNi3Hm8nDBzg/XqV8g5GBnPKu3Wd9gM9Tb3mIexbcPpplmAQqhUe2gGD8mcY yZtgOYUUuThaQ== Date: Tue, 26 Dec 2023 09:20:23 +0900 From: Masami Hiramatsu (Google) To: "Masami Hiramatsu (Google)" Cc: Alexei Starovoitov , Steven Rostedt , Florent Revest , linux-trace-kernel@vger.kernel.org, LKML , Martin KaFai Lau , bpf , Sven Schnelle , Alexei Starovoitov , Jiri Olsa , Arnaldo Carvalho de Melo , Daniel Borkmann , Alan Maguire , Mark Rutland , Peter Zijlstra , Thomas Gleixner , Guo Ren Subject: Re: [PATCH v5 11/34] function_graph: Have the instances use their own ftrace_ops for filtering Message-Id: <20231226092023.2383d0d05c1120c094302685@kernel.org> In-Reply-To: <170290522555.220107.1435543481968270637.stgit@devnote2> References: <170290509018.220107.1347127510564358608.stgit@devnote2> <170290522555.220107.1435543481968270637.stgit@devnote2> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hi, On Mon, 18 Dec 2023 22:13:46 +0900 "Masami Hiramatsu (Google)" wrote: > @@ -408,15 +395,51 @@ int function_graph_enter(unsigned long ret, unsigned long func, > return -EBUSY; > } > > +/* This is called from ftrace_graph_func() via ftrace */ > +int function_graph_enter_ops(unsigned long ret, unsigned long func, > + unsigned long frame_pointer, unsigned long *retp, > + struct fgraph_ops *gops) > +{ > + struct ftrace_graph_ent trace; > + int index; > + int type; > + Here, I found that this needs to check whether the fgraph_array[gops->idx] is still valid or not. When unregistering the fgraph, fgraph_array[idx] is cleared (with fgraph_stub) and disable ftrace. So there is a chance to hit this and it will mess up the shadow stack because gops->idx is already invalid. Thank you, -- Masami Hiramatsu (Google)