Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp523390lqe; Sat, 6 Apr 2024 10:57:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWQzNRZG9G1kdBhKeZDGLszuBkSeUbeXPqBEtbsfejS+joSSXKvBrq+vPOqckexwtWiamNQ3poJYx1EEi1Rhz0U56/CyoKsoEHna0ZEtw== X-Google-Smtp-Source: AGHT+IFcDsCdnmwmz2G78ijryhUlF51cqtsBT8ZOr4MxMMlLbrD1yjC2sFqZwBYDKu497fnG2Tm1 X-Received: by 2002:a17:907:2d25:b0:a51:beb9:956d with SMTP id gs37-20020a1709072d2500b00a51beb9956dmr1696404ejc.66.1712426268244; Sat, 06 Apr 2024 10:57:48 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id by17-20020a170906a2d100b00a51adadc228si1389943ejb.291.2024.04.06.10.57.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Apr 2024 10:57:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-134055-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@redhat.com header.s=mimecast20190719 header.b=OdffbgDd; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-134055-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134055-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id C3EFD1F217B4 for ; Sat, 6 Apr 2024 17:57:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 253A54596B; Sat, 6 Apr 2024 17:57:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OdffbgDd" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 BB5723EA86 for ; Sat, 6 Apr 2024 17:57:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712426260; cv=none; b=BURfFa9q0VctL/DzF3KuC/620gE+FkEBFWu2rYCIWyOWJW9WcwIrHB4ZKeZZqF/hUMd35/AQBzFp7nMF41QJHK0JRBhNh8J0uydL/avha9qAz2yNqQa89vhzdul59PRnGE2pWc1fBsbwhD//v04zKpuQYmbsdZ+nePgXkjr8aXw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712426260; c=relaxed/simple; bh=QCupe60Wi+dfmZCvC412Qmcmr7ZevvaEiPxSMLn4g/4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ofCe43EhUkZ+S1GF7S3BnnnEsvj6H2ex8dHjKsREK9I1CqwFSQmyGJJqeZCQmnWzQhmYgIMoh2nU3mRfM19bZ7xtjyuSaWUblmngGnLA0cOnjqP0TT60oJDRmlbgCGJIiKlvM1J3HjczG8Dp+L4Gv8iMgSy2zeT3nLWV3diQzuI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=OdffbgDd; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712426257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GReCWnFPjN08AjP0bPCM7WpKp2nC3psJcp83CUkmhh4=; b=OdffbgDd80GTn2AyeG8h+fk3Vgd6P9tjNDP+hyvn2avKL1G+Qmm9joLMtVdHf0QrUA/opl 0E0zzmknH56/4wo1JANzfdpQ1HEmucMBAbie+HvV2NbtI/EQF5eBzfcNaBTrdHzgbKfSeZ jIWCA1TX1IslSbufJ37pjw35CiotYmM= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-135-1Cg6l7qIPZ2PwNbQHHUDpg-1; Sat, 06 Apr 2024 13:57:34 -0400 X-MC-Unique: 1Cg6l7qIPZ2PwNbQHHUDpg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 32BB53C0F69A; Sat, 6 Apr 2024 17:57:33 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.226.136]) by smtp.corp.redhat.com (Postfix) with SMTP id F1667100F4D8; Sat, 6 Apr 2024 17:57:28 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Sat, 6 Apr 2024 19:56:08 +0200 (CEST) Date: Sat, 6 Apr 2024 19:55:59 +0200 From: Oleg Nesterov To: Masami Hiramatsu Cc: Jiri Olsa , Andrii Nakryiko , Steven Rostedt , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org, Song Liu , Yonghong Song , John Fastabend , Peter Zijlstra , Thomas Gleixner , "Borislav Petkov (AMD)" , x86@kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCHv2 1/3] uprobe: Add uretprobe syscall to speed up return probe Message-ID: <20240406175558.GC3060@redhat.com> References: <20240403230937.c3bd47ee47c102cd89713ee8@kernel.org> <20240404095829.ec5db177f29cd29e849169fa@kernel.org> <20240405005405.9bcbe5072d2f32967501edb3@kernel.org> <20240404161108.GG7153@redhat.com> <20240405102203.825c4a2e9d1c2be5b2bffe96@kernel.org> <20240405110230.GA22839@redhat.com> <20240406120536.57374198f3f45e809d7e4efa@kernel.org> 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-Disposition: inline In-Reply-To: <20240406120536.57374198f3f45e809d7e4efa@kernel.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 On 04/06, Masami Hiramatsu wrote: > > On Fri, 5 Apr 2024 13:02:30 +0200 > Oleg Nesterov wrote: > > > With or without this patch userpace can also do > > > > foo() { <-- retprobe1 > > bar() { > > jump to xol_area > > } > > } > > > > handle_trampoline() will handle retprobe1. > > This is OK because the execution path has been changed to trampoline, Agreed, in this case the misuse is more clear. But please see below. > but the above will continue running bar() after sys_uretprobe(). .. and most probably crash > > sigreturn() can be "improved" too. Say, it could validate sigcontext->ip > > and return -EINVAL if this addr is not valid. But why? > > Because sigreturn() never returns, but sys_uretprobe() will return. You mean, sys_uretprobe() returns to the next insn after syscall. Almost certainly yes, but this is not necessarily true. If one of consumers changes regs->sp sys_uretprobe() "returns" to another location, just like sys_rt_sigreturn(). That said. Masami, it is not that I am trying to prove that you are "wrong" ;) No. I see your points even if I am biased, I understand that my objections are not 100% "fair". I am just trying to explain why, rightly or not, I care much less about the abuse of sys_uretprobe(). Thanks! Oleg.