racket / racket/racket

W^X non-compliance

Open
#1,296 25 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
Racket
Stars
5.2k
Forks
698
Avg merge
18h 34m
Merged PRs (30d)
5

Description

I noticed in a list maintained by a PaX developer that Racket doesn't yet conform to W^X. This means that Racket maps memory pages that at some point simultaneously have write and execute permissions at the hardware level. These permissions are determined by the options passed to mmap(2), and by any subsequent calls to mprotect(2).

WX pages make heap-based exploits easier, so they're being phased out. I'm not aware of a reasonable use case for them, either. Relatively few projects still use WX pages (most include as-of-yet untamed JIT compilers), and in the not-so-distant future operating systems will probably enforce W^X.

I don't have Racket development experience and don't have time to start at the moment. I thought I'd mention this to start the conversation, though.

A few examples:

  • racket/src/racket/src/salloc.c:941
  • racket/src/racket/src/salloc.c:947
  • racket/src/racket/sgc/sgc.c:975
  • racket/src/racket/gc/os_dep.c:1940

Thanks for your time,
Mike

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the mmap(2) and mprotect(2) call sites in racket/src/racket/src/salloc.c, racket/src/racket/sgc/sgc.c, and racket/src/racket/gc/os_dep.c. Trace why those mappings require simultaneous write and execute permissions and determine whether the runtime's allocation or garbage-collection paths can avoid them. Done means Racket no longer creates hardware-level WX pages, with relevant behavior verified across the affected paths.

Written by the indexing model from the issue text.

Assessment

Domain
operating-systems, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.