Page MenuHomePhabricator
Feed Advanced Search

Jul 12 2022

zukatsinadze added a comment to D124244: [analyzer] add StoreToImmutable and ModelConstQualifiedReturn checkers.

Sorry for my late reply.

It feels like we have some serious obstacles.
The check::PostCall handler wants to mark some memory region immutable. Currently, the checker creates a new symbolic memregion, spawned into the immutable memory space. After this it simply re-binds the return value.
However, only eval::Call handler is supposed (must) to bind the return value, so the current implementation cannot land.

I played with the trait idea, which was this:

  1. Introduce a new program state trait with the REGISTER_SET_WITH_PROGRAMSTATE(ImmutableRegions, const ento::MemRegion *). One should not bind values to these regions. (*)
  2. The check::PostCall would simply insert into this set.
  3. The StoreToImmutableChecker, at the check::Bind handler, would verify that the region is not contained by the set - otherwise emit a report...
  4. Surface this new trait to be reachable by the Core infrastructure.
  5. Refactor all the Core functions introducing or expecting MemRegionManager::getGlobalsRegions to insert the region in question into this ImmutableRegions set associated with the current State, producing some new State.

The last point is the most critical. Now, by design, MemRegionManager does not refer to the ProgramState, hence we don't have one that we could mutate by inserting into the ImmutableRegions set. Passing a ProgramStateRef along all the functions is a nightmare. Trust me, I've tried it.
That being said, eradicating GlobalImmutableSpaceRegion seems to be challenging.

I've settled on using the custom trait, and the GlobalImmutableSpaceRegion memspace kind to detect if the store (bind) should be allowed or not.

WDYT @NoQ, how could we get rid of the GlobalImmutableSpaceRegion?


(*): Originally I wanted a set of const MemSpaceRegion *, but it turns out a default eval called function which returns a plain old mutable pointer is of SymRegion{conj{}} at the UnknownSpaceRegion. And we probably don't want to mark immutable the whole UnknownSpaceRegion xD.

Jul 12 2022, 6:02 AM · Restricted Project, Restricted Project

May 17 2022

zukatsinadze added a comment to D124244: [analyzer] add StoreToImmutable and ModelConstQualifiedReturn checkers.

The patch adds two new checkers.

I don't see any technical dependencies between the two, so, please split it into two independent patches.

May 17 2022, 4:09 PM · Restricted Project, Restricted Project
zukatsinadze added inline comments to D124244: [analyzer] add StoreToImmutable and ModelConstQualifiedReturn checkers.
May 17 2022, 4:02 PM · Restricted Project, Restricted Project
zukatsinadze updated the diff for D124244: [analyzer] add StoreToImmutable and ModelConstQualifiedReturn checkers.
May 17 2022, 4:02 PM · Restricted Project, Restricted Project

Apr 22 2022

zukatsinadze updated the diff for D124244: [analyzer] add StoreToImmutable and ModelConstQualifiedReturn checkers.

fix clang format

Apr 22 2022, 8:49 AM · Restricted Project, Restricted Project
zukatsinadze requested review of D124244: [analyzer] add StoreToImmutable and ModelConstQualifiedReturn checkers.
Apr 22 2022, 3:58 AM · Restricted Project, Restricted Project

Oct 4 2021

zukatsinadze committed rG811b1736d91b: [analyzer] Add InvalidPtrChecker (authored by zukatsinadze).
[analyzer] Add InvalidPtrChecker
Oct 4 2021, 8:13 AM
zukatsinadze closed D97699: [analyzer] Add InvalidPtrChecker.
Oct 4 2021, 8:13 AM · Restricted Project

Sep 13 2021

zukatsinadze added inline comments to D97699: [analyzer] Add InvalidPtrChecker.
Sep 13 2021, 6:40 AM · Restricted Project
zukatsinadze updated the diff for D97699: [analyzer] Add InvalidPtrChecker.

Thanks for the review @martong

Sep 13 2021, 6:38 AM · Restricted Project

Jun 8 2021

zukatsinadze added inline comments to D97699: [analyzer] Add InvalidPtrChecker.
Jun 8 2021, 10:40 AM · Restricted Project
zukatsinadze updated the diff for D97699: [analyzer] Add InvalidPtrChecker.

@balazske Thanks for the comments!

Jun 8 2021, 10:39 AM · Restricted Project

Jun 3 2021

zukatsinadze added a reviewer for D97699: [analyzer] Add InvalidPtrChecker: balazske.
Jun 3 2021, 8:42 AM · Restricted Project

May 24 2021

zukatsinadze added a comment to D97699: [analyzer] Add InvalidPtrChecker.

@NoQ can you please have another look at this? I think it will be a useful checker.

May 24 2021, 9:29 AM · Restricted Project

Apr 5 2021

zukatsinadze updated the diff for D97699: [analyzer] Add InvalidPtrChecker.

Gentle ping

Apr 5 2021, 2:50 PM · Restricted Project

Mar 21 2021

zukatsinadze added inline comments to D97699: [analyzer] Add InvalidPtrChecker.
Mar 21 2021, 5:49 PM · Restricted Project
zukatsinadze added inline comments to D97699: [analyzer] Add InvalidPtrChecker.
Mar 21 2021, 5:16 PM · Restricted Project

Mar 7 2021

zukatsinadze added a reviewer for D97699: [analyzer] Add InvalidPtrChecker: steakhal.
Mar 7 2021, 5:33 AM · Restricted Project

Mar 6 2021

zukatsinadze added a comment to D97699: [analyzer] Add InvalidPtrChecker.

@NoQ, thanks for the comments.

Mar 6 2021, 1:49 PM · Restricted Project

Mar 1 2021

zukatsinadze updated the diff for D97699: [analyzer] Add InvalidPtrChecker.

Removed code repetition from the tests.

Mar 1 2021, 10:17 AM · Restricted Project
zukatsinadze added a comment to D97699: [analyzer] Add InvalidPtrChecker.

Attaching results of CodeChecker run on some projects.

Mar 1 2021, 9:57 AM · Restricted Project
zukatsinadze updated the diff for D97699: [analyzer] Add InvalidPtrChecker.

Fixed docs.

Mar 1 2021, 9:32 AM · Restricted Project
zukatsinadze added a comment to D97699: [analyzer] Add InvalidPtrChecker.

Please suggest which package to use for the checker.
CERT rules are ENV, however, it deals with non-ENV functions as well.

Mar 1 2021, 9:08 AM · Restricted Project
zukatsinadze requested review of D97699: [analyzer] Add InvalidPtrChecker.
Mar 1 2021, 9:05 AM · Restricted Project

Aug 12 2020

zukatsinadze committed rG25bbe234e4e7: [analyzer] StdLibraryFunctionsChecker: Add support for new functions (authored by zukatsinadze).
[analyzer] StdLibraryFunctionsChecker: Add support for new functions
Aug 12 2020, 7:21 AM
zukatsinadze closed D85093: [analyzer] StdLibraryFunctionsChecker: Add support for new functions.
Aug 12 2020, 7:20 AM · Restricted Project

Aug 2 2020

zukatsinadze abandoned D70823: [clang-tidy] Adding cert-pos34-c check.
Aug 2 2020, 10:52 AM · Restricted Project, Restricted Project
zukatsinadze requested review of D85093: [analyzer] StdLibraryFunctionsChecker: Add support for new functions.
Aug 2 2020, 8:56 AM · Restricted Project

May 5 2020

zukatsinadze abandoned D79358: [analyzer] CERT: STR37-C.
May 5 2020, 7:31 AM · Restricted Project
zukatsinadze added a comment to D79358: [analyzer] CERT: STR37-C.

Adding @martong, because I fear that this is colliding with StdLibraryFunctionsChecker. The warnings added here seem to be, in essence, identical to D73898.

May 5 2020, 4:16 AM · Restricted Project

May 4 2020

zukatsinadze created D79358: [analyzer] CERT: STR37-C.
May 4 2020, 12:53 PM · Restricted Project

Feb 19 2020

zukatsinadze committed rGa54d81f59796: [analyzer] CERT: POS34-C (authored by zukatsinadze).
[analyzer] CERT: POS34-C
Feb 19 2020, 9:22 AM
zukatsinadze closed D71433: [analyzer] CERT: POS34-C.
Feb 19 2020, 9:21 AM · Restricted Project

Feb 18 2020

zukatsinadze added a comment to D71433: [analyzer] CERT: POS34-C.

I think for an alpha checker this is ready to land if you're ready -- do you have commit access or need assistance?

Feb 18 2020, 11:02 AM · Restricted Project

Feb 7 2020

zukatsinadze updated the diff for D71433: [analyzer] CERT: POS34-C.
  • Removed dead code.
Feb 7 2020, 6:03 AM · Restricted Project
zukatsinadze added inline comments to D71433: [analyzer] CERT: POS34-C.
Feb 7 2020, 6:03 AM · Restricted Project
zukatsinadze added a comment to D71433: [analyzer] CERT: POS34-C.
In D71433#1784238, @NoQ wrote:

Currently the check may warn on non-bugs of the following kind:

void foo() {
  char env[] = "NAME=value";
  putenv(env);
  doStuff();
  putenv("NAME=anothervalue");
}

That could be the next round as a follow-up patch as the next semester starts in February [...]

Well, the next semester is about to start. Could you implement that request please?

Feb 7 2020, 3:58 AM · Restricted Project
zukatsinadze updated the diff for D71433: [analyzer] CERT: POS34-C.

Addressed new inline comments.

Feb 7 2020, 3:41 AM · Restricted Project

Dec 15 2019

zukatsinadze updated the diff for D71433: [analyzer] CERT: POS34-C.
  • Removed extra test
Dec 15 2019, 1:24 AM · Restricted Project

Dec 14 2019

zukatsinadze added a comment to D71433: [analyzer] CERT: POS34-C.
In D71433#1784238, @NoQ wrote:

Thanks! This looks like a simple and efficient check. I have one overall suggestion.

Currently the check may warn on non-bugs of the following kind:

void foo() {
  char env[] = "NAME=value";
  putenv(env);
  doStuff();
  putenv("NAME=anothervalue");
}

I.e., it's obviously harmless if the local variable pointer is removed from the environment before it goes out of scope. Can we instead warn when the *last* putenv() on the execution path through the current stack frame is a local variable (that goes out of scope at the end of the stack frame)?

That'd allow the checker to be enabled by default, which will give a lot more users access to it. Otherwise we'll have to treat it as an opt-in check and users will only enable it when they know about it, which is much less usefulness.

Dec 14 2019, 3:21 PM · Restricted Project
zukatsinadze added inline comments to D71433: [analyzer] CERT: POS34-C.
Dec 14 2019, 3:12 PM · Restricted Project
zukatsinadze updated the diff for D71433: [analyzer] CERT: POS34-C.

Addressed most of the inline comments.

Dec 14 2019, 3:03 PM · Restricted Project

Dec 12 2019

zukatsinadze updated the summary of D71433: [analyzer] CERT: POS34-C.
Dec 12 2019, 1:21 PM · Restricted Project
zukatsinadze created D71433: [analyzer] CERT: POS34-C.
Dec 12 2019, 1:21 PM · Restricted Project

Dec 5 2019

zukatsinadze added inline comments to D70823: [clang-tidy] Adding cert-pos34-c check.
Dec 5 2019, 9:57 AM · Restricted Project, Restricted Project

Nov 28 2019

zukatsinadze updated the diff for D70823: [clang-tidy] Adding cert-pos34-c check.

changes after review.

Nov 28 2019, 1:21 PM · Restricted Project, Restricted Project
zukatsinadze added inline comments to D70823: [clang-tidy] Adding cert-pos34-c check.
Nov 28 2019, 1:21 PM · Restricted Project, Restricted Project
zukatsinadze created D70823: [clang-tidy] Adding cert-pos34-c check.
Nov 28 2019, 6:52 AM · Restricted Project, Restricted Project