Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp138905pxa; Wed, 26 Aug 2020 06:55:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLjTJDl6GPFSc9eTuhd8k5eJgfThhXjzBAsLpXOukt0N3+R7HXoDipnSAT8r+8T+loH7lZ X-Received: by 2002:a17:906:644e:: with SMTP id l14mr1704021ejn.60.1598450134130; Wed, 26 Aug 2020 06:55:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598450134; cv=none; d=google.com; s=arc-20160816; b=yifx4fS6oB5GklRM3vI8dq78t6U4VqGhZehJPYd84oaikgRqHPqAyBbQhVvkqIZ45K rgZHXRj38yHVPhOMSKmD1VtegZdof8XywgBVbMjGfzFd1umStDrEE+p1LkHe9R/tvtxT WaV9kZK5wVhPFmvFOvwgINwCeMjT7odWJ88I+vxDXB8+Zk258pub5WgQZ21Ge4nPePTK OtD3+3nmCi5W/SfZkQFb0PeekdIuKCbsaIelctN0bCu2PjYb6mi+74yphDpepuyGDu7T 6R+cXwK6ML9oXPdIfsn7shsCJ6jUwEaDiYHo0cuHp5sQ8gc67Pe6eTd3yLwzF5l+5xVI Spew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=2S1wwmGVZh+SrFG1Kx/a5H6tYe3C1GVyZGIEHQh0nds=; b=Nzhg+dRGXFbOvIwC9+eZLyxWLkv5qTAlxir9hOSgK8Xoooex/dIU9woEu099cAA1pb Wtz6aQJ2CPat0o5LTlvXa3ci6dTF7PWrh7f9DhVFEyqWlqNIkPKlRI9FzTy/zYIpze6P FFl9MX7RRTnNBosv2pyxBLNJmh9LRWMB/4YTQjhUdRpLan6m7mXmtnUKbeaDD0gc76SG 7J82TPNeL9ty5f/v1rjiRdrVjwAsg+MnqWiyMT5fkMYLY/5hqHkjBNvXT+WlrVULeKEE iEAPeSAmSKZ5uNzDuEK7p4v9KeQJ9Bft+VnNDg3sYkAohAGv/32ftquhrDMSU94Idx1i ytxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="j/E+zt4U"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f9si1655624ejq.571.2020.08.26.06.55.11; Wed, 26 Aug 2020 06:55:34 -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=@kernel.org header.s=default header.b="j/E+zt4U"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730558AbgHZNvu (ORCPT + 99 others); Wed, 26 Aug 2020 09:51:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:59454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730554AbgHZNvt (ORCPT ); Wed, 26 Aug 2020 09:51:49 -0400 Received: from devnote2 (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 31A40208E4; Wed, 26 Aug 2020 13:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598449908; bh=JfrtYoof4J1qKW2voT8243gmgO0ySPSskG0PqMYl7jQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=j/E+zt4UuuQbMklEfPBZsLYVlz1BsUK3CPW+SRpjuODk4VgDqLZw0PM7/G2GgnGdb 5YUQfoEKYZvFdChl6JIUwa4S9vSoibnk3+X0WC+PfzQ8nVBetsbnMBy5FD5lxePLtn Fd+ggB9OJPpECHpCuRcc5bpKArQeB0JHRfqmfwF4= Date: Wed, 26 Aug 2020 22:51:44 +0900 From: Masami Hiramatsu To: "Eddy_Wu@trendmicro.com" Cc: "peterz@infradead.org" , "mhiramat@kernel.org" , "linux-kernel@vger.kernel.org" , "x86@kernel.org" Subject: Re: x86/kprobes: kretprobe fails to triggered if kprobe at function entry is not optimized (trigger by int3 breakpoint) Message-Id: <20200826225144.6df009f67b3516a3d0d58e6e@kernel.org> In-Reply-To: <42c65d9e434945c183ead8bef3d89de2@trendmicro.com> References: <8816bdbbc55c4d2397e0b02aad2825d3@trendmicro.com> <20200825005426.f592075d13be740cb3c9aa77@kernel.org> <7396e7b2079644a6aafd9670a111232b@trendmicro.com> <20200825151538.f856d701a34f4e0561a64932@kernel.org> <20200825120911.GX1362448@hirez.programming.kicks-ass.net> <20200826172239.ff175be78ee5f3a4380579c3@kernel.org> <20200826180645.9b609fc05df2a149564df1b8@kernel.org> <20200826190041.2d0ff0fbe154ba62163b0c00@kernel.org> <20200826102545.GF1362448@hirez.programming.kicks-ass.net> <42c65d9e434945c183ead8bef3d89de2@trendmicro.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 26 Aug 2020 13:36:15 +0000 "Eddy_Wu@trendmicro.com" wrote: > > > > -----Original Message----- > > From: peterz@infradead.org > > Sent: Wednesday, August 26, 2020 6:26 PM > > To: Masami Hiramatsu > > Cc: Eddy Wu (RD-TW) ; linux-kernel@vger.kernel.org; x86@kernel.org > > Subject: Re: x86/kprobes: kretprobe fails to triggered if kprobe at function entry is not optimized (trigger by int3 breakpoint) > > > > On Wed, Aug 26, 2020 at 07:00:41PM +0900, Masami Hiramatsu wrote: > > > Of course, this doesn't solve the llist_del_first() contention in the > > > pre_kretprobe_handler(). So anyway we need a lock for per-probe llist > > > (if I understand llist.h comment correctly.) > > > > Bah, lemme think about that. Kprobes really shouldn't be using locks :/ > > Maybe we can have per-cpu free list for retprobe_instance? > This ensure we only have one user requesting free instance at a time, given that pre_kretprobe_handler() wont recursive. That will restrict kretprobe not to probe the recursive call loop... and if a thread is scheduled, another thread will not be probed too. I think lockless kretprobe is finally implemented by merging it's shadow-stack with func-graph tracer. Thank you, > > We may be wasting memory if target function perfer some cpu though. > > > TREND MICRO EMAIL NOTICE > > The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system. > > For details about what personal information we collect and why, please see our Privacy Notice on our website at: Read privacy policy -- Masami Hiramatsu