Commit Graph

1221 Commits (54ba471b41c9ee940e30838601ca923f3610796e)
 

Author SHA1 Message Date
Mary 77cce840f7
Update aya/src/bpf.rs
Co-authored-by: Alessandro Decina <alessandro.d@gmail.com>
1 year ago
Mary 93435fc854 aya: allow global value to be optional
This allow to not error out when a global symbol is missing from the object.
1 year ago
Andrew Stoycos 17930a88c5
Fixups in response to alessandrod review
Move BpfError::UnsupportedMap into MapError and add a map_type field to
the error.

Update the `allow_unsupported_maps` function comment.

Update the logic to check if any unsupported maps are being used. More
specifically only search a program's maps if `allow_unsupported_maps` is
set and then use the iter function `try_for_each` with a match statement
which allows us to return the inner map type if it's unsupported.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
1 year ago
Andrew Stoycos b5719c5b3f
Add Unsupported Map type
Just because aya doesn't support working with some map
types doesn't mean we should't allow them to be loaded.

Add a new `Unsupported` map type to facilitate this,

Next add a user configurable option `allow_unsupported_maps()`
which can be called against the `bpfLoader`.  Additionally
add a nice warning log message when a program is being loaded
by Aya and contains an unsupported map type.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
1 year ago
dependabot[bot] 4c08b9b43f
Merge pull request #628 from aya-rs/dependabot/cargo/bindgen-0.66 1 year ago
dependabot[bot] 77e3dc2c2e
build(deps): update bindgen requirement from 0.65 to 0.66
Updates the requirements on [bindgen](https://github.com/rust-lang/rust-bindgen) to permit the latest version.
- [Release notes](https://github.com/rust-lang/rust-bindgen/releases)
- [Changelog](https://github.com/rust-lang/rust-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/rust-bindgen/compare/v0.65.0...v0.66.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
1 year ago
dependabot[bot] 26c6b92ef1
Merge pull request #626 from aya-rs/dependabot/cargo/hashbrown-0.14 1 year ago
Kenjiro Nakayama 7dfabd07a7 Add pt_regs handling in aya-bpf/args.rs for riscv64
This patch introduces `pt_regs` handling in aya-bpf/args.rs
for the riscv64 architecture. The current CI is disabled
for riscv64 because this implementation is missing.
1 year ago
dependabot[bot] f5f8083441
build(deps): update hashbrown requirement from 0.13 to 0.14
Updates the requirements on [hashbrown](https://github.com/rust-lang/hashbrown) to permit the latest version.
- [Changelog](https://github.com/rust-lang/hashbrown/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/hashbrown/compare/v0.13.1...v0.14.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
1 year ago
Alessandro Decina 9cdae81265
Merge pull request #625 from FedericoPonzi/issue-534
aya-utils: add syscall_prefix and syscall_fnname_add_prefix
1 year ago
Federico Ponzi 987e8489d0 aya-utils: add syscall_prefix and syscall_fnname_add_prefix
These two functions are needed because kernel symbols representing
syscalls have architecture-specific prefixes.

These are the equivalent of bcc's get_syscall_fnname and
get_syscall_prefix.

Solves: #534
1 year ago
dependabot[bot] 53ec1f23ea
Merge pull request #623 from aya-rs/dependabot/cargo/rbpf-0.2.0 1 year ago
dependabot[bot] 4f85ff8a7b
build(deps): bump mikepenz/release-changelog-builder-action from 3 to 4 (#624)
Bumps [mikepenz/release-changelog-builder-action](https://github.com/mikepenz/release-changelog-builder-action) from 3 to 4.
- [Release notes](https://github.com/mikepenz/release-changelog-builder-action/releases)
- [Commits](https://github.com/mikepenz/release-changelog-builder-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: mikepenz/release-changelog-builder-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 year ago
Mary e5bac02953
Merge pull request #622 from marysaka/fix/uprobe-416-lower
aya: Fix uprobe support on 4.16 and lower
1 year ago
dependabot[bot] fa3dd4bef2
build(deps): update rbpf requirement from 0.1.0 to 0.2.0
Updates the requirements on [rbpf](https://github.com/qmonnet/rbpf) to permit the latest version.
- [Commits](https://github.com/qmonnet/rbpf/compare/v0.1.0...v0.2.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
1 year ago
Mary 49c6f5d122 aya: Fix uprobe support on 4.16 and lower
Fix uprobe support on Ubuntu 18.04.
1 year ago
Alessandro Decina 41fe944a1a
Merge pull request #621 from marysaka/fix/uprobe-debian-10
aya: Add support for old ld.so.cache format
1 year ago
Mary 8e9f395eab aya: Add support for old ld.so.cache format
This fix uprobe support on Debian 10. (and possibly others)
This implement support to parse the original libc5 format.
1 year ago
Alessandro Decina 95acc73b3d
Merge pull request #620 from probulate/rust-cache
github: update Swatinem/rust-cache@{v1,v2}
1 year ago
Tamir Duberstein 6f286f1d4d
github: update Swatinem/rust-cache@{v1,v2}
I don't understand why, but dependabot isn't updating this. See
https://github.com/dependabot/dependabot-core/issues/7384.
1 year ago
Alessandro Decina 37b7c1e614
Merge pull request #619 from poliorcetics/relax-ordering-probe-alias
fix: Relax unnecessarily strict atomic ordering on probe event_alias
1 year ago
Alexis (Poliorcetics) Bourget 243986c1da fix: Relax unnecessarily strict atomic ordering on probe event_alias 1 year ago
Mary d56ed8fd68
Merge pull request #618 from marysaka/fix/aya-probe-event-alias-uniq
aya: Make probe event_alias unique
1 year ago
Mary e9be3d9023 aya: Make probe event_alias unique
This fixes issues when trying to attach the same kernel function multiple times on 4.17 and lower (possibly upper too?)
1 year ago
Alessandro Decina 3f1a469f06
Merge pull request #611 from probulate/check-refs-not-values
aya-log-ebpf: avoid requiring Copy
1 year ago
Tamir Duberstein 6feebef9e5
aya-log-ebpf: simplify argument validation 1 year ago
Tamir Duberstein de7972483b
aya-log-ebpf: avoid requiring Copy
Before this change:
```
error[E0382]: use of moved value: `no_copy`
  --> test/integration-ebpf/src/log.rs:35:9
   |
33 |         let no_copy = NoCopy {};
   |             ------- move occurs because `no_copy` has type `NoCopy`, which does not implement the `Copy` trait
34 |
35 |         debug!(&ctx, "{:x}", no_copy.consume());
   |         ^^^^^^^^^^^^^^^^^^^^^-------^---------^
   |         |                    |       |
   |         |                    |       `no_copy` moved due to this method call
   |         |                    use occurs due to use in closure
   |         value used here after move
   |
note: `NoCopy::consume` takes ownership of the receiver `self`, which moves `no_copy`
  --> test/integration-ebpf/src/log.rs:28:24
   |
28 |             fn consume(self) -> u64 {
   |                        ^^^^
   = note: this error originates in the macro `debug` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0382`.
error: could not compile `integration-ebpf` (bin "log") due to previous error
```
1 year ago
Mary 85ad0197e0
Merge pull request #563 from marysaka/fix/reloc-less-strict
aya-obj: Make relocations less strict
1 year ago
Mary 35eaa50736 aya-obj: Make relocations less strict
Missing relocations at load time shouldn't cause an error in aya-obj
but instead poison related instructions.

This makes struct flavors work.
1 year ago
Alessandro Decina 3a9a54fd9b
Merge pull request #602 from marysaka/fix/btf-reloc-all-functions
aya: Apply BTF relocations to all functions
1 year ago
Alessandro Decina 3211d2c928
Merge pull request #616 from nak3/fix-bump
[codegen] Update libbpf to f7eb43b90f4c8882edf6354f8585094f8f3aade0
1 year ago
Kenjiro Nakayama afb4aa1c66 Add a few tweak a code to fix libbpf's API change. 1 year ago
Mary c4e721f3d3 aya: Apply BTF relocations to all functions
This fix aya wrong logic causing non entrypoint functions to not have
any BTF relocations working.

Also fix missing section_offset computation for instruction offset in
multiple spots.
1 year ago
alessandrod 0bc886f163 [codegen] Update libbpf to f7eb43b90f4c8882edf6354f8585094f8f3aade0Update libbpf to f7eb43b90f4c8882edf6354f8585094f8f3aade0
Files changed:
M	aya-obj/src/generated/btf_internal_bindings.rs
M	aya-obj/src/generated/linux_bindings_aarch64.rs
M	aya-obj/src/generated/linux_bindings_armv7.rs
M	aya-obj/src/generated/linux_bindings_riscv64.rs
M	aya-obj/src/generated/linux_bindings_x86_64.rs
M	bpf/aya-bpf-bindings/src/aarch64/bindings.rs
M	bpf/aya-bpf-bindings/src/armv7/bindings.rs
M	bpf/aya-bpf-bindings/src/riscv64/bindings.rs
M	bpf/aya-bpf-bindings/src/x86_64/bindings.rs
1 year ago
Robert Bartlensky 47a2f25fca aya-log-ebpf-macros: fix compile errors
aya-log-ebpf-macros was failing to compile because it was referencing
a couple of `DisplayHint` variants that no longer exist. These were
removed in #599.

```
    Compiling aya-log-ebpf-macros v0.1.0 (/home/robert/aya/aya-log-ebpf-macros)
error[E0599]: no variant or associated item named `Ipv4` found for enum `DisplayHint` in the current scope
  --> aya-log-ebpf-macros/src/expand.rs:93:22
   |
93 |         DisplayHint::Ipv4 => parse_str("::aya_log_ebpf::macro_support::check_impl_ipv4"),
   |                      ^^^^ variant or associated item not found in `DisplayHint`

error[E0599]: no variant or associated item named `Ipv6` found for enum `DisplayHint` in the current scope
  --> aya-log-ebpf-macros/src/expand.rs:94:22
   |
94 |         DisplayHint::Ipv6 => parse_str("::aya_log_ebpf::macro_support::check_impl_ipv6"),
   |                      ^^^^ variant or associated item not found in `DisplayHint`

For more information about this error, try `rustc --explain E0599`.
```
1 year ago
William Batista 3d1013d729 Fixed a typo in the per_cpu_hashmap documentation 1 year ago
Michal Rostecki 84e5e2894f aya-log: Unify IP format hints into one, repsesent it by `:i` token
Having separate format hints and tokens per IP address family is
unnecessary, since they are represented by different types and we handle
format hints for each type separately. So we can just have one format
hint.

Also, we should be consistent with the format strings grammar in
Rust[0]. The `type` token, which is mapped to formatting traits, usually
consists of one letter[1] (and optional `?` for `Debug` trait, but that
doesn't matter for us). It shouldn't consist of multiple letters. Our
`:ipv4` and `:ipv6` tokens were clearly breaking that convention, so we
should rather switch to something with one letter - hence `:i`.

[0] https://doc.rust-lang.org/std/fmt/#syntax
[1] https://doc.rust-lang.org/std/fmt/#formatting-traits
1 year ago
Andrés 5894c4ce82
Fix load errors for empty (but existent) BTF/BTF.ext sections (#608)
* use the hdr_len of BTF.ext sections rather than size of struct

Otherwise this will erroneously fail on older btf_ext_header that have
less fields than the bindgen'd struct

* do not attempt to load a BTF object that has no types

* add tests

* fix: hdr_len i32 -> u32

* guard against a bigger header in the future

* use separate unsafe blocks

* simplify writing to zero'd out header

* merge safe block and address typo
1 year ago
Alessandro Decina 58f1ecbf00
Merge pull request #606 from Hanaasagi/check-format-in-log
feat(aya-log): check format and value type in proc macro
1 year ago
Hanaasagi d999a95b41 fix(aya-log): remove some useless code 1 year ago
Hanaasagi 0970300d1f feat(aya-log): check format and value type in proc macro 1 year ago
Alessandro Decina d4bfd72f57
Merge pull request #607 from Hanaasagi/fix-warning
clippy: clean useless `any` in cfg
1 year ago
Hanaasagi 0e4aec475f fix(lint): remove useless `any` `all` in cfg. 1 year ago
Shubham Jain 1fa1c142f4
docs(macros): add rust docs for cgroup_sock_addr macro (#566)
Signed-off-by: Shubham Jain <shubhamkjain@outlook.com>
Co-authored-by: vadorovsky <vadorovsky@protonmail.com>
2 years ago
vadorovsky a06a5ae07e
Merge pull request #598 from nak3/add-user_regs_strct
xtask: codegen: generate bindings for user_regs_struct
2 years ago
Alessandro Decina 5165bf2f99
Merge pull request #585 from probulate/tag-len-value
aya-log-common: support logging byte slices
2 years ago
Alessandro Decina 9c437aafd9
Merge pull request #605 from marysaka/fix/global-data-reloc-ancient-kernels
aya: Do not create data maps on kernel without global data support
2 years ago
Alessandro Decina 3a9058e762
Merge pull request #604 from marysaka/fix/section-kind-from-str
aya-obj: Fix ProgramSection::from_str for bss and rodata sections
2 years ago
Mary 591e21267a aya: Do not create data maps on kernel without global data support
Fix map creation failure when a BPF have a data section on older
kernel. (< 5.2)

If the BPF uses that section, relocation will fail accordingly and
report an error.
2 years ago
Mary 18b3d75d09 aya-obj: Fix ProgramSection::from_str for bss and rodata sections 2 years ago