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
850c0659
Unverified
Commit
850c0659
authored
Apr 07, 2020
by
Christian Brauner
Committed by
Stéphane Graber
Apr 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start: ensure all file descriptors are closed during exec
Closes
https://github.com/checkpoint-restore/criu/issues/1011
. Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
98613f61
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
af_unix.c
src/lxc/af_unix.c
+1
-1
start.c
src/lxc/start.c
+5
-6
No files found.
src/lxc/af_unix.c
View file @
850c0659
...
@@ -189,7 +189,7 @@ static int lxc_abstract_unix_recv_fds_iov(int fd, int *recvfds, int num_recvfds,
...
@@ -189,7 +189,7 @@ static int lxc_abstract_unix_recv_fds_iov(int fd, int *recvfds, int num_recvfds,
msg
.
msg_iovlen
=
iovlen
;
msg
.
msg_iovlen
=
iovlen
;
do
{
do
{
ret
=
recvmsg
(
fd
,
&
msg
,
0
);
ret
=
recvmsg
(
fd
,
&
msg
,
MSG_CMSG_CLOEXEC
);
}
while
(
ret
<
0
&&
errno
==
EINTR
);
}
while
(
ret
<
0
&&
errno
==
EINTR
);
if
(
ret
<
0
||
ret
==
0
)
if
(
ret
<
0
||
ret
==
0
)
return
ret
;
return
ret
;
...
...
src/lxc/start.c
View file @
850c0659
...
@@ -1039,14 +1039,13 @@ static int do_start(void *data)
...
@@ -1039,14 +1039,13 @@ static int do_start(void *data)
struct
lxc_handler
*
handler
=
data
;
struct
lxc_handler
*
handler
=
data
;
__lxc_unused
__do_close
int
data_sock0
=
handler
->
data_sock
[
0
],
__lxc_unused
__do_close
int
data_sock0
=
handler
->
data_sock
[
0
],
data_sock1
=
handler
->
data_sock
[
1
];
data_sock1
=
handler
->
data_sock
[
1
];
__do_close
int
status_fd
=
-
EBADF
;
__do_close
int
devnull_fd
=
-
EBADF
,
status_fd
=
-
EBADF
;
int
ret
;
int
ret
;
uid_t
new_uid
;
uid_t
new_uid
;
gid_t
new_gid
;
gid_t
new_gid
;
struct
lxc_list
*
iterator
;
struct
lxc_list
*
iterator
;
uid_t
nsuid
=
0
;
uid_t
nsuid
=
0
;
gid_t
nsgid
=
0
;
gid_t
nsgid
=
0
;
int
devnull_fd
=
-
1
;
lxc_sync_fini_parent
(
handler
);
lxc_sync_fini_parent
(
handler
);
...
@@ -1401,20 +1400,20 @@ static int do_start(void *data)
...
@@ -1401,20 +1400,20 @@ static int do_start(void *data)
}
}
}
}
/* After this call, we are in error because this ops should not return
/*
* After this call, we are in error because this ops should not return
* as it execs.
* as it execs.
*/
*/
handler
->
ops
->
start
(
handler
,
handler
->
data
);
handler
->
ops
->
start
(
handler
,
handler
->
data
);
out_warn_father:
out_warn_father:
/* We want the parent to know something went wrong, so we return a
/*
* We want the parent to know something went wrong, so we return a
* special error code.
* special error code.
*/
*/
lxc_sync_wake_parent
(
handler
,
LXC_SYNC_ERROR
);
lxc_sync_wake_parent
(
handler
,
LXC_SYNC_ERROR
);
out_error:
out_error:
close_prot_errno_disarm
(
devnull_fd
);
return
-
1
;
return
-
1
;
}
}
...
...
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