All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers3@gmail.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	"kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	George Spelvin <linux@horizon.com>,
	Scott Bauer <sbauer@eng.utah.edu>,
	Andi Kleen <ak@linux.intel.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Greg KH <gregkh@linuxfoundation.org>,
	Jean-Philippe Aumasson <jeanphilippe.aumasson@gmail.com>,
	"Daniel J . Bernstein" <djb@cr.yp.to>
Subject: [kernel-hardening] Re: [PATCH v3] siphash: add cryptographically secure hashtable function
Date: Tue, 13 Dec 2016 00:39:48 -0800	[thread overview]
Message-ID: <20161213083948.GA8994@zzz> (raw)
In-Reply-To: <20161212221832.10653-1-Jason@zx2c4.com>

On Mon, Dec 12, 2016 at 11:18:32PM +0100, Jason A. Donenfeld wrote:
> +	for (; data != end; data += sizeof(u64)) {
> +		m = get_unaligned_le64(data);
> +		v3 ^= m;
> +		SIPROUND;
> +		SIPROUND;
> +		v0 ^= m;
> +	}
> +#if defined(CONFIG_DCACHE_WORD_ACCESS) && BITS_PER_LONG == 64
> +	b |= le64_to_cpu(load_unaligned_zeropad(data) & bytemask_from_count(left));
> +#else

Hmm, I don't think you can really do load_unaligned_zeropad() without first
checking for 'left != 0'.  The fixup section for load_unaligned_zeropad()
assumes that rounding the pointer down to a word boundary will produce an
address from which an 'unsigned long' can be loaded.  But if 'left = 0' and we
happen to be on a page boundary with the next page unmapped, then this will not
be true and the second load will still fault.

Eric

WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers3@gmail.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	"kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	George Spelvin <linux@horizon.com>,
	Scott Bauer <sbauer@eng.utah.edu>,
	Andi Kleen <ak@linux.intel.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Greg KH <gregkh@linuxfoundation.org>,
	Jean-Philippe Aumasson <jeanphilippe.aumasson@gmail.com>,
	"Daniel J . Bernstein" <djb@cr.yp.to>
Subject: Re: [PATCH v3] siphash: add cryptographically secure hashtable function
Date: Tue, 13 Dec 2016 00:39:48 -0800	[thread overview]
Message-ID: <20161213083948.GA8994@zzz> (raw)
In-Reply-To: <20161212221832.10653-1-Jason@zx2c4.com>

On Mon, Dec 12, 2016 at 11:18:32PM +0100, Jason A. Donenfeld wrote:
> +	for (; data != end; data += sizeof(u64)) {
> +		m = get_unaligned_le64(data);
> +		v3 ^= m;
> +		SIPROUND;
> +		SIPROUND;
> +		v0 ^= m;
> +	}
> +#if defined(CONFIG_DCACHE_WORD_ACCESS) && BITS_PER_LONG == 64
> +	b |= le64_to_cpu(load_unaligned_zeropad(data) & bytemask_from_count(left));
> +#else

Hmm, I don't think you can really do load_unaligned_zeropad() without first
checking for 'left != 0'.  The fixup section for load_unaligned_zeropad()
assumes that rounding the pointer down to a word boundary will produce an
address from which an 'unsigned long' can be loaded.  But if 'left = 0' and we
happen to be on a page boundary with the next page unmapped, then this will not
be true and the second load will still fault.

Eric

  parent reply	other threads:[~2016-12-13  8:39 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-09 18:36 [kernel-hardening] [PATCH] siphash: add cryptographically secure hashtable function Jason A. Donenfeld
2016-12-09 18:36 ` Jason A. Donenfeld
2016-12-10 12:37 ` [kernel-hardening] " Greg KH
2016-12-11 15:30   ` Jason A. Donenfeld
2016-12-11 15:30     ` Jason A. Donenfeld
2016-12-11 20:43     ` [kernel-hardening] " Greg KH
2016-12-12  3:48       ` [kernel-hardening] [PATCH v2] " Jason A. Donenfeld
2016-12-12  3:48         ` Jason A. Donenfeld
2016-12-12  4:01         ` [kernel-hardening] " Linus Torvalds
2016-12-12  4:01           ` Linus Torvalds
2016-12-12  5:48           ` [kernel-hardening] " Jason A. Donenfeld
2016-12-12  5:48             ` Jason A. Donenfeld
2016-12-12 21:37             ` [kernel-hardening] " Linus Torvalds
2016-12-12 21:37               ` Linus Torvalds
2016-12-12 22:18               ` [kernel-hardening] [PATCH v3] " Jason A. Donenfeld
2016-12-12 22:18                 ` Jason A. Donenfeld
2016-12-12 23:01                 ` [kernel-hardening] " Andi Kleen
2016-12-12 23:01                   ` Andi Kleen
2016-12-13  8:39                 ` Eric Biggers [this message]
2016-12-13  8:39                   ` Eric Biggers
2016-12-13 19:26                   ` [kernel-hardening] " Linus Torvalds
2016-12-13 19:26                     ` Linus Torvalds
2016-12-13 22:43                   ` [kernel-hardening] " Jason A. Donenfeld
2016-12-13 22:43                     ` Jason A. Donenfeld
2016-12-13 22:48                   ` [kernel-hardening] [PATCH v4] " Jason A. Donenfeld
2016-12-13 22:48                     ` Jason A. Donenfeld
2016-12-12  5:42         ` [kernel-hardening] Re: [PATCH v2] " Eric Biggers
2016-12-12  5:42           ` Eric Biggers
2016-12-12 21:17           ` [kernel-hardening] " Jason A. Donenfeld
2016-12-12 21:17             ` Jason A. Donenfeld
2016-12-10 14:17 ` [kernel-hardening] Re: [PATCH] " Vegard Nossum
2016-12-10 14:17   ` Vegard Nossum
2016-12-10 15:35   ` [kernel-hardening] " George Spelvin
2016-12-10 15:35     ` George Spelvin
2016-12-10 18:13   ` [kernel-hardening] " Jean-Philippe Aumasson
2016-12-10 18:13     ` Jean-Philippe Aumasson
  -- strict thread matches above, loose matches on Subject: below --
2016-12-12 23:04 [kernel-hardening] Re: [PATCH v3] " Jason A. Donenfeld
2016-12-13 19:25 ` Linus Torvalds
2016-12-13 23:36   ` Jason A. Donenfeld

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=20161213083948.GA8994@zzz \
    --to=ebiggers3@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=ak@linux.intel.com \
    --cc=djb@cr.yp.to \
    --cc=gregkh@linuxfoundation.org \
    --cc=jeanphilippe.aumasson@gmail.com \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    --cc=luto@amacapital.net \
    --cc=sbauer@eng.utah.edu \
    --cc=torvalds@linux-foundation.org \
    /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.