lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180910235550.GN19965@ZenIV.linux.org.uk>
Date:   Tue, 11 Sep 2018 00:55:50 +0100
From:   Al Viro <viro@...IV.linux.org.uk>
To:     linux-kernel@...r.kernel.org
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [WTF?] extremely old dead code

	Folks, please tell me that I'm misreading the history
here...

0.97:
kernel/chr_dev/tty_ioctl.c:tty_ioctl():
+               case FIONBIO:
+                       if (arg)
+                               file->f_flags |= O_NONBLOCK;
+                       else
+                               file->f_flags &= ~O_NONBLOCK;
+                       return 0;

0.98.2:
fs/ioctl.c:sys_ioctl():
+               case FIONBIO:
+                       on = get_fs_long((unsigned long *) arg);
+                       if (on)
+                               filp->f_flags |= O_NONBLOCK;
+                       else
+                               filp->f_flags &= ~O_NONBLOCK;
+                       return 0;

Note that the call of ->f_op->ioctl() is in default: in the same switch,
i.e. unreachable with cmd == FIONBIO.

0.98.3:
kernel/chr_dev/tty_ioctl.c:tty_ioctl():
                case FIONBIO:
+                       arg = get_fs_long((unsigned long *) arg);
                        if (arg)
                                file->f_flags |= O_NONBLOCK;
                        else
wasn't that dead code by that point?

0.99.13k: kernel/chr_dev/tty_ioctl.c moves to drivers/char/tty_ioctl.c,
tty_ioctl() essentially unchanged.

1.1.13: tty_ioctl() moves from drivers/char/tty_ioctl.c to
drivers/char/tty_io.c, leaving some bits behind (as n_tty_ioctl()).
FIONBIO handling is among the moved parts.

1.3.4: in tty_ioctl()
                case FIONBIO:
-                       retval = verify_area(VERIFY_READ, (void *) arg, sizeof(long));
+                       retval = verify_area(VERIFY_READ, (void *) arg, sizeof(int));

1.3.28: same change happens in sys_ioctl().

2.1.4: handling moved to helper (fionbio())

In 2006: Alan writes a nice description of fionbio()
+/**
+ *     fionbio         -       non blocking ioctl
+ *     @file: file to set blocking value
+ *     @p: user parameter
+ *
+ *     Historical tty interfaces had a blocking control ioctl before
+ *     the generic functionality existed. This piece of history is preserved
+ *     in the expected tty API of posix OS's.
+ *
+ *     Locking: none, the open fle handle ensures it won't go away.
+ */
"generic functionality" bit refers to fcntl(2) (F_SETFL)

In 2010: the whole thing is moved to drivers/tty/tty_io.c

Hadn't that sucker been dead code since 0.98.2?  What am I missing here?
Note that this thing had quite a few functionality changes over those
years; had they even been tested?

Confused and hoping to be told "Al, you're an idiot, here's an obvious way
for that thing to be reached"...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ