Mitigating Memory Safety Issues in Open Source Software, Google security blog
https://security.googleblog.com/2021/02/mitigating-memory-safety-issues-in-open.html[removed] — view removed post
7
u/fdwr fdwr@github 🔍 Feb 18 '21
So the point of this post on a C++ forum is to say not to use C++? Here I was thinking that maybe it was an article on how to improve the safety of C++, such as with zero initialization of all fields or some object lifetime annotations or something.
1
u/pjmlp Feb 18 '21
The point is unless the C++ community starts caring to spread the gospel that security matters, eventually C++ with be reduced to niche use cases.
You already see this happening across mobile OSes and desktop GUI frameworks provided by mainstream OS vendors, where C++ is being used for kernel drivers, visual composition engine, language runtimes and a couple of high performance libraries.
Quite far from the role C++ had on desktop platforms during the 90's on the last decade.
Google is already reconsidering how to move forward with Chrome development.
18
u/feverzsj Feb 18 '21
rarely see some memory issue in my c++ projects these days. More bugs are about concurrency.
8
14
Feb 18 '21
What does this have to do with C++? I’d say it’s more fitting on r/rust
4
u/unaligned_access Feb 18 '21
Maybe it will encourage C++ to have a memory safe subset or something :) how's
-Wlifetimedoing, by the way?1
5
u/emdeka87 Feb 18 '21
So yeah for the 1000th time: C++ is not memory-safe! If your top priority is memory safety then you should Probably not use C++.
9
u/James20k P2005R0 Feb 18 '21
The problem is, this essentially states that C++ should not be used for anything which touches untrusted data in any capacity. This massively restricts the field of potential applications for C++, because an absolute tonne of applications need to process network information or consume untrusted files
No servers, no networked videogames, virtually no cli utilities, no operating systems, chat applications, browsers, etc etc etc. If C++ simply stops being used anywhere where memory safety is an issue, it seems like C++ will simply stop being used
To be fair I can't describe myself as being massively against that, because the lack of memory (and thread) safety is crippling in anything touching untrusted data that's user facing, but personally it seems fairly mandatory to me if the language doesn't want to get relegated to cobol territory
0
u/Fazer2 Feb 18 '21
It shouldn't be a top priority, it should be an absolute minimum.
4
u/emdeka87 Feb 18 '21
I would argue that for most software written in C++ (games, audio, trading, physics, etc) having solid memory safety is nice to have (since obviously every double free is also a bug that needs to be fixed) but they don't need to be 100% devoid of them (as Software with focus on security that are constantly audited and checked for vulnerabilities). In reality, you get good enough memory safety by adhering to a set of good practices and idioms. Haven't had buffer overflow errors or double free in years. The Google code case is large and probably consist of lots of legacy C/C++ parts. I wouldn't be surprised if they could resolve a good percentage of these issues by modernizing their Code base.
2
u/pjmlp Feb 18 '21
In what concerns games, it depends on how relevant lost revenue due to server exploits and piracy might be to the company in case.
2
u/patatahooligan Feb 18 '21
Maybe sometime in the future when OS are configured to run everything in its own sandbox and a program going rogue can't really do anything, memory safety will be "nice to have". Right now you are one arbitrary code execution from having all your personal data grabbed, though, and the hand-wavy attitude of "it's probably good enough" needs to die off.
1
•
u/STL MSVC STL Dev Feb 18 '21
Removed as off-topic - as several have noted/reported, this provides no actionable insights for C++ programmers.