News for hackers. Stuff that matters.
Re:RFC: C++ Buffer Hardening by olliej on Thursday October 06, 2022 @02:10AM (#33104947)
Making out of bounds access on explicitly bound types is an easy memory safety win.

The fact the UB is still being used as an excuse to clearly undermine reasonably expected behaviour remains a BS trope, and WG21's continued acceptance of new features and specifications that say perfectly specifiable behaviour is UB instead of unspecified is a continuing source of avoidable security bugs.

It is inexcusable for new features to be added to C++ that have UB in any case other than the undefinable (invalid memory access, etc). Removing the copious unnecessary UB from the existing specs should be a higher priority that many of the new features being proposed.

Re:RFC: C++ Buffer Hardening by saagarjha on Thursday October 06, 2022 @02:50AM (#33105222)
Much that is UB deserves to be defined. And some that is defined deserves to be UB. Can you make it illegal? Then do not be too eager to deal out behaviors in standardization.

I don't actually oppose, in the long run, slowly picking some behaviors and changing them to be standardized. But I do vehemently oppose many of the suggestions that are brought up. The kinds of things that should be moved out of being undefined are things like "you named your function isfoo" and not "you passed NULL to memset".

Re:RFC: C++ Buffer Hardening by olliej on Thursday October 06, 2022 @04:05AM (#33105726)
> And some that is defined deserves to be UB.

Can you provide an example of currently specified behaviour that should be UB?

To be very clear I am using specification language here. "Unspecified behaviour" is very much not "undefined behaviour".

Re:RFC: C++ Buffer Hardening by flohofwoe on Thursday October 06, 2022 @04:35AM (#33105956)
It's an LoTR joke: "Many that live deserve death. And some that die deserve life. Can you give it to them? Then do not be too eager to deal out death in judgement"
Re:RFC: C++ Buffer Hardening by mgaunard on Thursday October 06, 2022 @04:41AM (#33105994)
Undefined behaviour is great. I for one will continue to vote in its favour.

C++ does not add runtime overhead to validate that programs are well-formed.

Re:RFC: C++ Buffer Hardening by olliej on Thursday October 06, 2022 @05:13AM (#33106191)
Can you provide examples of UB that could be unspecified behaviour, where UB does anything other than cause harm?
Re:RFC: C++ Buffer Hardening by mgaunard on Thursday October 06, 2022 @09:33AM (#33107960)
Dereferencing a pointer to memory that doesn't point to a live valid object is undefined behaviour. You couldn't possibly specify what this does without instrumenting every single access to memory, like asan or valgrind does.
Re:RFC: C++ Buffer Hardening by olliej on Thursday October 06, 2022 @01:30PM (#33111250)
As I said, behaviour that could be unspecified rather than undefined.

This is an example of something that cannot be anything other than UB.

Re:RFC: C++ Buffer Hardening by kllrnohj on Thursday October 06, 2022 @11:33AM (#33109566)
Re:RFC: C++ Buffer Hardening by staticassertion on Thursday October 06, 2022 @05:02AM (#33106131)
> C++ does not add runtime overhead to validate that programs are well-formed.

You have succinctly described the problem.

Re:RFC: C++ Buffer Hardening by mgaunard on Saturday October 08, 2022 @04:50AM (#33130830)
That's not a problem, that's a core policy of that language's design.

If you want a language that is slow, there are plenty of options.