RustConf 2023 - Integrating Rust and Go: Lessons from Github Code Search

  Рет қаралды 2,076

Rust

Rust

2 ай бұрын

Пікірлер: 7
@boringlymines
@boringlymines 2 ай бұрын
I learned about how to deal better with memory and FFI. I haven’t had to use FFI ever but that’s a good to know
@tuskiomisham
@tuskiomisham 2 ай бұрын
maybe I'm too new, what's this issue with use after free about?
@Ash-qp2yw
@Ash-qp2yw 2 ай бұрын
Data is stored in a certain location in memory, and when it's no longer needed, that memory is freed. (by most languages, this is the garbage collector. In C you have to do this manually. I'm not sure how this works in rust) If you try and use some memory after it no longer exists, that's use-after-free and will cause a crash (I think a segfault)
@sayaks12
@sayaks12 2 ай бұрын
@@Ash-qp2yw the rust compiler ensures that if you only ever use safe rust, then it is impossible to free an object that is currently in use. for instance in order to call `drop` on a value (which would free it) you need to move that value into the function, and you cannot move a value while there also exists a reference to it. the only way a use after free could happen is if you use some unsafe code to free it while it still exists, or dereference a raw pointer to it after it has been freed as the compiler doesn't keep track of raw pointers at all.
@ArmandoDoval
@ArmandoDoval Ай бұрын
The reason use after free is really bad is that after memory has been freed, it could have any literally any value since that memory could have been reused or overwritten. And "any value" includes values that aren't valid for the variable's type. As a simple example you might have an enum for the seven days of the week, and after the memory is freed you could end up with a nonsense value that's not one of the seven you defined. If the data was a pointer, you could end up with a pointer to a completely random address. If the program doesn't crash, it'll behave unpredictably and a clever attacker might even be able to exploit the bug to do things like run code of their own.
@jackielii
@jackielii Ай бұрын
I think the problem is getting the slice of bytes out at the end. The Finalizer is attached to the struct which is not associated with the slice at all. So GC will happily call the free method attached to the finalizer which calls into Rust to clear out all memory which also removes the memory the slices of bytes points to.
RustConf 2023 - The Art and Science of Teaching Rust
28:01
RustConf 2023 - Fine! I'll just make my own stable ABI!
31:44
[실시간] 전철에서 찍힌 기생생물 감염 장면 | 기생수: 더 그레이
00:15
Netflix Korea 넷플릭스 코리아
Рет қаралды 38 МЛН
skibidi toilet 73 (part 1)
04:46
DaFuq!?Boom!
Рет қаралды 35 МЛН
The World's Fastest Cleaners
00:35
MrBeast
Рет қаралды 98 МЛН
Rust on ESP32 - Getting started
14:09
Floodplain: Streaming, Rust and Embedded
Рет қаралды 15 М.
Git MERGE vs REBASE: The Definitive Guide
9:39
The Modern Coder
Рет қаралды 46 М.
What Makes Rust Different?
12:38
No Boilerplate
Рет қаралды 193 М.
Rust: When C Code Isn't Enough
8:26
CodeAhead
Рет қаралды 148 М.
Which Phone Unlock Code Will You Choose? 🤔️
0:12
Game9bit
Рет қаралды 6 МЛН
Компьютер подписчику
0:40
Miracle
Рет қаралды 207 М.
Result of the portable iPhone electrical machine #hacks
1:01
KevKevKiwi
Рет қаралды 7 МЛН
Samsung mobile phone waterproof display. samsung mobile phone digital s23ultra  #shorts
0:15
Я Создал Новый Айфон!
0:59
FLV
Рет қаралды 2 МЛН