aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ksyms
Commit message (Collapse)AuthorAgeFilesLines
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* vm_ooffset_t is now unsignedEric van Gyzen2020-09-181-1/+1
| | | | | | | | | | | | | vm_ooffset_t is now unsigned. Remove some tests for negative values, or make other adjustments accordingly. Reported by: Coverity Reviewed by: kib markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D26214 Notes: svn path=/head/; revision=365886
* Convert allocations of the phys pager to vm_pager_allocate().Konstantin Belousov2020-09-081-2/+5
| | | | | | | | | | | | | | Future changes would require additional initialization of OBJT_PHYS objects, and vm_object_allocate() is not suitable for it. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D24652 Notes: svn path=/head/; revision=365485
* [PowerPC] More relocation fixesBrandon Bergren2020-06-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out relocating the symbol table itself can cause issues, like fbt crashing because it applies the offsets to the kernel twice. This had been previously brought up in rS333447 when the stoffs hack was added, but I had been unaware of this and reimplemented symtab relocation. Instead of relocating the symbol table, keep track of the relocation base in ddb, so the ddb symbols behave like the kernel linker-provided symbols. This is intended to be NFC on platforms other than PowerPC, which do not use fully relocatable kernels. (The relbase will always be 0) * Remove the rest of the stoffs hack. * Remove my half-baked displace_symbol_table() function. * Extend ddb initialization to cope with having a relocation offset on the kernel symbol table. * Fix my kernel-as-initrd hack to work with booke64 by using a temporary mapping to access the data. * Fix another instance of __powerpc__ that is actually RELOCATABLE_KERNEL. * Change the behavior or X_db_symbol_values to apply the relocation base when updating valp, to match link_elf_symbol_values() behavior. Reviewed by: jhibbits Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D25223 Notes: svn path=/head/; revision=362458
* Convert ksyms(4) to use an OBJT_PHYS object.Mark Johnston2019-11-061-2/+1
| | | | | | | | | | | | | The pages stored in the ksyms object are not pageable. Moreover, this obviates the need to set OBJ_NOSPLIT. Reviewed by: alc, kib MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22229 Notes: svn path=/head/; revision=354402
* Set OBJ_NOSPLIT on the ksyms(4) VM object.Mark Johnston2019-10-231-1/+4
| | | | | | | | | | | | | The object does not provide anonymous memory. Reported by: kib Reviewed by: kib MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22123 Notes: svn path=/head/; revision=353935
* ksyms: Fixup symbols for powerpc in the kernel, not just modulesJustin Hibbits2019-05-201-1/+8
| | | | | | | | | | | | | | | | | | | Summary: PowerPC kernels are fully position independent, just like kernel modules. The same fixups that are done for modules therefore need to be done to the kernel, else symbol resolution in, e.g., DTrace, cannot resolve the kernel symbols, so only addresses in the kernel are printed, while kernel module symbols are printed. Test Plan: Run lockstat on powerpc64. Note symbols are resolved for kernel and modules. Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D20316 Notes: svn path=/head/; revision=347985
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* Remove D_TRACKCLOSE now that ksyms no longer has a close method.Mark Johnston2017-08-031-1/+1
| | | | | | | | Reported by: jhb X-MFC with: r321963 Notes: svn path=/head/; revision=321973
* Rework and simplify the ksyms(4) implementation.Mark Johnston2017-08-031-172/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | - Store the symbol table contents in an anonymous swap-backed object. Have mmap(/dev/ksyms) map that object, and stop mapping the symbol table into the calling process in ksyms_open(). Previously we would cache a pointer to the pmap of the opening process, and mmap(/dev/ksyms) would create a mapping using the physical address found by a pmap lookup at the initial mapping address. However, this assumes that the cached pmap is valid, which may not be the case. [1] - Remove the ksyms ioctl interface. It appears to have been added to work around a limitation in libelf that no longer exists; see r321842. Moreover, the interface is difficult to support and isn't present in illumos. Since ksyms was added specifically to support lockstat(1), it is expected that this removal won't have any real impact. - Simplify ksyms_read() to avoid unnecessary copying. - Don't call the device handle destructor if we fail to capture a snapshot of the kernel's symbol table. devfs will do that for us. Reported by: Ilja van Sprundel <ivansprundel@ioactive.com> [1] Reviewed by: kib (previous revision) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11789 Notes: svn path=/head/; revision=321963
* Fix style bugs in ksyms.c.Mark Johnston2017-07-281-160/+138
| | | | | | | | | No functional change intended. MFC after: 3 days Notes: svn path=/head/; revision=321640
* Restrict permissions on /dev/ksyms to 0400.Mark Johnston2017-07-281-1/+1
| | | | | | | | | | | The ksyms(4) device was added specifically for use by lockstat(1), which as a DTrace consumer must run as root. Discussed with: emaste MFC after: 3 days Notes: svn path=/head/; revision=321639
* Streamline use of cdevpriv and correct some corner cases.Hans Petter Selasky2012-08-151-2/+0
| | | | | | | | | | | | | | | | | | | | | | | 1) It is not useful to call "devfs_clear_cdevpriv()" from "d_close" callbacks, hence for example read, write, ioctl and so on might be sleeping at the time of "d_close" being called and then then freed private data can still be accessed. Examples: dtrace, linux_compat, ksyms (all fixed by this patch) 2) In sys/dev/drm* there are some cases in which memory will be freed twice, if open fails, first by code in the open routine, secondly by the cdevpriv destructor. Move registration of the cdevpriv to the end of the drm open routines. 3) devfs_clear_cdevpriv() is not called if the "d_open" callback registered cdevpriv data and the "d_open" callback function returned an error. Fix this. Discussed with: phk MFC after: 2 weeks Notes: svn path=/head/; revision=239303
* Get rid of D_PSEUDO.Ed Schouten2011-10-181-1/+1
| | | | | | | | | | | | | It seems the D_PSEUDO flag was meant to allow make_dev() to return NULL. Nowadays we have a different interface for that; make_dev_p(). There's no need to keep it there. While there, remove an unneeded D_NEEDMINOR from the gpio driver. Discussed with: gonzo@ (gpio) Notes: svn path=/head/; revision=226500
* Promote ksyms_map() and ksyms_unmap() to general facilityKonstantin Belousov2011-03-281-50/+3
| | | | | | | | | | copyout_map() and copyout_unmap() interfaces. Submitted by: John Wehle <john feith com>, nox MFC after: 2 weeks Notes: svn path=/head/; revision=220100
* Update d_mmap() to accept vm_ooffset_t and vm_memattr_t.Robert Noland2009-12-291-2/+2
| | | | | | | | | | | | | | | | This replaces d_mmap() with the d_mmap2() implementation and also changes the type of offset to vm_ooffset_t. Purge d_mmap2(). All driver modules will need to be rebuilt since D_VERSION is also bumped. Reviewed by: jhb@ MFC after: Not in this lifetime... Notes: svn path=/head/; revision=201223
* (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.Antoine Brodin2009-12-281-1/+1
| | | | | | | | | | | | Fix some wrong usages. Note: this does not affect generated binaries as this argument is not used. PR: 137213 Submitted by: Eygene Ryabinkin (initial version) MFC after: 1 month Notes: svn path=/head/; revision=201145
* strict kobj signatures: linker_if fixesAndriy Gapon2009-06-111-2/+3
| | | | | | | | | | | in symtab_get method symtab parameter is made constant as this reflects actual intention and usage of the method Reviewed by: imp, current@ Approved by: jhb (mentor) Notes: svn path=/head/; revision=194016
* Remove another d_thread_t use that crept in.John Baldwin2009-06-011-1/+1
| | | | Notes: svn path=/head/; revision=193278
* Change from using vm_map_delete() to vm_map_remove().Stacey Son2009-05-271-16/+2
| | | | | | | | Approved by: gnn (mentor) Obtained from: kib Notes: svn path=/head/; revision=192902
* Add the ksyms(4) pseudo driver. The ksyms driver allows a process toStacey Son2009-05-261-0/+678
get a quick snapshot of the kernel's symbol table including the symbols from any loaded modules (the symbols are all merged into one symbol table). Unlike like other implementations, this ksyms driver maps memory in the process memory space to store the snapshot at the time /dev/ksyms is opened. It also checks to see if the process has already a snapshot open and won't allow it to open /dev/ksyms it again until it closes first. This prevents kernel and process memory from being exhausted. Note that /dev/ksyms is used by the lockstat(1) command. Reviewed by: gallatin kib (freebsd-arch) Approved by: gnn (mentor) Notes: svn path=/head/; revision=192859