[libcxx-commits] [PATCH] D80057: [libc++][NFCI] Optimization to std::~unique_ptr

JF Bastien via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 19 08:07:40 PDT 2020


jfb added a comment.

I agree that the modification of the pointer isn't necessary. However, this nullptr has prevented UaFs for folks, and will now stop doing so. I'm fine having a "you used UB you get whatever" as an implementation strategy, because it generally gives us better performance. However, here we're regressing a safety that we'd offered developers. I wouldn't do so lightly, even if it is UB and we're allowed to. Is there a quantifiable gain from making this change? If not, then I'd rather add a "UB but fast" and a "safe-ish and a bit slower" mode to libc++, and make this change under the umbrella. I'd make "UB but fast" the default, and publicize that we're doing such a change so that folks who want the UaF protection here and similar protections in other places can make an informed choice. Doing otherwise feeds into the narrative "compiler developers use UB to do unexpected things to my code with no actual performance gain", which isn't something I want to encourage.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80057/new/

https://reviews.llvm.org/D80057





More information about the libcxx-commits mailing list