This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Add array support for MagentaHandleChecker
AbandonedPublic

Authored by haowei on Jul 28 2017, 3:13 PM.

Details

Reviewers
NoQ
dcoughlin
Summary

This commit adds support for syscalls that acquire/release handles in an array for MagentaHandleChecker introduced in D35968 and 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.

Diff Detail