From: Boaz Harrosh <bharrosh@panasas.com>
To: Ed Lin <ed.lin@promise.com>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: g.liakhovetski@gmx.de, linux-scsi@vger.kernel.org,
James Bottomley <James.Bottomley@SteelEye.com>
Subject: Re: [PATCH 3/3] Farther clean up of stex.c driver
Date: Sun, 01 Jul 2007 16:55:59 +0300 [thread overview]
Message-ID: <4687B26F.2050108@panasas.com> (raw)
In-Reply-To: <B70A50D07063384EB9BCE3330D18414F03601207@nonameb.ptu.promise.com>
Ed Lin wrote:
>
>>>>
>>> The software allocates a big enough buffer(so don't worry about this),
>>> and it trims the data size based on returned length. So it needs the
>>> actual data length.
This sounds like a security breach to me. An untrusted user-mode
with knowledge of such hardware in the machine can gain access to kernel
through the wrong( cracker-right) sized request.
>> What's the software? I mean that who trims the data size based on
>> returned length?
>>
>
> The management software provided by Promise.
>
I had a deeper look into this, and I am totally confused.
The code in question at stex.c::stex_ys_commands() is called
at softirq from stex_mu_intr(). It will than immediately go
on to eventually call cmd->scsi_done(cmd);
Now what is the upper layer that calls this command??!
There can be 3 possibilities that I know. From unlikely to likely order:
1. REQ_TYPE_FS command which is not possible because I don't know
of any one that can issue. a ccb->cmd->cmnd[0] == MGT_CMD
as an REQ_TYPE_FS. And anyway if bufflen is truncated like that
a REQ_TYPE_FS command will retry the command until complete.
2. REQ_TYPE_BLOCK_PC through sg, bsg or others at which truncating
a command like that will leak BIOs when trying to release the
command, since scsi-ml relies on bufflen in the call to
end_that_request_first.
3. A special upper layer that overrides the done functions at
scsi_cmnd or request levels and interprets the return info
and/or frees buffers. If this is the case, can such a driver
use a reserved member of scsi_cmnd like the fields in
struct scsi_pointer or something hanging on host_scribble?
Than later return to user-mode what it used to return before
but leave bufflen alone?
Setting of bufflen like that in a driver sounds like a highway
rubbery to me. Please stop that Hack. Now!
>>> So this length fix is necessary if software doesn't
>>> change policy. The whole thing is guaranteed by both software and
>>> firmware, software will do a check, firmware will do a check,
>>> so a check in driver is not necessary.
As I said. I'm sure we can change upper layer polices to not
break user-mode but to also not touch a delicate and private member
of scsi-ml. It limits the scsi-ml ability to change and evolve.
The most I can do for now is declare this driver broken once
scsi_sgtable goes in because I sure am not going to do:
ccb->cmd->sg_table->length = le32_to_cpu(*(__le32 *)&resp->variable[0]);
(Do we need an explanation why this is plain broken, leaking code)
If you point me to the upper layer driver used, I can see if I can change it
in a way that will not touch bufflen.
Another thing I do not understand is where in the SCSI standard
such an operation is defined. because if it is a standard SCSI
command or extended or vendor-specific command than, current code
is not built to cope with such scenario. How would one defined
it? a "truncated read"?
Boaz Harrosh
next prev parent reply other threads:[~2007-07-01 13:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-14 23:02 [PATCH 3/3] Farther clean up of stex.c driver Ed Lin
2007-06-14 23:52 ` FUJITA Tomonori
2007-07-01 13:55 ` Boaz Harrosh [this message]
2007-07-02 0:44 ` Lin Yu
-- strict thread matches above, loose matches on Subject: below --
2007-06-14 19:29 Ed Lin
2007-06-14 22:20 ` FUJITA Tomonori
2007-06-12 18:02 scsi_cmnd accessors issues Boaz Harrosh
2007-06-12 23:51 ` FUJITA Tomonori
2007-06-13 10:32 ` Harrosh, Boaz
2007-06-13 10:45 ` FUJITA Tomonori
2007-06-14 16:26 ` [PATCH 0/0] " Boaz Harrosh
2007-06-14 16:33 ` [PATCH 3/3] Farther clean up of stex.c driver Boaz Harrosh
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=4687B26F.2050108@panasas.com \
--to=bharrosh@panasas.com \
--cc=James.Bottomley@SteelEye.com \
--cc=ed.lin@promise.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=g.liakhovetski@gmx.de \
--cc=linux-scsi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.