All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>,
	James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
	Stefan Berger <stefanb@linux.vnet.ibm.com>,
	linux-integrity@vger.kernel.org,
	LSM List <linux-security-module@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ima: dynamically allocate shash_desc
Date: Tue, 18 Jun 2019 08:44:38 -0400	[thread overview]
Message-ID: <1560861878.9530.17.camel@linux.ibm.com> (raw)
In-Reply-To: <CAK8P3a1Q2JG3KBYNYgWg0_XtGUufNc6zuqcUBqiGSaBRp+au-w@mail.gmail.com>

On Mon, 2019-06-17 at 22:08 +0200, Arnd Bergmann wrote:
> On Mon, Jun 17, 2019 at 8:08 PM Mimi Zohar <zohar@linux.ibm.com> wrote:
> >
> > On Mon, 2019-06-17 at 11:55 -0400, Mimi Zohar wrote:
> > > On Mon, 2019-06-17 at 13:20 +0200, Arnd Bergmann wrote:
> > > > On 32-bit ARM, we get a warning about excessive stack usage when
> > > > building with clang.
> > > >
> > > > security/integrity/ima/ima_crypto.c:504:5: error: stack frame size
> > > > of 1152 bytes in function 'ima_calc_field_array_hash' [-Werror,-
> > > > Wframe-larger-than=]
> > >
> > > I'm definitely not seeing this.  Is this problem a result of non
> > > upstreamed patches?  For sha1, currently the only possible hash
> > > algorithm, I'm seeing 664.
> 
> You won't see it with gcc, only with clang in some randconfig builds,
> I suppose only when KASAN is enabled.
> 
> > Every time a measurement is added to the measurement list, the memory
> > would be allocated/freed.  The frequency of new measurements is policy
> > dependent.  For performance reasons, I'd prefer if the allocation
> > remains on the stack.
> 
> Is there a way to preallocate the shash_desc instead? That would
> avoid the overhead.

There are 3 other SHASH_DESC_ON_STACK definitions in just
ima_crypto.c, with a total of ~55 other places in the kernel.  Before
fixing this particular function, I'd like to know if the "excessive
stack usage" warning is limited to ima_calc_field_array_hash_tfm().
 If so, what is so special about its usage of SHASH_DESC_ON_STACK?

thanks,

Mimi


  reply	other threads:[~2019-06-18 13:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 11:20 [PATCH] ima: dynamically allocate shash_desc Arnd Bergmann
2019-06-17 15:55 ` Mimi Zohar
2019-06-17 18:07   ` Mimi Zohar
2019-06-17 20:08     ` Arnd Bergmann
2019-06-18 12:44       ` Mimi Zohar [this message]
2019-06-18 18:06         ` Arnd Bergmann
2019-06-18 18:53           ` Mimi Zohar

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=1560861878.9530.17.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=arnd@arndb.de \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jmorris@namei.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=serge@hallyn.com \
    --cc=stefanb@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.