Re: git: 766c2466ff46 - main - mmap map_at_zero test: handle W^X

From: Eric van Gyzen <>
Date: Mon, 28 Feb 2022 00:37:23 UTC
> If the test is just as legitimate without PROT_EXEC, what’s the
> justification for not just removing PROT_EXEC entirely rather than
> making its behaviour depend on the sysctl, which could become confusing
> (and complicates the test)? IMO either the test should be skipped for
> !allow_wx or it should always just make a RW mapping; this choice is
> rather odd.

The short answer is, we didn’t know whether PROT_EXEC was essential, so this seemed like the safest change to preserve the intent but also work correctly with W^X.  It was also the easiest way to increase test coverage of all these cases with the least code, since some systems will run with W+X and others with W^X.