summaryrefslogtreecommitdiff
path: root/external/cddl/osnet/dev
AgeCommit message (Collapse)Author
2023-05-22dtrace_fbt: Read and write instructions appropriately-endian on arm.riastradh
arm is a little more complicated because it has three cases: - big-endian data, big-endian instructions - big-endian data, little-endian instructions - little-endian data, little-endian instructions
2023-05-09dtrace_fbt: Read and write instruction words in little-endian.riastradh
Step toward making this work on aarch64eb.
2023-04-17(missed in pervious commit)skrll
Rename VM_KERNEL_IO_ADDRESS to VM_KERNEL_IO_BASE to match RISC-V It's less letters, matches other similar variables and will help with sharing code between the two architectures. NFCI.
2022-09-02dtrace_fbt: Allow tracing names that start with `__'.riastradh
This was never relevant on FreeBSD and I don't think it is relevant on NetBSD either. The FreeBSD change to lift this restriction had the following comment: r306570 | markj | 2016-10-02 00:35:00 +0000 (Sun, 02 Oct 2016) | 7 lines Allow tracing of functions prefixed by "__". This restriction was inherited from upstream but is not relevant on FreeBSD. Furthermore, it hindered the tracing of locking primitive subroutines.
2022-08-31dtrace_sdt: Fix bug in builtin module reference counting.riastradh
Don't module_hold(NULL)! This mistake was introduced in my attempt to get dtrace working for sdt probes defined in non-builtin modules like zfs.
2022-08-21dtrace/i386: Need machine/cpufunc.h for x86_read_flags and rcr2.riastradh
2022-08-07bsd.kmodule.mk: Build modules with KDTRACE_HOOKS if MKDTRACE=yes.riastradh
2022-08-07dtrace_sdt: Register sdt providers and probes in loaded modules too.riastradh
2022-03-28driver(9): devsw_detach never fails. Make it return void.riastradh
Prune a whole lotta dead branches as a result of this. (Some logic calling this is also wrong for other reasons; devsw_detach is final -- you should never have any reason to decide to roll it back. To be cleaned up in subsequent commits...) XXX kernel ABI change to devsw_detach signature requires bump
2022-02-27lockstat(4): KNF. No functional change intended.riastradh
2022-02-27lockstat(4): Membar audit.riastradh
- Serialize updates to lockstat_enabled, lockstat_dev_enabled, and lockstat_dtrace_enabled with a new __cpu_simple_lock. - Use xc_barrier to obviate any need for additional membars in lockstat_event. - Use atomic_load/store_* for access that might not be serialized by lockstat_lock or lockstat_enabled_lock.
2021-08-18PR/56355: Exclude the symbol trap, not all symbols other than trap.riastradh
2021-08-15PR/56355: Taylor Campbell: restore strcmp() over strncmp()christos
2021-08-11PR/56355: Brad Harder: dtrace triggers double-fault in supervisor modechristos
2021-04-07Use NAL (nop-and-link) to get the current PC.simonb
2021-04-06sizeof(*var) instead of sizeof(type)simonb
2021-04-06sizeof(*var) instead of sizeof(type)simonb
Call kmem_free() with size of data being freed.
2021-04-06sizeof(*var) instead of sizeof(type)christos
2021-04-06Call kmem_free() with the size of the thing we are freeing. Fixes panicsimonb
when unloading the ktrace module on MIPS.
2021-03-29Work in progress dtrace for MIPS. MIPS support mostly copied fromsimonb
FreeBSD, with NetBSD-specific changes largely based on aarch64 dtrace support. Working well enough for system call tracing.
2021-03-29Add cyclic_machdep.c for MIPSsimonb
The code is identical to i386's one.
2021-03-24Add NetBSD CVS IDs.simonb
2020-11-12One more catch up with ``aarch64 is not mips'' change.rin
Fix evbarm-aarch64 build.
2020-05-15Bump PROF_ARTIFICIAL_FRAMES to 4 now that cyclics are run from statclock().ad
2020-05-08Run Solaris cyclics from statclock() so dtrace isn't locked out by IPL_SCHEDad
(assuming the machine has a separate statclock() which almost all don't).
2020-05-02Modify the hotpatch mechanism, in order to make it much less ROP-friendly.maxv
Currently x86_patch_window_open is a big problem, because it is a perfect function to inject/modify executable code with ROP. - Remove x86_patch_window_open(), along with its x86_patch_window_close() counterpart. - Introduce a read-only link-set of hotpatch descriptor structures, which reference a maximum of two read-only hotpatch sources. - Modify x86_hotpatch() to open a window and call the new x86_hotpatch_apply() function in a hard-coded manner. - Modify x86_hotpatch() to take a name and a selector, and have x86_hotpatch_apply() resolve the descriptor from the name and the source from the selector, before hotpatching. - Move the error handling in a separate x86_hotpatch_cleanup() function, that gets called after we closed the window. The resulting implementation is a bit complex and non-obvious. But it gains the following properties: the code executed in the hotpatch window is strictly hard-coded (no callback and no possibility to execute your own code in the window) and the pointers this code accesses are strictly read-only (no possibility to forge pointers to hotpatch an area that was not designated as hotpatchable at compile-time, and no possibility to choose what bytes to write other than the maximum of two read-only templates that were designated as valid for the given destination at compile-time). With current CPUs this slightly improves a situation that is already pretty bad by definition on x86. Assuming CET however, this change closes a big hole and is kinda great. The only ~problem there is, is that dtrace-fbt tries to hotpatch random places with random bytes, and there is just no way to make it safe. However dtrace is only in a module, that is rarely used and never compiled into the kernel, so it's not a big problem; add a shitty & vulnerable independent hotpatch window in it, and leave big XXXs. It looks like fbt is going to collapse soon anyway.
2020-02-12Switch from db_write_bytes to using direct-mapping.riastradh
This way there's no dependency on ddb.
2020-02-12Change the address ranges that aarch64 considers toxic for dtrace.riastradh
`Toxic' means dtrace forbids D scripts from even attempting to read or write at them. Previously we considered [0, VM_MIN_KERNEL_ADDRESS) toxic, but VM_MIN_KERNEL_ADDRESS is only the minimum address of the kernel map; the direct-mapped region lies below it, and with PMAP_MAP_POOLPAGE we allocate virtual pages for pool backing directly from physical pages through the direct-mapped region. Also, this did not consider I/O mappings to be toxic, which they probably should be. Instead, treat: [0, AARCH64_KSEG_START) and [VM_KERNEL_IO_ADDRESS, 0xfff...ff) as toxic. (The upper bound for 0xfff...ff ought to be inclusive, not exclusive, but I think we'll need another mechanism for expressing that to dtrace!)
2020-02-12Count the number of artificial frames in aarch64 fbt probe correctly.riastradh
2020-02-12Teach dtrace about el1_trap_exit frames on aarch64.riastradh
Implement dtrace_getarg and dtrace_getreg while here.
2020-02-12Tidy up a bit: don't set things we won't use; assert nonzeroness.riastradh
2020-02-12Tidy up a bit. No functional change intended.riastradh
aarch64 fbt_invop doesn't actually use the argument, but it would make more sense for it to be the return value and/or first argument register. Certainly it's not `eax'!
2020-02-12Use db_write_bytes to overwrite kernel text.riastradh
2019-12-03dtrace: add support for aarch64jmcneill
2019-11-13Use x86_patch_window_{open,close}. This also fixes a bug: the CR0/PSLmaxv
reloads were inverted.
2019-11-08dtrace_trap() gets called from alltraps() -> trap() with interrupts enabledhannken
so we cannot assert for interrupts disabled here. Should fix PR kern/54603: kernel panic when running dtruss
2019-07-23Create "dtrace_taskq" here like FreeBSD does.hannken
PR kern/54397: Panic when loading a DTrace module whilst DTrace is running
2019-07-16Always exclude "fbt_*" from the list of FBT probes.hannken
2019-07-05Change dtrace toxic range to "0 .. VM_MIN_KERNEL_ADDRESS_DEFAULT",hannken
the direct map may be mapped below "VM_MIN_KERNEL_ADDRESS".
2019-03-09Reserve DTrace sdt and fdt major numberskamil
Register cmajor 252 for fbt and 253 for sdt. Previously the major number was picked randomly and it causes conflicts with preallocated values for different devices.
2019-02-13Fix DIAGNOSTIC build; replace FreeBSD-specific function with ours.rin
2019-02-12Fix build with DIAGNOSTIC:rin
ASSERT() is enabled ifdef DEBUG, not DIAGNOSTIC.
2019-01-27Merge the [pgoyette-compat] branchpgoyette
2019-01-12There is no such function read_rflags(), probably meant x86_read_flags().hannken
2018-08-16get rid of kernelbasechristos
2018-08-12handle variable kernel vm min addresschristos
2018-07-27Replace KERN_BASE by VM_MIN_KERNEL_ADDRESS. Also add XXX on INKERNEL.maxv
2018-06-29Rework the changes to DTRACE/ZFS files that were fixing Clang/LLVM buildkamil
Rever changes to upstream files and replace them with additional -Wno- compiler argument flags. Tested with base LLVM. Requested by <chuq>
2018-06-06Correct compilation of osnet/dev/systrace/systrace.c under Clangkamil
Mark arguments to dtrace_probe_lookup() with __UNCONST(). The proper fix constifying it causes pollution of const in too many files. This could be done with -W flags, but they are incompatible between compilers. This is a step forward functional MKLLVM=yes HAVE_LLVM=yes build. Sponsored by <The NetBSD Foundation>
2018-06-06Correct compilation of osnet/dev/profile/profile.c under Clangkamil
Constify char* types when initialized with liternals. This could be done with -W flags, but they are incompatible between compilers. This is a step forward functional MKLLVM=yes HAVE_LLVM=yes build. Sponsored by <The NetBSD Foundation>