Commit Graph

4 Commits

Author SHA1 Message Date
Artem Dergachev 5255ee303b [analyzer] MmapWriteExecChecker: Add support for mprotect().
mprotect() allows setting memory access flags similarly to mmap(),
causing similar security issues if these flags are needlessly broad.

Patch by David Carlier!

Differential Revision: https://reviews.llvm.org/D44250


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327098 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-09 01:47:24 +00:00
Artem Dergachev 8066b2f34d [analyzer] Add a checker for mmap()s which are both writable and executable.
This is a security check that warns when both PROT_WRITE and PROT_EXEC are
set during mmap(). If mmap()ed memory is both writable and executable, it makes
it easier for the attacker to execute arbitrary code when contents of this
memory are compromised. Some applications require such mmap()s though, such as
different sorts of JIT.

Re-applied after a revert in r324167.

Temporarily stays in the alpha package because it needs a better way of
determining macro values that are not immediately available in the AST.

Patch by David Carlier!

Differential Revision: https://reviews.llvm.org/D42645


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326405 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-01 01:27:46 +00:00
Artem Dergachev 0f87312e2f Revert r324166 "[analyzer] Add a checker for mmap()...".
Due to Buildbot failures - most likely that's because target triples were not
specified in the tests, even though the checker behaves differently with
different target triples.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324167 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-03 03:57:32 +00:00
Artem Dergachev 726a6da4d1 [analyzer] Add a checker for mmap()s which are both writable and executable.
This is a security check which is disabled by default but will be enabled
whenever the user consciously enables the security package. If mmap()ed memory
is both writable and executable, it makes it easier for the attacker to execute
arbitrary code when contents of this memory are compromised. Some applications
require such mmap()s though, such as different sorts of JIT.

Patch by David Carlier!

Differential Revision: https://reviews.llvm.org/D42645


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324166 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-03 02:33:42 +00:00