public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Douglas Gilbert <dougg@torque.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: James Bottomley <James.Bottomley@SteelEye.com>,
	Jens Axboe <axboe@suse.de>, Dave Jones <davej@redhat.com>,
	linux-scsi@vger.kernel.org
Subject: Re: cd burning with plextor drives.
Date: Sat, 29 Jul 2006 16:12:05 -0400	[thread overview]
Message-ID: <44CBC115.2080401@torque.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0607291145250.4168@g5.osdl.org>

Linus Torvalds wrote:
> 
> On Sat, 29 Jul 2006, Douglas Gilbert wrote:
>> Command filtering has always been dubious.
> 
> No it has not.
> 
> Command filtering falls under the _very_ non-dubious heading of "of 
> _course_ we have to do it". There is absolutely zero doubt about it at 
> all. 
> 
> You literally have two choices:
>  - you can filter commands
>  - you can disallow all command access for non-specific-capability users.
> 
> Those are the two choices. There really is no third choice. The only 
> question is the details of _how_ you do the filtering and/or disallowing.
> 
>> If a user has read write permissions on
>> a full device (not just a partition in it) why shouldn't
>> they be able to send any (SCSI/ATA/...) pass through
>> command to it?
> 
> They have read-write access to the PLATTER. 
> 
> The fact that you may have access to write data to a disk does _not_ mean 
> that you must necessarily be able to set the password on the disk so that 
> nobody else can ever read or write data to that disk without your 
> permission.

See below. Non-root users do not usually have read
or write permissions to a _disk_. We were talking
about a different class of devices: cd/dvd drives.

> Quite frankly, if you don't see that as an "obvious", and that I'm 100% 
> right when I say that you have the above _two_ choices, and that your 
> choice simply is not a choice at all, but total idiocy, then I don't know 
> what to say.

Well if you want to filter, I'll be happy to find
flaws, both over and under filtering. Are you sure
SCSI commands are being sent through the pass through?
How about ATA commands tunnelled in SCSI commands
(already supported by libata). There was recent talk
of tunnelling SAS SMP functions through SCSI (SSP)
to name another (ab)use.

> Put another way: you will remove that command filtering in 
> block/scsi_ioctl.c only in a kernel that I don't maintain, or by disabling 
> it in some way that is so hidden that I won't notice. Because I'm not so 
> stupid as to think that it's ok for normal users to set driver passwords 
> or rewrite the disk firmware just because they have write permissions to 
> the device. That's pretty damn final.

You weren't at the storage summit. As stated in other
posts to this thread it was concluded that command
filtering is a flawed strategy. With that consensus
that leaves the "disallow all command access for
non-specific-capability users" option.

> But you can try to _improve_ the filtering. We've certainly done that 
> before. Quite frankly, I don't think there's a lot there that can be 
> improved upon any more, but it's certainly an option that we could change 
> that filtering to be (a) per-device and (b) allow root to explicitly 
> change it on a per-machine and per-device setting, with the current 
> filtering rules being just the "default rules".

By current rules I suppose you mean the block SG_IO rules. Do you really
mean "per-device" as in /dev/hdc or "per-device-type" as in disk versus
cd/dvd drive? The current rules are skewed towards MMC so far that
they are broken in that some SBC (i.e. hard disk) modifying commands
can slip through in the guise of innocent MMC commands.

> Then you could encode any additional rules you want in a /sbin/hotplug 
> script or something. But the filtering isn't going _anywhere_, and what 
> you suggest is just totally and utterly insane.

Sounds like you are playing the man and not the ball.
Why didn't you jump on either of these posts:
http://marc.theaimsgroup.com/?l=linux-scsi&m=115417174425242&w=2
http://marc.theaimsgroup.com/?l=linux-scsi&m=115418046812126&w=2
Hmm?


As you are no doubt aware, disk permissions and cd/dvd drive
permissions are set up differently:

$ df -hT
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/hda2     ext3     19G   15G  3.4G  82% /

$ ls -l /dev/hda /dev/hda2
brw-r----- 1 root disk 3, 0 Jul 29 05:14 /dev/hda
brw-r----- 1 root disk 3, 2 Jul 29 09:14 /dev/hda2

This email has been saved on /dev/hda2 but I don't have
permissions on it. I can't send any pass through commands
to /dev/hda or /dev/hda2 as a non-root user (unless
my user is in group 'disk' and the command only needs
O_RDONLY which rules out the SCSI WRITE command).

Here is my cd/dvd combo drive:

$ ls -l /dev/hdc
brw------- 1 dougg disk 22, 0 Jul 29 09:14 /dev/hdc

The GUI (kde of FC5) was started as user 'dougg' but
I'm writing this email as user 'torque' so I can't
access that cd/dvd drive at the pass through level.


There is another class of commands that the sg driver does
require CAP_SYS_RAW_IO capability for. Those are the ones
that do collateral damage. A bus reset command comes to
mind (also ATA soft resets on PATA can take out the other
device on the cable). IMO collateral damage is something
the OS should take special care with.

Doug Gilbert

  reply	other threads:[~2006-07-29 20:12 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-29  4:52 cd burning with plextor drives Dave Jones
2006-07-29 11:12 ` Jens Axboe
2006-07-29 13:40   ` James Bottomley
2006-07-29 15:39     ` Christer Weinigel
2006-07-29 17:06     ` Linus Torvalds
2006-07-29 17:30       ` James Bottomley
2006-07-29 17:49         ` Linus Torvalds
2006-07-30 16:02           ` Christer Weinigel
2006-07-30 19:57             ` Linus Torvalds
2006-07-30 20:18               ` Christian Iversen
2006-07-31  0:12               ` Christer Weinigel
2006-07-31 20:32                 ` Linus Torvalds
2006-07-31 20:38                   ` Dave Jones
2006-07-31 20:41                   ` Jens Axboe
2006-07-31 20:46                     ` Linus Torvalds
2006-08-01  6:54                       ` Jens Axboe
2006-07-29 18:39       ` Douglas Gilbert
2006-07-29 18:54         ` Linus Torvalds
2006-07-29 20:12           ` Douglas Gilbert [this message]
2006-07-29 20:33             ` Linus Torvalds
2006-07-29 20:53               ` Linus Torvalds
2006-07-29 22:13                 ` Arjan van de Ven
2006-07-30  5:57                   ` Matthew Wilcox
2006-07-30  9:38               ` Rogier Wolff
2006-07-30 18:02               ` Douglas Gilbert
2006-07-30 20:06                 ` Linus Torvalds
2006-07-29 21:40           ` Christer Weinigel
2006-07-30  5:56             ` Linus Torvalds
2006-07-29 17:04   ` Linus Torvalds
2006-07-29 17:22     ` Dave Jones
2006-07-30 10:21       ` Rogier Wolff
2006-07-30 10:31         ` Arjan van de Ven
2006-07-30 11:09         ` Steve McIntyre
2006-07-31  9:33       ` Jens Axboe
2006-07-31  9:32     ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44CBC115.2080401@torque.net \
    --to=dougg@torque.net \
    --cc=James.Bottomley@SteelEye.com \
    --cc=axboe@suse.de \
    --cc=davej@redhat.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox