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
c689b58a
Unverified
Commit
c689b58a
authored
Feb 04, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: restricted fd-only controller mountpoint creation
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
315f8a4e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
cgfsng.c
src/lxc/cgroups/cgfsng.c
+10
-1
No files found.
src/lxc/cgroups/cgfsng.c
View file @
c689b58a
...
...
@@ -1808,6 +1808,7 @@ static inline int cg_mount_cgroup_full(int type, struct hierarchy *h,
__cgfsng_ops
static
bool
cgfsng_mount
(
struct
cgroup_ops
*
ops
,
struct
lxc_conf
*
conf
,
int
type
)
{
__do_close
int
dfd_mnt_cgroupfs
=
-
EBADF
;
__do_free
char
*
cgroup_root
=
NULL
;
bool
has_cgns
=
false
,
wants_force_mount
=
false
;
struct
lxc_rootfs
*
rootfs
=
&
conf
->
rootfs
;
...
...
@@ -1893,6 +1894,14 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
if
(
ret
<
0
)
return
false
;
dfd_mnt_cgroupfs
=
open_at
(
rootfs
->
mntpt_fd
,
DEFAULT_CGROUP_MOUNTPOINT_RELATIVE
,
PROTECT_OPATH_DIRECTORY
,
PROTECT_LOOKUP_BENEATH_XDEV
,
0
);
if
(
dfd_mnt_cgroupfs
<
0
)
return
log_error_errno
(
-
errno
,
errno
,
"Failed to open %d(%s)"
,
rootfs
->
mntpt_fd
,
DEFAULT_CGROUP_MOUNTPOINT_RELATIVE
);
for
(
int
i
=
0
;
ops
->
hierarchies
[
i
];
i
++
)
{
__do_free
char
*
controllerpath
=
NULL
,
*
path2
=
NULL
;
struct
hierarchy
*
h
=
ops
->
hierarchies
[
i
];
...
...
@@ -1906,7 +1915,7 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
if
(
dir_exists
(
controllerpath
))
continue
;
ret
=
mkdir
(
controllerpath
,
0755
);
ret
=
mkdir
at
(
dfd_mnt_cgroupfs
,
controller
,
0000
);
if
(
ret
<
0
)
return
log_error_errno
(
false
,
errno
,
"Error creating cgroup path: %s"
,
controllerpath
);
...
...
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