Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Sep 2002 19:23:31 -0700 (PDT)
From:      pqf <pqf@163.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/42943: fd 0,1,2 should not be set to nonblock in _thread_fd_table_init()
Message-ID:  <200209190223.g8J2NVDO061737@www.freebsd.org>

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

>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




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