mirror of
https://github.com/clearlinux/graphene.git
synced 2026-09-03 12:21:37 +00:00
Instead of depending on dynamic linking for LibOS entry point (syscalldb), we pass a pointer in the shim_tcb structure, so that the patched code can enter syscall using 'jmp *%gs:<offset>'. The same applies to the vDSO syscall code that previously needed an up-to-date pointer to syscalldb function. Now, there is no need to adjust the values inside the vDSO page. In addition, this change removes the other two instances where we import a symbol directly from LibOS: register_library (can be also done through GS register) and glibc_version (not important because we build Graphene and glibc together). This simplifies things because the dynamic linking necessary to make the syscalldb function available had to be performed by LibOS itself (in many cases, effectively doing a second pass of dynamic linking after ld.so). After this change, there will be no need for LibOS to perform dynamic linking, and the ELF loading code can be simplified. Signed-off-by: Paweł Marczewski <pawel@invisiblethingslab.com>
29 lines
740 B
C
29 lines
740 B
C
/* SPDX-License-Identifier: LGPL-3.0-or-later */
|
|
/* Copyright (C) 2021 Intel Corporation
|
|
* Paweł Marczewski <pawel@invisiblethingslab.com>
|
|
*/
|
|
|
|
/*
|
|
* This file describes Graphene's entrypoints from userspace (mostly from patched glibc).
|
|
*/
|
|
|
|
#ifndef SHIM_ENTRY_H_
|
|
#define SHIM_ENTRY_H_
|
|
|
|
/*!
|
|
* \brief LibOS syscall emulation entrypoint.
|
|
*
|
|
* Actual implementation and ABI are architecture-specific, but generally should dump the CPU
|
|
* context and call `shim_emulate_syscall`.
|
|
*/
|
|
void syscalldb(void);
|
|
|
|
/*!
|
|
* \brief Register a new library after loading by dynamic linker.
|
|
*
|
|
* Used mostly for debugger integration.
|
|
*/
|
|
int register_library(const char* name, unsigned long load_address);
|
|
|
|
#endif /* SHIM_ENTRY_H_ */
|