Project

General

Profile

Bug #7941

cannot use crypto lofi on a block/character device

Added by Josef Sipek over 2 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
2017-03-06
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

This looks like a regression from #6602 (labeled lofi).

# lofiadm -c aes-256-cbc -a /dev/rdsk/c2t0d0
lofiadm: cannot use lofi on itself

With this quick hack, everything works fine:

diff --git a/usr/src/cmd/lofiadm/main.c b/usr/src/cmd/lofiadm/main.c
index db1dad6..9007f21 100644
--- a/usr/src/cmd/lofiadm/main.c
+++ b/usr/src/cmd/lofiadm/main.c
@@ -302,10 +302,6 @@ name_to_minor(const char *devicename)
         return (0);
     }

-    if (st.st_mode & S_IFCHR || st.st_mode & S_IFBLK) {
-        return (LOFI_MINOR2ID(minor(st.st_rdev)));
-    }
-
     return (0);
 }


Related issues

Related to illumos gate - Feature #6602: lofi should support labeled devicesClosed2016-02-03

Actions

History

#1

Updated by Josef Sipek over 2 years ago

  • Related to Feature #6602: lofi should support labeled devices added
#2

Updated by Toomas Soome over 1 year ago

  • Category changed from driver - device drivers to cmd - userland programs
  • Status changed from New to In Progress
  • Assignee set to Toomas Soome
  • % Done changed from 0 to 90
  • Tags deleted (needs-triage)

Josef Sipek wrote:

This looks like a regression from #6602 (labeled lofi).

[...]

With this quick hack, everything works fine:

[...]

The problem is that this code is about how to determine if this node is actually lofi device or not. Luckily here we can use modctl interface (it is also available for local zones).

#3

Updated by Toomas Soome about 1 year ago

The original code was assuming that all lofi mappings are created only as devices in /dev/lofi tree, the 6602 did assume we could use LOFI_MINOR2ID() macro to extract the id for mapped device, but this approach does not work for labeled case, because minor number does not identify the device driver (such identification was previously done by checking /dev/lofi prefix in the device name).

So we want to use modctl(MODGETNAME) to query the driver name first, if it is "lofi", we use LOFI_MINOR2ID() macro to create ID from minor number.

#4

Updated by Electric Monk about 1 year ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit 35f80dcb41f3a97bbb452a00537b4a72e7dc9996

commit  35f80dcb41f3a97bbb452a00537b4a72e7dc9996
Author: Toomas Soome <tsoome@me.com>
Date:   2018-05-14T17:45:20.000Z

    7941 cannot use crypto lofi on a block/character device
    Reviewed by: Andy Fiddaman <omnios@citrus-it.co.uk>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF