dm-ima.rst 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  1. ======
  2. dm-ima
  3. ======
  4. For a given system, various external services/infrastructure tools
  5. (including the attestation service) interact with it - both during the
  6. setup and during rest of the system run-time. They share sensitive data
  7. and/or execute critical workload on that system. The external services
  8. may want to verify the current run-time state of the relevant kernel
  9. subsystems before fully trusting the system with business-critical
  10. data/workload.
  11. Device mapper plays a critical role on a given system by providing
  12. various important functionalities to the block devices using various
  13. target types like crypt, verity, integrity etc. Each of these target
  14. types’ functionalities can be configured with various attributes.
  15. The attributes chosen to configure these target types can significantly
  16. impact the security profile of the block device, and in-turn, of the
  17. system itself. For instance, the type of encryption algorithm and the
  18. key size determines the strength of encryption for a given block device.
  19. Therefore, verifying the current state of various block devices as well
  20. as their various target attributes is crucial for external services before
  21. fully trusting the system with business-critical data/workload.
  22. IMA kernel subsystem provides the necessary functionality for
  23. device mapper to measure the state and configuration of
  24. various block devices -
  25. - by device mapper itself, from within the kernel,
  26. - in a tamper resistant way,
  27. - and re-measured - triggered on state/configuration change.
  28. Setting the IMA Policy:
  29. =======================
  30. For IMA to measure the data on a given system, the IMA policy on the
  31. system needs to be updated to have following line, and the system needs
  32. to be restarted for the measurements to take effect.
  33. ::
  34. /etc/ima/ima-policy
  35. measure func=CRITICAL_DATA label=device-mapper template=ima-buf
  36. The measurements will be reflected in the IMA logs, which are located at:
  37. ::
  38. /sys/kernel/security/integrity/ima/ascii_runtime_measurements
  39. /sys/kernel/security/integrity/ima/binary_runtime_measurements
  40. Then IMA ASCII measurement log has the following format:
  41. ::
  42. <PCR> <TEMPLATE_DATA_DIGEST> <TEMPLATE_NAME> <TEMPLATE_DATA>
  43. PCR := Platform Configuration Register, in which the values are registered.
  44. This is applicable if TPM chip is in use.
  45. TEMPLATE_DATA_DIGEST := Template data digest of the IMA record.
  46. TEMPLATE_NAME := Template name that registered the integrity value (e.g. ima-buf).
  47. TEMPLATE_DATA := <ALG> ":" <EVENT_DIGEST> <EVENT_NAME> <EVENT_DATA>
  48. It contains data for the specific event to be measured,
  49. in a given template data format.
  50. ALG := Algorithm to compute event digest
  51. EVENT_DIGEST := Digest of the event data
  52. EVENT_NAME := Description of the event (e.g. 'dm_table_load').
  53. EVENT_DATA := The event data to be measured.
  54. |
  55. | *NOTE #1:*
  56. | The DM target data measured by IMA subsystem can alternatively
  57. be queried from userspace by setting DM_IMA_MEASUREMENT_FLAG with
  58. DM_TABLE_STATUS_CMD.
  59. |
  60. | *NOTE #2:*
  61. | The Kernel configuration CONFIG_IMA_DISABLE_HTABLE allows measurement of duplicate records.
  62. | To support recording duplicate IMA events in the IMA log, the Kernel needs to be configured with
  63. CONFIG_IMA_DISABLE_HTABLE=y.
  64. Supported Device States:
  65. ========================
  66. Following device state changes will trigger IMA measurements:
  67. 1. Table load
  68. #. Device resume
  69. #. Device remove
  70. #. Table clear
  71. #. Device rename
  72. 1. Table load:
  73. ---------------
  74. When a new table is loaded in a device's inactive table slot,
  75. the device information and target specific details from the
  76. targets in the table are measured.
  77. The IMA measurement log has the following format for 'dm_table_load':
  78. ::
  79. EVENT_NAME := "dm_table_load"
  80. EVENT_DATA := <dm_version_str> ";" <device_metadata> ";" <table_load_data>
  81. dm_version_str := "dm_version=" <N> "." <N> "." <N>
  82. Same as Device Mapper driver version.
  83. device_metadata := <device_name> "," <device_uuid> "," <device_major> "," <device_minor> ","
  84. <minor_count> "," <num_device_targets> ";"
  85. device_name := "name=" <dm-device-name>
  86. device_uuid := "uuid=" <dm-device-uuid>
  87. device_major := "major=" <N>
  88. device_minor := "minor=" <N>
  89. minor_count := "minor_count=" <N>
  90. num_device_targets := "num_targets=" <N>
  91. dm-device-name := Name of the device. If it contains special characters like '\', ',', ';',
  92. they are prefixed with '\'.
  93. dm-device-uuid := UUID of the device. If it contains special characters like '\', ',', ';',
  94. they are prefixed with '\'.
  95. table_load_data := <target_data>
  96. Represents the data (as name=value pairs) from various targets in the table,
  97. which is being loaded into the DM device's inactive table slot.
  98. target_data := <target_data_row> | <target_data><target_data_row>
  99. target_data_row := <target_index> "," <target_begin> "," <target_len> "," <target_name> ","
  100. <target_version> "," <target_attributes> ";"
  101. target_index := "target_index=" <N>
  102. Represents nth target in the table (from 0 to N-1 targets specified in <num_device_targets>)
  103. If all the data for N targets doesn't fit in the given buffer - then the data that fits
  104. in the buffer (say from target 0 to x) is measured in a given IMA event.
  105. The remaining data from targets x+1 to N-1 is measured in the subsequent IMA events,
  106. with the same format as that of 'dm_table_load'
  107. i.e. <dm_version_str> ";" <device_metadata> ";" <table_load_data>.
  108. target_begin := "target_begin=" <N>
  109. target_len := "target_len=" <N>
  110. target_name := Name of the target. 'linear', 'crypt', 'integrity' etc.
  111. The targets that are supported for IMA measurements are documented below in the
  112. 'Supported targets' section.
  113. target_version := "target_version=" <N> "." <N> "." <N>
  114. target_attributes := Data containing comma separated list of name=value pairs of target specific attributes.
  115. For instance, if a linear device is created with the following table entries,
  116. # dmsetup create linear1
  117. 0 2 linear /dev/loop0 512
  118. 2 2 linear /dev/loop0 512
  119. 4 2 linear /dev/loop0 512
  120. 6 2 linear /dev/loop0 512
  121. Then IMA ASCII measurement log will have the following entry:
  122. (converted from ASCII to text for readability)
  123. 10 a8c5ff755561c7a28146389d1514c318592af49a ima-buf sha256:4d73481ecce5eadba8ab084640d85bb9ca899af4d0a122989252a76efadc5b72
  124. dm_table_load
  125. dm_version=4.45.0;
  126. name=linear1,uuid=,major=253,minor=0,minor_count=1,num_targets=4;
  127. target_index=0,target_begin=0,target_len=2,target_name=linear,target_version=1.4.0,device_name=7:0,start=512;
  128. target_index=1,target_begin=2,target_len=2,target_name=linear,target_version=1.4.0,device_name=7:0,start=512;
  129. target_index=2,target_begin=4,target_len=2,target_name=linear,target_version=1.4.0,device_name=7:0,start=512;
  130. target_index=3,target_begin=6,target_len=2,target_name=linear,target_version=1.4.0,device_name=7:0,start=512;
  131. 2. Device resume:
  132. ------------------
  133. When a suspended device is resumed, the device information and the hash of the
  134. data from previous load of an active table are measured.
  135. The IMA measurement log has the following format for 'dm_device_resume':
  136. ::
  137. EVENT_NAME := "dm_device_resume"
  138. EVENT_DATA := <dm_version_str> ";" <device_metadata> ";" <active_table_hash> ";" <current_device_capacity> ";"
  139. dm_version_str := As described in the 'Table load' section above.
  140. device_metadata := As described in the 'Table load' section above.
  141. active_table_hash := "active_table_hash=" <table_hash_alg> ":" <table_hash>
  142. Rerpresents the hash of the IMA data being measured for the
  143. active table for the device.
  144. table_hash_alg := Algorithm used to compute the hash.
  145. table_hash := Hash of the (<dm_version_str> ";" <device_metadata> ";" <table_load_data> ";")
  146. as described in the 'dm_table_load' above.
  147. Note: If the table_load data spans across multiple IMA 'dm_table_load'
  148. events for a given device, the hash is computed combining all the event data
  149. i.e. (<dm_version_str> ";" <device_metadata> ";" <table_load_data> ";")
  150. across all those events.
  151. current_device_capacity := "current_device_capacity=" <N>
  152. For instance, if a linear device is resumed with the following command,
  153. #dmsetup resume linear1
  154. then IMA ASCII measurement log will have an entry with:
  155. (converted from ASCII to text for readability)
  156. 10 56c00cc062ffc24ccd9ac2d67d194af3282b934e ima-buf sha256:e7d12c03b958b4e0e53e7363a06376be88d98a1ac191fdbd3baf5e4b77f329b6
  157. dm_device_resume
  158. dm_version=4.45.0;
  159. name=linear1,uuid=,major=253,minor=0,minor_count=1,num_targets=4;
  160. active_table_hash=sha256:4d73481ecce5eadba8ab084640d85bb9ca899af4d0a122989252a76efadc5b72;current_device_capacity=8;
  161. 3. Device remove:
  162. ------------------
  163. When a device is removed, the device information and a sha256 hash of the
  164. data from an active and inactive table are measured.
  165. The IMA measurement log has the following format for 'dm_device_remove':
  166. ::
  167. EVENT_NAME := "dm_device_remove"
  168. EVENT_DATA := <dm_version_str> ";" <device_active_metadata> ";" <device_inactive_metadata> ";"
  169. <active_table_hash> "," <inactive_table_hash> "," <remove_all> ";" <current_device_capacity> ";"
  170. dm_version_str := As described in the 'Table load' section above.
  171. device_active_metadata := Device metadata that reflects the currently loaded active table.
  172. The format is same as 'device_metadata' described in the 'Table load' section above.
  173. device_inactive_metadata := Device metadata that reflects the inactive table.
  174. The format is same as 'device_metadata' described in the 'Table load' section above.
  175. active_table_hash := Hash of the currently loaded active table.
  176. The format is same as 'active_table_hash' described in the 'Device resume' section above.
  177. inactive_table_hash := Hash of the inactive table.
  178. The format is same as 'active_table_hash' described in the 'Device resume' section above.
  179. remove_all := "remove_all=" <yes_no>
  180. yes_no := "y" | "n"
  181. current_device_capacity := "current_device_capacity=" <N>
  182. For instance, if a linear device is removed with the following command,
  183. #dmsetup remove l1
  184. then IMA ASCII measurement log will have the following entry:
  185. (converted from ASCII to text for readability)
  186. 10 790e830a3a7a31590824ac0642b3b31c2d0e8b38 ima-buf sha256:ab9f3c959367a8f5d4403d6ce9c3627dadfa8f9f0e7ec7899299782388de3840
  187. dm_device_remove
  188. dm_version=4.45.0;
  189. device_active_metadata=name=l1,uuid=,major=253,minor=2,minor_count=1,num_targets=2;
  190. device_inactive_metadata=name=l1,uuid=,major=253,minor=2,minor_count=1,num_targets=1;
  191. active_table_hash=sha256:4a7e62efaebfc86af755831998b7db6f59b60d23c9534fb16a4455907957953a,
  192. inactive_table_hash=sha256:9d79c175bc2302d55a183e8f50ad4bafd60f7692fd6249e5fd213e2464384b86,remove_all=n;
  193. current_device_capacity=2048;
  194. 4. Table clear:
  195. ----------------
  196. When an inactive table is cleared from the device, the device information and a sha256 hash of the
  197. data from an inactive table are measured.
  198. The IMA measurement log has the following format for 'dm_table_clear':
  199. ::
  200. EVENT_NAME := "dm_table_clear"
  201. EVENT_DATA := <dm_version_str> ";" <device_inactive_metadata> ";" <inactive_table_hash> ";" <current_device_capacity> ";"
  202. dm_version_str := As described in the 'Table load' section above.
  203. device_inactive_metadata := Device metadata that was captured during the load time inactive table being cleared.
  204. The format is same as 'device_metadata' described in the 'Table load' section above.
  205. inactive_table_hash := Hash of the inactive table being cleared from the device.
  206. The format is same as 'active_table_hash' described in the 'Device resume' section above.
  207. current_device_capacity := "current_device_capacity=" <N>
  208. For instance, if a linear device's inactive table is cleared,
  209. #dmsetup clear l1
  210. then IMA ASCII measurement log will have an entry with:
  211. (converted from ASCII to text for readability)
  212. 10 77d347408f557f68f0041acb0072946bb2367fe5 ima-buf sha256:42f9ca22163fdfa548e6229dece2959bc5ce295c681644240035827ada0e1db5
  213. dm_table_clear
  214. dm_version=4.45.0;
  215. name=l1,uuid=,major=253,minor=2,minor_count=1,num_targets=1;
  216. inactive_table_hash=sha256:75c0dc347063bf474d28a9907037eba060bfe39d8847fc0646d75e149045d545;current_device_capacity=1024;
  217. 5. Device rename:
  218. ------------------
  219. When an device's NAME or UUID is changed, the device information and the new NAME and UUID
  220. are measured.
  221. The IMA measurement log has the following format for 'dm_device_rename':
  222. ::
  223. EVENT_NAME := "dm_device_rename"
  224. EVENT_DATA := <dm_version_str> ";" <device_active_metadata> ";" <new_device_name> "," <new_device_uuid> ";" <current_device_capacity> ";"
  225. dm_version_str := As described in the 'Table load' section above.
  226. device_active_metadata := Device metadata that reflects the currently loaded active table.
  227. The format is same as 'device_metadata' described in the 'Table load' section above.
  228. new_device_name := "new_name=" <dm-device-name>
  229. dm-device-name := Same as <dm-device-name> described in 'Table load' section above
  230. new_device_uuid := "new_uuid=" <dm-device-uuid>
  231. dm-device-uuid := Same as <dm-device-uuid> described in 'Table load' section above
  232. current_device_capacity := "current_device_capacity=" <N>
  233. E.g 1: if a linear device's name is changed with the following command,
  234. #dmsetup rename linear1 --setuuid 1234-5678
  235. then IMA ASCII measurement log will have an entry with:
  236. (converted from ASCII to text for readability)
  237. 10 8b0423209b4c66ac1523f4c9848c9b51ee332f48 ima-buf sha256:6847b7258134189531db593e9230b257c84f04038b5a18fd2e1473860e0569ac
  238. dm_device_rename
  239. dm_version=4.45.0;
  240. name=linear1,uuid=,major=253,minor=2,minor_count=1,num_targets=1;new_name=linear1,new_uuid=1234-5678;
  241. current_device_capacity=1024;
  242. E.g 2: if a linear device's name is changed with the following command,
  243. # dmsetup rename linear1 linear=2
  244. then IMA ASCII measurement log will have an entry with:
  245. (converted from ASCII to text for readability)
  246. 10 bef70476b99c2bdf7136fae033aa8627da1bf76f ima-buf sha256:8c6f9f53b9ef9dc8f92a2f2cca8910e622543d0f0d37d484870cb16b95111402
  247. dm_device_rename
  248. dm_version=4.45.0;
  249. name=linear1,uuid=1234-5678,major=253,minor=2,minor_count=1,num_targets=1;
  250. new_name=linear\=2,new_uuid=1234-5678;
  251. current_device_capacity=1024;
  252. Supported targets:
  253. ==================
  254. Following targets are supported to measure their data using IMA:
  255. 1. cache
  256. #. crypt
  257. #. integrity
  258. #. linear
  259. #. mirror
  260. #. multipath
  261. #. raid
  262. #. snapshot
  263. #. striped
  264. #. verity
  265. 1. cache
  266. ---------
  267. The 'target_attributes' (described as part of EVENT_DATA in 'Table load'
  268. section above) has the following data format for 'cache' target.
  269. ::
  270. target_attributes := <target_name> "," <target_version> "," <metadata_mode> "," <cache_metadata_device> ","
  271. <cache_device> "," <cache_origin_device> "," <writethrough> "," <writeback> ","
  272. <passthrough> "," <no_discard_passdown> ";"
  273. target_name := "target_name=cache"
  274. target_version := "target_version=" <N> "." <N> "." <N>
  275. metadata_mode := "metadata_mode=" <cache_metadata_mode>
  276. cache_metadata_mode := "fail" | "ro" | "rw"
  277. cache_device := "cache_device=" <cache_device_name_string>
  278. cache_origin_device := "cache_origin_device=" <cache_origin_device_string>
  279. writethrough := "writethrough=" <yes_no>
  280. writeback := "writeback=" <yes_no>
  281. passthrough := "passthrough=" <yes_no>
  282. no_discard_passdown := "no_discard_passdown=" <yes_no>
  283. yes_no := "y" | "n"
  284. E.g.
  285. When a 'cache' target is loaded, then IMA ASCII measurement log will have an entry
  286. similar to the following, depicting what 'cache' attributes are measured in EVENT_DATA
  287. for 'dm_table_load' event.
  288. (converted from ASCII to text for readability)
  289. dm_version=4.45.0;name=cache1,uuid=cache_uuid,major=253,minor=2,minor_count=1,num_targets=1;
  290. target_index=0,target_begin=0,target_len=28672,target_name=cache,target_version=2.2.0,metadata_mode=rw,
  291. cache_metadata_device=253:4,cache_device=253:3,cache_origin_device=253:5,writethrough=y,writeback=n,
  292. passthrough=n,metadata2=y,no_discard_passdown=n;
  293. 2. crypt
  294. ---------
  295. The 'target_attributes' (described as part of EVENT_DATA in 'Table load'
  296. section above) has the following data format for 'crypt' target.
  297. ::
  298. target_attributes := <target_name> "," <target_version> "," <allow_discards> "," <same_cpu_crypt> ","
  299. <submit_from_crypt_cpus> "," <no_read_workqueue> "," <no_write_workqueue> ","
  300. <iv_large_sectors> "," <iv_large_sectors> "," [<integrity_tag_size> ","] [<cipher_auth> ","]
  301. [<sector_size> ","] [<cipher_string> ","] <key_size> "," <key_parts> ","
  302. <key_extra_size> "," <key_mac_size> ";"
  303. target_name := "target_name=crypt"
  304. target_version := "target_version=" <N> "." <N> "." <N>
  305. allow_discards := "allow_discards=" <yes_no>
  306. same_cpu_crypt := "same_cpu_crypt=" <yes_no>
  307. submit_from_crypt_cpus := "submit_from_crypt_cpus=" <yes_no>
  308. no_read_workqueue := "no_read_workqueue=" <yes_no>
  309. no_write_workqueue := "no_write_workqueue=" <yes_no>
  310. iv_large_sectors := "iv_large_sectors=" <yes_no>
  311. integrity_tag_size := "integrity_tag_size=" <N>
  312. cipher_auth := "cipher_auth=" <string>
  313. sector_size := "sector_size=" <N>
  314. cipher_string := "cipher_string="
  315. key_size := "key_size=" <N>
  316. key_parts := "key_parts=" <N>
  317. key_extra_size := "key_extra_size=" <N>
  318. key_mac_size := "key_mac_size=" <N>
  319. yes_no := "y" | "n"
  320. E.g.
  321. When a 'crypt' target is loaded, then IMA ASCII measurement log will have an entry
  322. similar to the following, depicting what 'crypt' attributes are measured in EVENT_DATA
  323. for 'dm_table_load' event.
  324. (converted from ASCII to text for readability)
  325. dm_version=4.45.0;
  326. name=crypt1,uuid=crypt_uuid1,major=253,minor=0,minor_count=1,num_targets=1;
  327. target_index=0,target_begin=0,target_len=1953125,target_name=crypt,target_version=1.23.0,
  328. allow_discards=y,same_cpu=n,submit_from_crypt_cpus=n,no_read_workqueue=n,no_write_workqueue=n,
  329. iv_large_sectors=n,cipher_string=aes-xts-plain64,key_size=32,key_parts=1,key_extra_size=0,key_mac_size=0;
  330. 3. integrity
  331. -------------
  332. The 'target_attributes' (described as part of EVENT_DATA in 'Table load'
  333. section above) has the following data format for 'integrity' target.
  334. ::
  335. target_attributes := <target_name> "," <target_version> "," <dev_name> "," <start>
  336. <tag_size> "," <mode> "," [<meta_device> ","] [<block_size> ","] <recalculate> ","
  337. <allow_discards> "," <fix_padding> "," <fix_hmac> "," <legacy_recalculate> ","
  338. <journal_sectors> "," <interleave_sectors> "," <buffer_sectors> ";"
  339. target_name := "target_name=integrity"
  340. target_version := "target_version=" <N> "." <N> "." <N>
  341. dev_name := "dev_name=" <device_name_str>
  342. start := "start=" <N>
  343. tag_size := "tag_size=" <N>
  344. mode := "mode=" <integrity_mode_str>
  345. integrity_mode_str := "J" | "B" | "D" | "R"
  346. meta_device := "meta_device=" <meta_device_str>
  347. block_size := "block_size=" <N>
  348. recalculate := "recalculate=" <yes_no>
  349. allow_discards := "allow_discards=" <yes_no>
  350. fix_padding := "fix_padding=" <yes_no>
  351. fix_hmac := "fix_hmac=" <yes_no>
  352. legacy_recalculate := "legacy_recalculate=" <yes_no>
  353. journal_sectors := "journal_sectors=" <N>
  354. interleave_sectors := "interleave_sectors=" <N>
  355. buffer_sectors := "buffer_sectors=" <N>
  356. yes_no := "y" | "n"
  357. E.g.
  358. When a 'integrity' target is loaded, then IMA ASCII measurement log will have an entry
  359. similar to the following, depicting what 'integrity' attributes are measured in EVENT_DATA
  360. for 'dm_table_load' event.
  361. (converted from ASCII to text for readability)
  362. dm_version=4.45.0;
  363. name=integrity1,uuid=,major=253,minor=1,minor_count=1,num_targets=1;
  364. target_index=0,target_begin=0,target_len=7856,target_name=integrity,target_version=1.10.0,
  365. dev_name=253:0,start=0,tag_size=32,mode=J,recalculate=n,allow_discards=n,fix_padding=n,
  366. fix_hmac=n,legacy_recalculate=n,journal_sectors=88,interleave_sectors=32768,buffer_sectors=128;
  367. 4. linear
  368. ----------
  369. The 'target_attributes' (described as part of EVENT_DATA in 'Table load'
  370. section above) has the following data format for 'linear' target.
  371. ::
  372. target_attributes := <target_name> "," <target_version> "," <device_name> <,> <start> ";"
  373. target_name := "target_name=linear"
  374. target_version := "target_version=" <N> "." <N> "." <N>
  375. device_name := "device_name=" <linear_device_name_str>
  376. start := "start=" <N>
  377. E.g.
  378. When a 'linear' target is loaded, then IMA ASCII measurement log will have an entry
  379. similar to the following, depicting what 'linear' attributes are measured in EVENT_DATA
  380. for 'dm_table_load' event.
  381. (converted from ASCII to text for readability)
  382. dm_version=4.45.0;
  383. name=linear1,uuid=linear_uuid1,major=253,minor=2,minor_count=1,num_targets=1;
  384. target_index=0,target_begin=0,target_len=28672,target_name=linear,target_version=1.4.0,
  385. device_name=253:1,start=2048;
  386. 5. mirror
  387. ----------
  388. The 'target_attributes' (described as part of EVENT_DATA in 'Table load'
  389. section above) has the following data format for 'mirror' target.
  390. ::
  391. target_attributes := <target_name> "," <target_version> "," <nr_mirrors> ","
  392. <mirror_device_data> "," <handle_errors> "," <keep_log> "," <log_type_status> ";"
  393. target_name := "target_name=mirror"
  394. target_version := "target_version=" <N> "." <N> "." <N>
  395. nr_mirrors := "nr_mirrors=" <NR>
  396. mirror_device_data := <mirror_device_row> | <mirror_device_data><mirror_device_row>
  397. mirror_device_row is repeated <NR> times - for <NR> described in <nr_mirrors>.
  398. mirror_device_row := <mirror_device_name> "," <mirror_device_status>
  399. mirror_device_name := "mirror_device_" <X> "=" <mirror_device_name_str>
  400. where <X> ranges from 0 to (<NR> -1) - for <NR> described in <nr_mirrors>.
  401. mirror_device_status := "mirror_device_" <X> "_status=" <mirror_device_status_char>
  402. where <X> ranges from 0 to (<NR> -1) - for <NR> described in <nr_mirrors>.
  403. mirror_device_status_char := "A" | "F" | "D" | "S" | "R" | "U"
  404. handle_errors := "handle_errors=" <yes_no>
  405. keep_log := "keep_log=" <yes_no>
  406. log_type_status := "log_type_status=" <log_type_status_str>
  407. yes_no := "y" | "n"
  408. E.g.
  409. When a 'mirror' target is loaded, then IMA ASCII measurement log will have an entry
  410. similar to the following, depicting what 'mirror' attributes are measured in EVENT_DATA
  411. for 'dm_table_load' event.
  412. (converted from ASCII to text for readability)
  413. dm_version=4.45.0;
  414. name=mirror1,uuid=mirror_uuid1,major=253,minor=6,minor_count=1,num_targets=1;
  415. target_index=0,target_begin=0,target_len=2048,target_name=mirror,target_version=1.14.0,nr_mirrors=2,
  416. mirror_device_0=253:4,mirror_device_0_status=A,
  417. mirror_device_1=253:5,mirror_device_1_status=A,
  418. handle_errors=y,keep_log=n,log_type_status=;
  419. 6. multipath
  420. -------------
  421. The 'target_attributes' (described as part of EVENT_DATA in 'Table load'
  422. section above) has the following data format for 'multipath' target.
  423. ::
  424. target_attributes := <target_name> "," <target_version> "," <nr_priority_groups>
  425. ["," <pg_state> "," <priority_groups> "," <priority_group_paths>] ";"
  426. target_name := "target_name=multipath"
  427. target_version := "target_version=" <N> "." <N> "." <N>
  428. nr_priority_groups := "nr_priority_groups=" <NPG>
  429. priority_groups := <priority_groups_row>|<priority_groups_row><priority_groups>
  430. priority_groups_row := "pg_state_" <X> "=" <pg_state_str> "," "nr_pgpaths_" <X> "=" <NPGP> ","
  431. "path_selector_name_" <X> "=" <string> "," <priority_group_paths>
  432. where <X> ranges from 0 to (<NPG> -1) - for <NPG> described in <nr_priority_groups>.
  433. pg_state_str := "E" | "A" | "D"
  434. <priority_group_paths> := <priority_group_paths_row> | <priority_group_paths_row><priority_group_paths>
  435. priority_group_paths_row := "path_name_" <X> "_" <Y> "=" <string> "," "is_active_" <X> "_" <Y> "=" <is_active_str>
  436. "fail_count_" <X> "_" <Y> "=" <N> "," "path_selector_status_" <X> "_" <Y> "=" <path_selector_status_str>
  437. where <X> ranges from 0 to (<NPG> -1) - for <NPG> described in <nr_priority_groups>,
  438. and <Y> ranges from 0 to (<NPGP> -1) - for <NPGP> described in <priority_groups_row>.
  439. is_active_str := "A" | "F"
  440. E.g.
  441. When a 'multipath' target is loaded, then IMA ASCII measurement log will have an entry
  442. similar to the following, depicting what 'multipath' attributes are measured in EVENT_DATA
  443. for 'dm_table_load' event.
  444. (converted from ASCII to text for readability)
  445. dm_version=4.45.0;
  446. name=mp,uuid=,major=253,minor=0,minor_count=1,num_targets=1;
  447. target_index=0,target_begin=0,target_len=2097152,target_name=multipath,target_version=1.14.0,nr_priority_groups=2,
  448. pg_state_0=E,nr_pgpaths_0=2,path_selector_name_0=queue-length,
  449. path_name_0_0=8:16,is_active_0_0=A,fail_count_0_0=0,path_selector_status_0_0=,
  450. path_name_0_1=8:32,is_active_0_1=A,fail_count_0_1=0,path_selector_status_0_1=,
  451. pg_state_1=E,nr_pgpaths_1=2,path_selector_name_1=queue-length,
  452. path_name_1_0=8:48,is_active_1_0=A,fail_count_1_0=0,path_selector_status_1_0=,
  453. path_name_1_1=8:64,is_active_1_1=A,fail_count_1_1=0,path_selector_status_1_1=;
  454. 7. raid
  455. --------
  456. The 'target_attributes' (described as part of EVENT_DATA in 'Table load'
  457. section above) has the following data format for 'raid' target.
  458. ::
  459. target_attributes := <target_name> "," <target_version> "," <raid_type> "," <raid_disks> "," <raid_state>
  460. <raid_device_status> ["," journal_dev_mode] ";"
  461. target_name := "target_name=raid"
  462. target_version := "target_version=" <N> "." <N> "." <N>
  463. raid_type := "raid_type=" <raid_type_str>
  464. raid_disks := "raid_disks=" <NRD>
  465. raid_state := "raid_state=" <raid_state_str>
  466. raid_state_str := "frozen" | "reshape" |"resync" | "check" | "repair" | "recover" | "idle" |"undef"
  467. raid_device_status := <raid_device_status_row> | <raid_device_status_row><raid_device_status>
  468. <raid_device_status_row> is repeated <NRD> times - for <NRD> described in <raid_disks>.
  469. raid_device_status_row := "raid_device_" <X> "_status=" <raid_device_status_str>
  470. where <X> ranges from 0 to (<NRD> -1) - for <NRD> described in <raid_disks>.
  471. raid_device_status_str := "A" | "D" | "a" | "-"
  472. journal_dev_mode := "journal_dev_mode=" <journal_dev_mode_str>
  473. journal_dev_mode_str := "writethrough" | "writeback" | "invalid"
  474. E.g.
  475. When a 'raid' target is loaded, then IMA ASCII measurement log will have an entry
  476. similar to the following, depicting what 'raid' attributes are measured in EVENT_DATA
  477. for 'dm_table_load' event.
  478. (converted from ASCII to text for readability)
  479. dm_version=4.45.0;
  480. name=raid_LV1,uuid=uuid_raid_LV1,major=253,minor=12,minor_count=1,num_targets=1;
  481. target_index=0,target_begin=0,target_len=2048,target_name=raid,target_version=1.15.1,
  482. raid_type=raid10,raid_disks=4,raid_state=idle,
  483. raid_device_0_status=A,
  484. raid_device_1_status=A,
  485. raid_device_2_status=A,
  486. raid_device_3_status=A;
  487. 8. snapshot
  488. ------------
  489. The 'target_attributes' (described as part of EVENT_DATA in 'Table load'
  490. section above) has the following data format for 'snapshot' target.
  491. ::
  492. target_attributes := <target_name> "," <target_version> "," <snap_origin_name> ","
  493. <snap_cow_name> "," <snap_valid> "," <snap_merge_failed> "," <snapshot_overflowed> ";"
  494. target_name := "target_name=snapshot"
  495. target_version := "target_version=" <N> "." <N> "." <N>
  496. snap_origin_name := "snap_origin_name=" <string>
  497. snap_cow_name := "snap_cow_name=" <string>
  498. snap_valid := "snap_valid=" <yes_no>
  499. snap_merge_failed := "snap_merge_failed=" <yes_no>
  500. snapshot_overflowed := "snapshot_overflowed=" <yes_no>
  501. yes_no := "y" | "n"
  502. E.g.
  503. When a 'snapshot' target is loaded, then IMA ASCII measurement log will have an entry
  504. similar to the following, depicting what 'snapshot' attributes are measured in EVENT_DATA
  505. for 'dm_table_load' event.
  506. (converted from ASCII to text for readability)
  507. dm_version=4.45.0;
  508. name=snap1,uuid=snap_uuid1,major=253,minor=13,minor_count=1,num_targets=1;
  509. target_index=0,target_begin=0,target_len=4096,target_name=snapshot,target_version=1.16.0,
  510. snap_origin_name=253:11,snap_cow_name=253:12,snap_valid=y,snap_merge_failed=n,snapshot_overflowed=n;
  511. 9. striped
  512. -----------
  513. The 'target_attributes' (described as part of EVENT_DATA in 'Table load'
  514. section above) has the following data format for 'striped' target.
  515. ::
  516. target_attributes := <target_name> "," <target_version> "," <stripes> "," <chunk_size> ","
  517. <stripe_data> ";"
  518. target_name := "target_name=striped"
  519. target_version := "target_version=" <N> "." <N> "." <N>
  520. stripes := "stripes=" <NS>
  521. chunk_size := "chunk_size=" <N>
  522. stripe_data := <stripe_data_row>|<stripe_data><stripe_data_row>
  523. stripe_data_row := <stripe_device_name> "," <stripe_physical_start> "," <stripe_status>
  524. stripe_device_name := "stripe_" <X> "_device_name=" <stripe_device_name_str>
  525. where <X> ranges from 0 to (<NS> -1) - for <NS> described in <stripes>.
  526. stripe_physical_start := "stripe_" <X> "_physical_start=" <N>
  527. where <X> ranges from 0 to (<NS> -1) - for <NS> described in <stripes>.
  528. stripe_status := "stripe_" <X> "_status=" <stripe_status_str>
  529. where <X> ranges from 0 to (<NS> -1) - for <NS> described in <stripes>.
  530. stripe_status_str := "D" | "A"
  531. E.g.
  532. When a 'striped' target is loaded, then IMA ASCII measurement log will have an entry
  533. similar to the following, depicting what 'striped' attributes are measured in EVENT_DATA
  534. for 'dm_table_load' event.
  535. (converted from ASCII to text for readability)
  536. dm_version=4.45.0;
  537. name=striped1,uuid=striped_uuid1,major=253,minor=5,minor_count=1,num_targets=1;
  538. target_index=0,target_begin=0,target_len=640,target_name=striped,target_version=1.6.0,stripes=2,chunk_size=64,
  539. stripe_0_device_name=253:0,stripe_0_physical_start=2048,stripe_0_status=A,
  540. stripe_1_device_name=253:3,stripe_1_physical_start=2048,stripe_1_status=A;
  541. 10. verity
  542. ----------
  543. The 'target_attributes' (described as part of EVENT_DATA in 'Table load'
  544. section above) has the following data format for 'verity' target.
  545. ::
  546. target_attributes := <target_name> "," <target_version> "," <hash_failed> "," <verity_version> ","
  547. <data_device_name> "," <hash_device_name> "," <verity_algorithm> "," <root_digest> ","
  548. <salt> "," <ignore_zero_blocks> "," <check_at_most_once> ["," <root_hash_sig_key_desc>]
  549. ["," <verity_mode>] ";"
  550. target_name := "target_name=verity"
  551. target_version := "target_version=" <N> "." <N> "." <N>
  552. hash_failed := "hash_failed=" <hash_failed_str>
  553. hash_failed_str := "C" | "V"
  554. verity_version := "verity_version=" <verity_version_str>
  555. data_device_name := "data_device_name=" <data_device_name_str>
  556. hash_device_name := "hash_device_name=" <hash_device_name_str>
  557. verity_algorithm := "verity_algorithm=" <verity_algorithm_str>
  558. root_digest := "root_digest=" <root_digest_str>
  559. salt := "salt=" <salt_str>
  560. salt_str := "-" <verity_salt_str>
  561. ignore_zero_blocks := "ignore_zero_blocks=" <yes_no>
  562. check_at_most_once := "check_at_most_once=" <yes_no>
  563. root_hash_sig_key_desc := "root_hash_sig_key_desc="
  564. verity_mode := "verity_mode=" <verity_mode_str>
  565. verity_mode_str := "ignore_corruption" | "restart_on_corruption" | "panic_on_corruption" | "invalid"
  566. yes_no := "y" | "n"
  567. E.g.
  568. When a 'verity' target is loaded, then IMA ASCII measurement log will have an entry
  569. similar to the following, depicting what 'verity' attributes are measured in EVENT_DATA
  570. for 'dm_table_load' event.
  571. (converted from ASCII to text for readability)
  572. dm_version=4.45.0;
  573. name=test-verity,uuid=,major=253,minor=2,minor_count=1,num_targets=1;
  574. target_index=0,target_begin=0,target_len=1953120,target_name=verity,target_version=1.8.0,hash_failed=V,
  575. verity_version=1,data_device_name=253:1,hash_device_name=253:0,verity_algorithm=sha256,
  576. root_digest=29cb87e60ce7b12b443ba6008266f3e41e93e403d7f298f8e3f316b29ff89c5e,
  577. salt=e48da609055204e89ae53b655ca2216dd983cf3cb829f34f63a297d106d53e2d,
  578. ignore_zero_blocks=n,check_at_most_once=n;