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
abd80bde
Unverified
Commit
abd80bde
authored
Mar 05, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start: handle CLONE_PIDFD on arm64
Reported-by:
Ondrej Kubik
<
ondrej.kubik@canonical.com
>
Cc: stable-4.0 Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
673ce312
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
start.c
src/lxc/start.c
+19
-0
No files found.
src/lxc/start.c
View file @
abd80bde
...
@@ -1714,7 +1714,26 @@ static int lxc_spawn(struct lxc_handler *handler)
...
@@ -1714,7 +1714,26 @@ static int lxc_spawn(struct lxc_handler *handler)
/* Kernel might be too old for clone3(). */
/* Kernel might be too old for clone3(). */
if
(
handler
->
pid
<
0
)
{
if
(
handler
->
pid
<
0
)
{
SYSTRACE
(
"Failed to spawn container via clone3()"
);
SYSTRACE
(
"Failed to spawn container via clone3()"
);
/*
* In contrast to all other architectures arm64 verifies that
* the argument we use to retrieve the pidfd with is
* initialized to 0. But we need to be able to initialize it to
* a negative value such as our customary -EBADF so we can
* detect whether this kernel supports pidfds. If the syscall
* returns and the pidfd variable is set to something >= 0 then
* we know this is a kernel supporting pidfds. But if we can't
* set it to -EBADF then this won't work since 0 is a valid
* file descriptor too. And since legacy clone silently ignores
* unknown flags we are left without any way to detect support
* for pidfds. So let's special-case arm64 to not fail starting
* containers.
*/
#if defined(__aarch64__)
handler
->
pid
=
lxc_raw_legacy_clone
(
handler
->
clone_flags
&
~
CLONE_PIDFD
,
NULL
);
#else
handler
->
pid
=
lxc_raw_legacy_clone
(
handler
->
clone_flags
,
&
handler
->
pidfd
);
handler
->
pid
=
lxc_raw_legacy_clone
(
handler
->
clone_flags
,
&
handler
->
pidfd
);
#endif
}
}
if
(
handler
->
pid
<
0
)
{
if
(
handler
->
pid
<
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