From owner-freebsd-bugs Wed Sep 18 19:30: 4 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2857737B401 for ; Wed, 18 Sep 2002 19:30:03 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1420F43E91 for ; Wed, 18 Sep 2002 19:30:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g8J2U1Co060532 for ; Wed, 18 Sep 2002 19:30:01 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g8J2U18e060530; Wed, 18 Sep 2002 19:30:01 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A518837B401 for ; Wed, 18 Sep 2002 19:23:35 -0700 (PDT) Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 674F543E6E for ; Wed, 18 Sep 2002 19:23:35 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.6/8.12.6) with ESMTP id g8J2NV7R061738 for ; Wed, 18 Sep 2002 19:23:31 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.6/8.12.6/Submit) id g8J2NVDO061737; Wed, 18 Sep 2002 19:23:31 -0700 (PDT) Message-Id: <200209190223.g8J2NVDO061737@www.freebsd.org> Date: Wed, 18 Sep 2002 19:23:31 -0700 (PDT) From: pqf To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/42943: fd 0,1,2 should not be set to nonblock in _thread_fd_table_init() Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 42943 >Category: misc >Synopsis: fd 0,1,2 should not be set to nonblock in _thread_fd_table_init() >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Sep 18 19:30:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: pqf >Release: FreeBSD bsd 4.6.2-RELEASE >Organization: www.tebie.com >Environment: FreeBSD bsd 4.6.2-RELEASE FreeBSD 4.6.2-RELEASE #0: Wed Aug 14 21:23:26 GMT 2002 murray@builder.freebsdmall.com:/usr/src/sys/compile/GENERIC i386 >Description: in uthread_fd.c line 141, it set fd 0, 1, 2 to nonblock mode, and so the fd 0, 1, 2 in kernel is nonblock mode, but the mode of them in uthread level MAY be blocking normally, it's ok to do so, but think about the following condition: parend process call dup2() to make fd 0 be a unix domain socket parent process fork() muti-thread(pthread) child process child process set fd 0 to nonblock in _thread_fd_table_init() fd 0 is shared between parent process and child process, so the parent process's fd 0 is now nonblock, but the parent process DO NOT know what happen because it DID NOT do anything to fd 0... >How-To-Repeat: >Fix: comment line 140 to line 143 in uthread_fd.c >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message