Add better logs around IPC 81/301481/2
authorTomasz Swierczek <t.swierczek@samsung.com>
Thu, 16 Nov 2023 10:30:00 +0000 (11:30 +0100)
committerTomasz Swierczek <t.swierczek@samsung.com>
Thu, 16 Nov 2023 10:47:06 +0000 (11:47 +0100)
Needed by VD division to debug socket clogging problem in the kernel.

Change-Id: Ic1764b8e9342f93911dcf26f6c03fca028a7f72f

src/common/connection.cpp
src/server/main/socket-manager.cpp
src/server/service/service.cpp

index b133707..73fdfa2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2022 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2014-2023 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * This file is licensed under the terms of MIT License or the Apache License
  * Version 2.0 of your choice. See the LICENSE.MIT file for MIT license details.
@@ -181,6 +181,7 @@ int sendToServer(char const * const interface, MessageBuffer &buffer) {
             LogError("Error in poll(POLLOUT)");
             return SECURITY_MANAGER_ERROR_SOCKET;
         }
+        LogWarning("Attempting to send data from client");
         const auto temp = TEMP_FAILURE_RETRY(::send(sock.Get(), buffer.Ptr(), buffer.OutputSize(), MSG_NOSIGNAL));
         if (temp < 0) {
             LogErrno("write");
@@ -197,6 +198,7 @@ int sendToServer(char const * const interface, MessageBuffer &buffer) {
             LogError("Error in poll(POLLIN)");
             return SECURITY_MANAGER_ERROR_SOCKET;
         }
+        LogWarning("Attempting to receive data from server");
         const auto temp = TEMP_FAILURE_RETRY(::recv(sock.Get(), buffer.Ptr(), buffer.InputSize(), 0));
         if (temp <= 0) {
             if (!temp)
index e61406c..8fe7ed1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2022 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2013-2023 Samsung Electronics Co., Ltd. All rights reserved
  *
  * This file is licensed under the terms of MIT License or the Apache License
  * Version 2.0 of your choice. See the LICENSE.MIT file for MIT license details.
@@ -162,6 +162,7 @@ void SocketManager::ReadyForRead(int sock) {
     desc.isActiveThisGeneration = true;
     auto &buffer = desc.buffer;
 
+    LogWarning("Attempting to read data on server side");
     ssize_t size = read(sock, buffer.Ptr(), buffer.InputSize());
 
     if (size == 0) {
index 17ebf94..c12dd6a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2022 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2014-2023 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * This file is licensed under the terms of MIT License or the Apache License
  * Version 2.0 of your choice. See the LICENSE.MIT file for MIT license details.
@@ -58,6 +58,7 @@ void Service::processEvent(Event &&msg)
         int call_type_int;
         Deserialization::Deserialize(msg.buffer, call_type_int);
         SecurityModuleCall call_type = static_cast<SecurityModuleCall>(call_type_int);
+        LogWarning("Processing event from client - smack label: " << msg.creds.label << ", pid: " << msg.creds.pid);
         LOG_EXECUTION_TIME(SecurityModuleCallToString(call_type), msg.creds);
         switch (call_type) {
             case SecurityModuleCall::NOOP:
@@ -164,7 +165,7 @@ void Service::processEvent(Event &&msg)
                 Throw(ServiceException::InvalidAction);
         }
         // if we reach this point, the protocol is OK
-        LogDebug("Writing response to client.");
+        LogWarning("Event completed, prepared response to client");
         return m_serviceManager->Write(msg.connectionID, std::move(msg.buffer));
     } Catch(MessageBuffer::Exception::Base) {
         LogError("Broken protocol.");