Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1577158
| From | Scott Bauer <scott.bauer@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] block: sed-opal: reduce stack size of ioctl handler |
| Date | 2017-02-08 23:30 +0100 |
| Message-ID | <t8IUq-67n-23@gated-at.bofh.it> (permalink) |
| References | <t8HOG-5t6-7@gated-at.bofh.it> <t8IUq-67n-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Feb 08, 2017 at 02:58:28PM -0700, Scott Bauer wrote:
> On Wed, Feb 08, 2017 at 10:15:28PM +0100, Arnd Bergmann wrote:
> > When CONFIG_KASAN is in use, the sed_ioctl function uses unusually large stack,
> > as each possible ioctl argument gets its own stack area plus redzone:
> >
> > 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=]
> >
> > Moving the copy_from_user() calls into the individual functions has little
> > effect on readablility, but significantly reduces the stack size, with the
> > largest individual function (opal_enable_disable_shadow_mbr) now at
> > reasonable 456 bytes.
> >
> > Fixes: 455a7b238cd6 ("block: Add Sed-opal library")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
>
> Hi Arnd,
>
> Thank you for the report. We want to keep the function calls agnostic to userland.
> In the future we will have in-kernel callers and I don't want to have to do any
> get_fs(KERNEL_DS) wizardry.
>
> Instead I think we can use a union to lessen the stack burden. I tested this patch just now
> with config_ksasan and was able to build.
Nack on this patch, it only really masks the issue. Keith pointed out we have a call chain
up to this ioctl then deeper down into nvme then the block layer. If we use 25% of the stack
just for this function it's still too dangerous and we'll run into corruption later on and not
remember this fix. I'll come up with another solution.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] block: sed-opal: reduce stack size of ioctl handler Arnd Bergmann <arnd@arndb.de> - 2017-02-08 22:20 +0100
Re: [PATCH] block: sed-opal: reduce stack size of ioctl handler Scott Bauer <scott.bauer@intel.com> - 2017-02-08 23:30 +0100
Re: [PATCH] block: sed-opal: reduce stack size of ioctl handler Arnd Bergmann <arnd@arndb.de> - 2017-02-09 16:00 +0100
Re: [PATCH] block: sed-opal: reduce stack size of ioctl handler Scott Bauer <scott.bauer@intel.com> - 2017-02-08 23:40 +0100
RE: [PATCH] block: sed-opal: reduce stack size of ioctl handler David Laight <David.Laight@ACULAB.COM> - 2017-02-09 15:30 +0100
csiph-web