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)
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
Unknown Object (File)
Aug 30 2024, 9:00 PM
Unknown Object (File)
Aug 19 2024, 8:30 AM
Unknown Object (File)
Aug 17 2024, 12:53 PM

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.