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
2c80e9cf
Unverified
Commit
2c80e9cf
authored
Apr 13, 2018
by
Serge Hallyn
Committed by
GitHub
Apr 13, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2274 from…
Merge pull request #2274 from brauner/2018-04-13/fix_seccomp_with_personality_and_64bit_kernel_32_bit_userspace seccomp: handle arch inversion
parents
bf5afb01
b5ed021b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
16 deletions
+32
-16
seccomp.c
src/lxc/seccomp.c
+32
-16
No files found.
src/lxc/seccomp.c
View file @
2c80e9cf
...
...
@@ -370,17 +370,21 @@ scmp_filter_ctx get_new_ctx(enum lxc_hostarch_t n_arch, uint32_t default_policy_
WARN
(
"Failed to turn on seccomp nop-skip, continuing"
);
}
#endif
ret
=
seccomp_arch_add
(
ctx
,
arch
);
if
(
ret
!=
0
)
{
ERROR
(
"Seccomp error %d (%s) adding arch: %d"
,
ret
,
strerror
(
-
ret
),
(
int
)
n_arch
);
seccomp_release
(
ctx
);
return
NULL
;
}
if
(
seccomp_arch_remove
(
ctx
,
SCMP_ARCH_NATIVE
)
!=
0
)
{
ERROR
(
"Seccomp error removing native arch"
);
seccomp_release
(
ctx
);
return
NULL
;
if
(
seccomp_arch_exist
(
ctx
,
arch
)
==
-
EEXIST
)
{
ret
=
seccomp_arch_add
(
ctx
,
arch
);
if
(
ret
!=
0
)
{
ERROR
(
"Seccomp error %d (%s) adding arch: %d"
,
ret
,
strerror
(
-
ret
),
(
int
)
n_arch
);
seccomp_release
(
ctx
);
return
NULL
;
}
if
(
seccomp_arch_remove
(
ctx
,
SCMP_ARCH_NATIVE
)
!=
0
)
{
ERROR
(
"Seccomp error removing native arch"
);
seccomp_release
(
ctx
);
return
NULL
;
}
}
return
ctx
;
...
...
@@ -772,11 +776,23 @@ static int parse_config_v2(FILE *f, char *line, struct lxc_conf *conf)
}
if
(
compat_ctx
[
0
])
{
INFO
(
"Merging in the compat Seccomp ctx into the main one"
);
if
(
seccomp_merge
(
conf
->
seccomp_ctx
,
compat_ctx
[
0
])
!=
0
||
(
compat_ctx
[
1
]
!=
NULL
&&
seccomp_merge
(
conf
->
seccomp_ctx
,
compat_ctx
[
1
])
!=
0
))
{
ERROR
(
"Error merging compat Seccomp contexts"
);
goto
bad
;
INFO
(
"Merging compat seccomp contexts into main context"
);
if
(
compat_arch
[
0
]
!=
native_arch
&&
compat_arch
[
0
]
!=
seccomp_arch_native
())
{
ret
=
seccomp_merge
(
conf
->
seccomp_ctx
,
compat_ctx
[
0
]);
if
(
ret
<
0
)
{
ERROR
(
"Failed to merge first compat seccomp context into main context"
);
goto
bad
;
}
TRACE
(
"Merged first compat seccomp context into main context"
);
}
if
(
compat_arch
[
1
]
&&
compat_arch
[
1
]
!=
native_arch
&&
compat_arch
[
1
]
!=
seccomp_arch_native
())
{
ret
=
seccomp_merge
(
conf
->
seccomp_ctx
,
compat_ctx
[
1
]);
if
(
ret
<
0
)
{
ERROR
(
"Failed to merge first compat seccomp context into main context"
);
goto
bad
;
}
TRACE
(
"Merged second compat seccomp context into main context"
);
}
}
...
...
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