-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
This crate specifies nomem in the asm!(), and casts pointers to usize.
usdt/usdt-impl/src/no-linker.rs
Line 112 in 4329591
| options(nomem, nostack, preserves_flags) |
Line 182 in 4329591
| quote! { .as_ptr() as usize }, |
The inline assembly docs specify
The assembly code does not read from or write to any memory accessible outside of the assembly code. This allows the compiler to cache the values of modified global variables in registers across execution of the assembly code since it knows that they are not read from or written to by it.
It's quite clear that reading from a pointer value when nomem is set is UB. The probe function would necessarily need to read the pointer when tracing.
Wouldn't it be more appropriate to use readonly?
Thanks
Metadata
Metadata
Assignees
Labels
No labels