From: "liaochang (A)" <liaochang1@huawei.com>
To: Steven Rostedt <rostedt@goodmis.org>,
Chen Guokai <chenguokai17@mails.ucas.ac.cn>
Cc: <paul.walmsley@sifive.com>, <palmer@dabbelt.com>,
<aou@eecs.berkeley.edu>, <mingo@redhat.com>,
<sfr@canb.auug.org.au>, <linux-riscv@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH v4 2/8] riscv/kprobe: Allocate detour buffer from module area
Date: Fri, 18 Nov 2022 09:41:03 +0800 [thread overview]
Message-ID: <dadac419-acda-7ba5-b7bb-4bc5b6fee92d@huawei.com> (raw)
In-Reply-To: <20221116202521.6c528955@gandalf.local.home>
在 2022/11/17 9:25, Steven Rostedt 写道:
> On Sun, 6 Nov 2022 18:03:10 +0800
> Chen Guokai <chenguokai17@mails.ucas.ac.cn> wrote:
>
>> @@ -84,6 +85,30 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
>> }
>>
>> #ifdef CONFIG_MMU
>> +#if defined(CONFIG_OPTPROBES) && defined(CONFIG_64BIT)
>> +void *alloc_optinsn_page(void)
>> +{
>> + void *page;
>> +
>> + page = __vmalloc_node_range(PAGE_SIZE, 1, MODULES_VADDR,
>> + MODULES_END, GFP_KERNEL,
>> + PAGE_KERNEL, 0, NUMA_NO_NODE,
>> + __builtin_return_address(0));
>> + if (!page)
>> + return NULL;
>> +
>> + set_vm_flush_reset_perms(page);
>> + /*
>> + * First make the page read-only, and only then make it executable to
>> + * prevent it from being W+X in between.
>> + */
>> + set_memory_ro((unsigned long)page, 1);
>> + set_memory_x((unsigned long)page, 1);
>
> FYI, the above combination is going to be going away:
>
> https://lore.kernel.org/all/Y10OyLCLAAS6rsZv@hirez.programming.kicks-ass.net/
Thanks for reminding, i will use this API in next revision.
> -- Steve
>
>
>> +
>> + return page;
>> +}
>> +#endif
>> +
>
--
BR,
Liao, Chang
next prev parent reply other threads:[~2022-11-18 1:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-06 10:03 [PATCH v4 0/8] Add OPTPROBES feature on RISCV Chen Guokai
2022-11-06 10:03 ` [PATCH v4 1/8] riscv/kprobe: Prepare the skeleton to implement RISCV OPTPROBES feature Chen Guokai
2022-11-06 10:03 ` [PATCH v4 2/8] riscv/kprobe: Allocate detour buffer from module area Chen Guokai
2022-11-17 1:25 ` Steven Rostedt
2022-11-18 1:41 ` liaochang (A) [this message]
2022-11-06 10:03 ` [PATCH v4 3/8] riscv/kprobe: Prepare the skeleton to prepare optimized kprobe Chen Guokai
2022-11-06 10:03 ` [PATCH v4 4/8] riscv/kprobe: Add common RVI and RVC instruction decoder code Chen Guokai
2022-11-13 4:15 ` kernel test robot
2022-11-06 10:03 ` [PATCH v4 5/8] riscv/kprobe: Search free register(s) to clobber for 'AUIPC/JALR' Chen Guokai
2022-11-07 16:55 ` Björn Töpel
2022-11-06 10:03 ` [PATCH v4 6/8] riscv/kprobe: Add code to check if kprobe can be optimized Chen Guokai
2022-11-07 16:56 ` Björn Töpel
2022-11-06 10:03 ` [PATCH v4 7/8] riscv/kprobe: Prepare detour buffer for optimized kprobe Chen Guokai
2022-11-06 10:03 ` [PATCH v4 8/8] riscv/kprobe: Patch AUIPC/JALR pair to optimize kprobe Chen Guokai
2022-11-07 16:54 ` [PATCH v4 0/8] Add OPTPROBES feature on RISCV Björn Töpel
2022-11-08 11:04 ` Xim
2022-11-08 11:33 ` liaochang (A)
2022-11-08 13:12 ` Björn Töpel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dadac419-acda-7ba5-b7bb-4bc5b6fee92d@huawei.com \
--to=liaochang1@huawei.com \
--cc=aou@eecs.berkeley.edu \
--cc=chenguokai17@mails.ucas.ac.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mingo@redhat.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sfr@canb.auug.org.au \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®