[CRIU] [PATCHv2 16/17] x86/crtools: add injected int 0x80 instruction code
Dmitry Safonov
dsafonov at virtuozzo.com
Tue Apr 12 09:10:54 PDT 2016
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
criu/arch/x86/crtools.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/criu/arch/x86/crtools.c b/criu/arch/x86/crtools.c
index ad957cdf4a2d..8fd82ee674b6 100644
--- a/criu/arch/x86/crtools.c
+++ b/criu/arch/x86/crtools.c
@@ -26,17 +26,24 @@
/*
* Injected syscall instruction
*/
-/* FIXME: 32-bit syscalls */
const char code_syscall[] = {
0x0f, 0x05, /* syscall */
0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc /* int 3, ... */
};
+const char code_int_80[] = {
+ 0xcd, 0x80, /* int $0x80 */
+ 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc /* int 3, ... */
+};
+
static const int
code_syscall_aligned = round_up(sizeof(code_syscall), sizeof(long));
+static const int
+code_int_80_aligned = round_up(sizeof(code_syscall), sizeof(long));
static inline __always_unused void __check_code_syscall(void)
{
+ BUILD_BUG_ON(code_int_80_aligned != BUILTIN_SYSCALL_SIZE);
BUILD_BUG_ON(code_syscall_aligned != BUILTIN_SYSCALL_SIZE);
BUILD_BUG_ON(!is_log2(sizeof(code_syscall)));
}
@@ -128,6 +135,8 @@ int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
r->r10 = arg4;
r->r8 = arg5;
r->r9 = arg6;
+
+ err = __parasite_execute_syscall(ctl, ®s, code_syscall);
} else {
user_regs_struct32 *r = ®s.compat;
@@ -138,9 +147,9 @@ int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
r->si = arg4;
r->di = arg5;
r->bp = arg6;
- }
- err = __parasite_execute_syscall(ctl, ®s, code_syscall);
+ err = __parasite_execute_syscall(ctl, ®s, code_int_80);
+ }
*ret = get_user_reg(®s, ax);
return err;
--
2.8.0
More information about the CRIU
mailing list