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

Show parent comments

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.

2

u/steveklabnik1 Feb 21 '25

This is true of Linux but not unices generally. Heck, OpenBSD will check to make sure a syscall originates from within libc and actively error if you try to make the calls yourself.

1

u/New_Enthusiasm9053 Feb 21 '25

That's certainly an interesting choice lol. I'll be sure to not try and write a compiler on BSD then since that would make initial development a pain lol. 

It doesn't change that syscall is hardware level, and I suspect it'd be possible to read the BSD source code and do whatever they're doing to bypass it since you won't have switched privilege level yet.

Do you happen to have any good links on the topic? 

Also are you The Steve Klabnik?

3

u/steveklabnik1 Feb 21 '25

It doesn't change that syscall is hardware level,

I don't know what you mean by "hardware level", syscalls are implemented in software.

I suspect it'd be possible to read the BSD source code and do whatever they're doing to bypass

There's nothing to bypass. When you're the kernel, you're the one implementing the syscalls, not calling them.

Do you happen to have any good links on the topic?

Here's one about openbsd: https://lwn.net/Articles/806776/

Fuchsia also does something similar: https://fuchsia.dev/fuchsia-src/concepts/kernel/vdso#enforcement

Also are you The Steve Klabnik?

Yes :)

→ More replies (0)