public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Jasper Bryant-Greene <jasper@amiton.co.nz>
Cc: dhowells@redhat.com, Thomas Meyer <thomas@m3y3r.de>,
	James Morris <jmorris@namei.org>,
	Linux-Kernel <linux-kernel@vger.kernel.org>,
	Linux-Next <linux-next@vger.kernel.org>
Subject: Re: next-20080808: bash: fork: Resource temporarily unavailable
Date: Sun, 10 Aug 2008 10:45:39 +0100	[thread overview]
Message-ID: <10251.1218361539@redhat.com> (raw)
In-Reply-To: <1218322518.3268.0.camel@luna.unix.geek.nz>


Jasper Bryant-Greene <jasper@amiton.co.nz> wrote:

> This occurs on my x86_64 system, config was posted to this thread
> earlier.

Does it happen every time?  I took your config modified it very slightly so
that it'd work on my system:

	-CONFIG_INITRAMFS_SOURCE="/usr/share/v86d/initramfs"
	-CONFIG_INITRAMFS_ROOT_UID=0
	-CONFIG_INITRAMFS_ROOT_GID=0
	+CONFIG_INITRAMFS_SOURCE=""

	-CONFIG_PACKET=m
	+CONFIG_PACKET=y

	-CONFIG_UNIX=m
	+CONFIG_UNIX=y

	-CONFIG_NET_KEY=m
	+CONFIG_NET_KEY=y

	-CONFIG_E1000E=m
	+CONFIG_E1000E=y

	-# CONFIG_SERIAL_8250 is not set
	+CONFIG_SERIAL_8250=y
	+CONFIG_SERIAL_8250_CONSOLE=y
	+CONFIG_SERIAL_8250_PCI=y
	+CONFIG_SERIAL_8250_PNP=y
	+CONFIG_SERIAL_8250_NR_UARTS=4
	+CONFIG_SERIAL_8250_RUNTIME_UARTS=4
	+# CONFIG_SERIAL_8250_EXTENDED is not set

	+CONFIG_SERIAL_CORE=y
	+CONFIG_SERIAL_CORE_CONSOLE=y

	-# CONFIG_EXT3_FS is not set
	+CONFIG_EXT3_FS=y
	+CONFIG_EXT3_FS_XATTR=y
	+CONFIG_EXT3_FS_POSIX_ACL=y
	+CONFIG_EXT3_FS_SECURITY=y
	+CONFIG_JBD=y
	+# CONFIG_JBD_DEBUG is not set

None of which should make a difference, but the kernel works fine and survives
the LTP syscalls testscript:-/

Hmmm... There is a possibility, I suppose.  The only place in the fork path
that I know of that returns EAGAIN is this bit:

	retval = -EAGAIN;
	if (atomic_read(&p->real_cred->user->processes) >=
			p->signal->rlim[RLIMIT_NPROC].rlim_cur) {
		if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&
		    p->real_cred->user != current->nsproxy->user_ns->root_user)
			goto bad_fork_free;
	}

Are you running as an unprivileged user?  If so, this may be the point that's
biting you.  Can you try applying the attached patch to find more information?

David
---
Add printks to find problem

From: David Howells <dhowells@redhat.com>


---

 kernel/fork.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)


diff --git a/kernel/fork.c b/kernel/fork.c
index eb7838d..4d52954 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -920,8 +920,10 @@ static struct task_struct *copy_process(unsigned long clone_flags,
 		return ERR_PTR(-EINVAL);
 
 	retval = security_task_create(clone_flags);
-	if (retval)
+	if (retval) {
+		printk(KERN_ERR "security_task_create() returned %d\n", retval);
 		goto fork_out;
+	}
 
 	retval = -ENOMEM;
 	p = dup_task_struct(current);
@@ -938,13 +940,20 @@ static struct task_struct *copy_process(unsigned long clone_flags,
 	if (atomic_read(&p->real_cred->user->processes) >=
 			p->signal->rlim[RLIMIT_NPROC].rlim_cur) {
 		if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&
-		    p->real_cred->user != current->nsproxy->user_ns->root_user)
+		    p->real_cred->user != current->nsproxy->user_ns->root_user) {
+			printk(KERN_ERR "Rlimit EAGAIN (%d >= %lu, uid %d)\n",
+			       atomic_read(&p->real_cred->user->processes),
+			       p->signal->rlim[RLIMIT_NPROC].rlim_cur,
+			       p->real_cred->user->uid);
 			goto bad_fork_free;
+		}
 	}
 
 	retval = copy_creds(p, clone_flags);
-	if (retval < 0)
+	if (retval < 0) {
+		printk(KERN_ERR "copy_creds() returned %d\n", retval);
 		goto bad_fork_free;
+	}
 
 	/*
 	 * If multiple threads are within copy_process(), then this check
@@ -1274,6 +1283,7 @@ bad_fork_cleanup_count:
 bad_fork_free:
 	free_task(p);
 fork_out:
+	printk(KERN_ERR "copy_process() = %d\n", retval);
 	return ERR_PTR(retval);
 }
 

  reply	other threads:[~2008-08-10  9:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-08 17:02 next-20080808: bash: fork: Resource temporarily unavailable Thomas Meyer
2008-08-08 17:21 ` Adrian Bunk
2008-08-08 22:32   ` David Howells
2008-08-08 22:48     ` James Morris
2008-08-08 23:23       ` David Howells
2008-08-08 21:48 ` James Morris
2008-08-09  8:44   ` jasper
2008-08-09  8:46     ` jasper
2008-08-09 11:26   ` Thomas Meyer
2008-08-09 12:52     ` David Howells
2008-08-09 13:11       ` Thomas Meyer
2008-08-09 14:07         ` David Howells
2008-08-09 22:55           ` Jasper Bryant-Greene
2008-08-10  9:45             ` David Howells [this message]
2008-08-10 10:30               ` Grant Wilson
2008-08-10 11:31                 ` David Howells
2008-08-11  0:26                   ` James Morris
2008-08-11  0:21                 ` David Howells
2008-08-11  0:44                   ` James Morris

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=10251.1218361539@redhat.com \
    --to=dhowells@redhat.com \
    --cc=jasper@amiton.co.nz \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=thomas@m3y3r.de \
    /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