[PATCH] D34121: [ubsan] Teach the pointer overflow check that "p - <= p" (PR33430)

2017-07-13 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL307955: [ubsan] Teach the pointer overflow check that "p - <= p" (PR33430) (authored by vedantk). Changed prior to commit: https://reviews.llvm.org/D34121?vs=103606=106524#toc Repository: rL LLVM

[PATCH] D34121: [ubsan] Teach the pointer overflow check that "p - <= p" (PR33430)

2017-07-13 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added a comment. In https://reviews.llvm.org/D34121#808486, @dtzWill wrote: > In https://reviews.llvm.org/D34121#806978, @vsk wrote: > > > @dtzWill do you have any further comments on this one? > > > > I'd like to get another 'lgtm' before committing, and it'd be nice to get > > this in

[PATCH] D34121: [ubsan] Teach the pointer overflow check that "p - <= p" (PR33430)

2017-07-13 Thread Will Dietz via Phabricator via cfe-commits
dtzWill added a comment. In https://reviews.llvm.org/D34121#806978, @vsk wrote: > @dtzWill do you have any further comments on this one? > > I'd like to get another 'lgtm' before committing, and it'd be nice to get > this in before llvm 5.0 branches (7/19). > > FWIW we've been living on this

[PATCH] D34121: [ubsan] Teach the pointer overflow check that "p - <= p" (PR33430)

2017-07-12 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added a comment. @dtzWill do you have any further comments on this one? I'd like to get another 'lgtm' before committing, and it'd be nice to get this in before llvm 5.0 branches (7/19). FWIW we've been living on this for a few weeks internally without any issues:

[PATCH] D34121: [ubsan] Teach the pointer overflow check that "p - <= p" (PR33430)

2017-06-22 Thread Vedant Kumar via Phabricator via cfe-commits
vsk updated this revision to Diff 103606. vsk added a comment. Fix a typo introduced in emitArraySubscriptGEP while refactoring /*isSubtraction=false*/ to CodeGenFunction::NotSubtraction, and add CHECK lines which catch the issue. https://reviews.llvm.org/D34121 Files:

[PATCH] D34121: [ubsan] Teach the pointer overflow check that "p - <= p" (PR33430)

2017-06-14 Thread Vedant Kumar via Phabricator via cfe-commits
vsk updated this revision to Diff 102603. vsk marked an inline comment as done. vsk added a comment. Address Adrian's comment about using an enum to simplify some calls. https://reviews.llvm.org/D34121 Files: lib/CodeGen/CGExpr.cpp lib/CodeGen/CGExprScalar.cpp

[PATCH] D34121: [ubsan] Teach the pointer overflow check that "p - <= p" (PR33430)

2017-06-14 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added inline comments. Comment at: lib/CodeGen/CGExpr.cpp:3010 +return CGF.EmitCheckedInBoundsGEP(ptr, indices, signedIndices, + /*IsSubtraction=*/false, loc, name); } else { Might want to define an `enum {

[PATCH] D34121: [ubsan] Teach the pointer overflow check that "p - <= p" (PR33430)

2017-06-13 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added a comment. In https://reviews.llvm.org/D34121#779347, @dtzWill wrote: > Don't mean to block this, but just FYI I won't be able to look into this > carefully until later this week (sorry!). > > Kicked off a rebuild using these patches just now, though! O:) No problem, thanks for

[PATCH] D34121: [ubsan] Teach the pointer overflow check that "p - <= p" (PR33430)

2017-06-13 Thread Will Dietz via Phabricator via cfe-commits
dtzWill added a comment. Don't mean to block this, but just FYI I won't be able to look into this carefully until later this week (sorry!). Kicked off a rebuild using these patches just now, though! O:) https://reviews.llvm.org/D34121 ___

[PATCH] D34121: [ubsan] Teach the pointer overflow check that "p - <= p" (PR33430)

2017-06-12 Thread Vedant Kumar via Phabricator via cfe-commits
vsk updated this revision to Diff 102261. vsk marked an inline comment as done. vsk edited the summary of this revision. vsk added a comment. Thanks for the review! I'll wait for another 'lgtm'. https://reviews.llvm.org/D34121 Files: lib/CodeGen/CGExpr.cpp lib/CodeGen/CGExprScalar.cpp

[PATCH] D34121: [ubsan] Teach the pointer overflow check that "p - <= p" (PR33430)

2017-06-12 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. Looks okay, but I haven't been reviewing this series of patches closely, so I could be missing something. Comment at: lib/CodeGen/CGExprScalar.cpp:3974 ValidGEP = Builder.CreateAnd(PosOrZeroValid, NoOffsetOverflow); + } else if (!SignedIndices

[PATCH] D34121: [ubsan] Teach the pointer overflow check that "p - <= p" (PR33430)

2017-06-12 Thread Vedant Kumar via Phabricator via cfe-commits
vsk created this revision. The pointer overflow check gives false negatives when dealing with expressions in which an unsigned value is subtracted from a pointer. This is summarized in PR33430 [1]: ubsan permits the result of the submission to be greater than "p", but it should not. To fix the