From 60762093b7530f31aa55cb1e30a82e7da3d15758 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Thu, 27 May 2021 02:08:32 +0000 Subject: binder_rpc_fuzzer: avoid SIGPIPE android::base::WriteFully was causing SIGPIPE to be sent when we hang up connections after the last fuzzer modification. Bug: N/A Test: binder_rpc_fuzzer for a few minutes Change-Id: I3fe20da26805134bb28284860116ca766d823b3f --- libs/binder/tests/rpc_fuzzer/main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libs') diff --git a/libs/binder/tests/rpc_fuzzer/main.cpp b/libs/binder/tests/rpc_fuzzer/main.cpp index 072f8ddd07..9fc496f460 100644 --- a/libs/binder/tests/rpc_fuzzer/main.cpp +++ b/libs/binder/tests/rpc_fuzzer/main.cpp @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include #include #include #include @@ -90,8 +89,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (provider.ConsumeBool()) { std::vector writeData = provider.ConsumeBytes( provider.ConsumeIntegralInRange(0, provider.remaining_bytes())); - CHECK(base::WriteFully(connections.at(idx).get(), writeData.data(), - writeData.size())); + ssize_t size = TEMP_FAILURE_RETRY(send(connections.at(idx).get(), writeData.data(), + writeData.size(), MSG_NOSIGNAL)); + CHECK(errno == EPIPE || size == writeData.size()) + << size << " " << writeData.size() << " " << strerror(errno); } else { connections.erase(connections.begin() + idx); // hang up } -- cgit v1.2.3-59-g8ed1b