Linux device number bug report

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have some questions about device
number
extension.

In Linux kernel 2.6, device number will be extended from 16-bit to 32-bit. All utilities and libraries should make corresponding extension for this new feature in kernel 2.6.

I find that “rpm-4.2.1-4.2” uses structure dev_t and operates the device number
as 16-bit.
------------------------------------------------------------------------------------------
1. system.h line 76 and file/system.h line 165 :
#ifndef HAVE_MAJOR
#define major(dev)  (((dev) >> 8) & 0xff)
#define minor(dev)  ((dev) & 0xff)
#define makedev(maj, min)  (((maj) << 8) | (min))
#endif
 
This is a backup for lost of system defined macro, but all of these operations look dev_t as 16 bits instead of 32 bits, so they will call problem in current  situation.
------------------------------------------------------------------------------------------
 
2. build/files.c line 485 and 501
if (!(fl->devmajor >= 0 && fl->devmajor < 256))
if (!(fl->devminor >= 0 && fl->devminor < 256))
 
This sentence confirm the range of major device number and minor device number. But major device is 12bits and minor device is 20 bits now, so their max value isn't 255 any more.
------------------------------------------------------------------------------------------------------
 
3. build/files.c line 1234
if (sizeof(flp->fl_rdev) != sizeof(uint_16))
    uint_16 prdev = (uint_16)flp->fl_rdev;
 
flp->fl_rdev is dev_t type and it is 32 bits, so this assign 32bits to 16 bits, it may cause problem.
------------------------------------------------------------------------------------------------------
 
4. lib/verify.c line 180
uint_16 st_rdev = (sb.st_rdev & 0xffff);
 
sb is a stat struct and sb.st_rdev is dev_t type; this operation still deal dev_t as 16 bits.
------------------------------------------------------------------------------------------------------
 
5. rpmio/rpmrpc.c line 695
st->st_rdev = ((maj & 0xff) << 8) | (min & 0xffff00ff);
 
use major device number and minor device number to construct dev_t, the result st->st_rdev may look like this:
1111 1111 1111 1111 MMMM MMMM mmmm mmmm
But the correct result should be:
mmmm mmmm mmmm MMMM MMMM MMMM mmmm mmmm
"M" means major device number.
"m" means minor device number.
 ------------------------------------------------------------------------------------------------------
 
6. build/files.c line 1546
statp->st_rdev = ((fl->devmajor & 0xff) << 8) | (fl->devminor & 0xff);
 
this use the similar method as makedev() list befor to get device number. so it has the same problem.
------------------------------------------------------------------------------------------------------
 
7. lib/fsm.c line 704 
dev_t finalRdev = (fi->frdevs ? fi->frdevs[i] : 0);
This assign fi->frdevs[i] to finalRdev if fi->frdevs isn't NULL. but fi->frdevs[i] is unsigned short type, 16 bits and finalRdev is dev_t type, 32 bits; so it may cause problem.
------------------------------------------------------------------------------------------------------
 

Since I didn’t find any information about this aspect in homepage of this package, I wonder whether the latest version has completed the device number extension? If not, will it be completed in the future? And when?

Looking forward to answering.

 

Best Regards
--------------------------------------------------
Zhou Wei
Dept. of Technology and Development
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
No. 16-5, Guanzhou Rd., Nanjing, P.R.China
PHONE: +86+25-6630523-633
FUJITSU INTERNAL: 79955-633
FAX: +86+25-3317685
Mail: zhouwei@xxxxxxxxxxxxxxxx
--------------------------------------------------


[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux