Re: [PATCH] D25199: [ubsan] Sanitize deleted pointers

2016-10-21 Thread Richard Smith via cfe-commits
On Tue, Oct 4, 2016 at 11:43 AM, Matt Gingell wrote: > Hi Richard, > > Thanks for your analysis. > > This patch is intended to mitigate use-after-free bugs. In that context a > “define strict behavior for invalid pointer values” we could deploy in > production code would be very useful. Maybe cal

Re: [PATCH] D25199: [ubsan] Sanitize deleted pointers

2016-10-04 Thread Matt Gingell via cfe-commits
Hi Richard, Thanks for your analysis. This patch is intended to mitigate use-after-free bugs. In that context a “define strict behavior for invalid pointer values” we could deploy in production code would be very useful. Maybe calling this a sanitizer is misleading, and instead it could be pr

Re: [PATCH] D25199: [ubsan] Sanitize deleted pointers

2016-10-04 Thread Richard Smith via cfe-commits
On Mon, Oct 3, 2016 at 2:59 PM, Peter Collingbourne wrote: > pcc added a reviewer: rsmith. > pcc added a comment. > > It seems to me that this sanitizer would break the semantics of otherwise > well-defined programs. For example: > > int *x = nullptr; > delete x; > if (x != nullptr) { >

[PATCH] D25199: [ubsan] Sanitize deleted pointers

2016-10-04 Thread Filipe Cabecinhas via cfe-commits
filcab added a comment. In https://reviews.llvm.org/D25199#560061, @vsk wrote: > My question was about whether it's possible to resume normal program > execution after printing the stack trace from the segv handler. I had assumed > this is not possible, and (mistakenly) thought that you were su

[PATCH] D25199: [ubsan] Sanitize deleted pointers

2016-10-03 Thread Vedant Kumar via cfe-commits
vsk added a comment. In https://reviews.llvm.org/D25199#560023, @kcc wrote: > > Maybe we could call this `-fpoison-dangling-ptrs` and force users to be > > more explicit about opting into this behavior change. That would remove > > some of the constraints usually placed on new sanitizer checks

[PATCH] D25199: [ubsan] Sanitize deleted pointers

2016-10-03 Thread Kostya Serebryany via cfe-commits
kcc added a comment. > Maybe we could call this `-fpoison-dangling-ptrs` and force users to be more > explicit about opting into this behavior change. That would remove some of > the constraints usually placed on new sanitizer checks (e.g support for > executing after the error triggers, supp

[PATCH] D25199: [ubsan] Sanitize deleted pointers

2016-10-03 Thread Vedant Kumar via cfe-commits
vsk added a comment. In https://reviews.llvm.org/D25199#559849, @pcc wrote: > It seems to me that this sanitizer would break the semantics of otherwise > well-defined programs. For example: > > int *x = nullptr; > delete x; > if (x != nullptr) { > // normally unreachable > } > > > It

[PATCH] D25199: [ubsan] Sanitize deleted pointers

2016-10-03 Thread Peter Collingbourne via cfe-commits
pcc added a reviewer: rsmith. pcc added a comment. It seems to me that this sanitizer would break the semantics of otherwise well-defined programs. For example: int *x = nullptr; delete x; if (x != nullptr) { // normally unreachable } It may be that a null comparison would be enough

[PATCH] D25199: [ubsan] Sanitize deleted pointers

2016-10-03 Thread Vedant Kumar via cfe-commits
vsk added a comment. In https://reviews.llvm.org/D25199#559797, @kcc wrote: > >> will just crash without further reporting > > I agree, and we can address that by having special logic in ubsan's segv > handler. > This does not have to be in this patch. @kcc Is it safe to add a handler for

[PATCH] D25199: [ubsan] Sanitize deleted pointers

2016-10-03 Thread Kostya Serebryany via cfe-commits
kcc added a comment. >> will just crash without further reporting I agree, and we can address that by having special logic in ubsan's segv handler. This does not have to be in this patch. Also, I am not sure about the actual constant. DEADBEEF is commonly recognized poison valued, but on a

[PATCH] D25199: [ubsan] Sanitize deleted pointers

2016-10-03 Thread Kostya Serebryany via cfe-commits
kcc added a reviewer: pcc. kcc added a comment. In https://reviews.llvm.org/D25199#559407, @vsk wrote: > It looks like programs which trip -fsanitize-value-after-delete will just > crash without further reporting, which isn't in keeping with the way other > ubsan checks are implemented. > > IMO

[PATCH] D25199: [ubsan] Sanitize deleted pointers

2016-10-03 Thread Vedant Kumar via cfe-commits
vsk added a comment. It looks like programs which trip -fsanitize-value-after-delete will just crash without further reporting, which isn't in keeping with the way other ubsan checks are implemented. IMO, address sanitizer is better-equipped to diagnose this issue. https://reviews.llvm.org/D2

[PATCH] D25199: [ubsan] Sanitize deleted pointers

2016-10-03 Thread Matt Gingell via cfe-commits
gingell created this revision. gingell added reviewers: cfe-commits, kcc. This patch adds a "value-after-delete" sanitizer, which will invalidate the value of a pointer passed in a delete expression. For instance, when -fsanitize=value-after-delete is passed: int *foo = new int; delete foo; // f