From: Greg KH <gregkh@suse.de>
To: James.Bottomley@SteelEye.com, Kai.Makisara@kolumbus.fi,
linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, stable@kernel.org,
Justin Forbes <jmforbes@linuxtx.org>,
Zwane Mwaikambo <zwane@arm.linux.org.uk>,
Cliff White <cliffw@osdl.org>, Theodore Ts'o <tytso@mit.edu>,
"Randy.Dunlap" <rddunlap@osdl.org>,
Chuck Wolber <chuckw@quantumlinux.com>,
torvalds@osdl.org, akpm@osdl.org, alan@lxorguk.ukuu.org.uk
Subject: [06/07] [PATCH] SCSI tape security: require CAP_ADMIN for SG_IO etc.
Date: Wed, 27 Apr 2005 10:16:49 -0700 [thread overview]
Message-ID: <20050427171649.GG3195@kroah.com> (raw)
In-Reply-To: <20050427171446.GA3195@kroah.com>
-stable review patch. If anyone has any objections, please let us know.
------------------
The kernel currently allows any user permitted to access the tape device file
to send the tape drive commands that may either make the tape drivers internal
state inconsistent or to change the drive parameters so that other users find
the drive to be unusable. This patch changes ioctl handling so that SG_IO,
SCSI_IOCTL_COMMAND, etc. require CAP_ADMIN. This solves the consistency
problems for SCSI tapes. The st driver provides user-accessible commands to
change the drive parameters that users may need to access.
The SCSI command permissions were discussed widely on the linux lists but this
did not result in any useful refinement of the permissions. It may very well
be that the tape drives are the only devices that users are sometimes given
permissions to access and that have security problems with the current command
filtering. This patch solves the problem for tapes and no more elaborate
patches are needed.
Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
diff -Naru a/drivers/scsi/st.c b/drivers/scsi/st.c
--- a/drivers/scsi/st.c 2005-04-27 09:50:24 -07:00
+++ b/drivers/scsi/st.c 2005-04-27 09:50:24 -07:00
@@ -3461,11 +3461,17 @@
case SCSI_IOCTL_GET_BUS_NUMBER:
break;
default:
- i = scsi_cmd_ioctl(file, STp->disk, cmd_in, p);
+ if (!capable(CAP_SYS_ADMIN))
+ i = -EPERM;
+ else
+ i = scsi_cmd_ioctl(file, STp->disk, cmd_in, p);
if (i != -ENOTTY)
return i;
break;
}
+ if (!capable(CAP_SYS_ADMIN) &&
+ (cmd_in == SCSI_IOCTL_START_UNIT || cmd_in == SCSI_IOCTL_STOP_UNIT))
+ return -EPERM;
return scsi_ioctl(STp->device, cmd_in, p);
out:
next parent reply other threads:[~2005-04-27 17:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20050427171446.GA3195@kroah.com>
2005-04-27 17:16 ` Greg KH [this message]
2005-04-27 16:38 ` [06/07] [PATCH] SCSI tape security: require CAP_ADMIN for SG_IO etc Alan Cox
2005-04-27 18:26 ` Greg KH
2005-04-27 17:51 ` Alan Cox
2005-04-28 5:43 ` Kai Makisara
2005-04-28 12:49 ` Arjan van de Ven
2005-04-28 13:21 ` Alan Cox
2005-04-29 4:20 ` Greg KH
2005-04-29 20:16 ` Alan Cox
2005-04-29 20:38 ` Greg KH
2005-04-30 5:52 ` Kai Makisara
2005-04-30 5:10 ` Greg KH
2005-04-30 8:10 ` Kai Makisara
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=20050427171649.GG3195@kroah.com \
--to=gregkh@suse.de \
--cc=James.Bottomley@SteelEye.com \
--cc=Kai.Makisara@kolumbus.fi \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=chuckw@quantumlinux.com \
--cc=cliffw@osdl.org \
--cc=jmforbes@linuxtx.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=rddunlap@osdl.org \
--cc=stable@kernel.org \
--cc=torvalds@osdl.org \
--cc=tytso@mit.edu \
--cc=zwane@arm.linux.org.uk \
/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