public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Messer <andreas.messer@gmx.de>
To: Frank Steiner <fsteiner-mail@bio.ifi.lmu.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: 2.6.8.1 Mis-detect CRDW as CDROM
Date: Tue, 17 Aug 2004 13:11:06 +0200	[thread overview]
Message-ID: <200408171311.06222.satura@proton> (raw)
In-Reply-To: <4121A689.8030708@bio.ifi.lmu.de>

Frank Steiner wrote:

> So what's the target in this process? Should users finally be able to
> write cds again without or only with suid bit set? It would be good to
> know if I should try to set all cd writing applications suid or just
> have to wait for some patches coming up that would allow users to
> write cds without suid again...

I have now reviewed my changes to allow users-cdrecording using 
the mmc4-spec 
  http://www.t10.org/ftp/t10/drafts/mmc4/mmc4r03a.pdf
Someone should check, if i set the permissions the right way. I have not used 
the infomation Marc Ballarin, as i think the spec is more recent than the 
programms. Perhaps there have some commands for old recorders to be added, 
but i'm not sure if so much people use such old recorders.
My changes also include some things for reading and playing cds. The rest of 
the commands mentioned in the mmc4-spec is already defined in the basic 
commands.

>
> If the programs must be set suid, is that safe? In the past I was
> always told that setting e.g. cdrecord suid was a possible security issue.
> But I really don't understand enough of the new security model in the
> kernel to judge if that's right or wrong...

I don't think setting an application suid is the right way. If the rules are 
changed the right way, rights for accessing devices may be set up clearer - 
eg one usergroup may use the recorder for recording and another not. If 
setting cdrecord siud root, this won't work.

>
> Can someone enlighten me? :-)
>
> cu,
> Frank

Here are my suggested changes:

-- linux-2.6.8.1/drivers/block/scsi_ioctl.c	2004-08-16 21:44:53.000000000 
+0200
+++ linux/drivers/block/scsi_ioctl.c	2004-08-17 13:04:04.000000000 +0200
@@ -156,6 +156,53 @@
 		safe_for_write(WRITE_16),
 		safe_for_write(WRITE_BUFFER),
 		safe_for_write(WRITE_LONG),
+
+
+		/* Some additional defs for recording/reading CDs */
+
+		/* 0x01 REZERO_UNIT used by k3b, but also work without */
+               
+		/* read-mode */
+		safe_for_read(GPCMD_GET_CONFIGURATION),
+		safe_for_read(GPCMD_GET_EVENT_STATUS_NOTIFICATION),
+		safe_for_read(GPCMD_GET_PERFORMANCE),
+		safe_for_read(GPCMD_MECHANISM_STATUS),
+
+		/* should this allowed for read ? */
+		safe_for_read(GPCMD_LOAD_UNLOAD),
+		safe_for_read(GPCMD_SET_SPEED),
+		safe_for_read(GPCMD_PAUSE_RESUME),   /* playing audio cd */
+		safe_for_read(SEEK_10),              /* playing audio cd */
+		safe_for_read(GPCMD_SET_READ_AHEAD),
+		safe_for_read(GPCMD_SET_STREAMING),
+		safe_for_read(GPCMD_STOP_PLAY_SCAN), /* playing audio cd */
+
+		/* k3b wont work without read - maybe bug in k3b, but 
+		   MODE_SELECT_10 seems not to be destructive */
+		safe_for_read(GPCMD_MODE_SELECT_10), 
+
+		/* write-mode */
+		safe_for_write(GPCMD_BLANK), 
+		safe_for_write(GPCMD_CLOSE_TRACK),
+		safe_for_write(0x2c),        /* ERASE_10 */ 
+		safe_for_write(GPCMD_FORMAT_UNIT),
+		safe_for_write(GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL),
+		safe_for_write(0x5c),        /* READ_BUFFER_CAPACITY */
+		safe_for_write(GPCMD_READ_FORMAT_CAPACITIES),
+		safe_for_write(GPCMD_REPAIR_RZONE_TRACK),
+		safe_for_write(GPCMD_RESERVE_RZONE_TRACK),
+		safe_for_write(0x5d),        /* SEND_CUE_SHEET */
+		safe_for_write(0xbf),        /* SEND_DVD_STRUCTURE */
+		safe_for_write(GPCMD_SEND_KEY),
+		safe_for_write(GPCMD_SEND_OPC),
+		safe_for_write(SYNCHRONIZE_CACHE),
+		safe_for_write(VERIFY),
+
+		/* Disabled, may change firmware 
+		   safe_for_write(0x3b),  WRITE_BUFFER */
+		/* Disabled due useless without WRITE_BUFFER 
+		   safe_for_write(0x3c),  READ_BUFFER */
+
 	};
 	unsigned char type = cmd_type[cmd[0]];
 
@@ -173,6 +220,14 @@
 	if (capable(CAP_SYS_RAWIO))
 		return 0;
 
+        /* Added for debugging*/
+       
+	if(file->f_mode & FMODE_WRITE)
+	  printk(KERN_WARNING "SCSI-CMD Filter: 0x%x not allowed with 
write-mode\n",cmd[0]);
+	else
+	  printk(KERN_WARNING "SCSI-CMD Filter: 0x%x not allowed with 
read-mode\n",cmd[0]);
+
+
 	/* Otherwise fail it with an "Operation not permitted" */
 	return -EPERM;
 }


regards
Andreas
-- 
gnuPG keyid: 0xE94F63B7 fingerprint: D189 D5E3 FF4B 7E24 E49D 7638 07C5 924C 
E94F 63B7

  reply	other threads:[~2004-08-17 11:11 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-15 21:43 2.6.8.1 Mis-detect CRDW as CDROM John Wendel
2004-08-15 20:53 ` Alan Cox
2004-08-15 23:24   ` John Wendel
2004-08-15 23:10     ` Alan Cox
2004-08-16 12:38 ` Marc Ballarin
2004-08-16 13:03   ` Alan Cox
2004-08-16 14:58     ` Frank Steiner
2004-08-16 17:44     ` Kronos
2004-08-16 17:57     ` Marc Ballarin
2004-08-16 19:09       ` Marc Ballarin
2004-08-16 19:33         ` Kai Makisara
2004-08-16 21:12     ` Marc Ballarin
2004-08-17  6:32       ` Frank Steiner
2004-08-17 11:11         ` Andreas Messer [this message]
2004-08-17 15:59           ` [PATCH] " Andreas Messer
2004-08-17 17:27             ` [RFC] list of SCSI commands Marc Ballarin
2004-08-17 17:56               ` Andreas Messer
2004-08-17 19:43             ` [PATCH] 2.6.8.1 Mis-detect CRDW as CDROM Martin Schlemmer
2004-08-18  8:47             ` Frank Steiner
2004-08-18  9:09               ` Frank Steiner
2004-08-18  9:50                 ` [RFC] New security model for scsi_cmd_ioctl Andreas Messer
2004-08-18 12:01             ` [PATCH] 2.6.8.1 Mis-detect CRDW as CDROM Frank Steiner
2004-08-18 12:20               ` Marc Ballarin
2004-08-18 12:27                 ` Frank Steiner
2004-08-18 14:08               ` Frank Steiner
2004-08-17 11:29         ` Christer Weinigel
2004-08-17 11:59           ` Christer Weinigel
2004-08-17 13:25           ` Marc Ballarin
2004-08-17 11:41         ` Marc Ballarin
2004-08-17 13:03           ` Petri Kaukasoina
2004-08-17 14:27     ` [PATCH] update defines in cdrom.h Marc Ballarin
2004-08-17 15:19       ` [PATCH] update + fix " Marc Ballarin
2004-08-16 13:32   ` 2.6.8.1 Mis-detect CRDW as CDROM Petri Kaukasoina
  -- strict thread matches above, loose matches on Subject: below --
2004-08-16  7:40 Wolfgang Scheicher
2004-08-16 15:17 ` Adam Jones
     [not found] <2tB3a-7rU-19@gated-at.bofh.it>
     [not found] ` <2tOWp-cF-5@gated-at.bofh.it>
     [not found]   ` <2tQlC-1kl-27@gated-at.bofh.it>
2004-08-16 15:06     ` Wolfgang Scheicher
2004-08-16 15:10       ` Frank Steiner
2004-08-16 15:33 Giacomo Perale
2004-08-17 11:14 Joerg Schilling
2004-08-17 11:47 ` Andreas Messer
2004-08-17 13:12 Joerg Schilling
2004-08-17 13:48 ` Andreas Messer

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=200408171311.06222.satura@proton \
    --to=andreas.messer@gmx.de \
    --cc=fsteiner-mail@bio.ifi.lmu.de \
    --cc=linux-kernel@vger.kernel.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