[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5j+P++iR=Vf6OKi31foxRAO+eRcDZHeHmc7K_G2rViCjmQ@mail.gmail.com>
Date: Wed, 20 Jun 2018 13:38:20 -0700
From: Kees Cook <keescook@...omium.org>
To: Arnd Bergmann <arnd@...db.de>
Cc: Herbert Xu <herbert@...dor.apana.org.au>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
Alasdair Kergon <agk@...hat.com>,
Eric Biggers <ebiggers@...gle.com>,
Giovanni Cabiddu <giovanni.cabiddu@...el.com>,
Lars Persson <larper@...s.com>,
Mike Snitzer <snitzer@...hat.com>,
Rabin Vincent <rabinv@...s.com>,
Tim Chen <tim.c.chen@...ux.intel.com>,
"David S. Miller" <davem@...emloft.net>,
"open list:HARDWARE RANDOM NUMBER GENERATOR CORE"
<linux-crypto@...r.kernel.org>, qat-linux@...el.com,
dm-devel@...hat.com,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 11/11] crypto: skcipher: Remove VLA usage for SKCIPHER_REQUEST_ON_STACK
On Wed, Jun 20, 2018 at 12:44 PM, Arnd Bergmann <arnd@...db.de> wrote:
> On Wed, Jun 20, 2018 at 9:04 PM, Kees Cook <keescook@...omium.org> wrote:
>> In the quest to remove all stack VLA usage from the kernel[1], this
>> caps the skcipher request size similar to other limits and adds a sanity
>> check at registration.
>>
>>
>> +#define SKCIPHER_MAX_REQSIZE (PAGE_SIZE / 8)
>> +
>> #define SKCIPHER_REQUEST_ON_STACK(name, tfm) \
>> char __##name##_desc[sizeof(struct skcipher_request) + \
>> - crypto_skcipher_reqsize(tfm)] CRYPTO_MINALIGN_ATTR; \
>> + SKCIPHER_MAX_REQSIZE] CRYPTO_MINALIGN_ATTR; \
>> struct skcipher_request *name = (void *)__##name##_desc
>>
>
> This is probably a bad idea on kernels with large values of PAGE_SIZE.
> Some users on ppc64 and arm64 use 64KB here, but still limit
> the per-function stack size to 2KB.
We could make all of these PAGE_SIZE-related limits explicitly 512? I
think that was the intent originally.
-Kees
--
Kees Cook
Pixel Security
Powered by blists - more mailing lists