diff options
author | Andreas Kling <kling@serenityos.org> | 2021-05-22 18:36:22 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-22 18:54:22 +0200 |
commit | 9c2786b872e22d1cee1647be93f5067574355922 (patch) | |
tree | c405e9dd717c23287a71f20fbc7bb41e9c0dc3ce | |
parent | 252cb54310763170223f41402212795c19d71f5d (diff) | |
download | serenity-9c2786b872e22d1cee1647be93f5067574355922.zip |
Userland: Remove SymbolServer and the "symbol" user+group
-rw-r--r-- | Base/etc/SystemServer.ini | 6 | ||||
-rw-r--r-- | Base/etc/group | 1 | ||||
-rw-r--r-- | Base/etc/passwd | 1 | ||||
-rw-r--r-- | Userland/Services/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Userland/Services/SymbolServer/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Userland/Services/SymbolServer/ClientConnection.cpp | 82 | ||||
-rw-r--r-- | Userland/Services/SymbolServer/ClientConnection.h | 31 | ||||
-rw-r--r-- | Userland/Services/SymbolServer/Forward.h | 13 | ||||
-rw-r--r-- | Userland/Services/SymbolServer/SymbolClient.ipc | 4 | ||||
-rw-r--r-- | Userland/Services/SymbolServer/SymbolServer.ipc | 6 | ||||
-rw-r--r-- | Userland/Services/SymbolServer/main.cpp | 59 |
11 files changed, 0 insertions, 216 deletions
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 <kling@serenityos.org> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include <AK/MappedFile.h> -#include <LibDebug/DebugInfo.h> -#include <LibELF/Image.h> -#include <SymbolServer/ClientConnection.h> -#include <SymbolServer/SymbolClientEndpoint.h> - -namespace SymbolServer { - -struct CachedELF { - NonnullRefPtr<MappedFile> mapped_file; - Debug::DebugInfo debug_info; -}; - -static HashMap<String, OwnPtr<CachedELF>> s_cache; -static HashMap<int, RefPtr<ClientConnection>> s_connections; - -ClientConnection::ClientConnection(NonnullRefPtr<Core::LocalSocket> socket, int client_id) - : IPC::ClientConnection<SymbolClientEndpoint, SymbolServerEndpoint>(*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<ELF::Image>(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<CachedELF>(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 <kling@serenityos.org> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include <LibIPC/ClientConnection.h> -#include <SymbolServer/Forward.h> -#include <SymbolServer/SymbolClientEndpoint.h> -#include <SymbolServer/SymbolServerEndpoint.h> - -namespace SymbolServer { - -class ClientConnection final - : public IPC::ClientConnection<SymbolClientEndpoint, SymbolServerEndpoint> { - C_OBJECT(ClientConnection); - -public: - explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, 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 <kling@serenityos.org> - * - * 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 <kling@serenityos.org> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include <LibCore/EventLoop.h> -#include <LibCore/LocalServer.h> -#include <LibIPC/ClientConnection.h> -#include <SymbolServer/ClientConnection.h> - -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<SymbolServer::ClientConnection>(client_socket.release_nonnull(), client_id); - }; - - return event_loop.exec(); -} |