From owner-freebsd-ports Sun Feb 4 2:10:20 2001 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id B043037B491 for ; Sun, 4 Feb 2001 02:10:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f14AA1u98853; Sun, 4 Feb 2001 02:10:01 -0800 (PST) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 195B537B401 for ; Sun, 4 Feb 2001 02:09:29 -0800 (PST) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f14A9Tg98764; Sun, 4 Feb 2001 02:09:29 -0800 (PST) (envelope-from nobody) Message-Id: <200102041009.f14A9Tg98764@freefall.freebsd.org> Date: Sun, 4 Feb 2001 02:09:29 -0800 (PST) From: jml@cubical.fi To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: ports/24845: linuxthreads does not detect failed rfork Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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 ; kill "; 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