mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:17:35 +00:00
Userland: Remove SymbolServer and the "symbol" user+group
This commit is contained in:
parent
252cb54310
commit
9c2786b872
11 changed files with 0 additions and 216 deletions
|
@ -26,12 +26,6 @@ BootModes=graphical
|
||||||
MultiInstance=1
|
MultiInstance=1
|
||||||
AcceptSocketConnections=1
|
AcceptSocketConnections=1
|
||||||
|
|
||||||
[SymbolServer]
|
|
||||||
Socket=/tmp/portal/symbol
|
|
||||||
SocketPermissions=660
|
|
||||||
User=symbol
|
|
||||||
Lazy=1
|
|
||||||
|
|
||||||
[WebSocket]
|
[WebSocket]
|
||||||
Socket=/tmp/portal/websocket
|
Socket=/tmp/portal/websocket
|
||||||
SocketPermissions=660
|
SocketPermissions=660
|
||||||
|
|
|
@ -8,5 +8,4 @@ lookup:x:10:anon
|
||||||
notify:x:12:anon
|
notify:x:12:anon
|
||||||
window:x:13:anon,notify
|
window:x:13:anon,notify
|
||||||
clipboard:x:14:anon,notify
|
clipboard:x:14:anon,notify
|
||||||
symbol:x:17:anon
|
|
||||||
users:x:100:anon
|
users:x:100:anon
|
||||||
|
|
|
@ -3,7 +3,6 @@ lookup:!:10:10:LookupServer,,,:/:/bin/false
|
||||||
notify:!:12:12:NotificationServer,,,:/:/bin/false
|
notify:!:12:12:NotificationServer,,,:/:/bin/false
|
||||||
window:!:13:13:WindowServer,,,:/:/bin/false
|
window:!:13:13:WindowServer,,,:/:/bin/false
|
||||||
clipboard:!:14:14:Clipboard,,,:/:/bin/false
|
clipboard:!:14:14:Clipboard,,,:/:/bin/false
|
||||||
symbol:!:17:17:SymbolServer,,,:/:/bin/false
|
|
||||||
sshd:!:19:19:OpenSSH privsep,,,:/:/bin/false
|
sshd:!:19:19:OpenSSH privsep,,,:/:/bin/false
|
||||||
anon:!:100:100:Anonymous,,,:/home/anon:/bin/sh
|
anon:!:100:100:Anonymous,,,:/home/anon:/bin/sh
|
||||||
nona:!:200:200:Nona,,,:/home/nona:/bin/sh
|
nona:!:200:200:Nona,,,:/home/nona:/bin/sh
|
||||||
|
|
|
@ -12,7 +12,6 @@ add_subdirectory(LaunchServer)
|
||||||
add_subdirectory(LookupServer)
|
add_subdirectory(LookupServer)
|
||||||
add_subdirectory(NotificationServer)
|
add_subdirectory(NotificationServer)
|
||||||
add_subdirectory(RequestServer)
|
add_subdirectory(RequestServer)
|
||||||
add_subdirectory(SymbolServer)
|
|
||||||
add_subdirectory(SystemServer)
|
add_subdirectory(SystemServer)
|
||||||
add_subdirectory(Taskbar)
|
add_subdirectory(Taskbar)
|
||||||
add_subdirectory(TelnetServer)
|
add_subdirectory(TelnetServer)
|
||||||
|
|
|
@ -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)
|
|
|
@ -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 };
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace SymbolServer {
|
|
||||||
|
|
||||||
class ClientConnection;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
endpoint SymbolClient
|
|
||||||
{
|
|
||||||
dummy() =|
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
endpoint SymbolServer
|
|
||||||
{
|
|
||||||
greet() => ()
|
|
||||||
|
|
||||||
symbolicate(String path, u32 address) => (bool success, String name, u32 offset, String filename, u32 line)
|
|
||||||
}
|
|
|
@ -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();
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue