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
f8e88e94
Unverified
Commit
f8e88e94
authored
Jan 29, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attach: use dummy macros to make it easier to follow sync logic
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
6e36c297
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
attach.c
src/lxc/attach.c
+4
-4
sync.h
src/lxc/sync.h
+3
-0
No files found.
src/lxc/attach.c
View file @
f8e88e94
...
@@ -823,7 +823,7 @@ __noreturn static void do_attach(struct attach_payload *ap)
...
@@ -823,7 +823,7 @@ __noreturn static void do_attach(struct attach_payload *ap)
* set{g,u}id().
* set{g,u}id().
*/
*/
if
(
needs_lsm
)
{
if
(
needs_lsm
)
{
if
(
!
sync_wait_fd
(
ap
->
ipc_socket
,
&
lsm_fd
))
{
if
(
!
sync_wait_fd
(
ap
->
ipc_socket
,
ATTACH_SYNC_LSM
(
&
lsm_fd
)
))
{
SYSERROR
(
"Failed to receive lsm label fd"
);
SYSERROR
(
"Failed to receive lsm label fd"
);
goto
on_error
;
goto
on_error
;
}
}
...
@@ -1265,7 +1265,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
...
@@ -1265,7 +1265,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
lxc_attach_terminal_close_pts
(
&
terminal
);
lxc_attach_terminal_close_pts
(
&
terminal
);
/* Tell grandparent the pid of the pid of the newly created child. */
/* Tell grandparent the pid of the pid of the newly created child. */
if
(
!
sync_wake_pid
(
ipc_sockets
[
1
],
pid
))
{
if
(
!
sync_wake_pid
(
ipc_sockets
[
1
],
ATTACH_SYNC_PID
(
pid
)
))
{
/* If this really happens here, this is very unfortunate, since
/* If this really happens here, this is very unfortunate, since
* the parent will not know the pid of the attached process and
* the parent will not know the pid of the attached process and
* will not be able to wait for it (and we won't either due to
* will not be able to wait for it (and we won't either due to
...
@@ -1345,7 +1345,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
...
@@ -1345,7 +1345,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
TRACE
(
"Told intermediate process to start initializing"
);
TRACE
(
"Told intermediate process to start initializing"
);
/* Get pid of attached process from intermediate process. */
/* Get pid of attached process from intermediate process. */
if
(
!
sync_wait_pid
(
ipc_sockets
[
0
],
&
attached_pid
))
if
(
!
sync_wait_pid
(
ipc_sockets
[
0
],
ATTACH_SYNC_PID
(
&
attached_pid
)
))
goto
close_mainloop
;
goto
close_mainloop
;
TRACE
(
"Received pid %d of attached process in parent pid namespace"
,
attached_pid
);
TRACE
(
"Received pid %d of attached process in parent pid namespace"
,
attached_pid
);
...
@@ -1382,7 +1382,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
...
@@ -1382,7 +1382,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
TRACE
(
"Opened LSM label file descriptor %d"
,
labelfd
);
TRACE
(
"Opened LSM label file descriptor %d"
,
labelfd
);
/* Send child fd of the LSM security module to write to. */
/* Send child fd of the LSM security module to write to. */
if
(
!
sync_wake_fd
(
ipc_sockets
[
0
],
labelfd
))
{
if
(
!
sync_wake_fd
(
ipc_sockets
[
0
],
ATTACH_SYNC_LSM
(
labelfd
)
))
{
SYSERROR
(
"Failed to send lsm label fd"
);
SYSERROR
(
"Failed to send lsm label fd"
);
goto
close_mainloop
;
goto
close_mainloop
;
}
}
...
...
src/lxc/sync.h
View file @
f8e88e94
...
@@ -29,6 +29,9 @@ enum /* attach */ {
...
@@ -29,6 +29,9 @@ enum /* attach */ {
ATTACH_SYNC_CGROUP
=
0
,
ATTACH_SYNC_CGROUP
=
0
,
};
};
#define ATTACH_SYNC_PID(x) (x)
#define ATTACH_SYNC_LSM(x) (x)
__hidden
extern
bool
lxc_sync_init
(
struct
lxc_handler
*
handler
);
__hidden
extern
bool
lxc_sync_init
(
struct
lxc_handler
*
handler
);
__hidden
extern
void
lxc_sync_fini
(
struct
lxc_handler
*
);
__hidden
extern
void
lxc_sync_fini
(
struct
lxc_handler
*
);
__hidden
extern
void
lxc_sync_fini_parent
(
struct
lxc_handler
*
);
__hidden
extern
void
lxc_sync_fini_parent
(
struct
lxc_handler
*
);
...
...
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