-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zpoline nommu #1
Draft
thehajime
wants to merge
14
commits into
uml-next
Choose a base branch
from
zpoline-nommu-v6.10
base: uml-next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
thehajime
commented
Sep 12, 2024
thehajime
force-pushed
the
zpoline-nommu-v6.10
branch
19 times, most recently
from
September 17, 2024 10:28
9b86626
to
a754e79
Compare
thehajime
commented
Sep 17, 2024
thehajime
force-pushed
the
zpoline-nommu-v6.10
branch
from
September 18, 2024 02:14
a754e79
to
109311b
Compare
thehajime
commented
Sep 18, 2024
thehajime
force-pushed
the
zpoline-nommu-v6.10
branch
2 times, most recently
from
September 18, 2024 06:18
90042db
to
3496039
Compare
thehajime
force-pushed
the
zpoline-nommu-v6.10
branch
2 times, most recently
from
September 19, 2024 05:17
3e8124f
to
ddc2ef9
Compare
for the record: lmbench (usec)
do_getpid bench (nsec)
|
thehajime
force-pushed
the
zpoline-nommu-v6.10
branch
from
September 21, 2024 08:23
d53d51a
to
3e28856
Compare
thehajime
force-pushed
the
zpoline-nommu-v6.10
branch
from
November 12, 2024 10:23
c3f155e
to
e0d035e
Compare
thehajime
force-pushed
the
zpoline-nommu-v6.10
branch
from
November 12, 2024 23:41
e0d035e
to
9165e19
Compare
FDPIC ELF loader adds an architecture hook at the end of loading binaries to finalize the mapped memory before moving toward exec function. The hook is used by UML under !MMU when translating syscall/sysenter instructions before calling execve. Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Christian Brauner <brauner@kernel.org> Cc: Jan Kara <jack@suse.cz> Cc: Eric Biederman <ebiederm@xmission.com> Cc: Kees Cook <kees@kernel.org> Cc: linux-fsdevel@vger.kernel.org Cc: linux-mm@kvack.org Signed-off-by: Hajime Tazaki <thehajime@gmail.com>
As UML supports CONFIG_MMU=n case, it has to use an alternate ELF loader, FDPIC ELF loader. In this commit, we added necessary definitions in the arch, as UML has not been used so far. It also updates Kconfig file to use BINFMT_ELF_FDPIC under !MMU environment. Cc: Eric Biederman <ebiederm@xmission.com> Cc: Kees Cook <kees@kernel.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Christian Brauner <brauner@kernel.org> Cc: Jan Kara <jack@suse.cz> Cc: linux-mm@kvack.org Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Hajime Tazaki <thehajime@gmail.com> Signed-off-by: Ricardo Koller <ricarkol@google.com>
This commit adds memory operations on UML under !MMU environment. Some part of the original UML code relying on CONFIG_MMU are excluded from compilation when !CONFIG_MMU. Additionally, generic functions such as uaccess, futex, memcpy/strnlen/strncpy can be used as user- and kernel-space share the address space in !CONFIG_MMU mode. Signed-off-by: Hajime Tazaki <thehajime@gmail.com> Signed-off-by: Ricardo Koller <ricarkol@google.com>
This commit introduces an entry point of syscall interface for !MMU mode. It uses an entry function, __kernel_vsyscall, a kernel-wide global symbol accessible from any locations. Although it isn't in the scope of this commit, it can be also exposed via vdso image which is directly accessible from userspace. A standard library (i.e., libc) can utilize this entry point to implement syscall wrapper; we can also use this by hooking syscall for unmodified userspace applications/libraries, which will be implemented in the subsequent commit. This only supports 64-bit mode of x86 architecture. Signed-off-by: Hajime Tazaki <thehajime@gmail.com> Signed-off-by: Ricardo Koller <ricarkol@google.com>
This commit adds a mechanism to hook syscalls for unmodified userspace programs used under UML in !MMU mode. The mechanism, called zpoline, translates syscall/sysenter instructions with `call *%rax`, which can be processed by a trampoline code also installed upon an initcall during boot. The translation is triggered by elf_arch_finalize_exec(), an arch hook introduced by another commit. All syscalls issued by userspace thus redirected to a specific function, __kernel_vsyscall, introduced as a syscall entry point for !MMU UML. This totally changes the code path to hook syscall with ptrace(2) used by MMU-full UML. Signed-off-by: Hajime Tazaki <thehajime@gmail.com>
As syscall translation done by zpoline assumes that there are no direct syscalls issued by userspace code, but there would be possibly issued by 1) dlopen-ed code containing syscall instructions, or 2) JIT-generated code. This commit add a seccomp filter to prevent such syscalls from userspace code. Signed-off-by: Hajime Tazaki <thehajime@gmail.com>
Since ptrace facility isn't used under !MMU of UML, there is different code path to invoke processes/threads; on an entry to the syscall interface, the stack pointer should be manipulated to handle vfork(2) return address, no external process is used, and need to properly configure some of registers (fs segment register for TLS, etc) on every context switch, etc. Signals aren't delivered in non-ptrace syscall entry/leave so, we also need to handle pending signal by ourselves. Signed-off-by: Hajime Tazaki <thehajime@gmail.com> Signed-off-by: Ricardo Koller <ricarkol@google.com>
As userspace on UML/!MMU also need to configure %fs register when it is running to correctly access thread structure, host syscalls implemented in os-Linux drivers may be puzzled when they are called. Thus it has to configure %fs register via arch_prctl(SET_FS) on every host syscalls. Signed-off-by: Hajime Tazaki <thehajime@gmail.com> Signed-off-by: Ricardo Koller <ricarkol@google.com>
On !MMU mode, the address of vdso is accessible from userspace. This commit implements the entry point by pointing a block of page address. This commit also add memory permission configuration of vdso page to be executable. Signed-off-by: Hajime Tazaki <thehajime@gmail.com> Signed-off-by: Ricardo Koller <ricarkol@google.com>
thehajime
force-pushed
the
zpoline-nommu-v6.10
branch
from
November 13, 2024 00:02
9165e19
to
48be77e
Compare
This commit updates the behavior of signal handling under !MMU environment. 1) the stack preparation for the signal handlers and 2) restoration of stack after rt_sigreturn(2) syscall. Those are needed as the stack usage on vfork(2) syscall is different. It also adds the follow up routine for SIGSEGV as a signal delivery runs in the same stack frame while we have to avoid endless SIGSEGV. Signed-off-by: Hajime Tazaki <thehajime@gmail.com>
This commit tries to display MMU/!MMU mode from the output of uname(2) so that users can distinguish which mode of UML is running right now. Signed-off-by: Hajime Tazaki <thehajime@gmail.com>
This commit adds an initial documentation for !MMU mode of UML. Signed-off-by: Hajime Tazaki <thehajime@gmail.com>
Add nommu kernel for um build. defconfig is also provided. Signed-off-by: Hajime Tazaki <thehajime@gmail.com> Signed-off-by: Ricardo Koller <ricarkol@google.com>
thehajime
force-pushed
the
zpoline-nommu-v6.10
branch
from
November 13, 2024 00:51
48be77e
to
8cb7101
Compare
thehajime
force-pushed
the
zpoline-nommu-v6.10
branch
4 times, most recently
from
November 13, 2024 05:37
31736aa
to
df6df43
Compare
lmbench (usec)
do_getpid bench (nsec)
|
thehajime
force-pushed
the
zpoline-nommu-v6.10
branch
from
November 14, 2024 08:35
df6df43
to
8821308
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.