public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Mario 'BitKoenig' Holbe" <Mario.Holbe@TU-Ilmenau.DE>
To: Herbert Xu <herbert@gondor.hengli.com.au>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	Matt Mackall <mpm@selenic.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	Harald Welte <HaraldWelte@viatech.com>,
	Michal Ludvig <michal@logix.cz>
Subject: Re: 2.6.37-rc7: Regression: b43: crashes in hwrng_register()
Date: Thu, 6 Jan 2011 15:42:55 +0100	[thread overview]
Message-ID: <20110106144254.GC8803@darkside.kls.lan> (raw)
In-Reply-To: <20110106133541.GA22030@gondor.apana.org.au>


[-- Attachment #1.1: Type: text/plain, Size: 1887 bytes --]

On Fri, Jan 07, 2011 at 12:35:41AM +1100, Herbert Xu wrote:
> On Thu, Jan 06, 2011 at 02:15:16PM +0100, Mario 'BitKoenig' Holbe wrote:
> > 1. Having ECX on the clobber-list is not really necessary.
> > XSTORE doesn't touch ECX at all.
> > REP XSTORE would touch it, but for this ECX would be an input anyways.
> 
> The documentation wasn't clear whether ECX would be updated without
> the REP prefix so I included it to be on the safe side.  Unfortunately
> my only VIA machine is on another continent at the moment so I can't
> test it myself.  Can you verify that ECX isn't changed without the
> REP prefix?

session-log (including small test case) attached: ECX is not changed.

> > 2. Would you mind doing the same for EDX as you did for EDI?
> According to my documentation EDX isn't be modified (nor would it
> make sense as it would break REP XSTORE).  Are you seeing anything
> different?

http://linux.via.com.tw/support/beginDownload.action?eleid=181&fid=261
VIA PadLock Programming Guide, v1.66, 4th August 2005
2.1 XSTORE Instructions (page 9)
RNG Quality Factor: EDX
[...] Only the lower two bits of EDX are meaningful; the upper 30 bits
are ignored by the instruction and may be set to zero.
                                   ^^^^^^^^^^^^^^^^^^

http://hackipedia.org/Hardware/CPU/x86/chip,%20VIA/nano/Padlock,%20quick%20reference%20v0.95%20(July%2025th,%202008).pdf
PadLock Quick Reference, v0.95, 25th July 2008
RANDOM NUMBER GENERATION (page 3)
Register Usage: Output
EDX Bits 0:1 are unchanged, all higher order bits are zero.
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

See the attached session-log as well: those EDX bits are indeed zeroed.


Btw: I believe both documents are quite clear regarding ECX for XSTORE.


Mario
-- 
User sind wie ideale Gase - sie verteilen sich gleichmaessig ueber alle Platten

[-- Attachment #1.2: via-rng-test.out --]
[-- Type: text/plain, Size: 1042 bytes --]

holbe@ideapad ~ % cat via-rng-test.c
#include <stdio.h>
#include <string.h>

static inline unsigned long xstore(unsigned long *addr, unsigned long edx)
{
	unsigned long eax_out;
	unsigned long ecx = 0xaa55aa55;
	int ts_state;

	printf("ecx: %08lx\tedx: %08lx\tedi: %p\n", ecx, edx, addr);

	asm(".byte 0x0F,0xA7,0xC0 /* xstore %%edi (addr=%0) */"
		: "=m" (*addr), "=a" (eax_out), "+D" (addr), "+d" (edx), "+c" (ecx));

	printf("ecx: %08lx\tedx: %08lx\tedi: %p\n", ecx, edx, addr);

	return eax_out;
}

int main(void) {
	unsigned long addr[8];

	memset(addr, 0, sizeof(addr));

	printf("%p: %08lx\n", addr, *(unsigned long *)addr);
	xstore(addr, 0xffffff03); /* 8 rand bits, 32 stored bits */
	printf("%p: %08lx\n", addr, *(unsigned long *)addr);

	return 0;
}
holbe@ideapad ~ % gcc -o via-rng-test via-rng-test.c
holbe@ideapad ~ % ./via-rng-test
0xbff09d40: 00000000
ecx: aa55aa55   edx: ffffff03   edi: 0xbff09d40
ecx: aa55aa55   edx: 00000003   edi: 0xbff09d48
0xbff09d40: 339d4525
holbe@ideapad ~ % 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 482 bytes --]

  parent reply	other threads:[~2011-01-06 14:43 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-29  0:34 2.6.37-rc7: Regression: b43: crashes in hwrng_register() Larry Finger
2010-12-29 19:54 ` Mario 'BitKoenig' Holbe
2010-12-30  0:30   ` Larry Finger
2010-12-30  1:20     ` Mario 'BitKoenig' Holbe
2010-12-30  2:37       ` Larry Finger
2010-12-30 14:34         ` Mario 'BitKoenig' Holbe
2010-12-30 18:37           ` Larry Finger
2010-12-30 20:45             ` Mario 'BitKoenig' Holbe
2010-12-30 22:49               ` Larry Finger
2010-12-30 23:17                 ` Mario 'BitKoenig' Holbe
2010-12-31  0:37                 ` Herbert Xu
2010-12-31  0:46                   ` Larry Finger
2010-12-31  2:25                     ` Mario 'BitKoenig' Holbe
2010-12-31  2:46                       ` Herbert Xu
2010-12-31  8:51                         ` Mario 'BitKoenig' Holbe
2011-01-04  4:33                           ` Herbert Xu
2011-01-04 12:19                             ` Mario 'BitKoenig' Holbe
2011-01-04 12:38                               ` Herbert Xu
2011-01-04 12:57                                 ` Mario 'BitKoenig' Holbe
2011-01-04 22:42                                   ` Herbert Xu
2011-01-04 23:06                                     ` Mario 'BitKoenig' Holbe
2011-01-04 23:26                                       ` Larry Finger
2011-01-04 23:35                                       ` Mario 'BitKoenig' Holbe
2011-01-05  0:30                                       ` Herbert Xu
2011-01-05  1:45                                         ` Mario 'BitKoenig' Holbe
2011-01-05  3:52                                         ` Mario 'BitKoenig' Holbe
2011-01-05  5:47                                           ` Herbert Xu
2011-01-05 13:16                                             ` Mario 'BitKoenig' Holbe
2011-01-06  6:12                                               ` Herbert Xu
2011-01-06 13:15                                                 ` Mario 'BitKoenig' Holbe
2011-01-06 13:35                                                   ` Herbert Xu
2011-01-06 13:56                                                     ` Larry Finger
2011-01-06 14:42                                                     ` Mario 'BitKoenig' Holbe [this message]
2011-01-07  3:49                                                       ` Herbert Xu
2011-01-07  3:54                                                         ` crypto: padlock - Move padlock.h into include/crypto Herbert Xu
2011-01-07  3:55                                                           ` hwrng: via_rng - Fix memory scribbling on some CPUs Herbert Xu
2011-01-05  0:14                                     ` 2.6.37-rc7: Regression: b43: crashes in hwrng_register() Larry Finger
2011-01-05  0:19                                       ` Herbert Xu
2011-01-05  1:38                                         ` Larry Finger
2010-12-31  1:57               ` Michael Büsch
2010-12-31  2:25                 ` Larry Finger
  -- strict thread matches above, loose matches on Subject: below --
2010-12-28 13:32 Mario 'BitKoenig' Holbe
2010-12-29 10:30 ` Maciej Rutecki

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=20110106144254.GC8803@darkside.kls.lan \
    --to=mario.holbe@tu-ilmenau.de \
    --cc=HaraldWelte@viatech.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=herbert@gondor.hengli.com.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal@logix.cz \
    --cc=mpm@selenic.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox