sys/dev: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - error
sys/dev: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - errorprone - task.The Software Package Data Exchange (SPDX) group provides a specificationto make it easier for automated tools to detect and summarize well knownopensource licenses. We are gradually adopting the specification, notingthat the tags are considered only advisory and do not, in any way,superceed or replace the license texts.
show more ...
Remove D_TRACKCLOSE now that ksyms no longer has a close method.Reported by: jhbX-MFC with: r321963
Rework and simplify the ksyms(4) implementation.- 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
Rework and simplify the ksyms(4) implementation.- 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 <[email protected]> [1]Reviewed by: kib (previous revision)MFC after: 1 weekDifferential Revision: https://reviews.freebsd.org/D11789
Fix style bugs in ksyms.c.No functional change intended.MFC after: 3 days
Restrict permissions on /dev/ksyms to 0400.The ksyms(4) device was added specifically for use by lockstat(1), whichas a DTrace consumer must run as root.Discussed with: emasteMFC after: 3 days
Streamline use of cdevpriv and correct some corner cases.1) It is not useful to call "devfs_clear_cdevpriv()" from"d_close" callbacks, hence for example read, write, ioctl andso on might be sleep
Streamline use of cdevpriv and correct some corner cases.1) It is not useful to call "devfs_clear_cdevpriv()" from"d_close" callbacks, hence for example read, write, ioctl andso on might be sleeping at the time of "d_close" being calledand 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 willbe freed twice, if open fails, first by code in the openroutine, secondly by the cdevpriv destructor. Move registrationof the cdevpriv to the end of the drm open routines.3) devfs_clear_cdevpriv() is not called if the "d_open" callbackregistered cdevpriv data and the "d_open" callback functionreturned an error. Fix this.Discussed with: phkMFC after: 2 weeks
Get rid of D_PSEUDO.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'sno need to keep it there.While
Get rid of D_PSEUDO.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'sno need to keep it there.While there, remove an unneeded D_NEEDMINOR from the gpio driver.Discussed with: gonzo@ (gpio)
Promote ksyms_map() and ksyms_unmap() to general facilitycopyout_map() and copyout_unmap() interfaces.Submitted by: John Wehle <john feith com>, noxMFC after: 2 weeks
Update d_mmap() to accept vm_ooffset_t and vm_memattr_t.This replaces d_mmap() with the d_mmap2() implementation and alsochanges the type of offset to vm_ooffset_t.Purge d_mmap2().All driver m
Update d_mmap() to accept vm_ooffset_t and vm_memattr_t.This replaces d_mmap() with the d_mmap2() implementation and alsochanges the type of offset to vm_ooffset_t.Purge d_mmap2().All driver modules will need to be rebuilt since D_VERSION is alsobumped.Reviewed by: jhb@MFC after: Not in this lifetime...
(S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.Fix some wrong usages.Note: this does not affect generated binaries as this argument is not used.PR: 137213Submitted by: Eygene Ryab
(S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.Fix some wrong usages.Note: this does not affect generated binaries as this argument is not used.PR: 137213Submitted by: Eygene Ryabinkin (initial version)MFC after: 1 month
strict kobj signatures: linker_if fixesin symtab_get method symtab parameter is made constant as this reflectsactual intention and usage of the methodReviewed by: imp, current@Approved by: jhb
strict kobj signatures: linker_if fixesin symtab_get method symtab parameter is made constant as this reflectsactual intention and usage of the methodReviewed by: imp, current@Approved by: jhb (mentor)
Remove another d_thread_t use that crept in.
Change from using vm_map_delete() to vm_map_remove().Approved by: gnn (mentor)Obtained from: kib
Add the ksyms(4) pseudo driver. The ksyms driver allows a process toget a quick snapshot of the kernel's symbol table including the symbolsfrom any loaded modules (the symbols are all merged into
Add the ksyms(4) pseudo driver. The ksyms driver allows a process toget a quick snapshot of the kernel's symbol table including the symbolsfrom any loaded modules (the symbols are all merged into one symboltable). Unlike like other implementations, this ksyms driver mapsmemory 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 alreadya snapshot open and won't allow it to open /dev/ksyms it again until itcloses first. This prevents kernel and process memory from beingexhausted. Note that /dev/ksyms is used by the lockstat(1) command.Reviewed by: gallatin kib (freebsd-arch)Approved by: gnn (mentor)