[Bug 281433] Changing kern.elf64 sysctl's requires press-button reboot

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 11 Sep 2024 08:30:17 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281433

            Bug ID: 281433
           Summary: Changing kern.elf64 sysctl's requires press-button
                    reboot
           Product: Base System
           Version: 14.0-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: dewayne@heuristicsystems.com.au

Problem: 
While trying to resolve a dlopen failure for an application, I set
sysctl kern.elf64.allow_wx=0 kern.elf64.nxstack=0

Every command subsequent to setting these variable to 0, returns:
exec_new_vmspace: mapping stack size 0x20000000 prot 0x7 failed, mach error 2
errno 13
A hard reboot is required.

Reproducible:
# sysctl kern.elf64.allow_wx=0 kern.elf64.nxstack=0
# whoami
exec_new_vmspace: mapping stack size 0x20000000 prot 0x7 failed, mach error 2
errno 13

Drilling down, I notice that I have
security.bsd.stack_guard_page=1

Disabling this security.bsd.stack_guard_page=0 before
sysctl kern.elf64.allow_wx=0 kern.elf64.nxstack=0
Allows the machine to perform a few (less than 3) commands before the above
exec_new_vmspace message is the only response, again requiring a hard reset.

Platforms: both development machines on Windows VirtualBox
FreeBSD14.0-p4 amd-64 (near virgin added MAC modules to kernel)
FreeBSD14.0-p5 amd-64 (modified kernel and loader.conf and sysctl.conf)

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