Page MenuHomeFreeBSD

[RFC] Adjust kern.usrstack sysctl by stack gap.
AbandonedPublic

Authored by dgr_semihalf.com on Aug 26 2021, 1:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 5, 7:29 AM
Unknown Object (File)
Thu, Dec 5, 7:01 AM
Unknown Object (File)
Thu, Nov 21, 8:31 PM
Unknown Object (File)
Sep 27 2024, 10:01 PM
Unknown Object (File)
Sep 22 2024, 6:44 PM
Unknown Object (File)
Sep 13 2024, 4:09 PM
Unknown Object (File)
Sep 4 2024, 9:45 AM
Unknown Object (File)
Sep 4 2024, 5:46 AM

Details

Reviewers
mw
emaste
imp
kib
cy
Summary

kern.usrstack sysctl is used by some programs (e.g. firefox) when
creating threads. This sysctl returns hardcoded value. When stack
gap is enabled, the stack is instead moved by a random amount of
bytes. This can cause those programs to crash.

Adjust kern.usrstack value by the size of stack gap. This fixes the
issue with firefox not starting with stack gap enabled.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

dgr_semihalf.com created this revision.

This requires D31516.

Another approach would be to leave this sysctl as is and instead create a new one which could be used to read the actual stack position with stack gap enabled.

This does address the firefox and thunderbird segfaults.

No, this is not going to work. Problem is that the same sysctl is used by programs to get _other_ processes stack address, in particular pstrings location.

Abandoning this, I created D31897 and D31898, which add a different sysctl and modify libthr to use it.