/*
                 * - CLONE_DETACHED is blocked so that we can potentially
                 *   reuse it later for CLONE_PIDFD.
-                * - CLONE_THREAD is blocked until someone really needs it.
                 */
-               if (clone_flags & (CLONE_DETACHED | CLONE_THREAD))
+               if (clone_flags & CLONE_DETACHED)
                        return ERR_PTR(-EINVAL);
        }
 
         * if the fd table isn't shared).
         */
        if (clone_flags & CLONE_PIDFD) {
+               int flags = (clone_flags & CLONE_THREAD) ? PIDFD_THREAD : 0;
+
                /* Note that no task has been attached to @pid yet. */
-               retval = __pidfd_prepare(pid, 0, &pidfile);
+               retval = __pidfd_prepare(pid, flags, &pidfile);
                if (retval < 0)
                        goto bad_fork_free_pid;
                pidfd = retval;