Re: [PATCH bpf] bpf: invalidate unused part of bpf_prog_pack

From: Song Liu
Date: Thu Apr 21 2022 - 21:31:26 EST


Hi Linus,

> On Apr 21, 2022, at 4:10 PM, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Thu, Apr 21, 2022 at 3:52 PM Song Liu <songliubraving@xxxxxx> wrote:
>>
>> I think this won’t work, as set_memory_ro makes all the aliases of
>> these pages read only.
>
> Argh. I thought we only did that for the whole memory type thing
> (history: nasty machine checks possible on some hardware if you mix
> memory types for the same physical page with virtual mappings), but if
> we do it for RO too, then yeah.
>
> It's sad to use that horrid machinery for basically non-live code, but
> whatever.

I guess we will stick with bpf_arch_text_copy(), and we will keep the
Invalidation at BPF program free time?

I will reorder and resend pending patches. Then we can decide which ones
to ship with 5.18.

Thanks,
Song