unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Jeffrey Walton <noloader@gmail.com>
To: 47429@debbugs.gnu.org
Subject: bug#47429: Re 47429:allocating JIT code buffer failed: Permission denied
Date: Fri, 26 Mar 2021 19:34:24 -0400	[thread overview]
Message-ID: <CAH8yC8=qTLKQZbOC9CGC7eFTn+xyPQw4tds6+e=xAgS8bmA+rQ@mail.gmail.com> (raw)
In-Reply-To: <CAH8yC8m8d5uVWOAFAPdr_v5KCg_o6xAhiU+T17Way3ZaDuetDw@mail.gmail.com>

Dammit, check for the proper return value...

% cat mmap-test.c
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/mman.h>
int main(int argc, char* argv[])
{
    size_t len = 10;
    int prot = PROT_EXEC | PROT_READ | PROT_WRITE;
    int flags = MAP_PRIVATE | MAP_ANONYMOUS;

    void *p = mmap (NULL, len, prot, flags, -1, 0);
    int err = errno;

    if (p != (void*) -1) {
        printf("p is good\n");
        munmap(p, len);
    }
    else {
        printf("p is bad (%d)\n", err);
    }

    return 0;
}

% clang -Wall mmap-test.c -o mmap-test.exe
% ./mmap-test.exe
p is bad (13)

That is the permission denied.

Next, avoid W+X:

% cat mmap-test.c
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/mman.h>
int main(int argc, char* argv[])
{
    size_t len = 10;
    int prot = /*PROT_EXEC |*/ PROT_READ | PROT_WRITE;
    int flags = MAP_PRIVATE | MAP_ANONYMOUS;

    void *p = mmap (NULL, len, prot, flags, -1, 0);
    int err = errno;

    if (p != (void*) -1) {
        printf("p is good\n");
        munmap(p, len);
    }
    else {
        printf("p is bad (%d)\n", err);
    }

    return 0;
}

It looks like W^X is the culprit.

Jeff





  parent reply	other threads:[~2021-03-26 23:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26 22:48 bug#47429: allocating " Jeffrey Walton
2021-03-26 23:27 ` bug#47429: Re 47429:allocating " Jeffrey Walton
2021-03-26 23:34 ` Jeffrey Walton [this message]
2021-03-27  1:29 ` Jeffrey Walton
2021-03-27  2:39 ` Jeffrey Walton

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

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH8yC8=qTLKQZbOC9CGC7eFTn+xyPQw4tds6+e=xAgS8bmA+rQ@mail.gmail.com' \
    --to=noloader@gmail.com \
    --cc=47429@debbugs.gnu.org \
    --subject='Re: bug#47429: Re 47429:allocating JIT code buffer failed: Permission denied' \
    /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

unofficial mirror of bug-guile@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guile-bugs/0 guile-bugs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guile-bugs guile-bugs/ https://yhetil.org/guile-bugs \
		bug-guile@gnu.org
	public-inbox-index guile-bugs

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.lisp.guile.bugs
	nntp://news.gmane.io/gmane.lisp.guile.bugs


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git