From: Scott Bauer <scott.bauer@intel.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: "linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
"arnd@arndb.de" <arnd@arndb.de>, "axboe@fb.com" <axboe@fb.com>,
"keith.busch@intel.com" <keith.busch@intel.com>,
"jonathan.derrick@intel.com" <jonathan.derrick@intel.com>,
"hch@infradead.org" <hch@infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [PATCH V5 3/4] Move stack parameters for sed_ioctl to prevent oversized stack with CONFIG_KASAN
Date: Mon, 13 Feb 2017 09:29:42 -0700 [thread overview]
Message-ID: <20170213162941.GB18913@sbauer-Z170X-UD5> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DB028519B@AcuExch.aculab.com>
On Mon, Feb 13, 2017 at 04:30:36PM +0000, David Laight wrote:
> From: Scott Bauer Sent: 13 February 2017 16:11
> > When CONFIG_KASAN is enabled, compilation fails:
> >
> > block/sed-opal.c: In function 'sed_ioctl':
> > block/sed-opal.c:2447:1: error: the frame size of 2256 bytes is larger than 2048 bytes [-Werror=frame-
> > larger-than=]
> >
> > Moved all the ioctl structures off the stack and dynamically activate
> > using _IOC_SIZE()
>
> Think I'd not that this simplifies the code considerably.
> AFAICT CONFIG_KASAN is a just brainf*ck.
> It at least needs annotation that copy_from_user() has properties
> similar to memset().
> So if the size matches that of the type then no guard space (etc)
> is required.
>
I don't really follow what you're saying. Do you want me to just include that
the patch cleans up the ioctl path a bit. I need to include the KASAN part since
there was build breakage and the series does fix it even if it simplifies the path
as well. As for the memset part, we never copy back to userland so there's no chance
of data leakage which is what it seems you're hinting at.
> ...
> > + ioctl_ptr = memdup_user(arg, _IOC_SIZE(cmd));
> > + if (IS_ERR_OR_NULL(ioctl_ptr)) {
> > + ret = PTR_ERR(ioctl_ptr);
> > + goto out;
> ...
> > + out:
> > + kfree(ioctl_ptr);
> > + return ret;
> > }
>
> That error path doesn't look quite right to me.
>
> David
>
good god, this is a mess this morning. Thanks for the catch, I'll review these
more aggressively before sending out.
next prev parent reply other threads:[~2017-02-13 16:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-13 16:11 SED Opal Fixups Scott Bauer
2017-02-13 16:11 ` [PATCH V5 1/4] block: sed-opal: change ioctl to take user pointer instead of unsinged long Scott Bauer
2017-02-13 16:15 ` Scott Bauer
2017-02-14 8:17 ` Christoph Hellwig
2017-02-13 16:11 ` [PATCH V5 2/4] uapi: sed-opal fix IOW for activate lsp to use correct struct Scott Bauer
2017-02-14 8:18 ` Christoph Hellwig
2017-02-13 16:11 ` [PATCH V5 3/4] Move stack parameters for sed_ioctl to prevent oversized stack with CONFIG_KASAN Scott Bauer
2017-02-13 16:30 ` David Laight
2017-02-13 16:29 ` Scott Bauer [this message]
2017-02-13 17:01 ` Arnd Bergmann
2017-02-13 17:07 ` David Laight
2017-02-13 20:16 ` Arnd Bergmann
2017-02-13 16:11 ` [PATCH V5 4/4] Maintainers: Modify SED list from nvme to block Scott Bauer
2017-02-14 8:18 ` Christoph Hellwig
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=20170213162941.GB18913@sbauer-Z170X-UD5 \
--to=scott.bauer@intel.com \
--cc=David.Laight@ACULAB.COM \
--cc=arnd@arndb.de \
--cc=axboe@fb.com \
--cc=hch@infradead.org \
--cc=jonathan.derrick@intel.com \
--cc=keith.busch@intel.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.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