Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jul 2017 14:30:09 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 221048] minor() truncates device number to 32 bits, whereas dev_t type was extended to 64 bits
Message-ID:  <bug-221048-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D221048

            Bug ID: 221048
           Summary: minor() truncates device number to 32 bits, whereas
                    dev_t type was extended to 64 bits
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: victor.stinner@gmail.com

A commit made at May, 23, changed dev_t type from 32 bits to 64 bits:

* https://reviews.freebsd.org/D10439
*
https://github.com/freebsd/freebsd/commit/e75ba1d5c4c79376a78351c8544388491=
db49664#diff-12c2f5b61ce3b017a25144619d13ca66L108

The problem is that the userland minor() macro explicitly truncates to 32 b=
its:

#define minor(x) ((int)((x)&0xffff00ff)) /* minor number */

https://github.com/freebsd/freebsd/blob/master/sys/sys/types.h#L373

64-bit dev_t broke a unit test Python:
http://bugs.python.org/issue31044

In short, Python checks that makedev(major(dev), minor(dev))=3D=3Ddev, wher=
eas dev
comes from stat.st_dev of a file created in the current directory (ex: ZFS
filesystem for $HOME).

Example:

* stat() returns st_dev =3D 0xde4d0429ab
* major(0xde4d0429ab) returns 0x29
* minor(0xde4d0429ab) returns 0x4d0400ab

The problem is that minor() truncates 0xde00000000 high bits.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



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