iovisor / iovisor/bcc

bpf_get_prandom_u32 has the wrong type and can't be called

Open
#398 9 comments 0 reactions 1 assignee Claimed by @4ast View on GitHub
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
10d 4h
Merged PRs (30d)
3

Description

It seems that `bpf_get_prandom_u32` is declared as a `u32 *` in the headers. That's due to missing parens.

```
- static u32 (*bpf_get_prandom_u32) =
+ static u32 (*bpf_get_prandom_u32)(void) =
```

Also, after fixing the signature, a BPF program that uses this function doesn't pass verification. I get the following error:

```
bpf: Invalid argument
0: (bf) r6 = r1
1: (85) call 14
2: (67) r0 <<= 32
3: (77) r0 >>= 32
4: (15) if r0 == 0x437c goto pc+27
R0=inv R6=ctx R10=fp
5: (85) call 7
unknown func 7
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.