Skip to content
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

Bring aya-log into aya, creating a Monorepo #350

Merged
merged 41 commits into from
Jul 28, 2022

Conversation

dave-tucker
Copy link
Member

  • Git subtree merge of aya-log into an aya-log directory.
  • Moved the components of aya-log outside the subtree and added them to the appropriate workspaces
  • Sorted out the cargo-release config so it will continue to work
  • Adjusted CI

Note: I think this now ensures that aya-log-bpf@main and aya-bpf@main always rely on the same commit since they follow a path dep in the same repository.

@netlify
Copy link

netlify bot commented Jul 25, 2022

Deploy Preview for aya-rs ready!

Name Link
🔨 Latest commit 6ab7148
🔍 Latest deploy log https://app.netlify.com/sites/aya-rs/deploys/62e269ce4a1f53000c3dacde
😎 Deploy Preview https://deploy-preview-350--aya-rs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@dave-tucker dave-tucker force-pushed the monorepo branch 12 times, most recently from 21facc6 to d5bbef2 Compare July 27, 2022 17:42
vadorovsky and others added 24 commits July 28, 2022 10:46
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>
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
This seems to help the verifier keep track of where we're writing into
LOG_BUF
1024 is too small for many kernel string limits (i.e. PATH_MAX, which is
4096).

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
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:

https://github.com/alessandrod/aya-echo-tracepoint/blob/33a1aee2eaa7503615a444ffa574dfba2be943f9/echo-ebpf/src/main.rs#L47

Tested on:

https://github.com/vadorovsky/aya-echo-tracepoint/tree/876f8b45511d0818b683de9a2196e8103b92e1a7

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
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>
This ensures that macro expansion works properly and that expanded code
compiles

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
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](aya-rs/aya@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>
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>
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>
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>
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
@vadorovsky vadorovsky merged commit f37a514 into aya-rs:main Jul 28, 2022
@dave-tucker dave-tucker added fix A PR that is a small change or fixes a bug aya-log Relating to aya-log aya-log-ebpf Relating to aya-log-ebpf labels Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aya-log Relating to aya-log aya-log-ebpf Relating to aya-log-ebpf fix A PR that is a small change or fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants