[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#277083: kernel-image-2.6.8-1-686: Confirmed, also with -k7 version



On Fri, Nov 05, 2004 at 04:38:28PM +0900, Horms wrote:
> Hi,
> 
> this problem seems to be the problem discussed in the following LKML thread:
> http://testing.lkml.org/slashdot.php?mid=495924
> 
> In a nutshell, as a result of security concerns certain commands are not 
> allowed to be executed as a user. The net result is that in 2.6.8.1
> (which is what debian's 2.6.8 packages are based on) cdrecord
> must be run as root. 
> 
> There are patches in bittkepper that resolve this problem,
> I will try and pull them out and patch kernel-source-2.6.8.
> Watch this space.

Hi,

I took a look through this more closely, it does seem to relate to the
bug in the thread above.

This bug reports that 2.6.8-2 works fine and that 2.6.8-4 does not.

In 2.6.8-3, the SG_IO-safe-commands.dpatch was added,
which replaced the SG_IO-cap.dpatch patch. This should actually
help your problem, not hinder it, though that does not seem to be the
case.

In 2.6.8-4 SG_IO-safe-commands.dpatch was replaced with
SG_IO-safe-commands-2.dpatch which contains some _minor_ 
updates.

Looking through the bitkeeper logs I find two additional updates
which were included in the kernel.org 2.6.9. For reference I
will call them SG_IO-safe-commands-3.dpatch and
SG_IO-safe-commands-4.dpatch

I also found one patch which is pending for 2.6.10, which I will call
SG_IO-safe-commands-5.dpatch.

If you apply SG_IO-safe-commands-[345].dpatch to
kernel-source-2.6.8-4, 5, 6 or 7 you should get the behaviour
that is currently in bitkeeper. If you ommit
G_IO-safe-commands-5.dpatch then you should get the 2.6.9
behaviour.

I have attached all the relevant patches. If somone who is experiencing
this problem could take some time to test it out I would be very
helpful.

-- 
Horms
#! /bin/sh -e 
## <PATCHNAME>.dpatch by <PATCH_AUTHOR@EMAI>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Description: SCSI WRITE_BUFFER commands needs CAP_SYS_RAWIO
## DP: Patch author: Linux Torvalds <torvalds@osdl.org>
## DP: Upstream status: backport

. $(dirname $0)/DPATCH

@DPATCH@
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/08/14 03:24:55-07:00 torvalds@ppc970.osdl.org 
#   Make 'WRITE_BUFFER' require CAP_RAWIO capability
#   
#   Pointed out by Kai Makisara.
# 
# drivers/block/scsi_ioctl.c
#   2004/08/14 03:24:49-07:00 torvalds@ppc970.osdl.org +0 -1
#   Make 'WRITE_BUFFER' require CAP_RAWIO capability
#   
#   Pointed out by Kai Makisara.
# 
diff -Nru a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c
--- a/drivers/block/scsi_ioctl.c	2004-08-14 13:32:03 +02:00
+++ b/drivers/block/scsi_ioctl.c	2004-08-14 13:32:03 +02:00
@@ -154,7 +154,6 @@
 		safe_for_write(WRITE_12),
 		safe_for_write(WRITE_VERIFY_12),
 		safe_for_write(WRITE_16),
-		safe_for_write(WRITE_BUFFER),
 		safe_for_write(WRITE_LONG),
 	};
 	unsigned char type = cmd_type[cmd[0]];
#! /bin/sh -e 
## <PATCHNAME>.dpatch by <PATCH_AUTHOR@EMAI>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Description: Update list of safe SCSI commands for SG_IO
## DP: Patch author: Linux Torvalds, Jens Axboe
## DP: Upstream status: backport

. $(dirname $0)/DPATCH

@DPATCH@
--- linux-2.6.8/drivers/block/scsi_ioctl.c	2004-08-25 11:54:11.000000000 +0200
+++ linux-2.5/drivers/block/scsi_ioctl.c	2004-08-25 00:31:03.000000000 +0200
@@ -127,12 +127,16 @@
 		safe_for_read(MODE_SENSE),
 		safe_for_read(MODE_SENSE_10),
 		safe_for_read(START_STOP),
+		safe_for_read(GPCMD_VERIFY_10),
+		safe_for_read(VERIFY_16),
+		safe_for_read(READ_BUFFER),
 
 		/* Audio CD commands */
 		safe_for_read(GPCMD_PLAY_CD),
 		safe_for_read(GPCMD_PLAY_AUDIO_10),
 		safe_for_read(GPCMD_PLAY_AUDIO_MSF),
 		safe_for_read(GPCMD_PLAY_AUDIO_TI),
+		safe_for_read(GPCMD_PAUSE_RESUME),
 
 		/* CD/DVD data reading */
 		safe_for_read(GPCMD_READ_CD),
@@ -146,6 +150,12 @@
 		safe_for_read(GPCMD_READ_TOC_PMA_ATIP),
 		safe_for_read(GPCMD_REPORT_KEY),
 		safe_for_read(GPCMD_SCAN),
+		safe_for_read(GPCMD_GET_CONFIGURATION),
+		safe_for_read(GPCMD_READ_FORMAT_CAPACITIES),
+		safe_for_read(GPCMD_GET_EVENT_STATUS_NOTIFICATION),
+		safe_for_read(GPCMD_GET_PERFORMANCE),
+		safe_for_read(GPCMD_SEEK),
+		safe_for_read(GPCMD_STOP_PLAY_SCAN),
 
 		/* Basic writing commands */
 		safe_for_write(WRITE_6),
@@ -154,8 +164,25 @@
 		safe_for_write(WRITE_12),
 		safe_for_write(WRITE_VERIFY_12),
 		safe_for_write(WRITE_16),
-		safe_for_write(WRITE_BUFFER),
 		safe_for_write(WRITE_LONG),
+		safe_for_write(ERASE),
+		safe_for_write(GPCMD_MODE_SELECT_10),
+		safe_for_write(MODE_SELECT),
+		safe_for_write(GPCMD_BLANK),
+		safe_for_write(GPCMD_CLOSE_TRACK),
+		safe_for_write(GPCMD_FLUSH_CACHE),
+		safe_for_write(GPCMD_FORMAT_UNIT),
+		safe_for_write(GPCMD_REPAIR_RZONE_TRACK),
+		safe_for_write(GPCMD_RESERVE_RZONE_TRACK),
+		safe_for_write(GPCMD_SEND_DVD_STRUCTURE),
+		safe_for_write(GPCMD_SEND_EVENT),
+		safe_for_write(GPCMD_SEND_KEY),
+		safe_for_write(GPCMD_SEND_OPC),
+		safe_for_write(GPCMD_SEND_CUE_SHEET),
+		safe_for_write(GPCMD_SET_SPEED),
+		safe_for_write(GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL),
+		safe_for_write(GPCMD_LOAD_UNLOAD),
+		safe_for_write(GPCMD_SET_STREAMING),
 	};
 	unsigned char type = cmd_type[cmd[0]];
 
--- linux-2.6.8/include/linux/cdrom.h	2004-08-26 09:15:56.891296646 +0200
+++ linux-2.6.8/include/linux/cdrom.h	2004-08-26 09:14:34.434684402 +0200
@@ -468,6 +468,7 @@
 #define GPCMD_RESERVE_RZONE_TRACK	    0x53
 #define GPCMD_SCAN			    0xba
 #define GPCMD_SEEK			    0x2b
+#define GPCMD_SEND_CUE_SHEET    	    0x5d
 #define GPCMD_SEND_DVD_STRUCTURE	    0xad
 #define GPCMD_SEND_EVENT		    0xa2
 #define GPCMD_SEND_KEY			    0xa3
--- linux-2.6.8/include/scsi/scsi.h	2004-08-25 19:55:21.000000000 +0200
+++ linux-2.6.8/include/scsi/scsi.h	2004-08-26 09:12:24.594594554 +0200
@@ -111,6 +111,7 @@
 #define WRITE_LONG_2          0xea
 #define READ_16               0x88
 #define WRITE_16              0x8a
+#define VERIFY_16             0x8f
 #define SERVICE_ACTION_IN     0x9e
 /* values for service action in */
 #define	SAI_READ_CAPACITY_16  0x10
#! /bin/sh -e 
## <PATCHNAME>.dpatch by <PATCH_AUTHOR@EMAI>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Description: [PATCH] update SG_IO command table
## DP: Patch author: Jens Axobe <axboe@suse.de>
## DP: Upstream status: backport

. $(dirname $0)/DPATCH

@DPATCH@
# origin: axboe (BitKeeper)
# cset: 1.1803.144.222 (2.6) key=412a53f2QNsqhYybefqcMSOffiZb2g
# inclusion: upstream
# descrition: [PATCH] update SG_IO command table
# revision date: Fri, 05 Nov 2004 17:18:22 +0900
#
# rset: ChangeSet|1.1803.144.221..1.1803.144.222
# rset: include/linux/cdrom.h|1.21..1.22
# rset: drivers/block/scsi_ioctl.c|1.53..1.54
#
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/08/23 13:30:42-07:00 axboe@suse.de 
#   [PATCH] update SG_IO command table
#   
#   Here's a better table of acceptable commands, I've added some more
#   commands.  Should be pretty complete from the cd/dvd side now.
# 
# include/linux/cdrom.h
#   2004/08/23 08:17:56-07:00 axboe@suse.de +2 -1
#   update SG_IO command table
# Updated for Debian kernel-source-2.6.8
# 
# drivers/block/scsi_ioctl.c
#   2004/08/23 08:18:56-07:00 axboe@suse.de +27 -0
#   update SG_IO command table
# Deleted for Debian kernel-source-2.6.8 by Horms
# 
diff -Nru a/include/linux/cdrom.h b/include/linux/cdrom.h
--- a/include/linux/cdrom.h	2004-11-05 17:52:26.000000000 +0900
+++ b/include/linux/cdrom.h	2004-11-05 17:53:56.000000000 +0900
@@ -466,10 +466,10 @@
 #define GPCMD_REPORT_KEY		    0xa4
 #define GPCMD_REQUEST_SENSE		    0x03
 #define GPCMD_RESERVE_RZONE_TRACK	    0x53
+#define GPCMD_SEND_CUE_SHEET    	    0x5d
 #define GPCMD_SCAN			    0xba
 #define GPCMD_SEEK			    0x2b
-#define GPCMD_SEND_CUE_SHEET    	    0x5d
-#define GPCMD_SEND_DVD_STRUCTURE	    0xad
+#define GPCMD_SEND_DVD_STRUCTURE	    0xbf
 #define GPCMD_SEND_EVENT		    0xa2
 #define GPCMD_SEND_KEY			    0xa3
 #define GPCMD_SEND_OPC			    0x54
#! /bin/sh -e 
## <PATCHNAME>.dpatch by <PATCH_AUTHOR@EMAI>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Description: [PATCH] GPCMD_SEND_CUE_SHEET missing in scsi_ioctl
## DP: Patch author: Jens Axobe <axboe@suse.de>
## DP: Upstream status: backport

. $(dirname $0)/DPATCH

@DPATCH@
# origin: axboe (BitKeeper)
# cset: 1.1832.6.185 (2.6) key=412b9807JFV5HTT_Io8LpcPoyii17w
# inclusion: upstream
# descrition: [PATCH] GPCMD_SEND_CUE_SHEET missing in scsi_ioctl
# revision date: Fri, 05 Nov 2004 17:18:32 +0900
#
# rset: ChangeSet|1.1832.6.184..1.1832.6.185
# rset: drivers/block/scsi_ioctl.c|1.54..1.55
#
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/08/24 12:33:27-07:00 axboe@suse.de 
#   [PATCH] GPCMD_SEND_CUE_SHEET missing in scsi_ioctl
#   
#   Forgot one command, GPCMD_SEND_CUE_SHEET is also ok for write open.
#   
#   Signed-off-by: Jens Axboe <axboe@suse.de>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# drivers/block/scsi_ioctl.c
#   2004/08/24 06:10:37-07:00 axboe@suse.de +1 -0
#   GPCMD_SEND_CUE_SHEET missing in scsi_ioctl
# 
diff -Nru a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c
--- a/drivers/block/scsi_ioctl.c	2004-11-05 17:18:32 +09:00
+++ b/drivers/block/scsi_ioctl.c	2004-11-05 17:18:32 +09:00
@@ -178,6 +178,7 @@
 		safe_for_write(GPCMD_SEND_EVENT),
 		safe_for_write(GPCMD_SEND_KEY),
 		safe_for_write(GPCMD_SEND_OPC),
+		safe_for_write(GPCMD_SEND_CUE_SHEET),
 		safe_for_write(GPCMD_SET_SPEED),
 		safe_for_write(GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL),
 		safe_for_write(GPCMD_LOAD_UNLOAD),
#! /bin/sh -e 
## <PATCHNAME>.dpatch by <PATCH_AUTHOR@EMAI>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Description: READ_BUFFER_CAPACITY as read-ok command
## DP: Patch author: Daniel Drake <dsd@gentoo.org>
## DP: Upstream status: backport

. $(dirname $0)/DPATCH

@DPATCH@
# origin: axboe (BitKeeper)
# cset: 1.2457 (2.6) key=418a4f0df36yYLVdEKUY8xRMnS3HfA
# inclusion: upstream
# descrition: [PATCH] add READ_BUFFER_CAPACITY as read-ok command
# revision date: Fri, 05 Nov 2004 17:18:42 +0900
#
# rset: ChangeSet|1.2456..1.2457
# rset: include/linux/cdrom.h|1.24..1.25
# rset: drivers/block/scsi_ioctl.c|1.57..1.58
#
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/11/04 07:47:25-08:00 axboe@suse.de 
#   [PATCH] add READ_BUFFER_CAPACITY as read-ok command
#   
#   Patch is from Daniel Drake <dsd@gentoo.org>
#   
#   Signed-off-by: Jens Axboe <axboe@suse.de>
#   Signed-off-by: Daniel Drake <dsd@gentoo.org>
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# include/linux/cdrom.h
#   2004/11/03 14:01:16-08:00 axboe@suse.de +1 -0
#   add READ_BUFFER_CAPACITY as read-ok command
# 
# drivers/block/scsi_ioctl.c
#   2004/11/03 14:05:08-08:00 axboe@suse.de +1 -0
#   add READ_BUFFER_CAPACITY as read-ok command
# 
diff -Nru a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c
--- a/drivers/block/scsi_ioctl.c	2004-11-05 17:18:42 +09:00
+++ b/drivers/block/scsi_ioctl.c	2004-11-05 17:18:42 +09:00
@@ -139,6 +139,7 @@
 		safe_for_read(GPCMD_PAUSE_RESUME),
 
 		/* CD/DVD data reading */
+		safe_for_read(GPCMD_READ_BUFFER_CAPACITY),
 		safe_for_read(GPCMD_READ_CD),
 		safe_for_read(GPCMD_READ_CD_MSF),
 		safe_for_read(GPCMD_READ_DISC_INFO),
diff -Nru a/include/linux/cdrom.h b/include/linux/cdrom.h
--- a/include/linux/cdrom.h	2004-11-05 17:18:42 +09:00
+++ b/include/linux/cdrom.h	2004-11-05 17:18:42 +09:00
@@ -452,6 +452,7 @@
 #define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL  0x1e
 #define GPCMD_READ_10			    0x28
 #define GPCMD_READ_12			    0xa8
+#define GPCMD_READ_BUFFER_CAPACITY	    0x5c
 #define GPCMD_READ_CDVD_CAPACITY	    0x25
 #define GPCMD_READ_CD			    0xbe
 #define GPCMD_READ_CD_MSF		    0xb9
#! /bin/sh -e 
## <PATCHNAME>.dpatch by <PATCH_AUTHOR@EMAI>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Description: Update list of safe SCSI commands for SG_IO
## DP: Patch author: Linux Torvalds, Jens Axboe
## DP: Upstream status: backport

. $(dirname $0)/DPATCH

@DPATCH@
--- linux-2.6.8/drivers/block/scsi_ioctl.c	2004-08-25 11:54:11.000000000 +0200
+++ linux-2.5/drivers/block/scsi_ioctl.c	2004-08-25 00:31:03.000000000 +0200
@@ -127,12 +127,16 @@
 		safe_for_read(MODE_SENSE),
 		safe_for_read(MODE_SENSE_10),
 		safe_for_read(START_STOP),
+		safe_for_read(GPCMD_VERIFY_10),
+		safe_for_read(VERIFY_16),
+		safe_for_read(READ_BUFFER),
 
 		/* Audio CD commands */
 		safe_for_read(GPCMD_PLAY_CD),
 		safe_for_read(GPCMD_PLAY_AUDIO_10),
 		safe_for_read(GPCMD_PLAY_AUDIO_MSF),
 		safe_for_read(GPCMD_PLAY_AUDIO_TI),
+		safe_for_read(GPCMD_PAUSE_RESUME),
 
 		/* CD/DVD data reading */
 		safe_for_read(GPCMD_READ_CD),
@@ -146,6 +150,12 @@
 		safe_for_read(GPCMD_READ_TOC_PMA_ATIP),
 		safe_for_read(GPCMD_REPORT_KEY),
 		safe_for_read(GPCMD_SCAN),
+		safe_for_read(GPCMD_GET_CONFIGURATION),
+		safe_for_read(GPCMD_READ_FORMAT_CAPACITIES),
+		safe_for_read(GPCMD_GET_EVENT_STATUS_NOTIFICATION),
+		safe_for_read(GPCMD_GET_PERFORMANCE),
+		safe_for_read(GPCMD_SEEK),
+		safe_for_read(GPCMD_STOP_PLAY_SCAN),
 
 		/* Basic writing commands */
 		safe_for_write(WRITE_6),
@@ -154,8 +164,25 @@
 		safe_for_write(WRITE_12),
 		safe_for_write(WRITE_VERIFY_12),
 		safe_for_write(WRITE_16),
-		safe_for_write(WRITE_BUFFER),
 		safe_for_write(WRITE_LONG),
+		safe_for_write(ERASE),
+		safe_for_write(GPCMD_MODE_SELECT_10),
+		safe_for_write(MODE_SELECT),
+		safe_for_write(GPCMD_BLANK),
+		safe_for_write(GPCMD_CLOSE_TRACK),
+		safe_for_write(GPCMD_FLUSH_CACHE),
+		safe_for_write(GPCMD_FORMAT_UNIT),
+		safe_for_write(GPCMD_REPAIR_RZONE_TRACK),
+		safe_for_write(GPCMD_RESERVE_RZONE_TRACK),
+		safe_for_write(GPCMD_SEND_DVD_STRUCTURE),
+		safe_for_write(GPCMD_SEND_EVENT),
+		safe_for_write(GPCMD_SEND_KEY),
+		safe_for_write(GPCMD_SEND_OPC),
+		safe_for_write(GPCMD_SEND_CUE_SHEET),
+		safe_for_write(GPCMD_SET_SPEED),
+		safe_for_write(GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL),
+		safe_for_write(GPCMD_LOAD_UNLOAD),
+		safe_for_write(GPCMD_SET_STREAMING),
 	};
 	unsigned char type = cmd_type[cmd[0]];
 

Reply to: