Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1666586

Re: Crypto Fixes for 4.12

From Linus Torvalds <torvalds@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: Crypto Fixes for 4.12
Date 2017-06-15 11:10 +0200
Message-ID <tSyWR-yc-13@gated-at.bofh.it> (permalink)
References (2 earlier) <sYpJo-6v8-17@gated-at.bofh.it> <thcBY-5Kp-23@gated-at.bofh.it> <tK8ZA-68C-5@gated-at.bofh.it> <tQ1Vo-2mY-19@gated-at.bofh.it> <tSriG-3Uo-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jun 15, 2017 at 9:54 AM, Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> This push fixes a bug on sparc where we may dereference freed stack
> memory.

Ugh, that's a particularly ugly fix for a random gcc bug on a random
architecture that almost nobody tests.

In other words, it's nasty. It's nasty because nobody sane will ever
realize this pattern, and the code will either bit-rot or just happen
again somewhere else.

I'd have been *much* happier if this had been some nicer abstraction
that is built up around the use of SHASH_DESC_ON_STACK(), and just
have some rule that "SHASH_DESC_ON_STACK()" needs to be paired with
retrieving the final value and then a SHASH_DESC_DEALLOC() or
whatever.

Then you *could* implement SHASH_DESC_ON_STACK() as a kmalloc, and
SHASH_DESC_DEALLOC() would be a kfree - but with an alloca()-like
allocation the SHASH_DESC_DEALLOC() would be that "barrier_data()".

At that point the interface would make _sense_ at some conceptual
level, rather than being a random hack for a small collection of
random users of this thing.

There's a fair number of SHASH_DESC_ON_STACK users, are all the others
safe for some random reason that just happens to be about code
generation? Did people actually verify that?

                Linus

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Crypto Fixes for 4.12 Herbert Xu <herbert@gondor.apana.org.au> - 2017-06-08 11:30 +0200
  Re: Crypto Fixes for 4.12 David Miller <davem@davemloft.net> - 2017-06-08 16:10 +0200
    Re: Crypto Fixes for 4.12 Herbert Xu <herbert@gondor.apana.org.au> - 2017-06-09 05:00 +0200
  Crypto Fixes for 4.12 Herbert Xu <herbert@gondor.apana.org.au> - 2017-06-15 03:00 +0200
    Re: Crypto Fixes for 4.12 Linus Torvalds <torvalds@linux-foundation.org> - 2017-06-15 11:10 +0200
      Re: Crypto Fixes for 4.12 Linus Torvalds <torvalds@linux-foundation.org> - 2017-06-15 11:10 +0200
      Re: Crypto Fixes for 4.12 Herbert Xu <herbert@gondor.apana.org.au> - 2017-06-15 11:50 +0200
        Re: Crypto Fixes for 4.12 David Miller <davem@davemloft.net> - 2017-06-15 17:10 +0200
      Re: Crypto Fixes for 4.12 David Miller <davem@davemloft.net> - 2017-06-15 17:10 +0200
        Re: Crypto Fixes for 4.12 Theodore Ts'o <tytso@mit.edu> - 2017-06-16 15:00 +0200
          Re: Crypto Fixes for 4.12 David Miller <davem@davemloft.net> - 2017-06-16 19:00 +0200

csiph-web