All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabrice Bellard <fabrice@bellard.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] fix interaction with noexecstack
Date: Sat, 04 Sep 2004 12:49:38 +0200	[thread overview]
Message-ID: <41399DC2.2030404@bellard.org> (raw)
In-Reply-To: <20040904000017.GA27986@xi.wantstofly.org>

The patch seems OK for me, at least until the instruction cache is 
dynamically allocated.

Fabrice.

Lennert Buytenhek wrote:
> Hi,
> 
> qemu-arm doesn't work on Fedora Core 2 by default because it expects to
> be able to execute stuff off the heap (code_gen_buffer), but that part of
> the heap is not marked PROT_EXEC, and Fedora Core 2 has a patch that sets
> the CS segment limit to the highest PROT_EXEC-mapped address in the address
> space.
> 
> It's a bit of a hacky fix, but it Works For Me(tm) on the default Fedora
> 2.6.5 kernel.  I haven't yet looked into why qemu-arm was crashing on the
> Fedora 2.6.[78] update kernels.
> 
> 
> --L
> 
> 
> diff -urN qemu-20040804.orig/exec.c qemu-20040804.test/exec.c
> --- qemu-20040804.orig/exec.c	2004-07-06 02:00:18.000000000 +0300
> +++ qemu-20040804.test/exec.c	2004-09-04 02:49:25.414945456 +0300
> @@ -127,6 +127,9 @@
>  
>  static void page_init(void)
>  {
> +    unsigned long address;
> +    unsigned long length;
> +
>      /* NOTE: we can always suppose that qemu_host_page_size >=
>         TARGET_PAGE_SIZE */
>  #ifdef _WIN32
> @@ -134,6 +137,17 @@
>  #else
>      qemu_real_host_page_size = getpagesize();
>  #endif
> +
> +    address = (unsigned long)code_gen_buffer;
> +    address &= ~(qemu_real_host_page_size - 1);
> +
> +    length = (unsigned long)code_gen_buffer + sizeof(code_gen_buffer);
> +    length -= address;
> +    length += qemu_real_host_page_size - 1;
> +    length &= ~(qemu_real_host_page_size - 1);
> +
> +    mprotect(address, length, PROT_READ | PROT_WRITE | PROT_EXEC);
> +
>      if (qemu_host_page_size == 0)
>          qemu_host_page_size = qemu_real_host_page_size;
>      if (qemu_host_page_size < TARGET_PAGE_SIZE)
> 
> 
> 
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
> 
> 

  parent reply	other threads:[~2004-09-04 10:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-04  0:00 [Qemu-devel] [PATCH] fix interaction with noexecstack Lennert Buytenhek
2004-09-04  0:15 ` Lennert Buytenhek
2004-09-04 10:49 ` Fabrice Bellard [this message]
2004-09-04 12:19   ` Filip Navara
2004-09-04 14:45     ` [Qemu-devel] " Ronald
2004-09-04 16:15       ` Filip Navara
2004-09-04 17:07         ` [Qemu-devel] " Ronald
2004-09-07  7:59           ` Hartmut Birr
2004-09-05 14:13         ` [Qemu-devel] " Lennert Buytenhek
2004-09-29 21:23         ` Fabrice Bellard

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=41399DC2.2030404@bellard.org \
    --to=fabrice@bellard.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 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.