On 2026/2/22 00:51, Alexei Starovoitov wrote:
> On Sat, Feb 21, 2026 at 4:45 AM Leon Hwang <[email protected]> wrote:
>>
[...]
>>
>> Good idea. But I concern about the "in kernel disasm". Do you mean we
>> will build a disassembler for whitelist kfuncs at starting?
>>
>> I noticed you've mentioned the same direction in "bpf/s390: Implement
>> get_preempt_count()" [1]. So, I added Ilya here to discuss this direction.
>
> Much better. Keep it human.
>
> "in kernel disasm" already exists for some architectures
> (at least x86 and arm64) since it's being used by kprobes.
> The ask here is to figure out whether they're usable for such
> insn analysis. x86 disasm is likely capable.
>
After looking into x86&arm insn decoder, they are able to do insn analysis.
> re:"whitelist kfunc"
> I suspect an additional list is not necessary.
> kf_fastcall is a good enough signal that such kfunc should
> be inlinable.
I thought it was to build a light-weight custom disassembler, which
would only support limited machine codes (whitelist kfunc).
Obviously, I was wrong.
We can reuse the in-kernel insn decoding ability to validate fastcall
function by checking the registers use.
I'll post RFC after finishing poc, on both x86_64 and arm64 of course.
Thanks,
Leon