Repository: aya-rs/aya (language: rust)

Issue:
Error: error parsing BPF object: invalid program section `cgroup_skb`
**My program code：
```
#[cgroup_skb]
pub fn cg01(ctx: SkBuffContext) -> i32 {
    match try_cg02(ctx) {
        Ok(ret) => ret,
        Err(ret) => ret,
    }
}
fn try_cg01(ctx: SkBuffContext) -> Result<i32, i32> {
    info!(&ctx, "received a packet");
    Ok(0)
}**
==========================================================
**cargo xtask build-ebpf   -->  Compilation passed**

**cargo xtask run  --> Failed to run `sudo -E target/debug/cg01` invalid program section `cgroup_skb`**
```


Discussion / hints:
Change

```
#[cgroup_skb]
```

to 

```
#[cgroup_skb(ingress)]
```

if you want to hook to ingress or

```
#[cgroup_skb(egress)]
```

if you want to hook to egress
@dave-tucker looks like this was broken in https://github.com/aya-rs/aya/commit/c72aab5f7b809b48273cd2fed4554ddff6b66bdf#diff-748602d38469d68a9e1066e81e7675656a5bc2052f844ea8f0dd4d350101154fL379

the section name when no attrs are passed must be `cgroup/skb`

Fix patch:
diff --git a/aya-bpf-macros/src/cgroup_skb.rs b/aya-bpf-macros/src/cgroup_skb.rs
index 15b5a122d..1c984d13c 100644
--- a/aya-bpf-macros/src/cgroup_skb.rs
+++ b/aya-bpf-macros/src/cgroup_skb.rs
@@ -29,7 +29,7 @@ impl CgroupSkb {
         let section_name: Cow<'_, _> = if self.attach_type.is_some() {
             format!("cgroup_skb/{}", self.attach_type.as_ref().unwrap()).into()
         } else {
-            "cgroup_skb".into()
+            "cgroup/skb".into()
         };
         let fn_vis = &self.item.vis;
         let fn_name = self.item.sig.ident.clone();
@@ -66,7 +66,7 @@ mod tests {
         let expanded = prog.expand().unwrap();
         let expected = quote! {
             #[no_mangle]
-            #[link_section = "cgroup_skb"]
+            #[link_section = "cgroup/skb"]
             fn foo(ctx: *mut ::aya_bpf::bindings::__sk_buff) -> i32 {
                 return foo(::aya_bpf::programs::SkBuffContext::new(ctx));
 


Test patch: