From owner-freebsd-bugs Fri Jun 11 21:40: 5 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 85BD5150C6 for ; Fri, 11 Jun 1999 21:40:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id VAA42320; Fri, 11 Jun 1999 21:40:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from shell2.ba.best.com (shell2.ba.best.com [206.184.139.133]) by hub.freebsd.org (Postfix) with ESMTP id 9EBC91507D for ; Fri, 11 Jun 1999 21:34:17 -0700 (PDT) (envelope-from asaddi@shell2.ba.best.com) Received: (from asaddi@localhost) by shell2.ba.best.com (8.9.3/8.9.2/best.sh) id VAA02996; Fri, 11 Jun 1999 21:33:34 -0700 (PDT) Message-Id: <199906120433.VAA02996@shell2.ba.best.com> Date: Fri, 11 Jun 1999 21:33:34 -0700 (PDT) From: asaddi@philosophysw.com To: FreeBSD-gnats-submit@freebsd.org Subject: i386/12147: Linux emulator fcntl ignores args (patch included) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 12147 >Category: i386 >Synopsis: Linux emulator fcntl ignores args >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jun 11 21:40:00 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Allan Saddi >Release: FreeBSD 3.2-STABLE i386 >Organization: Philosophy SoftWorks >Environment: FreeBSD 3.2-STABLE #43: Wed May 19 21:50:31 PDT 1999 >Description: The Linux emulator's fcntl syscall ignores args for commands that shouldn't have them ignored: F_DUPFD and F_SETFD. As a result, whenever fcntl w/ the command of F_DUPFD is called, the descriptor copied is always descriptor 0. Also, fcntl w/ F_SETFD can't ever set a descriptor's close-on-exec flag. The bug was found while installing/running Scriptics' TclPro. Because descriptors failed to actually close-on-exec (i.e. pipe descriptors), closing a dup'ed copy of the descriptor did not actually close the file/ pipe. Thus, an EOF cannot be sent between the parent/child through the pipe, causing both to hang. (The child closes the pipe, thinking it's actually closed, while the parent waits, read'ing from a pipe that the child will never write to again.) >How-To-Repeat: Attempt to install Scriptics' TclPro (www.scriptics.com). Installation will hang while unzipping. >Fix: --- sys/i386/linux/linux_file.c.orig Sun Jan 10 15:15:35 1999 +++ sys/i386/linux/linux_file.c Fri Jun 11 19:19:17 1999 @@ -219,6 +219,7 @@ switch (args->cmd) { case LINUX_F_DUPFD: fcntl_args.cmd = F_DUPFD; + fcntl_args.arg = args->arg; return fcntl(p, &fcntl_args); case LINUX_F_GETFD: @@ -227,6 +228,7 @@ case LINUX_F_SETFD: fcntl_args.cmd = F_SETFD; + fcntl_args.arg = args->arg; return fcntl(p, &fcntl_args); case LINUX_F_GETFL: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message