1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de)
4 * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
9 #include <asm/unistd.h>
11 #include <as-layout.h>
12 #include <ptrace_user.h>
13 #include <stub-data.h>
14 #include <sysdep/stub.h>
17 * This is in a separate file because it needs to be compiled with any
18 * extraneous gcc flags (-pg, -fprofile-arcs, -ftest-coverage) disabled
20 * Use UM_KERN_PAGE_SIZE instead of PAGE_SIZE because that calls getpagesize
24 void __section(".__syscall_stub")
25 stub_clone_handler(void)
27 struct stub_data *data = (struct stub_data *) STUB_DATA;
30 err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD,
31 STUB_DATA + UM_KERN_PAGE_SIZE / 2 - sizeof(void *));
35 err = stub_syscall4(__NR_ptrace, PTRACE_TRACEME, 0, 0, 0);
39 remap_stack(data->fd, data->offset);
44 * save current result.
46 * child: retcode of mmap already saved and it jumps around this