mknod() cannot create device nodes with large majors or large minors
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
glibc (Debian) |
Fix Released
|
Unknown
|
|||
glibc (Ubuntu) |
Fix Released
|
Medium
|
Jeff Bailey |
Bug Description
This bug has already been reported upstream (see
http://
in Hoary. It would be a shame for Hoary to release with this unfixed since it
seems likely that kernel drivers requiring large major/minors will be coming soon.
In Debian Bug tracker #289945, Greg KH (greg-kroah) wrote : Re: Bug#289945: udev: does not create device nodes with large majors properly | #1 |
In Debian Bug tracker #289945, Roland Dreier (roland-topspin) wrote : | #2 |
Greg> glibc "issue" Try upgrading it to a newer version.
Looks like it. The udev tests behave as you say, and even simpler,
the following program prints "0x12c00" but creates /dev/infiniband/xxx
with major 0x2c. This is with Debian libc6 2.3.2.ds1-20, which is the
newest available in Debian. Do you happen to know which glibc version
has the fix for mknod?
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
printf("0x%x\n", makedev(300, 0));
mknod(
return 0;
}
Thanks,
Roland
In Debian Bug tracker #289945, Greg KH (greg-kroah) wrote : | #3 |
On Tue, Jan 11, 2005 at 04:34:58PM -0800, Roland Dreier wrote:
> Greg> glibc "issue" Try upgrading it to a newer version.
>
> Looks like it. The udev tests behave as you say, and even simpler,
> the following program prints "0x12c00" but creates /dev/infiniband/xxx
> with major 0x2c. This is with Debian libc6 2.3.2.ds1-20, which is the
> newest available in Debian. Do you happen to know which glibc version
> has the fix for mknod?
No idea, I don't run Debian on any of my boxes :)
Good luck,
greg k-h
In Debian Bug tracker #289945, Roland Dreier (roland-topspin) wrote : | #4 |
(I guess this bug should be reassigned to libc6)
It seems that the change to glibc's mknod was applied about 15 months
ago, between glibc 2.3.2 and glibc 2.3.3. Here's the patch taken from
glibc CVS:
Index: glibc-2.
=======
--- glibc-2.
+++ glibc-2.
@@ -35,7 +35,7 @@
int
__xmknod (int vers, const char *path, mode_t mode, dev_t *dev)
{
- unsigned short int k_dev;
+ unsigned long long int k_dev;
if (vers != _MKNOD_VER)
{
@@ -44,9 +44,12 @@
}
/* We must convert the value to dev_t type used by the kernel. */
- k_dev = ((major (*dev) & 0xff) << 8) | (minor (*dev) & 0xff);
+ k_dev = (*dev) & ((1ULL << 32) - 1);
+ if (k_dev != *dev)
+ return EOVERFLOW;
- return INLINE_SYSCALL (mknod, 3, CHECK_STRING (path), mode, k_dev);
+ return INLINE_SYSCALL (mknod, 3, CHECK_STRING (path), mode,
+ (unsigned int) k_dev);
}
weak_alias (__xmknod, _xmknod)
In Debian Bug tracker #289945, Marco d'Itri (md) wrote : please add support for long long dev_t | #5 |
reassign 289945 libc6
retitle 289945 please add support for long long dev_t
tag 289945 patch upstream
thanks
Please apply to allow udev to create nodes for drivers which need more
than 2^8 minors.
On Jan 12, Roland Dreier <email address hidden> wrote:
> (I guess this bug should be reassigned to libc6)
>
> It seems that the change to glibc's mknod was applied about 15 months
> ago, between glibc 2.3.2 and glibc 2.3.3. Here's the patch taken from
> glibc CVS:
>
> Index: glibc-2.
> =======
> --- glibc-2.
> +++ glibc-2.
> @@ -35,7 +35,7 @@
> int
> __xmknod (int vers, const char *path, mode_t mode, dev_t *dev)
> {
> - unsigned short int k_dev;
> + unsigned long long int k_dev;
>
> if (vers != _MKNOD_VER)
> {
> @@ -44,9 +44,12 @@
> }
>
> /* We must convert the value to dev_t type used by the kernel. */
> - k_dev = ((major (*dev) & 0xff) << 8) | (minor (*dev) & 0xff);
> + k_dev = (*dev) & ((1ULL << 32) - 1);
> + if (k_dev != *dev)
> + return EOVERFLOW;
>
> - return INLINE_SYSCALL (mknod, 3, CHECK_STRING (path), mode, k_dev);
> + return INLINE_SYSCALL (mknod, 3, CHECK_STRING (path), mode,
> + (unsigned int) k_dev);
> }
>
> weak_alias (__xmknod, _xmknod)
--
ciao,
Marco
In Debian Bug tracker #289945, Roland Dreier (roland-topspin) wrote : Re: Bug#289945: udev: does not create device nodes with large majors properly | #6 |
reassign 289945 libc6
thanks
In Debian Bug tracker #289945, GOTO Masanori (gotom-debian) wrote : Re: please add support for long long dev_t | #7 |
tags 289945 fixed-upstream
thanks
Roland Dreier (roland.dreier) wrote : | #8 |
This bug has already been reported upstream (see
http://
in Hoary. It would be a shame for Hoary to release with this unfixed since it
seems likely that kernel drivers requiring large major/minors will be coming soon.
Debian Bug Importer (debzilla) wrote : | #9 |
Message-Id: <E1CoVrk-
Date: Tue, 11 Jan 2005 15:56:00 -0800
From: Roland Dreier <email address hidden>
To: Debian Bug Tracking System <email address hidden>
Subject: udev: does not create device nodes with large majors properly
Package: udev
Version: 0.050-3
Severity: normal
I was testing the possibility of using a large major (that is, a major > 255) for
a character device driver I am working on, the ib_umad InfiniBand MAD user access
module. This driver is merged upstream post 2.6.10, although the in-tree version
will not use a large major. In any case, I tried modifying the driver code so
that the character device was registered with major 300.
Everything seems to work on the kernel side:
# grep infiniband_mad /proc/devices
300 infiniband_mad
# cat /sys/class/
300:0
I have the rule
KERNEL="umad*", NAME="infiniban
in my rules file, and in fact udev wants to do the right thing:
# udevtest /class/
version 050
looking at '/class/
opened class_dev-
configured rule in '/etc/udev/
creating device node '/dev/infiniban
but in the end the major number gets truncated:
# stat -c %t:%T /dev/infiniband
2c:0
(0x2c is 44 decimal, which is 300 - 256 of course)
I'm not sure if this is a udev bug, a C library bug, or a problem with how udev is
built, but I'll start the report under udev.
-- Package-specific info:
-- /etc/udev/rules.d/:
/etc/udev/rules.d/:
total 0
lrwxr-xr-x 1 root root 13 Jul 2 2004 udev.rules -> ../udev.rules
lrwxr-xr-x 1 root root 12 Dec 30 20:53 z_hal-plugdev.rules -> ../hal.rules
-- /sys/:
/sys/block/fd0/dev
/sys/block/hda/dev
/sys/block/
/sys/block/
/sys/block/
/sys/block/
/sys/block/
/sys/block/
/sys/block/
/sys/block/
/sys/block/
/sys/block/
/sys/block/hdc/dev
/sys/block/ram0/dev
/sys/block/ram1/dev
/sys/block/
/sys/block/
/sys/block/
/sys/block/
/sys/block/
/sys/block/
/sys/block/ram2/dev
/sys/block/ram3/dev
/sys/block/ram4/dev
/sys/block/ram5/dev
/sys/block/ram6/dev
/sys/block/ram7/dev
/sys/block/ram8/dev
/sys/block/ram9/dev
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class/
/sys/class...
Debian Bug Importer (debzilla) wrote : | #10 |
Message-ID: <email address hidden>
Date: Tue, 11 Jan 2005 16:15:39 -0800
From: Greg KH <email address hidden>
To: Roland Dreier <email address hidden>, <email address hidden>
Cc: Debian Bug Tracking System <email address hidden>
Subject: Re: Bug#289945: udev: does not create device nodes with large majors properly
On Tue, Jan 11, 2005 at 03:56:00PM -0800, Roland Dreier wrote:
>
> I'm not sure if this is a udev bug, a C library bug, or a problem with how udev is
> built, but I'll start the report under udev.
glibc "issue" Try upgrading it to a newer version.
To test this out, try grabbing the udev tarball and building it:
make
then as root:
make test
It should fail on the test "big minor number test" or "big major number
test" and "big major and big minor number test" (sorry I don't remember
the number of the test.)
Then try this:
make clean
make USE_KLIBC=true
and then as root:
make test
Odds are those tests then pass. If so, it's a glibc thing.
thanks,
greg k-h
Debian Bug Importer (debzilla) wrote : | #11 |
Message-ID: <email address hidden>
Date: Tue, 11 Jan 2005 16:34:58 -0800
From: Roland Dreier <email address hidden>
To: Greg KH <email address hidden>
Cc: <email address hidden>,
Debian Bug Tracking System <email address hidden>
Subject: Re: Bug#289945: udev: does not create device nodes with large
majors properly
Greg> glibc "issue" Try upgrading it to a newer version.
Looks like it. The udev tests behave as you say, and even simpler,
the following program prints "0x12c00" but creates /dev/infiniband/xxx
with major 0x2c. This is with Debian libc6 2.3.2.ds1-20, which is the
newest available in Debian. Do you happen to know which glibc version
has the fix for mknod?
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
printf("0x%x\n", makedev(300, 0));
mknod(
return 0;
}
Thanks,
Roland
Debian Bug Importer (debzilla) wrote : | #12 |
Message-ID: <email address hidden>
Date: Tue, 11 Jan 2005 16:39:27 -0800
From: Greg KH <email address hidden>
To: Roland Dreier <email address hidden>
Cc: <email address hidden>
Subject: Re: Bug#289945: udev: does not create device nodes with large majors properly
On Tue, Jan 11, 2005 at 04:34:58PM -0800, Roland Dreier wrote:
> Greg> glibc "issue" Try upgrading it to a newer version.
>
> Looks like it. The udev tests behave as you say, and even simpler,
> the following program prints "0x12c00" but creates /dev/infiniband/xxx
> with major 0x2c. This is with Debian libc6 2.3.2.ds1-20, which is the
> newest available in Debian. Do you happen to know which glibc version
> has the fix for mknod?
No idea, I don't run Debian on any of my boxes :)
Good luck,
greg k-h
Debian Bug Importer (debzilla) wrote : | #13 |
Message-ID: <email address hidden>
Date: Tue, 11 Jan 2005 17:47:52 -0800
From: Roland Dreier <email address hidden>
To: <email address hidden>
Subject: Re: Bug#289945: udev: does not create device nodes with large
majors properly
(I guess this bug should be reassigned to libc6)
It seems that the change to glibc's mknod was applied about 15 months
ago, between glibc 2.3.2 and glibc 2.3.3. Here's the patch taken from
glibc CVS:
Index: glibc-2.
=======
--- glibc-2.
+++ glibc-2.
@@ -35,7 +35,7 @@
int
__xmknod (int vers, const char *path, mode_t mode, dev_t *dev)
{
- unsigned short int k_dev;
+ unsigned long long int k_dev;
if (vers != _MKNOD_VER)
{
@@ -44,9 +44,12 @@
}
/* We must convert the value to dev_t type used by the kernel. */
- k_dev = ((major (*dev) & 0xff) << 8) | (minor (*dev) & 0xff);
+ k_dev = (*dev) & ((1ULL << 32) - 1);
+ if (k_dev != *dev)
+ return EOVERFLOW;
- return INLINE_SYSCALL (mknod, 3, CHECK_STRING (path), mode, k_dev);
+ return INLINE_SYSCALL (mknod, 3, CHECK_STRING (path), mode,
+ (unsigned int) k_dev);
}
weak_alias (__xmknod, _xmknod)
Debian Bug Importer (debzilla) wrote : | #14 |
Message-ID: <email address hidden>
Date: Wed, 12 Jan 2005 10:02:22 +0100
From: <email address hidden> (Marco d'Itri)
To: Roland Dreier <email address hidden>, <email address hidden>
Cc: <email address hidden>, <email address hidden>
Subject: please add support for long long dev_t
--NMuMz9nt05w80d4+
Content-Type: text/plain; charset=us-ascii
Content-
Content-
reassign 289945 libc6
retitle 289945 please add support for long long dev_t
tag 289945 patch upstream
thanks
Please apply to allow udev to create nodes for drivers which need more
than 2^8 minors.
On Jan 12, Roland Dreier <email address hidden> wrote:
> (I guess this bug should be reassigned to libc6)
>=20
> It seems that the change to glibc's mknod was applied about 15 months
> ago, between glibc 2.3.2 and glibc 2.3.3. Here's the patch taken from
> glibc CVS:
>=20
> Index: glibc-2.
> =3D=3D=
=3D=3D=
=3D=3D=
> --- glibc-2.
=2E000000000 -0700
> +++ glibc-2.
74232 -0800
> @@ -35,7 +35,7 @@
> int
> __xmknod (int vers, const char *path, mode_t mode, dev_t *dev)
> {
> - unsigned short int k_dev;
> + unsigned long long int k_dev;
> =20
> if (vers !=3D _MKNOD_VER)
> {
> @@ -44,9 +44,12 @@
> }
> =20
> /* We must convert the value to dev_t type used by the kernel. */
> - k_dev =3D ((major (*dev) & 0xff) << 8) | (minor (*dev) & 0xff);
> + k_dev =3D (*dev) & ((1ULL << 32) - 1);
> + if (k_dev !=3D *dev)
> + return EOVERFLOW;
> =20
> - return INLINE_SYSCALL (mknod, 3, CHECK_STRING (path), mode, k_dev);
> + return INLINE_SYSCALL (mknod, 3, CHECK_STRING (path), mode,
> + (unsigned int) k_dev);
> }
> =20
> weak_alias (__xmknod, _xmknod)
--=20
ciao,
Marco
--NMuMz9nt05w80d4+
Content-Type: application/
Content-
Content-
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQFB5OeeFGf
L+6Nm2qrUD05YRK
=efQP
-----END PGP SIGNATURE-----
--NMuMz9nt05w80
Debian Bug Importer (debzilla) wrote : | #15 |
Message-ID: <email address hidden>
Date: Wed, 12 Jan 2005 13:12:22 -0800
From: Roland Dreier <email address hidden>
To: <email address hidden>
Subject: Re: Bug#289945: udev: does not create device nodes with large
majors properly
reassign 289945 libc6
thanks
Debian Bug Importer (debzilla) wrote : | #16 |
Message-ID: <email address hidden>
Date: Thu, 13 Jan 2005 19:56:24 +0900
From: GOTO Masanori <email address hidden>
To: <email address hidden>
Subject: Re: please add support for long long dev_t
tags 289945 fixed-upstream
thanks
Jeff Bailey (jbailey) wrote : | #17 |
Fixed in Breezy's glibc update.
In Debian Bug tracker #289945, GOTO Masanori (gotom) wrote : Bug#289945: fixed in glibc 2.3.5-3 | #18 |
Source: glibc
Source-Version: 2.3.5-3
We believe that the bug you reported is fixed in the latest version of
glibc, which is due to be installed in the Debian FTP archive:
glibc-doc_
to pool/main/
glibc_2.
to pool/main/
glibc_2.3.5-3.dsc
to pool/main/
libc6-dbg_
to pool/main/
libc6-dbg_
to pool/main/
libc6-dbg_
to pool/main/
libc6-dbg_
to pool/main/
libc6-dbg_
to pool/main/
libc6-dbg_
to pool/main/
libc6-dbg_
to pool/main/
libc6-dbg_
to pool/main/
libc6-dev-
to pool/main/
libc6-dev-
to pool/main/
libc6-dev-
to pool/main/
libc6-dev_
to pool/main/
libc6-dev_
to pool/main/
libc6-dev_
to pool/main/
libc6-dev_
to pool/main/
libc6-dev_
to pool/main/
libc6-dev_
to pool/main/
libc6-dev_
to pool/main/
libc6-dev_
to pool/main/
libc6-i686_
to pool/main/
libc6-pic_
to pool/main/
libc6-pic_
to pool/main/
libc6-pic_
to pool/main/
libc6-pic_
to pool/main/
libc6-pic_
to pool/main/
libc6-pic_
to pool/main/
libc6-pic_
to pool/main/
libc6-pic_
to pool/main/
libc6-ppc64_
to pool/main/
libc6-prof_
to pool/main/
libc6-prof_
to pool/main/
libc6-prof_
to pool/main/
libc6-prof_
to pool/main/
libc6-prof_
to pool/main/
libc6-prof_
to pool/main/
libc6-prof_
Debian Bug Importer (debzilla) wrote : | #19 |
Message-Id: <email address hidden>
Date: Fri, 05 Aug 2005 03:29:24 -0700
From: GOTO Masanori <email address hidden>
To: <email address hidden>
Subject: Bug#289945: fixed in glibc 2.3.5-3
Source: glibc
Source-Version: 2.3.5-3
We believe that the bug you reported is fixed in the latest version of
glibc, which is due to be installed in the Debian FTP archive:
glibc-doc_
to pool/main/
glibc_2.
to pool/main/
glibc_2.3.5-3.dsc
to pool/main/
libc6-dbg_
to pool/main/
libc6-dbg_
to pool/main/
libc6-dbg_
to pool/main/
libc6-dbg_
to pool/main/
libc6-dbg_
to pool/main/
libc6-dbg_
to pool/main/
libc6-dbg_
to pool/main/
libc6-dbg_
to pool/main/
libc6-dev-
to pool/main/
libc6-dev-
to pool/main/
libc6-dev-
to pool/main/
libc6-dev_
to pool/main/
libc6-dev_
to pool/main/
libc6-dev_
to pool/main/
libc6-dev_
to pool/main/
libc6-dev_
to pool/main/
libc6-dev_
to pool/main/
libc6-dev_
to pool/main/
libc6-dev_
to pool/main/
libc6-i686_
to pool/main/
libc6-pic_
to pool/main/
libc6-pic_
to pool/main/
libc6-pic_
to pool/main/
libc6-pic_
to pool/main/
libc6-pic_
to pool/main/
libc6-pic_
to pool/main/
libc6-pic_
to pool/main/
libc6-pic_
to pool/main/
libc6-ppc64_
to pool/main/
libc6-prof_
to pool/main/
libc6-prof_
to pool/main/
libc6-prof_
to pool/main/
libc6-prof_
to pool/main/
On Tue, Jan 11, 2005 at 03:56:00PM -0800, Roland Dreier wrote:
>
> I'm not sure if this is a udev bug, a C library bug, or a problem with how udev is
> built, but I'll start the report under udev.
glibc "issue" Try upgrading it to a newer version.
To test this out, try grabbing the udev tarball and building it:
make
then as root:
make test
It should fail on the test "big minor number test" or "big major number
test" and "big major and big minor number test" (sorry I don't remember
the number of the test.)
Then try this:
make clean
make USE_KLIBC=true
and then as root:
make test
Odds are those tests then pass. If so, it's a glibc thing.
thanks,
greg k-h