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
2e3c4e36
Commit
2e3c4e36
authored
Dec 19, 2011
by
Cyrill Gorcunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move everything related to ptrace into ptrace.[ch]
Signed-off-by:
Cyrill Gorcunov
<
gorcunov@openvz.org
>
parent
83fd63d3
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
89 additions
and
89 deletions
+89
-89
Makefile
Makefile
+1
-1
cr-dump.c
cr-dump.c
+1
-1
ptrace.h
include/ptrace.h
+4
-0
util.h
include/util.h
+0
-5
parasite-syscall.c
parasite-syscall.c
+1
-0
ptrace.c
ptrace.c
+82
-2
util.c
util.c
+0
-80
No files found.
Makefile
View file @
2e3c4e36
...
...
@@ -64,7 +64,7 @@ OBJS += cr-dump.o
OBJS
+=
cr-restore.o
OBJS
+=
cr-show.o
OBJS
+=
util.o
OBJS
+=
seiz
e.o
OBJS
+=
ptrac
e.o
OBJS
+=
restorer.o
OBJS
+=
log.o
...
...
cr-dump.c
View file @
2e3c4e36
...
...
@@ -29,7 +29,7 @@
#include "compiler.h"
#include "crtools.h"
#include "syscall.h"
#include "
seiz
e.h"
#include "
ptrac
e.h"
#include "util.h"
#include "image.h"
...
...
include/
seiz
e.h
→
include/
ptrac
e.h
View file @
2e3c4e36
...
...
@@ -5,5 +5,9 @@
extern
int
seize_task
(
pid_t
pid
);
extern
int
unseize_task
(
pid_t
pid
);
extern
int
ptrace_peek_area
(
pid_t
pid
,
void
*
dst
,
void
*
addr
,
long
bytes
);
extern
int
ptrace_poke_area
(
pid_t
pid
,
void
*
src
,
void
*
addr
,
long
bytes
);
extern
int
ptrace_show_area
(
pid_t
pid
,
void
*
addr
,
long
bytes
);
extern
int
ptrace_show_area_r
(
pid_t
pid
,
void
*
addr
,
long
bytes
);
#endif
/* SEIZE_H_ */
include/util.h
View file @
2e3c4e36
...
...
@@ -123,11 +123,6 @@ extern void printk(const char *format, ...);
#define memzero_p(p) memset(p, 0, sizeof(*p))
#define memzero(p, size) memset(p, 0, size)
extern
int
ptrace_peek_area
(
pid_t
pid
,
void
*
dst
,
void
*
addr
,
long
bytes
);
extern
int
ptrace_poke_area
(
pid_t
pid
,
void
*
src
,
void
*
addr
,
long
bytes
);
extern
int
ptrace_show_area
(
pid_t
pid
,
void
*
addr
,
long
bytes
);
extern
int
ptrace_show_area_r
(
pid_t
pid
,
void
*
addr
,
long
bytes
);
extern
void
printk_registers
(
user_regs_struct_t
*
regs
);
extern
void
printk_siginfo
(
siginfo_t
*
siginfo
);
...
...
parasite-syscall.c
View file @
2e3c4e36
...
...
@@ -17,6 +17,7 @@
#include "compiler.h"
#include "syscall.h"
#include "types.h"
#include "ptrace.h"
#include "util.h"
#include "parasite-syscall.h"
...
...
seiz
e.c
→
ptrac
e.c
View file @
2e3c4e36
...
...
@@ -27,9 +27,8 @@
#include "compiler.h"
#include "types.h"
#include "list.h"
#include "util.h"
#include "
seiz
e.h"
#include "
ptrac
e.h"
#include "crtools.h"
...
...
@@ -79,3 +78,84 @@ err_cont:
continue_task
(
pid
);
goto
err
;
}
int
ptrace_show_area_r
(
pid_t
pid
,
void
*
addr
,
long
bytes
)
{
unsigned
long
w
,
i
;
if
(
bytes
&
(
sizeof
(
long
)
-
1
))
return
-
1
;
for
(
w
=
0
;
w
<
bytes
/
sizeof
(
long
);
w
++
)
{
unsigned
long
*
a
=
addr
;
unsigned
long
v
;
v
=
ptrace
(
PTRACE_PEEKDATA
,
pid
,
a
+
w
,
NULL
);
if
(
v
==
-
1U
&&
errno
)
goto
err
;
else
{
unsigned
char
*
c
=
(
unsigned
char
*
)
&
v
;
for
(
i
=
sizeof
(
v
)
/
sizeof
(
*
c
);
i
>
0
;
i
--
)
printk
(
"%02x "
,
c
[
i
-
1
]);
printk
(
" "
);
}
}
printk
(
"
\n
"
);
return
0
;
err:
return
-
2
;
}
int
ptrace_show_area
(
pid_t
pid
,
void
*
addr
,
long
bytes
)
{
unsigned
long
w
,
i
;
if
(
bytes
&
(
sizeof
(
long
)
-
1
))
return
-
1
;
printk
(
"%016lx: "
,
(
unsigned
long
)
addr
);
for
(
w
=
0
;
w
<
bytes
/
sizeof
(
long
);
w
++
)
{
unsigned
long
*
a
=
addr
;
unsigned
long
v
;
v
=
ptrace
(
PTRACE_PEEKDATA
,
pid
,
a
+
w
,
NULL
);
if
(
v
==
-
1U
&&
errno
)
goto
err
;
else
{
unsigned
char
*
c
=
(
unsigned
char
*
)
&
v
;
for
(
i
=
0
;
i
<
sizeof
(
v
)
/
sizeof
(
*
c
);
i
++
)
printk
(
"%02x "
,
c
[
i
]);
printk
(
" "
);
}
}
printk
(
"
\n
"
);
return
0
;
err:
return
-
2
;
}
int
ptrace_peek_area
(
pid_t
pid
,
void
*
dst
,
void
*
addr
,
long
bytes
)
{
unsigned
long
w
;
if
(
bytes
&
(
sizeof
(
long
)
-
1
))
return
-
1
;
for
(
w
=
0
;
w
<
bytes
/
sizeof
(
long
);
w
++
)
{
unsigned
long
*
d
=
dst
,
*
a
=
addr
;
d
[
w
]
=
ptrace
(
PTRACE_PEEKDATA
,
pid
,
a
+
w
,
NULL
);
if
(
d
[
w
]
==
-
1U
&&
errno
)
goto
err
;
}
return
0
;
err:
return
-
2
;
}
int
ptrace_poke_area
(
pid_t
pid
,
void
*
src
,
void
*
addr
,
long
bytes
)
{
unsigned
long
w
;
if
(
bytes
&
(
sizeof
(
long
)
-
1
))
return
-
1
;
for
(
w
=
0
;
w
<
bytes
/
sizeof
(
long
);
w
++
)
{
unsigned
long
*
s
=
src
,
*
a
=
addr
;
if
(
ptrace
(
PTRACE_POKEDATA
,
pid
,
a
+
w
,
s
[
w
]))
goto
err
;
}
return
0
;
err:
return
-
2
;
}
util.c
View file @
2e3c4e36
...
...
@@ -47,86 +47,6 @@ void printk(const char *format, ...)
va_end
(
params
);
}
int
ptrace_show_area_r
(
pid_t
pid
,
void
*
addr
,
long
bytes
)
{
unsigned
long
w
,
i
;
if
(
bytes
&
(
sizeof
(
long
)
-
1
))
return
-
1
;
for
(
w
=
0
;
w
<
bytes
/
sizeof
(
long
);
w
++
)
{
unsigned
long
*
a
=
addr
;
unsigned
long
v
;
v
=
ptrace
(
PTRACE_PEEKDATA
,
pid
,
a
+
w
,
NULL
);
if
(
v
==
-
1U
&&
errno
)
goto
err
;
else
{
unsigned
char
*
c
=
(
unsigned
char
*
)
&
v
;
for
(
i
=
sizeof
(
v
)
/
sizeof
(
*
c
);
i
>
0
;
i
--
)
printk
(
"%02x "
,
c
[
i
-
1
]);
printk
(
" "
);
}
}
printk
(
"
\n
"
);
return
0
;
err:
return
-
2
;
}
int
ptrace_show_area
(
pid_t
pid
,
void
*
addr
,
long
bytes
)
{
unsigned
long
w
,
i
;
if
(
bytes
&
(
sizeof
(
long
)
-
1
))
return
-
1
;
printk
(
"%016lx: "
,
(
unsigned
long
)
addr
);
for
(
w
=
0
;
w
<
bytes
/
sizeof
(
long
);
w
++
)
{
unsigned
long
*
a
=
addr
;
unsigned
long
v
;
v
=
ptrace
(
PTRACE_PEEKDATA
,
pid
,
a
+
w
,
NULL
);
if
(
v
==
-
1U
&&
errno
)
goto
err
;
else
{
unsigned
char
*
c
=
(
unsigned
char
*
)
&
v
;
for
(
i
=
0
;
i
<
sizeof
(
v
)
/
sizeof
(
*
c
);
i
++
)
printk
(
"%02x "
,
c
[
i
]);
printk
(
" "
);
}
}
printk
(
"
\n
"
);
return
0
;
err:
return
-
2
;
}
int
ptrace_peek_area
(
pid_t
pid
,
void
*
dst
,
void
*
addr
,
long
bytes
)
{
unsigned
long
w
;
if
(
bytes
&
(
sizeof
(
long
)
-
1
))
return
-
1
;
for
(
w
=
0
;
w
<
bytes
/
sizeof
(
long
);
w
++
)
{
unsigned
long
*
d
=
dst
,
*
a
=
addr
;
d
[
w
]
=
ptrace
(
PTRACE_PEEKDATA
,
pid
,
a
+
w
,
NULL
);
if
(
d
[
w
]
==
-
1U
&&
errno
)
goto
err
;
}
return
0
;
err:
return
-
2
;
}
int
ptrace_poke_area
(
pid_t
pid
,
void
*
src
,
void
*
addr
,
long
bytes
)
{
unsigned
long
w
;
if
(
bytes
&
(
sizeof
(
long
)
-
1
))
return
-
1
;
for
(
w
=
0
;
w
<
bytes
/
sizeof
(
long
);
w
++
)
{
unsigned
long
*
s
=
src
,
*
a
=
addr
;
if
(
ptrace
(
PTRACE_POKEDATA
,
pid
,
a
+
w
,
s
[
w
]))
goto
err
;
}
return
0
;
err:
return
-
2
;
}
void
hex_dump
(
void
*
addr
,
unsigned
long
len
)
{
unsigned
char
*
p
=
addr
;
...
...
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