Bug#396570: mdadm: Incorrect error message for insufficient permission

Rob Sims debbugs-z at robsims.com
Fri Jan 29 22:44:27 UTC 2010


On Sat, Jan 30, 2010 at 10:59:34AM +1300, martin f krafft wrote:
> notfixed 396570 3.0
> found 396570 3.0.3-2
> fixed 396570 3.1.1-1
> thanks
> 
> It's fixed in 3.1.1:
> 
> mdadm-lab:~# su nobody -c '/sbin/mdadm --remove /dev/md0 /dev/hda1'
> mdadm: error opening /dev/md0: Permission denied
> mdadm-lab:~# mdadm --version
> mdadm - v3.1.1 - 19th November 2009

Still not fixed:
$  mdadm --remove /dev/md0 /dev/sdd1
mdadm: /dev/md0 does not appear to be an md device
$ mdadm --version
mdadm - v3.1.1 - 19th November 2009

I get the same results as you for user nobody.

Didn't look before, but it appears I have rw permission on the md0
device:
$ ll /dev/md0
brw-rw---- 1 root disk 9, 0 Jan 28 02:51 /dev/md0

The open succeeds, the ioctl fails:
open("/dev/md0", O_RDWR|O_LARGEFILE)    = 3
fstat64(3, {st_mode=S_IFBLK|0660, st_rdev=makedev(9, 0), ...}) = 0
ioctl(3, 0x800c0910, 0xbfa5a7a4)        = -1 EACCES (Permission denied)
close(3)                                = 0
write(2, "mdadm: /dev/md0 does not appear "..., 51) = 51
exit_group(1)                           = ?


So I traced it:
Breakpoint 2, main (argc=4, argv=0xbffff4c4) at mdadm.c:989
989                             mdfd = open_mddev(devlist->devname, 1);
open_mddev (dev=0xbffff66f "/dev/md0", report_errors=1) at mdopen.c:391
391     {
392             int mdfd = open(dev, O_RDWR);
393             if (mdfd < 0) {
392             int mdfd = open(dev, O_RDWR);
393             if (mdfd < 0) {
399             if (md_get_version(mdfd) <= 0) {
md_get_version (fd=5) at util.c:116
116     {
120         if (fstat(fd, &stb)<0)
fstat (fd=5) at /usr/include/sys/stat.h:469
469       return __fxstat (_STAT_VER, __fd, __statbuf);
md_get_version (fd=5) at util.c:120
120         if (fstat(fd, &stb)<0)
122         if ((S_IFMT&stb.st_mode) != S_IFBLK)
125         if (ioctl(fd, RAID_VERSION, &vers) == 0)
127         if (errno == EACCES)
129         if (major(stb.st_rdev) == MD_MAJOR)
132     }
open_mddev (dev=0xbffff66f "/dev/md0", report_errors=1) at mdopen.c:400
400                     close(mdfd);
401                     if (report_errors)
402                             fprintf(stderr, Name ": %s does not appear to be "
mdadm: /dev/md0 does not appear to be an md device
407     }
main (argc=4, argv=0xbffff4c4) at mdadm.c:990
990                             if (mdfd < 0)
989                             mdfd = open_mddev(devlist->devname, 1);
990                             if (mdfd < 0)
1264                                    exit(1);

Program exited with code 01.

> -- 
>  .''`.   martin f. krafft <madduck at d.o>      Related projects:
> : :'  :  proud Debian developer               http://debiansystem.info
> `. `'`   http://people.debian.org/~madduck    http://vcs-pkg.org
>   `-  Debian - when you have better things to do than fixing systems
>  
> "a human being should be able to change a diaper, plan an invasion,
>  butcher a hog, conn a ship, design a building, write a sonnet,
>  balance accounts, build a wall, set a bone, comfort the dying, take
>  orders, give orders, cooperate, act alone, solve equations, analyze
>  a new problem, pitch manure, program a computer, cook a tasty meal,
>  fight efficiently, die gallantly. specialization is for insects."
>                                                   -- robert heinlein



-- 
Rob
  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-mdadm-devel/attachments/20100129/ae966b17/attachment-0001.pgp>


More information about the pkg-mdadm-devel mailing list