Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2902510pxa; Tue, 25 Aug 2020 06:34:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZ1X3grE7IghIFzSA7MBcAR2fzP5+xgPIoFQJWXT64oxCCZi9fxYcj7CNu+o3moGWc1BRN X-Received: by 2002:a05:6402:743:: with SMTP id p3mr10129900edy.19.1598362444870; Tue, 25 Aug 2020 06:34:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598362444; cv=none; d=google.com; s=arc-20160816; b=HFpSh/BlH3khMYrS2GXrlWNlpDJaq71JtaKlGHcSf2S4y5YgJQ2re8f/MwtSR1we/V CEJo70jZ2f20o5qJyN6W6JczZ0XIq1vwAW969f4RIiLh+z4vczmkf5UjhUXeyV2nkMWg nNFZZZMjKaDoMXYvtKTn0P1y7YvEVo8E3sG6eQ1Hj55oZvE70Pu5sUsTjWp883M/ElYc OXU15w0cvEE2Z+3nxxYY+hxFbLWNp32JjTp2bUQPU9k2Ryc/qUGKSr1SObYPnzdI5csY ts9hIw7Rwsik9iLj50MUqiCy1dR+MlfaFqaQx2OeLXWD/iKhN1zpCt27vfq/7qQwGZIs Akdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=T0iA/ESQ7g89ajHduy7nVinGEeYb5qspM1YNkrQY/OQ=; b=imqPjDbMDNGNjnB6+7y5lQtA+BY3hc8RB35dhd8XR+2lLAhL4Kpu48bWgj8JhB03d0 yIckIsl0uXUHcB2K0AN2C5sSGpbpM7YZ+Wou2C1RIupojFks6UpB/C7mxihw84YXcMji tvqPQu6hhxOPNqPVGATeECYBCNwSNqx66MAsnT08bE2s24kcFuLvUHVHy8E+VpCo3qIC oO/X4eE9VfyJUA6B+VIdFJc34PsH9IP+DYeO/P7k5sgbb+ILyibS9PtrwGRCGn8ldWws lfvVR/PFbNEIiLjlasZOL9wPG4Wl82cTdmT4qgl2UntZ0ZxHQfGYvCjcIGfHrncEmtul 7Rtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=JePRDUdS; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h17si2808532edw.308.2020.08.25.06.33.41; Tue, 25 Aug 2020 06:34:04 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=JePRDUdS; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726631AbgHYNaU (ORCPT + 99 others); Tue, 25 Aug 2020 09:30:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726024AbgHYNaR (ORCPT ); Tue, 25 Aug 2020 09:30:17 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50170C061574 for ; Tue, 25 Aug 2020 06:30:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=T0iA/ESQ7g89ajHduy7nVinGEeYb5qspM1YNkrQY/OQ=; b=JePRDUdSk6wTLpH+cDjmhVmoCP iKx9/roB2SULZZms3G5d07MEjORCH/osBFueYs1IdIS8T62B3Zb0FV8YZVJPYijn74LljtZAH3Qst jITFluYmF2XPojsZy4VrYPd2cj11vHmyhtHLqW4ZcPZ6LuvAfP2JTGV7FCgM6BJhjzDQ3bq8+LJFX cHvaN8Vanpl7dVO29V3pfVQoaU+vdi5ZvCEIoqMPrgJvagRZaBEG0PGrZtK3+RB1qivIGMl3/4S+t HywWwaisgot7VbZ3rYSPUC7hJemtaoOQ5RL7m+6Sc4bAWrnAOFYOdRT/NC3OlfEWdlUF9YyxXiHLe SpibzOMw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kAZ1b-0001Lp-5c; Tue, 25 Aug 2020 13:30:07 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 40F1A3003D8; Tue, 25 Aug 2020 15:30:05 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 29B3421F9DB48; Tue, 25 Aug 2020 15:30:05 +0200 (CEST) Date: Tue, 25 Aug 2020 15:30:05 +0200 From: peterz@infradead.org To: Masami Hiramatsu Cc: "Eddy_Wu@trendmicro.com" , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , "David S. Miller" Subject: Re: x86/kprobes: kretprobe fails to triggered if kprobe at function entry is not optimized (trigger by int3 breakpoint) Message-ID: <20200825133005.GY1362448@hirez.programming.kicks-ass.net> References: <8816bdbbc55c4d2397e0b02aad2825d3@trendmicro.com> <20200825005426.f592075d13be740cb3c9aa77@kernel.org> <7396e7b2079644a6aafd9670a111232b@trendmicro.com> <20200825151538.f856d701a34f4e0561a64932@kernel.org> <20200825120911.GX1362448@hirez.programming.kicks-ass.net> <20200825221555.a2d72c9754284feced6a8536@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200825221555.a2d72c9754284feced6a8536@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 25, 2020 at 10:15:55PM +0900, Masami Hiramatsu wrote: > > damn... one last problem is dangling instances.. so close. > > We can apparently unregister a kretprobe while there's still active > > kretprobe_instance's out referencing it. > > Yeah, kretprobe already provided the per-instance data (as far as > I know, only systemtap depends on it). We need to provide it for > such users. > But if we only have one lock, we can avoid checking NMI because > we can check the recursion with trylock. It is needed only if the > kretprobe uses per-instance data. Or we can just pass a dummy > instance on the stack. I think it is true in general, you can unregister a rp while tasks are preempted. Anyway,. I think I have a solution, just need to talk to paulmck for a bit. > > Ignoring that issue for the moment, the below seems to actually work. > > OK, this looks good to me too. > I'll make a series to rewrite kretprobe based on this patch, OK? Please, I'll send the fix along when I have it.