Message ID | 20210207011027.676572-1-andreimatei1@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | allow variable-offset stack acces | expand |
On Sat, Feb 6, 2021 at 5:11 PM Andrei Matei <andreimatei1@gmail.com> wrote: > > Before this patch, variable offset access to the stack was dissalowed > for regular instructions, but was allowed for "indirect" accesses (i.e. > helpers). This patch removes the restriction, allowing reading and > writing to the stack through stack pointers with variable offsets. This > makes stack-allocated buffers more usable in programs, and brings stack > pointers closer to other types of pointers. > > The motivation is being able to use stack-allocated buffers for data > manipulation. When the stack size limit is sufficient, allocating > buffers on the stack is simpler than per-cpu arrays, or other > alternatives. > > V2 -> V3 > > - var-offset writes mark all the stack slots in range as initialized, so > that future reads are not rejected. > - rewrote the C test to not use uprobes, as per Andrii's suggestion. > - addressed other review comments from Alexei. I've fixed up Andrii's nits in patch 4, then moved skel__attach after test_pid init and applied to bpf-next. I've played with a few other ways to do var stack access in C and all looked good. Thanks a lot for making the verifier smarter.