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
a9034401
Unverified
Commit
a9034401
authored
May 24, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
seccomp: get_v2_action()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
46acf530
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
22 deletions
+29
-22
seccomp.c
src/lxc/seccomp.c
+29
-22
No files found.
src/lxc/seccomp.c
View file @
a9034401
...
...
@@ -65,6 +65,23 @@ static int parse_config_v1(FILE *f, struct lxc_conf *conf)
}
#if HAVE_DECL_SECCOMP_SYSCALL_RESOLVE_NAME_ARCH
static
const
char
*
get_action_name
(
uint32_t
action
)
{
/* The upper 16 bits indicate the type of the seccomp action. */
switch
(
action
&
0xffff0000
)
{
case
SCMP_ACT_KILL
:
return
"kill"
;
case
SCMP_ACT_ALLOW
:
return
"allow"
;
case
SCMP_ACT_TRAP
:
return
"trap"
;
case
SCMP_ACT_ERRNO
(
0
):
return
"errno"
;
}
return
"invalid action"
;
}
static
uint32_t
get_v2_default_action
(
char
*
line
)
{
uint32_t
ret_action
=
-
1
;
...
...
@@ -94,41 +111,31 @@ static uint32_t get_v2_default_action(char *line)
return
ret_action
;
}
static
const
char
*
get_action_name
(
uint32_t
action
)
{
/* The upper 16 bits indicate the type of the seccomp action. */
switch
(
action
&
0xffff0000
)
{
case
SCMP_ACT_KILL
:
return
"kill"
;
case
SCMP_ACT_ALLOW
:
return
"allow"
;
case
SCMP_ACT_TRAP
:
return
"trap"
;
case
SCMP_ACT_ERRNO
(
0
):
return
"errno"
;
}
return
"invalid action"
;
}
static
uint32_t
get_v2_action
(
char
*
line
,
uint32_t
def_action
)
{
char
*
p
=
strchr
(
line
,
' '
)
;
char
*
p
;
uint32_t
ret
;
p
=
strchr
(
line
,
' '
);
if
(
!
p
)
return
def_action
;
p
++
;
while
(
*
p
==
' '
)
p
++
;
if
(
!*
p
||
*
p
==
'#'
)
return
def_action
;
ret
=
get_v2_default_action
(
p
);
switch
(
ret
)
{
case
-
2
:
return
-
1
;
case
-
1
:
return
def_action
;
default:
return
ret
;
switch
(
ret
)
{
case
-
2
:
return
-
1
;
case
-
1
:
return
def_action
;
}
return
ret
;
}
struct
v2_rule_args
{
...
...
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