From 9c2786b872e22d1cee1647be93f5067574355922 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 22 May 2021 18:36:22 +0200 Subject: Userland: Remove SymbolServer and the "symbol" user+group --- Base/etc/SystemServer.ini | 6 -- Base/etc/group | 1 - Base/etc/passwd | 1 - Userland/Services/CMakeLists.txt | 1 - Userland/Services/SymbolServer/CMakeLists.txt | 12 ---- .../Services/SymbolServer/ClientConnection.cpp | 82 ---------------------- Userland/Services/SymbolServer/ClientConnection.h | 31 -------- Userland/Services/SymbolServer/Forward.h | 13 ---- Userland/Services/SymbolServer/SymbolClient.ipc | 4 -- Userland/Services/SymbolServer/SymbolServer.ipc | 6 -- Userland/Services/SymbolServer/main.cpp | 59 ---------------- 11 files changed, 216 deletions(-) delete mode 100644 Userland/Services/SymbolServer/CMakeLists.txt delete mode 100644 Userland/Services/SymbolServer/ClientConnection.cpp delete mode 100644 Userland/Services/SymbolServer/ClientConnection.h delete mode 100644 Userland/Services/SymbolServer/Forward.h delete mode 100644 Userland/Services/SymbolServer/SymbolClient.ipc delete mode 100644 Userland/Services/SymbolServer/SymbolServer.ipc delete mode 100644 Userland/Services/SymbolServer/main.cpp diff --git a/Base/etc/SystemServer.ini b/Base/etc/SystemServer.ini index 157bedda11..bae775f3fc 100644 --- a/Base/etc/SystemServer.ini +++ b/Base/etc/SystemServer.ini @@ -26,12 +26,6 @@ BootModes=graphical MultiInstance=1 AcceptSocketConnections=1 -[SymbolServer] -Socket=/tmp/portal/symbol -SocketPermissions=660 -User=symbol -Lazy=1 - [WebSocket] Socket=/tmp/portal/websocket SocketPermissions=660 diff --git a/Base/etc/group b/Base/etc/group index 7e204cdeac..d3a423bfbb 100644 --- a/Base/etc/group +++ b/Base/etc/group @@ -8,5 +8,4 @@ lookup:x:10:anon notify:x:12:anon window:x:13:anon,notify clipboard:x:14:anon,notify -symbol:x:17:anon users:x:100:anon diff --git a/Base/etc/passwd b/Base/etc/passwd index d09142dfa4..6033717d22 100644 --- a/Base/etc/passwd +++ b/Base/etc/passwd @@ -3,7 +3,6 @@ lookup:!:10:10:LookupServer,,,:/:/bin/false notify:!:12:12:NotificationServer,,,:/:/bin/false window:!:13:13:WindowServer,,,:/:/bin/false clipboard:!:14:14:Clipboard,,,:/:/bin/false -symbol:!:17:17:SymbolServer,,,:/:/bin/false sshd:!:19:19:OpenSSH privsep,,,:/:/bin/false anon:!:100:100:Anonymous,,,:/home/anon:/bin/sh nona:!:200:200:Nona,,,:/home/nona:/bin/sh diff --git a/Userland/Services/CMakeLists.txt b/Userland/Services/CMakeLists.txt index c126e2d09c..3feb4fe174 100644 --- a/Userland/Services/CMakeLists.txt +++ b/Userland/Services/CMakeLists.txt @@ -12,7 +12,6 @@ add_subdirectory(LaunchServer) add_subdirectory(LookupServer) add_subdirectory(NotificationServer) add_subdirectory(RequestServer) -add_subdirectory(SymbolServer) add_subdirectory(SystemServer) add_subdirectory(Taskbar) add_subdirectory(TelnetServer) diff --git a/Userland/Services/SymbolServer/CMakeLists.txt b/Userland/Services/SymbolServer/CMakeLists.txt deleted file mode 100644 index 4bf28bbe6e..0000000000 --- a/Userland/Services/SymbolServer/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -compile_ipc(SymbolServer.ipc SymbolServerEndpoint.h) -compile_ipc(SymbolClient.ipc SymbolClientEndpoint.h) - -set(SOURCES - ClientConnection.cpp - main.cpp - SymbolServerEndpoint.h - SymbolClientEndpoint.h -) - -serenity_bin(SymbolServer) -target_link_libraries(SymbolServer LibIPC LibDebug) diff --git a/Userland/Services/SymbolServer/ClientConnection.cpp b/Userland/Services/SymbolServer/ClientConnection.cpp deleted file mode 100644 index cdbf983fbb..0000000000 --- a/Userland/Services/SymbolServer/ClientConnection.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2021, Andreas Kling - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include -#include -#include -#include -#include - -namespace SymbolServer { - -struct CachedELF { - NonnullRefPtr mapped_file; - Debug::DebugInfo debug_info; -}; - -static HashMap> s_cache; -static HashMap> s_connections; - -ClientConnection::ClientConnection(NonnullRefPtr socket, int client_id) - : IPC::ClientConnection(*this, move(socket), client_id) -{ - s_connections.set(client_id, *this); -} - -ClientConnection::~ClientConnection() -{ -} - -void ClientConnection::die() -{ - s_connections.remove(client_id()); -} - -void ClientConnection::greet() -{ -} - -Messages::SymbolServer::SymbolicateResponse ClientConnection::symbolicate(String const& path, u32 address) -{ - if (!s_cache.contains(path)) { - auto mapped_file = MappedFile::map(path); - if (mapped_file.is_error()) { - dbgln("Failed to map {}: {}", path, mapped_file.error().string()); - s_cache.set(path, {}); - return { false, String {}, 0, String {}, 0 }; - } - auto elf = make(mapped_file.value()->bytes()); - if (!elf->is_valid()) { - dbgln("ELF not valid: {}", path); - s_cache.set(path, {}); - return { false, String {}, 0, String {}, 0 }; - } - Debug::DebugInfo debug_info(move(elf)); - auto cached_elf = make(mapped_file.release_value(), move(debug_info)); - s_cache.set(path, move(cached_elf)); - } - - auto it = s_cache.find(path); - VERIFY(it != s_cache.end()); - auto& cached_elf = it->value; - - if (!cached_elf) - return { false, String {}, 0, String {}, 0 }; - - u32 offset = 0; - auto symbol = cached_elf->debug_info.elf().symbolicate(address, &offset); - auto source_position = cached_elf->debug_info.get_source_position(address); - String filename; - u32 line_number = 0; - if (source_position.has_value()) { - filename = source_position.value().file_path; - line_number = source_position.value().line_number; - } - - return { true, symbol, offset, filename, line_number }; -} - -} diff --git a/Userland/Services/SymbolServer/ClientConnection.h b/Userland/Services/SymbolServer/ClientConnection.h deleted file mode 100644 index 7c05231f93..0000000000 --- a/Userland/Services/SymbolServer/ClientConnection.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2020, Andreas Kling - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include -#include -#include -#include - -namespace SymbolServer { - -class ClientConnection final - : public IPC::ClientConnection { - C_OBJECT(ClientConnection); - -public: - explicit ClientConnection(NonnullRefPtr, int client_id); - ~ClientConnection() override; - - virtual void die() override; - -private: - virtual void greet() override; - virtual Messages::SymbolServer::SymbolicateResponse symbolicate(String const&, u32) override; -}; - -} diff --git a/Userland/Services/SymbolServer/Forward.h b/Userland/Services/SymbolServer/Forward.h deleted file mode 100644 index 97cdfba43c..0000000000 --- a/Userland/Services/SymbolServer/Forward.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) 2021, Andreas Kling - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -namespace SymbolServer { - -class ClientConnection; - -} diff --git a/Userland/Services/SymbolServer/SymbolClient.ipc b/Userland/Services/SymbolServer/SymbolClient.ipc deleted file mode 100644 index d5bbbaf2ae..0000000000 --- a/Userland/Services/SymbolServer/SymbolClient.ipc +++ /dev/null @@ -1,4 +0,0 @@ -endpoint SymbolClient -{ - dummy() =| -} diff --git a/Userland/Services/SymbolServer/SymbolServer.ipc b/Userland/Services/SymbolServer/SymbolServer.ipc deleted file mode 100644 index 08fc9c2f7b..0000000000 --- a/Userland/Services/SymbolServer/SymbolServer.ipc +++ /dev/null @@ -1,6 +0,0 @@ -endpoint SymbolServer -{ - greet() => () - - symbolicate(String path, u32 address) => (bool success, String name, u32 offset, String filename, u32 line) -} diff --git a/Userland/Services/SymbolServer/main.cpp b/Userland/Services/SymbolServer/main.cpp deleted file mode 100644 index 5f96a0d066..0000000000 --- a/Userland/Services/SymbolServer/main.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2021, Andreas Kling - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include -#include -#include -#include - -int main(int, char**) -{ - Core::EventLoop event_loop; - auto server = Core::LocalServer::construct(); - - if (pledge("stdio rpath accept", nullptr) < 0) { - perror("pledge"); - return 1; - } - - if (unveil("/bin", "r") < 0) { - perror("unveil"); - return 1; - } - - if (unveil("/usr/lib", "r") < 0) { - perror("unveil"); - return 1; - } - - // NOTE: Developers can opt into kernel symbolication by making /boot/Kernel accessible to the "symbol" user. - if (access("/boot/Kernel", F_OK) == 0) { - if (unveil("/boot/Kernel", "r") < 0) { - perror("unveil"); - return 1; - } - } - - if (unveil(nullptr, nullptr) < 0) { - perror("unveil"); - return 1; - } - - bool ok = server->take_over_from_system_server(); - VERIFY(ok); - server->on_ready_to_accept = [&] { - auto client_socket = server->accept(); - if (!client_socket) { - dbgln("LaunchServer: accept failed."); - return; - } - static int s_next_client_id = 0; - int client_id = ++s_next_client_id; - IPC::new_client_connection(client_socket.release_nonnull(), client_id); - }; - - return event_loop.exec(); -} -- cgit v1.2.3