[PATCH] D42645: New simple Checker for mmap calls

Aleksei Sidorin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 5 09:40:56 PST 2018


a.sidorin added a comment.

Hi David! The patch looks almost OK.



================
Comment at: lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp:65
+          *BT, "Both PROT_WRITE and PROT_EXEC flags are set. This can "
+               "lead to exploitable memory regions, which could be overwritten with malicious code"
+         , N);
----------------
This line violates 80-char limit. Next line starts with comma which is not good.


================
Comment at: test/Analysis/mmap-writeexec.c:1
+// RUN: %clang_analyze_cc1 -triple i686-unknown-freebsd -analyzer-checker=security.MmapWriteExec -verify %s
+// RUN: %clang_analyze_cc1 -triple x86_64-unknown-apple-darwin10 -analyzer-checker=security.MmapWriteExec -verify %s
----------------
Do you try to test  `if (Triple.isOSGlibc())` branch here? If so, `i686-unknown-freebsd` doesn't look like an appropriate target (it is not kFreeBSD). You can use `-triple=x86_64-pc-kfreebsd-gnu` or just `i686-unknown-linux`.


Repository:
  rC Clang

https://reviews.llvm.org/D42645





More information about the cfe-commits mailing list