Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
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
Chen Yisong
lxc
Commits
f67c94d0
Unverified
Commit
f67c94d0
authored
May 24, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
seccomp: parse_v2_rules()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
63a49b03
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
19 deletions
+13
-19
seccomp.c
src/lxc/seccomp.c
+13
-19
No files found.
src/lxc/seccomp.c
View file @
f67c94d0
...
@@ -235,13 +235,11 @@ static int get_seccomp_arg_value(char *key, struct seccomp_v2_rule_args *rule_ar
...
@@ -235,13 +235,11 @@ static int get_seccomp_arg_value(char *key, struct seccomp_v2_rule_args *rule_ar
* @rules : output struct.
* @rules : output struct.
* Returns 0 on success, < 0 otherwise.
* Returns 0 on success, < 0 otherwise.
*/
*/
static
int
parse_v2_rules
(
char
*
line
,
uint32_t
def_action
,
struct
seccomp_v2_rule
*
rules
)
static
int
parse_v2_rules
(
char
*
line
,
uint32_t
def_action
,
struct
seccomp_v2_rule
*
rules
)
{
{
int
ret
=
0
;
int
i
=
0
,
ret
=
-
1
;
int
i
=
0
;
char
*
key
=
NULL
,
*
saveptr
=
NULL
,
*
tmp
=
NULL
;
char
*
tmp
=
NULL
;
char
*
key
=
NULL
;
char
*
saveptr
=
NULL
;
tmp
=
strdup
(
line
);
tmp
=
strdup
(
line
);
if
(
!
tmp
)
if
(
!
tmp
)
...
@@ -249,33 +247,29 @@ static int parse_v2_rules(char *line, uint32_t def_action, struct seccomp_v2_rul
...
@@ -249,33 +247,29 @@ static int parse_v2_rules(char *line, uint32_t def_action, struct seccomp_v2_rul
/* read optional action which follows the syscall */
/* read optional action which follows the syscall */
rules
->
action
=
get_v2_action
(
tmp
,
def_action
);
rules
->
action
=
get_v2_action
(
tmp
,
def_action
);
if
(
rules
->
action
==
-
1
)
{
ERROR
(
"Failed to interpret action"
);
ret
=
-
1
;
goto
out
;
}
rules
->
args_num
=
0
;
if
(
!
strchr
(
tmp
,
'['
))
{
ret
=
0
;
ret
=
0
;
rules
->
args_num
=
0
;
if
(
!
strchr
(
tmp
,
'['
))
goto
out
;
goto
out
;
}
for
((
key
=
strtok_r
(
tmp
,
"]"
,
&
saveptr
)),
i
=
0
;
key
&&
i
<
6
;
(
key
=
strtok_r
(
NULL
,
"]"
,
&
saveptr
)),
i
++
)
{
ret
=
get_seccomp_arg_value
(
key
,
&
rules
->
args_value
[
i
]);
if
(
ret
<
0
)
{
ret
=
-
1
;
ret
=
-
1
;
for
((
key
=
strtok_r
(
tmp
,
"]"
,
&
saveptr
)),
i
=
0
;
key
&&
i
<
6
;
(
key
=
strtok_r
(
NULL
,
"]"
,
&
saveptr
)),
i
++
)
{
ret
=
get_seccomp_arg_value
(
key
,
&
rules
->
args_value
[
i
]);
if
(
ret
<
0
)
goto
out
;
goto
out
;
}
rules
->
args_num
++
;
rules
->
args_num
++
;
}
}
ret
=
0
;
ret
=
0
;
out:
out:
free
(
tmp
);
free
(
tmp
);
return
ret
;
return
ret
;
}
}
#endif
#endif
#if HAVE_DECL_SECCOMP_SYSCALL_RESOLVE_NAME_ARCH
#if HAVE_DECL_SECCOMP_SYSCALL_RESOLVE_NAME_ARCH
...
...
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