Commit Graph

835 Commits (3adb9b049f493ec9b80fcf868a8eac3363d17844)
 

Author SHA1 Message Date
Hengqi Chen b8b291c51b aya-log/README: Fix links to aya-log repo
The aya-log repo ([0]) has been archived, use the link to
aya repo instead.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years ago
Andre Fredette 207c689f56 Add support for setting priority for classifier programs
Addresses issue #358

Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Alessandro Decina 2f715f0036
Merge pull request #360 from conectado/patch-1
Minor fix for `lpm_trie::key` docs
2 years ago
Gabi 14bad9ba92
aya-bpf: minor fix lpm_trie::key docs 2 years ago
Michal Rostecki 3d5ab0b17d
Merge pull request #357 from vadorovsky/env_logger
aya-log, test: Switch from simplelog to env_logger
2 years ago
Michal Rostecki 3664e1ea0d aya-log, test: Switch from simplelog to env_logger
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Dave Tucker 55a7e3c4d0
Merge pull request #355 from dave-tucker/rm-map-pin-path
aya: Remove MapError::InvalidPinPath
2 years ago
Dave Tucker 03a15b9864 aya: Remove MapError::InvalidPinPath
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 8e6c9ad0d2
Merge pull request #343 from dave-tucker/pinning-redux
Small Pinning API improvements
2 years ago
Dave Tucker 34ba2bc048 aya: Use PinError for all pinning errors
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 64f8a434d2 aya: Implement FdLink::pin()
This allows for FdLinks to also be pinned to BpfFs.
In order for it to be called, the user would first call
`take_link` to get the underlying link. This can then
be destructured to an FdLink where FdLink::pin() may be called.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 5726b6d044 aya: Allow pin to be used on all programs
This allows for `pin` to be called as `Xdp::pin()` or
Program::pin() - the same way that unload() can be used.
This simplifies the use of this API.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Michal Rostecki d968094b66
Merge pull request #353 from vadorovsky/log-remove-u128
aya-log: Remove i128 and u128 types
2 years ago
Michal Rostecki 611f967cd1 aya-log: Remove i128 and u128 types
They are not supported by eBPF VM and we are going to use arrays for
IPv6.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki f37a51433f
Merge pull request #350 from dave-tucker/monorepo
Bring aya-log into aya, creating a Monorepo
2 years ago
Dave Tucker 6ab7148731 bpf: Only use never type with rust nightly
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker c9e70a8758 aya: Fix rlimit warning on for 32bit systems
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker dc31e11691 Re-organize into a single workspace
This commit moves the aya-log projects from the subtree and adds them to
the main cargo workspace. It also brings the BPF crates into the
workspace and moves the macro crates up a level since they aren't BPF
code.

Miri was disabled for aya-bpf as the previous config wasn't actually
checking anything.

CI, clippy, fmt and release configurations have all been adjusted
appropriately.

CI was not properly running for other supported arches which was also
ixed here.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Michal Rostecki 28abaece2a Fix the log buffer bounds
Change 821ba0b243fd removed the `size > buf.len()` check, which was a
mistake, because we might write to a subslice of the whole buffer, so
then `buf` can be lower than `LOG_BUF_CAPACITY`.

This change compares `size` with `min::(buf.len(), LOG_BUF_CAPACITY)`
instead.

Fixes: 821ba0b243fd ("Ensure log buffer bounds")
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki 2e0702854b Ensure log buffer bounds
This change adds checks in `TagLenValue.write()` to ensure that the size
of written data doesn't exceed the buffer size.

Verifier in recent kernel versions requires the bound to be a constant
value, so using `buf.len()` does not work.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Alessandro Decina 6aea880890 ebpf: use new PerCpuArray::get_ptr_mut API 2 years ago
Dave Tucker 526493b444 aya-log, aya-log-common: start next development iteration 0.1.11-dev.0 2 years ago
Dave Tucker 3abd97307e aya-log, aya-log-common: release version 0.1.10 2 years ago
dependabot[bot] 060ba45153 Update aya requirement from 0.10.7 to 0.11.0
Updates the requirements on [aya](https://github.com/aya-rs/aya) to permit the latest version.
- [Release notes](https://github.com/aya-rs/aya/releases)
- [Commits](https://github.com/aya-rs/aya/compare/aya-v0.10.7...aya-v0.11.0)

---
updated-dependencies:
- dependency-name: aya
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
Dave Tucker 0038b43627 Add CI
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker c1bb790c0d Add vim/vscode rust-analyzer settings
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 3f0085195f Add rustfmt.toml
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 5789585994 ebpf: Add example
This ensures that macro expansion works properly and that expanded code
compiles

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 5d82d9a73e 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>
2 years ago
Michal Rostecki 628b473e09 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>
2 years ago
Michal Rostecki 70b4e68130 common: Bump the buffer size
1024 is too small for many kernel string limits (i.e. PATH_MAX, which is
4096).

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Alessandro Decina bd9a5c8fdf aya-log, aya-log-common: start next development iteration 0.1.10-dev.0 2 years ago
Alessandro Decina 8bc1bbb3ab aya-log, aya-log-common: release version 0.1.9 2 years ago
Alessandro Decina a8d133f6b0 Add cargo-release config 2 years ago
Alessandro Decina d1a0ce51ee xtask: do not release 2 years ago
Alessandro Decina c4d89fa13c aya-log: use stricter version for the aya-log-common dep 2 years ago
Alessandro Decina bdb2750e66 ebpf: inline write_record_header
This seems to help the verifier keep track of where we're writing into
LOG_BUF
2 years ago
Michal Rostecki 81befa0661 Update aya to 0.10.7
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki ca1fe7e05f 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>
2 years ago
Alessandro Decina 9b229d00e1 Don't recompute the record length 2 years ago
Alessandro Decina 7f8d7057df ebpf: initialize AYA_LOGS with max_entries=0
This way aya will create one perf buffer for each cpu
2 years ago
Alessandro Decina 2800454763 Fix clippy warning 2 years ago
Alessandro Decina 8bde15dad7 Add copy of README.md inside aya-log/
Needed for crates.io
2 years ago
Alessandro Decina 5e18a715b2 Add missing manifest fields 2 years ago
Alessandro Decina 31e71f8db5 (cargo-release) version 0.1.1 2 years ago
Alessandro Decina 29955b2287 (cargo-release) version 0.1.1 2 years ago
Alessandro Decina 6d14a16d8e git add .cargo and xtask 2 years ago
Alessandro Decina cced3da5c8 Update to aya 0.10.5 2 years ago
Alessandro Decina 9ab9c80183 Simplify BpfLogger::init
Make BpfLogger::init(bpf) log using the default logger. Add
BpfLoger::init_with_logger(bpf, logger) for logging using a custom
logger instance.
2 years ago
Alessandro Decina 2ac433449c Minor tweaks to make the verifier's job easier 2 years ago