From 31078711d6c3639073db97322c6f7d98dacbbefe Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Tue, 20 Jul 2021 19:24:47 +0900 Subject: ipa: Use FileDescriptor instead of int in layers above IPC payload Regarding (de)serialization in isolated IPA calls, we have four layers: - struct - byte vector + fd vector - IPCMessage - IPC payload The proxy handles the upper three layers (with help from the IPADataSerializer), and passes an IPCMessage to the IPC mechanism (implemented as an IPCPipe), which sends an IPC payload to its worker counterpart. When a FileDescriptor is involved, previously it was only a FileDescriptor in the first layer; in the lower three it was an int. To reduce the risk of potential fd leaks in the future, keep the FileDescriptor as-is throughout the upper three layers. Only the IPC mechanism will deal with ints, if it so wishes, when it does the actual IPC. IPCPipeUnixSocket does deal with ints for sending fds, so the conversion between IPCMessage and IPCUnixSocket::Payload converts between FileDescriptor and int. Additionally, change the data portion of the serialized form of FileDescriptor to a 32-bit unsigned integer, for alightnment purposes and in preparation for conversion to an index into the fd array. Also update the deserializer of FrameBuffer::Plane accordingly. Signed-off-by: Paul Elder Tested-by: Umang Jain Reviewed-by: Laurent Pinchart Reviewed-by: Umang Jain --- utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl') diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl index a4e008c7..aab1fffb 100644 --- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl +++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl @@ -236,7 +236,7 @@ void {{proxy_name}}::recvMessage(const IPCMessage &data) void {{proxy_name}}::{{method.mojom_name}}IPC( std::vector::const_iterator data, size_t dataSize, - [[maybe_unused]] const std::vector &fds) + [[maybe_unused]] const std::vector &fds) { {%- for param in method.parameters %} {{param|name}} {{param.mojom_name}}; -- cgit v1.2.1