jrmarino / synth

Next D/Ports build tool for live systems (Alternative for Portmaster and Portupgrade tools)
ISC License
251 stars 15 forks source link

synth fails with W^X enabled #207

Open basbebe opened 2 years ago

basbebe commented 2 years ago

Having W^X enabled on FreeBSD 13.0, synth fails immediately.

/etc/sysctl.conf

kern.elf32.allow_wx=0
kern.elf64.allow_wx=0
> doas synth upgrade-system
Password:
exec_new_vmspace: mapping stack size 0x20000000 prot 0x7 failed mach error 2 errno 13
fish: Job 1, 'doas synth upgrade-system' terminated by signal SIGABRT (Abort)
jrmarino commented 1 year ago

I assume this could be fixed with specific compilation flags (unclear if it's c only or both c and ada)

jrmarino commented 1 year ago

heh, synth made an article on this: https://ximalas.info/2021/04/15/freebsd-13-and-wx-memory-mapping-policy-for-user-processes/

jrmarino commented 1 year ago

TLDR; For now run this command if W^X enabled on FreeBSD 13:

elfctl -e +wxneeded /usr/local/bin/synth

But read the entire article. there's even a provided script for synth.

Ximalas commented 7 months ago

If you don't mind amending your own copy of ports-mgmt/synth/Makefile, you can add these two lines after the WATCHDOG_EXTRA_PATCHES_OFF line and have the W^X problem taken care of automatically:

USES+=elfctl
ELF_FEATURES+=+wxneeded:build/synth
jrmarino commented 7 months ago

you should let the maintainer (Fluffy) know. I'm sure he'd add those lines. His address is listed under maintainer at https://www.freshports.org/ports-mgmt/synth

Ximalas commented 7 months ago

I created PR 276886, https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276886. Fingers crossed.