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 14:39:07 -0400	[thread overview]
Message-ID: <44CBAB4B.7050308@torque.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0607291005200.4168@g5.osdl.org>

Linus Torvalds wrote:
> 
> On Sat, 29 Jul 2006, James Bottomley wrote:
>> I concur.  If we're going to allow users access to burn CDs, it's
>> impossible to police them with certainty as this case indicates.
> 
> Not so. I can (and have) written tons of CD's as a normal user, with 
> perfect security.
> 
> No, the kernel shouldn't allow device-specific commands. That goes without 
> saying. Whether this is a sg.c problem, or a cdrecord problem is unclear, 
> I suspect it's the latter. 

Command filtering has always been dubious. The sg driver
takes the approach of allowing through a small number of
"safe" (often mandatory) SCSI _Primary_ Commands (SPC). It
takes no special account of the Multimedia Commands (MMC),
cdrecord or the SCSI Block Commands (SBC). The sg driver
filter does lean a little towards SBC by allowing the
READ CAPACITY command to be accessed O_RDONLY.

The block layer SG_IO filter bends over backwards to
support MMC and hence cdrecord. So it supports one
device _type_ specific class. Due to vendor specific
commands (e.g. from plextor) it cannot keep cdrecord
completely happy.

For a comparison of the two filters see table 3 in:
http://www.torque.net/sg/sg_io.html
That table highlights another difference between the
two filters:
  - sg: allow some commands to be accessed O_RDONLY
    and let all commands to be accessed O_RDWR
  - block SG_IO: has three states: allow some commands
    to be accessed O_RDONLY, a larger set O_RDWR and
    the rest with CAP_SYS_RAW_IO

The latter approach is harder to keep correct. Two glaring
faults are REPORT LUNS (mandatory since SPC-3) and
READ CAPACITY(16); both are "safe" but need CAP_SYS_RAW_IO
capability (usually root permissions). This may not annoy
cdrecord but it would peeve other pass through users.


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? When the sg driver was used to burn cd
and dvds in lk 2.4 series the window manager needed to
arrange for the GUI owner to have write permissions
on cd and dvd writing devices. No root permissions or
CAP_SYS_RAW_IO capability was needed.

Doug Gilbert

  parent reply	other threads:[~2006-07-29 18:39 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 [this message]
2006-07-29 18:54         ` Linus Torvalds
2006-07-29 20:12           ` Douglas Gilbert
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=44CBAB4B.7050308@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