Skip to contentSkip to conversation

master - dmsetup: do not suppress kernel key descriptions in tables

PATCH okozina 1 participant 1 message Feb 10, 2017

lore
Share & tools
lore

okozina

author
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=035c614c195b08398df3403c4bbd3d986cca68c3
Commit:        035c614c195b08398df3403c4bbd3d986cca68c3
Parent:        baba3f8e2a1c6f6fcfcefaa06e87872ff63cac6d
Author:        Ondrej Kozina <[email protected]>
AuthorDate:    Fri Feb 10 13:19:22 2017 +0100
Committer:     Ondrej Kozina <[email protected]>
CommitterDate: Fri Feb 10 19:18:49 2017 +0100

dmsetup: do not suppress kernel key descriptions in tables

Kernel 4.10 (dm-crypt v1.15.0) and later supports loading device tables with crypt segment having key in kernel keyring retention service.

dmsetup hid key section of tables output. With this patch dmsetup no longer hides key section if it detects kernel key description instead of hex byte representation of key itself.

---
 WHATS_NEW_DM                  |    1 +
 man/dmsetup.8.in              |    6 ++-
 test/shell/dmsetup-keyring.sh |   72 +++++++++++++++++++++++++++++++++++++++++
 tools/dmsetup.c               |   11 +++++-
 4 files changed, 86 insertions(+), 4 deletions(-)
WHATS_NEW_DM +1 -0
index 4903de3..ac2d420 100644
@@ -1,5 +1,6 @@
 Version 1.02.138 - 
 =====================================
+  Do not suppress kernel key description in dmsetup table output.
   Support configurable command executed from dmeventd thin plugin.
   Support new R|r human readable units output format.
   Thin dmeventd plugin reacts faster on lvextend failure path with umount.
man/dmsetup.8.in +4 -2
index 8aa0ff7..36a6d74 100644
@@ -820,8 +820,10 @@ Outputs the current table for the device in a format that can be fed
 back in using the create or load commands.
 With \fB\-\-target\fP, only information relating to the specified target type
 is displayed.
-Encryption keys are suppressed in the table output for the crypt
-target unless the \fB\-\-showkeys\fP parameter is supplied.
+Real encryption keys are suppressed in the table output for the crypt
+target unless the \fB\-\-showkeys\fP parameter is supplied. Kernel key
+references prefixed with \fB:\fP are not affected by the parameter and get
+displayed always.
 .
 .HP
 .CMD_TARGETS
test/shell/dmsetup-keyring.sh new file +72 -0

72 lines not on this page · raw message

tools/dmsetup.c +9 -2
index c9549c6..6464069 100644
@@ -2197,8 +2197,15 @@ static int _status(CMD_ARGS)
 						c++;
 					if (*c)
 						c++;
-					while (*c && *c != ' ')
-						*c++ = '0';
+					/*
+					 * Do not suppress kernel key references prefixed
+					 * with colon ':'. Displaying those references is
+					 * harmless. crypt target supports kernel keys
+					 * starting with v1.15.0 (merged in kernel 4.10)
+					 */
+					if (*c != ':')
+						while (*c && *c != ' ')
+							*c++ = '0';
 				}
 				printf(FMTu64 " " FMTu64 " %s %s",
 				       start, length, target_type, params);