libbinder: abort on Parcel::appendFrom in no-kernel mode
Abort with LOG_ALWAYS_FATAL if Parcel::appendFrom is called
on a kernel Parcel in a no-kernel build.
Bug: 224644083
Test: build on Trusty
Change-Id: I8a63b23fbd465de8d0e89597622692f7266ed0bf
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 3dccf20..537527e 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -503,8 +503,8 @@
err = NO_ERROR;
-#ifdef BINDER_WITH_KERNEL_IPC
if (auto* kernelFields = maybeKernelFields()) {
+#ifdef BINDER_WITH_KERNEL_IPC
auto* otherKernelFields = parcel->maybeKernelFields();
LOG_ALWAYS_FATAL_IF(otherKernelFields == nullptr);
@@ -564,6 +564,10 @@
}
}
}
+#else
+ LOG_ALWAYS_FATAL("Binder kernel driver disabled at build time");
+ return INVALID_OPERATION;
+#endif // BINDER_WITH_KERNEL_IPC
} else {
auto* rpcFields = maybeRpcFields();
LOG_ALWAYS_FATAL_IF(rpcFields == nullptr);
@@ -622,7 +626,6 @@
}
}
}
-#endif // BINDER_WITH_KERNEL_IPC
return err;
}