Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp1233118pxa; Fri, 28 Aug 2020 07:22:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywv0L6tV2O9Di+VmH6KyAlXZPEN9RMlksItUxx2kgcrmIM1Pgmi4NMi0s0jRyfDdwEmHcu X-Received: by 2002:a50:f398:: with SMTP id g24mr2085520edm.62.1598624560209; Fri, 28 Aug 2020 07:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598624560; cv=none; d=google.com; s=arc-20160816; b=fogC7NKwbn9JWUWaFOP1spphmvf+rFc0el8j6Uf2zQMj+sxZwLXVKRemiU0n8B40mG 33UG/4D6RJ3flF5t8UTf27d7j7A9aN45aqYHlqQMWHqeJesYY5nEUmWywq+mkzdtX8SQ AW2nNSdu5E4U4376g/9zQ5ymjqlMBqBMBfqqAKr+NG78ktPqiQKz7ByrWWsZmeRQieUj QggpZB8Vt6n6UkrPbA+qNQpfFXy2veGi9AopAvve3EKhofLcL61QZMO9iAdC5aWz+ENI ZaXpqrbewn5yUTh1TZj6AphEYdenvKRueu2zEEEHcI1/Kh+z0m2Ch/DMIDfBKG+D8rY8 k5bA== 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=CgkzEyu0nU72gWHm4QE/GrxCk7mtJkJ1KRfoVj7KTxU=; b=CwY/TVua4zJaWsq4l1b1jIKn43goBq4Lmp2FTdowgzz88+jLHEgwEcE/dBc+AzVLkS xlvXL9601Z3S/xA9zlVCqbJhj+5b7n2dm37VWLXT35Yc/hVngzS2xOvIBLn68+T1ncDK rgKN8g2B7Ob+kx6Q7orC6Z7c3CAY7rq/7UfL2L1BJ/sNaz4EEst0uL5Xj32BTaIWoimk FIC+qNZ//wt9m/qCajRK9sKyxf3F8KIO256+CRJeRhmOpJ+disG529a7GeoAP5qUD623 uynFiz668oRrkYJk/rb52xGrgc673IDqaIck8SxLJDm4pnhwIiFlfX60TKX2IbTrCbd5 9Ogw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=qXErMp4M; 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 bx2si719710edb.377.2020.08.28.07.22.18; Fri, 28 Aug 2020 07:22:40 -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=qXErMp4M; 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 S1726579AbgH1OTj (ORCPT + 99 others); Fri, 28 Aug 2020 10:19:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725857AbgH1OTe (ORCPT ); Fri, 28 Aug 2020 10:19:34 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D46CC061264; Fri, 28 Aug 2020 07:19:34 -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=CgkzEyu0nU72gWHm4QE/GrxCk7mtJkJ1KRfoVj7KTxU=; b=qXErMp4MVkKtX8+yfaAqaWid7U hp1ZkOY9TbMDQoNfoh50zxxhiXqksCVZymihPqoo3xdi9ufHVlPx1z2eeG0jJI79WkyvuhVAUvEVl avjbStouRLh5Y+vQbOaTVKFm6dfezPizfn379Z5MINu4MDKHgURH5/1aPv/1ZvMBKRRimcRgWQ8sB 46rsc2KEFDoZ5J/NPy3w7ADlimjd+OF7gGJBTq0H1D621rD329L4O0NSG3o5fougcXt4nGQUIEBxw F0m9k0e2LZdoUfcpu3tjtKGl2Na8KH/i5VsK6vCMLiEFAtbvoY1jVXWVloXeUHvZfbUAU20l7VPqu f2UJG26Q==; 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 1kBfDr-0006yS-Qg; Fri, 28 Aug 2020 14:19:19 +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 21F7C300238; Fri, 28 Aug 2020 16:19:17 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C80752C5FDBE8; Fri, 28 Aug 2020 16:19:17 +0200 (CEST) Date: Fri, 28 Aug 2020 16:19:17 +0200 From: peterz@infradead.org To: "Eddy_Wu@trendmicro.com" Cc: Masami Hiramatsu , "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: <20200828141917.GE1362448@hirez.programming.kicks-ass.net> References: <20200827161237.889877377@infradead.org> <20200827161754.359432340@infradead.org> <7df0a1af432040d9908517661c32dc34@trendmicro.com> <20200828225113.9541a5f67a3bcb17c4ce930c@kernel.org> <23d43cfb12c54a1fbc766ea313ecb5a6@trendmicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <23d43cfb12c54a1fbc766ea313ecb5a6@trendmicro.com> 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 02:11:18PM +0000, Eddy_Wu@trendmicro.com wrote: > > From: Masami Hiramatsu > > > > 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 > > I think new process created by fork/clone uses a brand new kernel > stack? I thought only user stack are copied. Otherwise any process > launch should crash in the same way I was under the same impression, we create a brand new stack-frame for the new task, this 'fake' frame we can schedule into. It either points to ret_from_fork() for new user tasks, or kthread_frame_init() for kernel threads.