Project

General

Profile

Actions

Bug #7941

closed

cannot use crypto lofi on a block/character device

Added by Josef Sipek almost 7 years ago. Updated over 5 years ago.

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

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

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 devicesClosedToomas Soome2016-02-03

Actions
Actions #1

Updated by Josef Sipek almost 7 years ago

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

Updated by Toomas Soome over 5 years 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).

Actions #3

Updated by Toomas Soome over 5 years 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.

Actions #4

Updated by Electric Monk over 5 years 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>

Actions

Also available in: Atom PDF