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
18a405ee
Unverified
Commit
18a405ee
authored
May 29, 2019
by
Christian Brauner
Committed by
GitHub
May 29, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2987 from tych0/pass-zero-to-clone
Pass zero to clone
parents
0cfec4f7
3df90604
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
21 deletions
+16
-21
lxc.container.conf.sgml.in
doc/lxc.container.conf.sgml.in
+6
-0
namespace.c
src/lxc/namespace.c
+10
-21
No files found.
doc/lxc.container.conf.sgml.in
View file @
18a405ee
...
@@ -1722,6 +1722,12 @@ dev/null proc/kcore none bind,relative 0 0
...
@@ -1722,6 +1722,12 @@ dev/null proc/kcore none bind,relative 0 0
process wants to inherit the other's network namespace it usually
process wants to inherit the other's network namespace it usually
needs to inherit the user namespace as well.
needs to inherit the user namespace as well.
</para>
</para>
<para>
Note that without careful additional configuration of an LSM,
sharing user+pid namespaces with a task may allow that task to
escalate privileges to that of the task calling liblxc.
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
</variablelist>
</variablelist>
...
...
src/lxc/namespace.c
View file @
18a405ee
...
@@ -42,33 +42,22 @@
...
@@ -42,33 +42,22 @@
lxc_log_define
(
namespace
,
lxc
);
lxc_log_define
(
namespace
,
lxc
);
struct
clone_arg
{
#define __LXC_STACK_SIZE (8 * 1024 * 1024)
int
(
*
fn
)(
void
*
);
void
*
arg
;
};
static
int
do_clone
(
void
*
arg
)
{
struct
clone_arg
*
clone_arg
=
arg
;
return
clone_arg
->
fn
(
clone_arg
->
arg
);
}
#define __LXC_STACK_SIZE 4096
pid_t
lxc_clone
(
int
(
*
fn
)(
void
*
),
void
*
arg
,
int
flags
,
int
*
pidfd
)
pid_t
lxc_clone
(
int
(
*
fn
)(
void
*
),
void
*
arg
,
int
flags
,
int
*
pidfd
)
{
{
size_t
stack_size
;
pid_t
ret
;
pid_t
ret
;
struct
clone_arg
clone_arg
=
{
void
*
stack
;
.
fn
=
fn
,
.
arg
=
arg
,
stack
=
malloc
(
__LXC_STACK_SIZE
);
};
if
(
!
stack
)
{
char
*
stack
[
__LXC_STACK_SIZE
]
=
{
0
};
SYSERROR
(
"Failed to allocate clone stack"
);
stack_size
=
__LXC_STACK_SIZE
;
return
-
ENOMEM
;
}
#ifdef __ia64__
#ifdef __ia64__
ret
=
__clone2
(
do_clone
,
stack
,
stack_size
,
flags
|
SIGCHLD
,
&
clone_
arg
,
pidfd
);
ret
=
__clone2
(
fn
,
stack
,
__LXC_STACK_SIZE
,
flags
|
SIGCHLD
,
arg
,
pidfd
);
#else
#else
ret
=
clone
(
do_clone
,
stack
+
stack_size
,
flags
|
SIGCHLD
,
&
clone_
arg
,
pidfd
);
ret
=
clone
(
fn
,
stack
+
__LXC_STACK_SIZE
,
flags
|
SIGCHLD
,
arg
,
pidfd
);
#endif
#endif
if
(
ret
<
0
)
if
(
ret
<
0
)
SYSERROR
(
"Failed to clone (%#x)"
,
flags
);
SYSERROR
(
"Failed to clone (%#x)"
,
flags
);
...
...
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