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
bc84967f
Commit
bc84967f
authored
Dec 09, 2016
by
Stéphane Graber
Committed by
GitHub
Dec 09, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1348 from brauner/2016-12-08/fix_attach_fd_leak_stable-1.0
attach: close lsm label file descriptor
parents
7586efbe
2174895d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
attach.c
src/lxc/attach.c
+5
-1
No files found.
src/lxc/attach.c
View file @
bc84967f
...
@@ -941,7 +941,8 @@ int lxc_attach(const char* name, const char* lxcpath, lxc_attach_exec_t exec_fun
...
@@ -941,7 +941,8 @@ int lxc_attach(const char* name, const char* lxcpath, lxc_attach_exec_t exec_fun
/* Open LSM fd and send it to child. */
/* Open LSM fd and send it to child. */
if
((
options
->
namespaces
&
CLONE_NEWNS
)
&&
(
options
->
attach_flags
&
LXC_ATTACH_LSM
)
&&
init_ctx
->
lsm_label
)
{
if
((
options
->
namespaces
&
CLONE_NEWNS
)
&&
(
options
->
attach_flags
&
LXC_ATTACH_LSM
)
&&
init_ctx
->
lsm_label
)
{
int
on_exec
,
labelfd
;
int
on_exec
;
int
labelfd
=
-
1
;
on_exec
=
options
->
attach_flags
&
LXC_ATTACH_LSM_EXEC
?
1
:
0
;
on_exec
=
options
->
attach_flags
&
LXC_ATTACH_LSM_EXEC
?
1
:
0
;
/* Open fd for the LSM security module. */
/* Open fd for the LSM security module. */
labelfd
=
lsm_openat
(
procfd
,
attached_pid
,
on_exec
);
labelfd
=
lsm_openat
(
procfd
,
attached_pid
,
on_exec
);
...
@@ -950,6 +951,7 @@ int lxc_attach(const char* name, const char* lxcpath, lxc_attach_exec_t exec_fun
...
@@ -950,6 +951,7 @@ int lxc_attach(const char* name, const char* lxcpath, lxc_attach_exec_t exec_fun
/* Send child fd of the LSM security module to write to. */
/* Send child fd of the LSM security module to write to. */
ret
=
lxc_abstract_unix_send_fd
(
ipc_sockets
[
0
],
labelfd
,
NULL
,
0
);
ret
=
lxc_abstract_unix_send_fd
(
ipc_sockets
[
0
],
labelfd
,
NULL
,
0
);
close
(
labelfd
);
if
(
ret
<=
0
)
{
if
(
ret
<=
0
)
{
ERROR
(
"Error using IPC to send child LSM fd (4): %s."
,
ERROR
(
"Error using IPC to send child LSM fd (4): %s."
,
strerror
(
errno
));
strerror
(
errno
));
...
@@ -957,6 +959,8 @@ int lxc_attach(const char* name, const char* lxcpath, lxc_attach_exec_t exec_fun
...
@@ -957,6 +959,8 @@ int lxc_attach(const char* name, const char* lxcpath, lxc_attach_exec_t exec_fun
}
}
}
}
if
(
procfd
>=
0
)
close
(
procfd
);
/* now shut down communication with child, we're done */
/* now shut down communication with child, we're done */
shutdown
(
ipc_sockets
[
0
],
SHUT_RDWR
);
shutdown
(
ipc_sockets
[
0
],
SHUT_RDWR
);
close
(
ipc_sockets
[
0
]);
close
(
ipc_sockets
[
0
]);
...
...
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