From: Omar Sandoval <osandov@osandov.com>
To: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Linux Block Layer Mailinglist <linux-block@vger.kernel.org>,
Linux SCSI Mailinglist <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH blktests v2 3/3] sg/001: add regression test for syzcaller generated GPF in sg_read path
Date: Mon, 22 May 2017 10:59:05 -0700 [thread overview]
Message-ID: <20170522175905.GA17738@vader.DHCP.thefacebook.com> (raw)
In-Reply-To: <79600648b662bc8b9e701ff6627986887384585b.1495201975.git.jthumshirn@suse.de>
On Fri, May 19, 2017 at 03:55:31PM +0200, Johannes Thumshirn wrote:
> Add a regression test for commit 48ae8484e9fc ("scsi: sg: don't return
> bogus Sg_requests"). This is a general protection fault triggered by
> syzcaller via issuing bogus read(2)s on the /dev/sg devices.
>
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
> tests/sg/001 | 47 +++++++++++++++++++++++++++++++++++++++++++++++
> tests/sg/001.out | 2 ++
> 2 files changed, 49 insertions(+)
> create mode 100755 tests/sg/001
> create mode 100644 tests/sg/001.out
>
> diff --git a/tests/sg/001 b/tests/sg/001
> new file mode 100755
> index 000000000000..86430409b6a3
> --- /dev/null
> +++ b/tests/sg/001
> @@ -0,0 +1,47 @@
> +#!/bin/bash
> +#
> +# Regression test for commit 48ae8484e9fc ("scsi: sg: don't return bogus
> +# Sg_requests")
> +#
> +# Copyright (C) 2017 Johannes Thumshirn <jthumshirn@suse.de>
> +#
> +# This program is free software: you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation, either version 3 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> +
> +. common/sg
> +. common/scsi_debug
> +
> +DESCRIPTION="try triggering a kernel GPF with 0 byte SG reads"
> +QUICK=1
> +
> +requires() {
> + _have_program src/sg-001 \
> + && _have_scsi_debug \
> + && _have_scsi_generic
> +}
> +
> +
> +test() {
> + echo "Running ${TEST_NAME}"
> +
> + if ! _get_scsi_debug_dev; then
> + return 1
> + fi
> +
> + SG_DEV=$(_get_sg_from_blockdev "$SCSI_DEBUG_NAME")
> + timeout -s INT 10s ./src/sg-001 "$SG_DEV"
> +
> + _put_scsi_debug_dev
> +
> + echo "Test complete"
> +}
This looks much better, thanks! One question for you: is there any value
in running this on specific test devices (i.e., changing test() to
test_device() and using "$TEST_DEV" instead of a scsi-debug device), or
would it be a waste of time since it's just exercising generic code?
next prev parent reply other threads:[~2017-05-22 17:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 13:55 [PATCH blktests v2 0/3] Add SCSI generic test group Johannes Thumshirn
2017-05-19 13:55 ` [PATCH blktests v2 1/3] Add ability to build test-cases Johannes Thumshirn
2017-05-19 13:55 ` [PATCH blktests v2 2/3] tests/sg: add SCSI generic test grouop Johannes Thumshirn
2017-05-19 13:55 ` [PATCH blktests v2 3/3] sg/001: add regression test for syzcaller generated GPF in sg_read path Johannes Thumshirn
2017-05-22 17:59 ` Omar Sandoval [this message]
2017-05-23 6:58 ` Johannes Thumshirn
2017-05-23 14:15 ` Jens Axboe
2017-05-23 14:25 ` Johannes Thumshirn
2017-05-23 14:39 ` Jens Axboe
2017-05-23 14:46 ` Johannes Thumshirn
2017-06-07 6:44 ` [PATCH blktests v2 0/3] Add SCSI generic test group Omar Sandoval
2017-06-07 7:03 ` Johannes Thumshirn
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=20170522175905.GA17738@vader.DHCP.thefacebook.com \
--to=osandov@osandov.com \
--cc=jthumshirn@suse.de \
--cc=linux-block@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox