Actions
Bug #4653
closednet hooks registered with HH_BEFORE or HH_AFTER hints create invalid hint_value kstats
Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
kernel
Start date:
2014-03-01
Due date:
% Done:
100%
Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
Description
If you create a net hook with a hint of HH_BEFORE or HH_AFTER, the kstat for that hook is invalid. Specifically, the hint_value kstat_named_t (hook_hintvalue in hook_hook_kstat_t) is created as KSTAT_DATA_STRING, but no extra space is allocated in the parent kstat.
This manifests itself as the kstat command dumping core if you run it when the hooks are enabled:
> $c libc.so.1`strlen+0x30(64ddab0, 1, 8047d08, 83c71b8) safe_strdup+0x50(64ddab0, 83c71b8, 83c71d8, 1, 83c7048, 80c8558) save_named+0x9d(80c8558, 83c7048, 0, a) ks_instances_read+0x28f(806e108, fef804f0, feef56d0, 8056554, 87, 0) main+0x5a3(8047ddc, fef6e7c8, 8047e18, 8053773, 1, 8047e24) _start+0x83(1, 8047edc, 0, 8047ee2, 8047f08, 8047f0f)
The kstat that the kstat command chokes on has an invalid pointer to the string, 0x64ddab0:
> 80c8558::print kstat_t { ks_crtime = 0x4c1452ce7a07 ks_next = 0x80c85f8 ks_kid = 0x8d3 ks_module = [ "inet/NIC_EVENTS" ] ks_resv = 0 ks_instance = 0 ks_name = [ "ipfilter_hook4_nicevents" ] ks_type = 0x1 ks_class = [ "hook" ] ks_flags = 0x1 ks_data = 0x83c7158 ks_ndata = 0x6 ks_data_size = 0x120 ks_snaptime = 0x4c1630ea4eca ks_update = 0 ks_private = 0 ks_snapshot = 0 ks_lock = 0 } > (0x83c7158 + 0x30 * 3::print kstat_named_t { name = [ "hint_value" ] data_type = 0x9 value = { c = [ '\\\\260', '\\\\332', 'M', '\\\\006', '\\\\0', '\\\\0', '\\\\0', '\\\\0', '\\\\034', '\\\\0', '\\\\0', '\\\\0', '\\\\0', '\\\\0', '\\\\0', '\\\\0' ] i32 = 0x64ddab0 ui32 = 0x64ddab0 str = { addr = { ptr = 0x64ddab0 __pad = [ '\\\\260', '\\\\332', 'M', '\\\\006', '\\\\0', '\\\\0', '\\\\0', '\\\\0' ] } len = 0x0 } i64 = 0x64ddab0 ui64 = 0x64ddab0 l = 0x64ddab0 ul = 0x64ddab0 ll = 0x64ddab0 ull = 0x64ddab0 f = +3.8716881e-35 d = +5.2255126e-316 } }
Updated by Robert Mustacchi about 8 years ago
- Status changed from New to Resolved
Updated by Electric Monk about 8 years ago
git commit 652fb50dec8e8b074b60a3c82d00248a2aeb5eb9
Author: Rob Gulewich <robert.gulewich@joyent.com> 4653 net hooks registered with HH_BEFORE or HH_AFTER hints create invalid hint_value kstats Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Dan McDonald <danmcd@omniti.com> Approved by: Richard Lowe <richlowe@richlowe.net>
Actions