https://bugzilla.mindrot.org/show_bug.cgi?id=2139
Bug ID: 2139
Summary: re-exec fallback problem
Product: Portable OpenSSH
Version: -current
Hardware: Other
OS: FreeBSD
Status: NEW
Severity: minor
Priority: P5
Component: sshd
Assignee: [email protected]
Reporter: [email protected]
I've attempted to run openssh-SNAP-20130802.tar.gz on
FreeBSD 9.1-STABLE FreeBSD 9.1-STABLE #2 r251997: Wed Jun
19 11:13:25 PDT 2013 /usr/obj/usr/src/sys/GENERIC amd64
While "make tests" pass successfully, I did stumble upon, potentially
not a new, bug related to fallback re-exec functionality bug.
Here is how to reproduce it.
$ pwd
/tmp/todelete/openssh
$ make tests
$ cd regress
$ /tmp/todelete/openssh/regress/sshd -f
/tmp/todelete/openssh/regress/sshd_config -Esshd.log -dddD
# in a separate window:
$ pwd
/tmp/todelete/openssh/regress
$ mv sshd sshd.o # simulate reexec fallback
$ ../ssh -nqo "Protocol=2" -F ssh_config somehost ls
Connection to 127.0.0.1 closed by remote host.
$ echo $?
255
I haven't been able to figure out exactly what's causing the failure,
but it
appears to be something about assumption about which fd values.
I.e. if we ensure that FD to which stderr is redirected (-E), gets a
higher
than usual fd, then the problem goes away:
--- log.c.orig 2013-08-02 15:27:27.000000000 -0700
+++ log.c 2013-08-02 15:28:23.000000000 -0700
@@ -352,11 +352,20 @@
{
int fd;
+#define XSIZ 3
+ int f[XSIZ], i;
+ /* ensure fd gets a higher numbered fd */
+ for (i = 0; i < XSIZ; i++)
+ f[i] = open("/COPYRIGHT", O_RDONLY);
+
if ((fd = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0600)) == -1) {
fprintf(stderr, "Couldn't open logfile %s: %s\n", logfile,
strerror(errno));
exit(1);
}
+ for (i = 0; i < XSIZ; i++)
+ close(f[i]);
+
log_stderr_fd = fd;
}
--
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
openssh-bugs mailing list
[email protected]
https://lists.mindrot.org/mailman/listinfo/openssh-bugs