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

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 12 Sep 2024 01:05:34 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281433

--- Comment #3 from dewayne@heuristicsystems.com.au ---
(In reply to Konstantin Belousov from comment #1)
I'm really impressed that you were able to identify the problem, and so
quickly.  Thank-you.  Could you provide a hint how I can fix?

So that I can disable this feature, I need to find where/how PT_GNU_STACK is
revealed on my 14.0 boxes using clang version 16.0.6, LLD 16.0.6. My futile
attempts involved:

# objdump -T -t `which whoami`|grep -i  -e stack -e gnu
0000000000000000      DO *UND*  0000000000000000 (FBSD_1.0)   __stack_chk_guard
0000000000000000      DF *UND*  0000000000000000 (FBSD_1.0)   __stack_chk_fail

# readelf -a `which whoami` |grep -i  -e stack -e gnu -e id
  GNU_RELRO      0x0000000000002540 0x0000000000004540 0x0000000000004540
  GNU_EH_FRAME   0x00000000000014ac 0x00000000000014ac 0x00000000000014ac
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
...
    27: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  UND
__stack_chk_guard@FBSD_1.0 (3)
    31: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND
__stack_chk_fail@FBSD_1.0 (3)
  GNU           0x00000010      NT_GNU_BUILD_ID (Build id set by ld(1))
   Build ID: ef0defaeb38f943913d65e8474989b1c

# objdump -T -t  /libexec/ld-elf.so.1 | grep -i  -e stack -e gnu -e id
000000000000e260 g    DF .text  0000000000000007  FBSDprivate_1.0
_rtld_get_stack_prot

Nothing helpful.  (I also tried hd and ktrace)

So is there a clue from my /etc/make*.conf
# make -C /usr/src -VCFLAGS -Vspace -VLDFLAGS
-O2 -pipe -march=haswell -fomit-frame-pointer -fno-signed-zeros -g0 -ggdb0
-DSTRIP_FBSDID -UDEBUGGING -DNDEBUG -Qunused-arguments
-Wno-error=unused-command-line-argument -Wno-error=unknown-warning-option
-fno-common -fno-asynchronous-unwind-tables -Wl,-zrelro -Wl,-znow
-Wl,--strip-debug -Wl,--build-id=md5 -Wl,--hash-style=sysv -DPIC -fpie

-Wl,-zrelro -Wl,-znow -Wl,--strip-debug -Wl,--build-id=md5
-Wl,--hash-style=sysv -pie

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