Re: [PATCH bpf-next v2] bpftool: Probe for ISA v4 instruction set extension
From: Quentin Monnet
Date: Mon Dec 09 2024 - 12:06:22 EST
2024-12-09 18:01 UTC+0100 ~ Simone Magnani <simone.magnani@xxxxxxxxxxxxx>
> On 09/12/24 16:20, Quentin Monnet wrote:
>> Looking again at the probe itself, does the second instruction serve any
>> practical purpose here? Don't you just need to test the BPF_JMP32_A?
>>
>> Looks good otherwise, thank you!
>>
>> Reviewed-by: Quentin Monnet <qmo@xxxxxxxxxx>
>
> I wanted to keep probes similar to the previous ones (especially v3
> and v2), despite we never check their return codes. This means
> having as 4th instruction `BPF_MOV64_IMM(BPF_REG_0, 1)`. However,
> to do so, I also need the 2nd instruction, otherwise I'd hit an
> `Invalid Argument` error while calling `bpf_prog_load()`: I think
> that would be due to the fact that no execution paths would
> execute that instruction otherwise.
Right, that's what I missed.
>
> An alternative approach less consistent with the others would be:
>
> struct bpf_insn insns[3] = {
> BPF_MOV64_IMM(BPF_REG_0, 0),
> BPF_JMP32_A(0),
> BPF_EXIT_INSN()
> };
>
> Please let me know if you have any further questions, need
> additional information, or if I could improve the patch.
No it's all good to me in that case, thank you!
Quentin