Is there a problem with 1.3.42?

Is there a problem with 1.3.42?

Post by Sean Christopher Farl » Sat, 18 Nov 1995 04:00:00



Now I might not totally correct, but I think there is a problem with
the 1.3.42 patch.

I am referring to the swapping of _IOC_READ and _IOC_WRITE.  I noticed
the swapping in the asm-i386/ioctl.h:
--- v1.3.41/linux/include/asm-i386/ioctl.h      Mon Nov 13 12:36:46 1995

  * Direction bits.
  */
 #define _IOC_NONE      0U
-#define _IOC_READ      1U
-#define _IOC_WRITE     2U
+#define _IOC_WRITE     1U
+#define _IOC_READ      2U

But they are also flipped three times in drivers/block/floppy.c.  
As an example on line 3216:

        /* verify writability of result, and fail early */
-       if (_IOC_DIR(cmd) & _IOC_WRITE)
+       if (_IOC_DIR(cmd) & _IOC_READ)

A double flipping would cancel the change, which may be what is desired.
Is this correct?  I also noticed that after an IOC_WRITE on line 3222
there is an attempt to fd_copyin.  Would that not be a read as opposed to
write?

If I am wrong, sorry, just trying to help.

Sean
--
Sean C. Farley

PGP 2.6.2 key using finger or WWW
WWW Homepage is:  http://www.cs.purdue.edu/people/farleysc

 
 
 

Is there a problem with 1.3.42?

Post by Alain Kna » Sat, 18 Nov 1995 04:00:00



: Now I might not totally correct, but I think there is a problem with
: the 1.3.42 patch.

: I am referring to the swapping of _IOC_READ and _IOC_WRITE.  I noticed
: the swapping in the asm-i386/ioctl.h:
: --- v1.3.41/linux/include/asm-i386/ioctl.h      Mon Nov 13 12:36:46 1995
: +++ linux/include/asm-i386/ioctl.h      Wed Nov 15 09:15:02 1995

:   * Direction bits.
:   */
:  #define _IOC_NONE      0U
: -#define _IOC_READ      1U
: -#define _IOC_WRITE     2U
: +#define _IOC_WRITE     1U
: +#define _IOC_READ      2U

: But they are also flipped three times in drivers/block/floppy.c.  
: As an example on line 3216:

:       /* verify writability of result, and fail early */
: -       if (_IOC_DIR(cmd) & _IOC_WRITE)
: +       if (_IOC_DIR(cmd) & _IOC_READ)

: A double flipping would cancel the change, which may be what is desired.
: Is this correct?
 Yes. The reason for this was that in the old version of ioctl.h the
_IOC_xxx and _IOx macros disagreed: i.e. _IOC_WRITE went with _IOR and
vice-versa. This was fixed in 1.3.41 and 1.3.42.

: I also noticed that after an IOC_WRITE on line 3222
: there is an attempt to fd_copyin.  Would that not be a read as opposed to
: write?
 IOC_READ and IOC_WRITE are expressed relative to user space (it used
to be relative to kernel space). A transfer from user space to kernel
space (as done by fd_copyin) is a write for the user but a read for
the kernel. The new point of view is the user's, so this is correct.

: If I am wrong, sorry, just trying to help.

: Sean
: --
: Sean C. Farley

: PGP 2.6.2 key using finger or WWW
: WWW Homepage is:  http://www.cs.purdue.edu/people/farleysc

--
 Linux - Where do you want to fly today ?
 Windows 95 - Makes a grown man cry

 Alain