Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2563041rdb; Fri, 22 Sep 2023 02:12:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFSQcnqgl8feos86DaJR/qvwj765pTEsStLIg/Qw1rBoTsWAYoo6ConGoU/L9FXmcRVhcB5 X-Received: by 2002:a17:902:a5ca:b0:1b3:d4ae:7e21 with SMTP id t10-20020a170902a5ca00b001b3d4ae7e21mr6861068plq.63.1695373977684; Fri, 22 Sep 2023 02:12:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695373977; cv=none; d=google.com; s=arc-20160816; b=y/WYJbEOzTm9B6iRze188TJ+aQXjyWnN+P8IOpY22hymJzu0bL4+lYC1yiyi6gbF+l CWP/4qgo2j0OrkD7SqK96Tf5Lg968f0lHOezEmiATenPBzjqXLMig9qa6psTey9K20RA crKCk6DbLzfU80Icbyhbh0ajhsbYasCo3LLnFBg89osGdYl1JtmlyOy4Hu5xs4o0/zG9 ixHN1J+tkG+/+5cPSVfJfT2tLIwVbIQkYZwm3Cgz2KGYbWj6+Cwv9OwqxBuO3Py9cNgO VyEMMvxyY4f9pSbPi1C+yJ5CmhuYq+XcLUeV1IStsXvCors1zqzmkBmtMksrPNGmz8M9 v8CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=cD7XUg298xVjGqeR1Ug2Ktt8gpiErOYhno/n1pb06F8=; fh=6Otu3Cl0AyxJYkeVS9CR7IZatm9rlBQD02idN11e8GY=; b=QcfwyyvWUqWGpGi0X4WBgwjtiWdJYjfe1UCCnjcI19mvL0Knbbc5lFbsppsb9rC8eF jmtSinHSt/ZWGj45WZecScy51Et1NxsOHtb+Un52g1nxExQLt/krX1S6Y5P+AGIsn+gc KAQS0SbhvDjYmhkrMAUa+n0e3P/H4I6Bq1ouS1sI3g34E1jh20bWhdUxbR3G/urZ2o92 ByhSP5K5o/JGFSW8OclAjPbhM4nY+kO2CcDgqVvo8KSYwg55wJgtgspYDFxTG/Ysdng8 bSrAuG3VBR31xRUYwfxXKZAsbNuoZcH+PjqiPx+hbu31fVNVGBsR8WkRtdcpgtSiLVJ7 5Uew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CjAAOHnW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id 21-20020a170902e9d500b001c0dab08decsi3209650plk.499.2023.09.22.02.12.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 02:12:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CjAAOHnW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7FDAC82E3C75; Fri, 22 Sep 2023 01:55:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232719AbjIVIzu (ORCPT + 99 others); Fri, 22 Sep 2023 04:55:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232389AbjIVIzt (ORCPT ); Fri, 22 Sep 2023 04:55:49 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DE77A9; Fri, 22 Sep 2023 01:55:44 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B218CC433C9; Fri, 22 Sep 2023 08:55:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695372943; bh=8QkGhwghTGYPhExKboS3z0PsUiDKGGvXCleAsd5SH5o=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=CjAAOHnW+m8+RDAztDmFbJSI8mdUHvPboMtroHiybyvatO27zYyfR1Wv55g8Fv01I te0s9HGkJ0VGUxcVzi6S21q5ZnP3kW3G91E9EzkcgwFh/S+KI1A7tuuEMTGE3HIqBt 6nRrji+IFh6kZxhnMEpdwcEddc5XEiLgoKEsYESe9+KRFo95Dw/rmUlDTh3/54BTTX 9KM5MArpAD0s7o4CKVI6Ii4apE868YOc1Vz8d3/fGW7P9s5e+247+f0d/ycaOQufD9 8mHhukuVVMeyYfCV4bv8fVCeskg+IFFN9ztlmxGPfhc3ExSSu6BsWAGJwgW8ktELWJ FSaXLLenObg+g== Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-502a4f33440so3234084e87.1; Fri, 22 Sep 2023 01:55:43 -0700 (PDT) X-Gm-Message-State: AOJu0YyoBMjZb8rQESVje9/kRPLVWuTOkCtq5JEZr4gWNmQaTKnELTh/ rNJEHyctSpE+6kVmt2HO/SEyUHB8fr33pwPeRNw= X-Received: by 2002:ac2:5bc5:0:b0:503:79e:fb7b with SMTP id u5-20020ac25bc5000000b00503079efb7bmr6817575lfn.68.1695372941964; Fri, 22 Sep 2023 01:55:41 -0700 (PDT) MIME-Version: 1.0 References: <20230918072955.2507221-1-rppt@kernel.org> <20230918072955.2507221-7-rppt@kernel.org> <9b73ad3d-cfda-bce5-2589-e8674a58c827@csgroup.eu> In-Reply-To: <9b73ad3d-cfda-bce5-2589-e8674a58c827@csgroup.eu> From: Song Liu Date: Fri, 22 Sep 2023 01:55:29 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 06/13] mm/execmem: introduce execmem_data_alloc() To: Christophe Leroy Cc: Mike Rapoport , "linux-kernel@vger.kernel.org" , Andrew Morton , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Catalin Marinas , "David S. Miller" , Dinh Nguyen , Heiko Carstens , Helge Deller , Huacai Chen , Kent Overstreet , Luis Chamberlain , Mark Rutland , Michael Ellerman , Nadav Amit , "Naveen N. Rao" , Palmer Dabbelt , Puranjay Mohan , Rick Edgecombe , Russell King , Steven Rostedt , Thomas Bogendoerfer , Thomas Gleixner , Will Deacon , "bpf@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-mips@vger.kernel.org" , "linux-mm@kvack.org" , "linux-modules@vger.kernel.org" , "linux-parisc@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "linux-s390@vger.kernel.org" , "linux-trace-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "loongarch@lists.linux.dev" , "netdev@vger.kernel.org" , "sparclinux@vger.kernel.org" , "x86@kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 22 Sep 2023 01:55:49 -0700 (PDT) On Fri, Sep 22, 2023 at 12:17=E2=80=AFAM Christophe Leroy wrote: > > > > Le 22/09/2023 =C3=A0 00:52, Song Liu a =C3=A9crit : > > On Mon, Sep 18, 2023 at 12:31=E2=80=AFAM Mike Rapoport wrote: > >> > > [...] > >> diff --git a/include/linux/execmem.h b/include/linux/execmem.h > >> index 519bdfdca595..09d45ac786e9 100644 > >> --- a/include/linux/execmem.h > >> +++ b/include/linux/execmem.h > >> @@ -29,6 +29,7 @@ > >> * @EXECMEM_KPROBES: parameters for kprobes > >> * @EXECMEM_FTRACE: parameters for ftrace > >> * @EXECMEM_BPF: parameters for BPF > >> + * @EXECMEM_MODULE_DATA: parameters for module data sections > >> * @EXECMEM_TYPE_MAX: > >> */ > >> enum execmem_type { > >> @@ -37,6 +38,7 @@ enum execmem_type { > >> EXECMEM_KPROBES, > >> EXECMEM_FTRACE, > > > > In longer term, I think we can improve the JITed code and merge > > kprobe/ftrace/bpf. to use the same ranges. Also, do we need special > > setting for FTRACE? If not, let's just remove it. > > How can we do that ? Some platforms like powerpc require executable > memory for BPF and non-exec mem for KPROBE so it can't be in the same > area/ranges. Hmm... non-exec mem for kprobes? if (strict_module_rwx_enabled()) execmem_params.ranges[EXECMEM_KPROBES].pgprot =3D PAGE_KERNE= L_ROX; else execmem_params.ranges[EXECMEM_KPROBES].pgprot =3D PAGE_KERNE= L_EXEC; Do you mean the latter case? Thanks, Song