[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-15 Thread Balázs Benics via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGf4fc3f6ba319: [analyzer] Treat system globals as mutable if they are not const (authored by steakhal). Repository: rG LLVM Github Monorepo CHANGE

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-15 Thread Balázs Benics via Phabricator via cfe-commits
steakhal marked an inline comment as done. steakhal added a comment. According to my measurements, this commit will change some reports, but nothing significant (<20) on our testset (except llvm which I did not include). But more importantly, no taint reports disappeared nor were introduced. Re

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-15 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127306/new/ https://reviews.llvm.org/D127306 _

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-14 Thread Balázs Benics via Phabricator via cfe-commits
steakhal marked 3 inline comments as done. steakhal added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/MemRegion.cpp:978 +assert(!Ty.isNull()); +if (Ty.isConstQualified() && Ty->isArithmeticType()) { // TODO: We could walk the complex types here and s

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-14 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. In D127306#3581814 , @martong wrote: > In D127306#3580981 , @steakhal > wrote: > >> - Modify the `GenericTaintChecker::isStdin()` to look through //derived >> symbols//, to mitigate the

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-14 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 436821. steakhal marked an inline comment as done. steakhal added a comment. Use `getOriginRegion()`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127306/new/ https://reviews.llvm.org/D127306 Files: clang/

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-14 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D127306#3580981 , @steakhal wrote: > - Modify the `GenericTaintChecker::isStdin()` to look through //derived > symbols//, to mitigate the effect of invalidations. So, the taint property is still not propagated by the engine a

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-14 Thread Balázs Benics via Phabricator via cfe-commits
steakhal requested review of this revision. steakhal added a comment. Please check this again @martong @xazax.hun. I'll also conduct a measurement, investigating what report changes we experience with this change. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://review

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-14 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 436707. steakhal marked an inline comment as done. steakhal added a comment. - Modify the `GenericTaintChecker::isStdin()` to look through //derived symbols//, to mitigate the effect of invalidations. Repository: rG LLVM Github Monorepo CHANGES SINCE LA

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-13 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/MemRegion.cpp:978 +assert(!Ty.isNull()); +if (Ty.isConstQualified() && Ty->isArithmeticType()) { // TODO: We could walk the complex types here and see if everything is steak

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-13 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/MemRegion.cpp:978 +assert(!Ty.isNull()); +if (Ty.isConstQualified() && Ty->isArithmeticType()) { // TODO: We could walk the complex types here and see if everything is xazax.

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-13 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun accepted this revision. xazax.hun added a comment. Overall looks good to me, it is a step towards having a more faithful representation of the reality. Comment at: clang/lib/StaticAnalyzer/Core/MemRegion.cpp:978 +assert(!Ty.isNull()); +if (Ty.isConstQualified

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-13 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. Ok, LGTM Comment at: clang/test/Analysis/globals-are-not-always-immutable.c:70 + invalidate_globals(); + clang_analyzer_eval(my_mutable_system_global == x); // expected-w

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-09 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/MemRegion.cpp:979-980 +if (Ty.isConstQualified() && Ty->isArithmeticType()) { // TODO: We could walk the complex types here and see if everything is // constified. + sReg = getGlobals

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-09 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 435611. steakhal marked 2 inline comments as done. steakhal added a comment. - Use `assert` macro for introducing constraints. - Add tests for store binding invalidations, besides constraint invalidations. CHANGES SINCE LAST ACTION https://reviews.llvm.or

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-09 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D127306#3570170 , @steakhal wrote: > In D127306#3570083 , @martong wrote: > >> In D127306#3566984 , @steakhal >> wrote: >> >>> In D127306#3566

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-09 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. In D127306#3570083 , @martong wrote: > In D127306#3566984 , @steakhal > wrote: > >> In D127306#3566761 , @martong >> wrote: >> In theory,

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-09 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D127306#3566984 , @steakhal wrote: > In D127306#3566761 , @martong wrote: > >>> In theory, the engine should propagate taint in default eval call. If that >>> would be the case, we wou

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-08 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. In D127306#3566761 , @martong wrote: >> In theory, the engine should propagate taint in default eval call. If that >> would be the case, we would still have this report. > > How complex would it be to add the taint propagation t

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-08 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. > In theory, the engine should propagate taint in default eval call. If that > would be the case, we would still have this report. How complex would it be to add the taint propagation to the engine/evalCall? Do you see that feasible as a parent patch of this? Reposito

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-08 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: NoQ, martong, ASDenysPetrov, balazske, Szelethus, gamesh411. Herald added subscribers: manas, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a project: All. steakhal requested