Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp1216069pxa; Fri, 28 Aug 2020 07:01:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMfVsitaDqEQCFFQnZZpS51T7XBCSzzTrWtINDEyJLTmIZ6+t4Sh1aITe+QtaFB7JkbVtY X-Received: by 2002:a05:6402:1584:: with SMTP id c4mr2063162edv.192.1598623271070; Fri, 28 Aug 2020 07:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598623271; cv=none; d=google.com; s=arc-20160816; b=Ggj4PKXwqhCPyHUf1+Vp9ST256VdKHQ5A52Bcz8TfWV1A1PAK8FIYc5oZC0EJ4HqG8 D2oa0+AEz6DKtT8REVeC4dXTx62IYhCWnd1uz0WMNrapNr3P7sqJZPwsmo4GOSKZrnSn KXZp5zgGZg1VQoymHtZbQ756dydvKJAOCppunL14dsOg5S1AakGPPmBf2JMI+Nhep3pW 6q+hxMPVUvj5r2WYUvxVPQV6J+oYmeySuvDQzd61lpoJeAPyXEpzJK6Y7fs/inklV8Lm mgz51BebkBphY9TuMNJyZgss8Iq/9kDNPlQeAC2gFjFRK0kYL4O4Jz/LrHbyUsLh9mYp bXBQ== 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=4hGq8CaOAFXxKPe7WDzEFN5Pehs2C2y/wZVImhCCsFw=; b=E7G+CP3lj3eKlbtKgXNPRbcMB+kyU6DQkjwuJWXJvhsboR3vQeKaJN/2BhIaihF7SN Ofd9Y9Il9t8IpGuJyCTHRUpeE/EMmxcB3+yAUZFPaxQ818w0EVdbt3IUkHcq3dAnAUY8 XnErA5Faky18g9lSGZUEI59QRgsDPRdHPGGmthwABDuNxCmQUO40HueJF8VSLZYqJW/M lnhVgWLgI8PoAnH459NUrlK+SrmSee2ZC9gJ/vdVEXrMvakPAf9GccDWAQ1n/vT9201x oh6UOT3TMlJS2TpIboXfNfpmfWcvtdXy4DfO6jkvHiaUbv1bS1M5rkkj2k3p9txIjced J4MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=NHCh0HYE; 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 m26si707544edp.47.2020.08.28.07.00.48; Fri, 28 Aug 2020 07:01:11 -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=NHCh0HYE; 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 S1726900AbgH1N7z (ORCPT + 99 others); Fri, 28 Aug 2020 09:59:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726947AbgH1N6w (ORCPT ); Fri, 28 Aug 2020 09:58:52 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D17FEC061264; Fri, 28 Aug 2020 06:58:46 -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=4hGq8CaOAFXxKPe7WDzEFN5Pehs2C2y/wZVImhCCsFw=; b=NHCh0HYEMyA2HIyS7y4bLZhXQH 2RQukhb5S5+XWbYdrzZHJ7ivfevz4WKBObInOi1SRbg0xRydLAzIdXRG+jpGKV6bFA4w/5NnCx/2x gKVfxmeYbtiUeP2YwIPqDN6jlHPvFKgXFCrmDtcvZCFZ4XlalHDOlWrFqcuoJYs46f3p+fX/ZmBja gqJaS9LCmnkETXqx7RCROgEY7yDdkCfe5QY/eOjeIe7J+HOchvxsAC4PUAerGkbwkZSRwMWd+9OlJ FeG/jccwTljYYNekC0bvM1lPP6Q+t0/XT/uPEKVJtOu4wxqPkROq4U8ZGzRKg4hGWbNYn/QVWgRGK XsNNi2gw==; 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 1kBete-0004EY-Dp; Fri, 28 Aug 2020 13:58:26 +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 078493007CD; Fri, 28 Aug 2020 15:58:24 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B0CB72C5FD7F8; Fri, 28 Aug 2020 15:58:24 +0200 (CEST) Date: Fri, 28 Aug 2020 15:58:24 +0200 From: peterz@infradead.org To: Masami Hiramatsu Cc: "Eddy_Wu@trendmicro.com" , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , "davem@davemloft.net" , "rostedt@goodmis.org" , "naveen.n.rao@linux.ibm.com" , "anil.s.keshavamurthy@intel.com" , "linux-arch@vger.kernel.org" , "cameron@moodycamel.com" , "oleg@redhat.com" , "will@kernel.org" , "paulmck@kernel.org" Subject: Re: [RFC][PATCH 3/7] kprobes: Remove kretprobe hash Message-ID: <20200828135824.GD1362448@hirez.programming.kicks-ass.net> References: <20200827161237.889877377@infradead.org> <20200827161754.359432340@infradead.org> <7df0a1af432040d9908517661c32dc34@trendmicro.com> <20200828225113.9541a5f67a3bcb17c4ce930c@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200828225113.9541a5f67a3bcb17c4ce930c@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 28, 2020 at 10:51:13PM +0900, Masami Hiramatsu wrote: > OK, schedule function will be the key. I guess the senario is.. > > 1) kretporbe replace the return address with kretprobe_trampoline on task1's kernel stack > 2) the task1 forks task2 before returning to the kretprobe_trampoline > 3) while copying the process with the kernel stack, task2->kretprobe_instances.first = NULL > 4) task2 returns to the kretprobe_trampoline > 5) Bomb! > > Hmm, we need to fixup the kernel stack when copying process. How would that scenario have been avoided in the old code? Because there task2 would have a different has and not have found a kretprobe_instance either.