sample = bpf_dynptr_data(dynptr - 1, 0, sizeof(*sample));
bpf_printk("Was able to pass bad pointer %lx\n", (__u64)dynptr - 1);
return 0;
}
/* A callback that accesses a dynptr in a bpf_user_ringbuf_drain callback should * not be able to read before the pointer.
*/
SEC("?raw_tp")
__failure __msg("negative offset dynptr_ptr ptr") int user_ringbuf_callback_bad_access1(void *ctx)
{
bpf_user_ringbuf_drain(&user_ringbuf, bad_access1, NULL, 0);
sample = bpf_dynptr_data(dynptr + 1, 0, sizeof(*sample));
bpf_printk("Was able to pass bad pointer %lx\n", (__u64)dynptr + 1);
return 0;
}
/* A callback that accesses a dynptr in a bpf_user_ringbuf_drain callback should * not be able to read past the end of the pointer.
*/
SEC("?raw_tp")
__failure __msg("dereference of modified dynptr_ptr ptr") int user_ringbuf_callback_bad_access2(void *ctx)
{
bpf_user_ringbuf_drain(&user_ringbuf, bad_access2, NULL, 0);
/* A callback that accesses a dynptr in a bpf_user_ringbuf_drain callback should * not be able to write to that pointer.
*/
SEC("?raw_tp")
__failure __msg("invalid mem access 'dynptr_ptr'") int user_ringbuf_callback_write_forbidden(void *ctx)
{
bpf_user_ringbuf_drain(&user_ringbuf, write_forbidden, NULL, 0);
/* A callback that accesses a dynptr in a bpf_user_ringbuf_drain callback should * not be able to write to that pointer.
*/
SEC("?raw_tp")
__failure __msg("invalid mem access 'scalar'") int user_ringbuf_callback_null_context_write(void *ctx)
{
bpf_user_ringbuf_drain(&user_ringbuf, null_context_write, NULL, 0);
/* A callback that accesses a dynptr in a bpf_user_ringbuf_drain callback should * not be able to write to that pointer.
*/
SEC("?raw_tp")
__failure __msg("invalid mem access 'scalar'") int user_ringbuf_callback_null_context_read(void *ctx)
{
bpf_user_ringbuf_drain(&user_ringbuf, null_context_read, NULL, 0);
/* A callback that accesses a dynptr in a bpf_user_ringbuf_drain callback should * not be able to read past the end of the pointer.
*/
SEC("?raw_tp")
__failure __msg("cannot release unowned const bpf_dynptr") int user_ringbuf_callback_discard_dynptr(void *ctx)
{
bpf_user_ringbuf_drain(&user_ringbuf, try_discard_dynptr, NULL, 0);
/* A callback that accesses a dynptr in a bpf_user_ringbuf_drain callback should * not be able to read past the end of the pointer.
*/
SEC("?raw_tp")
__failure __msg("cannot release unowned const bpf_dynptr") int user_ringbuf_callback_submit_dynptr(void *ctx)
{
bpf_user_ringbuf_drain(&user_ringbuf, try_submit_dynptr, NULL, 0);
/* A callback that accesses a dynptr in a bpf_user_ringbuf_drain callback should * not be able to write to that pointer.
*/
SEC("?raw_tp")
__failure __msg("At callback return the register R0 has ") int user_ringbuf_callback_invalid_return(void *ctx)
{
bpf_user_ringbuf_drain(&user_ringbuf, invalid_drain_callback_return, NULL, 0);
SEC("?raw_tp")
__failure __msg("Dynptr has to be an uninitialized dynptr") int user_ringbuf_callback_reinit_dynptr_mem(void *ctx)
{
bpf_user_ringbuf_drain(&user_ringbuf, try_reinit_dynptr_mem, NULL, 0); return 0;
}
SEC("?raw_tp")
__failure __msg("Dynptr has to be an uninitialized dynptr") int user_ringbuf_callback_reinit_dynptr_ringbuf(void *ctx)
{
bpf_user_ringbuf_drain(&user_ringbuf, try_reinit_dynptr_ringbuf, NULL, 0); return 0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.