Commit Graph

6 Commits (d30ff102b012e8b10e056217ce68562434c3cddb)

Author SHA1 Message Date
Dave Tucker f1c71916f7 Add rustfmt.toml
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 516121a462 ebpf: Add example
This ensures that macro expansion works properly and that expanded code
compiles

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 0c25d8655e Add Tests
This moves a large chunk of code from ebpf to shared so we can re-use
write_record_header and write_record_message and friends so that we
can write test cases to ensure that logs are properly formatted
given certain input.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Michal Rostecki 9be90f8a74 ebpf: Ensure the bounds of log buffer
eBPF verifier rejects programs which are not checking the bounds of the
log buffer before writing any arguments. This change ensures that
written log arguments.

In practice, it means that doing this kind of checks is not going to be
needed in eBPF program code anymore:

33a1aee2ea/echo-ebpf/src/main.rs (L47)

Tested on:

876f8b4551

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
3 years ago
Alessandro Decina 223e2f4ea1 ebpf: inline write_record_header
This seems to help the verifier keep track of where we're writing into
LOG_BUF
3 years ago
Michal Rostecki ec31526de1 Format arguments in userspace
This change moves away argument formatting from eBPF to the userspace.
eBPF part of aya-log writes unformatted log message and all arguments to
the perf buffer and the userspace part of aya-log is formatting the
message after receiving all arguments.

Aya-based project to test this change:

https://github.com/vadorovsky/aya-log-example

Fixes: #4
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
Signed-off-by: Tuetuopay <tuetuopay@me.com>
Co-authored-by: Tuetuopay <tuetuopay@me.com>
3 years ago