-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in Aya log #808
Comments
Can you reproduce this with a test in this repo? I understand if bpf-linker needs to be built from the |
It is mandatory to have a bpf-linker |
debug-info = 2 is easy to do - just put it in the appropriate manifest or .cargo/config.toml. Having a custom bpf-linker is not easy to do, but just leave that part out. The tests use whatever bpf-linker is installed on the machine, if you have a repro that requires me to install bpf-linker from the DI branch, that is good enough. |
Have you managed to reproduce the issue ? |
Sorry, did you write a test that I missed? |
I guess I miss-understood your last post. I thought you meant the repro project as it is was fine ! |
Yes. You can adapt https://github.com/aya-rs/aya/blob/main/test/integration-ebpf/src/log.rs if you like. |
Signed-off-by: Quentin JEROME <qjerome@users.noreply.github.com>
Test implemented in #810 |
Signed-off-by: Quentin JEROME <qjerome@users.noreply.github.com>
Signed-off-by: Quentin JEROME <qjerome@users.noreply.github.com>
We only want exported symbols (programs marked as #[no_mangle]) to have linkage=global. This avoid issues like: Global function write() doesn't return scalar. Only those are supported. verification time 18 usec stack depth 0+0 ... The error above happens when aya-log's WriteBuf::write doesn't get inlined, and ends up having linkage=global. Global functions are verified independently from their callers, so the verifier has less context, and as a result globals are harder to verify. In clang one makes a function global by not making it `static`. That model doesn't work for rust, where all symbols exported by dependencies are non-static, and therefore end up being emitted as global. This commit implements a custom pass which marks functions as linkage=static unless they've been explicitly exported. Fixes aya-rs/aya#808
We only want exported symbols (programs marked as #[no_mangle]) to have linkage=global. This avoid issues like: Global function write() doesn't return scalar. Only those are supported. verification time 18 usec stack depth 0+0 ... The error above happens when aya-log's WriteBuf::write doesn't get inlined, and ends up having linkage=global. Global functions are verified independently from their callers, so the verifier has less context, and as a result globals are harder to verify. In clang one makes a function global by not making it `static`. That model doesn't work for rust, where all symbols exported by dependencies are non-static, and therefore end up being emitted as global. This commit implements a custom pass which marks functions as linkage=static unless they've been explicitly exported. Fixes aya-rs/aya#808
We only want exported symbols (programs marked as #[no_mangle]) to have linkage=global. This avoid issues like: Global function write() doesn't return scalar. Only those are supported. verification time 18 usec stack depth 0+0 ... The error above happens when aya-log's WriteBuf::write doesn't get inlined, and ends up having linkage=global. Global functions are verified independently from their callers, so the verifier has less context, and as a result globals are harder to verify. In clang one makes a function global by not making it `static`. That model doesn't work for rust, where all symbols exported by dependencies are non-static, and therefore end up being emitted as global. This commit implements a custom pass which marks functions as linkage=static unless they've been explicitly exported. Fixes aya-rs/aya#808
We only want exported symbols (programs marked as #[no_mangle]) to have linkage=global. This avoid issues like: Global function write() doesn't return scalar. Only those are supported. verification time 18 usec stack depth 0+0 ... The error above happens when aya-log's WriteBuf::write doesn't get inlined, and ends up having linkage=global. Global functions are verified independently from their callers, so the verifier has less context, and as a result globals are harder to verify. In clang one makes a function global by not making it `static`. That model doesn't work for rust, where all symbols exported by dependencies are non-static, and therefore end up being emitted as global. This commit implements a custom pass which marks functions as linkage=static unless they've been explicitly exported. Fixes aya-rs/aya#808
We only want exported symbols (programs marked as #[no_mangle]) to have linkage=global. This avoid issues like: Global function write() doesn't return scalar. Only those are supported. verification time 18 usec stack depth 0+0 ... The error above happens when aya-log's WriteBuf::write doesn't get inlined, and ends up having linkage=global. Global functions are verified independently from their callers, so the verifier has less context, and as a result globals are harder to verify. In clang one makes a function global by not making it `static`. That model doesn't work for rust, where all symbols exported by dependencies are non-static, and therefore end up being emitted as global. This commit implements a custom pass which marks functions as linkage=static unless they've been explicitly exported. Fixes aya-rs/aya#808
We only want exported symbols (programs marked as #[no_mangle]) to have linkage=global. This avoid issues like: Global function write() doesn't return scalar. Only those are supported. verification time 18 usec stack depth 0+0 ... The error above happens when aya-log's WriteBuf::write doesn't get inlined, and ends up having linkage=global. Global functions are verified independently from their callers, so the verifier has less context, and as a result globals are harder to verify. In clang one makes a function global by not making it `static`. That model doesn't work for rust, where all symbols exported by dependencies are non-static, and therefore end up being emitted as global. This commit implements a custom pass which marks functions as linkage=static unless they've been explicitly exported. Fixes aya-rs/aya#808
The verifier fails at loading BPF program because of (supposed) DisplayHint::write function.
This bug appears only under some conditions:
feature/fix-di
is useddebug-info = 2
is present in eBPF'sCargo.toml
fileSupporting files:
A repro project can be found here: https://github.com/0xrawsec/poc-bug-aya-log
IMPORTANT: a compiled version of
bpf-linker
is provided with the project and is located under the eBPF's directory.The text was updated successfully, but these errors were encountered: