Go to file
pgoyette cb32a134a5 Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
  the kernel and in the structures used for exporting the history data
  to userland via sysctl(9).  This avoids problems on some architectures
  where passing a 64-bit (or larger) value to printf(3) can cause it to
  process the value as multiple arguments.  (This can be particularly
  problematic when printf()'s format string is not a literal, since in
  that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
  include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
  updated.  Each format specifier now includes an explicit length
  modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
  updated to replace uses of "%p" with "%#jx", and the pointer
  arguments are now cast to (uintptr_t) before being subsequently cast
  to (uintmax_t).  This is needed to avoid compiler warnings about
  casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
  "%c" format strings replaced with numeric formats; several instances
  of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
  history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
  the -u option does not exist (previously, this condition was silently
  ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
  data exported via sysctl(9) and exits if they do not match the values
  with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
  requirements imposed on the format strings, along with several other
  minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
    uint64_t) for the history arguments.  But that would require another
    "rototill" of all the users in the future when we add support for an
    architecture that supports a larger size.  Also, the printf(3) format
    specifiers for explicitly-sized values, such as "%"PRIu64, are much
    more verbose (and less aesthetically appealing, IMHO) than simply
    using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
    but it is possible that I've missed some of them.  I would be glad to
    update any stragglers that anyone identifies.
2017-10-28 00:37:11 +00:00
bin Use %zu for size_t 2017-10-25 08:50:05 +00:00
common Simplify, and comment out xrefs to non-existing pages. 2017-10-23 00:59:44 +00:00
compat Don't mix abis in any CRUNCHEDPROG 2017-01-05 21:28:42 +00:00
crypto PR/52604: Tatoku Ogaito: Fix x11 session forwarding. 2017-10-09 12:07:03 +00:00
dist/pf PR 50709 David Binderman: memory leak 2016-05-30 17:21:07 +00:00
distrib Add man page for bwfm(4) 2017-10-26 07:29:52 +00:00
doc Note addition of bwfm(4) 2017-10-25 19:27:06 +00:00
etc /tmp/t 2017-10-25 07:41:35 +00:00
external unbound reloads config on SIGHUP, so add the reload command 2017-10-25 09:13:41 +00:00
extsrc
games Include time.h for time. Drop sys/types.h and expect basic working 2017-10-02 22:03:10 +00:00
include Add endian.h header. Simply includes sys/endian.h 2017-10-16 11:38:25 +00:00
lib Add NULL check after doing memory allocation at a couple of places 2017-10-27 18:16:09 +00:00
libexec fix to compile without USE_PAM. (unused variables) 2017-10-07 19:23:02 +00:00
regress Don't test call gates, they are not supported anymore. 2017-08-30 15:46:19 +00:00
rescue Extra flags for static PIE 2017-10-08 15:02:33 +00:00
sbin user librumpres 2017-10-10 19:30:06 +00:00
share Update the kernhist(9) kernel history code to address issues identified 2017-10-28 00:37:11 +00:00
sys Update the kernhist(9) kernel history code to address issues identified 2017-10-28 00:37:11 +00:00
tests The Zone test was obviously intended to test %Z rather than %z, otherwise 2017-10-27 05:14:11 +00:00
tools use the variable for the source dir instead of duplicating it. 2017-10-04 21:42:20 +00:00
usr.bin Update the kernhist(9) kernel history code to address issues identified 2017-10-28 00:37:11 +00:00
usr.sbin New sentence, new line. 2017-10-23 01:07:27 +00:00
build.sh Better validation of var name args to -V and -Z, in a way that makes 2017-10-08 01:05:13 +00:00
BUILDING regen 2017-10-21 23:49:28 +00:00
Makefile Add NOBINARIES, useful to build tools are libraries which is what's needed 2017-10-04 23:54:33 +00:00
Makefile.inc
UPDATING Note possible need to clean objdir (or depends at least) for 2017-10-13 07:04:58 +00:00