summaryrefslogtreecommitdiffstats
path: root/sys/cddl/dev
Commit message (Collapse)AuthorAgeFilesLines
* MFC 289769,289822,290143,290144:jhb2016-01-201-10/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename remaining linux32 symbols from linux_* to linux32_*. 289769: Rename remaining linux32 symbols such as linux_sysent[] and linux_syscallnames[] from linux_* to linux32_* to avoid conflicts with linux64.ko. While here, add support for linux64 binaries to systrace. - Update NOPROTO entries in amd64/linux/syscalls.master to match the main table to fix systrace build. - Add a special case for union l_semun arguments to the systrace generation. - The systrace_linux32 module now only builds the systrace_linux32.ko. module on amd64. - Add a new systrace_linux module that builds on both i386 and amd64. For i386 it builds the existing systrace_linux.ko. For amd64 it builds a systrace_linux.ko for 64-bit binaries. 289822: Fix build for the KTR-enabled kernels. 290143: Fix build with DEBUG defined. 290144: Update for LINUX32 rename. The assembler didn't complain about undefined symbols but just used 0 after the rename.
* MFC r288363: std: it is important that func name is never an empty stringavg2015-10-231-0/+2
|
* MFC r288362: sdt: start checking version field when parsing probe definitionsavg2015-10-231-0/+6
|
* MFC r288365: sdt: static-ize couple of variablesavg2015-10-231-2/+2
|
* MFC r288364: sdt module does not seem to actually use any symbol fromavg2015-10-231-1/+0
| | | | opensolaris module
* MFC r288361: dtrace_getarg: remove stray return statement on amd64, powerpcavg2015-10-232-2/+0
|
* MFC r285643:kib2015-08-072-8/+8
| | | | | When checking for the valid value of the frame pointer, verify that it belongs to the kernel stack address range for the thread.
* MFC r285041:kib2015-08-051-3/+0
| | | | | Use single instance of the identical INKERNEL() and PMC_IN_KERNEL() macros on amd64 and i386. On i386, correct the lowest kernel address.
* MFC r285663, r285664, r285667:markj2015-07-211-0/+4
| | | | | | | | | Ensure that locstat_nsecs() has no effect when lockstat probes are not enabled or when the profiled lock carries the LO_NOPROFILE flag. PR: 201642, 201517 Approved by: re (gjb) Tested by: Jason Unovitch
* MFC r278166, MFV r266993:pfg2015-06-072-16/+0
| | | | | | | | | | | 4469 DTrace helper tracing should be dynamic Reference: https://illumos.org/issues/4469 Obtained from: Illumos Phabric: D1551 Reviewed by: markj
* MFC r281915:markj2015-05-295-459/+0
| | | | | | | Make vpanic() externally visible. MFC r281916: Fix DTrace's panic() action.
* MFC r275576: remove opensolaris cyclic code, replace with high-precision ↵avg2015-05-115-1865/+169
| | | | callouts
* MFC r280834:markj2015-04-132-2/+44
| | | | Bound the number of frames traversed when executing the ustackdepth action.
* MFC r263710, r273377, r273378, r273423 and r273455:hselasky2014-10-271-2/+2
| | | | | | | - De-vnet hash sizes and hash masks. - Fix multiple issues related to arguments passed to SYSCTL macros. Sponsored by: Mellanox Technologies
* MFC r267851:pfg2014-10-144-84/+1
| | | | | | | | | Continue the crusade towards a dev_clone()-free kernel, removing its usage from dtrace. The dtrace code already uses cdevpriv(9) since FreeBSD 8, so this change is quite harmless. Originally by: davide Reviewed by: markj
* MFC r266103grehan2014-08-191-17/+188
| | | | | | | | | | | | | | | | | | | | | | | | | Update dis_tables.c to the latest Illumos version. This includes decodes of recent Intel instructions, in particular VT-x and related instructions. This allows the FBT provider to locate the exit points of routines that include these new instructions. Illumos issues: 3414 Need a new word of AT_SUN_HWCAP bits 3415 Add isainfo support for f16c and rdrand 3416 Need disassembler support for rdrand and f16c 3413 isainfo -v overflows 80 columns 3417 mdb disassembler confuses rdtscp for invlpg 1518 dis should support AMD SVM/AMD-V/Pacifica instructions 1096 i386 disassembler should understand complex nops 1362 add kvmstat for monitoring of KVM statistics 1363 add vmregs[] variable to DTrace 1364 need disassembler support for VMX instructions 1365 mdb needs 16-bit disassembler support This corresponds to Illumos-gate (github) version eb23829ff08a873c612ac45d191d559394b4b408
* MFC r267759, r267761markj2014-08-053-20/+16
| | | | | | | | | | | | | | | | | | | | | | r267759: Fix a couple of bugs on amd64 when fetching probe arguments beyond the first five for probes entered through a UD fault (i.e. FBT probes). Specifically, handle the fact that dtrace_invop_callsite must be 16 byte-aligned and thus may not immediately follow the call to dtrace_invop() in dtrace_invop_start(). Also fetch register arguments and the stack pointer through a struct trapframe instead of a struct reg. r267761: Fix some bugs when fetching probe arguments in i386. Firstly ensure that the 4 byte-aligned dtrace_invop_callsite can be found and that it immediately follows the call to dtrace_invop(). Secondly, fix some pointer arithmetic to account for differences between struct i386_frame and illumos' struct frame. Finally, ensure that dtrace_getarg() isn't inlined. It works by following a fixed number of frame pointers to the probe site, so inlining breaks it. PR: 191260
* MFC r267706:markj2014-08-051-16/+17
| | | | | | Allow creation of SDT probes from a module in which no providers are defined. This ensures that the sdt:zfs:: probes appear despite the fact the sdt provider is defined in the kernel rather than in zfs.ko.
* MFC r256822:markj2014-08-041-1/+21
| | | | | | | | | When fetching function arguments out of a frame on amd64, explicitly select the register based on the argument index rather than relying on the fields in struct reg to be in the right order. This assumption is incorrect on FreeBSD and generally led to bogus argument values for the sixth argument of PID and USDT probes; the first five are passed directly to dtrace_probe() via the fasttrap trap handler and so were correctly handled.
* MFC r256571:markj2014-08-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | Add a function, memstr, which can be used to convert a buffer of null-separated strings to a single string. This can be used to print the full arguments of a process using execsnoop (from the DTrace toolkit) or with the following one-liner: dtrace -n 'syscall::execve:return {trace(curpsinfo->pr_psargs);}' Note that this relies on the process arguments being cached via the struct proc, which means that it will not work for argvs longer than kern.ps_arg_cache_limit. However, the following rather non-portable script can be used to extract any argv at exec time: fbt::kern_execve:entry { printf("%s", memstr(args[1]->begin_argv, ' ', args[1]->begin_envv - args[1]->begin_argv)); } The debug.dtrace.memstr_max sysctl limits the maximum argument size to memstr().
* MFC r264434:markj2014-07-311-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DTrace's pid provider works by inserting breakpoint instructions at probe sites and installing a hook at the kernel's trap handler. The fasttrap code will emulate the overwritten instruction in some common cases, but otherwise copies it out into some scratch space in the traced process' address space and ensures that it's executed after returning from the trap. In Solaris and illumos, this (per-thread) scratch space comes from some reserved space in TLS, accessible via the fs segment register. This approach is somewhat unappealing on FreeBSD since it would require some modifications to rtld and jemalloc (for static TLS) to ensure that TLS is executable, and would thus introduce dependencies on their implementation details. I think it would also be impossible to safely trace static binaries compiled without these modifications. This change implements the functionality in a different way, by having fasttrap map pages into the target process' address space on demand. Each page is divided into 64-byte chunks for use by individual threads, and fasttrap's process descriptor struct has been extended to keep track of any scratch space allocated for the corresponding process. With this change it's possible to trace all libc functions in a program, e.g. with pid$target:libc.so.*::entry {@[probefunc] = count();} Previously this would generally cause the victim process to crash, as tracing memcpy on amd64 requires the functionality described above.
* MFC r264435:markj2014-07-291-1/+7
| | | | | Ensure that all eight syscall arguments are available to dtrace_probe(), rather than just the first five.
* MFC 267929, 267937, 267939, 267940, 267941, 267942, 267987, 268006:rpaulo2014-07-121-0/+1
| | | | | | | | | | | | | | | | 2915 DTrace in a zone should see "cpu", "curpsinfo", et al 2916 DTrace in a zone should be able to access fds[] 2917 DTrace in a zone should have limited provider access 4477 DTrace should speak JSON Add stubs for CTF functions which are not yet implemented. 4474 DTrace Userland CTF Support 4475 DTrace userland Keyword 4476 DTrace tests should be better citizens 4479 pid provider types 4480 dof emulation is missing checks 4471 DTrace count() with histogram 4472 DTrace full width distribution histograms 4473 DTrace frequency trails
* MFC r262665:markj2014-05-152-2/+12
| | | | | | | Expose a few DTrace parameters as sysctls under kern.dtrace and add descriptions for several existing sysctls. PR: 187027
* MFC r262543:markj2014-05-031-0/+51
| | | | | Fix the struct reg mappings for i386 and amd64, which differ between illumos and FreeBSD.
* MFC r262542:markj2014-05-036-5078/+0
| | | | | Move some files that are identical on i386 and amd64 to an x86 subdirectory rather than keeping duplicate copies.
* MFC r260132: Allocate the probe ID unrhdr before the DTrace kld_* eventavg2014-02-171-2/+2
| | | | handlers are registered
* MFC r257417: Remove references to an unused fasttrap probe hookavg2014-02-171-8/+0
|
* MFC r257152: Do some cleanup of the SDT codeavg2014-02-171-71/+68
|
* MFC r258622: dtrace sdt: remove the ugly sname parameter of SDT_PROBE_DEFINEavg2014-01-172-2/+15
|
* MFC r256543,r259245,r259421,r259668,r259674jhibbits2014-01-151-2/+2
| | | | | | | | | | | | | | | | | | | r256543: Add fasttrap for PowerPC. This is the last piece of the DTrace/ppc puzzle. It's incomplete, it doesn't contain full instruction emulation, but it should be sufficient for most cases. r259245,r259421: (FBT) FBT now does work fully on PowerPC. Save r3 before using it for the trap check, else we end up saving the new r3, containing the trap instruction encoding (0x7c810808), and restoring it back with the frame on return. This caused it to panic on my ppc32 machine. r259668,r259674: Fix a typo in the FBT code.
* Initialize and free the DTrace taskqueue in the dtrace module load/unloadmarkj2013-10-082-0/+4
| | | | | | | | | | | | handlers rather than in the dtrace device open/close methods. The current approach can cause a panic if the device is closed which the taskqueue thread is active, or if a kernel module containing a provider is unloaded while retained enablings are present and the dtrace device isn't opened. Submitted by: gibbs (original version) Reviewed by: gibbs Approved by: re (glebius) MFC after: 2 weeks
* - Use make_dev_credf(MAKEDEV_REF) instead of the race-prone make_dev()+davide2013-09-071-5/+1
| | | | | | | | dev_ref() in the clone handlers that still use it. - Don't set SI_CHEAPCLONE flag, it's not used anywhere neither in devfs (for anything real) Reviewed by: kib
* Whitespace cleanup.jhibbits2013-09-021-48/+48
|
* Fixes for DTrace on PowerPC:jhibbits2013-08-313-112/+261
| | | | | | - Implement dtrace_getarg() - Sync fbt with x86, and fix a typo. - Pull in the time synchronization code from amd64.
* Rename the kld_unload event handler to kld_unload_try, and add a newmarkj2013-08-243-9/+9
| | | | | | | | | | | | | | kld_unload event handler which gets invoked after a linker file has been successfully unloaded. The kld_unload and kld_load event handlers are now invoked with the shared linker lock held, while kld_unload_try is invoked with the lock exclusively held. Convert hwpmc(4) to use these event handlers instead of having kern_kldload() and kern_kldunload() invoke hwpmc(4) hooks whenever files are loaded or unloaded. This has no functional effect, but simplifes the linker code somewhat. Reviewed by: jhb
* fbt: drop a local write-only variableavg2013-08-231-6/+0
| | | | | Discovered with: gcc46 MFC after: 4 days
* Make dtrace_copy() actually work on PowerPC. Although unused currently,jhibbits2013-08-221-4/+4
| | | | it may be used in the future by dtrace.
* Fix some ppc64 dtrace bugs, and enable systrace_freebsd32 for ppc64.jhibbits2013-08-192-0/+15
|
* Add a "translated type" argument to SDT_PROBE_ARGTYPE() and add some macrosmarkj2013-08-171-2/+6
| | | | | | | | | | | which allow one to define SDT probes that specify translated types. The idea is to make it easy to write SDT probe definitions that can work across multiple operating systems. In particular, this makes it possible to port illumos SDT probes to FreeBSD without changing their argument types, so long as the appropriate translators are defined. Then DTrace scripts written for Solaris/illumos will work on FreeBSD without any changes. MFC after: 1 week
* Use kld_{load,unload} instead of mod_{load,unload} for the linker file loadmarkj2013-08-143-23/+23
| | | | | | | and unload event handlers added in r254266. Reported by: jhb X-MFC with: r254266
* FreeBSD's DTrace implementation has a few problems with respect to handlingmarkj2013-08-134-79/+227
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | probes declared in a kernel module when that module is unloaded. In particular, * Unloading a module with active SDT probes will cause a panic. [1] * A module's (FBT/SDT) probes aren't destroyed when the module is unloaded; trying to use them after the fact will generally cause a panic. This change fixes both problems by porting the DTrace module load/unload handlers from illumos and registering them with the corresponding EVENTHANDLER(9) handlers. This allows the DTrace framework to destroy all probes defined in a module when that module is unloaded, and to prevent a module unload from proceeding if some of its probes are active. The latter problem has already been fixed for FBT probes by checking lf->nenabled in kern_kldunload(), but moving the check into the DTrace framework generalizes it to all kernel providers and also fixes a race in the current implementation (since a probe may be activated between the check and the call to linker_file_unload()). Additionally, the SDT implementation has been reworked to define SDT providers/probes/argtypes in linker sets rather than using SYSINIT/SYSUNINIT to create and destroy SDT probes when a module is loaded or unloaded. This simplifies things quite a bit since it means that pretty much all of the SDT code can live in sdt.ko, and since it becomes easier to integrate SDT with the DTrace framework. Furthermore, this allows FreeBSD to be quite flexible in that SDT providers spanning multiple modules can be created on the fly when a module is loaded; at the moment it looks like illumos' SDT implementation requires all SDT probes to be statically defined in a single kernel table. PR: 166927, 166926, 166928 Reported by: davide [1] Reviewed by: avg, trociny (earlier version) MFC after: 1 month
* opensolaris code: translate INVARIANTS to DEBUG and ZFS_DEBUGavg2013-08-062-0/+4
| | | | | | | | | | | | | | | | Do this by forcing inclusion of sys/cddl/compat/opensolaris/sys/debug_compat.h via -include option into all source files from OpenSolaris. Note that this -include option must always be after -include opt_global.h. Additionally, remove forced definition of DEBUG for some modules and fix their build without DEBUG. Also, meaning of DEBUG was overloaded to enable WITNESS support for some OpenSolaris (primarily ZFS) locks. Now this overloading is removed and that use of DEBUG is replaced with a new option OPENSOLARIS_WITNESS. MFC after: 17 days
* dtrace disassembler: take the latest/last CDDL code from OpenSolarisavg2013-07-294-388/+3680
| | | | | | | | | | | OpenSolaris version is: 13108:33bb8a0301ab 6762020 Disassembly support for Intel Advanced Vector Extensions (AVX) This corresponds to Illumos-gate (github) version ab47273fedff893c8ae22ec39ffc666d4fa6fc8b MFC after: 3 weeks
* Hide references to mod_lock. In FreeBSD it is always acquired with themarkj2013-07-053-9/+8
| | | | provider lock held, so its use has no effect.
* The dtmalloc provider uses the short description of a malloc type as themarkj2013-06-281-0/+10
| | | | | | | | function name of its corresponding DTrace probes. These descriptions may contain whitespace, but probe names cannot, so just replace any whitespace with underscores when creating probes. MFC after: 1 week
* SDT probes can directly pass up to five arguments as arguments tomarkj2013-06-022-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dtrace_probe(). Arguments beyond these five must be obtained in an architecture-specific way; this can be done through the getargval provider method, and through dtrace_getarg() if getargval isn't overridden. This change fixes two off-by-one bugs in the way these arguments are fetched in FreeBSD's DTrace implementation. First, the SDT provider must set the aframes parameter to 1 when creating a probe. The aframes parameter controls the number of frames that dtrace_getarg() will step over in order to find the frame containing the extra arguments. On FreeBSD, dtrace_getarg() is called in SDT probe context via dtrace_probe()->dtrace_dif_emulate()->dtrace_dif_variable->dtrace_getarg() so aframes must be 3 since the arguments are in dtrace_probe()'s frame; it was previously being called with a value of 2 instead. illumos uses a different aframes value for SDT probes, but this is because illumos SDT probes fire by triggering the #UD fault handler rather than calling dtrace_probe() directly. The second bug has to do with the way arguments are grabbed out dtrace_probe()'s frame on amd64. The code currently jumps over the first stack argument and retrieves the rest of them using a pointer into the stack. This works on i386 because all of dtrace_probe()'s arguments will be on the stack and the first argument is the probe ID, which should be ignored. However, it is incorrect to ignore the first stack argument on amd64, so we correct the pointer used to access the arguments. MFC after: 2 weeks
* Port the SDT test now that it's possible to create SDT probes that takemarkj2013-06-021-0/+37
| | | | | | | | | | | | seven arguments. The original test uses Solaris' uadmin system call to trigger the test probe; this change adds a sysctl to the dtrace_test module and gets the test program to trigger the test probe via the sysctl handler. The test is currently failing on amd64 because of some bugs in the way that probe arguments beyond the first five are obtained - these bugs will be fixed in a separate change.
* Bring back part of r249367 by adding DTrace's temporal option, which allowsmarkj2013-05-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | users to guarantee that the output of DTrace scripts will be time-ordered. This option is enabled by adding the line #pragma D option temporal to the beginning of a script, or by adding '-x temporal' to the arguments of dtrace(1). This change fixes a bug in the original port of the temporal option. This bug was causing some assertions to fail, so they had been disabled; in this revision the assertions are working properly and are enabled. The DTrace version number has been bumped from 1.9.0 to 1.9.1 to reflect the language change that's being introduced. This change corresponds to part of illumos-gate commit e5803b76927480: 3021 option for time-ordered output from dtrace(1M) Reviewed by: pfg Obtained from: illumos MFC after: 1 month
* fbt_getargdesc: correctly handle types for return probesavg2013-03-231-5/+17
| | | | MFC after: 6 days
OpenPOWER on IntegriCloud