[Bug 252549] statically linked threaded binaries have executable thread stacks

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Jan 10 02:49:24 UTC 2021


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

            Bug ID: 252549
           Summary: statically linked threaded binaries have executable
                    thread stacks
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: threads
          Assignee: threads at FreeBSD.org
          Reporter: emaste at freebsd.org

The stack created by pthread_create in a statically linked binary has RWX
protection, regardless of the binary's desired stack (via PT_GNU_STACK).
Initial stack has expected protection.

See https://reviews.freebsd.org/D28050 for the discovery of this issue.

lib/libc/gen/dlfcn.c provides a weak _rtld_get_stack_prot for statically linked
binaries:

#pragma weak _rtld_get_stack_prot
int
_rtld_get_stack_prot(void)
{

        return (PROT_EXEC | PROT_READ | PROT_WRITE);
}

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


More information about the freebsd-threads mailing list