From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [bug?] clone(CLONE_IO) failing after kernel commit commit ef2c41cf38a7
Date: Tue, 5 May 2020 03:28:34 -0400 (EDT) [thread overview]
Message-ID: <1038674044.11248021.1588663714272.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <100149681.11244932.1588661282331.JavaMail.zimbra@redhat.com>
Hi,
I'm seeing an issue with CLONE_IO and libc' clone() on ppc64le,
where flags parameter appears to be sign extended before it's passed
to kernel syscall.
This is an issue since kernel commit ef2c41cf38a7 ("clone3: allow
spawning processes into cgroups"), because there's now a check for
flag that userspace didn't intend to pass:
static int cgroup_css_set_fork(struct kernel_clone_args *kargs)
__acquires(&cgroup_mutex) __acquires(&cgroup_threadgroup_rwsem)
if (!(kargs->flags & CLONE_INTO_CGROUP)) { // CLONE_INTO_CGROUP == 0x200000000ULL
kargs->cset = cset;
return 0;
}
f = fget_raw(kargs->cgroup);
if (!f) {
ret = -EBADF;
goto err;
}
Reproducer:
#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <sys/wait.h>
char stack[2*1024*1024];
static int do_child(void *arg)
{
printf("hello");
return 0;
}
int main(void)
{
clone(do_child, stack+1024*1024, CLONE_IO|SIGCHLD, NULL, NULL, NULL, NULL);
return 0;
}
reliably hits EBADF with glibc-2.31.9000-12.fc33.ppc64le and 5.7.0-0.rc2 kernel:
clone(child_stack=0x1011ffe0, flags=CLONE_IO|0xffffffff00000000|SIGCHLD) = -1 EBADF (Bad file descriptor)
Regards,
Jan
next parent reply other threads:[~2020-05-05 7:28 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <100149681.11244932.1588661282331.JavaMail.zimbra@redhat.com>
2020-05-05 7:28 ` Jan Stancek [this message]
2020-05-05 7:49 ` [LTP] [bug?] clone(CLONE_IO) failing after kernel commit commit ef2c41cf38a7 Florian Weimer
2020-05-05 7:59 ` Christian Brauner
2020-05-05 8:02 ` Christian Brauner
2020-05-05 8:32 ` Christian Brauner
2020-05-05 8:58 ` Jan Stancek
2020-05-05 9:05 ` Florian Weimer
2020-05-05 9:15 ` Christian Brauner
2020-05-05 9:36 ` Florian Weimer
2020-05-05 9:58 ` Christian Brauner
2020-05-05 10:21 ` Christian Brauner
2020-05-05 11:34 ` Florian Weimer
2020-05-05 11:35 ` Dmitry V. Levin
2020-05-05 11:43 ` Christian Brauner
2020-05-05 11:49 ` Dmitry V. Levin
2020-05-05 11:57 ` Christian Brauner
2020-05-05 11:08 ` Florian Weimer
2020-05-05 11:26 ` Christian Brauner
2020-05-05 7:54 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1038674044.11248021.1588663714272.JavaMail.zimbra@redhat.com \
--to=jstancek@redhat.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox