Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Feb 2001 02:09:29 -0800 (PST)
From:      jml@cubical.fi
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/24845: linuxthreads does not detect failed rfork
Message-ID:  <200102041009.f14A9Tg98764@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         24845
>Category:       ports
>Synopsis:       linuxthreads does not detect failed rfork
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 04 02:10:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Juha-Matti Liukkonen
>Release:        4.2-RELEASE
>Organization:
Cubical Solutions Ltd
>Environment:
FreeBSD snafu.intra.net 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Sat Feb  3 20:12:33 EET 2001
     root@:/usr/src/sys/compile/SERVER  i386

>Description:
When a new thread is created by the manager thread calling __clone()
and rfork() fails (eg. proc limit reached), the manager thread enters
busy loop.

>How-To-Repeat:
A small program:

void* func(void* arg) { sleep(100); return 0; }

main() {
struct rlimit rl = { 20, 0 };
pthread_t pt;
setrlimit(RLIMIT_NPROC, &rl);
for (;;) pthread_create(&pt, 0, func, 0);
}

Observe "top" or "ps l" output. Issue sysctl -w kern.corefile="%N-%P.core"
to get per-thread cores. Get a core dump with "kill -TRAP
<manager-pid>; kill <main-pid>"; load the manager's core and say where.

>Fix:
In clone.S, the execution seems to go to the error branch correctly,
but the subsequent return from __clone throws the manager thread back
to its entry point.

Adding "call _exit" before the .cerror jmp exits the manager thread
in the error situation -- maybe the stack gets corrupted somehow to
cause the ret from the .cerror macro to fail?


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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