Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jan 2021 02:49:24 +0000
From:      bugzilla-noreply@freebsd.org
To:        threads@FreeBSD.org
Subject:   [Bug 252549] statically linked threaded binaries have executable thread stacks
Message-ID:  <bug-252549-13406@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

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@FreeBSD.org
          Reporter: emaste@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.

help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-252549-13406>