News for hackers. Stuff that matters.
Re:Nvidia Security Team: “What if we just stopped using C?” by P5fRxh5kUvp2th on Monday November 07, 2022 @11:49AM (#33508353)
Our industry went through this with the move to Java (and later .Net).

"It will solve memory leaks!"

...

"whoops, you can still leak memory in garbage collected languages, my bad everyone!".

Re:Nvidia Security Team: “What if we just stopped using C?” by adgjlsfhk1 on Monday November 07, 2022 @12:40PM (#33509192)
ditching C doesn't solve memory leaks but it does solve use after free. A memory leak is a performance problem that isn't generally exploitable. A use after free is almost always a security vulnerability.
Re:Nvidia Security Team: “What if we just stopped using C?” by P5fRxh5kUvp2th on Monday November 07, 2022 @02:55PM (#33511439)
quick, someone tell everyone locking up resources without releasing them isn't exploitable for bad actors.
Re:Nvidia Security Team: “What if we just stopped using C?” by worthless-trash on Monday November 07, 2022 @06:37PM (#33514098)
Memory leak is better than privesc in most cases of active exploitation.
Re:Nvidia Security Team: “What if we just stopped using C?” by ndriscoll on Monday November 07, 2022 @10:14PM (#33515518)
You can use resources after releasing them in pretty much any language. That's maybe not as dangerous as reinterpreting arbitrary memory, but then you can also use object pools for everything in C, which is what some very high performance code I used to work on did.
Re:Nvidia Security Team: “What if we just stopped using C?” by bcrosby95 on Monday November 07, 2022 @12:01PM (#33508571)
Both a paper cut and a gunshot wound bleed. It doesn't make them equal.
Re:Nvidia Security Team: “What if we just stopped using C?” by wiseowise on Monday November 07, 2022 @12:58PM (#33509480)
In C you leak memory because of all the land mines in the language. In Java/.Net you leak memory because you have flaw in your logic.
Re:Nvidia Security Team: “What if we just stopped using C?” by paulmd on Monday November 07, 2022 @02:38PM (#33511179)
Circular references and other things that tend to leak memory on GC languages aren't a logic flaw in the sense of your business logic being wrong, though.
Re:Nvidia Security Team: “What if we just stopped using C?” by scawf on Monday November 07, 2022 @03:52PM (#33512264)
Circular reference does not leak memory if your using a proper GC
Re:Nvidia Security Team: “What if we just stopped using C?” by donkeybeer on Monday November 07, 2022 @03:11PM (#33511691)
Memory errors are always logic errors in C. Freeing something that was already freed or accessing a buffer out of bounds and so on are pure logic errors.
Re:Nvidia Security Team: “What if we just stopped using C?” by pjmlp on Tuesday November 08, 2022 @03:34AM (#33517137)
Plenty of logic errors in the last 50 years, CVE appeciates it.
Re:Nvidia Security Team: “What if we just stopped using C?” by donkeybeer on Tuesday November 08, 2022 @04:54AM (#33517598)
But that person was trying to say memory errors are some kind of special "magical" error, which is simply wrong. Memory errors are merely logical errors. There is nothing "special" or "mysterious" about them.
Re:Nvidia Security Team: “What if we just stopped using C?” by pjmlp on Tuesday November 08, 2022 @05:57AM (#33517924)
Given the common meme as nasal dragons for UB, there is certainly some magic creatures associated with them.
Re:Nvidia Security Team: “What if we just stopped using C?” by hardware2win on Monday November 07, 2022 @01:11PM (#33509681)
I dont remember single mem leak in my half decade .net career

which speaks how rare they are

Re:Nvidia Security Team: “What if we just stopped using C?” by P5fRxh5kUvp2th on Monday November 07, 2022 @02:58PM (#33511490)
.net 1.0 was 20 years ago, you've been working in it for 5 years, roughly 25% of its lifetime.
Re:Nvidia Security Team: “What if we just stopped using C?” by hardware2win on Monday November 07, 2022 @03:39PM (#33512073)
We're evaluating techs by their state decade(s) ago here or what?
Re:Nvidia Security Team: “What if we just stopped using C?” by P5fRxh5kUvp2th on Monday November 07, 2022 @03:44PM (#33512149)
judgment is not the only reason for conversation, I strongly suggest you read back over the conversation from the beginning and endeavor to understand the context with which responses are made.

I also suggest you say 5 years instead of "half-a-decade", most of us see through that and it's off-putting.

Re:Nvidia Security Team: “What if we just stopped using C?” by zamalek on Monday November 07, 2022 @04:26PM (#33512738)
I have worked with .Net, in a hobby capacity, since beta. I have worked with it professionally since 2007.

I have seen two instances of rooted memory:

- WPF. The implicit GC root path introduced by events. We were easily able to track this down due to the information that the GC holds in memory[1] (fixing it was not so easy).

- A leak in managed C++ (non-pure, i.e. native code). We had to use the normal tools to track this down, not a 5 minute diagnosis.

At the end of the day GC'd languages can have (and usually do) richer tooling surrounding memory usage. They are better in this regard even during a failure state.

[1]: https://learn.microsoft.com/en-us/dotnet/core/diagnostics/so...

Re:Nvidia Security Team: “What if we just stopped using C?” by P5fRxh5kUvp2th on Monday November 07, 2022 @07:19PM (#33514451)
Lets loop back to the original point.

Getting rid of C won't get rid of security problems anymore than moving to java and .net got rid of needing to think about memory leaks.

Those that think otherwise are ignorant of history, or choosing to ignore it.

And it gets worse when you consider resource exhaustion, not just memory. There are entire mechanisms in .net and java whose sole purpose in life is to try and deal with resource exhaustion because the GC only deals with 1 aspect of that resource exhaustion (memory leaks).

---

For those of us who watched that transition, it's obvious it won't work out the way people are claiming.

Re:Nvidia Security Team: “What if we just stopped using C?” by zamalek on Monday November 07, 2022 @02:02PM (#33510576)
From my comment, emphasis added:

> it could slightly reduce

Re:Nvidia Security Team: “What if we just stopped using C?” by raxxorraxor on Tuesday November 08, 2022 @03:10AM (#33516988)
I had to move part of the Code to C for different reason (imaging device) and used that code in a .net application. But allocating unmanaged memory on .nets heap led to memory fragmentation and while overall there was enough memory available, you ran into allocation errors since unmanaged memory needed to be allocated in one successive block. Usually doesn't happen, but if you have large objects like high resolution images in memory, you can quickly run into problems. And to my knowledge there was no way to check if there was enough successive memory available.

Had to wait on a patch for .net... not a problem anymore today, although I don't know the details how they solved the problem.