All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@google.com>
To: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Mikulas Patocka <mpatocka@redhat.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org, dm-devel@redhat.com,
	Milan Broz <mbroz@redhat.com>,
	Megha Dey <megha.dey@linux.intel.com>
Subject: Re: Crash in crypto mcryptd
Date: Thu, 1 Dec 2016 23:06:58 -0800	[thread overview]
Message-ID: <20161202070658.GA18690@google.com> (raw)
In-Reply-To: <1480643222.3064.52.camel@linux.intel.com>

On Thu, Dec 01, 2016 at 05:47:02PM -0800, Tim Chen wrote:
> On Thu, 2016-12-01 at 19:00 -0500, Mikulas Patocka wrote:
> > Hi
> > 
> > There is a bug in mcryptd initialization.
> > 
> > This is a test module that tries various hash algorithms. When you load 
> > the module with "insmod test.ko 'alg=mcryptd(md5)'", the machine crashes.
> 
> I don't think your test setup is right.  The mcryptd supports only multi-buffer
> algorithm.  I don't think there is such an implementation for md5.
> 
> Please refer to arch/x86/crypto/sha1-mb 
> multi-buffer implementation of sha1 to see the proper
> setup and usage with mcryptd.  You can also run tcrypt test to
> exercise this code.
> 
> Tim

No, mcryptd must not crash the kernel if it's passed the wrong algorithm.
Users can try to instantiate it with any algorithm using AF_ALG, for example:

	struct sockaddr_alg addr = {
		.salg_type = "hash",
		.salg_name = "mcryptd(md5)",
	};
	
	int fd = socket(AF_ALG, SOCK_SEQPACKET, 0);

	bind(fd, (struct sockaddr *)&addr, sizeof(addr));

Currently, this instantly crashes the kernel.

Eric

  reply	other threads:[~2016-12-02  7:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02  0:00 Crash in crypto mcryptd Mikulas Patocka
2016-12-02  1:47 ` Tim Chen
2016-12-02  7:06   ` Eric Biggers [this message]
2016-12-02 18:30     ` Tim Chen
2016-12-03  0:16 ` Tim Chen

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=20161202070658.GA18690@google.com \
    --to=ebiggers@google.com \
    --cc=davem@davemloft.net \
    --cc=dm-devel@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=mbroz@redhat.com \
    --cc=megha.dey@linux.intel.com \
    --cc=mpatocka@redhat.com \
    --cc=tim.c.chen@linux.intel.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.