Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 7 Dec 2017 16:26:09 +0100
From: Natanael Copa <ncopa@...inelinux.org>
To: musl@...ts.openwall.com
Subject: bug with sysconf(_SC_CHILD_MAX) with user process ulimit set to
 unlimited

Hi,

While trying to debug why `bash -c 'sleep 1 &  wait $!'` hangs with
alpine in docker[1] I made an interesting discovery.

Set user process ulimit to "unlimited" and run the following program on
an x86_64 machine:

#include <stdio.h>
#include <unistd.h>

int main() {
	long maxchild = sysconf(_SC_CHILD_MAX);
	printf("maxchild: %ld\n", maxchild);
	return 0;
}


With musl libc it prints:

  maxchild: 9223372036854775807

With glibc it prints:

  maxchild: -1


Setting the process ulimit to something like 64k makes bash work again.

Shouldn't sysconf(_SC_CHILD_MAX) return -1 if ulimit is set to
"unlimited"?

Thanks!

-nc


[1]: https://github.com/tianon/docker-bash/issues/4

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.