Page MenuHomeFreeBSD

fasttrap: Avoid creating WX mappings
ClosedPublic

Authored by markj on Feb 16 2022, 4:08 PM.
Tags
None
Referenced Files
F156430170: D34304.id103355.diff
Wed, May 13, 4:05 PM
F156403853: D34304.id102846.diff
Wed, May 13, 11:08 AM
Unknown Object (File)
Wed, May 13, 1:46 AM
Unknown Object (File)
Mon, May 4, 3:07 PM
Unknown Object (File)
Thu, Apr 30, 8:45 AM
Unknown Object (File)
Tue, Apr 28, 12:41 AM
Unknown Object (File)
Thu, Apr 23, 12:01 PM
Unknown Object (File)
Tue, Apr 21, 11:08 PM

Details

Summary

fasttrap instruments certain instructions by overwriting them and
copying the original instruction to some per-thread scratch space which
is executed after the probe fires. This trampoline jumps back to the
tracepoint after executing the original instruction.

The created mapping has both write and execute permissions, and so this
mechanism doesn't work when allow_wx is disabled. Work around the
restriction by using proc_rwmem() to write to the trampoline.

PR: 261965

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable