Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1006830pxf; Thu, 1 Apr 2021 21:17:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrEuUyyB+ggOIrvxnSr5vvSW/VEhYOiNpWF7KsaWtiUY0oiPbMCCDqyhzFukpidOozPci+ X-Received: by 2002:a17:906:da0e:: with SMTP id fi14mr12722830ejb.188.1617337046014; Thu, 01 Apr 2021 21:17:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617337046; cv=none; d=google.com; s=arc-20160816; b=Nk0Hed2anuJHFM9VFgFGolaHBVWZhZZFzCG5e4G3V6zLQdj3pnSplhOz4s7VFerbbx FrhxAjj6yeWHTeh8Pj+zu71ML/KHIf5Xp4PzhwZCLWwqo8Oo3euMkwpQfJztesNaHIry 0aNbCjB9nGAt5SmhFJgptEw4VtoN5SzZAPNtCjruXkM0f5Yjm4Io4N9bsrDjkvpj95ln KJUAkDyIYmvc1xXlQOVDhSZNe238s24tyRsU2Dzx4zsU9z1OIl2ZKztoUixSUm49A5JH 7kgcLPUpDOgHapl7U87fa76mkDlRmIjfUuJAlSotH4L+LxjSPwTckknWGc55IJLMq8Q1 aoVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=EF04ZQkeFciI3OPVClfJodus6PK+ab706FdkNzAwhhM=; b=yp9O0+ssRJxZRhFanvb+RuDSpd04Uor9o9HN8h7lTRc1tQketHydv6S7307oWFddCd vkhyXBCzedlEpu3YjF7H5nfz4CTjGhJkeWLN7WyvYyxRHp7dyb98cjqHh0iagzZlXcVO rSAqfF3PE8do9U1aJoMAU7wnVZhCncio8nUgXrC4Gx9lUuYc7Z1XjNn4CTF2goTNpQnl PpdP4SEZvU7NQ6T+aABBoqCJt1EQbKRRM5jLnzysbwSPw1fnqc/El/KvWXY0EYXFzcrn 6rQvzv5Yi7G16ToWXwBzK7GtO5n69HNZ9Q+bYZtIY/IZnY/oN6kQbikO1SJaSngIX6Tz llqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=YnksgUvT; 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 fx16si5447737ejb.342.2021.04.01.21.17.03; Thu, 01 Apr 2021 21:17:25 -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=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=YnksgUvT; 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 S229605AbhDBEQi (ORCPT + 99 others); Fri, 2 Apr 2021 00:16:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbhDBEQi (ORCPT ); Fri, 2 Apr 2021 00:16:38 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76A6FC061788 for ; Thu, 1 Apr 2021 21:16:36 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id e18so3672404wrt.6 for ; Thu, 01 Apr 2021 21:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EF04ZQkeFciI3OPVClfJodus6PK+ab706FdkNzAwhhM=; b=YnksgUvTp/aj/gKETPzhozoW5W6T/U14dYMauYuYflKWD8oXsbKHIgk/5UM7FgMBXS +BTLAkLs2N7OW+GbQSMqXVZeVVqP3RuO39RaPprBCyTCKfTE3OZu1hT+q59bbwpxI4KV vp+HYS6aC3a4n48AgGFXM0pD0faBVwawGv6qZ0sYE6SWO/zhmt+G9RzM7VW40KhH5kog hFUAYZ/1uLJkT5oGyKtjgQqsWioshEX565M97SN0U0iYThjmna7XyXPBnH5rzPh9zWye 0gQvDp+V8v4z+k/99thMEzz+vYpHcNrqBQt7c8a9fUot7/d5O5aqQRoHaFmdTxVxWZth a7ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EF04ZQkeFciI3OPVClfJodus6PK+ab706FdkNzAwhhM=; b=ImQ/IPSGEpK8PSTdZ+xJKlUKlxM6Bd2s9boHGDudmY9vFf3puihU8FW2HxudDh7RNm 2xQd0qspFzCUVQd4oLAe06qQjEG2PusPy99v0xoEdl8mNKh+SGhkBLn3ZHnk2SFxIn+E 5BCE3a1Cj8bth2C0Zgzg7LtngYcKlkoFiyZP9gLeL3Uq0gseBn97qf461G1U49ygcGto EBXZx7U+Dcv0zC9AwJSkHSvFo/0lMVi8antmAlhyeQSWiM6IEzv2i/aO0YLb7nFYjjKy krccAc1WDJnZaXpr6aZ0Y/TYgfcvW11OTMIkfAxd3V2QT7m+7JkYH6SZA47ZyklmMIYt t5pg== X-Gm-Message-State: AOAM533tD+C+2rkZbkmyuBDqmnMw/wL3n9PkDLXFg1jtv2bScw6oRR4w kIDxqQDwF9irfTCYglVBmW7zTPCvZfSu3N8t9NK4kQ== X-Received: by 2002:adf:9544:: with SMTP id 62mr12966999wrs.128.1617336995047; Thu, 01 Apr 2021 21:16:35 -0700 (PDT) MIME-Version: 1.0 References: <20210401002442.2fe56b88@xhacker> <20210401002724.794b3bc4@xhacker> In-Reply-To: <20210401002724.794b3bc4@xhacker> From: Anup Patel Date: Fri, 2 Apr 2021 09:46:24 +0530 Message-ID: Subject: Re: [PATCH v2 5/9] riscv: kprobes: Implement alloc_insn_page() To: Jisheng Zhang Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Song Liu , Yonghong Song , John Fastabend , KP Singh , Luke Nelson , Xi Wang , linux-riscv , "linux-kernel@vger.kernel.org List" , kasan-dev@googlegroups.com, netdev@vger.kernel.org, bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 31, 2021 at 10:02 PM Jisheng Zhang wrote: > > From: Jisheng Zhang > > Allocate PAGE_KERNEL_READ_EXEC(read only, executable) page for kprobes > insn page. This is to prepare for STRICT_MODULE_RWX. > > Signed-off-by: Jisheng Zhang Looks good to me. Reviewed-by: Anup Patel Regards, Anup > --- > arch/riscv/kernel/probes/kprobes.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/arch/riscv/kernel/probes/kprobes.c b/arch/riscv/kernel/probes/kprobes.c > index 7e2c78e2ca6b..8c1f7a30aeed 100644 > --- a/arch/riscv/kernel/probes/kprobes.c > +++ b/arch/riscv/kernel/probes/kprobes.c > @@ -84,6 +84,14 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) > return 0; > } > > +void *alloc_insn_page(void) > +{ > + return __vmalloc_node_range(PAGE_SIZE, 1, VMALLOC_START, VMALLOC_END, > + GFP_KERNEL, PAGE_KERNEL_READ_EXEC, > + VM_FLUSH_RESET_PERMS, NUMA_NO_NODE, > + __builtin_return_address(0)); > +} > + > /* install breakpoint in text */ > void __kprobes arch_arm_kprobe(struct kprobe *p) > { > -- > 2.31.0 > > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv