Commit Graph

31 Commits

Author SHA1 Message Date
ad e071d39c84 - Convert hashinit() to use kmem_alloc(). The hash tables can be large
and it's better to not have them in kmem_map.
- Convert a couple of minor items along the way to kmem_alloc().
- Fix some memory leaks.
2008-05-05 17:11:16 +00:00
ad 4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
elad 6700cfccd6 Some Veriexec stuff that's been rotting in my tree for months.
Bug fixes:
  - Fix crash reported by Scott Ellis on current-users@.

  - Fix race conditions in enforcing the Veriexec rename and remove
    policies. These are NOT security issues.

  - Fix memory leak in rename handling when overwriting a monitored
    file.

  - Fix table deletion logic.

  - Don't prevent query requests if not in learning mode.


KPI updates:
  - fileassoc_table_run() now takes a cookie to pass to the callback.

  - veriexec_table_add() was removed, it is now done internally. As a
    result, there's no longer a need for VERIEXEC_TABLESIZE.

  - veriexec_report() was removed, it is now internal.

  - Perform sanity checks on the entry type, and enforce default type
    in veriexec_file_add() rather than in veriexecctl.

  - Add veriexec_flush(), used to delete all Veriexec tables, and
    veriexec_dump(), used to fill an array with all Veriexec entries.


New features:
  - Add a '-k' flag to veriexecctl, to keep the filenames in the kernel
    database. This allows Veriexec to produce slightly more accurate
    logs under certain circumstances. In the future, this can be either
    replaced by vnode->pathname translation, or combined with it.

  - Add a VERIEXEC_DUMP ioctl, to dump the entire Veriexec database.
    This can be used to recover a database if the file was lost.
    Example usage:

        # veriexecctl dump > /etc/signatures

    Note that only entries with the filename kept (that is, were loaded
    with the '-k' flag) will be dumped.

    Idea from Brett Lymn.

  - Add a VERIEXEC_FLUSH ioctl, to delete all Veriexec entries. Sample
    usage:

        # veriexecctl flush

  - Add a 'veriexec_flags' rc(8) variable, and make its default have
    the '-k' flag. On systems using the default signatures file
    (generaetd from running 'veriexecgen' with no arguments), this will
    use additional 32kb of kernel memory on average.

  - Add a '-e' flag to veriexecctl, to evaluate the fingerprint during
    load. This is done automatically for files marked as 'untrusted'.


Misc. stuff:
  - The code for veriexecctl was massively simplified as a result of
    eliminating the need for VERIEXEC_TABLESIZE, and now uses a single
    pass of the signatures file, making the loading somewhat faster.

  - Lots of minor fixes found using the (still under development)
    Veriexec regression testsuite.

  - Some of the messages Veriexec prints were improved.

  - Various documentation fixes.


All relevant man-pages were updated to reflect the above changes.

Binary compatibility with existing veriexecctl binaries is maintained.
2007-05-15 19:47:43 +00:00
rmind 1e2aad36da Revert the latest changes back to 1.25 rev. 2007-04-05 01:33:31 +00:00
rmind 330166a2eb Fix tbl, which was misstyped as tlb. 2007-04-04 11:01:10 +00:00
rmind 5174ef0ece fileassoc_file_delete: Handle an error case of fileassoc_table_lookup().
CID: 4431
2007-04-03 22:29:23 +00:00
yamt fd1a6294d1 fileassoc_table_lookup: call fileassoc_init if it has not been done yet.
fixes crashes sys_unlink when there are no users of fileassoc.
2007-03-09 05:51:50 +00:00
elad 5a6bb5eba2 remove empty line 2007-02-08 16:06:58 +00:00
elad 01b9a124ad - Properly autocreate tables,
- Properly track number of used slots in the table,
- Track number of "assocs" per entry.
2007-02-07 09:38:04 +00:00
elad 119d4b5acd PR/35253: YAMAMOTO Takashi: fileassoc hash size problem
fileassoc_table_add() was removed from the KPI and made internal. From now
fileassoc(9) will manage the optimal table size internally.

Input from and okay yamt@.
2007-02-06 01:09:48 +00:00
elad 4f9ade2efc Add missing specificdata_key_delete() in fileassoc_deregister(). 2007-01-26 12:36:46 +00:00
elad 73a4d95bb6 Update comment: device -> mount. No functional change. 2007-01-25 13:57:28 +00:00
elad d2e4f7167b Remove advertising clause from all of my stuff. 2007-01-09 12:49:36 +00:00
elad 8daca39031 Fix a comment. No functional change. 2006-12-26 08:55:32 +00:00
yamt e49bb7c765 - remove the fileassoc "tabledata" functionality. use mountspecific instead.
- make pax_segvguard_cb static.

tested and ok'ed by elad.
2006-12-23 08:35:43 +00:00
yamt 4cfe5a1b41 - just associate fileassoc "table" to struct mount.
because the latter is always available during the lifetime of the former,
  there is little point to use another global list to keep track of them.
  it also allows to remove an #ifdef FILEASSOC.

- avoid some operations (memory allocation and VOP) in fileassoc_file_lookup,
  when fileassoc table is not used.

ok'ed by elad.
2006-12-14 09:24:54 +00:00
yamt e4e829e9d1 make fileassoc_tables static. 2006-12-12 14:22:07 +00:00
yamt b0a14e5934 - remove a static configuration, FILEASSOC_NHOOKS. do it dynamically instead.
- make fileassoc_t a pointer and remove FILEASSOC_INVAL.
- clean up kern_fileassoc.c.  unify duplicated code.
- unexport fileassoc_init using RUN_ONCE(9).
- plug memory leaks in fileassoc_file_delete and fileassoc_table_delete.
- always call callbacks, regardless of the value of the associated data.

ok'ed by elad.
2006-12-11 15:24:27 +00:00
yamt 4d5f3128d9 don't expose FILEASSOC_NHOOKS. 2006-12-08 13:23:22 +00:00
elad 9a87be9622 compare pointer against null, not zero 2006-11-20 21:50:51 +00:00
elad 145a8382e1 Don't leak handle. 2006-10-27 22:17:09 +00:00
blymn 6395103101 * Correct hashing macro so it uses FHANDLE_SIZE()
* Stop fhandle memory leaks and use the correct fhandle dealloc routine
  (thanks to Elad for these fixes)
* Remove include of kmem.h, it is not required.
2006-09-08 13:57:38 +00:00
blymn c09e9ac5fb * Remove "hinted" interface
* Modify fileassoc internals to use fhandle_t instead of fileid
2006-09-06 13:37:49 +00:00
blymn 50abf3c730 Add functions to the fileassoc interface to allow a "hint" to be provided
instead of performing an implicit VOP_GETATTR() when adding/looking up
fileassoc entries.
2006-08-20 10:38:23 +00:00
xtraeme dfa8fac821 Add __KERNEL_RCSID() 2006-08-13 06:21:10 +00:00
christos ce0ef6cfc4 Pretending to be Elad's keyboard:
fileassoc.diff adds a fileassoc_table_run() routine that allows you to
pass a callback to be called with every entry on a given mount.

veriexec.diff adds some raw device access policies: if raw disk is
opened at strict level 1, all fingerprints on this disk will be
invalidated as a safety measure. level 2 will not allow opening disk
for raw writing if we monitor it, and prevent raw writes to memory.
level 3 will not allow opening any disk for raw writing.

both update all relevant documentation.

veriexec concept is okay blymn@.
2006-08-11 19:17:47 +00:00
ad f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
cube 2d03dc4c3e Fix an obvious overlook (struct fileassoc_hook is not defined in
fileassoc.h anymore).  I could say "please compile-test", but then, I'm not
doing it either for that commit.
2006-07-20 09:00:41 +00:00
elad 9be7229906 expose less api; prompted by yamt@. 2006-07-16 19:37:55 +00:00
elad e3f6ad54bf dont use magic numbers. 2006-07-15 16:42:12 +00:00
elad b5d09ef065 okay, since there was no way to divide this to two commits, here it goes..
introduce fileassoc(9), a kernel interface for associating meta-data with
files using in-kernel memory. this is very similar to what we had in
veriexec till now, only abstracted so it can be used more easily by more
consumers.

this also prompted the redesign of the interface, making it work on vnodes
and mounts and not directly on devices and inodes. internally, we still
use file-id but that's gonna change soon... the interface will remain
consistent.

as a result, veriexec went under some heavy changes to conform to the new
interface. since we no longer use device numbers to identify file-systems,
the veriexec sysctl stuff changed too: kern.veriexec.count.dev_N is now
kern.veriexec.tableN.* where 'N' is NOT the device number but rather a
way to distinguish several mounts.

also worth noting is the plugging of unmount/delete operations
wrt/fileassoc and veriexec.

tons of input from yamt@, wrstuden@, martin@, and christos@.
2006-07-14 18:41:40 +00:00