Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
fb9b0f50
Commit
fb9b0f50
authored
Apr 08, 2013
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parasite: Use struct pid on parasite_ctl
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
69db54d8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
27 additions
and
24 deletions
+27
-24
crtools.c
arch/arm/crtools.c
+1
-1
crtools.c
arch/x86/crtools.c
+1
-1
cr-dump.c
cr-dump.c
+2
-2
file-lock.c
file-lock.c
+1
-1
files.c
files.c
+3
-3
parasite-syscall.h
include/parasite-syscall.h
+3
-1
mem.c
mem.c
+2
-2
parasite-syscall.c
parasite-syscall.c
+14
-13
No files found.
arch/arm/crtools.c
View file @
fb9b0f50
...
...
@@ -74,7 +74,7 @@ int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
regs
.
ARM_r5
=
arg6
;
parasite_setup_regs
(
ctl
->
syscall_ip
,
&
regs
);
err
=
__parasite_execute
(
ctl
,
ctl
->
pid
,
&
regs
);
err
=
__parasite_execute
(
ctl
,
ctl
->
pid
.
real
,
&
regs
);
if
(
err
)
return
err
;
...
...
arch/x86/crtools.c
View file @
fb9b0f50
...
...
@@ -98,7 +98,7 @@ int syscall_seized(struct parasite_ctl *ctl, int nr, unsigned long *ret,
regs
.
r9
=
arg6
;
parasite_setup_regs
(
ctl
->
syscall_ip
,
&
regs
);
err
=
__parasite_execute
(
ctl
,
ctl
->
pid
,
&
regs
);
err
=
__parasite_execute
(
ctl
,
ctl
->
pid
.
real
,
&
regs
);
if
(
err
)
return
err
;
...
...
cr-dump.c
View file @
fb9b0f50
...
...
@@ -393,10 +393,10 @@ static int dump_task_creds(struct parasite_ctl *ctl, const struct cr_fdset *fds)
CredsEntry
ce
=
CREDS_ENTRY__INIT
;
pr_info
(
"
\n
"
);
pr_info
(
"Dumping creds for %d)
\n
"
,
ctl
->
pid
);
pr_info
(
"Dumping creds for %d)
\n
"
,
ctl
->
pid
.
real
);
pr_info
(
"----------------------------------------
\n
"
);
ret
=
parse_pid_status
(
ctl
->
pid
,
&
cr
);
ret
=
parse_pid_status
(
ctl
->
pid
.
real
,
&
cr
);
if
(
ret
<
0
)
return
ret
;
...
...
file-lock.c
View file @
fb9b0f50
...
...
@@ -117,7 +117,7 @@ int dump_task_file_locks(struct parasite_ctl *ctl,
FileLockEntry
fle
;
struct
file_lock
*
fl
;
pid_t
pid
=
ctl
->
pid
;
pid_t
pid
=
ctl
->
pid
.
real
;
int
ret
=
0
;
list_for_each_entry
(
fl
,
&
file_lock_list
,
list
)
{
...
...
files.c
View file @
fb9b0f50
...
...
@@ -154,13 +154,13 @@ static int fill_fd_params(struct parasite_ctl *ctl, int fd, int lfd,
return
-
1
;
}
p
->
flags
=
ret
;
p
->
pid
=
ctl
->
pid
;
p
->
pid
=
ctl
->
pid
.
real
;
p
->
fd_flags
=
opts
->
flags
;
fown_entry__init
(
&
p
->
fown
);
pr_info
(
"%d fdinfo %d: pos: 0x%16lx flags: %16o/%#x
\n
"
,
ctl
->
pid
,
fd
,
p
->
pos
,
p
->
flags
,
(
int
)
p
->
fd_flags
);
ctl
->
pid
.
real
,
fd
,
p
->
pos
,
p
->
flags
,
(
int
)
p
->
fd_flags
);
ret
=
fcntl
(
lfd
,
F_GETSIG
,
0
);
if
(
ret
<
0
)
{
...
...
@@ -265,7 +265,7 @@ int dump_task_files_seized(struct parasite_ctl *ctl, struct pstree_item *item,
int
i
,
ret
=
-
1
;
pr_info
(
"
\n
"
);
pr_info
(
"Dumping opened files (pid: %d)
\n
"
,
ctl
->
pid
);
pr_info
(
"Dumping opened files (pid: %d)
\n
"
,
ctl
->
pid
.
real
);
pr_info
(
"----------------------------------------
\n
"
);
lfds
=
xmalloc
(
dfds
->
nr_fds
*
sizeof
(
int
));
...
...
include/parasite-syscall.h
View file @
fb9b0f50
...
...
@@ -3,9 +3,11 @@
#define BUILTIN_SYSCALL_SIZE 8
#include "pstree.h"
/* parasite control block */
struct
parasite_ctl
{
pid_t
pid
;
/* process pid where we live in */
struct
pid
pid
;
void
*
remote_map
;
void
*
local_map
;
unsigned
long
map_length
;
...
...
mem.c
View file @
fb9b0f50
...
...
@@ -111,7 +111,7 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl, int vpid,
struct
page_xfer
xfer
;
pr_info
(
"
\n
"
);
pr_info
(
"Dumping pages (type: %d pid: %d)
\n
"
,
CR_FD_PAGES
,
ctl
->
pid
);
pr_info
(
"Dumping pages (type: %d pid: %d)
\n
"
,
CR_FD_PAGES
,
ctl
->
pid
.
real
);
pr_info
(
"----------------------------------------
\n
"
);
pr_debug
(
" Private vmas %lu/%lu pages
\n
"
,
...
...
@@ -123,7 +123,7 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl, int vpid,
if
(
!
map
)
goto
out
;
ret
=
pagemap
=
open_proc
(
ctl
->
pid
,
"pagemap"
);
ret
=
pagemap
=
open_proc
(
ctl
->
pid
.
real
,
"pagemap"
);
if
(
ret
<
0
)
goto
out_free
;
...
...
parasite-syscall.c
View file @
fb9b0f50
...
...
@@ -200,7 +200,7 @@ static int parasite_execute_by_pid(unsigned int cmd, struct parasite_ctl *ctl, p
int
ret
;
user_regs_struct_t
regs_orig
,
regs
;
if
(
ctl
->
pid
==
pid
)
if
(
ctl
->
pid
.
real
==
pid
)
regs
=
ctl
->
regs_orig
;
else
{
if
(
ptrace
(
PTRACE_GETREGS
,
pid
,
NULL
,
&
regs_orig
))
{
...
...
@@ -221,7 +221,7 @@ static int parasite_execute_by_pid(unsigned int cmd, struct parasite_ctl *ctl, p
if
(
ret
)
pr_err
(
"Parasite exited with %d
\n
"
,
ret
);
if
(
ctl
->
pid
!=
pid
)
if
(
ctl
->
pid
.
real
!=
pid
)
if
(
ptrace
(
PTRACE_SETREGS
,
pid
,
NULL
,
&
regs_orig
))
{
pr_perror
(
"Can't restore registers (pid: %d)"
,
pid
);
return
-
1
;
...
...
@@ -232,7 +232,7 @@ static int parasite_execute_by_pid(unsigned int cmd, struct parasite_ctl *ctl, p
int
parasite_execute
(
unsigned
int
cmd
,
struct
parasite_ctl
*
ctl
)
{
return
parasite_execute_by_pid
(
cmd
,
ctl
,
ctl
->
pid
);
return
parasite_execute_by_pid
(
cmd
,
ctl
,
ctl
->
pid
.
real
);
}
static
int
munmap_seized
(
struct
parasite_ctl
*
ctl
,
void
*
addr
,
size_t
length
)
...
...
@@ -601,26 +601,26 @@ int parasite_cure_seized(struct parasite_ctl *ctl, struct pstree_item *item)
if
(
ctl
->
remote_map
)
{
if
(
munmap_seized
(
ctl
,
(
void
*
)
ctl
->
remote_map
,
ctl
->
map_length
))
{
pr_err
(
"munmap_seized failed (pid: %d)
\n
"
,
ctl
->
pid
);
pr_err
(
"munmap_seized failed (pid: %d)
\n
"
,
ctl
->
pid
.
real
);
ret
=
-
1
;
}
}
if
(
ctl
->
local_map
)
{
if
(
munmap
(
ctl
->
local_map
,
ctl
->
map_length
))
{
pr_err
(
"munmap failed (pid: %d)
\n
"
,
ctl
->
pid
);
pr_err
(
"munmap failed (pid: %d)
\n
"
,
ctl
->
pid
.
real
);
ret
=
-
1
;
}
}
if
(
ptrace_poke_area
(
ctl
->
pid
,
(
void
*
)
ctl
->
code_orig
,
if
(
ptrace_poke_area
(
ctl
->
pid
.
real
,
(
void
*
)
ctl
->
code_orig
,
(
void
*
)
ctl
->
syscall_ip
,
sizeof
(
ctl
->
code_orig
)))
{
pr_err
(
"Can't restore syscall blob (pid: %d)
\n
"
,
ctl
->
pid
);
pr_err
(
"Can't restore syscall blob (pid: %d)
\n
"
,
ctl
->
pid
.
real
);
ret
=
-
1
;
}
if
(
ptrace
(
PTRACE_SETREGS
,
ctl
->
pid
,
NULL
,
&
ctl
->
regs_orig
))
{
pr_err
(
"Can't restore registers (pid: %d)
\n
"
,
ctl
->
pid
);
if
(
ptrace
(
PTRACE_SETREGS
,
ctl
->
pid
.
real
,
NULL
,
&
ctl
->
regs_orig
))
{
pr_err
(
"Can't restore registers (pid: %d)
\n
"
,
ctl
->
pid
.
real
);
ret
=
-
1
;
}
...
...
@@ -659,7 +659,8 @@ struct parasite_ctl *parasite_prep_ctl(pid_t pid, struct vm_area_list *vma_area_
goto
err
;
}
ctl
->
pid
=
pid
;
ctl
->
pid
.
real
=
pid
;
ctl
->
pid
.
virt
=
0
;
ctl
->
syscall_ip
=
vma_area
->
vma
.
start
;
/*
...
...
@@ -667,7 +668,7 @@ struct parasite_ctl *parasite_prep_ctl(pid_t pid, struct vm_area_list *vma_area_
* we will need it to restore original program content.
*/
memcpy
(
ctl
->
code_orig
,
code_syscall
,
sizeof
(
ctl
->
code_orig
));
if
(
ptrace_swap_area
(
ctl
->
pid
,
(
void
*
)
ctl
->
syscall_ip
,
if
(
ptrace_swap_area
(
pid
,
(
void
*
)
ctl
->
syscall_ip
,
(
void
*
)
ctl
->
code_orig
,
sizeof
(
ctl
->
code_orig
)))
{
pr_err
(
"Can't inject syscall blob (pid: %d)
\n
"
,
pid
);
goto
err
;
...
...
@@ -688,13 +689,13 @@ int parasite_map_exchange(struct parasite_ctl *ctl, unsigned long size)
PROT_READ
|
PROT_WRITE
|
PROT_EXEC
,
MAP_ANONYMOUS
|
MAP_SHARED
,
-
1
,
0
);
if
(
!
ctl
->
remote_map
)
{
pr_err
(
"Can't allocate memory for parasite blob (pid: %d)
\n
"
,
ctl
->
pid
);
pr_err
(
"Can't allocate memory for parasite blob (pid: %d)
\n
"
,
ctl
->
pid
.
real
);
return
-
1
;
}
ctl
->
map_length
=
round_up
(
size
,
PAGE_SIZE
);
fd
=
open_proc_rw
(
ctl
->
pid
,
"map_files/%p-%p"
,
fd
=
open_proc_rw
(
ctl
->
pid
.
real
,
"map_files/%p-%p"
,
ctl
->
remote_map
,
ctl
->
remote_map
+
ctl
->
map_length
);
if
(
fd
<
0
)
return
-
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment