Bug #7941
closedcannot use crypto lofi on a block/character device
100%
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
Updated by Josef Sipek almost 7 years ago
- Related to Feature #6602: lofi should support labeled devices added
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).
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.
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>