Skip to content

Conversation

qmonnet
Copy link
Owner

@qmonnet qmonnet commented Oct 29, 2024

Rust 1.83 introduces some additional out-of-bound checks, making it illegal to attempt to load at an out-of-bound access when trying to load/store values from/to register in rbpf's interpreter, and causing the program to panick even before we reach the safety checks from check_mem().

I understand we need to use wrapping_offset() rather than offset() in that case, which causes the operation itself (but not the resulting poitner) to be safe, and the checked to be deferred. See also the related GitHub issue.

Fixes: #115

Rust 1.83 introduces some additional out-of-bound checks [0], making it
illegal to attempt to load at an out-of-bound access when trying to
load/store values from/to register in rbpf's interpreter, and causing
the program to panick even before we reach the safety checks from
check_mem().

I understand we need to use wrapping_offset() rather than offset() in
that case, which causes the operation itself (but not the resulting
poitner) to be safe, and the checked to be deferred. See also the
related GitHub issue [1].

[0] rust-lang/rust#130251
[1] #115

Reported-by: Ben Kimock <kimockb@gmail.com>
Signed-off-by: Quentin Monnet <qmo@qmon.net>
@qmonnet qmonnet merged commit cfb363c into main Oct 29, 2024
8 checks passed
@qmonnet qmonnet deleted the pr/wrapping_offset branch October 29, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_vm_stdw_add_overflow encounters UB, will fail in Rust 1.83

1 participant