Commit ec642468 authored by Alexander Kartashov's avatar Alexander Kartashov Committed by Pavel Emelyanov

parasite-syscall.c: moved the syscall instructions into the file arch/x86/crtools.c.

Signed-off-by: 's avatarAlexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent aa9ea920
...@@ -121,6 +121,7 @@ OBJS += protobuf.o ...@@ -121,6 +121,7 @@ OBJS += protobuf.o
OBJS += tty.o OBJS += tty.o
OBJS += cr-exec.o OBJS += cr-exec.o
OBJS += cpu.o OBJS += cpu.o
OBJS += $(ARCH_DIR)/crtools.o
DEPS := $(patsubst %.o,%.d,$(OBJS)) DEPS := $(patsubst %.o,%.d,$(OBJS))
......
#include "asm/types.h"
#include "compiler.h"
#include "parasite-syscall.h"
/*
* Injected syscall instruction
*/
const char code_syscall[] = {
0x0f, 0x05, /* syscall */
0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc /* int 3, ... */
};
const int code_syscall_size = round_up(sizeof(code_syscall), sizeof(long));
static inline void __check_code_syscall(void)
{
BUILD_BUG_ON(sizeof(code_syscall) != BUILTIN_SYSCALL_SIZE);
BUILD_BUG_ON(!is_log2(sizeof(code_syscall)));
}
#ifndef __CR_ASM_PARASITE_SYSCALL_H__
#define __CR_ASM_PARASITE_SYSCALL_H__
extern const char code_syscall[];
extern const int code_syscall_size;
#endif
...@@ -23,10 +23,8 @@ ...@@ -23,10 +23,8 @@
#include <stdlib.h> #include <stdlib.h>
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
static const char code_syscall[] = {0x0f, 0x05, 0xcc, 0xcc, #include "asm/parasite-syscall.h"
0xcc, 0xcc, 0xcc, 0xcc};
#define code_syscall_size (round_up(sizeof(code_syscall), sizeof(long)))
#define parasite_size (round_up(sizeof(parasite_blob), sizeof(long))) #define parasite_size (round_up(sizeof(parasite_blob), sizeof(long)))
static int can_run_syscall(unsigned long ip, unsigned long start, unsigned long end) static int can_run_syscall(unsigned long ip, unsigned long start, unsigned long end)
...@@ -797,9 +795,6 @@ struct parasite_ctl *parasite_prep_ctl(pid_t pid, struct list_head *vma_area_lis ...@@ -797,9 +795,6 @@ struct parasite_ctl *parasite_prep_ctl(pid_t pid, struct list_head *vma_area_lis
* Inject syscall instruction and remember original code, * Inject syscall instruction and remember original code,
* we will need it to restore original program content. * we will need it to restore original program content.
*/ */
BUILD_BUG_ON(sizeof(code_syscall) != sizeof(ctl->code_orig));
BUILD_BUG_ON(!is_log2(sizeof(code_syscall)));
memcpy(ctl->code_orig, code_syscall, sizeof(ctl->code_orig)); memcpy(ctl->code_orig, code_syscall, sizeof(ctl->code_orig));
if (ptrace_swap_area(ctl->pid, (void *)ctl->syscall_ip, if (ptrace_swap_area(ctl->pid, (void *)ctl->syscall_ip,
(void *)ctl->code_orig, sizeof(ctl->code_orig))) { (void *)ctl->code_orig, sizeof(ctl->code_orig))) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment