-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
bpf_get_prandom_u32 has the wrong type and can't be called #398
Comments
Oops, obvious syntax issue. However, the second issue is there because this func is only exported to networking programs. |
Oh. Is there any particular reason for that? |
it's not exposed to tracing, because there was no use case for it yet. |
Fixes: #398 Signed-off-by: Brenden Blanco <[email protected]>
Well, for the trace tool, it could be useful if the user could do something like |
Fixes: iovisor#398 Signed-off-by: Brenden Blanco <[email protected]>
@4ast So, do you think it will be exposed to tracing programs in the future, or do you not see this use case as compelling? |
I would like to see a real use case when random sampling is actually needed. Do you want to prepare and test a kernel patch? |
I've never done it, but I'm willing to learn. Is there some kind of Kernel Patches for Dummies that you recommend? Regarding a test case, @brendangregg - what do you think? |
the real use case came up. When we're doing sampling in kprobes and tracepoints it's often useful not to process every event and instead randomly drop most of them. arraymap counter can be used as token but random is easier to use. timestamp doesn't have entropy when there are lots of events. So pretty much what @goldshtn said. We just faced the issue on our own :) |
Fixed with 8937bd80fce6. |
It seems that
bpf_get_prandom_u32
is declared as au32 *
in the headers. That's due to missing parens.Also, after fixing the signature, a BPF program that uses this function doesn't pass verification. I get the following error:
The text was updated successfully, but these errors were encountered: