Skip to contentSkip to conversation

Bug#274860: Acknowledgement (kernel-image-2.6.8-1-686: CDROM_SEND_PACKET ioctls only work as root)

DISCUSSION Luke Kenneth Casson Leighton 3 participants 5 messages Oct 4, 2004 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

found it.

it's a new piece of kernel code verify_command in drivers/block/scsi_ioctl.c, which checks for the capability CAP_SYS_RAWIO.

ah, dammit.

for k3b to work, you'd have to install it setuid root, call getcap(), remove all but the necessary capabilities (i.e. don't remove CAP_SYS_RAWIO), do a setfsuid() and setfsgid() and do a setcap().

fuse (file system in userspace) uses this technique for allowing mount and unmount but nothing else

[which doesn't work on 2.6.8 btw: the getcap() fails, but i did notice that debian doesn't install fusermount as setuid to root which is half the problem...]

l.

Quoted 64 lines · Luke Kenneth Casson Leighton

additional info:

kernel 2.6.8. ioctl ("/dev/hdc", CDROM_SEND_PACKET, cmd)

commands that are failing as non-root, even when permission is granted rwxrwxrwx to /dev/hdc, are, according to some debug info added to k3b:

GET CONFIGURATION (46)
error code: 0
sense key: NO SENSE (2)
asc: 0
ascq: 0

and:

MODE SELECT (55)
error code: 0
sense key: NO SENSE (2)
asc: 0
ascq: 0

the result is that k3b cannot determine that the drive exists, therefore it cannot use it even though cdrecord might actually work.

as root, the following errors occur:

	MODE SELECT (46)
	errorcode: 70
	sense key: ILLEGAL REQUEST (5)
	asc: 26
	ascq: 0

	READ DVD STRUCTURE (ad)
	errorcode: 70
	sense key: NOT READY (2)
	asc: 3a
	ascq: 0

presumably it can be concluded that the GET CONFIGURATION ioctl command is the one at fault.

... what gives?

l.

Signature · 16 lines
--
Truth, honesty and respect are rare commodities that all spring from
the same well: Love.  If you love yourself and everyone and everything
around you, funnily and coincidentally enough, life gets a lot better.
--
<a href="http://lkcl.net">      lkcl.net      </a> <br />
<a href="mailto:[email protected]"> [email protected] </a> <br />

-- 
--
Truth, honesty and respect are rare commodities that all spring from
the same well: Love.  If you love yourself and everyone and everything
around you, funnily and coincidentally enough, life gets a lot better.
--
<a href="http://lkcl.net">      lkcl.net      </a> <br />
<a href="mailto:[email protected]"> [email protected] </a> <br />
Signature · 7 lines
--
Truth, honesty and respect are rare commodities that all spring from
the same well: Love.  If you love yourself and everyone and everything
around you, funnily and coincidentally enough, life gets a lot better.
--
<a href="http://lkcl.net">      lkcl.net      </a> <br />
<a href="mailto:[email protected]"> [email protected] </a> <br />
#4 lore raw
Quoted 6 lines · Luke Kenneth Casson Leighton

found it.

it's a new piece of kernel code verify_command in drivers/block/scsi_ioctl.c, which checks for the capability CAP_SYS_RAWIO.

Quoted 6 lines

ah, dammit.

for k3b to work, you'd have to install it setuid root, call getcap(), remove all but the necessary capabilities (i.e. don't remove CAP_SYS_RAWIO), do a setfsuid() and setfsgid() and do a setcap().

it works in 2.6.9-rcX.

Signature · 1 line
Jens Axboe
#5 lore raw
Quoted 7 lines · Jens Axboe
Quoted 6 lines · Luke Kenneth Casson Leighton

found it.

it's a new piece of kernel code verify_command in drivers/block/scsi_ioctl.c, which checks for the capability CAP_SYS_RAWIO.

Quoted 8 lines
Quoted 6 lines

ah, dammit.

for k3b to work, you'd have to install it setuid root, call getcap(), remove all but the necessary capabilities (i.e. don't remove CAP_SYS_RAWIO), do a setfsuid() and setfsgid() and do a setcap().

it works in 2.6.9-rcX.

okay so someone has added the GET_CAPABILITY to verify_command in scsi_block.c there, yes?

#6 lore raw
Quoted 15 lines · Luke Kenneth Casson Leighton
Quoted 14 lines · Jens Axboe
Quoted 12 lines · Luke Kenneth Casson Leighton

found it.

it's a new piece of kernel code verify_command in drivers/block/scsi_ioctl.c, which checks for the capability CAP_SYS_RAWIO.

ah, dammit.

for k3b to work, you'd have to install it setuid root, call getcap(), remove all but the necessary capabilities (i.e. don't remove CAP_SYS_RAWIO), do a setfsuid() and setfsgid() and do a setcap().

Quoted 4 lines
Quoted 1 line

it works in 2.6.9-rcX.

okay so someone has added the GET_CAPABILITY to verify_command in scsi_block.c there, yes?

GET_CONFIGURATION, yes. There have been a number of additions since 2.6.8.

Signature · 1 line
Jens Axboe
#7 lore raw
In reply to Jens Axboe
Quoted 10 lines · Jens Axboe
Quoted 8 lines · Luke Kenneth Casson Leighton

found it.

it's a new piece of kernel code verify_command in drivers/block/scsi_ioctl.c, which checks for the capability CAP_SYS_RAWIO.

ah, dammit.

Quoted 8 lines
Quoted 4 lines

for k3b to work, you'd have to install it setuid root, call getcap(), remove all but the necessary capabilities (i.e. don't remove CAP_SYS_RAWIO), do a setfsuid() and setfsgid() and do a setcap().

it works in 2.6.9-rcX.

I don't know for sure if this is related or not, but it sure sounds like it. I have noticed the following in at least the last few versions (I believe 2.6.9-rc2 also): Even though CONFIG_SECURITY_CAPABILITIES can be configured as a module, if I don't compile it into the kernel getcap and setcap fail.

kr