qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Giovanni Mascellani <gio@debian.org>,
	David Hildenbrand <david@redhat.com>
Cc: Bug 1815024 <1815024@bugs.launchpad.net>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Bug 1815024] [NEW] SIGILL on instruction "stck" under qemu-s390x in user mode
Date: Thu, 7 Feb 2019 11:49:13 +0100	[thread overview]
Message-ID: <20190207114913.2c5f2c5b.cohuck@redhat.com> (raw)
In-Reply-To: <154953276796.22523.967637403683519556.malonedeb@chaenomeles.canonical.com>

On Thu, 07 Feb 2019 09:46:07 -0000
Giovanni Mascellani <gio@debian.org> wrote:

> Public bug reported:
> 
> qemu-s390x in user mode crashes with SIGILL (under host architecture
> x86_64, running Debian unstable) when executing target instruction
> "stck" ("STORE CLOCK", see
> https://www-01.ibm.com/support/docview.wss?uid=isg26480faec85f44e2385256d5200627dee&aid=1),
> which is basically a kind of equivalent of Intel "rdtsc". The same
> instruction works fine under qemu-s390x in system mode. The bug is
> reproducible with both the qemu version distributed in Debian unstable
> and with the latest upstream master (commit
> 47994e16b1d66411953623e7c0bf0cdcd50bd507).

Did that work before commit 7de3b1cdc67 ("s390x/tcg: properly implement
the TOD")?

> 
> This bug manifested itself as a crash of ssh-keygen program, which uses
> "stck" to obtain some bits of randomness during key creation. Bisection
> of the code led to the attached minimal example. Compile with (inside an
> s390x system):
> 
>  $ gcc -c -o test.o test.c
>  $ gcc -c -o rdtsc.o rdtsc.S
>  $ gcc -o test test.o rdtsc.o
> 
> Then run test. It will crash with SIGILL in user mode and run fine in
> system mode. Also, compare with the original file at
> https://github.com/openssl/openssl/blob/master/crypto/s390xcpuid.pl#L139
> (there the instruction "stckf" is also used; it is probable that it has
> the same problem if it is supported altogether, but it did not test for
> this).

stckf will end up at the same helper, so it seems likely to hit the
same problem.

> 
> Running qemu-s390x with options -d
> in_asm,out_asm,op,op_opt,exec,nochain,cpu gives the trace attached in
> log.txt.

I think the problem is that the helper tries to access the todstate
object, which we won't have in user mode IIUC. David?

  parent reply	other threads:[~2019-02-07 10:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-07  9:46 [Qemu-devel] [Bug 1815024] [NEW] SIGILL on instruction "stck" under qemu-s390x in user mode Giovanni Mascellani
2019-02-07  9:46 ` [Qemu-devel] [Bug 1815024] " Giovanni Mascellani
2019-02-07  9:46 ` Giovanni Mascellani
2019-02-07  9:48 ` Giovanni Mascellani
2019-02-07 10:49 ` Cornelia Huck [this message]
2019-02-07 11:05   ` [Qemu-devel] [Bug 1815024] [NEW] " Giovanni Mascellani
2019-02-07 11:26     ` Thomas Huth
2019-02-07 11:46       ` Giovanni Mascellani
2019-02-07 12:01         ` Thomas Huth
2019-02-07 12:15           ` Richard Henderson
2019-02-07 12:36             ` Thomas Huth
2019-02-07 13:05               ` Richard Henderson
2019-02-07 13:00             ` Giovanni Mascellani
2019-02-07 13:09               ` Thomas Huth
2019-02-22 15:24 ` [Qemu-devel] [Bug 1815024] " Thomas Huth
2019-04-24  6:09 ` Thomas Huth
2019-04-24  6:09   ` Thomas Huth

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=20190207114913.2c5f2c5b.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=1815024@bugs.launchpad.net \
    --cc=david@redhat.com \
    --cc=gio@debian.org \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).