News for hackers. Stuff that matters.
Re:A brief introduction to C++'s model for type- and resourc... by nickpsecurity on Friday January 15, 2016 @01:15PM (#10911012)
I'm amazed at how well-written and thoughtful these papers are given the product is a language I oppose. Well, it does have some good ideas. :)

However, what made my jaw drop was section 3.2: "a dynamic model" for making the system safe and easily implemented in hardware. The section said Stroustrup deciced not to publish it because it was impractical. One of few times see his name and go "what an idiot..." What wasn't practical in general case or that time period doesn't mean it won't be in future in other circumstances. Good ideas, esp simple solutions, have a way of coming back to us.

Specifically, efforts like Cambridge's CHERI processor are looking at minimal modifications to CPU's to greatly increase assurance w/ legacy compatibility. This concept should've been published as there's use in embedded and appliance field where a lot uses subsets of C++. He should've published it. I'm saving the paper for my collection just in case that idea comes in handy.

Re:A brief introduction to C++'s model for type- and resourc... by pcwalton on Friday January 15, 2016 @08:17PM (#10913658)
> The section said Stroustrup deciced not to publish it because it was impractical. One of few times see his name and go "what an idiot..."

He's right though. Such a system would be slower than a good tracing GC, which completely eliminates these problems and is much easier for the programmer to use.

Re:A brief introduction to C++'s model for type- and resourc... by nickpsecurity on Friday January 15, 2016 @08:45PM (#10913773)
In "hardware" as a minimal processor extension as I said? Pointer checks, etc take almost nothing in HW. Garbage collection schemes have a bigger hit and more complex integration. Hence, having his published report for details to add to collection of lightweight schemes out there for C++ or even another language that might benefit later.

That sort of thing happens more than you know in CompSci. Example: One method for Oberon and Java appliances I pulled right out of an old Scheme CPU paper that was also impractical then. Also found a correct-by-construction HW method in same one. ;)

Re:A brief introduction to C++'s model for type- and resourc... by pcwalton on Friday January 15, 2016 @08:49PM (#10913784)
Specifically, how do you do use after free detection in hardware without garbage collection?
Re:A brief introduction to C++'s model for type- and resourc... by nickpsecurity on Friday January 15, 2016 @11:48PM (#10914297)
I should've clarified that my statement assumes his model works as advertised, then notes that the pointer checks are efficient in hardware. I couldn't be sure if he was detecting or preventing use-after-free with what would be in compiler and what in runtime. Here's the things I was looking at:

"supports the general thesis that garbage collection is neither necessary nor sufficient for quality software. This paper describes the techniques used to eliminate dangling pointers and to ensure resource safety."

"Every object on the free store (heap, dynamic store) must have exactly one owner [pointer/reference]"

"set the ownership bit when a value returned from new is assigned"

"use delete whenever a pointer with the ownership bit is set goes out of scope"

Sounds similar to what I read in Rust guide, esp one-per-location and scope part. Those and other rules appeared to make it easy for checks to prevent or catch use-after-free. If so, then my keep it around for hardware suggestion could lead to acceleration work. If I misread the paper or goals of ownership model, then my suggestion would've only led to accelerating... whatever safety it was trying to enforce.

Did that clear it up for you? Or did you spot where I went wrong? Could go either way given it was a quick read for me.