From patchwork Thu Oct 10 20:56:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrii Nakryiko X-Patchwork-Id: 13831112 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DFC5D24451 for ; Thu, 10 Oct 2024 20:57:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE0436B008A; Thu, 10 Oct 2024 16:57:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A67BE6B0092; Thu, 10 Oct 2024 16:57:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E0E46B0093; Thu, 10 Oct 2024 16:57:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 6C6316B008A for ; Thu, 10 Oct 2024 16:57:00 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id DAF00C0870 for ; Thu, 10 Oct 2024 20:56:55 +0000 (UTC) X-FDA: 82658902158.10.D8CA697 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id A7AEA40007 for ; Thu, 10 Oct 2024 20:56:56 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="OdE/XF1b"; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf27.hostedemail.com: domain of andrii@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=andrii@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728593773; a=rsa-sha256; cv=none; b=sc1NDooHu0R5dUNK/LBn1iFqIOIgmpBIsI6A3OLaHWYQGy39InPZvvfP1cPOdtYNEGW+UN fRU3pZKMf+HbJwiAZsruYFDOzxNsJSu4GZ6jokK5msPHBzqV9ioWvI//izgg9JuRewooox 6mB72cU2q1yWyumOa+wSa3J6OEUi9Pk= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="OdE/XF1b"; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf27.hostedemail.com: domain of andrii@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=andrii@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728593773; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=mSexpQZUU8hmqxF1hz9XEZ+jv/OHgDid5UTMA0t74S0=; b=hm1ITGnTk10xQ6yE5B9RSEaSxGmSKpuelDLb7zVxxTWiy7XR/1l81SHRWaIaPTDeUHRvwZ TOVhoa32Xzf0wFrZoMMz88e2gGtyXKxlPCm8V2K7Qn1bTY9ESf6BGwSs26LrqePbFIQLtR w4M4I4Nep102T8n/dMwjDg5g/487kUw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 2F5D65C5FCC; Thu, 10 Oct 2024 20:56:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22F7FC4CEC5; Thu, 10 Oct 2024 20:56:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728593817; bh=R2MF70Qe5RyiJ7bapva+CdTRJ3ORlm3QRnJgpBNcwdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OdE/XF1bptJss+RjCSwJXgar0qqj6hZ1g1s6lERBGX2VMmD6i1AXUd2ErsiARXGNW YRD21MpcXIx2VN8huDFgvMAkI2ywlHm1TLyrzAqmANnFxbUj513wQorX4kzCCbnNRF GA4pK3Mwa3/NB+GEQOQe8KCIJK85CcSZMGYtSaHpdZWuYJ7DbHT9VKA9XLmfNXtAXz BM2DzYEHyr6b1/yP6r6vqwCwOgdbFLq3QZ+VYIPzk4x+4WVdjutVExOVZR/DO9yjpN lyRpste/timi9kH9OupllEhR2R79MWCKf6hny5yBMJ2rsl4aUU6KtsLlmgq+io3mO2 gOytO7LwqRWfA== From: Andrii Nakryiko To: linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, peterz@infradead.org Cc: oleg@redhat.com, rostedt@goodmis.org, mhiramat@kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, jolsa@kernel.org, paulmck@kernel.org, willy@infradead.org, surenb@google.com, akpm@linux-foundation.org, mjguzik@gmail.com, brauner@kernel.org, jannh@google.com, mhocko@kernel.org, vbabka@suse.cz, shakeel.butt@linux.dev, hannes@cmpxchg.org, Liam.Howlett@oracle.com, lorenzo.stoakes@oracle.com, Andrii Nakryiko Subject: [PATCH v3 tip/perf/core 3/4] uprobes: simplify find_active_uprobe_rcu() VMA checks Date: Thu, 10 Oct 2024 13:56:43 -0700 Message-ID: <20241010205644.3831427-4-andrii@kernel.org> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241010205644.3831427-1-andrii@kernel.org> References: <20241010205644.3831427-1-andrii@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: A7AEA40007 X-Rspamd-Server: rspam01 X-Stat-Signature: zzdtmb14bzp9cxaurjsp5brqbetc47e9 X-HE-Tag: 1728593816-167092 X-HE-Meta: U2FsdGVkX19xbBgJe8CR98sGA13KM9DJGr3ZWbGmz0CwJRU/bH6fU0hI5YcF5wM2H1hetRTEwe0m2VaQ+69QnKjVqSXc+GVcJVC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ErhCSOXK2yScQ91KNGnJcgih3FQ/jXhRU6nKNrMEh5WPsDEPW2Yg3pJVBCDRT6ghl1mxqo/aapf1FLJRCRN6IfUZaGhIsmzsvnF/LLrAMi2EqGOtw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: At the point where find_active_uprobe_rcu() is used we know that VMA in question has triggered software breakpoint, so we don't need to validate vma->vm_flags. Keep only vma->vm_file NULL check. Acked-by: Oleg Nesterov Suggested-by: Oleg Nesterov Signed-off-by: Andrii Nakryiko --- kernel/events/uprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 2a0059464383..fa1024aad6c4 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -2057,7 +2057,7 @@ static struct uprobe *find_active_uprobe_rcu(unsigned long bp_vaddr, int *is_swb mmap_read_lock(mm); vma = vma_lookup(mm, bp_vaddr); if (vma) { - if (valid_vma(vma, false)) { + if (vma->vm_file) { struct inode *inode = file_inode(vma->vm_file); loff_t offset = vaddr_to_offset(vma, bp_vaddr);