lkml.org 
[lkml]   [2022]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v3 bpf-next 5/7] x86/alternative: introduce text_poke_jit
Date


> On Jan 11, 2022, at 4:13 AM, Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Wed, Jan 05, 2022 at 06:25:31PM -0800, Song Liu wrote:
>
>> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
>> index 23fb4d51a5da..02c35725cc62 100644
>> --- a/arch/x86/kernel/alternative.c
>> +++ b/arch/x86/kernel/alternative.c
>> @@ -1102,6 +1102,34 @@ void *text_poke_kgdb(void *addr, const void *opcode, size_t len)
>> return __text_poke(addr, opcode, len);
>> }
>>
>> +/**
>> + * text_poke_jit - Update instructions on a live kernel by jit engine
>> + * @addr: address to modify
>> + * @opcode: source of the copy
>> + * @len: length to copy, could be more than 2x PAGE_SIZE
>> + *
>> + * Only module memory taking jit text (e.g. for bpf) should be patched.
>> + */
>
> Maybe:
>
> text_poke_copy() - Copy instructions into (an unused part of) RX memory
> @args...
>
> Not safe against concurrent execution; useful for JITs to dump
> new code blocks into unused regions of RX memory. Can be used in
> conjunction with synchronize_rcu_tasks() to wait for existing
> execution to quiesce after having made sure no existing
> functions pointers are life.
>
> or something along those lines?

This sounds good! Thanks!

Song

\
 
 \ /
  Last update: 2022-01-11 18:44    [W:0.054 / U:2.596 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site