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)
Sun, Apr 21, 9:37 PM
Unknown Object (File)
Fri, Apr 5, 2:00 PM
Unknown Object (File)
Jan 10 2024, 8:11 PM
Unknown Object (File)
Dec 10 2023, 2:32 PM
Unknown Object (File)
Nov 30 2023, 1:50 PM
Unknown Object (File)
Oct 19 2023, 5:45 PM
Unknown Object (File)
Oct 11 2023, 11:49 PM
Unknown Object (File)
Oct 10 2023, 6:23 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.