kmesh-net / kmesh

High Performance ServiceMesh Data Plane Based on Programmable Kernel
https://kmesh.net
Apache License 2.0
464 stars 70 forks source link

BPF_LOG_SIZE does not take effect #761

Closed supercharge-xsy closed 2 months ago

supercharge-xsy commented 2 months ago

What happened: BPF_LOG_SIZE is used to set the err buffer size of the verification result returned when the BPF program fails to be loaded. However, the setting does not take effect.:

like this,the log is also be truncated: load program: bad address: 12124: (25) if r2 > 0xd goto pc+165: The sequence of 8193 jumps is too complex. (truncated, 108 line(s) omitted)" What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

weli-l commented 2 months ago

/assign

Okabe-Rintarou-0 commented 2 months ago

also met this before. Sometimes increasing it will work: print more verifier logs, but the log size is not as expected.

hzxuzhonghu commented 2 months ago

This env will not take effect once we upgrade the pkg https://github.com/kmesh-net/kmesh/pull/717

weli-l commented 2 months ago

BPF_LOG_SIZE has been removed, but the verifier's log cannot be dumped completely, We can temporarily modify the following code to ensure that all logs are exported


func (cl *collectionLoader) loadProgram(progName string) (*Program, error) {
        ... ...
    prog, err := newProgramWithOptions(progSpec, cl.opts.Programs)
    if err != nil {
        return nil, fmt.Errorf("program %s: %+w", progName, err)// %w can be modified to %+w
    }

    cl.programs[progName] = prog
    return prog, nil
}
hzxuzhonghu commented 2 months ago
    if err = l.workloadObj.Load(); err != nil {
        l.Stop()
        return fmt.Errorf("bpf Load failed, %s", err)
    }

We should always use %w to print error instead of %s

hzxuzhonghu commented 2 months ago

close now, as BPF_LOG_SIZE is no longer needed. If there is truncated issue, should report to cilium ebpf repo