qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	Michael Tokarev <mjt@tls.msk.ru>,
	Leon Alrae <leon.alrae@imgtec.com>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [Qemu-devel] qemu-img segfaults on MIPS hosts due to not having an executable stack
Date: Mon, 13 Jun 2016 16:16:02 +0100	[thread overview]
Message-ID: <CAFEAcA8XEfFf45U2RQfZ4DMrwXwei=+6XzR99+D0CRUDoz=sBw@mail.gmail.com> (raw)
In-Reply-To: <20160613144555.GP18794@redhat.com>

On 13 June 2016 at 15:45, Daniel P. Berrange <berrange@redhat.com> wrote:
> On Mon, Jun 13, 2016 at 03:11:08PM +0100, Peter Maydell wrote:
>> QEMU currently allocates coroutine stacks with a plain g_malloc(),
>> which makes them r/w but not exec. That's a bug in QEMU which we
>> should fix (though I'm not sure how best to identify the required
>> permissions for stacks). It's a bit unhelpful of the kernel to
>> assume an executable stack and not give a useful diagnostic or
>> failure mode if it's not true, though.
>
> I'd suggest we just #ifdef the code base on architecture, on that basis
> all platforms except mips are probably happy with non-exec stack.

Have they really all got rid of signal handler trampolines?

(Also, probably breaks running QEMU under QEMU linux-user, because
our linux-user code still assumes trampolines generally :-))

> eg, just change the g_malloc(size) to
>
>   mmap(0, size,
>   #ifdef (TARGET_MIPS)

This wants to be per *host*, not per target.

>        /* FP emulation in linux requires executable stack */
>        PROT_READ | PROT_WRITE | PROT_EXEC,
>   #else
>        PROT_READ | PROT_WRITE,
>   #endif
>        MAP_PRIVATE | MAP_ANONYMOUS,
>        -1, 0);

I have a definite dislike of architecture-ifdef ladders if
we can possibly avoid them. (We have too many already.)

thanks
-- PMM

  reply	other threads:[~2016-06-13 15:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13 14:11 [Qemu-devel] qemu-img segfaults on MIPS hosts due to not having an executable stack Peter Maydell
2016-06-13 14:45 ` Daniel P. Berrange
2016-06-13 15:16   ` Peter Maydell [this message]
2016-06-13 22:10     ` Ralf Baechle

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='CAFEAcA8XEfFf45U2RQfZ4DMrwXwei=+6XzR99+D0CRUDoz=sBw@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=berrange@redhat.com \
    --cc=leon.alrae@imgtec.com \
    --cc=mjt@tls.msk.ru \
    --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).