On 2025/9/24 03:23 Alexei Starovoitov <[email protected]> write: > On Mon, Sep 22, 2025 at 7:11 AM Menglong Dong <[email protected]> > wrote: > > > > On Mon, Sep 22, 2025 at 10:08 PM Song Liu <[email protected]> wrote: > > > > > > On Mon, Sep 22, 2025 at 11:57 AM Menglong Dong <[email protected]> > > > wrote: > > > > > > > > The "data" in struct bpf_session_run_ctx is always 8-bytes aligned. > > > > Therefore, we can store the "is_return" to the last bit of the "data", > > > > which can make bpf_session_run_ctx 8-bytes aligned and save memory. > > > > > > Does this really save anything? AFAICT, bpf_session_run_ctx is > > > only allocated on the stack. Therefore, we don't save any memory > > > unless there is potential risk of stack overflow. > > > > Hi, Song. My original intention is to save the usage of the > > stack to prevent potential stack overflow, > > 8 bytes won't matter, but wasting 8 bytes for 1 bit is indeed annoying. > > > especially when we > > trace all the kernel functions with kprobe-multi. > > What do you mean? kprobe-multi won't recurse, > so tracing all or a few functions is the same concern > from stack overflow pov, no ?
You are right, I made something wrong. I mixed it with origin call case of the bpf trampoline, which will store all the things in the stack for every function call. > > > The most thing for me is that the unaligned field in the struct > > looks very awkward, and it consumes 8-bytes only for a bit. > > let's keep it as-is. If stack overflow is indeed an issue we need > a generic way to detect it and prevent it. > We've been thinking whether vmap stack guard pages > can become JIT's extable-like things, so when stack overflow Interesting > happens we unwind stack and stop bpf prog instead of panicing. Yeah, I think it's OK to keep it still. Thanks! Menglong Dong > >
