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
ccf8d128
Unverified
Commit
ccf8d128
authored
May 24, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
seccomp: parse_config_v1()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
5fdc4e77
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
seccomp.c
src/lxc/seccomp.c
+14
-9
No files found.
src/lxc/seccomp.c
View file @
ccf8d128
...
@@ -23,9 +23,9 @@
...
@@ -23,9 +23,9 @@
#define _GNU_SOURCE
#define _GNU_SOURCE
#include <errno.h>
#include <errno.h>
#include <seccomp.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <seccomp.h>
#include <sys/mount.h>
#include <sys/mount.h>
#include <sys/utsname.h>
#include <sys/utsname.h>
...
@@ -38,25 +38,30 @@ lxc_log_define(lxc_seccomp, lxc);
...
@@ -38,25 +38,30 @@ lxc_log_define(lxc_seccomp, lxc);
static
int
parse_config_v1
(
FILE
*
f
,
struct
lxc_conf
*
conf
)
static
int
parse_config_v1
(
FILE
*
f
,
struct
lxc_conf
*
conf
)
{
{
char
line
[
1024
];
int
ret
=
0
;
int
ret
;
size_t
line_bufsz
=
0
;
char
*
line
=
NULL
;
while
(
fgets
(
line
,
1024
,
f
)
)
{
while
(
getline
(
&
line
,
&
line_bufsz
,
f
)
!=
-
1
)
{
int
nr
;
int
nr
;
ret
=
sscanf
(
line
,
"%d"
,
&
nr
);
ret
=
sscanf
(
line
,
"%d"
,
&
nr
);
if
(
ret
!=
1
)
if
(
ret
!=
1
)
return
-
1
;
return
-
1
;
ret
=
seccomp_rule_add
(
#if HAVE_SCMP_FILTER_CTX
#if HAVE_SCMP_FILTER_CTX
conf
->
seccomp_ctx
,
ret
=
seccomp_rule_add
(
conf
->
seccomp_ctx
,
SCMP_ACT_ALLOW
,
nr
,
0
);
#else
ret
=
seccomp_rule_add
(
SCMP_ACT_ALLOW
,
nr
,
0
);
#endif
#endif
SCMP_ACT_ALLOW
,
nr
,
0
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ERROR
(
"Failed loading allow rule for %d"
,
nr
);
ERROR
(
"Failed loading allow rule for %d"
,
nr
);
return
ret
;
break
;
}
}
}
}
return
0
;
free
(
line
);
return
ret
;
}
}
#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