Skip site navigation (1)Skip section navigation (2)
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)
Message-ID:  <199906120433.VAA02996@shell2.ba.best.com>

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

>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




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