fix: init reg[2] as mbuff.len()#139
Conversation
There was a problem hiding this comment.
Thanks! But I'm not sure I want that, this looks like a difference in behaviour with what the kernel does.
If you need to know the length of your mem area, you should specify it in the relevant field of the mbuff. The mbuff would typically have a constant size, and (as long as we don't have a better verifier) it would be up to the user to make sure that the program doesn't attempt to reach beyond the mbuff size. This is to mimic what we have in the kernel with packets and metadata buffers. Meanwhile, reg[2] typically starts with a 0 value, if I'm not mistaken.
|
Thanks for your detailed explanation. sorry i did not mention the context, here is how ubpf handled But i'm ok with your considerations. |
|
Thanks for the context. I see that iovisor/ubpf#57 says “The eBPF spec allows R1-R5 to be used for such purposes”. I believe it refers to this draft:
But this convention never explicitly made it to the final ISA specification. So there's no real convention as far as I know. This change probably makes more sense for uBPF, which doesn't work with |
|
Got it. Thanks! |
No description provided.