[PATCH] D42645: New simple Checker for mmap calls

David CARLIER via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 6 02:33:48 PST 2018


devnexen added a comment.

In https://reviews.llvm.org/D42645#998732, @a.sidorin wrote:

> Hello David,
>
> I have looked into mmap constant definitions in different implementations and found them pretty inconsistent. For example, MMAP_EXEC can be 0x01, 0x04 and I even found 0x00 in some file (https://www.cs.cmu.edu/~dga/crypto/priveth/libethash/mmap.h). Therefore, we should clearly state how do we predict these values. Are you sure that checking `isOSGlibc()` is enough?
>
> Also, could you please explain me how the test works? If I understand correctly, for all platforms we manually define the constants in the test. Then, we check if   `PROT_WRITE | PROT_EXEC` is set. For OSGlibc, PROT_EXEC is defined as 0x01 in the checker. This means that if isOSGlibc branch is covered, we should not get any warnings for one of test launches because `PROT_WRITE | PROT_EXEC` is 0x03 in the checker and is 0x06 in the test file.


Yes maybe in the test glibc constants should be defined as well (I develop mainly on *BSD variants I missed that for the test case you re right).


Repository:
  rC Clang

https://reviews.llvm.org/D42645





More information about the cfe-commits mailing list