Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Aug 2021 08:57:26 GMT
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4385147547d9 - main - linux(4): Return ENOSYS for unsupported clone3 option bits.
Message-ID:  <202108120857.17C8vQcY064292@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=4385147547d9f2f8b93f08012c0a18aa6d895403

commit 4385147547d9f2f8b93f08012c0a18aa6d895403
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2021-08-12 08:56:36 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2021-08-12 08:56:36 +0000

    linux(4): Return ENOSYS for unsupported clone3 option bits.
    
    Differential Revision:  https://reviews.freebsd.org/D31483
    MFC after:              2 weeks
---
 sys/compat/linux/linux_fork.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c
index 77dd8446c588..ba169ff98923 100644
--- a/sys/compat/linux/linux_fork.c
+++ b/sys/compat/linux/linux_fork.c
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
 #include <compat/linux/linux_emul.h>
 #include <compat/linux/linux_fork.h>
 #include <compat/linux/linux_futex.h>
+#include <compat/linux/linux_mib.h>
 #include <compat/linux/linux_misc.h>
 #include <compat/linux/linux_util.h>
 
@@ -411,6 +412,20 @@ linux_clone3_args_valid(struct l_user_clone_args *uca)
 	if (uca->stack != 0 && uca->stack_size == 0)
 		return (EINVAL);
 
+	/* Verify that no unsupported flags are passed along. */
+	if ((uca->flags & LINUX_CLONE_NEWTIME) != 0) {
+		LINUX_RATELIMIT_MSG("unsupported clone3 option CLONE_NEWTIME");
+		return (ENOSYS);
+	}
+	if ((uca->flags & LINUX_CLONE_INTO_CGROUP) != 0) {
+		LINUX_RATELIMIT_MSG("unsupported clone3 option CLONE_INTO_CGROUP");
+		return (ENOSYS);
+	}
+	if (uca->set_tid != 0 || uca->set_tid_size != 0) {
+		LINUX_RATELIMIT_MSG("unsupported clone3 set_tid");
+		return (ENOSYS);
+	}
+
 	return (0);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108120857.17C8vQcY064292>