public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kronos <kronos@kronoz.cjb.net>
To: linux-kernel@vger.kernel.org
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, John Wendel <jwendel10@comcast.net>
Subject: Re: 2.6.8.1 Mis-detect CRDW as CDROM
Date: Mon, 16 Aug 2004 19:44:50 +0200	[thread overview]
Message-ID: <20040816174450.GA3754@dreamland.darkstar.lan> (raw)
In-Reply-To: <1092661385.20528.25.camel@localhost.localdomain>

Alan Cox <alan@lxorguk.ukuu.org.uk> ha scritto:
> On Llu, 2004-08-16 at 13:38, Marc Ballarin wrote:
>> Due to the newly added command filtering, you now need to run cdrecord as
>> root. Since cdrecord will drop root privileges before accessing the drive,
>> setuid root won't help
> 
> cdrecord should be fine. k3b is issuing something not on the filter
> list.

cdrecord (from debian) does not work.

>> This patch restores the behaviour of previous kernels, security issues included:
> 
> Like allowing any user to erase your drive firmware. What you could do
> which is much more useful is printk the command byte that gets refused
> and see if you can pin down what commands are being blocked that
> are needed by K3B 

kronos:~$ cdrecord --version
Cdrecord-Clone 2.01a34 (i686-pc-linux-gnu) Copyright (C) 1995-2004 Jörg Schilling
NOTE: this version of cdrecord is an inofficial (modified) release of cdrecord
      and thus may have bugs that are not present in the original version.
      Please send bug reports and support requests to <cdrtools@packages.debian.org>.
      The original author should not be bothered with problems of this version.

This is mkisofs ... | cdrecord dev=/dev/hdd -tao - (as non-root user, I
have write access to the device):

verify_command: failed cmd 0x46
verify_command: failed cmd 0x46
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x5c

This is cdrecord dev=/dev/hdd blank=fast:

verify_command: failed cmd 0x46
verify_command: failed cmd 0x46
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x5c
verify_command: failed cmd 0x1e
verify_command: failed cmd 0x1
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x55
verify_command: failed cmd 0x35
verify_command: failed cmd 0x55
verify_command: failed cmd 0x1e

0x55 is MODE_SELECT_10 (not listed in verify_command)
0x01 is REZERO_UNIT (not listed in verify_command)
0x1e is ALLOW_MEDIUM_REMOVAL (not listed in verify_command)
0x35 is SYNCHRONIZE_CACHE (not listed in verify_command)

I can't find 0x46 in scsi/scsi.h... but from cdrecord sources
(cdrecord/scsi_mmc.c):

/*
 * Get feature codes
 */
EXPORT int
get_configuration(scgp, bp, cnt, st_feature, rt)
        SCSI    *scgp;
        caddr_t bp;
        int     cnt;
        int     st_feature;
        int     rt;
{
        register struct scg_cmd *scmd = scgp->scmd;

        fillbytes((caddr_t)scmd, sizeof (*scmd), '\0');
        scmd->addr = bp;
        scmd->size = cnt;
        scmd->flags = SCG_RECV_DATA|SCG_DISRE_ENA;
        scmd->cdb_len = SC_G1_CDBLEN;
        scmd->sense_len = CCS_SENSE_LEN;
  --->  scmd->cdb.g1_cdb.cmd = 0x46; <--- 
        scmd->cdb.g1_cdb.lun = scg_lun(scgp);
        if (rt & 1)
                scmd->cdb.g1_cdb.reladr  = 1;
        if (rt & 2)
                scmd->cdb.g1_cdb.res  =  1;

        i_to_2_byte(scmd->cdb.g1_cdb.addr, st_feature);
        g1_cdblen(&scmd->cdb.g1_cdb, cnt);

        scgp->cmdname = "get_configuration";
        
        return (scg_cmd(scgp));
}

Luca
-- 
Home: http://kronoz.cjb.net
You and me baby ain't nothin' but mammals
So let's do it like they do on the Discovery Channel

  parent reply	other threads:[~2004-08-16 17:45 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 [this message]
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
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=20040816174450.GA3754@dreamland.darkstar.lan \
    --to=kronos@kronoz.cjb.net \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=jwendel10@comcast.net \
    --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