Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp255512pxb; Wed, 14 Apr 2021 14:42:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/XNZ7IWhzaQSWA5kn708nq8IWlAxN5KFypE/oXFBqq4QKo/GOIM/eYaEY8DwYVcksuggs X-Received: by 2002:a63:5b5c:: with SMTP id l28mr317174pgm.363.1618436559429; Wed, 14 Apr 2021 14:42:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618436559; cv=none; d=google.com; s=arc-20160816; b=k2DlttWW63B0A99TRFvXx1lEyr/JlgZvz+2B9zQe04/wx2foHwYkKHPPH25wspWGmy sYy3VMof2jexNVrRNRA81odgOim8ZLh3kZCka6VJ1P5POrObLIGKP1Sv7xkK+U4Jrrnz 6DPytfKNLkEtgA1IgoMfDFgorQ6pGsEHm9pzLCBQjip1BOjXaIjbDXZC3/LUQvZVHP/q qcfm6ZH5MfjCqtadKNKJep+3+VXc/14zdKkF+ZKHJ1qBb9r1R7Kfo2eX7gj+hWeDg+41 z8JpxxIaooX0/rgBTxeenpASol6ckmQo3nfTDnSz+NiSApLk2nhuWOdyepz3oLfsle7H LWBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=eVYyblrdCxIkyUE515ZP4T7v0QY7HK3Eyprs2oJV4Cg=; b=pDaITCNPg5rQgnNMivJy8vwMp7EvW+MS7gwt0PpZ6o/dJwgpa+SbmB7b6hpmagQ62P 8CIoonVUZSIatbllI7MHtsm5Ma3mgWTbx5lWWjtchoG59PBBeqgsmW8cwjdsPseUZpsa Hn5K3u0EU1CD5XThox5uU3y2z809gMIfdnoTcph1MoqSsr33F/CRub70xabSe2lyYp01 N4QRqlyovPW1waMeLg8sKjlI9fF29bEtBfpJT988Lmto34Z+5VltRYzhf/ELLm3q3zJR V2fgGq5AsADWY2sSo07xTqwBjeq3TZCmcRK9PucBo5rSI37QhTX7nDfRuUU7V6giZyHu M0VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rXaoy70o; 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 o19si779734pgu.259.2021.04.14.14.42.25; Wed, 14 Apr 2021 14:42:39 -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=k20201202 header.b=rXaoy70o; 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 S1348163AbhDNIXZ (ORCPT + 99 others); Wed, 14 Apr 2021 04:23:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:40648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348116AbhDNIXX (ORCPT ); Wed, 14 Apr 2021 04:23:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BBA25613B1; Wed, 14 Apr 2021 08:23:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618388583; bh=Km7I9PdJFzfGIP73XKM9CEP0KFnUi+R5roL2Xwtps8g=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=rXaoy70oH0V5AucEU164eRq04UniZC9Si92KuwTd+eoB4bC8qYqvikks9LGa/i4QG Oq8gn+rjfXwmn9DuYD1sJD4fTlbzlVrWC3ZGJMx6bWW+Bu0Flndp+LNLTBfR3N4+c+ McIRdgYoNU98q6mYsxTljrOBzLr3f7kBbnKmgtHBFTCn75ByXP6Rlgx1lMF5GhpaDG E0gvDsByUBpjysWGydNQE9ZKKGBAKuKfU9l0OAK80XZCvoYlVx2AVihd4ZO15DovC8 gIE2LSSfYq/a1npc+8oxeG+p0mk0tmUac4xJRkhsW0UDd4Ub/o8ezxsB8cTeU8N67g Z/9jGc2X9hzjg== Date: Wed, 14 Apr 2021 17:22:58 +0900 From: Masami Hiramatsu To: Jisheng Zhang Cc: Jarkko Sakkinen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Jiri Olsa , linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/kprobes: Simplify alloc_insn_page() with __vmalloc_node_range Message-Id: <20210414172258.e44302c4524644b92ce106ec@kernel.org> In-Reply-To: <20210414152728.418a41fb@xhacker.debian> References: <20210413180231.19b72601@xhacker.debian> <20210413220030.d1cbbc63659dcbc52876696d@kernel.org> <20210414152728.418a41fb@xhacker.debian> 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jisheng, On Wed, 14 Apr 2021 15:27:28 +0800 Jisheng Zhang wrote: \ > > > > On Tue, 13 Apr 2021 18:03:24 +0800 > > Jisheng Zhang wrote: > > > > > Use the __vmalloc_node_range() to simplify x86's alloc_insn_page() > > > implementation. > > > > Have you checked this is equivarent to the original code on all > > architecture? IIRC, some arch has a special module_alloc(), > > > Indeed, this isn't equivarent to the original code. FWICT, the differences on x86 are: > > > 1) module_alloc() allocates a special vmalloc range > > 2) module_alloc() randomizes the return address via. module_load_offset() > > 3) module_alloc() also supports kasan instrumentation by kasan_module_alloc() > > > But I'm not sure whether the above differences are useful for kprobes ss > > insn slot page or not. Take 1) for example, special range in module_alloc > > is due to relative jump limitation, modules need to call kernel .text. does > > kprobes ss ins slot needs this limitation too? > > Oops, I found this wonderful thread: > https://www.lkml.org/lkml/2020/7/28/1413 > > So kprobes ss ins slot page "must be in the range of relative branching only > for x86 and arm" Yes, at this moment. (Not sure we can introduce similar feature on other arch too) > > And Jarkko's "arch/x86: kprobes: Remove MODULES dependency" series look > much better. The last version is v5, I'm not sure whether Jarkko will > send new version to mainline the series. I hope so. If module_alloc() itself is implemented on the generic text_alloc(), I can replace the module_alloc() with text_alloc(). Thank you, -- Masami Hiramatsu