[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <A4019486-85F3-4900-8073-6879608706B1@fb.com>
Date: Wed, 18 May 2022 18:34:18 +0000
From: Song Liu <songliubraving@...com>
To: Peter Zijlstra <peterz@...radead.org>
CC: Song Liu <song@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Luis Chamberlain <mcgrof@...nel.org>,
"Torvalds, Linus" <torvalds@...ux-foundation.org>,
"Edgecombe, Rick P" <rick.p.edgecombe@...el.com>,
Kernel Team <Kernel-team@...com>
Subject: Re: [PATCH bpf-next 2/5] x86/alternative: introduce text_poke_set
> On May 18, 2022, at 10:09 AM, Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Sun, May 15, 2022 at 10:40:48PM -0700, Song Liu wrote:
>> Introduce a memset like API for text_poke. This will be used to fill the
>> unused RX memory with illegal instructions.
>
> FWIW, you're going to use it to set INT3 (0xCC), that's not an illegal
> instruction. INTO (0xCE) would be an illegal instruction (in 64bit
> mode).
Hmm… we have been using INT3 as illegal/invalid/special instructions in
the JIT. I guess they are equally good for this job?
>
>
>> + return addr;
>> +}
>> +
>> +/**
>> + * text_poke_set - memset into (an unused part of) RX memory
>> + * @addr: address to modify
>> + * @c: the byte to fill the area with
>> + * @len: length to copy, could be more than 2x PAGE_SIZE
>> + *
>> + * 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 live.
>
> That comment suffers from copy-pasta and needs an update because it
> clearly isn't correct.
Will fix in the next version.
>
>> + */
>
> Other than that, seems fine.
>
> Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Thanks,
Song
Powered by blists - more mailing lists