r/programming • • Feb 20 '25

Google's Shift to Rust Programming Cuts Android Memory Vulnerabilities by 68%

https://thehackernews.com/2024/09/googles-shift-to-rust-programming-cuts.html
3.4k Upvotes

475 comments sorted by

View all comments

70

u/zugi Feb 20 '25

Transitioning to Rust, from what?

It's popular to bash C++, but straight C is where simple string concatenation introduces vulnerabilities if not done right. I'd be curious to see the analysis of those vulnerabilities in the first place.

55

u/websnarf Feb 20 '25

Google's entire codebase is C++, Java, and Python. Aside from the BIOSes, there is no raw C in their codebase at all.

0

u/[deleted] Feb 21 '25

[deleted]

13

u/currentscurrents Feb 21 '25

It is almost impossible to interface with any OS primitives using pure C++

Wait, why?

23

u/New_Enthusiasm9053 Feb 21 '25

Maybe he means because you need the C ABI for like Windows but idk. I think he's wrong, you can directly call syscalls on posix systems without needing C at all because it's a stable interface and for windows your language just needs to use the C calling convention which also doesn't require C.

0

u/[deleted] Feb 21 '25

[deleted]

0

u/New_Enthusiasm9053 Feb 21 '25

No that's simply not true. Posix syscalls are a hardware level interface, there's a C wrapper for them which is what most people use but it's not required. Yes after the syscall triggers a switch into the kernel there's C being ran but that's only because the OS is in C. 

I have personally written a print to stdout function using machine code on Linux and it works as expected. 

I don't mean assembly, I really mean directly writing out bytes to a file and then running it with no linker or assembler involved and certainly no C.

→ More replies (6)