]> code.ossystems Code Review - openembedded-core.git/commit
glibc: fix create thread failed in unprivileged process
authorHongxu Jia <hongxu.jia@windriver.com>
Wed, 16 Feb 2022 02:54:29 +0000 (18:54 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 18 Feb 2022 11:47:23 +0000 (11:47 +0000)
commit58802b2c4f63a4572cc7cca26d1d8a6b30e2fc79
tree61ce58afdff59b60967a7302d9b7c8ace6dc79f6
parente1a1b201c4a850ae116d88975df3fdab4dea6945
glibc: fix create thread failed in unprivileged process

Since upstream commit [d8ea0d0168 Add an internal wrapper for clone, clone2
and clone3] applied, start a unprivileged container (docker run without
--privileged), it creates a thread failed in container.

In commit d8ea0d0168, it calls __clone3 if HAVE_CLONE3_WAPPER is defined.  If
__clone3 returns -1 with ENOSYS, fall back to clone or clone2.

As known from [1], cloneXXX fails with EPERM if CLONE_NEWCGROUP,
CLONE_NEWIPC, CLONE_NEWNET, CLONE_NEWNS, CLONE_NEWPID, or CLONE_NEWUTS
was specified by an unprivileged process (process without CAP_SYS_ADMIN)

[1] https://man7.org/linux/man-pages/man2/clone3.2.html

So if __clone3 returns -1 with EPERM, fall back to clone or clone2 could
fix the issue.

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/glibc/glibc/0024-fix-create-thread-failed-in-unprivileged-process-BZ-.patch [new file with mode: 0644]
meta/recipes-core/glibc/glibc_2.35.bb