public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rolf Eike Beer <eike-kernel@sf-tec.de>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: JBottomley@parallels.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: prevent stack buffer overflow in host_reset
Date: Fri, 16 Nov 2012 10:35:32 +0100	[thread overview]
Message-ID: <2743667.hK8qPvyv2t@eto> (raw)
In-Reply-To: <1353012706-28182-1-git-send-email-sasha.levin@oracle.com>

[-- Attachment #1: Type: text/plain, Size: 1697 bytes --]

Am Donnerstag 15 November 2012, 15:51:46 schrieb Sasha Levin:
> store_host_reset() has tried to re-invent the wheel to compare sysfs
> strings. Unfortunately it did so poorly and never bothered to check the
> input from userspace before overwriting stack with it, so something simple
> as:
> 
> echo "WoopsieWoopsie" >
> /sys/devices/pseudo_0/adapter0/host0/scsi_host/host0/host_reset
> 
> would result in:
> 
> [  316.310101] Kernel panic - not syncing: stack-protector: Kernel stack is
> corrupted in: ffffffff81f5bac7 [  316.310101]
> [  316.320051] Pid: 6655, comm: sh Tainted: G        W   
> 3.7.0-rc5-next-20121114-sasha-00016-g5c9d68d-dirty #129 [  316.320051] Call
> Trace:
> [  316.340058] pps pps0: PPS event at 1352918752.620355751
> [  316.340062] pps pps0: capture assert seq #303
> [  316.320051]  [<ffffffff83b3856b>] panic+0xcd/0x1f4
> [  316.320051]  [<ffffffff81f5bac7>] ? store_host_reset+0xd7/0x100
> [  316.320051]  [<ffffffff8110b996>] __stack_chk_fail+0x16/0x20
> [  316.320051]  [<ffffffff81f5bac7>] store_host_reset+0xd7/0x100
> [  316.320051]  [<ffffffff81e55bb3>] dev_attr_store+0x13/0x30
> [  316.320051]  [<ffffffff812f7db1>] sysfs_write_file+0x101/0x170
> [  316.320051]  [<ffffffff8127acc8>] vfs_write+0xb8/0x180
> [  316.320051]  [<ffffffff8127ae80>] sys_write+0x50/0xa0
> [  316.320051]  [<ffffffff83c03418>] tracesys+0xe1/0xe6
> 
> Fix this by uninventing whatever was going on there and just use
> sysfs_streq.
> 
> Bug introduced by 29443691 ("[SCSI] scsi: Added support for adapter and
> firmware reset").
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

That revision is in 3.2 and all following, so I think this needs to go into 
stable, too.

Eike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2012-11-16  9:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-15 20:51 [PATCH] scsi: prevent stack buffer overflow in host_reset Sasha Levin
2012-11-16  9:35 ` Rolf Eike Beer [this message]
2012-11-30  9:07 ` James Bottomley

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=2743667.hK8qPvyv2t@eto \
    --to=eike-kernel@sf-tec.de \
    --cc=JBottomley@parallels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sasha.levin@oracle.com \
    /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