Description
These three sections are present in the relocation-model test's Makefile:
$(RUSTC) -C relocation-model=dynamic-no-pic foo.rs
$(call RUN,foo)
$(RUSTC) -C relocation-model=default foo.rs
$(call RUN,foo)
$(RUSTC) -C relocation-model=static foo.rs
$(call RUN,foo)
On systems with PaX's MPROTECT enabled (and with ELFRELOCS disabled), relocations are forbidden by default. Running these binaries therefore requires use of paxctl-ng to disable MPROTECT, like so:
$(RUSTC) -C relocation-model=dynamic-no-pic foo.rs
paxctl-ng -cm $(TMPDIR)/foo
$(call RUN,foo)
$(RUSTC) -C relocation-model=default foo.rs
paxctl-ng -cm $(TMPDIR)/foo
$(call RUN,foo)
$(RUSTC) -C relocation-model=static foo.rs
paxctl-ng -cm $(TMPDIR)/foo
$(call RUN,foo)
Two notes:
- Of course this particular change only works when paxctl-ng is in the $PATH, as it is for me on my system.
- The first of these three sections actually does not require the paxctl-ng command! I believe that this is because foo.rs contains nothing but an empty
main
, and the dynamic-no-pic option uses PIC dynamic libraries, so there's no reason for relocations to be produced.
My feeling is that either this test needs to go away (it's not clear to me what it's actually checking for, or that it works as intended), or we need to add paxctl detection back into the build system for this test.
Note that reverting the changes from #14850 is not enough to accomplish the latter. Nowadays most PaX systems are probably using extended attributes, which means that the newer command paxctl-ng should be searched for first, and then the obsolete paxctl command should be used only if that's not present.