[PATCH] D36023: [analyzer] Add array support for MagentaHandleChecker
Haowei Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 28 15:14:00 PDT 2017
haowei created this revision.
Herald added a subscriber: xazax.hun.
This commit adds support for syscalls that acquire/release handles in an array for MagentaHandleChecker introduced in https://reviews.llvm.org/D35968 and https://reviews.llvm.org/D36022.
Most magenta handle related syscalls will take a pointer to a local mx_handle_t variable for handle acquisition and take a value of a local mx_handle variable for handle release. A good example would be:
mx_status_t mx_channel_create(uint32_t options,
mx_handle_t* out0, mx_handle_t* out1);
and
mx_status_t mx_handle_close(mx_handle_t handle);
However, there are two exceptions, syscall
mx_status_t mx_channel_read(mx_handle_t handle, uint32_t options,
void* bytes, mx_handle_t* handles,
uint32_t num_bytes, uint32_t num_handles,
uint32_t* actual_bytes, uint32_t* actual_handles);
Will read(acquire) "num_handles" of handles and save them to the array pointed to by "handles". The actual number of acquired handles will be saved to the variable pointed to by "actual_handles".
And syscall
mx_status_t mx_channel_write(mx_handle_t handle, uint32_t options,
void* bytes, uint32_t num_bytes,
mx_handle_t* handles, uint32_t num_handles)
Will release "num_handles" of handles in array "handles".
This patch adds support to handle acquire/release through arrays so these two syscalls can be processed by this checker.
https://reviews.llvm.org/D36023
Files:
lib/StaticAnalyzer/Checkers/MagentaHandleChecker.cpp
test/Analysis/mxhandle.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36023.108719.patch
Type: text/x-patch
Size: 17599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170728/90a6d476/attachment-0001.bin>
More information about the cfe-commits
mailing list