Loading trusty/fuzz/Android.bp +2 −3 Original line number Diff line number Diff line Loading @@ -14,10 +14,8 @@ cc_defaults { name: "trusty_fuzzer_defaults", static_libs: [ "libtrusty_fuzz_utils", ], shared_libs: [ "libtrusty_fuzz_utils", "libbase", "liblog", ], Loading @@ -36,6 +34,7 @@ cc_library { srcs: ["utils.cpp"], export_include_dirs: ["include"], shared_libs: [ "libtrusty_test", "libbase", "liblog", ], Loading trusty/fuzz/utils.cpp +2 −17 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <linux/uio.h> #include <log/log_read.h> #include <time.h> #include <trusty/tipc.h> #include <iostream> using android::base::ErrnoError; Loading @@ -32,9 +33,6 @@ using android::base::Error; using android::base::Result; using android::base::unique_fd; #define TIPC_IOC_MAGIC 'r' #define TIPC_IOC_CONNECT _IOW(TIPC_IOC_MAGIC, 0x80, char*) namespace { const size_t kTimeoutSeconds = 5; Loading Loading @@ -80,27 +78,14 @@ TrustyApp::TrustyApp(std::string tipc_dev, std::string ta_port) : tipc_dev_(tipc_dev), ta_port_(ta_port), ta_fd_(-1) {} Result<void> TrustyApp::Connect() { /* * TODO: We can't use libtrusty because (yet) * (1) cc_fuzz can't deal with vendor components (b/170753563) * (2) We need non-blocking behavior to detect Trusty going down. * (we could implement the timeout in the fuzzing code though, as * it needs to be around the call to read()) */ alarm(kTimeoutSeconds); int fd = open(tipc_dev_.c_str(), O_RDWR); int fd = tipc_connect(tipc_dev_.c_str(), ta_port_.c_str()); alarm(0); if (fd < 0) { return ErrnoError() << "failed to open TIPC device: "; } ta_fd_.reset(fd); // This ioctl will time out in the kernel if it can't connect. int rc = TEMP_FAILURE_RETRY(ioctl(ta_fd_, TIPC_IOC_CONNECT, ta_port_.c_str())); if (rc < 0) { return ErrnoError() << "failed to connect to TIPC service: "; } return {}; } Loading trusty/libtrusty/Android.bp +15 −4 Original line number Diff line number Diff line Loading @@ -12,10 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. cc_library { name: "libtrusty", vendor: true, cc_defaults { name: "libtrusty_defaults", srcs: ["trusty.c"], export_include_dirs: ["include"], cflags: [ Loading @@ -25,3 +23,16 @@ cc_library { shared_libs: ["liblog"], } cc_library { name: "libtrusty", vendor: true, defaults: ["libtrusty_defaults"], } // TODO(b/170753563): cc_fuzz can't deal with vendor components. Build libtrusty // for system. cc_test_library { name: "libtrusty_test", defaults: ["libtrusty_defaults"], } Loading
trusty/fuzz/Android.bp +2 −3 Original line number Diff line number Diff line Loading @@ -14,10 +14,8 @@ cc_defaults { name: "trusty_fuzzer_defaults", static_libs: [ "libtrusty_fuzz_utils", ], shared_libs: [ "libtrusty_fuzz_utils", "libbase", "liblog", ], Loading @@ -36,6 +34,7 @@ cc_library { srcs: ["utils.cpp"], export_include_dirs: ["include"], shared_libs: [ "libtrusty_test", "libbase", "liblog", ], Loading
trusty/fuzz/utils.cpp +2 −17 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <linux/uio.h> #include <log/log_read.h> #include <time.h> #include <trusty/tipc.h> #include <iostream> using android::base::ErrnoError; Loading @@ -32,9 +33,6 @@ using android::base::Error; using android::base::Result; using android::base::unique_fd; #define TIPC_IOC_MAGIC 'r' #define TIPC_IOC_CONNECT _IOW(TIPC_IOC_MAGIC, 0x80, char*) namespace { const size_t kTimeoutSeconds = 5; Loading Loading @@ -80,27 +78,14 @@ TrustyApp::TrustyApp(std::string tipc_dev, std::string ta_port) : tipc_dev_(tipc_dev), ta_port_(ta_port), ta_fd_(-1) {} Result<void> TrustyApp::Connect() { /* * TODO: We can't use libtrusty because (yet) * (1) cc_fuzz can't deal with vendor components (b/170753563) * (2) We need non-blocking behavior to detect Trusty going down. * (we could implement the timeout in the fuzzing code though, as * it needs to be around the call to read()) */ alarm(kTimeoutSeconds); int fd = open(tipc_dev_.c_str(), O_RDWR); int fd = tipc_connect(tipc_dev_.c_str(), ta_port_.c_str()); alarm(0); if (fd < 0) { return ErrnoError() << "failed to open TIPC device: "; } ta_fd_.reset(fd); // This ioctl will time out in the kernel if it can't connect. int rc = TEMP_FAILURE_RETRY(ioctl(ta_fd_, TIPC_IOC_CONNECT, ta_port_.c_str())); if (rc < 0) { return ErrnoError() << "failed to connect to TIPC service: "; } return {}; } Loading
trusty/libtrusty/Android.bp +15 −4 Original line number Diff line number Diff line Loading @@ -12,10 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. cc_library { name: "libtrusty", vendor: true, cc_defaults { name: "libtrusty_defaults", srcs: ["trusty.c"], export_include_dirs: ["include"], cflags: [ Loading @@ -25,3 +23,16 @@ cc_library { shared_libs: ["liblog"], } cc_library { name: "libtrusty", vendor: true, defaults: ["libtrusty_defaults"], } // TODO(b/170753563): cc_fuzz can't deal with vendor components. Build libtrusty // for system. cc_test_library { name: "libtrusty_test", defaults: ["libtrusty_defaults"], }