3 ms·
What is Apple doing about these non stop memory safety bugs? Google has put out a post about how they now write the majority of Android code in memory safe lang
by Gigachad 4y ago
What is Apple doing about these non stop memory safety bugs? Google has put out a post about how they now write the majority of Android code in memory safe languages including 1.3 million lines of production Rust. While Apple hasn't said anything as far as I'm aware.
https://security.googleblog.com/2022/12/memory-safe-languages-in-android-13.html https://security.googleblog.com/2022/12/memory-safe-language...
- saagarjha 4y agoMajority of new Android code. Apple also has been writing parts of their operating system in a memory safe language, Swift.
- deleted 4y ago[deleted]
- randyrand 4y agoMost new code at Apple is not written in Swift, just a small portion.
- saagarjha 4y agoI actually think a lot of their new projects are written almost exclusively in Swift. There’s a lot of existing code that would need work to embed Swift into, though. (They’re working on it: https://www.swift.org/blog/future-of-foundation/ https://www.swift.org/blog/future-of-foundation/)
- deleted 4y ago[deleted]
- pjmlp 4y agoWell, given their WWDC 2022 announcement regarding Objective-C, and that Swift has surpassed C++ on iOS 16, things are starting to change.
- DenisM 4y agoWhat announcement?
- bri3d 4y agoIn the kernel: https://security.apple.com/blog/towards-the-next-generation-of-xnu-memory-safety/ https://security.apple.com/blog/towards-the-next-generation-... In bootloaders: https://support.apple.com/guide/security/memory-safe-iboot-implementation-sec30d8d9ec1/web https://support.apple.com/guide/security/memory-safe-iboot-i...
- dcsommer 4y agoI would love to see details of iBoot. How they built a memory safe bootloader with just "a modified C toolchain" is a pretty important detail. Did add they another language to the toolchain or add a special --memory-safe flag to a forked C compiler?
- olliej 4y agoNo, google wrote a blog post about how they're moving their new code to safe languages. The vast majority of Google's code is in C/C++, and will be for the foreseeable future. The same is true for Apple - there's a huge amount of existing C/C++, and new code is increasingly being written in Swift.
- pjmlp 4y agoThat blog post was about Android, its use of Java, Kotlin and now Rust (since Android 12), mainly used to rewrite Bluetooth stack and the new virtualization framework in Android 13. Any NDK user painfully knows how castrating the whole experience is, to access anything that doesn't have to do with graphics or real time audio.
- Gigachad 4y agoThat's exactly what I said with "they now write"
- olliej 4y agoin that case you can look at the last series of years of WWDC with apple driving swift for developers, and swift's adoption by apple by increasing amounts of the OS. Which seems like the equivalent, only not in blog form.
- Gigachad 4y agoNot terribly familiar with Swift but my understanding was it was more an app programming language. Is Swift suitable for writing OS code?
- pjmlp 4y agoYes, that is even mentioned on its official documentation, a replacement for C, Objective-C and C++.
- AdamN 4y agoSwift is a very powerful and robust language. I would expect that they keep going further down the stack with it but the problem will always be, "is it worth investing in a language refactoring on an existing codebase?". I presume all but the lowest level (or server-side) new code is in Swift at Apple nowadays.
- alwillis 4y agoI expect new code is being mostly written in Swift but there’s still lots of C, C++ and Objective C code that has to be maintained. WebKit is a huge C++ codebase for example.
- MBCook 4y agoApple has, and is using, Swift. There was an announcement recently that Foundation was moving to be written in Swift and not C/C++/Obj-C (I’m not sure how much of each it was). This means a whole host of conversions and memory allocation and such will be in a safe language, underpinning everything. Including Objective-C programs. https://www.swift.org/blog/future-of-foundation/ https://www.swift.org/blog/future-of-foundation/
- brigade 4y agoFor this batch... most of the memory safety issues look to be in kernel code or adjacent, followed by Safari/Webkit. The Android Linux kernel is still pure C (for now), and I'm pretty sure new Chrome/Blink code is still primarily C++. The codebase as a whole certainly is…