[Bug 239873] www/firefox and mail/thunderbird don't like the new ASLR "stackgap" feature

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Aug 12 20:15:07 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239873

--- Comment #3 from sigsys at gmail.com ---
(In reply to Thibault Payet from comment #2)
Same problem here.

Looks like the proccontrol stackgap toggle only affects the stack "guard page"
(handled by vm_map_stack_locked() in sys/vm/vm_map.c), not the ASLR randomized
stackgap.

This patch makes it affect the ASLR stackgap too and that makes firefox work
with proccontrol.

diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index fe71acabe0b..56623f29d4e 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -2766,6 +2766,9 @@ __elfN(stackgap)(struct image_params *imgp, uintptr_t
*stack_base)

        if ((imgp->map_flags & MAP_ASLR) == 0)
                return;
+       if ((imgp->proc->p_flag2 & P2_STKGAP_DISABLE) != 0 ||
+           (imgp->proc->p_fctl0 & NT_FREEBSD_FCTL_STKGAP_DISABLE) != 0)
+               return;
        pct = __elfN(aslr_stack_gap);
        if (pct == 0)
                return;

Also if you mark firefox's binary with the new ELF feature flag to disable
stackgap like so:

# elfctl -e +stackgap /usr/local/bin/firefox

Then firefox just works without needing to start with it proccontrol.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-gecko mailing list